diff options
Diffstat (limited to 'fluid/alignment_panel.fl')
| -rw-r--r-- | fluid/alignment_panel.fl | 599 |
1 files changed, 549 insertions, 50 deletions
diff --git a/fluid/alignment_panel.fl b/fluid/alignment_panel.fl index da80df3a4..ef9d48455 100644 --- a/fluid/alignment_panel.fl +++ b/fluid/alignment_panel.fl @@ -4,7 +4,7 @@ header_name {.h} code_name {.cxx} snap { ver 1 - current_suite FLTK + current_suite {FLUID (based on FLTK)} current_preset 0 suite { name {FLUID (based on FLTK)} @@ -91,6 +91,9 @@ decl {\#include <FL/fl_ask.H>} {private global decl {\#include <string.h>} {private global } +decl {\#include "../src/flstring.h"} {private global +} + decl {void init_scheme(void);} { comment {// initialize the scheme from preferences} public global } @@ -104,11 +107,49 @@ decl {extern void i18n_cb(Fl_Choice *,void *);} {public local decl {void scheme_cb(Fl_Scheme_Choice *, void *);} {public local } +decl {int w_settings_shell_list_selected;} {public local +} + +Function {make_script_panel()} {open +} { + Fl_Window script_panel { + label {Shell Script Editor} + callback {if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape) + return; // ignore Escape +script_panel->hide(); // otherwise hide..} open + xywh {764 319 540 180} type Double labelsize 11 resizable + code0 {o->size_range(200, 150);} modal visible + } { + Fl_Text_Editor script_input { + xywh {10 10 520 130} box DOWN_BOX labelsize 11 when 13 textfont 4 textsize 11 resizable + code0 {script_input->buffer(new Fl_Text_Buffer);} + } + Fl_Group {} {open + xywh {10 150 520 20} labelsize 11 + } { + Fl_Return_Button script_panel_ok { + label OK + xywh {400 150 60 20} labelsize 11 hotspot + } + Fl_Button script_panel_cancel { + label Cancel + xywh {470 150 60 20} labelsize 11 + } + Fl_Box {} { + xywh {10 150 380 20} labelsize 11 resizable + } + } + } + code {// Enable line numbers +script_input->linenumber_width(60); +script_input->linenumber_size(script_input->Fl_Text_Display::textsize());} {} +} + Function {make_settings_window()} {open } { Fl_Window settings_window { label {FLUID Settings} open - xywh {423 204 340 580} type Double align 80 non_modal visible + xywh {392 362 340 580} type Double align 80 visible } { Fl_Tabs w_settings_tabs { callback {propagate_load(o, v);} open @@ -758,73 +799,528 @@ g_layout_list.update_dialogs();} } Fl_Group w_settings_shell_tab { label Shell - callback {propagate_load(o, v);} + callback {propagate_load(o, v);} open image {icons/shell_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 hide code0 {o->image()->scale(36, 24);} } { - Fl_Input {} { - label {Command:} + Fl_Browser w_settings_shell_list { + label {Shell +command +list:} callback {if (v == LOAD) { - o->value(g_shell_command.c_str()); + // load from g_shell_config + if (g_shell_config) { + o->clear(); + w_settings_shell_list_selected = 0; + for (int i=0; i<g_shell_config->list_size; i++) { + Fd_Shell_Command *cmd = g_shell_config->list[i]; + o->add(cmd->name.c_str()); + if (cmd->storage == FD_STORE_USER) + o->icon(i+1, w_settings_shell_fd_user->image()); + else if (cmd->storage == FD_STORE_PROJECT) + o->icon(i+1, w_settings_shell_fd_project->image()); + } + } } else { - g_shell_command = o->value(); +// int prev_selected = w_settings_shell_list_selected; + w_settings_shell_list_selected = 0; + int selected = w_settings_shell_list->value(); + if (selected) { + if (w_settings_shell_list->selected(selected)) + w_settings_shell_list_selected = selected; + } + w_settings_shell_cmd->do_callback(w_settings_shell_cmd, LOAD); + w_settings_shell_toolbox->do_callback(w_settings_shell_toolbox, LOAD); }} - tooltip {external shell command} xywh {100 78 220 20} labelfont 1 labelsize 11 textfont 4 textsize 11 + xywh {100 90 220 110} type Multi labelfont 1 labelsize 11 align 4 textsize 13 } - Fl_Check_Button {} { - label {save .fl project file} - callback {if (v == LOAD) { - o->value(g_shell_save_fl); + Fl_Group w_settings_shell_toolbox { + callback {if (v==LOAD) { + propagate_load(o, v); +}} open + xywh {100 200 220 22} + } { + Fl_Button {} { + label {+} + callback {if (v != LOAD) { + int selected = w_settings_shell_list_selected; + Fd_Shell_Command *cmd = new Fd_Shell_Command("new shell command"); + g_shell_config->insert(selected, cmd); + w_settings_shell_list->insert(selected+1, cmd->name.c_str()); + w_settings_shell_list->deselect(); + w_settings_shell_list->value(selected+1); + if (cmd->storage == FD_STORE_USER) + w_settings_shell_list->icon(selected+1, w_settings_shell_fd_user->image()); + else if (cmd->storage == FD_STORE_PROJECT) + w_settings_shell_list->icon(selected+1, w_settings_shell_fd_project->image()); + w_settings_shell_list->do_callback(); + w_settings_shell_cmd->do_callback(w_settings_shell_cmd, LOAD); + w_settings_shell_toolbox->do_callback(w_settings_shell_toolbox, LOAD); + g_shell_config->rebuild_shell_menu(); +}} + xywh {100 200 24 22} labelsize 11 + } + Fl_Button w_settings_shell_dup { + label {++} + callback {int selected = w_settings_shell_list_selected; +if (v==LOAD) { + if (selected) { + o->activate(); + } else { + o->deactivate(); + } } else { - g_shell_save_fl = o->value(); + if (!selected) return; + Fd_Shell_Command *cmd = new Fd_Shell_Command(g_shell_config->list[selected-1]); + g_shell_config->insert(selected, cmd); + w_settings_shell_list->insert(selected+1, cmd->name.c_str()); + w_settings_shell_list->deselect(); + w_settings_shell_list->deselect(); + w_settings_shell_list->value(selected+1); + if (cmd->storage == FD_STORE_USER) + w_settings_shell_list->icon(selected+1, w_settings_shell_fd_user->image()); + else if (cmd->storage == FD_STORE_PROJECT) + w_settings_shell_list->icon(selected+1, w_settings_shell_fd_project->image()); + w_settings_shell_list->do_callback(); + w_settings_shell_cmd->do_callback(w_settings_shell_cmd, LOAD); + w_settings_shell_toolbox->do_callback(w_settings_shell_toolbox, LOAD); + g_shell_config->rebuild_shell_menu(); }} - tooltip {save the project to the .fl file before running the command} xywh {100 98 220 20} down_box DOWN_BOX labelsize 11 - } - Fl_Check_Button {} { - label {save source code} - callback {if (v == LOAD) { - o->value(g_shell_save_code); + xywh {124 200 24 22} labelsize 11 deactivate + } + Fl_Button w_settings_shell_remove { + label {-} + callback {int selected = w_settings_shell_list_selected; +if (v==LOAD) { + if (selected) { + o->activate(); + } else { + o->deactivate(); + } } else { - g_shell_save_code = o->value(); + if (!selected) return; + g_shell_config->remove(selected-1); + w_settings_shell_list->remove(selected); + if (selected <= w_settings_shell_list->size()) + w_settings_shell_list->value(selected); + else + w_settings_shell_list->value(0); + w_settings_shell_list->do_callback(); + w_settings_shell_cmd->do_callback(w_settings_shell_cmd, LOAD); + w_settings_shell_toolbox->do_callback(w_settings_shell_toolbox, LOAD); + g_shell_config->rebuild_shell_menu(); }} - tooltip {generate the source code and header file before running the command} xywh {100 118 220 19} down_box DOWN_BOX labelsize 11 - } - Fl_Check_Button {} { - label {save i18n strings} - callback {if (v == LOAD) { - o->value(g_shell_save_strings); + xywh {148 200 24 22} labelsize 11 deactivate + } + Fl_Menu_Button w_settings_shell_menu {open + xywh {172 200 24 22} labelsize 11 textsize 11 + } { + MenuItem {} { + label {Import...} + callback {if (v != LOAD) + Fd_Shell_Command_List::import_from_file();} + xywh {90 90 100 20} labelsize 11 + } + MenuItem {} { + label {Export selected...} + callback {if (v != LOAD) + Fd_Shell_Command_List::export_selected();} + xywh {10 10 100 20} labelsize 11 divider + } + MenuItem {} { + label {Import Example Scripts:} + xywh {20 20 100 20} labelfont 1 labelsize 10 deactivate + } + MenuItem {} { + label {Compile with fltk-config} + xywh {30 30 100 20} labelsize 11 + } + MenuItem {} { + label {Build and run} + xywh {40 40 100 20} labelsize 11 + } + MenuItem {} { + label {Build with Xcode on macOS} + xywh {50 50 100 20} labelsize 11 + } + MenuItem {} { + label {Build with CMake} + xywh {60 60 100 20} labelsize 11 + } + } + Fl_Button w_settings_shell_play { + label Run + callback {int selected = w_settings_shell_list_selected; +if (v==LOAD) { + if (selected) { + o->activate(); + } else { + o->deactivate(); + } } else { - g_shell_save_strings = o->value(); + if (!selected) return; + Fd_Shell_Command *cmd = g_shell_config->list[selected-1]; + cmd->run(); }} - tooltip {save the internationalisation string before running the command} xywh {100 137 220 20} down_box DOWN_BOX labelsize 11 + xywh {270 200 50 22} labelsize 11 deactivate + } } - Fl_Check_Button shell_use_fl_button { - label {save settings in .fl project files} - callback {if (v == LOAD) { - o->value(g_shell_use_fl_settings); + Fl_Group w_settings_shell_cmd { + callback {if (v==LOAD) { + int selected = w_settings_shell_list_selected; + if (selected) { + o->activate(); + } else { + o->deactivate(); + } + propagate_load(o, v); +}} open + xywh {10 235 320 291} + } { + Fl_Input {} { + label {Name:} + callback {int selected = w_settings_shell_list_selected; +if (v == LOAD) { + if (selected) { + o->value(g_shell_config->list[selected-1]->name.c_str()); + } else { + o->value(""); + } } else { - g_shell_use_fl_settings = o->value(); - fluid_prefs.set("shell_use_fl", g_shell_use_fl_settings); - if (g_shell_use_fl_settings) { - shell_settings_read(); + if (selected) { + Fd_Shell_Command *cmd = g_shell_config->list[selected-1]; + cmd->name = o->value(); + w_settings_shell_list->text(selected, o->value()); + if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + } +}} + xywh {100 246 220 20} labelfont 1 labelsize 11 when 13 textfont 4 textsize 11 + } + Fl_Input {} { + label {Label:} + callback {int selected = w_settings_shell_list_selected; +if (v == LOAD) { + if (selected) { + o->value(g_shell_config->list[selected-1]->label.c_str()); } else { - shell_prefs_get(); + o->value(""); + } +} else { + if (selected) { + Fd_Shell_Command *cmd = g_shell_config->list[selected-1]; + cmd->label = o->value(); + cmd->update_shell_menu(); + if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); } - w_settings_shell_tab->do_callback(w_settings_shell_tab, LOAD); }} - tooltip {check to read and write shell command from and to .fl files} xywh {100 194 220 19} down_box DOWN_BOX labelsize 11 deactivate + xywh {100 272 220 20} labelfont 1 labelsize 11 textfont 4 textsize 11 + } + Fl_Button {} { + label Shortcut + callback {int selected = w_settings_shell_list_selected; +if (v == LOAD) { + if (selected) { + o->value(g_shell_config->list[selected-1]->shortcut); + o->default_value(o->value()); + } else { + o->value(0); + } +} else { + if (selected) { + Fd_Shell_Command *cmd = g_shell_config->list[selected-1]; + cmd->shortcut = o->value(); + cmd->update_shell_menu(); + if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + } +}} + xywh {100 297 130 20} labelsize 11 align 16 + code0 {\#include <FL/Fl_Shortcut_Button.H>} + class Fl_Shortcut_Button + } + Fl_Choice {} { + label {Store:} + callback {int selected = w_settings_shell_list_selected; +if (v == LOAD) { + if (selected) { + Fd_Tool_Store ts = g_shell_config->list[selected-1]->storage; + o->value(o->find_item_with_argument((long)ts)); + } else { + o->value(o->find_item_with_argument((long)FD_STORE_USER)); + } +} else { + if (selected) { + Fd_Shell_Command *cmd = g_shell_config->list[selected-1]; + Fd_Tool_Store ts = (Fd_Tool_Store)(o->mvalue()->argument()); + if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + cmd->storage = ts; + //w_settings_shell_list->text(selected, cmd->name.c_str()); + if (cmd->storage == FD_STORE_USER) + w_settings_shell_list->icon(selected, w_settings_shell_fd_user->image()); + else if (cmd->storage == FD_STORE_PROJECT) + w_settings_shell_list->icon(selected, w_settings_shell_fd_project->image()); + if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + } +}} open + xywh {100 322 130 20} down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 + } { + MenuItem {} { + label {@fd_user User Setting} + user_data FD_STORE_USER user_data_type long + xywh {0 0 100 20} labelsize 11 + } + MenuItem {} { + label {@fd_project Project File} + user_data FD_STORE_PROJECT user_data_type long + xywh {0 0 100 20} labelsize 11 + } + } + Fl_Choice {} { + label {Condition:} + callback {int selected = w_settings_shell_list_selected; +if (v == LOAD) { + if (selected) { + int cond = g_shell_config->list[selected-1]->condition; + o->value(o->find_item_with_argument(cond)); + } else { + o->value(o->find_item_with_argument(0)); + } +} else { + if (selected) { + Fd_Shell_Command *cmd = g_shell_config->list[selected-1]; + int cond = (int)(o->mvalue()->argument()); + cmd->condition = cond; + g_shell_config->rebuild_shell_menu(); + if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + } +}} open + xywh {100 348 130 20} down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 + } { + MenuItem {} { + label {all platforms} + user_data {Fd_Shell_Command::ALWAYS} user_data_type long + xywh {0 0 100 20} labelsize 11 + } + MenuItem {} { + label {MS Windows only} + user_data {Fd_Shell_Command::WIN_ONLY} user_data_type long + xywh {0 0 100 20} labelsize 11 + } + MenuItem {} { + label {Linux only} + user_data {Fd_Shell_Command::UX_ONLY} user_data_type long + xywh {0 0 100 20} labelsize 11 + } + MenuItem {} { + label {macOS only} + user_data {Fd_Shell_Command::MAC_ONLY} user_data_type long + xywh {0 0 100 20} labelsize 11 + } + MenuItem {} { + label {Linux and macOS} + user_data {Fd_Shell_Command::MAC_AND_UX_ONLY} user_data_type long + xywh {0 0 100 20} labelsize 11 + } + MenuItem {} { + label {don't use} + user_data {Fd_Shell_Command::NEVER} user_data_type long + xywh {0 0 100 20} labelsize 11 + } + } + Fl_Input {} { + label {Label:} + callback {if (v == LOAD) { +// o->value(g_shell_command.c_str()); +} else { +// g_shell_command = o->value(); +}} + xywh {230 348 90 20} labelfont 1 labelsize 11 textfont 4 textsize 11 hide + } + Fl_Text_Editor w_settings_shell_command { + label {Shell script:} + callback {int selected = w_settings_shell_list_selected; +if (v == LOAD) { + if (selected) { + o->buffer()->text(g_shell_config->list[selected-1]->command.c_str()); + } else { + o->buffer()->text(""); + } +} else { + if (selected) { + Fd_Shell_Command *cmd = g_shell_config->list[selected-1]; + cmd->command = o->buffer()->text(); + if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + } +}} + xywh {100 373 196 80} labelfont 1 labelsize 11 align 4 textfont 4 textsize 12 + code0 {o->buffer(new Fl_Text_Buffer);} + } + Fl_Group {} {open + xywh {296 373 24 44} + } { + Fl_Menu_Button w_settings_shell_text_macros { + callback {const Fl_Menu_Item *mi = o->mvalue(); +if (mi) { + char buffer[256]; + fl_strlcpy(buffer, mi->label(), 255); + int n = (int)strlen(buffer)-1; + if (buffer[n]=='@') buffer[n] = 0; + char *word = buffer; + if (word[0]=='@') word++; + if (w_settings_shell_command->buffer()->selected()) { + int start = 0, end = 0; + w_settings_shell_command->buffer()->selection_position(&start, &end); + w_settings_shell_command->buffer()->replace(start, end, word); + } else { + int pos = w_settings_shell_command->insert_position(); + w_settings_shell_command->buffer()->insert(pos, word); + } + w_settings_shell_command->do_callback(w_settings_shell_command, (void*)NULL); +}} open + xywh {296 373 24 22} labelsize 11 textsize 11 + } { + MenuItem {} { + label {@@BASENAME@@} + xywh {80 80 100 20} labelfont 4 labelsize 11 + } + MenuItem {} { + label {@@PROJECTFILE_PATH@@} + xywh {0 0 100 20} labelfont 4 labelsize 11 + } + MenuItem {} { + label {@@PROJECTFILE_NAME@@} + xywh {10 10 100 20} labelfont 4 labelsize 11 + } + MenuItem {} { + label {@@CODEFILE_PATH@@} + xywh {20 20 100 20} labelfont 4 labelsize 11 + } + MenuItem {} { + label {@@CODEFILE_NAME@@} + xywh {30 30 100 20} labelfont 4 labelsize 11 + } + MenuItem {} { + label {@@HEADERFILE_PATH@@} + xywh {40 40 100 20} labelfont 4 labelsize 11 + } + MenuItem {} { + label {@@HEADERFILE_NAME@@} + xywh {50 50 100 20} labelfont 4 labelsize 11 + } + MenuItem {} { + label {@@TEXTFILE_PATH@@} + xywh {60 60 100 20} labelfont 4 labelsize 11 + } + MenuItem {} { + label {@@TEXTFILE_NAME@@} + xywh {70 70 100 20} labelfont 4 labelsize 11 + } + MenuItem {} { + label {@@FLTK_CONFIG@@} + comment {Not yet implemented} + xywh {70 70 100 20} labelfont 4 labelsize 11 hide + } + MenuItem {} { + label {@@TMPDIR@@} + xywh {70 70 100 20} labelfont 4 labelsize 11 + } + } + Fl_Button {} { + label {@square} + callback {if (!script_panel) make_script_panel(); +script_input->buffer()->text(w_settings_shell_command->buffer()->text()); +script_panel->show(); + +for (;;) { + Fl_Widget* w = Fl::readqueue(); + if (w == script_panel_cancel) goto BREAK2; + else if (w == script_panel_ok) break; + else if (!w) Fl::wait(); +} + +w_settings_shell_command->buffer()->text(script_input->buffer()->text()); +w_settings_shell_command->do_callback(); +BREAK2: +script_panel->hide();} + tooltip {open big code editor} xywh {296 395 24 22} labelsize 11 labelcolor 49 + } + } + Fl_Check_Button {} { + label {save .fl project file} + callback {int selected = w_settings_shell_list_selected; +if (v == LOAD) { + if (selected) { + o->value(g_shell_config->list[selected-1]->flags & Fd_Shell_Command::SAVE_PROJECT); + } else { + o->value(0); + } +} else { + if (selected) { + Fd_Shell_Command *cmd = g_shell_config->list[selected-1]; + int v = o->value(); + if (v) { + cmd->flags |= Fd_Shell_Command::SAVE_PROJECT; + } else { + cmd->flags &= ~Fd_Shell_Command::SAVE_PROJECT; + } + if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + } +}} + tooltip {save the project to the .fl file before running the command} xywh {100 458 220 20} down_box DOWN_BOX labelsize 11 + } + Fl_Check_Button {} { + label {save source code} + callback {int selected = w_settings_shell_list_selected; +if (v == LOAD) { + if (selected) { + o->value(g_shell_config->list[selected-1]->flags & Fd_Shell_Command::SAVE_SOURCECODE); + } else { + o->value(0); + } +} else { + if (selected) { + Fd_Shell_Command *cmd = g_shell_config->list[selected-1]; + int v = o->value(); + if (v) { + cmd->flags |= Fd_Shell_Command::SAVE_SOURCECODE; + } else { + cmd->flags &= ~Fd_Shell_Command::SAVE_SOURCECODE; + } + if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + } +}} + tooltip {generate the source code and header file before running the command} xywh {100 478 220 19} down_box DOWN_BOX labelsize 11 + } + Fl_Check_Button {} { + label {save i18n strings} + callback {int selected = w_settings_shell_list_selected; +if (v == LOAD) { + if (selected) { + o->value(g_shell_config->list[selected-1]->flags & Fd_Shell_Command::SAVE_STRINGS); + } else { + o->value(0); + } +} else { + if (selected) { + Fd_Shell_Command *cmd = g_shell_config->list[selected-1]; + int v = o->value(); + if (v) { + cmd->flags |= Fd_Shell_Command::SAVE_STRINGS; + } else { + cmd->flags &= ~Fd_Shell_Command::SAVE_STRINGS; + } + if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + } +}} + tooltip {save the internationalisation strings before running the command} xywh {100 497 220 20} down_box DOWN_BOX labelsize 11 + } } - Fl_Button {} { - label {save as default} - callback {if (v != LOAD) - shell_prefs_set();} - tooltip {update the Fluid app settings for external shell commands to the current settings} xywh {100 218 115 20} labelsize 11 + Fl_Box w_settings_shell_fd_project { + image {pixmaps/fd_project.png} compress_image 1 bind_image 1 bind_deimage 1 xywh {20 70 16 15} labelsize 11 hide deactivate + code0 {o->image()->scale(16, 16);} } - Fl_Return_Button {} { - label Run - callback {if (v != LOAD) - do_shell_command(NULL, NULL);} - tooltip {save selected files and run the command} xywh {100 162 100 20} labelsize 11 + Fl_Box w_settings_shell_fd_user { + image {pixmaps/fd_user.png} compress_image 1 bind_image 1 bind_deimage 1 xywh {20 70 16 15} labelsize 11 hide deactivate + code0 {o->image()->scale(16, 16);} } } Fl_Group w_settings_i18n_tab { @@ -953,7 +1449,10 @@ g_layout_list.update_dialogs();} } Fl_Button {} { label Close - callback {settings_window->hide();} + callback {if (g_shell_config) + g_shell_config->write(fluid_prefs, FD_STORE_USER); +g_layout_list.write(fluid_prefs, FD_STORE_USER); +settings_window->hide();} tooltip {Close this dialog.} xywh {230 550 100 20} labelsize 11 } } |
