diff options
| author | Matthias Melcher <git@matthiasm.com> | 2021-12-09 02:43:57 +0100 |
|---|---|---|
| committer | Matthias Melcher <git@matthiasm.com> | 2021-12-09 02:48:40 +0100 |
| commit | 4f2febd801eadce214189f119090cbe0bb9c05b1 (patch) | |
| tree | f34dfcaedd4304c73013e7568e85ab9024ab0c4e /fluid/alignment_panel.cxx | |
| parent | 1be158a840922aa03682d39926dc60ecb487063b (diff) | |
Fluid STR 3460.D: Shell commands are now saved in the .fl file (user option)
The shell properties toolbox is completely redesigned:
This dialog box offers a field for a command line and three check buttons
to generate and save various files before the command is run.
If the fourth checkbox, "use settings in .fl design files" is checked,
all shell settings will be store in the current .fl file, and they will
be read and restored when the .fl is loaded again.
Fluid will save different shell settings for different operating system as
it is common that a different OS requires a different shell command.
Fluid comes with default shell settings. Pressing the "save as default" button
will store the current setting in the Fluid app settings and are used for new
designs, or if the "use settings..." box is not checked.
Fluid app settings are saved per user and per machine.
Diffstat (limited to 'fluid/alignment_panel.cxx')
| -rw-r--r-- | fluid/alignment_panel.cxx | 130 |
1 files changed, 81 insertions, 49 deletions
diff --git a/fluid/alignment_panel.cxx b/fluid/alignment_panel.cxx index 8ce1725b0..2fb6dafa3 100644 --- a/fluid/alignment_panel.cxx +++ b/fluid/alignment_panel.cxx @@ -326,30 +326,32 @@ Fl_Double_Window *shell_window=(Fl_Double_Window *)0; Fl_Input *shell_command_input=(Fl_Input *)0; -static void cb_shell_command_input(Fl_Input*, void*) { - fluid_prefs.set("shell_command", shell_command_input->value()); -} +Fl_Check_Button *shell_savefl_button=(Fl_Check_Button *)0; Fl_Check_Button *shell_writecode_button=(Fl_Check_Button *)0; -static void cb_shell_writecode_button(Fl_Check_Button*, void*) { - fluid_prefs.set("shell_writecode", shell_writecode_button->value()); -} - Fl_Check_Button *shell_writemsgs_button=(Fl_Check_Button *)0; -static void cb_shell_writemsgs_button(Fl_Check_Button*, void*) { - fluid_prefs.set("shell_writemsgs", shell_writemsgs_button->value()); +Fl_Check_Button *shell_use_fl_button=(Fl_Check_Button *)0; + +static void cb_shell_use_fl_button(Fl_Check_Button*, void*) { + g_shell_use_fl_settings = shell_use_fl_button->value(); +fluid_prefs.set("shell_use_fl", g_shell_use_fl_settings); } -Fl_Check_Button *shell_savefl_button=(Fl_Check_Button *)0; +static void cb_save(Fl_Button*, void*) { + apply_shell_window(); +shell_prefs_set(); +} -static void cb_shell_savefl_button(Fl_Check_Button*, void*) { - fluid_prefs.set("shell_savefl", shell_savefl_button->value()); +static void cb_Run(Fl_Return_Button*, void*) { + apply_shell_window(); +do_shell_command(NULL, NULL); } static void cb_Cancel(Fl_Button*, void*) { - shell_window->hide(); + shell_command_input->value(g_shell_command); +shell_window->hide(); } Fl_Double_Window *shell_run_window=(Fl_Double_Window *)0; @@ -368,42 +370,72 @@ shell_run_window->hide(); } Fl_Double_Window* make_shell_window() { - { shell_window = new Fl_Double_Window(365, 125, "Shell Command"); - { shell_command_input = new Fl_Input(10, 27, 347, 25, "Command:"); - shell_command_input->labelfont(1); - shell_command_input->callback((Fl_Callback*)cb_shell_command_input); - shell_command_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - char buf[1024]; - fluid_prefs.get("shell_command", buf, "", sizeof(buf)); - shell_command_input->value(buf); - } // Fl_Input* shell_command_input - { shell_writecode_button = new Fl_Check_Button(128, 61, 93, 19, "Write Code"); - shell_writecode_button->down_box(FL_DOWN_BOX); - shell_writecode_button->callback((Fl_Callback*)cb_shell_writecode_button); - int b; - fluid_prefs.get("shell_writecode", b, 1); - shell_writecode_button->value(b); - } // Fl_Check_Button* shell_writecode_button - { shell_writemsgs_button = new Fl_Check_Button(231, 61, 126, 19, "Write Messages"); - shell_writemsgs_button->down_box(FL_DOWN_BOX); - shell_writemsgs_button->callback((Fl_Callback*)cb_shell_writemsgs_button); - int b; - fluid_prefs.get("shell_writemsgs", b, 0); - shell_writemsgs_button->value(b); - } // Fl_Check_Button* shell_writemsgs_button - { shell_savefl_button = new Fl_Check_Button(10, 62, 108, 19, "Save .FL File"); - shell_savefl_button->down_box(FL_DOWN_BOX); - shell_savefl_button->callback((Fl_Callback*)cb_shell_savefl_button); - int b; - fluid_prefs.get("shell_savefl", b, 1); - shell_savefl_button->value(b); - } // Fl_Check_Button* shell_savefl_button - { Fl_Return_Button* o = new Fl_Return_Button(132, 90, 143, 25, "Run Command"); - o->callback((Fl_Callback*)do_shell_command); - } // Fl_Return_Button* o - { Fl_Button* o = new Fl_Button(285, 90, 72, 25, "Cancel"); - o->callback((Fl_Callback*)cb_Cancel); - } // Fl_Button* o + { shell_window = new Fl_Double_Window(365, 200, "Shell Command"); + { Fl_Group* o = new Fl_Group(0, 0, 365, 165); + { shell_command_input = new Fl_Input(82, 14, 277, 20, "Command:"); + shell_command_input->tooltip("external shell command"); + shell_command_input->labelfont(1); + shell_command_input->labelsize(12); + shell_command_input->textfont(4); + shell_command_input->textsize(12); + Fl_Group::current()->resizable(shell_command_input); + } // Fl_Input* shell_command_input + { shell_savefl_button = new Fl_Check_Button(82, 39, 136, 19, "save .fl design file"); + shell_savefl_button->tooltip("save the design to the .fl file before running the command"); + shell_savefl_button->down_box(FL_DOWN_BOX); + shell_savefl_button->labelsize(12); + } // Fl_Check_Button* shell_savefl_button + { shell_writecode_button = new Fl_Check_Button(82, 59, 120, 19, "save source code"); + shell_writecode_button->tooltip("generate the source code and header file before running the command"); + shell_writecode_button->down_box(FL_DOWN_BOX); + shell_writecode_button->labelsize(12); + } // Fl_Check_Button* shell_writecode_button + { shell_writemsgs_button = new Fl_Check_Button(82, 79, 126, 19, "save i18n strings"); + shell_writemsgs_button->tooltip("save the internationalisation string before running the command"); + shell_writemsgs_button->down_box(FL_DOWN_BOX); + shell_writemsgs_button->labelsize(12); + } // Fl_Check_Button* shell_writemsgs_button + { shell_use_fl_button = new Fl_Check_Button(82, 110, 180, 19, "use settings in .fl design files"); + shell_use_fl_button->tooltip("check to read and write shell command from and to .fl files"); + shell_use_fl_button->down_box(FL_DOWN_BOX); + shell_use_fl_button->labelsize(12); + shell_use_fl_button->callback((Fl_Callback*)cb_shell_use_fl_button); + } // Fl_Check_Button* shell_use_fl_button + { Fl_Box* o = new Fl_Box(82, 103, 275, 1); + o->box(FL_BORDER_FRAME); + o->color(FL_FOREGROUND_COLOR); + } // Fl_Box* o + { Fl_Group* o = new Fl_Group(82, 134, 273, 20); + { Fl_Button* o = new Fl_Button(82, 134, 104, 20, "save as default"); + o->tooltip("update the Fluid app settings for external shell commands to the current sett\ +ings"); + o->labelsize(12); + o->callback((Fl_Callback*)cb_save); + } // Fl_Button* o + { Fl_Box* o = new Fl_Box(186, 136, 169, 15); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + o->end(); + } // Fl_Group* o + o->end(); + } // Fl_Group* o + { Fl_Group* o = new Fl_Group(0, 160, 365, 40); + { Fl_Box* o = new Fl_Box(10, 167, 135, 25); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + { Fl_Return_Button* o = new Fl_Return_Button(145, 167, 100, 25, "Run"); + o->tooltip("save selected files and run the command"); + o->labelsize(12); + o->callback((Fl_Callback*)cb_Run); + } // Fl_Return_Button* o + { Fl_Button* o = new Fl_Button(255, 167, 100, 25, "Cancel"); + o->labelsize(12); + o->callback((Fl_Callback*)cb_Cancel); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + shell_window->set_modal(); + shell_window->size_range(365, 200, 365, 200); shell_window->end(); } // Fl_Double_Window* shell_window { shell_run_window = new Fl_Double_Window(555, 430, "Shell Command Output"); |
