Fix and consolidate settings dialogs (#346, #703)

This commit is contained in:
Matthias Melcher
2023-03-19 20:04:01 +01:00
committed by GitHub
parent f9004352b4
commit f37347dd6e
19 changed files with 2095 additions and 1710 deletions
+7
View File
@@ -20,6 +20,7 @@ Subchapters:
\li \ref fluid_i18n \li \ref fluid_i18n
\li \ref fluid_limitations \li \ref fluid_limitations
\li \ref fluid_hotkeys \li \ref fluid_hotkeys
\li \ref fluid_licenses
\section fluid_what_is_fluid What is FLUID? \section fluid_what_is_fluid What is FLUID?
@@ -1679,6 +1680,12 @@ On Apple computers, use the Apple Command key instead of Ctrl.
<tr><td> `Shift-Ctrl-Arrow` </td><td> resize by grid units </td></tr> <tr><td> `Shift-Ctrl-Arrow` </td><td> resize by grid units </td></tr>
</table> </table>
\section fluid_licenses Licenses
FLUID uses graphical images based on the Zendesk Garden Stroke icon set:
<a href="">https://github.com/zendeskgarden</a>.
Garden Stroke is licensed under the Apache License, Version 2.0:
<a href="">https://www.apache.org/licenses/LICENSE-2.0.html</a>.
\htmlonly \htmlonly
<hr> <hr>
+2 -2
View File
@@ -561,8 +561,8 @@ void Fd_Layout_List::update_dialogs() {
assert(current_preset_ < 3); assert(current_preset_ < 3);
layout = list_[current_suite_].layout[current_preset_]; layout = list_[current_suite_].layout[current_preset_];
assert(layout); assert(layout);
if (grid_window) { if (w_settings_layout_tab) {
grid_window->do_callback(grid_window, LOAD); w_settings_layout_tab->do_callback(w_settings_layout_tab, LOAD);
layout_choice->redraw(); layout_choice->redraw();
} }
preset_menu[current_preset_].setonly(preset_menu); preset_menu[current_preset_].setonly(preset_menu);
-2
View File
@@ -164,8 +164,6 @@ Fl_Type *Fl_Menu_Item_Type::make(Strategy strategy) {
} }
if (!o) { if (!o) {
o = new Fl_Button(0,0,100,20); // create template widget o = new Fl_Button(0,0,100,20); // create template widget
o->labelsize(layout->labelsize);
o->labelfont(layout->labelfont);
} }
Fl_Menu_Item_Type* t = submenuflag ? new Fl_Submenu_Type() : new Fl_Menu_Item_Type(); Fl_Menu_Item_Type* t = submenuflag ? new Fl_Submenu_Type() : new Fl_Menu_Item_Type();
+11 -118
View File
@@ -62,10 +62,15 @@ static void update_xywh() {
} }
} }
void i18n_type_cb(Fl_Choice *c, void *) { void i18n_type_cb(Fl_Choice *c, void *v) {
undo_checkpoint(); if (v == LOAD) {
c->value(g_project.i18n_type);
switch (g_project.i18n_type = c->value()) { } else {
undo_checkpoint();
g_project.i18n_type = c->value();
set_modflag(1);
}
switch (g_project.i18n_type) {
case 0 : /* None */ case 0 : /* None */
i18n_include_input->hide(); i18n_include_input->hide();
i18n_conditional_input->hide(); i18n_conditional_input->hide();
@@ -108,83 +113,11 @@ void i18n_type_cb(Fl_Choice *c, void *) {
break; break;
} }
set_modflag(1);
}
void i18n_text_cb(Fl_Input *i, void *) {
undo_checkpoint();
if (i == i18n_function_input)
g_project.i18n_function = i->value();
else if (i == i18n_static_function_input)
g_project.i18n_static_function = i->value();
else if (i == i18n_file_input)
g_project.i18n_file = i->value();
else if (i == i18n_include_input)
g_project.i18n_include = i->value();
else if (i == i18n_conditional_input)
g_project.i18n_conditional = i->value();
set_modflag(1);
}
void i18n_int_cb(Fl_Int_Input *i, void *) {
undo_checkpoint();
if (i == i18n_set_input)
g_project.i18n_set = i->value();
set_modflag(1);
}
void show_project_cb(Fl_Widget *, void *) {
if(project_window==0) make_project_window();
include_H_from_C_button->value(g_project.include_H_from_C);
use_FL_COMMAND_button->value(g_project.use_FL_COMMAND);
utf8_in_src_button->value(g_project.utf8_in_src);
avoid_early_includes_button->value(g_project.avoid_early_includes);
header_file_input->value(g_project.header_file_name.c_str());
code_file_input->value(g_project.code_file_name.c_str());
i18n_type_chooser->value(g_project.i18n_type);
i18n_function_input->value(g_project.i18n_function.c_str());
i18n_static_function_input->value(g_project.i18n_static_function.c_str());
i18n_file_input->value(g_project.i18n_file.c_str());
i18n_set_input->value(g_project.i18n_set.c_str());
i18n_include_input->value(g_project.i18n_include.c_str());
i18n_conditional_input->value(g_project.i18n_conditional.c_str());
switch (g_project.i18n_type) {
case 0 : /* None */
i18n_include_input->hide();
i18n_conditional_input->hide();
i18n_file_input->hide();
i18n_set_input->hide();
i18n_function_input->hide();
i18n_static_function_input->hide();
break;
case 1 : /* GNU gettext */
i18n_include_input->show();
i18n_conditional_input->show();
i18n_file_input->hide();
i18n_set_input->hide();
i18n_function_input->show();
i18n_static_function_input->show();
break;
case 2 : /* POSIX cat */
i18n_include_input->show();
i18n_conditional_input->show();
i18n_file_input->show();
i18n_set_input->show();
i18n_function_input->hide();
i18n_static_function_input->hide();
break;
}
project_window->hotspot(project_window);
project_window->show();
} }
void show_grid_cb(Fl_Widget *, void *) { void show_grid_cb(Fl_Widget *, void *) {
grid_window->hotspot(grid_window); settings_window->show();
grid_window->show(); w_settings_tabs->value(w_settings_layout_tab);
} }
void show_settings_cb(Fl_Widget *, void *) { void show_settings_cb(Fl_Widget *, void *) {
@@ -192,46 +125,6 @@ void show_settings_cb(Fl_Widget *, void *) {
settings_window->show(); settings_window->show();
} }
void header_input_cb(Fl_Input* i, void*) {
if (strcmp(g_project.header_file_name.c_str(), i->value()))
set_modflag(1);
g_project.header_file_name = i->value();
}
void code_input_cb(Fl_Input* i, void*) {
if (strcmp(g_project.code_file_name.c_str(), i->value()))
set_modflag(1);
g_project.code_file_name = i->value();
}
void include_H_from_C_button_cb(Fl_Check_Button* b, void*) {
if (g_project.include_H_from_C != b->value()) {
set_modflag(1);
g_project.include_H_from_C = b->value();
}
}
void use_FL_COMMAND_button_cb(Fl_Check_Button* b, void*) {
if (g_project.use_FL_COMMAND != b->value()) {
set_modflag(1);
g_project.use_FL_COMMAND = b->value();
}
}
void utf8_in_src_cb(Fl_Check_Button *b, void*) {
if (g_project.utf8_in_src != b->value()) {
set_modflag(1);
g_project.utf8_in_src = b->value();
}
}
void avoid_early_includes_cb(Fl_Check_Button *b, void*) {
if (g_project.avoid_early_includes != b->value()) {
set_modflag(1);
g_project.avoid_early_includes = b->value();
}
}
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
Fl_Menu_Item window_type_menu[] = { Fl_Menu_Item window_type_menu[] = {
+1203 -741
View File
File diff suppressed because it is too large Load Diff
+797 -738
View File
File diff suppressed because it is too large Load Diff
+37 -51
View File
@@ -33,47 +33,17 @@
*/ */
void init_scheme(void); void init_scheme(void);
extern struct Fl_Menu_Item *dbmanager_item; extern struct Fl_Menu_Item *dbmanager_item;
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Preferences.H>
#include <FL/Fl_Tooltip.H>
extern Fl_Double_Window *project_window;
#include <FL/Fl_Button.H>
#include <FL/Fl_Tabs.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Input.H>
extern void header_input_cb(Fl_Input*, void*);
extern Fl_Input *header_file_input;
extern void code_input_cb(Fl_Input*, void*);
extern Fl_Input *code_file_input;
#include <FL/Fl_Check_Button.H>
extern void include_H_from_C_button_cb(Fl_Check_Button*, void*);
extern Fl_Check_Button *include_H_from_C_button;
extern void use_FL_COMMAND_button_cb(Fl_Check_Button*, void*);
extern Fl_Check_Button *use_FL_COMMAND_button;
extern void utf8_in_src_cb(Fl_Check_Button*, void*);
extern Fl_Check_Button *utf8_in_src_button;
extern void avoid_early_includes_cb(Fl_Check_Button*, void*);
extern Fl_Check_Button *avoid_early_includes_button;
#include <FL/Fl_Choice.H>
extern void i18n_type_cb(Fl_Choice*, void*);
extern Fl_Choice *i18n_type_chooser;
extern void i18n_text_cb(Fl_Input*, void*);
extern Fl_Input *i18n_include_input;
extern Fl_Input *i18n_conditional_input;
extern Fl_Input *i18n_file_input;
#include <FL/Fl_Int_Input.H>
extern void i18n_int_cb(Fl_Int_Input*, void*);
extern Fl_Int_Input *i18n_set_input;
extern Fl_Input *i18n_function_input;
extern Fl_Input *i18n_static_function_input;
Fl_Double_Window* make_project_window();
extern Fl_Menu_Item menu_i18n_type_chooser[];
extern void i18n_cb(Fl_Choice *,void *); extern void i18n_cb(Fl_Choice *,void *);
extern void scheme_cb(Fl_Scheme_Choice *, void *); extern void scheme_cb(Fl_Scheme_Choice *, void *);
#include <FL/Fl_Double_Window.H>
extern Fl_Double_Window *settings_window; extern Fl_Double_Window *settings_window;
#include <FL/Fl_Tabs.H>
extern Fl_Tabs *w_settings_tabs;
#include <FL/Fl_Group.H>
extern void scheme_cb(Fl_Scheme_Choice*, void*); extern void scheme_cb(Fl_Scheme_Choice*, void*);
extern Fl_Scheme_Choice *scheme_choice; extern Fl_Scheme_Choice *scheme_choice;
#include <FL/Fl_Box.H>
#include <FL/Fl_Check_Button.H>
extern Fl_Check_Button *tooltips_button; extern Fl_Check_Button *tooltips_button;
extern Fl_Check_Button *completion_button; extern Fl_Check_Button *completion_button;
extern Fl_Check_Button *openlast_button; extern Fl_Check_Button *openlast_button;
@@ -82,22 +52,19 @@ extern Fl_Check_Button *show_comments_button;
#include <FL/Fl_Spinner.H> #include <FL/Fl_Spinner.H>
extern Fl_Spinner *recent_spinner; extern Fl_Spinner *recent_spinner;
extern Fl_Check_Button *use_external_editor_button; extern Fl_Check_Button *use_external_editor_button;
#include <FL/Fl_Input.H>
extern Fl_Input *editor_command_input; extern Fl_Input *editor_command_input;
Fl_Double_Window* make_settings_window(); extern Fl_Group *w_settings_project_tab;
extern Fl_Double_Window *shell_window; extern Fl_Input *header_file_input;
extern Fl_Input *shell_command_input; extern Fl_Input *code_file_input;
extern Fl_Check_Button *shell_savefl_button; extern Fl_Check_Button *include_H_from_C_button;
extern Fl_Check_Button *shell_writecode_button; extern Fl_Check_Button *use_FL_COMMAND_button;
extern Fl_Check_Button *shell_writemsgs_button; extern Fl_Check_Button *utf8_in_src_button;
extern Fl_Check_Button *shell_use_fl_button; extern Fl_Check_Button *avoid_early_includes_button;
#include <FL/Fl_Return_Button.H> extern Fl_Group *w_settings_layout_tab;
extern Fl_Double_Window *shell_run_window; #include <FL/Fl_Choice.H>
#include <FL/Fl_Simple_Terminal.H>
extern Fl_Simple_Terminal *shell_run_terminal;
extern Fl_Return_Button *shell_run_button;
Fl_Double_Window* make_shell_window();
extern Fl_Double_Window *grid_window;
extern Fl_Choice *layout_choice; extern Fl_Choice *layout_choice;
#include <FL/Fl_Button.H>
#include <FL/Fl_Menu_Button.H> #include <FL/Fl_Menu_Button.H>
extern Fl_Menu_Button *w_layout_menu; extern Fl_Menu_Button *w_layout_menu;
#include <FL/Fl_Native_File_Chooser.H> #include <FL/Fl_Native_File_Chooser.H>
@@ -106,7 +73,20 @@ extern void edit_layout_preset_cb(Fl_Button*, long);
extern Fl_Button *preset_choice[3]; extern Fl_Button *preset_choice[3];
#include <FL/Fl_Value_Input.H> #include <FL/Fl_Value_Input.H>
extern Fl_Menu_Item fontmenu[]; extern Fl_Menu_Item fontmenu[];
Fl_Double_Window* make_layout_window(); extern Fl_Group *w_settings_shell_tab;
extern Fl_Check_Button *shell_use_fl_button;
#include <FL/Fl_Return_Button.H>
extern Fl_Group *w_settings_i18n_tab;
extern void i18n_type_cb(Fl_Choice*, void*);
extern Fl_Choice *i18n_type_chooser;
extern Fl_Input *i18n_include_input;
extern Fl_Input *i18n_conditional_input;
extern Fl_Input *i18n_file_input;
#include <FL/Fl_Int_Input.H>
extern Fl_Int_Input *i18n_set_input;
extern Fl_Input *i18n_function_input;
extern Fl_Input *i18n_static_function_input;
Fl_Double_Window* make_settings_window();
extern Fl_Menu_Item menu_layout_choice[]; extern Fl_Menu_Item menu_layout_choice[];
extern Fl_Menu_Item menu_w_layout_menu[]; extern Fl_Menu_Item menu_w_layout_menu[];
#define w_layout_menu_rename (menu_w_layout_menu+0) #define w_layout_menu_rename (menu_w_layout_menu+0)
@@ -114,4 +94,10 @@ extern Fl_Menu_Item *w_layout_menu_storage[4];
#define w_layout_menu_load (menu_w_layout_menu+5) #define w_layout_menu_load (menu_w_layout_menu+5)
#define w_layout_menu_save (menu_w_layout_menu+6) #define w_layout_menu_save (menu_w_layout_menu+6)
#define w_layout_menu_delete (menu_w_layout_menu+7) #define w_layout_menu_delete (menu_w_layout_menu+7)
extern Fl_Menu_Item menu_i18n_type_chooser[];
extern Fl_Double_Window *shell_run_window;
#include <FL/Fl_Simple_Terminal.H>
extern Fl_Simple_Terminal *shell_run_terminal;
extern Fl_Return_Button *shell_run_button;
Fl_Double_Window* make_shell_window();
#endif #endif
-5
View File
@@ -296,11 +296,6 @@ void Fd_Project_Reader::read_children(Fl_Type *p, int paste, Strategy strategy,
g_project.i18n_conditional = read_word(); g_project.i18n_conditional = read_word();
goto CONTINUE; goto CONTINUE;
} }
if (!strcmp(c,"i18n_type"))
{
g_project.i18n_type = atoi(read_word());
goto CONTINUE;
}
if (!strcmp(c,"header_name")) { if (!strcmp(c,"header_name")) {
if (!g_project.header_file_set) g_project.header_file_name = read_word(); if (!g_project.header_file_set) g_project.header_file_name = read_word();
else read_word(); else read_word();
+18 -8
View File
@@ -281,6 +281,13 @@ void Fluid_Project::reset() {
code_file_name = ".cxx"; code_file_name = ".cxx";
} }
void Fluid_Project::update_settings_dialog() {
if (settings_window) {
w_settings_project_tab->do_callback(w_settings_project_tab, LOAD);
w_settings_i18n_tab->do_callback(w_settings_i18n_tab, LOAD);
}
}
// ---- Sourceview definition // ---- Sourceview definition
void update_sourceview_position(); void update_sourceview_position();
@@ -635,6 +642,7 @@ void revert_cb(Fl_Widget *,void *) {
if (!read_file(filename, 0)) { if (!read_file(filename, 0)) {
undo_resume(); undo_resume();
widget_browser->rebuild(); widget_browser->rebuild();
g_project.update_settings_dialog();
fl_message("Can't read %s: %s", filename, strerror(errno)); fl_message("Can't read %s: %s", filename, strerror(errno));
return; return;
} }
@@ -642,6 +650,7 @@ void revert_cb(Fl_Widget *,void *) {
undo_resume(); undo_resume();
set_modflag(0, 0); set_modflag(0, 0);
undo_clear(); undo_clear();
g_project.update_settings_dialog();
} }
/** /**
@@ -775,6 +784,7 @@ void open_cb(Fl_Widget *, void *v) {
if (!read_file(c, v!=0)) { if (!read_file(c, v!=0)) {
undo_resume(); undo_resume();
widget_browser->rebuild(); widget_browser->rebuild();
g_project.update_settings_dialog();
fl_message("Can't read %s: %s", c, strerror(errno)); fl_message("Can't read %s: %s", c, strerror(errno));
free((void *)filename); free((void *)filename);
filename = oldfilename; filename = oldfilename;
@@ -794,6 +804,7 @@ void open_cb(Fl_Widget *, void *v) {
undo_clear(); undo_clear();
if (oldfilename) free((void *)oldfilename); if (oldfilename) free((void *)oldfilename);
} }
g_project.update_settings_dialog();
} }
/** /**
@@ -826,6 +837,7 @@ void open_history_cb(Fl_Widget *, void *v) {
free((void *)filename); free((void *)filename);
filename = oldfilename; filename = oldfilename;
if (main_window) main_window->label(filename); if (main_window) main_window->label(filename);
g_project.update_settings_dialog();
return; return;
} }
set_modflag(0, 0); set_modflag(0, 0);
@@ -836,6 +848,7 @@ void open_history_cb(Fl_Widget *, void *v) {
free((void *)oldfilename); free((void *)oldfilename);
oldfilename = 0L; oldfilename = 0L;
} }
g_project.update_settings_dialog();
} }
/** /**
@@ -864,6 +877,7 @@ void new_cb(Fl_Widget *, void *v) {
set_filename(NULL); set_filename(NULL);
set_modflag(0, 0); set_modflag(0, 0);
widget_browser->rebuild(); widget_browser->rebuild();
g_project.update_settings_dialog();
} }
/** /**
@@ -964,6 +978,7 @@ void new_from_template_cb(Fl_Widget *w, void *v) {
} }
widget_browser->rebuild(); widget_browser->rebuild();
g_project.update_settings_dialog();
set_modflag(0); set_modflag(0);
undo_clear(); undo_clear();
} }
@@ -1425,8 +1440,7 @@ Fl_Menu_Item Main_Menu[] = {
{"Hide Guides",FL_COMMAND+FL_SHIFT+'g',toggle_guides}, {"Hide Guides",FL_COMMAND+FL_SHIFT+'g',toggle_guides},
{"Show Widget &Bin...",FL_ALT+'b',toggle_widgetbin_cb}, {"Show Widget &Bin...",FL_ALT+'b',toggle_widgetbin_cb},
{"Show Source Code...",FL_ALT+FL_SHIFT+'s', (Fl_Callback*)toggle_sourceview_cb, 0, FL_MENU_DIVIDER}, {"Show Source Code...",FL_ALT+FL_SHIFT+'s', (Fl_Callback*)toggle_sourceview_cb, 0, FL_MENU_DIVIDER},
{"Pro&ject Settings...",FL_ALT+'p',show_project_cb}, {"Settings...",FL_ALT+'p',show_settings_cb},
{"GU&I Settings...",FL_ALT+FL_SHIFT+'p',show_settings_cb},
{0}, {0},
{"&New", 0, 0, (void *)New_Menu, FL_SUBMENU_POINTER}, {"&New", 0, 0, (void *)New_Menu, FL_SUBMENU_POINTER},
{"&Layout",0,0,0,FL_SUBMENU}, {"&Layout",0,0,0,FL_SUBMENU},
@@ -1612,7 +1626,6 @@ void make_main_window() {
fluid_prefs.get("show_guides", show_guides, 0); fluid_prefs.get("show_guides", show_guides, 0);
fluid_prefs.get("show_comments", show_comments, 1); fluid_prefs.get("show_comments", show_comments, 1);
shell_prefs_get(); shell_prefs_get();
make_layout_window();
make_shell_window(); make_shell_window();
} }
@@ -1812,8 +1825,8 @@ void set_modflag(int mf, int mfc) {
} }
// Enable/disable the Save menu item... // Enable/disable the Save menu item...
if (modflag) save_item->activate(); // if (modflag) save_item->activate();
else save_item->deactivate(); // else save_item->deactivate();
} }
// ---- Sourceview implementation // ---- Sourceview implementation
@@ -2134,9 +2147,6 @@ int main(int argc,char **argv) {
#endif // _WIN32 #endif // _WIN32
undo_clear(); undo_clear();
if (g_shell_command)
::free(g_shell_command);
return (0); return (0);
} }
+1
View File
@@ -86,6 +86,7 @@ public:
Fluid_Project(); Fluid_Project();
~Fluid_Project(); ~Fluid_Project();
void reset(); void reset();
void update_settings_dialog();
int i18n_type; int i18n_type;
Fl_String i18n_include; Fl_String i18n_include;
Binary file not shown.

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

+12 -42
View File
@@ -33,7 +33,7 @@ Shell_Settings shell_settings_linux = { };
Shell_Settings shell_settings_macos = { }; Shell_Settings shell_settings_macos = { };
/// Current shell command, stored in .fl file for each platform, and in app prefs /// Current shell command, stored in .fl file for each platform, and in app prefs
char *g_shell_command = NULL; Fl_String g_shell_command;
/// Save .fl file before running, stored in .fl file for each platform, and in app prefs /// Save .fl file before running, stored in .fl file for each platform, and in app prefs
int g_shell_save_fl = 1; int g_shell_save_fl = 1;
@@ -85,11 +85,7 @@ void shell_settings_read()
#else #else
Shell_Settings &shell_settings = shell_settings_linux; Shell_Settings &shell_settings = shell_settings_linux;
#endif #endif
if (g_shell_command) g_shell_command = shell_settings.command;
free((void*)g_shell_command);
g_shell_command = NULL;
if (shell_settings.command)
g_shell_command = fl_strdup(shell_settings.command);
g_shell_save_fl = ((shell_settings.flags&1)==1); g_shell_save_fl = ((shell_settings.flags&1)==1);
g_shell_save_code = ((shell_settings.flags&2)==2); g_shell_save_code = ((shell_settings.flags&2)==2);
g_shell_save_strings = ((shell_settings.flags&4)==4); g_shell_save_strings = ((shell_settings.flags&4)==4);
@@ -112,8 +108,8 @@ void shell_settings_write()
if (shell_settings.command) if (shell_settings.command)
free((void*)shell_settings.command); free((void*)shell_settings.command);
shell_settings.command = NULL; shell_settings.command = NULL;
if (g_shell_command) if (!g_shell_command.empty())
shell_settings.command = fl_strdup(g_shell_command); shell_settings.command = fl_strdup(g_shell_command.c_str());
shell_settings.flags = 0; shell_settings.flags = 0;
if (g_shell_save_fl) if (g_shell_save_fl)
shell_settings.flags |= 1; shell_settings.flags |= 1;
@@ -244,13 +240,13 @@ void Fl_Process::clean_close(HANDLE& h) {
// Shell command support... // Shell command support...
static bool prepare_shell_command(const char * &command) { // common pre-shell command code all platforms static bool prepare_shell_command() {
shell_window->hide(); // settings_window->hide();
if (s_proc.desc()) { if (s_proc.desc()) {
fl_alert("Previous shell command still running!"); fl_alert("Previous shell command still running!");
return false; return false;
} }
if ((command = g_shell_command) == NULL || !*command) { if (g_shell_command.empty()) {
fl_alert("No shell command entered!"); fl_alert("No shell command entered!");
return false; return false;
} }
@@ -282,17 +278,15 @@ void shell_pipe_cb(FL_SOCKET, void*) {
} }
void do_shell_command(Fl_Return_Button*, void*) { void do_shell_command(Fl_Return_Button*, void*) {
const char *command=NULL; // Command to run if (!prepare_shell_command()) return;
if (!prepare_shell_command(command)) return;
// Show the output window and clear things... // Show the output window and clear things...
shell_run_terminal->text(""); shell_run_terminal->text("");
shell_run_terminal->append(command); shell_run_terminal->append(g_shell_command.c_str());
shell_run_terminal->append("\n"); shell_run_terminal->append("\n");
shell_run_window->label("Shell Command Running..."); shell_run_window->label("Shell Command Running...");
if (s_proc.popen((char *)command) == NULL) { if (s_proc.popen((char *)g_shell_command.c_str()) == NULL) {
fl_alert("Unable to run shell command: %s", strerror(errno)); fl_alert("Unable to run shell command: %s", strerror(errno));
return; return;
} }
@@ -343,31 +337,7 @@ void do_shell_command(Fl_Return_Button*, void*) {
Fluid app settings are saved per user and per machine. Fluid app settings are saved per user and per machine.
*/ */
void show_shell_window() { void show_shell_window() {
update_shell_window(); settings_window->show();
shell_window->hotspot(shell_command_input); w_settings_tabs->value(w_settings_shell_tab);
shell_window->show();
}
/**
Update the shell properties dialog box.
*/
void update_shell_window() {
shell_command_input->value(g_shell_command);
shell_savefl_button->value(g_shell_save_fl);
shell_writecode_button->value(g_shell_save_code);
shell_writemsgs_button->value(g_shell_save_strings);
shell_use_fl_button->value(g_shell_use_fl_settings);
}
/**
Copy the sshe;l settings from the dialog box into the variables.
*/
void apply_shell_window() {
if (g_shell_command)
free((void*)g_shell_command);
g_shell_command = fl_strdup(shell_command_input->value());
g_shell_save_fl = shell_savefl_button->value();
g_shell_save_code = shell_writecode_button->value();
g_shell_save_strings = shell_writemsgs_button->value();
} }
+3 -3
View File
@@ -20,6 +20,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <FL/Fl_String.H>
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
# include <direct.h> # include <direct.h>
# include <windows.h> # include <windows.h>
@@ -32,8 +34,6 @@
#endif #endif
void show_shell_window(); void show_shell_window();
void update_shell_window();
void apply_shell_window();
void do_shell_command(class Fl_Return_Button*, void*); void do_shell_command(class Fl_Return_Button*, void*);
typedef struct { typedef struct {
@@ -45,7 +45,7 @@ extern Shell_Settings shell_settings_windows;
extern Shell_Settings shell_settings_linux; extern Shell_Settings shell_settings_linux;
extern Shell_Settings shell_settings_macos; extern Shell_Settings shell_settings_macos;
extern char *g_shell_command; extern Fl_String g_shell_command;
extern int g_shell_save_fl; extern int g_shell_save_fl;
extern int g_shell_save_code; extern int g_shell_save_code;
extern int g_shell_save_strings; extern int g_shell_save_strings;
+4
View File
@@ -88,6 +88,7 @@ void redo_cb(Fl_Widget *, void *) {
if (!read_file(undo_filename(undo_current + 1), 0)) { if (!read_file(undo_filename(undo_current + 1), 0)) {
// Unable to read checkpoint file, don't redo... // Unable to read checkpoint file, don't redo...
widget_browser->rebuild(); widget_browser->rebuild();
g_project.update_settings_dialog();
undo_resume(); undo_resume();
return; return;
} }
@@ -104,6 +105,7 @@ void redo_cb(Fl_Widget *, void *) {
// Update modified flag... // Update modified flag...
set_modflag(undo_current != undo_save); set_modflag(undo_current != undo_save);
widget_browser->rebuild(); widget_browser->rebuild();
g_project.update_settings_dialog();
// Update undo/redo menu items... // Update undo/redo menu items...
if (undo_current >= undo_last) Main_Menu[redo_item].deactivate(); if (undo_current >= undo_last) Main_Menu[redo_item].deactivate();
@@ -129,6 +131,7 @@ void undo_cb(Fl_Widget *, void *) {
if (!read_file(undo_filename(undo_current - 1), 0)) { if (!read_file(undo_filename(undo_current - 1), 0)) {
// Unable to read checkpoint file, don't undo... // Unable to read checkpoint file, don't undo...
widget_browser->rebuild(); widget_browser->rebuild();
g_project.update_settings_dialog();
undo_resume(); undo_resume();
return; return;
} }
@@ -151,6 +154,7 @@ void undo_cb(Fl_Widget *, void *) {
if (undo_current <= 0) Main_Menu[undo_item].deactivate(); if (undo_current <= 0) Main_Menu[undo_item].deactivate();
Main_Menu[redo_item].activate(); Main_Menu[redo_item].activate();
widget_browser->rebuild(); widget_browser->rebuild();
g_project.update_settings_dialog();
undo_resume(); undo_resume();
} }