From 51a55bc73660f64e8f4b32b8b4d3858f2a786f7b Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sun, 16 Mar 2025 17:16:12 -0400 Subject: Fluid: restructuring and rejuvenation of the source code. * Add classes for application and project * Removed all globals from Fluid.h * Extracting args and project history into their own classes * Moving globals into Application class * Initialize values inside headers for some classes. * Undo functionality wrapped in a class inside Project. * File reader and writer are now linked to a project. * Avoid global project access * Nodes (former Types) will be managed by a new Tree class. * Removed static members (hidden globals) form Node/Fl_Type. * Adding Tree iterator. * Use nullptr instead of 0, NULL, or 0L * Renamed Fl_..._Type to ..._Node, FL_OVERRIDE -> override * Renaming ..._type to ...::prototype * Splitting Widget Panel into multiple files. * Moved callback code into widget panel file. * Cleaning up Fluid_Image -> Image_asset * Moving Fd_Snap_Action into new namespace fld::app::Snap_Action etc. * Moved mergeback into proj folder. * `enum ID` is now `enum class Type`. --- fluid/panels/about_panel.cxx | 5 +- fluid/panels/about_panel.fl | 6 +- fluid/panels/about_panel.h | 2 +- fluid/panels/codeview_panel.cxx | 115 +- fluid/panels/codeview_panel.fl | 117 +- fluid/panels/function_panel.cxx | 128 +- fluid/panels/function_panel.fl | 126 +- fluid/panels/print_panel.cxx | 586 ------ fluid/panels/print_panel.fl | 358 ---- fluid/panels/print_panel.h | 56 - fluid/panels/settings_panel.cxx | 434 ++-- fluid/panels/settings_panel.fl | 426 ++-- fluid/panels/settings_panel.h | 9 +- fluid/panels/template_panel.cxx | 16 +- fluid/panels/template_panel.fl | 16 +- fluid/panels/widget_panel.cxx | 2840 ++++++++++++++++---------- fluid/panels/widget_panel.fl | 2313 +++++++++++++-------- fluid/panels/widget_panel.h | 115 +- fluid/panels/widget_panel/Grid_Child_Tab.cxx | 538 +++++ fluid/panels/widget_panel/Grid_Child_Tab.fl | 397 ++++ fluid/panels/widget_panel/Grid_Child_Tab.h | 79 + fluid/panels/widget_panel/Grid_Tab.cxx | 778 +++++++ fluid/panels/widget_panel/Grid_Tab.fl | 515 +++++ fluid/panels/widget_panel/Grid_Tab.h | 90 + 24 files changed, 6373 insertions(+), 3692 deletions(-) delete mode 100644 fluid/panels/print_panel.cxx delete mode 100644 fluid/panels/print_panel.fl delete mode 100644 fluid/panels/print_panel.h create mode 100644 fluid/panels/widget_panel/Grid_Child_Tab.cxx create mode 100644 fluid/panels/widget_panel/Grid_Child_Tab.fl create mode 100644 fluid/panels/widget_panel/Grid_Child_Tab.h create mode 100644 fluid/panels/widget_panel/Grid_Tab.cxx create mode 100644 fluid/panels/widget_panel/Grid_Tab.fl create mode 100644 fluid/panels/widget_panel/Grid_Tab.h (limited to 'fluid/panels') diff --git a/fluid/panels/about_panel.cxx b/fluid/panels/about_panel.cxx index ab36ddc10..6c78314dd 100644 --- a/fluid/panels/about_panel.cxx +++ b/fluid/panels/about_panel.cxx @@ -17,7 +17,6 @@ // generated by Fast Light User Interface Designer (fluid) version 1.0500 #include "about_panel.h" -void show_help(const char *name); Fl_Double_Window *about_panel=(Fl_Double_Window *)0; @@ -140,14 +139,14 @@ static const unsigned char idata_fluid[] = 99,199,176,225,186,61,16,35,74,220,19,2,0,59}; static Fl_Image *image_fluid() { Fl_GIF_Image::animate = true; - static Fl_Image *image = NULL; + static Fl_Image *image = 0L; if (!image) image = new Fl_Anim_GIF_Image("fluid.animated.gif", idata_fluid, 2545); return image; } static void cb_View(Fl_Button*, void*) { - show_help("license.html"); + Fluid.show_help("license.html"); } static void cb_Close(Fl_Return_Button* o, void*) { diff --git a/fluid/panels/about_panel.fl b/fluid/panels/about_panel.fl index 3b5d54b72..7e7feba5f 100644 --- a/fluid/panels/about_panel.fl +++ b/fluid/panels/about_panel.fl @@ -20,10 +20,10 @@ comment {// } {in_source in_header } -decl {\#include } {public global +decl {\#include "Fluid.h"} {public global } -decl {void show_help(const char *name);} {public local +decl {\#include } {public global } Function {make_about_panel()} {open @@ -60,7 +60,7 @@ Version x.x.x} } Fl_Button {} { label {View License...} - callback {show_help("license.html");} + callback {Fluid.show_help("license.html");} xywh {115 145 123 25} labelcolor 136 } Fl_Return_Button {} { diff --git a/fluid/panels/about_panel.h b/fluid/panels/about_panel.h index 0130a1e44..421b1d40c 100644 --- a/fluid/panels/about_panel.h +++ b/fluid/panels/about_panel.h @@ -19,8 +19,8 @@ #ifndef about_panel_h #define about_panel_h #include +#include "Fluid.h" #include -extern void show_help(const char *name); #include #include "../src/flstring.h" extern Fl_Double_Window *about_panel; diff --git a/fluid/panels/codeview_panel.cxx b/fluid/panels/codeview_panel.cxx index c1c6a1d65..745ad0ad1 100644 --- a/fluid/panels/codeview_panel.cxx +++ b/fluid/panels/codeview_panel.cxx @@ -17,19 +17,20 @@ // generated by Fast Light User Interface Designer (fluid) version 1.0500 #include "codeview_panel.h" -#include "app/fluid.h" -#include "app/project.h" +#include "Fluid.h" +#include "Project.h" #include "io/Project_Reader.h" #include "io/Project_Writer.h" +#include "io/String_Writer.h" #include #include #include "../src/flstring.h" -static char *cv_source_filename = NULL; -static char *cv_header_filename = NULL; -static char *cv_design_filename = NULL; +static char *cv_source_filename = nullptr; +static char *cv_header_filename = nullptr; +static char *cv_design_filename = nullptr; int cv_code_choice; -extern void select_only(Fl_Type *o); -extern void reveal_in_browser(Fl_Type *t); +extern void select_only(Node *o); +extern void reveal_in_browser(Node *t); /** Update the header and source code highlighting depending on the @@ -45,29 +46,29 @@ void update_codeview_position() { return; if (cv_autoposition->value()==0) return; - if (codeview_panel && codeview_panel->visible() && Fl_Type::current) { + if (codeview_panel && codeview_panel->visible() && Fluid.proj.tree.current) { int pos0 = 0, pos1 = 0; if (cv_source->visible_r()) { switch (cv_code_choice) { case 0: // prolog: not yet (include statements) - pos0 = Fl_Type::current->code1_start; - pos1 = Fl_Type::current->code2_end; + pos0 = Fluid.proj.tree.current->code1_start; + pos1 = Fluid.proj.tree.current->code2_end; break; case 1: // static: callbacks, menu declarations - pos0 = Fl_Type::current->code_static_start; - pos1 = Fl_Type::current->code_static_end; + pos0 = Fluid.proj.tree.current->code_static_start; + pos1 = Fluid.proj.tree.current->code_static_end; break; case 2: // code: entire implementation block including children - pos0 = Fl_Type::current->code1_start; - pos1 = Fl_Type::current->code2_end; + pos0 = Fluid.proj.tree.current->code1_start; + pos1 = Fluid.proj.tree.current->code2_end; break; case 3: // code1: all implementation code before the children - pos0 = Fl_Type::current->code1_start; - pos1 = Fl_Type::current->code1_end; + pos0 = Fluid.proj.tree.current->code1_start; + pos1 = Fluid.proj.tree.current->code1_end; break; case 4: // code1: all implementation code before the children - pos0 = Fl_Type::current->code2_start; - pos1 = Fl_Type::current->code2_end; + pos0 = Fluid.proj.tree.current->code2_start; + pos1 = Fluid.proj.tree.current->code2_end; break; } if (pos0>=0) { @@ -82,20 +83,20 @@ void update_codeview_position() { switch (cv_code_choice) { case 0: // prolog: not yet (include statements) case 1: // static: callbacks, menu declarations - pos0 = Fl_Type::current->header_static_start; - pos1 = Fl_Type::current->header_static_end; + pos0 = Fluid.proj.tree.current->header_static_start; + pos1 = Fluid.proj.tree.current->header_static_end; break; case 2: // code: entire implementation block including children - pos0 = Fl_Type::current->header1_start; - pos1 = Fl_Type::current->header2_end; + pos0 = Fluid.proj.tree.current->header1_start; + pos1 = Fluid.proj.tree.current->header2_end; break; case 3: // code1: all implementation code before the children - pos0 = Fl_Type::current->header1_start; - pos1 = Fl_Type::current->header1_end; + pos0 = Fluid.proj.tree.current->header1_start; + pos1 = Fluid.proj.tree.current->header1_end; break; case 4: // code1: all implementation code before the children - pos0 = Fl_Type::current->header2_start; - pos1 = Fl_Type::current->header2_end; + pos0 = Fluid.proj.tree.current->header2_start; + pos1 = Fluid.proj.tree.current->header2_end; break; } if (pos0>=0) { @@ -111,16 +112,16 @@ void update_codeview_position() { case 0: // prolog: not yet (include statements) case 1: // static: callbacks, menu declarations case 2: // code: entire implementation block including children - pos0 = Fl_Type::current->proj1_start; - pos1 = Fl_Type::current->proj2_end; + pos0 = Fluid.proj.tree.current->proj1_start; + pos1 = Fluid.proj.tree.current->proj2_end; break; case 3: // code1: all implementation code before the children - pos0 = Fl_Type::current->proj1_start; - pos1 = Fl_Type::current->proj1_end; + pos0 = Fluid.proj.tree.current->proj1_start; + pos1 = Fluid.proj.tree.current->proj1_end; break; case 4: // code1: all implementation code before the children - pos0 = Fl_Type::current->proj2_start; - pos1 = Fl_Type::current->proj2_end; + pos0 = Fluid.proj.tree.current->proj2_start; + pos1 = Fluid.proj.tree.current->proj2_end; break; } if (pos0>=0) { @@ -154,43 +155,43 @@ void update_codeview_cb(class Fl_Button*, void*) { if (!cv_source_filename) { cv_source_filename = (char*)malloc(FL_PATH_MAX); - fl_strlcpy(cv_source_filename, get_tmpdir().c_str(), FL_PATH_MAX); + fl_strlcpy(cv_source_filename, Fluid.get_tmpdir().c_str(), FL_PATH_MAX); fl_strlcat(cv_source_filename, "codeview_tmp.cxx", FL_PATH_MAX); } if (!cv_header_filename) { cv_header_filename = (char*)malloc(FL_PATH_MAX); - fl_strlcpy(cv_header_filename, get_tmpdir().c_str(), FL_PATH_MAX); + fl_strlcpy(cv_header_filename, Fluid.get_tmpdir().c_str(), FL_PATH_MAX); fl_strlcat(cv_header_filename, "codeview_tmp.h", FL_PATH_MAX); } if (!cv_design_filename) { cv_design_filename = (char*)malloc(FL_PATH_MAX); - fl_strlcpy(cv_design_filename, get_tmpdir().c_str(), FL_PATH_MAX); + fl_strlcpy(cv_design_filename, Fluid.get_tmpdir().c_str(), FL_PATH_MAX); fl_strlcat(cv_design_filename, "codeview_tmp.fl", FL_PATH_MAX); } if (cv_project->visible_r()) { - fld::io::write_file(cv_design_filename, false, true); + fld::io::write_file(Fluid.proj, cv_design_filename, false, true); int top = cv_project->top_line(); cv_project->buffer()->loadfile(cv_design_filename); cv_project->scroll(top, 0); } else if (cv_strings->visible_r()) { static const char *exts[] = { ".txt", ".po", ".msg" }; char fn[FL_PATH_MAX+1]; - fl_strlcpy(fn, get_tmpdir().c_str(), FL_PATH_MAX); + fl_strlcpy(fn, Fluid.get_tmpdir().c_str(), FL_PATH_MAX); fl_strlcat(fn, "strings", FL_PATH_MAX); - fl_filename_setext(fn, FL_PATH_MAX, exts[g_project.i18n_type]); - write_strings(fn); + fl_filename_setext(fn, FL_PATH_MAX, exts[static_cast(Fluid.proj.i18n_type)]); + fld::io::write_strings(Fluid.proj, fn); int top = cv_strings->top_line(); cv_strings->buffer()->loadfile(fn); cv_strings->scroll(top, 0); } else if (cv_source->visible_r() || cv_header->visible_r()) { - std::string code_file_name_bak = g_project.code_file_name; - g_project.code_file_name = cv_source_filename; - std::string header_file_name_bak = g_project.header_file_name; - g_project.header_file_name = cv_header_filename; + std::string code_file_name_bak = Fluid.proj.code_file_name; + Fluid.proj.code_file_name = cv_source_filename; + std::string header_file_name_bak = Fluid.proj.header_file_name; + Fluid.proj.header_file_name = cv_header_filename; // generate the code and load the files - fld::io::Code_Writer f; + fld::io::Code_Writer f(Fluid.proj); // generate files if (f.write_code(cv_source_filename, cv_header_filename, true)) { @@ -206,8 +207,8 @@ void update_codeview_cb(class Fl_Button*, void*) { update_codeview_position(); } - g_project.code_file_name = code_file_name_bak; - g_project.header_file_name = header_file_name_bak; + Fluid.proj.code_file_name = code_file_name_bak; + Fluid.proj.header_file_name = header_file_name_bak; } } @@ -236,7 +237,7 @@ void codeview_toggle_visibility() { if (!codeview_panel) { make_codeview(); codeview_panel->callback((Fl_Callback*)toggle_codeview_cb); - Fl_Preferences svp(fluid_prefs, "codeview"); + Fl_Preferences svp(Fluid.preferences, "codeview"); int autorefresh; svp.get("autorefresh", autorefresh, 1); cv_autorefresh->value(autorefresh); @@ -248,15 +249,15 @@ void codeview_toggle_visibility() { if (tab>=0 && tabchildren()) cv_tab->value(cv_tab->child(tab)); svp.get("code_choice", cv_code_choice, 2); cv_code_choice_w->value(cv_code_choice_w->find_item_with_argument(cv_code_choice)); - if (!position_window(codeview_panel,"codeview_pos", 0, 320, 120, 550, 500)) return; + if (!Fluid.position_window(codeview_panel,"codeview_pos", 0, 320, 120, 550, 500)) return; } if (codeview_panel->visible()) { codeview_panel->hide(); - codeview_item->label("Show Code View"); + Fluid.codeview_item->label("Show Code View"); } else { codeview_panel->show(); - codeview_item->label("Hide Code View"); + Fluid.codeview_item->label("Hide Code View"); update_codeview_cb(0,0); } } @@ -282,7 +283,7 @@ Fl_Button *cv_find_text_case=(Fl_Button *)0; Fl_Input *cv_find_text=(Fl_Input *)0; static void cb_cv_find_text(Fl_Input* o, void*) { - Fl_Text_Display *e = NULL; + Fl_Text_Display *e = nullptr; if (cv_source->visible_r()) { e = cv_source; } else if (cv_header->visible_r()) { @@ -303,7 +304,7 @@ static void cb_cv_find_text(Fl_Input* o, void*) { } static void cb_(Fl_Button*, void*) { - Fl_Text_Display *e = NULL; + Fl_Text_Display *e = nullptr; if (cv_source->visible_r()) { e = cv_source; } else if (cv_header->visible_r()) { @@ -328,7 +329,7 @@ static void cb_(Fl_Button*, void*) { } static void cb_1(Fl_Button*, void*) { - Fl_Text_Display *e = NULL; + Fl_Text_Display *e = nullptr; if (cv_source->visible_r()) { e = cv_source; } else if (cv_header->visible_r()) { @@ -354,13 +355,13 @@ static void cb_1(Fl_Button*, void*) { static void cb_Reveal(Fl_Button*, void*) { if (codeview_panel && codeview_panel->visible()) { - Fl_Type *node = NULL; + Node *node = nullptr; if (cv_source->visible_r()) - node = Fl_Type::find_in_text(0, cv_source->insert_position()); + node = Fluid.proj.tree.find_in_text(0, cv_source->insert_position()); else if (cv_header->visible_r()) - node = Fl_Type::find_in_text(1, cv_header->insert_position()); + node = Fluid.proj.tree.find_in_text(1, cv_header->insert_position()); else if (cv_project->visible_r()) - node = Fl_Type::find_in_text(2, cv_project->insert_position()); + node = Fluid.proj.tree.find_in_text(2, cv_project->insert_position()); if (node) { select_only(node); reveal_in_browser(node); diff --git a/fluid/panels/codeview_panel.fl b/fluid/panels/codeview_panel.fl index ce40ffd8a..fc62fee51 100644 --- a/fluid/panels/codeview_panel.fl +++ b/fluid/panels/codeview_panel.fl @@ -20,10 +20,10 @@ comment {// } {in_source in_header } -decl {\#include "app/fluid.h"} {private local +decl {\#include "Fluid.h"} {private local } -decl {\#include "app/project.h"} {private local +decl {\#include "Project.h"} {private local } decl {\#include "io/Project_Reader.h"} {private local @@ -32,6 +32,9 @@ decl {\#include "io/Project_Reader.h"} {private local decl {\#include "io/Project_Writer.h"} {private local } +decl {\#include "io/String_Writer.h"} {private local +} + decl {\#include } {private local } @@ -41,22 +44,22 @@ decl {\#include } {private local decl {\#include "../src/flstring.h"} {selected private local } -decl {char *cv_source_filename = NULL;} {private local +decl {char *cv_source_filename = nullptr;} {private local } -decl {char *cv_header_filename = NULL;} {private local +decl {char *cv_header_filename = nullptr;} {private local } -decl {char *cv_design_filename = NULL;} {private local +decl {char *cv_design_filename = nullptr;} {private local } decl {int cv_code_choice;} {public local } -decl {extern void select_only(Fl_Type *o);} {private global +decl {extern void select_only(Node *o);} {private global } -decl {extern void reveal_in_browser(Fl_Type *t);} {private global +decl {extern void reveal_in_browser(Node *t);} {private global } Function {update_codeview_position()} { @@ -72,29 +75,29 @@ file.} open return_type void return; if (cv_autoposition->value()==0) return; - if (codeview_panel && codeview_panel->visible() && Fl_Type::current) { + if (codeview_panel && codeview_panel->visible() && Fluid.proj.tree.current) { int pos0 = 0, pos1 = 0; if (cv_source->visible_r()) { switch (cv_code_choice) { case 0: // prolog: not yet (include statements) - pos0 = Fl_Type::current->code1_start; - pos1 = Fl_Type::current->code2_end; + pos0 = Fluid.proj.tree.current->code1_start; + pos1 = Fluid.proj.tree.current->code2_end; break; case 1: // static: callbacks, menu declarations - pos0 = Fl_Type::current->code_static_start; - pos1 = Fl_Type::current->code_static_end; + pos0 = Fluid.proj.tree.current->code_static_start; + pos1 = Fluid.proj.tree.current->code_static_end; break; case 2: // code: entire implementation block including children - pos0 = Fl_Type::current->code1_start; - pos1 = Fl_Type::current->code2_end; + pos0 = Fluid.proj.tree.current->code1_start; + pos1 = Fluid.proj.tree.current->code2_end; break; case 3: // code1: all implementation code before the children - pos0 = Fl_Type::current->code1_start; - pos1 = Fl_Type::current->code1_end; + pos0 = Fluid.proj.tree.current->code1_start; + pos1 = Fluid.proj.tree.current->code1_end; break; case 4: // code1: all implementation code before the children - pos0 = Fl_Type::current->code2_start; - pos1 = Fl_Type::current->code2_end; + pos0 = Fluid.proj.tree.current->code2_start; + pos1 = Fluid.proj.tree.current->code2_end; break; } if (pos0>=0) { @@ -109,20 +112,20 @@ file.} open return_type void switch (cv_code_choice) { case 0: // prolog: not yet (include statements) case 1: // static: callbacks, menu declarations - pos0 = Fl_Type::current->header_static_start; - pos1 = Fl_Type::current->header_static_end; + pos0 = Fluid.proj.tree.current->header_static_start; + pos1 = Fluid.proj.tree.current->header_static_end; break; case 2: // code: entire implementation block including children - pos0 = Fl_Type::current->header1_start; - pos1 = Fl_Type::current->header2_end; + pos0 = Fluid.proj.tree.current->header1_start; + pos1 = Fluid.proj.tree.current->header2_end; break; case 3: // code1: all implementation code before the children - pos0 = Fl_Type::current->header1_start; - pos1 = Fl_Type::current->header1_end; + pos0 = Fluid.proj.tree.current->header1_start; + pos1 = Fluid.proj.tree.current->header1_end; break; case 4: // code1: all implementation code before the children - pos0 = Fl_Type::current->header2_start; - pos1 = Fl_Type::current->header2_end; + pos0 = Fluid.proj.tree.current->header2_start; + pos1 = Fluid.proj.tree.current->header2_end; break; } if (pos0>=0) { @@ -138,16 +141,16 @@ file.} open return_type void case 0: // prolog: not yet (include statements) case 1: // static: callbacks, menu declarations case 2: // code: entire implementation block including children - pos0 = Fl_Type::current->proj1_start; - pos1 = Fl_Type::current->proj2_end; + pos0 = Fluid.proj.tree.current->proj1_start; + pos1 = Fluid.proj.tree.current->proj2_end; break; case 3: // code1: all implementation code before the children - pos0 = Fl_Type::current->proj1_start; - pos1 = Fl_Type::current->proj1_end; + pos0 = Fluid.proj.tree.current->proj1_start; + pos1 = Fluid.proj.tree.current->proj1_end; break; case 4: // code1: all implementation code before the children - pos0 = Fl_Type::current->proj2_start; - pos1 = Fl_Type::current->proj2_end; + pos0 = Fluid.proj.tree.current->proj2_start; + pos1 = Fluid.proj.tree.current->proj2_end; break; } if (pos0>=0) { @@ -179,43 +182,43 @@ and load those into the Code Viewer widgets.} open return_type void if (!cv_source_filename) { cv_source_filename = (char*)malloc(FL_PATH_MAX); - fl_strlcpy(cv_source_filename, get_tmpdir().c_str(), FL_PATH_MAX); + fl_strlcpy(cv_source_filename, Fluid.get_tmpdir().c_str(), FL_PATH_MAX); fl_strlcat(cv_source_filename, "codeview_tmp.cxx", FL_PATH_MAX); } if (!cv_header_filename) { cv_header_filename = (char*)malloc(FL_PATH_MAX); - fl_strlcpy(cv_header_filename, get_tmpdir().c_str(), FL_PATH_MAX); + fl_strlcpy(cv_header_filename, Fluid.get_tmpdir().c_str(), FL_PATH_MAX); fl_strlcat(cv_header_filename, "codeview_tmp.h", FL_PATH_MAX); } if (!cv_design_filename) { cv_design_filename = (char*)malloc(FL_PATH_MAX); - fl_strlcpy(cv_design_filename, get_tmpdir().c_str(), FL_PATH_MAX); + fl_strlcpy(cv_design_filename, Fluid.get_tmpdir().c_str(), FL_PATH_MAX); fl_strlcat(cv_design_filename, "codeview_tmp.fl", FL_PATH_MAX); } if (cv_project->visible_r()) { - fld::io::write_file(cv_design_filename, false, true); + fld::io::write_file(Fluid.proj, cv_design_filename, false, true); int top = cv_project->top_line(); cv_project->buffer()->loadfile(cv_design_filename); cv_project->scroll(top, 0); } else if (cv_strings->visible_r()) { static const char *exts[] = { ".txt", ".po", ".msg" }; char fn[FL_PATH_MAX+1]; - fl_strlcpy(fn, get_tmpdir().c_str(), FL_PATH_MAX); + fl_strlcpy(fn, Fluid.get_tmpdir().c_str(), FL_PATH_MAX); fl_strlcat(fn, "strings", FL_PATH_MAX); - fl_filename_setext(fn, FL_PATH_MAX, exts[g_project.i18n_type]); - write_strings(fn); + fl_filename_setext(fn, FL_PATH_MAX, exts[static_cast(Fluid.proj.i18n_type)]); + fld::io::write_strings(Fluid.proj, fn); int top = cv_strings->top_line(); cv_strings->buffer()->loadfile(fn); cv_strings->scroll(top, 0); } else if (cv_source->visible_r() || cv_header->visible_r()) { - std::string code_file_name_bak = g_project.code_file_name; - g_project.code_file_name = cv_source_filename; - std::string header_file_name_bak = g_project.header_file_name; - g_project.header_file_name = cv_header_filename; + std::string code_file_name_bak = Fluid.proj.code_file_name; + Fluid.proj.code_file_name = cv_source_filename; + std::string header_file_name_bak = Fluid.proj.header_file_name; + Fluid.proj.header_file_name = cv_header_filename; // generate the code and load the files - fld::io::Code_Writer f; + fld::io::Code_Writer f(Fluid.proj); // generate files if (f.write_code(cv_source_filename, cv_header_filename, true)) { @@ -231,8 +234,8 @@ and load those into the Code Viewer widgets.} open return_type void update_codeview_position(); } - g_project.code_file_name = code_file_name_bak; - g_project.header_file_name = header_file_name_bak; + Fluid.proj.code_file_name = code_file_name_bak; + Fluid.proj.header_file_name = header_file_name_bak; }} {} } @@ -260,7 +263,7 @@ The state is stored in the app preferences. code {if (!codeview_panel) { make_codeview(); codeview_panel->callback((Fl_Callback*)toggle_codeview_cb); - Fl_Preferences svp(fluid_prefs, "codeview"); + Fl_Preferences svp(Fluid.preferences, "codeview"); int autorefresh; svp.get("autorefresh", autorefresh, 1); cv_autorefresh->value(autorefresh); @@ -272,15 +275,15 @@ The state is stored in the app preferences. if (tab>=0 && tabchildren()) cv_tab->value(cv_tab->child(tab)); svp.get("code_choice", cv_code_choice, 2); cv_code_choice_w->value(cv_code_choice_w->find_item_with_argument(cv_code_choice)); - if (!position_window(codeview_panel,"codeview_pos", 0, 320, 120, 550, 500)) return; + if (!Fluid.position_window(codeview_panel,"codeview_pos", 0, 320, 120, 550, 500)) return; } if (codeview_panel->visible()) { codeview_panel->hide(); - codeview_item->label("Show Code View"); + Fluid.codeview_item->label("Show Code View"); } else { codeview_panel->show(); - codeview_item->label("Hide Code View"); + Fluid.codeview_item->label("Hide Code View"); update_codeview_cb(0,0); }} {} } @@ -354,7 +357,7 @@ Function {make_codeview()} {open } Fl_Input cv_find_text { label {Find:} - callback {Fl_Text_Display *e = NULL; + callback {Fl_Text_Display *e = nullptr; if (cv_source->visible_r()) { e = cv_source; } else if (cv_header->visible_r()) { @@ -376,7 +379,7 @@ if (e) { } Fl_Button {} { label {<<} - callback {Fl_Text_Display *e = NULL; + callback {Fl_Text_Display *e = nullptr; if (cv_source->visible_r()) { e = cv_source; } else if (cv_header->visible_r()) { @@ -402,7 +405,7 @@ if (e) { } Fl_Button {} { label {>>} - callback {Fl_Text_Display *e = NULL; + callback {Fl_Text_Display *e = nullptr; if (cv_source->visible_r()) { e = cv_source; } else if (cv_header->visible_r()) { @@ -429,13 +432,13 @@ if (e) { Fl_Button {} { label Reveal callback {if (codeview_panel && codeview_panel->visible()) { - Fl_Type *node = NULL; + Node *node = nullptr; if (cv_source->visible_r()) - node = Fl_Type::find_in_text(0, cv_source->insert_position()); + node = Fluid.proj.tree.find_in_text(0, cv_source->insert_position()); else if (cv_header->visible_r()) - node = Fl_Type::find_in_text(1, cv_header->insert_position()); + node = Fluid.proj.tree.find_in_text(1, cv_header->insert_position()); else if (cv_project->visible_r()) - node = Fl_Type::find_in_text(2, cv_project->insert_position()); + node = Fluid.proj.tree.find_in_text(2, cv_project->insert_position()); if (node) { select_only(node); reveal_in_browser(node); diff --git a/fluid/panels/function_panel.cxx b/fluid/panels/function_panel.cxx index 4ef8fac64..3703cb157 100644 --- a/fluid/panels/function_panel.cxx +++ b/fluid/panels/function_panel.cxx @@ -17,9 +17,9 @@ // generated by Fast Light User Interface Designer (fluid) version 1.0500 #include "function_panel.h" -#include "app/fluid.h" -#include "app/undo.h" -#include "nodes/Fl_Type.h" +#include "Fluid.h" +#include "proj/undo.h" +#include "nodes/Node.h" #include "nodes/factory.h" #include "rsrcs/pixmaps.h" #include "widgets/Bin_Button.h" @@ -765,7 +765,7 @@ Fl_Double_Window* make_comment_panel() { void type_make_cb(Fl_Widget*,void*d) { const char *type_name = (const char*)d; - if (Fl_Type::current && Fl_Type::current->can_have_children()) + if (Fluid.proj.tree.current && Fluid.proj.tree.current->can_have_children()) add_new_widget_from_user(type_name, Strategy::AS_LAST_CHILD); else add_new_widget_from_user(type_name, Strategy::AFTER_CURRENT); @@ -773,11 +773,11 @@ void type_make_cb(Fl_Widget*,void*d) { Fl_Window *widgetbin_panel=(Fl_Window *)0; -static void cb_widgetbin_panel(Fl_Window* o, void* v) { +static void cb_widgetbin_panel(Fl_Window*, void*) { if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape) - exit_cb((Fl_Widget*)o, v); + Fluid.quit(); else - toggle_widgetbin_cb((Fl_Widget*)o, v); + Fluid.toggle_widget_bin(); } Fl_Window* make_widgetbin() { @@ -790,31 +790,31 @@ Fl_Window* make_widgetbin() { o->tooltip("Function"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)type_make_cb, (void*)("Function")); - o->image(pixmap[ID_Function]); + o->image(pixmap[(int)Type::Function]); } // Fl_Button* o { Fl_Button* o = new Fl_Button(30, 21, 24, 24); o->tooltip("Class"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)type_make_cb, (void*)("Class")); - o->image(pixmap[ID_Class]); + o->image(pixmap[(int)Type::Class]); } // Fl_Button* o { Fl_Button* o = new Fl_Button(55, 21, 24, 24); o->tooltip("Comment"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)type_make_cb, (void*)("comment")); - o->image(pixmap[ID_Comment]); + o->image(pixmap[(int)Type::Comment]); } // Fl_Button* o { Fl_Button* o = new Fl_Button(5, 46, 24, 24); o->tooltip("Code"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)type_make_cb, (void*)("Code")); - o->image(pixmap[ID_Code]); + o->image(pixmap[(int)Type::Code]); } // Fl_Button* o { Fl_Button* o = new Fl_Button(30, 46, 24, 24); o->tooltip("Code Block"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)type_make_cb, (void*)("CodeBlock")); - o->image(pixmap[ID_CodeBlock]); + o->image(pixmap[(int)Type::CodeBlock]); } // Fl_Button* o { fld::widget::Bin_Window_Button* o = new fld::widget::Bin_Window_Button(55, 46, 24, 24); o->tooltip("Widget Class"); @@ -828,25 +828,25 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("widget_class")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Widget_Class]); + o->image(pixmap[(int)Type::Widget_Class]); } // fld::widget::Bin_Window_Button* o { Fl_Button* o = new Fl_Button(5, 71, 24, 24); o->tooltip("Declaration"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)type_make_cb, (void*)("decl")); - o->image(pixmap[ID_Decl]); + o->image(pixmap[(int)Type::Decl]); } // Fl_Button* o { Fl_Button* o = new Fl_Button(30, 71, 24, 24); o->tooltip("Declaration Block"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)type_make_cb, (void*)("declblock")); - o->image(pixmap[ID_DeclBlock]); + o->image(pixmap[(int)Type::DeclBlock]); } // Fl_Button* o { Fl_Button* o = new Fl_Button(55, 71, 24, 24); o->tooltip("Inline Data"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)type_make_cb, (void*)("data")); - o->image(pixmap[ID_Data]); + o->image(pixmap[(int)Type::Data]); } // Fl_Button* o o->end(); } // Fl_Group* o @@ -864,7 +864,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Window")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Window]); + o->image(pixmap[(int)Type::Window]); } // fld::widget::Bin_Window_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(114, 21, 24, 24); o->tooltip("Group"); @@ -878,7 +878,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Group")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Group]); + o->image(pixmap[(int)Type::Group]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(139, 21, 24, 24); o->tooltip("Pack"); @@ -892,7 +892,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Pack")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Pack]); + o->image(pixmap[(int)Type::Pack]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(89, 46, 24, 24); o->tooltip("Tabs"); @@ -906,7 +906,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Tabs")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Tabs]); + o->image(pixmap[(int)Type::Tabs]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(114, 46, 24, 24); o->tooltip("Scroll"); @@ -920,7 +920,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Scroll")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Scroll]); + o->image(pixmap[(int)Type::Scroll]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(139, 46, 24, 24); o->tooltip("Flex"); @@ -934,7 +934,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Flex")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Flex]); + o->image(pixmap[(int)Type::Flex]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(89, 71, 24, 24); o->tooltip("Tile"); @@ -948,7 +948,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Tile")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Tile]); + o->image(pixmap[(int)Type::Tile]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(114, 71, 24, 24); o->tooltip("Wizard"); @@ -962,7 +962,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Wizard")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Wizard]); + o->image(pixmap[(int)Type::Wizard]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(139, 71, 24, 24); o->tooltip("Grid"); @@ -976,7 +976,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Grid")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Grid]); + o->image(pixmap[(int)Type::Grid]); } // fld::widget::Bin_Button* o o->end(); } // Fl_Group* o @@ -994,7 +994,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Button")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Button]); + o->image(pixmap[(int)Type::Button]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(198, 21, 24, 24); o->tooltip("Return Button"); @@ -1008,7 +1008,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Return_Button")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Return_Button]); + o->image(pixmap[(int)Type::Return_Button]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(173, 46, 24, 24); o->tooltip("Light Button"); @@ -1022,7 +1022,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Light_Button")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Light_Button]); + o->image(pixmap[(int)Type::Light_Button]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(198, 46, 24, 24); o->tooltip("Repeat Button"); @@ -1036,7 +1036,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Repeat_Button")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Repeat_Button]); + o->image(pixmap[(int)Type::Repeat_Button]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(173, 71, 24, 24); o->tooltip("Check Button"); @@ -1050,7 +1050,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Check_Button")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Check_Button]); + o->image(pixmap[(int)Type::Check_Button]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(198, 71, 24, 24); o->tooltip("Round Button"); @@ -1064,7 +1064,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Round_Button")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Round_Button]); + o->image(pixmap[(int)Type::Round_Button]); } // fld::widget::Bin_Button* o o->end(); } // Fl_Group* o @@ -1082,7 +1082,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Slider")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Slider]); + o->image(pixmap[(int)Type::Slider]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(257, 21, 24, 24); o->tooltip("Scroll Bar"); @@ -1096,7 +1096,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Scrollbar")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Scrollbar]); + o->image(pixmap[(int)Type::Scrollbar]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(282, 21, 24, 24); o->tooltip("Value Slider"); @@ -1110,7 +1110,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Value_Slider")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Value_Slider]); + o->image(pixmap[(int)Type::Value_Slider]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(307, 21, 24, 24); o->tooltip("Value Output"); @@ -1124,7 +1124,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Value_Output")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Value_Output]); + o->image(pixmap[(int)Type::Value_Output]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(232, 46, 24, 24); o->tooltip("Adjuster"); @@ -1138,7 +1138,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Adjuster")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Adjuster]); + o->image(pixmap[(int)Type::Adjuster]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(257, 46, 24, 24); o->tooltip("Counter"); @@ -1152,7 +1152,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Counter")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Counter]); + o->image(pixmap[(int)Type::Counter]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(282, 46, 24, 24); o->tooltip("Dial"); @@ -1166,7 +1166,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Dial")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Dial]); + o->image(pixmap[(int)Type::Dial]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(232, 71, 24, 24); o->tooltip("Roller"); @@ -1180,7 +1180,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Roller")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Roller]); + o->image(pixmap[(int)Type::Roller]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(257, 71, 24, 24); o->tooltip("Spinner"); @@ -1194,7 +1194,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Spinner")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Spinner]); + o->image(pixmap[(int)Type::Spinner]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(282, 71, 24, 24); o->tooltip("Value Input"); @@ -1208,7 +1208,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Value_Input")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Value_Input]); + o->image(pixmap[(int)Type::Value_Input]); } // fld::widget::Bin_Button* o o->end(); } // Fl_Group* o @@ -1226,7 +1226,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Input")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Input]); + o->image(pixmap[(int)Type::Input]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(366, 21, 24, 24); o->tooltip("Output"); @@ -1240,7 +1240,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Output")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Output]); + o->image(pixmap[(int)Type::Output]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(341, 46, 24, 24); o->tooltip("Text Edit"); @@ -1254,7 +1254,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Text_Editor")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Text_Editor]); + o->image(pixmap[(int)Type::Text_Editor]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(366, 46, 24, 24); o->tooltip("Text Display"); @@ -1268,7 +1268,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Text_Display")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Text_Display]); + o->image(pixmap[(int)Type::Text_Display]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(341, 71, 24, 24); o->tooltip("File Input"); @@ -1282,7 +1282,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_File_Input")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_File_Input]); + o->image(pixmap[(int)Type::File_Input]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(366, 71, 24, 24); o->tooltip("Terminal"); @@ -1296,7 +1296,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Terminal")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Terminal]); + o->image(pixmap[(int)Type::Terminal]); } // fld::widget::Bin_Button* o o->end(); } // Fl_Group* o @@ -1314,7 +1314,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Input_Choice")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Input_Choice]); + o->image(pixmap[(int)Type::Input_Choice]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(425, 21, 24, 24); o->tooltip("Menu Item"); @@ -1328,7 +1328,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("menuitem")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Menu_Item]); + o->image(pixmap[(int)Type::Menu_Item]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(450, 21, 24, 24); o->tooltip("Menu Bar"); @@ -1342,7 +1342,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Menu_Bar")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Menu_Bar]); + o->image(pixmap[(int)Type::Menu_Bar]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(400, 46, 24, 24); o->tooltip("Menu Button"); @@ -1356,7 +1356,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Menu_Button")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Menu_Button]); + o->image(pixmap[(int)Type::Menu_Button]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(425, 46, 24, 24); o->tooltip("Checkbox Menu Item"); @@ -1370,7 +1370,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("checkmenuitem")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Checkbox_Menu_Item]); + o->image(pixmap[(int)Type::Checkbox_Menu_Item]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(450, 46, 24, 24); o->tooltip("Sub Menu"); @@ -1384,7 +1384,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("submenu")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Submenu]); + o->image(pixmap[(int)Type::Submenu]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(400, 71, 24, 24); o->tooltip("Choice"); @@ -1398,7 +1398,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Choice")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Choice]); + o->image(pixmap[(int)Type::Choice]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(425, 71, 24, 24); o->tooltip("Radio Menu Item"); @@ -1412,7 +1412,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("radiomenuitem")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Radio_Menu_Item]); + o->image(pixmap[(int)Type::Radio_Menu_Item]); } // fld::widget::Bin_Button* o o->end(); } // Fl_Group* o @@ -1430,7 +1430,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Browser")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Browser]); + o->image(pixmap[(int)Type::Browser]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(509, 21, 24, 24); o->tooltip("Tree"); @@ -1444,7 +1444,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Tree")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Tree]); + o->image(pixmap[(int)Type::Tree]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(484, 46, 24, 24); o->tooltip("Check Browser"); @@ -1458,7 +1458,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Check_Browser")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Check_Browser]); + o->image(pixmap[(int)Type::Check_Browser]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(509, 46, 24, 24); o->tooltip("Help Browser"); @@ -1472,7 +1472,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Help_View")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Help_View]); + o->image(pixmap[(int)Type::Help_View]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(484, 71, 24, 24); o->tooltip("File Browser"); @@ -1486,7 +1486,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_File_Browser")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_File_Browser]); + o->image(pixmap[(int)Type::File_Browser]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(509, 71, 24, 24); o->tooltip("Table"); @@ -1500,7 +1500,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Table")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Table]); + o->image(pixmap[(int)Type::Table]); } // fld::widget::Bin_Button* o o->end(); } // Fl_Group* o @@ -1518,7 +1518,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Box")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Box]); + o->image(pixmap[(int)Type::Box]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(567, 21, 24, 24); o->tooltip("Clock"); @@ -1532,7 +1532,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Clock")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Clock]); + o->image(pixmap[(int)Type::Clock]); } // fld::widget::Bin_Button* o { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(542, 46, 24, 24); o->tooltip("Progress"); @@ -1546,7 +1546,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("Fl_Progress")); o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); - o->image(pixmap[ID_Progress]); + o->image(pixmap[(int)Type::Progress]); } // fld::widget::Bin_Button* o o->end(); } // Fl_Group* o diff --git a/fluid/panels/function_panel.fl b/fluid/panels/function_panel.fl index 7adb2ecea..d07af5c8c 100644 --- a/fluid/panels/function_panel.fl +++ b/fluid/panels/function_panel.fl @@ -25,13 +25,13 @@ comment {// } {in_source in_header } -decl {\#include "app/fluid.h"} {private local +decl {\#include "Fluid.h"} {private local } -decl {\#include "app/undo.h"} {private local +decl {\#include "proj/undo.h"} {private local } -decl {\#include "nodes/Fl_Type.h"} {private local +decl {\#include "nodes/Node.h"} {private local } decl {\#include "nodes/factory.h"} {private local @@ -588,7 +588,7 @@ Function {make_comment_panel()} {open Function {type_make_cb(Fl_Widget*,void*d)} {open return_type void } { code {const char *type_name = (const char*)d; -if (Fl_Type::current && Fl_Type::current->can_have_children()) +if (Fluid.proj.tree.current && Fluid.proj.tree.current->can_have_children()) add_new_widget_from_user(type_name, Strategy::AS_LAST_CHILD); else add_new_widget_from_user(type_name, Strategy::AFTER_CURRENT);} {} @@ -599,9 +599,9 @@ Function {make_widgetbin()} {open Fl_Window widgetbin_panel { label {Widget Bin} callback {if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape) - exit_cb((Fl_Widget*)o, v); + Fluid.quit(); else - toggle_widgetbin_cb((Fl_Widget*)o, v);} open + Fluid.toggle_widget_bin();} open xywh {395 227 600 102} type Single align 80 non_modal visible } { Fl_Group {} { @@ -612,56 +612,56 @@ else user_data {"Function"} callback type_make_cb tooltip Function xywh {5 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Function]);} + code0 {o->image(pixmap[(int)Type::Function]);} } Fl_Button {} { user_data {"Class"} callback type_make_cb tooltip Class xywh {30 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Class]);} + code0 {o->image(pixmap[(int)Type::Class]);} } Fl_Button {} { user_data {"comment"} callback type_make_cb tooltip Comment xywh {55 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Comment]);} + code0 {o->image(pixmap[(int)Type::Comment]);} } Fl_Button {} { user_data {"Code"} callback type_make_cb tooltip Code xywh {5 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Code]);} + code0 {o->image(pixmap[(int)Type::Code]);} } Fl_Button {} { user_data {"CodeBlock"} callback type_make_cb tooltip {Code Block} xywh {30 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_CodeBlock]);} + code0 {o->image(pixmap[(int)Type::CodeBlock]);} } Fl_Button {} { user_data {"widget_class"} callback type_make_cb tooltip {Widget Class} xywh {55 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Widget_Class]);} + code0 {o->image(pixmap[(int)Type::Widget_Class]);} class {fld::widget::Bin_Window_Button} } Fl_Button {} { user_data {"decl"} callback type_make_cb tooltip Declaration xywh {5 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Decl]);} + code0 {o->image(pixmap[(int)Type::Decl]);} } Fl_Button {} { user_data {"declblock"} callback type_make_cb tooltip {Declaration Block} xywh {30 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_DeclBlock]);} + code0 {o->image(pixmap[(int)Type::DeclBlock]);} } Fl_Button {} { user_data {"data"} callback type_make_cb tooltip {Inline Data} xywh {55 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Data]);} + code0 {o->image(pixmap[(int)Type::Data]);} } } Fl_Group {} { @@ -672,63 +672,63 @@ else user_data {"Fl_Window"} callback type_make_cb tooltip Window xywh {89 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Window]);} + code0 {o->image(pixmap[(int)Type::Window]);} class {fld::widget::Bin_Window_Button} } Fl_Button {} { user_data {"Fl_Group"} callback type_make_cb selected tooltip Group xywh {114 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Group]);} + code0 {o->image(pixmap[(int)Type::Group]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Pack"} callback type_make_cb tooltip Pack xywh {139 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Pack]);} + code0 {o->image(pixmap[(int)Type::Pack]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Tabs"} callback type_make_cb tooltip Tabs xywh {89 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Tabs]);} + code0 {o->image(pixmap[(int)Type::Tabs]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Scroll"} callback type_make_cb tooltip Scroll xywh {114 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Scroll]);} + code0 {o->image(pixmap[(int)Type::Scroll]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Flex"} callback type_make_cb tooltip Flex xywh {139 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Flex]);} + code0 {o->image(pixmap[(int)Type::Flex]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Tile"} callback type_make_cb tooltip Tile xywh {89 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Tile]);} + code0 {o->image(pixmap[(int)Type::Tile]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Wizard"} callback type_make_cb tooltip Wizard xywh {114 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Wizard]);} + code0 {o->image(pixmap[(int)Type::Wizard]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Grid"} callback type_make_cb tooltip Grid xywh {139 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Grid]);} + code0 {o->image(pixmap[(int)Type::Grid]);} class {fld::widget::Bin_Button} } } @@ -740,42 +740,42 @@ else user_data {"Fl_Button"} callback type_make_cb tooltip Button xywh {173 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Button]);} + code0 {o->image(pixmap[(int)Type::Button]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Return_Button"} callback type_make_cb tooltip {Return Button} xywh {198 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Return_Button]);} + code0 {o->image(pixmap[(int)Type::Return_Button]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Light_Button"} callback type_make_cb tooltip {Light Button} xywh {173 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Light_Button]);} + code0 {o->image(pixmap[(int)Type::Light_Button]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Repeat_Button"} callback type_make_cb tooltip {Repeat Button} xywh {198 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Repeat_Button]);} + code0 {o->image(pixmap[(int)Type::Repeat_Button]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Check_Button"} callback type_make_cb tooltip {Check Button} xywh {173 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Check_Button]);} + code0 {o->image(pixmap[(int)Type::Check_Button]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Round_Button"} callback type_make_cb tooltip {Round Button} xywh {198 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Round_Button]);} + code0 {o->image(pixmap[(int)Type::Round_Button]);} class {fld::widget::Bin_Button} } } @@ -787,70 +787,70 @@ else user_data {"Fl_Slider"} callback type_make_cb tooltip Slider xywh {232 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Slider]);} + code0 {o->image(pixmap[(int)Type::Slider]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Scrollbar"} callback type_make_cb tooltip {Scroll Bar} xywh {257 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Scrollbar]);} + code0 {o->image(pixmap[(int)Type::Scrollbar]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Value_Slider"} callback type_make_cb tooltip {Value Slider} xywh {282 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Value_Slider]);} + code0 {o->image(pixmap[(int)Type::Value_Slider]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Value_Output"} callback type_make_cb tooltip {Value Output} xywh {307 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Value_Output]);} + code0 {o->image(pixmap[(int)Type::Value_Output]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Adjuster"} callback type_make_cb tooltip Adjuster xywh {232 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Adjuster]);} + code0 {o->image(pixmap[(int)Type::Adjuster]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Counter"} callback type_make_cb tooltip Counter xywh {257 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Counter]);} + code0 {o->image(pixmap[(int)Type::Counter]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Dial"} callback type_make_cb tooltip Dial xywh {282 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Dial]);} + code0 {o->image(pixmap[(int)Type::Dial]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Roller"} callback type_make_cb tooltip Roller xywh {232 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Roller]);} + code0 {o->image(pixmap[(int)Type::Roller]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Spinner"} callback type_make_cb tooltip Spinner xywh {257 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Spinner]);} + code0 {o->image(pixmap[(int)Type::Spinner]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Value_Input"} callback type_make_cb tooltip {Value Input} xywh {282 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Value_Input]);} + code0 {o->image(pixmap[(int)Type::Value_Input]);} class {fld::widget::Bin_Button} } } @@ -862,42 +862,42 @@ else user_data {"Fl_Input"} callback type_make_cb tooltip Input xywh {341 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Input]);} + code0 {o->image(pixmap[(int)Type::Input]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Output"} callback type_make_cb tooltip Output xywh {366 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Output]);} + code0 {o->image(pixmap[(int)Type::Output]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Text_Editor"} callback type_make_cb tooltip {Text Edit} xywh {341 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Text_Editor]);} + code0 {o->image(pixmap[(int)Type::Text_Editor]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Text_Display"} callback type_make_cb tooltip {Text Display} xywh {366 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Text_Display]);} + code0 {o->image(pixmap[(int)Type::Text_Display]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_File_Input"} callback type_make_cb tooltip {File Input} xywh {341 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_File_Input]);} + code0 {o->image(pixmap[(int)Type::File_Input]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Terminal"} callback type_make_cb tooltip Terminal xywh {366 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Terminal]);} + code0 {o->image(pixmap[(int)Type::Terminal]);} class {fld::widget::Bin_Button} } } @@ -909,56 +909,56 @@ else user_data {"Fl_Input_Choice"} callback type_make_cb tooltip {Input Choice} xywh {400 22 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Input_Choice]);} + code0 {o->image(pixmap[(int)Type::Input_Choice]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"menuitem"} callback type_make_cb tooltip {Menu Item} xywh {425 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Menu_Item]);} + code0 {o->image(pixmap[(int)Type::Menu_Item]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Menu_Bar"} callback type_make_cb tooltip {Menu Bar} xywh {450 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Menu_Bar]);} + code0 {o->image(pixmap[(int)Type::Menu_Bar]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Menu_Button"} callback type_make_cb tooltip {Menu Button} xywh {400 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Menu_Button]);} + code0 {o->image(pixmap[(int)Type::Menu_Button]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"checkmenuitem"} callback type_make_cb tooltip {Checkbox Menu Item} xywh {425 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Checkbox_Menu_Item]);} + code0 {o->image(pixmap[(int)Type::Checkbox_Menu_Item]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"submenu"} callback type_make_cb tooltip {Sub Menu} xywh {450 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Submenu]);} + code0 {o->image(pixmap[(int)Type::Submenu]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Choice"} callback type_make_cb tooltip Choice xywh {400 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Choice]);} + code0 {o->image(pixmap[(int)Type::Choice]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"radiomenuitem"} callback type_make_cb tooltip {Radio Menu Item} xywh {425 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Radio_Menu_Item]);} + code0 {o->image(pixmap[(int)Type::Radio_Menu_Item]);} class {fld::widget::Bin_Button} } } @@ -970,42 +970,42 @@ else user_data {"Fl_Browser"} callback type_make_cb tooltip Browser xywh {484 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Browser]);} + code0 {o->image(pixmap[(int)Type::Browser]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Tree"} callback type_make_cb tooltip Tree xywh {509 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Tree]);} + code0 {o->image(pixmap[(int)Type::Tree]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Check_Browser"} callback type_make_cb tooltip {Check Browser} xywh {484 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Check_Browser]);} + code0 {o->image(pixmap[(int)Type::Check_Browser]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Help_View"} callback type_make_cb tooltip {Help Browser} xywh {509 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Help_View]);} + code0 {o->image(pixmap[(int)Type::Help_View]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_File_Browser"} callback type_make_cb tooltip {File Browser} xywh {484 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_File_Browser]);} + code0 {o->image(pixmap[(int)Type::File_Browser]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Table"} callback type_make_cb tooltip Table xywh {509 71 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Table]);} + code0 {o->image(pixmap[(int)Type::Table]);} class {fld::widget::Bin_Button} } } @@ -1017,21 +1017,21 @@ else user_data {"Fl_Box"} callback type_make_cb tooltip Box xywh {542 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Box]);} + code0 {o->image(pixmap[(int)Type::Box]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Clock"} callback type_make_cb tooltip Clock xywh {567 21 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Clock]);} + code0 {o->image(pixmap[(int)Type::Clock]);} class {fld::widget::Bin_Button} } Fl_Button {} { user_data {"Fl_Progress"} callback type_make_cb tooltip Progress xywh {542 46 24 24} box THIN_UP_BOX - code0 {o->image(pixmap[ID_Progress]);} + code0 {o->image(pixmap[(int)Type::Progress]);} class {fld::widget::Bin_Button} } } diff --git a/fluid/panels/print_panel.cxx b/fluid/panels/print_panel.cxx deleted file mode 100644 index f585efee5..000000000 --- a/fluid/panels/print_panel.cxx +++ /dev/null @@ -1,586 +0,0 @@ -// -// FLUID print panel for the Fast Light Tool Kit (FLTK). -// -// Copyright 1998-2020 by Bill Spitzak and others. -// -// This library is free software. Distribution and use rights are outlined in -// the file "COPYING" which should have been included with this file. If this -// file is missing or damaged, see the license at: -// -// https://www.fltk.org/COPYING.php -// -// Please see the following page on how to report bugs and issues: -// -// https://www.fltk.org/bugs.php -// - -// generated by Fast Light User Interface Designer (fluid) version 1.0500 - -#include "print_panel.h" -#include "app/fluid.h" -#include -#include "../src/flstring.h" -#include -#include - -Fl_Double_Window *print_panel=(Fl_Double_Window *)0; - -Fl_Group *print_panel_controls=(Fl_Group *)0; - -Fl_Choice *print_choice=(Fl_Choice *)0; - -static void cb_print_choice(Fl_Choice*, void*) { - print_update_status(); -} - -Fl_Button *print_properties=(Fl_Button *)0; - -static void cb_print_properties(Fl_Button*, void*) { - print_properties_panel->show(); -} - -Fl_Box *print_status=(Fl_Box *)0; - -Fl_Round_Button *print_all=(Fl_Round_Button *)0; - -static void cb_print_all(Fl_Round_Button*, void*) { - print_from->deactivate(); - print_to->deactivate(); -} - -Fl_Round_Button *print_pages=(Fl_Round_Button *)0; - -static void cb_print_pages(Fl_Round_Button*, void*) { - print_from->activate(); - print_to->activate(); -} - -Fl_Round_Button *print_selection=(Fl_Round_Button *)0; - -static void cb_print_selection(Fl_Round_Button*, void*) { - print_from->deactivate(); - print_to->deactivate(); -} - -Fl_Int_Input *print_from=(Fl_Int_Input *)0; - -Fl_Int_Input *print_to=(Fl_Int_Input *)0; - -Fl_Spinner *print_copies=(Fl_Spinner *)0; - -static void cb_print_copies(Fl_Spinner*, void*) { - if (print_copies->value() == 1) { - print_collate_button->deactivate(); - print_collate_group[0]->deactivate(); - print_collate_group[1]->deactivate(); - } else { - print_collate_button->activate(); - print_collate_group[0]->activate(); - print_collate_group[1]->activate(); - } -} - -Fl_Check_Button *print_collate_button=(Fl_Check_Button *)0; - -static void cb_print_collate_button(Fl_Check_Button*, void*) { - int i = print_collate_button->value() != 0; - print_collate_group[i]->show(); - print_collate_group[1 - i]->hide(); -} - -Fl_Group *print_collate_group[2]={(Fl_Group *)0}; - -static void cb_Cancel(Fl_Button*, void*) { - print_panel->hide(); -} - -Fl_Progress *print_progress=(Fl_Progress *)0; - -Fl_Double_Window *print_properties_panel=(Fl_Double_Window *)0; - -static void cb_print_properties_panel(Fl_Double_Window*, void*) { - print_properties_panel->hide(); - print_update_status(); -} - -Fl_Choice *print_page_size=(Fl_Choice *)0; - -Fl_Menu_Item menu_print_page_size[] = { - {"Letter", 0, 0, 0, 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0}, - {"A4", 0, 0, 0, 0, (uchar)FL_NORMAL_LABEL, 0, 14, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -#include - -static const char *idata_print_color[] = { -"24 24 17 1", -" \tc None", -".\tc #FFFF00", -"+\tc #C8FF00", -"@\tc #00FF00", -"#\tc #FFC800", -"$\tc #FF0000", -"%\tc #00FFFF", -"&\tc #000000", -"*\tc #FF00FF", -"=\tc #00FFC8", -"-\tc #FF00C8", -";\tc #00C800", -">\tc #C80000", -",\tc #0000C8", -"\'\tc #0000FF", -")\tc #00C8FF", -"!\tc #C800FF", -" ...... ", -" .......... ", -" ............ ", -" .............. ", -" .............. ", -" ................ ", -" ................ ", -" ................ ", -" +@@@@@@+#$$$$$$# ", -" %@@@@@@@&&$$$$$$$* ", -" %%@@@@@@&&&&$$$$$$** ", -" %%%=@@@@&&&&&&$$$$-*** ", -" %%%%@@@;&&&&&&>$$$**** ", -"%%%%%%@@&&&&&&&&$$******", -"%%%%%%%@&&&&&&&&$*******", -"%%%%%%%%,&&&&&&,********", -"%%%%%%%%\'\'\'\'\'\'\'\'********", -"%%%%%%%%\'\'\'\'\'\'\'\'********", -"%%%%%%%%\'\'\'\'\'\'\'\'********", -" %%%%%%%)\'\'\'\'\'\'!******* ", -" %%%%%%%%\'\'\'\'\'\'******** ", -" %%%%%%%%\'\'\'\'******** ", -" %%%%%%%%\'\'******** ", -" %%%%%% ****** " -}; -static Fl_Image *image_print_color() { - static Fl_Image *image = NULL; - if (!image) - image = new Fl_Pixmap(idata_print_color); - return image; -} - -static const char *idata_print_gray[] = { -"24 24 17 1", -" \tc None", -".\tc #E3E3E3", -"+\tc #D2D2D2", -"@\tc #969696", -"#\tc #C2C2C2", -"$\tc #4C4C4C", -"%\tc #B2B2B2", -"&\tc #000000", -"*\tc #696969", -"=\tc #ACACAC", -"-\tc #626262", -";\tc #767676", -">\tc #3C3C3C", -",\tc #161616", -"\'\tc #1C1C1C", -")\tc #929292", -"!\tc #585858", -" ...... ", -" .......... ", -" ............ ", -" .............. ", -" .............. ", -" ................ ", -" ................ ", -" ................ ", -" +@@@@@@+#$$$$$$# ", -" %@@@@@@@&&$$$$$$$* ", -" %%@@@@@@&&&&$$$$$$** ", -" %%%=@@@@&&&&&&$$$$-*** ", -" %%%%@@@;&&&&&&>$$$**** ", -"%%%%%%@@&&&&&&&&$$******", -"%%%%%%%@&&&&&&&&$*******", -"%%%%%%%%,&&&&&&,********", -"%%%%%%%%\'\'\'\'\'\'\'\'********", -"%%%%%%%%\'\'\'\'\'\'\'\'********", -"%%%%%%%%\'\'\'\'\'\'\'\'********", -" %%%%%%%)\'\'\'\'\'\'!******* ", -" %%%%%%%%\'\'\'\'\'\'******** ", -" %%%%%%%%\'\'\'\'******** ", -" %%%%%%%%\'\'******** ", -" %%%%%% ****** " -}; -static Fl_Image *image_print_gray() { - static Fl_Image *image = NULL; - if (!image) - image = new Fl_Pixmap(idata_print_gray); - return image; -} - -Fl_Button *print_output_mode[4]={(Fl_Button *)0}; - -static void cb_Save(Fl_Return_Button*, void*) { - print_properties_panel->hide(); - - char name[1024]; - int val; - const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data(); - - snprintf(name, sizeof(name), "%s/page_size", printer); - fluid_prefs.set(name, print_page_size->value()); - - snprintf(name, sizeof(name), "%s/output_mode", printer); - for (val = 0; val < 4; val ++) { - if (print_output_mode[val]->value()) break; - } - fluid_prefs.set(name, val); -} - -static void cb_Cancel1(Fl_Button*, void*) { - print_properties_panel->hide(); - print_update_status(); -} - -static void cb_Use(Fl_Button*, void*) { - print_properties_panel->hide(); -} - -Fl_Double_Window* make_print_panel() { - { print_panel = new Fl_Double_Window(465, 235, "Print"); - { print_panel_controls = new Fl_Group(10, 10, 447, 216); - { print_choice = new Fl_Choice(113, 10, 181, 25, "Printer:"); - print_choice->down_box(FL_BORDER_BOX); - print_choice->labelfont(1); - print_choice->callback((Fl_Callback*)cb_print_choice); - print_choice->when(FL_WHEN_CHANGED); - } // Fl_Choice* print_choice - { print_properties = new Fl_Button(294, 10, 105, 25, "Properties..."); - print_properties->callback((Fl_Callback*)cb_print_properties); - } // Fl_Button* print_properties - { print_status = new Fl_Box(111, 41, 288, 17, "printer/job status"); - print_status->align(Fl_Align(68|FL_ALIGN_INSIDE)); - } // Fl_Box* print_status - { Fl_Group* o = new Fl_Group(10, 86, 227, 105, "Print Range"); - o->box(FL_THIN_DOWN_BOX); - o->labelfont(1); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - { print_all = new Fl_Round_Button(20, 96, 38, 25, "All"); - print_all->type(102); - print_all->down_box(FL_ROUND_DOWN_BOX); - print_all->value(1); - print_all->callback((Fl_Callback*)cb_print_all); - } // Fl_Round_Button* print_all - { print_pages = new Fl_Round_Button(20, 126, 64, 25, "Pages"); - print_pages->type(102); - print_pages->down_box(FL_ROUND_DOWN_BOX); - print_pages->callback((Fl_Callback*)cb_print_pages); - } // Fl_Round_Button* print_pages - { print_selection = new Fl_Round_Button(20, 156, 82, 25, "Selection"); - print_selection->type(102); - print_selection->down_box(FL_ROUND_DOWN_BOX); - print_selection->callback((Fl_Callback*)cb_print_selection); - } // Fl_Round_Button* print_selection - { print_from = new Fl_Int_Input(136, 126, 28, 25, "From:"); - print_from->type(2); - print_from->textfont(4); - print_from->deactivate(); - } // Fl_Int_Input* print_from - { print_to = new Fl_Int_Input(199, 126, 28, 25, "To:"); - print_to->type(2); - print_to->textfont(4); - print_to->deactivate(); - } // Fl_Int_Input* print_to - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(247, 86, 210, 105, "Copies"); - o->box(FL_THIN_DOWN_BOX); - o->labelfont(1); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - { print_copies = new Fl_Spinner(321, 96, 45, 25, "# Copies:"); - print_copies->callback((Fl_Callback*)cb_print_copies); - print_copies->when(FL_WHEN_CHANGED); - } // Fl_Spinner* print_copies - { print_collate_button = new Fl_Check_Button(376, 96, 64, 25, "Collate"); - print_collate_button->down_box(FL_DOWN_BOX); - print_collate_button->callback((Fl_Callback*)cb_print_collate_button); - print_collate_button->when(FL_WHEN_CHANGED); - print_collate_button->deactivate(); - } // Fl_Check_Button* print_collate_button - { print_collate_group[0] = new Fl_Group(257, 131, 191, 50); - print_collate_group[0]->deactivate(); - { Fl_Box* o = new Fl_Box(287, 141, 30, 40, "1"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - o->deactivate(); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(272, 136, 30, 40, "1"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - o->deactivate(); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(257, 131, 30, 40, "1"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - o->deactivate(); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(352, 141, 30, 40, "2"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - o->deactivate(); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(337, 136, 30, 40, "2"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - o->deactivate(); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(322, 131, 30, 40, "2"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - o->deactivate(); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(417, 141, 30, 40, "3"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - o->deactivate(); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(402, 136, 30, 40, "3"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - o->deactivate(); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(387, 131, 30, 40, "3"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - o->deactivate(); - } // Fl_Box* o - print_collate_group[0]->end(); - } // Fl_Group* print_collate_group[0] - { print_collate_group[1] = new Fl_Group(257, 131, 191, 50); - print_collate_group[1]->hide(); - print_collate_group[1]->deactivate(); - { Fl_Box* o = new Fl_Box(287, 141, 30, 40, "3"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(272, 136, 30, 40, "2"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(257, 131, 30, 40, "1"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(352, 141, 30, 40, "3"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(337, 136, 30, 40, "2"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(322, 131, 30, 40, "1"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(417, 141, 30, 40, "3"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(402, 136, 30, 40, "2"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - } // Fl_Box* o - { Fl_Box* o = new Fl_Box(387, 131, 30, 40, "1"); - o->box(FL_BORDER_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->labelsize(11); - o->align(Fl_Align(FL_ALIGN_BOTTOM_RIGHT|FL_ALIGN_INSIDE)); - } // Fl_Box* o - print_collate_group[1]->end(); - } // Fl_Group* print_collate_group[1] - o->end(); - } // Fl_Group* o - { Fl_Return_Button* o = new Fl_Return_Button(309, 201, 70, 25, "Print"); - o->callback((Fl_Callback*)print_cb); - } // Fl_Return_Button* o - { Fl_Button* o = new Fl_Button(389, 201, 68, 25, "Cancel"); - o->callback((Fl_Callback*)cb_Cancel); - } // Fl_Button* o - print_panel_controls->end(); - } // Fl_Group* print_panel_controls - { print_progress = new Fl_Progress(10, 203, 289, 21); - print_progress->selection_color((Fl_Color)4); - print_progress->hide(); - } // Fl_Progress* print_progress - print_panel->set_modal(); - print_panel->end(); - } // Fl_Double_Window* print_panel - { print_properties_panel = new Fl_Double_Window(290, 130, "Printer Properties"); - print_properties_panel->callback((Fl_Callback*)cb_print_properties_panel); - { print_page_size = new Fl_Choice(110, 10, 80, 25, "Page Size:"); - print_page_size->down_box(FL_BORDER_BOX); - print_page_size->labelfont(1); - print_page_size->labelsize(12); - print_page_size->menu(menu_print_page_size); - } // Fl_Choice* print_page_size - { Fl_Group* o = new Fl_Group(110, 45, 170, 40, "Output Mode:"); - o->labelfont(1); - o->labelsize(12); - o->align(Fl_Align(FL_ALIGN_LEFT)); - { print_output_mode[0] = new Fl_Button(110, 45, 30, 40); - print_output_mode[0]->type(102); - print_output_mode[0]->box(FL_BORDER_BOX); - print_output_mode[0]->down_box(FL_BORDER_BOX); - print_output_mode[0]->value(1); - print_output_mode[0]->color(FL_BACKGROUND2_COLOR); - print_output_mode[0]->selection_color(FL_FOREGROUND_COLOR); - print_output_mode[0]->image( image_print_color() ); - } // Fl_Button* print_output_mode[0] - { print_output_mode[1] = new Fl_Button(150, 50, 40, 30); - print_output_mode[1]->type(102); - print_output_mode[1]->box(FL_BORDER_BOX); - print_output_mode[1]->down_box(FL_BORDER_BOX); - print_output_mode[1]->color(FL_BACKGROUND2_COLOR); - print_output_mode[1]->selection_color(FL_FOREGROUND_COLOR); - print_output_mode[1]->image( image_print_color() ); - } // Fl_Button* print_output_mode[1] - { print_output_mode[2] = new Fl_Button(200, 45, 30, 40); - print_output_mode[2]->type(102); - print_output_mode[2]->box(FL_BORDER_BOX); - print_output_mode[2]->down_box(FL_BORDER_BOX); - print_output_mode[2]->color(FL_BACKGROUND2_COLOR); - print_output_mode[2]->selection_color(FL_FOREGROUND_COLOR); - print_output_mode[2]->image( image_print_gray() ); - } // Fl_Button* print_output_mode[2] - { print_output_mode[3] = new Fl_Button(240, 50, 40, 30); - print_output_mode[3]->type(102); - print_output_mode[3]->box(FL_BORDER_BOX); - print_output_mode[3]->down_box(FL_BORDER_BOX); - print_output_mode[3]->color(FL_BACKGROUND2_COLOR); - print_output_mode[3]->selection_color(FL_FOREGROUND_COLOR); - print_output_mode[3]->image( image_print_gray() ); - } // Fl_Button* print_output_mode[3] - o->end(); - } // Fl_Group* o - { Fl_Return_Button* o = new Fl_Return_Button(123, 95, 79, 25, "Save"); - o->callback((Fl_Callback*)cb_Save); - } // Fl_Return_Button* o - { Fl_Button* o = new Fl_Button(212, 95, 68, 25, "Cancel"); - o->callback((Fl_Callback*)cb_Cancel1); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(60, 95, 53, 25, "Use"); - o->callback((Fl_Callback*)cb_Use); - } // Fl_Button* o - print_properties_panel->set_modal(); - print_properties_panel->end(); - } // Fl_Double_Window* print_properties_panel - return print_properties_panel; -} -void print_cb(Fl_Return_Button *, void *); - -void print_load() { - FILE *lpstat; - char line[1024], name[1024], *nptr, qname[2048], *qptr, defname[1024]; - int i; - - if (print_choice->size() > 1) { - for (i = 1; print_choice->text(i); i ++) { - free(print_choice->menu()[i].user_data()); - } - } - - print_choice->clear(); - print_choice->add("Print To File", 0, 0, 0, FL_MENU_DIVIDER); - print_choice->value(0); - - defname[0] = '\0'; - - if ((lpstat = popen("LC_MESSAGES=C LANG=C lpstat -p -d", "r")) != NULL) { - while (fgets(line, sizeof(line), lpstat)) { - if (!strncmp(line, "printer ", 8) && - sscanf(line + 8, "%s", name) == 1) { - for (nptr = name, qptr = qname; *nptr; *qptr++ = *nptr++) { - if (*nptr == '/') *qptr++ = '\\'; - } - *qptr = '\0'; - - print_choice->add(qname, 0, 0, (void *)fl_strdup(name), 0); - } else if (!strncmp(line, "system default destination: ", 28)) { - if (sscanf(line + 28, "%s", defname) != 1) defname[0] = '\0'; - } - } - pclose(lpstat); - } - - if (defname[0]) { - for (i = 1; print_choice->text(i); i ++) { - if (!strcmp((char *)print_choice->menu()[i].user_data(), defname)) { - print_choice->value(i); - break; - } - } - } else if (print_choice->size() > 2) print_choice->value(1); - - - print_update_status(); -} - -void print_update_status() { - FILE *lpstat; - char command[1024]; - static char status[1024]; - const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data(); - - if (print_choice->value()) { - snprintf(command, sizeof(command), "lpstat -p '%s'", printer); - if ((lpstat = popen(command, "r")) != NULL) { - if (fgets(status, sizeof(status), lpstat)==0) { /* ignore */ } - pclose(lpstat); - } else strcpy(status, "printer status unavailable"); - } else status[0] = '\0'; - - print_status->label(status); - - char name[1024]; - int val; - - snprintf(name, sizeof(name), "%s/page_size", printer); - fluid_prefs.get(name, val, 0); - print_page_size->value(val); - - snprintf(name, sizeof(name), "%s/output_mode", printer); - fluid_prefs.get(name, val, 0); - print_output_mode[val]->setonly(); -} diff --git a/fluid/panels/print_panel.fl b/fluid/panels/print_panel.fl deleted file mode 100644 index ae1899c3e..000000000 --- a/fluid/panels/print_panel.fl +++ /dev/null @@ -1,358 +0,0 @@ -# data file for the Fltk User Interface Designer (fluid) -version 1.0500 -header_name {.h} -code_name {.cxx} -comment {// -// FLUID print panel for the Fast Light Tool Kit (FLTK). -// -// Copyright 1998-2020 by Bill Spitzak and others. -// -// This library is free software. Distribution and use rights are outlined in -// the file "COPYING" which should have been included with this file. If this -// file is missing or damaged, see the license at: -// -// https://www.fltk.org/COPYING.php -// -// Please see the following page on how to report bugs and issues: -// -// https://www.fltk.org/bugs.php -// -} {in_source in_header -} - -decl {\#include "app/fluid.h"} {private local -} - -decl {\#include } {private local -} - -decl {\#include "../src/flstring.h"} {private local -} - -decl {\#include } {private local -} - -decl {\#include } {private local -} - -Function {make_print_panel()} {open -} { - Fl_Window print_panel { - label Print selected - xywh {465 222 465 235} type Double modal visible - } { - Fl_Group print_panel_controls {open - xywh {10 10 447 216} - } { - Fl_Choice print_choice { - label {Printer:} - callback {print_update_status();} open - xywh {113 10 181 25} down_box BORDER_BOX labelfont 1 when 1 - } {} - Fl_Button print_properties { - label {Properties...} - callback {print_properties_panel->show();} - xywh {294 10 105 25} - } - Fl_Box print_status { - label {printer/job status} - xywh {111 41 288 17} align 84 - } - Fl_Group {} { - label {Print Range} open - xywh {10 86 227 105} box THIN_DOWN_BOX labelfont 1 align 5 - } { - Fl_Round_Button print_all { - label All - callback {print_from->deactivate(); -print_to->deactivate();} - xywh {20 96 38 25} type Radio down_box ROUND_DOWN_BOX value 1 - } - Fl_Round_Button print_pages { - label Pages - callback {print_from->activate(); -print_to->activate();} - xywh {20 126 64 25} type Radio down_box ROUND_DOWN_BOX - } - Fl_Round_Button print_selection { - label Selection - callback {print_from->deactivate(); -print_to->deactivate();} - xywh {20 156 82 25} type Radio down_box ROUND_DOWN_BOX - } - Fl_Input print_from { - label {From:} - xywh {136 126 28 25} type Int textfont 4 deactivate - } - Fl_Input print_to { - label {To:} - xywh {199 126 28 25} type Int textfont 4 deactivate - } - } - Fl_Group {} { - label Copies open - xywh {247 86 210 105} box THIN_DOWN_BOX labelfont 1 align 5 - } { - Fl_Spinner print_copies { - label {\# Copies:} - callback {if (print_copies->value() == 1) { - print_collate_button->deactivate(); - print_collate_group[0]->deactivate(); - print_collate_group[1]->deactivate(); -} else { - print_collate_button->activate(); - print_collate_group[0]->activate(); - print_collate_group[1]->activate(); -}} - xywh {321 96 45 25} when 1 - } - Fl_Check_Button print_collate_button { - label Collate - callback {int i = print_collate_button->value() != 0; -print_collate_group[i]->show(); -print_collate_group[1 - i]->hide();} - xywh {376 96 64 25} down_box DOWN_BOX when 1 deactivate - } - Fl_Group {print_collate_group[0]} { - xywh {257 131 191 50} deactivate - } { - Fl_Box {} { - label 1 - xywh {287 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate - } - Fl_Box {} { - label 1 - xywh {272 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate - } - Fl_Box {} { - label 1 - xywh {257 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate - } - Fl_Box {} { - label 2 - xywh {352 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate - } - Fl_Box {} { - label 2 - xywh {337 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate - } - Fl_Box {} { - label 2 - xywh {322 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate - } - Fl_Box {} { - label 3 - xywh {417 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate - } - Fl_Box {} { - label 3 - xywh {402 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate - } - Fl_Box {} { - label 3 - xywh {387 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26 deactivate - } - } - Fl_Group {print_collate_group[1]} { - xywh {257 131 191 50} hide deactivate - } { - Fl_Box {} { - label 3 - xywh {287 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26 - } - Fl_Box {} { - label 2 - xywh {272 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26 - } - Fl_Box {} { - label 1 - xywh {257 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26 - } - Fl_Box {} { - label 3 - xywh {352 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26 - } - Fl_Box {} { - label 2 - xywh {337 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26 - } - Fl_Box {} { - label 1 - xywh {322 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26 - } - Fl_Box {} { - label 3 - xywh {417 141 30 40} box BORDER_BOX color 7 labelsize 11 align 26 - } - Fl_Box {} { - label 2 - xywh {402 136 30 40} box BORDER_BOX color 7 labelsize 11 align 26 - } - Fl_Box {} { - label 1 - xywh {387 131 30 40} box BORDER_BOX color 7 labelsize 11 align 26 - } - } - } - Fl_Return_Button {} { - label Print - callback print_cb - xywh {309 201 70 25} - } - Fl_Button {} { - label Cancel - callback {print_panel->hide();} - xywh {389 201 68 25} - } - } - Fl_Progress print_progress { - xywh {10 203 289 21} selection_color 4 hide - } - } - Fl_Window print_properties_panel { - label {Printer Properties} - callback {print_properties_panel->hide(); -print_update_status();} - xywh {462 486 290 130} type Double modal visible - } { - Fl_Choice print_page_size { - label {Page Size:} - xywh {110 10 80 25} down_box BORDER_BOX labelfont 1 labelsize 12 - } { - MenuItem {} { - label Letter - xywh {0 0 35 25} - } - MenuItem {} { - label A4 - xywh {0 0 35 25} - } - } - Fl_Group {} { - label {Output Mode:} open - xywh {110 45 170 40} labelfont 1 labelsize 12 align 4 - } { - Fl_Button {print_output_mode[0]} { - image {../pixmaps/print_color.xpm} compress_image 0 xywh {110 45 30 40} type Radio box BORDER_BOX down_box BORDER_BOX value 1 color 7 selection_color 0 - } - Fl_Button {print_output_mode[1]} { - image {../pixmaps/print_color.xpm} compress_image 0 xywh {150 50 40 30} type Radio box BORDER_BOX down_box BORDER_BOX color 7 selection_color 0 - } - Fl_Button {print_output_mode[2]} { - image {../pixmaps/print_gray.xpm} compress_image 0 xywh {200 45 30 40} type Radio box BORDER_BOX down_box BORDER_BOX color 7 selection_color 0 - } - Fl_Button {print_output_mode[3]} { - image {../pixmaps/print_gray.xpm} compress_image 0 xywh {240 50 40 30} type Radio box BORDER_BOX down_box BORDER_BOX color 7 selection_color 0 - } - } - Fl_Return_Button {} { - label Save - callback {print_properties_panel->hide(); - -char name[1024]; -int val; -const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data(); - -snprintf(name, sizeof(name), "%s/page_size", printer); -fluid_prefs.set(name, print_page_size->value()); - -snprintf(name, sizeof(name), "%s/output_mode", printer); -for (val = 0; val < 4; val ++) { - if (print_output_mode[val]->value()) break; -} -fluid_prefs.set(name, val);} - xywh {123 95 79 25} - } - Fl_Button {} { - label Cancel - callback {print_properties_panel->hide(); -print_update_status();} - xywh {212 95 68 25} - } - Fl_Button {} { - label Use - callback {print_properties_panel->hide();} - xywh {60 95 53 25} - } - } -} - -decl {void print_cb(Fl_Return_Button *, void *);} {public local -} - -Function {print_load()} {open return_type void -} { - code {FILE *lpstat; -char line[1024], name[1024], *nptr, qname[2048], *qptr, defname[1024]; -int i; - -if (print_choice->size() > 1) { - for (i = 1; print_choice->text(i); i ++) { - free(print_choice->menu()[i].user_data()); - } -} - -print_choice->clear(); -print_choice->add("Print To File", 0, 0, 0, FL_MENU_DIVIDER); -print_choice->value(0); - -defname[0] = '\\0'; - -if ((lpstat = popen("LC_MESSAGES=C LANG=C lpstat -p -d", "r")) != NULL) { - while (fgets(line, sizeof(line), lpstat)) { - if (!strncmp(line, "printer ", 8) && - sscanf(line + 8, "%s", name) == 1) { - for (nptr = name, qptr = qname; *nptr; *qptr++ = *nptr++) { - if (*nptr == '/') *qptr++ = '\\\\'; - } - *qptr = '\\0'; - - print_choice->add(qname, 0, 0, (void *)fl_strdup(name), 0); - } else if (!strncmp(line, "system default destination: ", 28)) { - if (sscanf(line + 28, "%s", defname) != 1) defname[0] = '\\0'; - } - } - pclose(lpstat); -} - -if (defname[0]) { - for (i = 1; print_choice->text(i); i ++) { - if (!strcmp((char *)print_choice->menu()[i].user_data(), defname)) { - print_choice->value(i); - break; - } - } -} else if (print_choice->size() > 2) print_choice->value(1); - - -print_update_status();} {} -} - -Function {print_update_status()} {open return_type void -} { - code {FILE *lpstat; -char command[1024]; -static char status[1024]; -const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data(); - -if (print_choice->value()) { - snprintf(command, sizeof(command), "lpstat -p '%s'", printer); - if ((lpstat = popen(command, "r")) != NULL) { - if (fgets(status, sizeof(status), lpstat)==0) { /* ignore */ } - pclose(lpstat); - } else strcpy(status, "printer status unavailable"); -} else status[0] = '\\0'; - -print_status->label(status); - -char name[1024]; -int val; - -snprintf(name, sizeof(name), "%s/page_size", printer); -fluid_prefs.get(name, val, 0); -print_page_size->value(val); - -snprintf(name, sizeof(name), "%s/output_mode", printer); -fluid_prefs.get(name, val, 0); -print_output_mode[val]->setonly();} {} -} diff --git a/fluid/panels/print_panel.h b/fluid/panels/print_panel.h deleted file mode 100644 index fed8fd3c0..000000000 --- a/fluid/panels/print_panel.h +++ /dev/null @@ -1,56 +0,0 @@ -// -// FLUID print panel for the Fast Light Tool Kit (FLTK). -// -// Copyright 1998-2020 by Bill Spitzak and others. -// -// This library is free software. Distribution and use rights are outlined in -// the file "COPYING" which should have been included with this file. If this -// file is missing or damaged, see the license at: -// -// https://www.fltk.org/COPYING.php -// -// Please see the following page on how to report bugs and issues: -// -// https://www.fltk.org/bugs.php -// - -// generated by Fast Light User Interface Designer (fluid) version 1.0500 - -#ifndef print_panel_h -#define print_panel_h -#include -#include -extern Fl_Double_Window *print_panel; -#include -extern Fl_Group *print_panel_controls; -#include -extern Fl_Choice *print_choice; -#include -extern Fl_Button *print_properties; -#include -extern Fl_Box *print_status; -#include -extern Fl_Round_Button *print_all; -extern Fl_Round_Button *print_pages; -extern Fl_Round_Button *print_selection; -#include -extern Fl_Int_Input *print_from; -extern Fl_Int_Input *print_to; -#include -extern Fl_Spinner *print_copies; -#include -extern Fl_Check_Button *print_collate_button; -extern Fl_Group *print_collate_group[2]; -#include -extern void print_cb(Fl_Return_Button*, void*); -#include -extern Fl_Progress *print_progress; -extern Fl_Double_Window *print_properties_panel; -extern Fl_Choice *print_page_size; -extern Fl_Button *print_output_mode[4]; -Fl_Double_Window* make_print_panel(); -extern Fl_Menu_Item menu_print_page_size[]; -extern void print_cb(Fl_Return_Button *, void *); -void print_load(); -void print_update_status(); -#endif diff --git a/fluid/panels/settings_panel.cxx b/fluid/panels/settings_panel.cxx index 358f90c8d..432613623 100644 --- a/fluid/panels/settings_panel.cxx +++ b/fluid/panels/settings_panel.cxx @@ -17,8 +17,8 @@ // generated by Fast Light User Interface Designer (fluid) version 1.0500 #include "settings_panel.h" -#include "app/project.h" -#include "app/undo.h" +#include "Project.h" +#include "proj/undo.h" #include #include #include @@ -230,7 +230,7 @@ static const unsigned char idata_general_64[] = 150,102,123,63,248,127,27,97,180,206,27,14,172,151,0,0,0,0,73,69,78,68,174,66, 96,130}; static Fl_Image *image_general_64() { - static Fl_Image *image = NULL; + static Fl_Image *image = 0L; if (!image) image = new Fl_PNG_Image("general_64.png", idata_general_64, 2162); return image; @@ -242,36 +242,40 @@ static void cb_(Fl_Group* o, void* v) { Fl_Scheme_Choice *scheme_choice=(Fl_Scheme_Choice *)0; +static void cb_scheme_choice(Fl_Scheme_Choice* o, void*) { + Fluid.set_scheme(o->text(o->value())); +} + Fl_Check_Button *tooltips_button=(Fl_Check_Button *)0; static void cb_tooltips_button(Fl_Check_Button*, void*) { Fl_Tooltip::enable(tooltips_button->value()); - fluid_prefs.set("show_tooltips", tooltips_button->value()); + Fluid.preferences.set("show_tooltips", tooltips_button->value()); } Fl_Check_Button *completion_button=(Fl_Check_Button *)0; static void cb_completion_button(Fl_Check_Button*, void*) { - fluid_prefs.set("show_completion_dialogs", completion_button->value()); + Fluid.preferences.set("show_completion_dialogs", completion_button->value()); } Fl_Check_Button *openlast_button=(Fl_Check_Button *)0; static void cb_openlast_button(Fl_Check_Button*, void*) { - fluid_prefs.set("open_previous_file", openlast_button->value()); + Fluid.preferences.set("open_previous_file", openlast_button->value()); } Fl_Check_Button *prevpos_button=(Fl_Check_Button *)0; static void cb_prevpos_button(Fl_Check_Button*, void*) { - fluid_prefs.set("prev_window_pos", prevpos_button->value()); + Fluid.preferences.set("prev_window_pos", prevpos_button->value()); } Fl_Check_Button *show_comments_button=(Fl_Check_Button *)0; static void cb_show_comments_button(Fl_Check_Button*, void*) { - show_comments = show_comments_button->value(); - fluid_prefs.set("show_comments", show_comments); + Fluid.show_comments = show_comments_button->value(); + Fluid.preferences.set("Fluid.show_comments", Fluid.show_comments); redraw_browser(); } @@ -282,24 +286,24 @@ static void cb_1(Fl_Group* o, void* v) { Fl_Spinner *recent_spinner=(Fl_Spinner *)0; static void cb_recent_spinner(Fl_Spinner*, void*) { - fluid_prefs.set("recent_files", recent_spinner->value()); - load_history(); + Fluid.preferences.set("recent_files", recent_spinner->value()); + Fluid.history.load(); } Fl_Check_Button *use_external_editor_button=(Fl_Check_Button *)0; static void cb_use_external_editor_button(Fl_Check_Button*, void*) { - G_use_external_editor = use_external_editor_button->value(); - fluid_prefs.set("use_external_editor", G_use_external_editor); + Fluid.use_external_editor = use_external_editor_button->value(); + Fluid.preferences.set("use_external_editor", Fluid.use_external_editor); redraw_browser(); } Fl_Input *editor_command_input=(Fl_Input *)0; static void cb_editor_command_input(Fl_Input*, void*) { - strncpy(G_external_editor_command, editor_command_input->value(), sizeof(G_external_editor_command)-1); - G_external_editor_command[sizeof(G_external_editor_command)-1] = 0; - fluid_prefs.set("external_editor_command", G_external_editor_command); + strncpy(Fluid.external_editor_command, editor_command_input->value(), sizeof(Fluid.external_editor_command)-1); + Fluid.external_editor_command[sizeof(Fluid.external_editor_command)-1] = 0; + Fluid.preferences.set("external_editor_command", Fluid.external_editor_command); redraw_browser(); } @@ -359,7 +363,7 @@ static const unsigned char idata_document_64[] = 147,239,104,255,202,153,244,20,250,15,100,60,232,29,230,9,101,148,0,0,0,0,73,69, 78,68,174,66,96,130}; static Fl_Image *image_document_64() { - static Fl_Image *image = NULL; + static Fl_Image *image = 0L; if (!image) image = new Fl_PNG_Image("document_64.png", idata_document_64, 927); return image; @@ -369,11 +373,11 @@ Fl_Input *header_file_input=(Fl_Input *)0; static void cb_header_file_input(Fl_Input* o, void* v) { if (v == LOAD) { - o->value(g_project.header_file_name.c_str()); + o->value(Fluid.proj.header_file_name.c_str()); } else { - if (strcmp(g_project.header_file_name.c_str(), o->value())) { - g_project.header_file_name = o->value(); - set_modflag(1); + if (strcmp(Fluid.proj.header_file_name.c_str(), o->value())) { + Fluid.proj.header_file_name = o->value(); + Fluid.proj.set_modflag(1); } } } @@ -382,11 +386,11 @@ Fl_Input *code_file_input=(Fl_Input *)0; static void cb_code_file_input(Fl_Input* o, void* v) { if (v == LOAD) { - o->value(g_project.code_file_name.c_str()); + o->value(Fluid.proj.code_file_name.c_str()); } else { - if (strcmp(g_project.code_file_name.c_str(), o->value())) { - g_project.code_file_name = o->value(); - set_modflag(1); + if (strcmp(Fluid.proj.code_file_name.c_str(), o->value())) { + Fluid.proj.code_file_name = o->value(); + Fluid.proj.set_modflag(1); } } } @@ -395,11 +399,11 @@ Fl_Check_Button *include_H_from_C_button=(Fl_Check_Button *)0; static void cb_include_H_from_C_button(Fl_Check_Button* o, void* v) { if (v == LOAD) { - o->value(g_project.include_H_from_C); + o->value(Fluid.proj.include_H_from_C); } else { - if (g_project.include_H_from_C != o->value()) { - set_modflag(1); - g_project.include_H_from_C = o->value(); + if (Fluid.proj.include_H_from_C != o->value()) { + Fluid.proj.set_modflag(1); + Fluid.proj.include_H_from_C = o->value(); } } } @@ -408,11 +412,11 @@ Fl_Check_Button *use_FL_COMMAND_button=(Fl_Check_Button *)0; static void cb_use_FL_COMMAND_button(Fl_Check_Button* o, void* v) { if (v == LOAD) { - o->value(g_project.use_FL_COMMAND); + o->value(Fluid.proj.use_FL_COMMAND); } else { - if (g_project.use_FL_COMMAND != o->value()) { - set_modflag(1); - g_project.use_FL_COMMAND = o->value(); + if (Fluid.proj.use_FL_COMMAND != o->value()) { + Fluid.proj.set_modflag(1); + Fluid.proj.use_FL_COMMAND = o->value(); } } } @@ -421,11 +425,11 @@ Fl_Check_Button *utf8_in_src_button=(Fl_Check_Button *)0; static void cb_utf8_in_src_button(Fl_Check_Button* o, void* v) { if (v == LOAD) { - o->value(g_project.utf8_in_src); + o->value(Fluid.proj.utf8_in_src); } else { - if (g_project.utf8_in_src != o->value()) { - set_modflag(1); - g_project.utf8_in_src = o->value(); + if (Fluid.proj.utf8_in_src != o->value()) { + Fluid.proj.set_modflag(1); + Fluid.proj.utf8_in_src = o->value(); } } } @@ -434,11 +438,11 @@ Fl_Check_Button *avoid_early_includes_button=(Fl_Check_Button *)0; static void cb_avoid_early_includes_button(Fl_Check_Button* o, void* v) { if (v == LOAD) { - o->value(g_project.avoid_early_includes); + o->value(Fluid.proj.avoid_early_includes); } else { - if (g_project.avoid_early_includes != o->value()) { - set_modflag(1); - g_project.avoid_early_includes = o->value(); + if (Fluid.proj.avoid_early_includes != o->value()) { + Fluid.proj.set_modflag(1); + Fluid.proj.avoid_early_includes = o->value(); } } } @@ -447,11 +451,11 @@ Fl_Check_Button *w_proj_mergeback=(Fl_Check_Button *)0; static void cb_w_proj_mergeback(Fl_Check_Button* o, void* v) { if (v == LOAD) { - o->value(g_project.write_mergeback_data); + o->value(Fluid.proj.write_mergeback_data); } else { - if (g_project.write_mergeback_data != o->value()) { - set_modflag(1); - g_project.write_mergeback_data = o->value(); + if (Fluid.proj.write_mergeback_data != o->value()) { + Fluid.proj.set_modflag(1); + Fluid.proj.write_mergeback_data = o->value(); } } } @@ -485,7 +489,7 @@ static const unsigned char idata_layout_64[] = 219,234,153,20,127,159,185,12,250,99,90,14,203,239,127,120,165,154,78,208,47, 215,15,118,242,56,45,94,1,0,0,0,0,73,69,78,68,174,66,96,130}; static Fl_Image *image_layout_64() { - static Fl_Image *image = NULL; + static Fl_Image *image = 0L; if (!image) image = new Fl_PNG_Image("layout_64.png", idata_layout_64, 481); return image; @@ -495,11 +499,11 @@ Fl_Choice *layout_choice=(Fl_Choice *)0; static void cb_layout_choice(Fl_Choice* o, void* v) { if (v == LOAD) { - o->value(g_layout_list.current_suite()); + o->value(Fluid.layout_list.current_suite()); } else { int index = o->value(); - g_layout_list.current_suite(index); - g_layout_list.update_dialogs(); + Fluid.layout_list.current_suite(index); + Fluid.layout_list.update_dialogs(); } } @@ -515,21 +519,21 @@ static void cb_2(Fl_Button*, void* v) { if (v == LOAD) return; std::string old_name = "Copy of "; - old_name.append(g_layout_list[g_layout_list.current_suite()].name_); + old_name.append(Fluid.layout_list[Fluid.layout_list.current_suite()].name_); const char *new_name = fl_input("Enter a name for the new layout:", old_name.c_str()); - if (new_name == NULL) + if (new_name == nullptr) return; - g_layout_list.add(new_name); - g_layout_list.update_dialogs(); + Fluid.layout_list.add(new_name); + Fluid.layout_list.update_dialogs(); } Fl_Menu_Button *w_layout_menu=(Fl_Menu_Button *)0; static void cb_w_layout_menu(Fl_Menu_Button*, void* v) { if (v == LOAD) { - Fd_Layout_Suite &suite = g_layout_list[g_layout_list.current_suite()]; - if (suite.storage_ == FD_STORE_INTERNAL) { + fld::app::Layout_Suite &suite = Fluid.layout_list[Fluid.layout_list.current_suite()]; + if (suite.storage_ == fld::Tool_Store::INTERNAL) { w_layout_menu_rename->deactivate(); for (int i=1; i<4; i++) w_layout_menu_storage[i]->deactivate(); w_layout_menu_delete->deactivate(); @@ -538,44 +542,44 @@ static void cb_w_layout_menu(Fl_Menu_Button*, void* v) { for (int i=1; i<4; i++) w_layout_menu_storage[i]->activate(); w_layout_menu_delete->activate(); } - w_layout_menu_storage[suite.storage_]->setonly(); + w_layout_menu_storage[static_cast(suite.storage_)]->setonly(); } } static void cb_w_layout_menu_rename(Fl_Menu_*, void*) { // Rename the current layout suite - std::string old_name = g_layout_list[g_layout_list.current_suite()].name_; + std::string old_name = Fluid.layout_list[Fluid.layout_list.current_suite()].name_; const char *new_name = fl_input("Enter a new name for the layout:", old_name.c_str()); - if (new_name == NULL) + if (new_name == nullptr) return; - g_layout_list.rename(new_name); - g_layout_list.update_dialogs(); + Fluid.layout_list.rename(new_name); + Fluid.layout_list.update_dialogs(); } static void cb_w_layout_menu_storage(Fl_Menu_*, void*) { - Fd_Layout_Suite &suite = g_layout_list[g_layout_list.current_suite()]; - suite.storage(FD_STORE_INTERNAL); - g_layout_list.update_dialogs(); + fld::app::Layout_Suite &suite = Fluid.layout_list[Fluid.layout_list.current_suite()]; + suite.storage(fld::Tool_Store::INTERNAL); + Fluid.layout_list.update_dialogs(); } static void cb_w_layout_menu_storage1(Fl_Menu_*, void*) { - Fd_Layout_Suite &suite = g_layout_list[g_layout_list.current_suite()]; - suite.storage(FD_STORE_USER); - g_layout_list.update_dialogs(); + fld::app::Layout_Suite &suite = Fluid.layout_list[Fluid.layout_list.current_suite()]; + suite.storage(fld::Tool_Store::USER); + Fluid.layout_list.update_dialogs(); } static void cb_w_layout_menu_storage2(Fl_Menu_*, void*) { - Fd_Layout_Suite &suite = g_layout_list[g_layout_list.current_suite()]; - suite.storage(FD_STORE_PROJECT); - g_layout_list.update_dialogs(); + fld::app::Layout_Suite &suite = Fluid.layout_list[Fluid.layout_list.current_suite()]; + suite.storage(fld::Tool_Store::PROJECT); + Fluid.layout_list.update_dialogs(); } static void cb_w_layout_menu_storage3(Fl_Menu_*, void*) { - Fd_Layout_Suite &suite = g_layout_list[g_layout_list.current_suite()]; - suite.storage(FD_STORE_FILE); - g_layout_list.update_dialogs(); + fld::app::Layout_Suite &suite = Fluid.layout_list[Fluid.layout_list.current_suite()]; + suite.storage(fld::Tool_Store::FILE); + Fluid.layout_list.update_dialogs(); } static void cb_w_layout_menu_load(Fl_Menu_*, void*) { @@ -588,9 +592,9 @@ static void cb_w_layout_menu_load(Fl_Menu_*, void*) { if (fnfc.show() != 0) return; const char *new_filename = fnfc.filename(); if (!new_filename) return; - g_layout_list.load(new_filename); - //g_layout_list.current_suite(n); - g_layout_list.update_dialogs(); + Fluid.layout_list.load(new_filename); + //Fluid.layout_list.current_suite(n); + Fluid.layout_list.update_dialogs(); } static void cb_w_layout_menu_save(Fl_Menu_*, void*) { @@ -600,21 +604,21 @@ static void cb_w_layout_menu_save(Fl_Menu_*, void*) { fnfc.type(Fl_Native_File_Chooser::BROWSE_SAVE_FILE); fnfc.options(Fl_Native_File_Chooser::SAVEAS_CONFIRM | Fl_Native_File_Chooser::USE_FILTER_EXT); fnfc.filter("FLUID Layouts\t*.fll\n"); - std::string filename = g_layout_list.filename_; + std::string filename = Fluid.layout_list.filename_; fnfc.directory(fl_filename_path_str(filename).c_str()); fnfc.preset_file(fl_filename_name_str(filename).c_str()); if (fnfc.show() != 0) return; const char *new_filename = fnfc.filename(); if (!new_filename) return; - g_layout_list.filename_ = new_filename; - g_layout_list.save(new_filename); + Fluid.layout_list.filename_ = new_filename; + Fluid.layout_list.save(new_filename); } static void cb_w_layout_menu_delete(Fl_Menu_*, void*) { // remove the current suite - g_layout_list.remove(g_layout_list.current_suite()); - g_layout_list.update_dialogs(); + Fluid.layout_list.remove(Fluid.layout_list.current_suite()); + Fluid.layout_list.update_dialogs(); } Fl_Menu_Item menu_w_layout_menu[] = { @@ -633,193 +637,193 @@ Fl_Button *preset_choice[3]={(Fl_Button *)0}; static void cb_Left(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->left_window_margin); + o->value((double)Fluid.proj.layout->left_window_margin); } else { - layout->left_window_margin = (int)o->value(); + Fluid.proj.layout->left_window_margin = (int)o->value(); } } static void cb_Top(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->top_window_margin); + o->value((double)Fluid.proj.layout->top_window_margin); } else { - layout->top_window_margin = (int)o->value(); + Fluid.proj.layout->top_window_margin = (int)o->value(); } } static void cb_Right(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->right_window_margin); + o->value((double)Fluid.proj.layout->right_window_margin); } else { - layout->right_window_margin = (int)o->value(); + Fluid.proj.layout->right_window_margin = (int)o->value(); } } static void cb_Bottom(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->bottom_window_margin); + o->value((double)Fluid.proj.layout->bottom_window_margin); } else { - layout->bottom_window_margin = (int)o->value(); + Fluid.proj.layout->bottom_window_margin = (int)o->value(); } } static void cb_Horizontal(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->window_grid_x); + o->value((double)Fluid.proj.layout->window_grid_x); } else { - layout->window_grid_x = (int)o->value(); + Fluid.proj.layout->window_grid_x = (int)o->value(); } } static void cb_Vertical(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->window_grid_y); + o->value((double)Fluid.proj.layout->window_grid_y); } else { - layout->window_grid_y = (int)o->value(); + Fluid.proj.layout->window_grid_y = (int)o->value(); } } static void cb_Left1(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->left_group_margin); + o->value((double)Fluid.proj.layout->left_group_margin); } else { - layout->left_group_margin = (int)o->value(); + Fluid.proj.layout->left_group_margin = (int)o->value(); } } static void cb_Top1(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->top_group_margin); + o->value((double)Fluid.proj.layout->top_group_margin); } else { - layout->top_group_margin = (int)o->value(); + Fluid.proj.layout->top_group_margin = (int)o->value(); } } static void cb_Right1(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->right_group_margin); + o->value((double)Fluid.proj.layout->right_group_margin); } else { - layout->right_group_margin = (int)o->value(); + Fluid.proj.layout->right_group_margin = (int)o->value(); } } static void cb_Bottom1(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->bottom_group_margin); + o->value((double)Fluid.proj.layout->bottom_group_margin); } else { - layout->bottom_group_margin = (int)o->value(); + Fluid.proj.layout->bottom_group_margin = (int)o->value(); } } static void cb_Horizontal1(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->group_grid_x); + o->value((double)Fluid.proj.layout->group_grid_x); } else { - layout->group_grid_x = (int)o->value(); + Fluid.proj.layout->group_grid_x = (int)o->value(); } } static void cb_Vertical1(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->group_grid_y); + o->value((double)Fluid.proj.layout->group_grid_y); } else { - layout->group_grid_y = (int)o->value(); + Fluid.proj.layout->group_grid_y = (int)o->value(); } } static void cb_Top2(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->top_tabs_margin); + o->value((double)Fluid.proj.layout->top_tabs_margin); } else { - layout->top_tabs_margin = (int)o->value(); + Fluid.proj.layout->top_tabs_margin = (int)o->value(); } } static void cb_Bottom2(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->bottom_tabs_margin); + o->value((double)Fluid.proj.layout->bottom_tabs_margin); } else { - layout->bottom_tabs_margin = (int)o->value(); + Fluid.proj.layout->bottom_tabs_margin = (int)o->value(); } } static void cb_Minimum(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->widget_min_w); + o->value((double)Fluid.proj.layout->widget_min_w); } else { - layout->widget_min_w = (int)o->value(); + Fluid.proj.layout->widget_min_w = (int)o->value(); } } static void cb_Increment(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->widget_inc_w); + o->value((double)Fluid.proj.layout->widget_inc_w); } else { - layout->widget_inc_w = (int)o->value(); + Fluid.proj.layout->widget_inc_w = (int)o->value(); } } static void cb_Gap(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->widget_gap_x); + o->value((double)Fluid.proj.layout->widget_gap_x); } else { - layout->widget_gap_x = (int)o->value(); + Fluid.proj.layout->widget_gap_x = (int)o->value(); } } static void cb_3(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->widget_min_h); + o->value((double)Fluid.proj.layout->widget_min_h); } else { - layout->widget_min_h = (int)o->value(); + Fluid.proj.layout->widget_min_h = (int)o->value(); } } static void cb_4(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->widget_inc_h); + o->value((double)Fluid.proj.layout->widget_inc_h); } else { - layout->widget_inc_h = (int)o->value(); + Fluid.proj.layout->widget_inc_h = (int)o->value(); } } static void cb_5(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value((double)layout->widget_gap_y); + o->value((double)Fluid.proj.layout->widget_gap_y); } else { - layout->widget_gap_y = (int)o->value(); + Fluid.proj.layout->widget_gap_y = (int)o->value(); } } static void cb_6(Fl_Choice* o, void* v) { if (v == LOAD) { - o->value(layout->labelfont+1); + o->value(Fluid.proj.layout->labelfont+1); } else { - layout->labelfont = (int)o->value()-1; + Fluid.proj.layout->labelfont = (int)o->value()-1; } } static void cb_7(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value(layout->labelsize); + o->value(Fluid.proj.layout->labelsize); } else { - layout->labelsize = (int)o->value(); + Fluid.proj.layout->labelsize = (int)o->value(); } } static void cb_8(Fl_Choice* o, void* v) { if (v == LOAD) { - o->value(layout->textfont+1); + o->value(Fluid.proj.layout->textfont+1); } else { - layout->textfont = (int)o->value()-1; + Fluid.proj.layout->textfont = (int)o->value()-1; } } static void cb_9(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value(layout->textsize); + o->value(Fluid.proj.layout->textsize); } else { - layout->textsize = (int)o->value(); + Fluid.proj.layout->textsize = (int)o->value(); } } @@ -863,7 +867,7 @@ static const unsigned char idata_shell_64[] = 82,219,229,239,135,114,138,14,109,164,201,83,85,44,126,133,81,55,103,232,191,0, 145,21,211,195,226,88,204,195,0,0,0,0,73,69,78,68,174,66,96,130}; static Fl_Image *image_shell_64() { - static Fl_Image *image = NULL; + static Fl_Image *image = 0L; if (!image) image = new Fl_PNG_Image("shell_64.png", idata_shell_64, 802); return image; @@ -880,9 +884,9 @@ static void cb_w_settings_shell_list(Fl_Browser* o, void* v) { for (int i=0; ilist_size; i++) { Fd_Shell_Command *cmd = g_shell_config->list[i]; o->add(cmd->name.c_str()); - if (cmd->storage == FD_STORE_USER) + if (cmd->storage == fld::Tool_Store::USER) o->icon(i+1, w_settings_shell_fd_user->image()); - else if (cmd->storage == FD_STORE_PROJECT) + else if (cmd->storage == fld::Tool_Store::PROJECT) o->icon(i+1, w_settings_shell_fd_project->image()); } } @@ -915,11 +919,11 @@ static void cb_a(Fl_Button*, void* v) { 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) { + if (cmd->storage == fld::Tool_Store::USER) { w_settings_shell_list->icon(selected+1, w_settings_shell_fd_user->image()); - } else if (cmd->storage == FD_STORE_PROJECT) { + } else if (cmd->storage == fld::Tool_Store::PROJECT) { w_settings_shell_list->icon(selected+1, w_settings_shell_fd_project->image()); - set_modflag(1); + Fluid.proj.set_modflag(1); } w_settings_shell_list->do_callback(); w_settings_shell_cmd->do_callback(w_settings_shell_cmd, LOAD); @@ -945,11 +949,11 @@ static void cb_w_settings_shell_dup(Fl_Button* o, void* v) { 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) { + if (cmd->storage == fld::Tool_Store::USER) { w_settings_shell_list->icon(selected+1, w_settings_shell_fd_user->image()); - } else if (cmd->storage == FD_STORE_PROJECT) { + } else if (cmd->storage == fld::Tool_Store::PROJECT) { w_settings_shell_list->icon(selected+1, w_settings_shell_fd_project->image()); - set_modflag(1); + Fluid.proj.set_modflag(1); } w_settings_shell_list->do_callback(); w_settings_shell_cmd->do_callback(w_settings_shell_cmd, LOAD); @@ -971,9 +975,9 @@ static void cb_w_settings_shell_remove(Fl_Button* o, void* v) { } else { if (!selected) return; int ret = fl_choice("Delete the shell command\n\"%s\"?\n\nThis can not be undone.", - "Delete", "Cancel", NULL, g_shell_config->list[selected-1]->name.c_str()); + "Delete", "Cancel", nullptr, g_shell_config->list[selected-1]->name.c_str()); if (ret==1) return; - if (g_shell_config->at(selected-1)->storage == FD_STORE_PROJECT) set_modflag(1); + if (g_shell_config->at(selected-1)->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); g_shell_config->remove(selected-1); w_settings_shell_list->remove(selected); if (selected <= w_settings_shell_list->size()) @@ -1058,7 +1062,7 @@ static void cb_Name(Fl_Input* o, void* v) { 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); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } } } @@ -1076,7 +1080,7 @@ static void cb_Menu(Fl_Input* o, void* v) { 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); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } } } @@ -1099,7 +1103,7 @@ static void cb_Shortcut(Fl_Shortcut_Button* o, void* v) { 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); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } } } @@ -1108,30 +1112,30 @@ static void cb_Store(Fl_Choice* o, void* v) { int selected = w_settings_shell_list_selected; if (v == LOAD) { if (selected) { - Fd_Tool_Store ts = g_shell_config->list[selected-1]->storage; + fld::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)); + o->value(o->find_item_with_argument((long)fld::Tool_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); + fld::Tool_Store ts = (fld::Tool_Store)(o->mvalue()->argument()); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); cmd->storage = ts; //w_settings_shell_list->text(selected, cmd->name.c_str()); - if (cmd->storage == FD_STORE_USER) + if (cmd->storage == fld::Tool_Store::USER) w_settings_shell_list->icon(selected, w_settings_shell_fd_user->image()); - else if (cmd->storage == FD_STORE_PROJECT) + else if (cmd->storage == fld::Tool_Store::PROJECT) w_settings_shell_list->icon(selected, w_settings_shell_fd_project->image()); - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } } } Fl_Menu_Item menu_Store[] = { - {"@fd_user User Setting", 0, 0, (void*)(FD_STORE_USER), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, - {"@fd_project Project File", 0, 0, (void*)(FD_STORE_PROJECT), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"@fd_user User Setting", 0, 0, (void*)(fld::Tool_Store::USER), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"@fd_project Project File", 0, 0, (void*)(fld::Tool_Store::PROJECT), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, {0,0,0,0,0,0,0,0,0} }; @@ -1150,7 +1154,7 @@ static void cb_Condition(Fl_Choice* o, void* v) { int cond = (int)(o->mvalue()->argument()); cmd->condition = cond; g_shell_config->rebuild_shell_menu(); - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } } } @@ -1187,7 +1191,7 @@ static void cb_w_settings_shell_command(Fl_Text_Editor* o, void* v) { 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); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } } } @@ -1211,7 +1215,7 @@ static void cb_w_settings_shell_text_macros(Fl_Menu_Button* o, void*) { 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); + w_settings_shell_command->do_callback(w_settings_shell_command, (void*)nullptr); } } @@ -1266,7 +1270,7 @@ static void cb_save(Fl_Check_Button* o, void* v) { } else { cmd->flags &= ~Fd_Shell_Command::SAVE_PROJECT; } - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } } } @@ -1288,7 +1292,7 @@ static void cb_save1(Fl_Check_Button* o, void* v) { } else { cmd->flags &= ~Fd_Shell_Command::SAVE_SOURCECODE; } - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } } } @@ -1310,7 +1314,7 @@ static void cb_save2(Fl_Check_Button* o, void* v) { } else { cmd->flags &= ~Fd_Shell_Command::SAVE_STRINGS; } - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } } } @@ -1332,7 +1336,7 @@ static void cb_show(Fl_Check_Button* o, void* v) { } else { cmd->flags &= ~Fd_Shell_Command::DONT_SHOW_TERMINAL; } - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } } } @@ -1354,7 +1358,7 @@ static void cb_clear(Fl_Check_Button* o, void* v) { } else { cmd->flags &= ~Fd_Shell_Command::CLEAR_TERMINAL; } - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } } } @@ -1376,7 +1380,7 @@ static void cb_clear1(Fl_Check_Button* o, void* v) { } else { cmd->flags &= ~Fd_Shell_Command::CLEAR_HISTORY; } - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } } } @@ -1664,7 +1668,7 @@ static const unsigned char idata_fd_project[] = 213,122,16,176,223,94,207,73,175,70,249,59,81,177,117,128,158,31,49,127,246,30, 207,181,170,20,0,0,0,0,73,69,78,68,174,66,96,130}; static Fl_Image *image_fd_project() { - static Fl_Image *image = NULL; + static Fl_Image *image = 0L; if (!image) image = new Fl_PNG_Image("fd_project.png", idata_fd_project, 6950); return image; @@ -2029,7 +2033,7 @@ static const unsigned char idata_fd_user[] = 116,89,108,93,41,107,255,5,119,155,194,247,64,241,254,70,0,0,0,0,73,69,78,68, 174,66,96,130}; static Fl_Image *image_fd_user() { - static Fl_Image *image = NULL; + static Fl_Image *image = 0L; if (!image) image = new Fl_PNG_Image("fd_user.png", idata_fd_user, 8612); return image; @@ -2108,7 +2112,7 @@ static const unsigned char idata_language_64[] = 157,33,48,255,61,163,226,212,114,146,206,17,166,130,48,126,136,23,88,161,222, 205,191,56,75,123,84,202,251,159,166,0,0,0,0,73,69,78,68,174,66,96,130}; static Fl_Image *image_language_64() { - static Fl_Image *image = NULL; + static Fl_Image *image = 0L; if (!image) image = new Fl_PNG_Image("language_64.png", idata_language_64, 1450); return image; @@ -2133,11 +2137,11 @@ Fl_Input *i18n_gnu_include_input=(Fl_Input *)0; static void cb_i18n_gnu_include_input(Fl_Input* o, void* v) { if (v == LOAD) { - o->value(g_project.i18n_gnu_include.c_str()); + o->value(Fluid.proj.i18n_gnu_include.c_str()); } else { - undo_checkpoint(); - g_project.i18n_gnu_include = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_gnu_include = o->value(); + Fluid.proj.set_modflag(1); } } @@ -2145,11 +2149,11 @@ Fl_Input *i18n_gnu_conditional_input=(Fl_Input *)0; static void cb_i18n_gnu_conditional_input(Fl_Input* o, void* v) { if (v == LOAD) { - o->value(g_project.i18n_gnu_conditional.c_str()); + o->value(Fluid.proj.i18n_gnu_conditional.c_str()); } else { - undo_checkpoint(); - g_project.i18n_gnu_conditional = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_gnu_conditional = o->value(); + Fluid.proj.set_modflag(1); } } @@ -2157,11 +2161,11 @@ Fl_Input *i18n_gnu_function_input=(Fl_Input *)0; static void cb_i18n_gnu_function_input(Fl_Input* o, void* v) { if (v == LOAD) { - o->value(g_project.i18n_gnu_function.c_str()); + o->value(Fluid.proj.i18n_gnu_function.c_str()); } else { - undo_checkpoint(); - g_project.i18n_gnu_function = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_gnu_function = o->value(); + Fluid.proj.set_modflag(1); } } @@ -2169,11 +2173,11 @@ Fl_Input *i18n_gnu_static_function_input=(Fl_Input *)0; static void cb_i18n_gnu_static_function_input(Fl_Input* o, void* v) { if (v == LOAD) { - o->value(g_project.i18n_gnu_static_function.c_str()); + o->value(Fluid.proj.i18n_gnu_static_function.c_str()); } else { - undo_checkpoint(); - g_project.i18n_gnu_static_function = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_gnu_static_function = o->value(); + Fluid.proj.set_modflag(1); } } @@ -2187,11 +2191,11 @@ Fl_Input *i18n_pos_include_input=(Fl_Input *)0; static void cb_i18n_pos_include_input(Fl_Input* o, void* v) { if (v == LOAD) { - o->value(g_project.i18n_pos_include.c_str()); + o->value(Fluid.proj.i18n_pos_include.c_str()); } else { - undo_checkpoint(); - g_project.i18n_pos_include = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_pos_include = o->value(); + Fluid.proj.set_modflag(1); } } @@ -2199,11 +2203,11 @@ Fl_Input *i18n_pos_conditional_input=(Fl_Input *)0; static void cb_i18n_pos_conditional_input(Fl_Input* o, void* v) { if (v == LOAD) { - o->value(g_project.i18n_pos_conditional.c_str()); + o->value(Fluid.proj.i18n_pos_conditional.c_str()); } else { - undo_checkpoint(); - g_project.i18n_pos_conditional = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_pos_conditional = o->value(); + Fluid.proj.set_modflag(1); } } @@ -2211,11 +2215,11 @@ Fl_Input *i18n_pos_file_input=(Fl_Input *)0; static void cb_i18n_pos_file_input(Fl_Input* o, void* v) { if (v == LOAD) { - o->value(g_project.i18n_pos_file.c_str()); + o->value(Fluid.proj.i18n_pos_file.c_str()); } else { - undo_checkpoint(); - g_project.i18n_pos_file = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_pos_file = o->value(); + Fluid.proj.set_modflag(1); } } @@ -2227,11 +2231,11 @@ Fl_Int_Input *i18n_pos_set_input=(Fl_Int_Input *)0; static void cb_i18n_pos_set_input(Fl_Int_Input* o, void* v) { if (v == LOAD) { - o->value(g_project.i18n_pos_set.c_str()); + o->value(Fluid.proj.i18n_pos_set.c_str()); } else { - undo_checkpoint(); - g_project.i18n_pos_set = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_pos_set = o->value(); + Fluid.proj.set_modflag(1); } } @@ -2421,7 +2425,7 @@ static const unsigned char idata_user_circle_64[] = 252,106,89,247,128,255,3,60,207,245,248,165,38,113,147,0,0,0,0,73,69,78,68,174, 66,96,130}; static Fl_Image *image_user_circle_64() { - static Fl_Image *image = NULL; + static Fl_Image *image = 0L; if (!image) image = new Fl_PNG_Image("user_circle_64.png", idata_user_circle_64, 3909); return image; @@ -2431,8 +2435,8 @@ Fl_Choice *w_settings_user_commenttext=(Fl_Choice *)0; static void cb_Close(Fl_Button*, void*) { if (g_shell_config) - g_shell_config->write(fluid_prefs, FD_STORE_USER); - g_layout_list.write(fluid_prefs, FD_STORE_USER); + g_shell_config->write(Fluid.preferences, fld::Tool_Store::USER); + Fluid.layout_list.write(Fluid.preferences, fld::Tool_Store::USER); settings_window->hide(); } @@ -2459,10 +2463,10 @@ Fl_Double_Window* make_settings_window() { scheme_choice->labelfont(1); scheme_choice->labelsize(11); scheme_choice->labelcolor(FL_FOREGROUND_COLOR); - scheme_choice->callback((Fl_Callback*)scheme_cb); + scheme_choice->callback((Fl_Callback*)cb_scheme_choice); scheme_choice->align(Fl_Align(FL_ALIGN_LEFT)); scheme_choice->when(FL_WHEN_RELEASE); - init_scheme(); + Fluid.init_scheme(); } // Fl_Scheme_Choice* scheme_choice { Fl_Box* o = new Fl_Box(240, 78, 10, 25); o->hide(); @@ -2480,7 +2484,7 @@ Fl_Double_Window* make_settings_window() { tooltips_button->labelsize(11); tooltips_button->callback((Fl_Callback*)cb_tooltips_button); int b; - fluid_prefs.get("show_tooltips", b, 1); + Fluid.preferences.get("show_tooltips", b, 1); tooltips_button->value(b); Fl_Tooltip::enable(b); } // Fl_Check_Button* tooltips_button @@ -2489,7 +2493,7 @@ Fl_Double_Window* make_settings_window() { completion_button->labelsize(11); completion_button->callback((Fl_Callback*)cb_completion_button); int b; - fluid_prefs.get("show_completion_dialogs", b, 1); + Fluid.preferences.get("show_completion_dialogs", b, 1); completion_button->value(b); } // Fl_Check_Button* completion_button { openlast_button = new Fl_Check_Button(120, 155, 200, 20, "Open Previous File on Startup"); @@ -2497,7 +2501,7 @@ Fl_Double_Window* make_settings_window() { openlast_button->labelsize(11); openlast_button->callback((Fl_Callback*)cb_openlast_button); int b; - fluid_prefs.get("open_previous_file", b, 0); + Fluid.preferences.get("open_previous_file", b, 0); openlast_button->value(b); } // Fl_Check_Button* openlast_button { prevpos_button = new Fl_Check_Button(120, 175, 200, 20, "Remember Window Positions"); @@ -2505,15 +2509,15 @@ Fl_Double_Window* make_settings_window() { prevpos_button->labelsize(11); prevpos_button->callback((Fl_Callback*)cb_prevpos_button); int b; - fluid_prefs.get("prev_window_pos", b, 1); + Fluid.preferences.get("prev_window_pos", b, 1); prevpos_button->value(b); } // Fl_Check_Button* prevpos_button { show_comments_button = new Fl_Check_Button(120, 195, 200, 20, "Show Comments in Browser"); show_comments_button->down_box(FL_DOWN_BOX); show_comments_button->labelsize(11); show_comments_button->callback((Fl_Callback*)cb_show_comments_button); - fluid_prefs.get("show_comments", show_comments, 1); - show_comments_button->value(show_comments); + Fluid.preferences.get("Fluid.show_comments", Fluid.show_comments, 1); + show_comments_button->value(Fluid.show_comments); } // Fl_Check_Button* show_comments_button { Fl_Group* o = new Fl_Group(120, 225, 50, 20); o->callback((Fl_Callback*)cb_1); @@ -2525,7 +2529,7 @@ Fl_Double_Window* make_settings_window() { recent_spinner->callback((Fl_Callback*)cb_recent_spinner); recent_spinner->when(FL_WHEN_CHANGED); int c; - fluid_prefs.get("recent_files", c, 5); + Fluid.preferences.get("recent_files", c, 5); recent_spinner->maximum(10); recent_spinner->value(c); } // Fl_Spinner* recent_spinner @@ -2539,8 +2543,8 @@ Fl_Double_Window* make_settings_window() { use_external_editor_button->down_box(FL_DOWN_BOX); use_external_editor_button->labelsize(11); use_external_editor_button->callback((Fl_Callback*)cb_use_external_editor_button); - fluid_prefs.get("use_external_editor", G_use_external_editor, 0); - use_external_editor_button->value(G_use_external_editor); + Fluid.preferences.get("use_external_editor", Fluid.use_external_editor, 0); + use_external_editor_button->value(Fluid.use_external_editor); } // Fl_Check_Button* use_external_editor_button { editor_command_input = new Fl_Input(120, 255, 200, 20, "External Editor:"); editor_command_input->tooltip("The editor command to open your external text editor.\nInclude any necessary " @@ -2552,8 +2556,8 @@ Fl_Double_Window* make_settings_window() { editor_command_input->textsize(11); editor_command_input->callback((Fl_Callback*)cb_editor_command_input); editor_command_input->when(FL_WHEN_CHANGED); - fluid_prefs.get("external_editor_command", G_external_editor_command, "", sizeof(G_external_editor_command)-1); - editor_command_input->value(G_external_editor_command); + Fluid.preferences.get("external_editor_command", Fluid.external_editor_command, "", sizeof(Fluid.external_editor_command)-1); + editor_command_input->value(Fluid.external_editor_command); } // Fl_Input* editor_command_input { Fl_Box* o = new Fl_Box(120, 300, 0, 20, "Overlays: "); o->labelfont(1); @@ -2565,7 +2569,7 @@ Fl_Double_Window* make_settings_window() { guides_button->down_box(FL_DOWN_BOX); guides_button->labelsize(11); guides_button->callback((Fl_Callback*)toggle_guides_cb); - o->value(show_guides); + o->value(Fluid.show_guides); } // Fl_Check_Button* guides_button { Fl_Check_Button* o = restricted_button = new Fl_Check_Button(120, 320, 200, 20, "Show Restricted Areas"); restricted_button->tooltip("show overlapping and out of bounds areas, show unfilled areas in Fl_Pack grou" @@ -2573,7 +2577,7 @@ Fl_Double_Window* make_settings_window() { restricted_button->down_box(FL_DOWN_BOX); restricted_button->labelsize(11); restricted_button->callback((Fl_Callback*)toggle_restricted_cb); - o->value(show_restricted); + o->value(Fluid.show_restricted); } // Fl_Check_Button* restricted_button { Fl_Check_Button* o = ghosted_outline_button = new Fl_Check_Button(120, 340, 200, 20, "Show Ghosted Group Outlines"); ghosted_outline_button->tooltip("groups with no box type or flat boxtypes without contrast will be rendered wi" @@ -2581,7 +2585,7 @@ Fl_Double_Window* make_settings_window() { ghosted_outline_button->down_box(FL_DOWN_BOX); ghosted_outline_button->labelsize(11); ghosted_outline_button->callback((Fl_Callback*)toggle_ghosted_outline_cb); - o->value(show_ghosted_outline); + o->value(Fluid.show_ghosted_outline); } // Fl_Check_Button* ghosted_outline_button { Fl_Box* o = new Fl_Box(120, 530, 200, 10); o->hide(); @@ -3517,7 +3521,7 @@ static void cb_Clear(Fl_Button*, void*) { Fl_Return_Button *shell_run_button=(Fl_Return_Button *)0; static void cb_shell_run_button(Fl_Return_Button*, void*) { - Fl_Preferences pos(fluid_prefs, "shell_run_Window_pos"); + Fl_Preferences pos(Fluid.preferences, "shell_run_Window_pos"); pos.set("x", shell_run_window->x()); pos.set("y", shell_run_window->y()); pos.set("w", shell_run_window->w()); diff --git a/fluid/panels/settings_panel.fl b/fluid/panels/settings_panel.fl index 7460ae8af..c66f48bd2 100644 --- a/fluid/panels/settings_panel.fl +++ b/fluid/panels/settings_panel.fl @@ -4,7 +4,7 @@ header_name {.h} code_name {.cxx} snap { ver 1 - current_suite {FLUID (based on FLTK)} + current_suite FLTK current_preset 0 suite { name {FLUID (based on FLTK)} @@ -49,16 +49,16 @@ comment {// } {in_source in_header } -decl {\#include "app/fluid.h"} {public global +decl {\#include "Fluid.h"} {public global } -decl {\#include "app/project.h"} {private local +decl {\#include "Project.h"} {private local } -decl {\#include "app/undo.h"} {private global +decl {\#include "proj/undo.h"} {private global } -decl {\#include "app/Fd_Snap_Action.h"} {public global +decl {\#include "app/Snap_Action.h"} {public global } decl {\#include "app/shell_command.h"} {public global @@ -97,11 +97,7 @@ decl {\#include "../src/flstring.h"} {private global decl {\#include } {private global } -decl {using namespace fld::widget;} {selected private global -} - -decl {void init_scheme(void);} { - comment {// initialize the scheme from preferences} public global +decl {using namespace fld::widget;} {private global } decl {extern struct Fl_Menu_Item *dbmanager_item;} {public local @@ -211,9 +207,9 @@ Function {make_settings_window()} {open } { Fl_Choice scheme_choice { label {Scheme: } - callback scheme_cb open + callback {Fluid.set_scheme(o->text(o->value()));} open selected xywh {120 78 120 25} down_box BORDER_BOX labelfont 1 labelsize 11 - code0 {init_scheme();} + code0 {Fluid.init_scheme();} class Fl_Scheme_Choice } {} Fl_Box {} { @@ -227,45 +223,45 @@ Function {make_settings_window()} {open Fl_Check_Button tooltips_button { label {Show Tooltips} callback {Fl_Tooltip::enable(tooltips_button->value()); -fluid_prefs.set("show_tooltips", tooltips_button->value());} +Fluid.preferences.set("show_tooltips", tooltips_button->value());} xywh {120 115 200 20} down_box DOWN_BOX labelsize 11 code0 {int b;} - code1 {fluid_prefs.get("show_tooltips", b, 1);} + code1 {Fluid.preferences.get("show_tooltips", b, 1);} code2 {tooltips_button->value(b);} code3 {Fl_Tooltip::enable(b);} } Fl_Check_Button completion_button { label {Show Completion Dialogs} - callback {fluid_prefs.set("show_completion_dialogs", completion_button->value());} + callback {Fluid.preferences.set("show_completion_dialogs", completion_button->value());} xywh {120 135 200 20} down_box DOWN_BOX labelsize 11 code0 {int b;} - code1 {fluid_prefs.get("show_completion_dialogs", b, 1);} + code1 {Fluid.preferences.get("show_completion_dialogs", b, 1);} code2 {completion_button->value(b);} } Fl_Check_Button openlast_button { label {Open Previous File on Startup} - callback {fluid_prefs.set("open_previous_file", openlast_button->value());} + callback {Fluid.preferences.set("open_previous_file", openlast_button->value());} xywh {120 155 200 20} down_box DOWN_BOX labelsize 11 code0 {int b;} - code1 {fluid_prefs.get("open_previous_file", b, 0);} + code1 {Fluid.preferences.get("open_previous_file", b, 0);} code2 {openlast_button->value(b);} } Fl_Check_Button prevpos_button { label {Remember Window Positions} - callback {fluid_prefs.set("prev_window_pos", prevpos_button->value());} + callback {Fluid.preferences.set("prev_window_pos", prevpos_button->value());} xywh {120 175 200 20} down_box DOWN_BOX labelsize 11 code0 {int b;} - code1 {fluid_prefs.get("prev_window_pos", b, 1);} + code1 {Fluid.preferences.get("prev_window_pos", b, 1);} code2 {prevpos_button->value(b);} } Fl_Check_Button show_comments_button { label {Show Comments in Browser} - callback {show_comments = show_comments_button->value(); -fluid_prefs.set("show_comments", show_comments); + callback {Fluid.show_comments = show_comments_button->value(); +Fluid.preferences.set("Fluid.show_comments", Fluid.show_comments); redraw_browser();} xywh {120 195 200 20} down_box DOWN_BOX labelsize 11 - code1 {fluid_prefs.get("show_comments", show_comments, 1);} - code2 {show_comments_button->value(show_comments);} + code1 {Fluid.preferences.get("Fluid.show_comments", Fluid.show_comments, 1);} + code2 {show_comments_button->value(Fluid.show_comments);} } Fl_Group {} { callback {propagate_load(o, v);} open @@ -273,11 +269,11 @@ redraw_browser();} } { Fl_Spinner recent_spinner { label {\# Recent Files:} - callback {fluid_prefs.set("recent_files", recent_spinner->value()); -load_history();} + callback {Fluid.preferences.set("recent_files", recent_spinner->value()); +Fluid.history.load();} xywh {120 225 40 20} labelfont 1 labelsize 11 when 1 maximum 10 textsize 11 code0 {int c;} - code1 {fluid_prefs.get("recent_files", c, 5);} + code1 {Fluid.preferences.get("recent_files", c, 5);} code2 {recent_spinner->maximum(10);} code3 {recent_spinner->value(c);} } @@ -287,18 +283,18 @@ load_history();} } Fl_Check_Button use_external_editor_button { label {Use for Code Nodes} - callback {G_use_external_editor = use_external_editor_button->value(); -fluid_prefs.set("use_external_editor", G_use_external_editor); + callback {Fluid.use_external_editor = use_external_editor_button->value(); +Fluid.preferences.set("use_external_editor", Fluid.use_external_editor); redraw_browser();} xywh {120 275 200 20} down_box DOWN_BOX labelsize 11 - code1 {fluid_prefs.get("use_external_editor", G_use_external_editor, 0);} - code2 {use_external_editor_button->value(G_use_external_editor);} + code1 {Fluid.preferences.get("use_external_editor", Fluid.use_external_editor, 0);} + code2 {use_external_editor_button->value(Fluid.use_external_editor);} } Fl_Input editor_command_input { label {External Editor:} - callback {strncpy(G_external_editor_command, editor_command_input->value(), sizeof(G_external_editor_command)-1); -G_external_editor_command[sizeof(G_external_editor_command)-1] = 0; -fluid_prefs.set("external_editor_command", G_external_editor_command); + callback {strncpy(Fluid.external_editor_command, editor_command_input->value(), sizeof(Fluid.external_editor_command)-1); +Fluid.external_editor_command[sizeof(Fluid.external_editor_command)-1] = 0; +Fluid.preferences.set("external_editor_command", Fluid.external_editor_command); redraw_browser();} tooltip {The editor command to open your external text editor. Include any necessary flags to ensure your editor does not background itself. @@ -306,8 +302,8 @@ Examples: gvim -f gedit emacs} xywh {120 255 200 20} labelfont 1 labelsize 11 when 1 textfont 4 textsize 11 - code1 {fluid_prefs.get("external_editor_command", G_external_editor_command, "", sizeof(G_external_editor_command)-1);} - code2 {editor_command_input->value(G_external_editor_command);} + code1 {Fluid.preferences.get("external_editor_command", Fluid.external_editor_command, "", sizeof(Fluid.external_editor_command)-1);} + code2 {editor_command_input->value(Fluid.external_editor_command);} } Fl_Box {} { label {Overlays: } @@ -317,19 +313,19 @@ Examples: label {Show Positioning Guides} callback toggle_guides_cb tooltip {show guides that help to position and resize widgets and enable snapping} xywh {120 300 200 20} down_box DOWN_BOX labelsize 11 - code0 {o->value(show_guides);} + code0 {o->value(Fluid.show_guides);} } Fl_Check_Button restricted_button { label {Show Restricted Areas} callback toggle_restricted_cb tooltip {show overlapping and out of bounds areas, show unfilled areas in Fl_Pack groups} xywh {120 320 200 20} down_box DOWN_BOX labelsize 11 - code0 {o->value(show_restricted);} + code0 {o->value(Fluid.show_restricted);} } Fl_Check_Button ghosted_outline_button { label {Show Ghosted Group Outlines} callback toggle_ghosted_outline_cb tooltip {groups with no box type or flat boxtypes without contrast will be rendered with a dim outline in the editing window only} xywh {120 340 200 20} down_box DOWN_BOX labelsize 11 - code0 {o->value(show_ghosted_outline);} + code0 {o->value(Fluid.show_ghosted_outline);} } Fl_Box {} { xywh {120 530 200 10} hide resizable @@ -356,11 +352,11 @@ or just ".ext" to set extension.} label {Header File:} user_data 1 user_data_type {void*} callback {if (v == LOAD) { - o->value(g_project.header_file_name.c_str()); + o->value(Fluid.proj.header_file_name.c_str()); } else { - if (strcmp(g_project.header_file_name.c_str(), o->value())) { - g_project.header_file_name = o->value(); - set_modflag(1); + if (strcmp(Fluid.proj.header_file_name.c_str(), o->value())) { + Fluid.proj.header_file_name = o->value(); + Fluid.proj.set_modflag(1); } }} tooltip {The name of the generated header file.} xywh {100 112 220 20} box THIN_DOWN_BOX labelfont 1 labelsize 11 when 1 textfont 4 textsize 11 @@ -369,11 +365,11 @@ or just ".ext" to set extension.} label {Code File:} user_data 1 user_data_type {void*} callback {if (v == LOAD) { - o->value(g_project.code_file_name.c_str()); + o->value(Fluid.proj.code_file_name.c_str()); } else { - if (strcmp(g_project.code_file_name.c_str(), o->value())) { - g_project.code_file_name = o->value(); - set_modflag(1); + if (strcmp(Fluid.proj.code_file_name.c_str(), o->value())) { + Fluid.proj.code_file_name = o->value(); + Fluid.proj.set_modflag(1); } }} tooltip {The name of the generated code file.} xywh {100 137 220 20} box THIN_DOWN_BOX labelfont 1 labelsize 11 when 1 textfont 4 textsize 11 @@ -381,11 +377,11 @@ or just ".ext" to set extension.} Fl_Check_Button include_H_from_C_button { label {Include Header from Code} callback {if (v == LOAD) { - o->value(g_project.include_H_from_C); + o->value(Fluid.proj.include_H_from_C); } else { - if (g_project.include_H_from_C != o->value()) { - set_modflag(1); - g_project.include_H_from_C = o->value(); + if (Fluid.proj.include_H_from_C != o->value()) { + Fluid.proj.set_modflag(1); + Fluid.proj.include_H_from_C = o->value(); } }} tooltip {Include the header file from the code file.} xywh {100 162 220 20} down_box DOWN_BOX labelsize 11 @@ -397,11 +393,11 @@ or just ".ext" to set extension.} Fl_Check_Button use_FL_COMMAND_button { label {Menu shortcuts use FL_COMMAND} callback {if (v == LOAD) { - o->value(g_project.use_FL_COMMAND); + o->value(Fluid.proj.use_FL_COMMAND); } else { - if (g_project.use_FL_COMMAND != o->value()) { - set_modflag(1); - g_project.use_FL_COMMAND = o->value(); + if (Fluid.proj.use_FL_COMMAND != o->value()) { + Fluid.proj.set_modflag(1); + Fluid.proj.use_FL_COMMAND = o->value(); } }} tooltip {Replace FL_CTRL and FL_META with FL_COMMAND when generating menu shortcuts} xywh {100 205 220 20} down_box DOWN_BOX labelsize 11 @@ -409,11 +405,11 @@ or just ".ext" to set extension.} Fl_Check_Button utf8_in_src_button { label {allow Unicode UTF-8 in source code} callback {if (v == LOAD) { - o->value(g_project.utf8_in_src); + o->value(Fluid.proj.utf8_in_src); } else { - if (g_project.utf8_in_src != o->value()) { - set_modflag(1); - g_project.utf8_in_src = o->value(); + if (Fluid.proj.utf8_in_src != o->value()) { + Fluid.proj.set_modflag(1); + Fluid.proj.utf8_in_src = o->value(); } }} tooltip {For older compilers, characters outside of the printable ASCII range are escaped using octal notation `\\0123`. If this option is checked, Fluid will write UTF-8 characters unchanged.} xywh {100 230 220 20} down_box DOWN_BOX labelsize 11 @@ -421,11 +417,11 @@ or just ".ext" to set extension.} Fl_Check_Button avoid_early_includes_button { label {avoid early include of Fl.H} callback {if (v == LOAD) { - o->value(g_project.avoid_early_includes); + o->value(Fluid.proj.avoid_early_includes); } else { - if (g_project.avoid_early_includes != o->value()) { - set_modflag(1); - g_project.avoid_early_includes = o->value(); + if (Fluid.proj.avoid_early_includes != o->value()) { + Fluid.proj.set_modflag(1); + Fluid.proj.avoid_early_includes = o->value(); } }} tooltip {Do not emit \#include until it is needed by another include file.} xywh {100 255 220 20} down_box DOWN_BOX labelsize 11 @@ -437,11 +433,11 @@ or just ".ext" to set extension.} Fl_Check_Button w_proj_mergeback { label {generate MergeBack data} callback {if (v == LOAD) { - o->value(g_project.write_mergeback_data); + o->value(Fluid.proj.write_mergeback_data); } else { - if (g_project.write_mergeback_data != o->value()) { - set_modflag(1); - g_project.write_mergeback_data = o->value(); + if (Fluid.proj.write_mergeback_data != o->value()) { + Fluid.proj.set_modflag(1); + Fluid.proj.write_mergeback_data = o->value(); } }} comment {// Matt: disabled} @@ -462,11 +458,11 @@ or just ".ext" to set extension.} } Fl_Choice layout_choice { callback {if (v == LOAD) { - o->value(g_layout_list.current_suite()); + o->value(Fluid.layout_list.current_suite()); } else { int index = o->value(); - g_layout_list.current_suite(index); - g_layout_list.update_dialogs(); + Fluid.layout_list.current_suite(index); + Fluid.layout_list.update_dialogs(); }} xywh {85 78 187 24} down_box BORDER_BOX } { @@ -486,19 +482,19 @@ or just ".ext" to set extension.} if (v == LOAD) return; std::string old_name = "Copy of "; -old_name.append(g_layout_list[g_layout_list.current_suite()].name_); +old_name.append(Fluid.layout_list[Fluid.layout_list.current_suite()].name_); const char *new_name = fl_input("Enter a name for the new layout:", old_name.c_str()); -if (new_name == NULL) +if (new_name == nullptr) return; -g_layout_list.add(new_name); -g_layout_list.update_dialogs();} +Fluid.layout_list.add(new_name); +Fluid.layout_list.update_dialogs();} xywh {272 78 24 24} } Fl_Menu_Button w_layout_menu { callback {if (v == LOAD) { - Fd_Layout_Suite &suite = g_layout_list[g_layout_list.current_suite()]; - if (suite.storage_ == FD_STORE_INTERNAL) { + fld::app::Layout_Suite &suite = Fluid.layout_list[Fluid.layout_list.current_suite()]; + if (suite.storage_ == fld::Tool_Store::INTERNAL) { w_layout_menu_rename->deactivate(); for (int i=1; i<4; i++) w_layout_menu_storage[i]->deactivate(); w_layout_menu_delete->deactivate(); @@ -507,7 +503,7 @@ g_layout_list.update_dialogs();} for (int i=1; i<4; i++) w_layout_menu_storage[i]->activate(); w_layout_menu_delete->activate(); } - w_layout_menu_storage[suite.storage_]->setonly(); + w_layout_menu_storage[static_cast(suite.storage_)]->setonly(); }} open xywh {296 78 24 24} } { @@ -515,41 +511,41 @@ g_layout_list.update_dialogs();} label {Rename...} callback {// Rename the current layout suite -std::string old_name = g_layout_list[g_layout_list.current_suite()].name_; +std::string old_name = Fluid.layout_list[Fluid.layout_list.current_suite()].name_; const char *new_name = fl_input("Enter a new name for the layout:", old_name.c_str()); -if (new_name == NULL) +if (new_name == nullptr) return; -g_layout_list.rename(new_name); -g_layout_list.update_dialogs();} +Fluid.layout_list.rename(new_name); +Fluid.layout_list.update_dialogs();} xywh {0 0 31 20} divider } MenuItem {w_layout_menu_storage[0]} { label {@fd_beaker FLUID Built-In} - callback {Fd_Layout_Suite &suite = g_layout_list[g_layout_list.current_suite()]; -suite.storage(FD_STORE_INTERNAL); -g_layout_list.update_dialogs();} + callback {fld::app::Layout_Suite &suite = Fluid.layout_list[Fluid.layout_list.current_suite()]; +suite.storage(fld::Tool_Store::INTERNAL); +Fluid.layout_list.update_dialogs();} xywh {0 0 31 20} type Radio deactivate } MenuItem {w_layout_menu_storage[1]} { label {@fd_user User Preference} - callback {Fd_Layout_Suite &suite = g_layout_list[g_layout_list.current_suite()]; -suite.storage(FD_STORE_USER); -g_layout_list.update_dialogs();} + callback {fld::app::Layout_Suite &suite = Fluid.layout_list[Fluid.layout_list.current_suite()]; +suite.storage(fld::Tool_Store::USER); +Fluid.layout_list.update_dialogs();} xywh {0 0 31 20} type Radio } MenuItem {w_layout_menu_storage[2]} { label {@fd_project Store in .fl Project File} - callback {Fd_Layout_Suite &suite = g_layout_list[g_layout_list.current_suite()]; -suite.storage(FD_STORE_PROJECT); -g_layout_list.update_dialogs();} + callback {fld::app::Layout_Suite &suite = Fluid.layout_list[Fluid.layout_list.current_suite()]; +suite.storage(fld::Tool_Store::PROJECT); +Fluid.layout_list.update_dialogs();} xywh {0 0 31 20} type Radio } MenuItem {w_layout_menu_storage[3]} { label {@fd_file Store in External File} - callback {Fd_Layout_Suite &suite = g_layout_list[g_layout_list.current_suite()]; -suite.storage(FD_STORE_FILE); -g_layout_list.update_dialogs();} + callback {fld::app::Layout_Suite &suite = Fluid.layout_list[Fluid.layout_list.current_suite()]; +suite.storage(fld::Tool_Store::FILE); +Fluid.layout_list.update_dialogs();} xywh {0 0 31 20} type Radio divider } MenuItem w_layout_menu_load { @@ -563,9 +559,9 @@ fnfc.filter("FLUID Layouts\\t*.fll\\n"); if (fnfc.show() != 0) return; const char *new_filename = fnfc.filename(); if (!new_filename) return; -g_layout_list.load(new_filename); -//g_layout_list.current_suite(n); -g_layout_list.update_dialogs();} +Fluid.layout_list.load(new_filename); +//Fluid.layout_list.current_suite(n); +Fluid.layout_list.update_dialogs();} xywh {0 0 31 20} } MenuItem w_layout_menu_save { @@ -576,14 +572,14 @@ g_layout_list.update_dialogs();} fnfc.type(Fl_Native_File_Chooser::BROWSE_SAVE_FILE); fnfc.options(Fl_Native_File_Chooser::SAVEAS_CONFIRM | Fl_Native_File_Chooser::USE_FILTER_EXT); fnfc.filter("FLUID Layouts\\t*.fll\\n"); - std::string filename = g_layout_list.filename_; + std::string filename = Fluid.layout_list.filename_; fnfc.directory(fl_filename_path_str(filename).c_str()); fnfc.preset_file(fl_filename_name_str(filename).c_str()); if (fnfc.show() != 0) return; const char *new_filename = fnfc.filename(); if (!new_filename) return; - g_layout_list.filename_ = new_filename; - g_layout_list.save(new_filename);} + Fluid.layout_list.filename_ = new_filename; + Fluid.layout_list.save(new_filename);} xywh {0 0 31 20} divider code0 {\#include } } @@ -591,8 +587,8 @@ g_layout_list.update_dialogs();} label Delete callback {// remove the current suite -g_layout_list.remove(g_layout_list.current_suite()); -g_layout_list.update_dialogs();} +Fluid.layout_list.remove(Fluid.layout_list.current_suite()); +Fluid.layout_list.update_dialogs();} xywh {0 0 31 20} } } @@ -634,36 +630,36 @@ g_layout_list.update_dialogs();} Fl_Value_Input {} { label {Left:} callback {if (v == LOAD) { - o->value((double)layout->left_window_margin); + o->value((double)Fluid.proj.layout->left_window_margin); } else { - layout->left_window_margin = (int)o->value(); + Fluid.proj.layout->left_window_margin = (int)o->value(); }} xywh {85 167 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } Fl_Value_Input {} { label {Top:} callback {if (v == LOAD) { - o->value((double)layout->top_window_margin); + o->value((double)Fluid.proj.layout->top_window_margin); } else { - layout->top_window_margin = (int)o->value(); + Fluid.proj.layout->top_window_margin = (int)o->value(); }} xywh {145 167 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } Fl_Value_Input {} { label {Right:} callback {if (v == LOAD) { - o->value((double)layout->right_window_margin); + o->value((double)Fluid.proj.layout->right_window_margin); } else { - layout->right_window_margin = (int)o->value(); + Fluid.proj.layout->right_window_margin = (int)o->value(); }} xywh {205 167 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } Fl_Value_Input {} { label {Bottom:} callback {if (v == LOAD) { - o->value((double)layout->bottom_window_margin); + o->value((double)Fluid.proj.layout->bottom_window_margin); } else { - layout->bottom_window_margin = (int)o->value(); + Fluid.proj.layout->bottom_window_margin = (int)o->value(); }} xywh {265 167 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } @@ -674,18 +670,18 @@ g_layout_list.update_dialogs();} Fl_Value_Input {} { label {Horizontal:} callback {if (v == LOAD) { - o->value((double)layout->window_grid_x); + o->value((double)Fluid.proj.layout->window_grid_x); } else { - layout->window_grid_x = (int)o->value(); + Fluid.proj.layout->window_grid_x = (int)o->value(); }} xywh {85 201 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } Fl_Value_Input {} { label {Vertical:} callback {if (v == LOAD) { - o->value((double)layout->window_grid_y); + o->value((double)Fluid.proj.layout->window_grid_y); } else { - layout->window_grid_y = (int)o->value(); + Fluid.proj.layout->window_grid_y = (int)o->value(); }} xywh {145 201 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } @@ -700,36 +696,36 @@ g_layout_list.update_dialogs();} Fl_Value_Input {} { label {Left:} callback {if (v == LOAD) { - o->value((double)layout->left_group_margin); + o->value((double)Fluid.proj.layout->left_group_margin); } else { - layout->left_group_margin = (int)o->value(); + Fluid.proj.layout->left_group_margin = (int)o->value(); }} xywh {85 261 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } Fl_Value_Input {} { label {Top:} callback {if (v == LOAD) { - o->value((double)layout->top_group_margin); + o->value((double)Fluid.proj.layout->top_group_margin); } else { - layout->top_group_margin = (int)o->value(); + Fluid.proj.layout->top_group_margin = (int)o->value(); }} xywh {145 261 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } Fl_Value_Input {} { label {Right:} callback {if (v == LOAD) { - o->value((double)layout->right_group_margin); + o->value((double)Fluid.proj.layout->right_group_margin); } else { - layout->right_group_margin = (int)o->value(); + Fluid.proj.layout->right_group_margin = (int)o->value(); }} xywh {205 261 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } Fl_Value_Input {} { label {Bottom:} callback {if (v == LOAD) { - o->value((double)layout->bottom_group_margin); + o->value((double)Fluid.proj.layout->bottom_group_margin); } else { - layout->bottom_group_margin = (int)o->value(); + Fluid.proj.layout->bottom_group_margin = (int)o->value(); }} xywh {265 261 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } @@ -740,18 +736,18 @@ g_layout_list.update_dialogs();} Fl_Value_Input {} { label {Horizontal:} callback {if (v == LOAD) { - o->value((double)layout->group_grid_x); + o->value((double)Fluid.proj.layout->group_grid_x); } else { - layout->group_grid_x = (int)o->value(); + Fluid.proj.layout->group_grid_x = (int)o->value(); }} xywh {85 295 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } Fl_Value_Input {} { label {Vertical:} callback {if (v == LOAD) { - o->value((double)layout->group_grid_y); + o->value((double)Fluid.proj.layout->group_grid_y); } else { - layout->group_grid_y = (int)o->value(); + Fluid.proj.layout->group_grid_y = (int)o->value(); }} xywh {145 295 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } @@ -766,18 +762,18 @@ g_layout_list.update_dialogs();} Fl_Value_Input {} { label {Top:} callback {if (v == LOAD) { - o->value((double)layout->top_tabs_margin); + o->value((double)Fluid.proj.layout->top_tabs_margin); } else { - layout->top_tabs_margin = (int)o->value(); + Fluid.proj.layout->top_tabs_margin = (int)o->value(); }} xywh {85 355 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } Fl_Value_Input {} { label {Bottom:} callback {if (v == LOAD) { - o->value((double)layout->bottom_tabs_margin); + o->value((double)Fluid.proj.layout->bottom_tabs_margin); } else { - layout->bottom_tabs_margin = (int)o->value(); + Fluid.proj.layout->bottom_tabs_margin = (int)o->value(); }} xywh {145 355 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } @@ -792,27 +788,27 @@ g_layout_list.update_dialogs();} Fl_Value_Input {} { label {Minimum:} callback {if (v == LOAD) { - o->value((double)layout->widget_min_w); + o->value((double)Fluid.proj.layout->widget_min_w); } else { - layout->widget_min_w = (int)o->value(); + Fluid.proj.layout->widget_min_w = (int)o->value(); }} xywh {85 414 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } Fl_Value_Input {} { label {Increment:} callback {if (v == LOAD) { - o->value((double)layout->widget_inc_w); + o->value((double)Fluid.proj.layout->widget_inc_w); } else { - layout->widget_inc_w = (int)o->value(); + Fluid.proj.layout->widget_inc_w = (int)o->value(); }} xywh {145 414 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } Fl_Value_Input {} { label {Gap:} callback {if (v == LOAD) { - o->value((double)layout->widget_gap_x); + o->value((double)Fluid.proj.layout->widget_gap_x); } else { - layout->widget_gap_x = (int)o->value(); + Fluid.proj.layout->widget_gap_x = (int)o->value(); }} xywh {205 414 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } @@ -822,25 +818,25 @@ g_layout_list.update_dialogs();} } Fl_Value_Input {} { callback {if (v == LOAD) { - o->value((double)layout->widget_min_h); + o->value((double)Fluid.proj.layout->widget_min_h); } else { - layout->widget_min_h = (int)o->value(); + Fluid.proj.layout->widget_min_h = (int)o->value(); }} xywh {85 440 55 20} labelsize 11 maximum 32767 step 1 textsize 11 } Fl_Value_Input {} { callback {if (v == LOAD) { - o->value((double)layout->widget_inc_h); + o->value((double)Fluid.proj.layout->widget_inc_h); } else { - layout->widget_inc_h = (int)o->value(); + Fluid.proj.layout->widget_inc_h = (int)o->value(); }} xywh {145 440 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } Fl_Value_Input {} { callback {if (v == LOAD) { - o->value((double)layout->widget_gap_y); + o->value((double)Fluid.proj.layout->widget_gap_y); } else { - layout->widget_gap_y = (int)o->value(); + Fluid.proj.layout->widget_gap_y = (int)o->value(); }} xywh {205 440 55 20} labelsize 11 align 5 maximum 32767 step 1 textsize 11 } @@ -851,9 +847,9 @@ g_layout_list.update_dialogs();} } { Fl_Choice {} { callback {if (v == LOAD) { - o->value(layout->labelfont+1); + o->value(Fluid.proj.layout->labelfont+1); } else { - layout->labelfont = (int)o->value()-1; + Fluid.proj.layout->labelfont = (int)o->value()-1; }} open tooltip {The style of the label text.} xywh {85 465 150 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable code0 {extern Fl_Menu_Item fontmenu_w_default[];} @@ -861,9 +857,9 @@ g_layout_list.update_dialogs();} } {} Fl_Value_Input {} { callback {if (v == LOAD) { - o->value(layout->labelsize); + o->value(Fluid.proj.layout->labelsize); } else { - layout->labelsize = (int)o->value(); + Fluid.proj.layout->labelsize = (int)o->value(); }} tooltip {The size of the label text.} xywh {235 465 50 20} labelsize 11 minimum 1 maximum 1000 step 1 value 14 textsize 11 } @@ -875,9 +871,9 @@ g_layout_list.update_dialogs();} } { Fl_Choice {} { callback {if (v == LOAD) { - o->value(layout->textfont+1); + o->value(Fluid.proj.layout->textfont+1); } else { - layout->textfont = (int)o->value()-1; + Fluid.proj.layout->textfont = (int)o->value()-1; }} open tooltip {The value text style.} xywh {85 490 150 20} box DOWN_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 code0 {extern Fl_Menu_Item fontmenu_w_default[];} @@ -885,9 +881,9 @@ g_layout_list.update_dialogs();} } {} Fl_Value_Input {} { callback {if (v == LOAD) { - o->value(layout->textsize); + o->value(Fluid.proj.layout->textsize); } else { - layout->textsize = (int)o->value(); + Fluid.proj.layout->textsize = (int)o->value(); }} tooltip {The value text size.} xywh {235 490 50 20} labelsize 11 maximum 1000 step 1 value 14 textsize 11 } @@ -917,9 +913,9 @@ list:} for (int i=0; ilist_size; i++) { Fd_Shell_Command *cmd = g_shell_config->list[i]; o->add(cmd->name.c_str()); - if (cmd->storage == FD_STORE_USER) + if (cmd->storage == fld::Tool_Store::USER) o->icon(i+1, w_settings_shell_fd_user->image()); - else if (cmd->storage == FD_STORE_PROJECT) + else if (cmd->storage == fld::Tool_Store::PROJECT) o->icon(i+1, w_settings_shell_fd_project->image()); } } @@ -951,11 +947,11 @@ list:} 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) { + if (cmd->storage == fld::Tool_Store::USER) { w_settings_shell_list->icon(selected+1, w_settings_shell_fd_user->image()); - } else if (cmd->storage == FD_STORE_PROJECT) { + } else if (cmd->storage == fld::Tool_Store::PROJECT) { w_settings_shell_list->icon(selected+1, w_settings_shell_fd_project->image()); - set_modflag(1); + Fluid.proj.set_modflag(1); } w_settings_shell_list->do_callback(); w_settings_shell_cmd->do_callback(w_settings_shell_cmd, LOAD); @@ -980,11 +976,11 @@ if (v==LOAD) { 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) { + if (cmd->storage == fld::Tool_Store::USER) { w_settings_shell_list->icon(selected+1, w_settings_shell_fd_user->image()); - } else if (cmd->storage == FD_STORE_PROJECT) { + } else if (cmd->storage == fld::Tool_Store::PROJECT) { w_settings_shell_list->icon(selected+1, w_settings_shell_fd_project->image()); - set_modflag(1); + Fluid.proj.set_modflag(1); } w_settings_shell_list->do_callback(); w_settings_shell_cmd->do_callback(w_settings_shell_cmd, LOAD); @@ -1005,9 +1001,9 @@ if (v==LOAD) { } else { if (!selected) return; int ret = fl_choice("Delete the shell command\\n\\"%s\\"?\\n\\nThis can not be undone.", - "Delete", "Cancel", NULL, g_shell_config->list[selected-1]->name.c_str()); + "Delete", "Cancel", nullptr, g_shell_config->list[selected-1]->name.c_str()); if (ret==1) return; - if (g_shell_config->at(selected-1)->storage == FD_STORE_PROJECT) set_modflag(1); + if (g_shell_config->at(selected-1)->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); g_shell_config->remove(selected-1); w_settings_shell_list->remove(selected); if (selected <= w_settings_shell_list->size()) @@ -1109,7 +1105,7 @@ if (v == LOAD) { 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); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } }} tooltip {file the shell command under this name in the shell command list} xywh {100 246 220 20} labelfont 1 labelsize 11 when 13 textfont 4 textsize 11 @@ -1128,7 +1124,7 @@ if (v == LOAD) { 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); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } }} tooltip {label text for the Shell menu in the main menu bar} xywh {100 272 220 20} labelfont 1 labelsize 11 textfont 4 textsize 11 @@ -1152,7 +1148,7 @@ if (v == LOAD) { 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); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } }} tooltip {an optional keyboard shortcut to run this shell command} xywh {100 297 130 20} labelsize 11 align 16 @@ -1164,35 +1160,35 @@ if (v == LOAD) { callback {int selected = w_settings_shell_list_selected; if (v == LOAD) { if (selected) { - Fd_Tool_Store ts = g_shell_config->list[selected-1]->storage; + fld::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)); + o->value(o->find_item_with_argument((long)fld::Tool_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); + fld::Tool_Store ts = (fld::Tool_Store)(o->mvalue()->argument()); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); cmd->storage = ts; //w_settings_shell_list->text(selected, cmd->name.c_str()); - if (cmd->storage == FD_STORE_USER) + if (cmd->storage == fld::Tool_Store::USER) w_settings_shell_list->icon(selected, w_settings_shell_fd_user->image()); - else if (cmd->storage == FD_STORE_PROJECT) + else if (cmd->storage == fld::Tool_Store::PROJECT) w_settings_shell_list->icon(selected, w_settings_shell_fd_project->image()); - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } }} open tooltip {store this shell command as a user setting or save it with the .fl project file} 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 + user_data {fld::Tool_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 + user_data {fld::Tool_Store::PROJECT} user_data_type long xywh {0 0 100 20} labelsize 11 } } @@ -1212,7 +1208,7 @@ if (v == LOAD) { int cond = (int)(o->mvalue()->argument()); cmd->condition = cond; g_shell_config->rebuild_shell_menu(); - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } }} open tooltip {add this command to the main menu bar only if this condition is true} xywh {100 348 130 20} down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 @@ -1278,7 +1274,7 @@ if (v == LOAD) { 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); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } }} xywh {100 373 196 80} labelfont 1 labelsize 11 align 4 textfont 4 textsize 12 resizable @@ -1304,7 +1300,7 @@ if (mi) { 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); + w_settings_shell_command->do_callback(w_settings_shell_command, (void*)nullptr); }} open tooltip {a list of text replacements available for the shell script} xywh {296 373 24 22} labelsize 11 textsize 11 } { @@ -1396,7 +1392,7 @@ if (v == LOAD) { } else { cmd->flags &= ~Fd_Shell_Command::SAVE_PROJECT; } - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } }} tooltip {save the project to the .fl file before running the command} xywh {100 458 110 20} down_box DOWN_BOX labelsize 11 @@ -1419,7 +1415,7 @@ if (v == LOAD) { } else { cmd->flags &= ~Fd_Shell_Command::SAVE_SOURCECODE; } - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } }} tooltip {generate the source code and header file before running the command} xywh {100 478 110 19} down_box DOWN_BOX labelsize 11 @@ -1442,7 +1438,7 @@ if (v == LOAD) { } else { cmd->flags &= ~Fd_Shell_Command::SAVE_STRINGS; } - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } }} tooltip {save the internationalisation strings before running the command} xywh {100 498 110 20} down_box DOWN_BOX labelsize 11 @@ -1465,7 +1461,7 @@ if (v == LOAD) { } else { cmd->flags &= ~Fd_Shell_Command::DONT_SHOW_TERMINAL; } - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } }} tooltip {show the terminal window when launching this script} xywh {214 458 106 20} down_box DOWN_BOX labelsize 11 @@ -1488,7 +1484,7 @@ if (v == LOAD) { } else { cmd->flags &= ~Fd_Shell_Command::CLEAR_TERMINAL; } - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } }} tooltip {clear the teminal window before running this script} xywh {214 478 106 19} down_box DOWN_BOX labelsize 11 @@ -1511,7 +1507,7 @@ if (v == LOAD) { } else { cmd->flags &= ~Fd_Shell_Command::CLEAR_HISTORY; } - if (cmd->storage == FD_STORE_PROJECT) set_modflag(1); + if (cmd->storage == fld::Tool_Store::PROJECT) Fluid.proj.set_modflag(1); } }} tooltip {clear the teminal history in the terminal window} xywh {214 498 106 19} down_box DOWN_BOX labelsize 11 @@ -1564,44 +1560,44 @@ if (v == LOAD) { Fl_Input i18n_gnu_include_input { label {\#include:} callback {if (v == LOAD) { - o->value(g_project.i18n_gnu_include.c_str()); + o->value(Fluid.proj.i18n_gnu_include.c_str()); } else { - undo_checkpoint(); - g_project.i18n_gnu_include = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_gnu_include = o->value(); + Fluid.proj.set_modflag(1); }} tooltip {The include file for internationalization.} xywh {100 103 220 20} box THIN_DOWN_BOX labelsize 11 textfont 4 textsize 11 } Fl_Input i18n_gnu_conditional_input { label {Conditional:} callback {if (v == LOAD) { - o->value(g_project.i18n_gnu_conditional.c_str()); + o->value(Fluid.proj.i18n_gnu_conditional.c_str()); } else { - undo_checkpoint(); - g_project.i18n_gnu_conditional = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_gnu_conditional = o->value(); + Fluid.proj.set_modflag(1); }} tooltip {only include the header file if this preprocessor macro is defined, for example FLTK_GETTEXT_FOUND} xywh {100 128 220 20} box THIN_DOWN_BOX labelsize 11 textfont 4 textsize 11 } Fl_Input i18n_gnu_function_input { label {Function:} callback {if (v == LOAD) { - o->value(g_project.i18n_gnu_function.c_str()); + o->value(Fluid.proj.i18n_gnu_function.c_str()); } else { - undo_checkpoint(); - g_project.i18n_gnu_function = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_gnu_function = o->value(); + Fluid.proj.set_modflag(1); }} tooltip {The function to call to translate labels and tooltips, usually "gettext" or "_"} xywh {100 153 220 20} box THIN_DOWN_BOX labelsize 11 textfont 4 textsize 11 } Fl_Input i18n_gnu_static_function_input { label {Static Function:} callback {if (v == LOAD) { - o->value(g_project.i18n_gnu_static_function.c_str()); + o->value(Fluid.proj.i18n_gnu_static_function.c_str()); } else { - undo_checkpoint(); - g_project.i18n_gnu_static_function = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_gnu_static_function = o->value(); + Fluid.proj.set_modflag(1); }} tooltip {function to call to translate static text, The function to call to internationalize labels and tooltips, usually "gettext_noop" or "N_"} xywh {100 178 220 20} box THIN_DOWN_BOX labelsize 11 textfont 4 textsize 11 } @@ -1613,33 +1609,33 @@ if (v == LOAD) { Fl_Input i18n_pos_include_input { label {\#include:} callback {if (v == LOAD) { - o->value(g_project.i18n_pos_include.c_str()); + o->value(Fluid.proj.i18n_pos_include.c_str()); } else { - undo_checkpoint(); - g_project.i18n_pos_include = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_pos_include = o->value(); + Fluid.proj.set_modflag(1); }} tooltip {The include file for internationalization.} xywh {100 103 220 20} box THIN_DOWN_BOX labelsize 11 textfont 4 textsize 11 } Fl_Input i18n_pos_conditional_input { label {Conditional:} callback {if (v == LOAD) { - o->value(g_project.i18n_pos_conditional.c_str()); + o->value(Fluid.proj.i18n_pos_conditional.c_str()); } else { - undo_checkpoint(); - g_project.i18n_pos_conditional = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_pos_conditional = o->value(); + Fluid.proj.set_modflag(1); }} tooltip {only include the header file if this preprocessor macro is defined, for example FLTK_GETTEXT_FOUND} xywh {100 128 220 20} box THIN_DOWN_BOX labelsize 11 textfont 4 textsize 11 } Fl_Input i18n_pos_file_input { label {Catalog:} callback {if (v == LOAD) { - o->value(g_project.i18n_pos_file.c_str()); + o->value(Fluid.proj.i18n_pos_file.c_str()); } else { - undo_checkpoint(); - g_project.i18n_pos_file = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_pos_file = o->value(); + Fluid.proj.set_modflag(1); }} tooltip {The name of the message catalog.} xywh {100 153 220 20} box THIN_DOWN_BOX labelsize 11 textfont 4 textsize 11 } @@ -1650,11 +1646,11 @@ if (v == LOAD) { Fl_Input i18n_pos_set_input { label {Set:} callback {if (v == LOAD) { - o->value(g_project.i18n_pos_set.c_str()); + o->value(Fluid.proj.i18n_pos_set.c_str()); } else { - undo_checkpoint(); - g_project.i18n_pos_set = o->value(); - set_modflag(1); + Fluid.proj.undo.checkpoint(); + Fluid.proj.i18n_pos_set = o->value(); + Fluid.proj.set_modflag(1); }} tooltip {The message set number.} xywh {100 178 80 20} type Int box THIN_DOWN_BOX labelsize 11 textfont 4 textsize 11 } @@ -1835,8 +1831,8 @@ if (v == LOAD) { Fl_Button {} { label Close callback {if (g_shell_config) - g_shell_config->write(fluid_prefs, FD_STORE_USER); -g_layout_list.write(fluid_prefs, FD_STORE_USER); + g_shell_config->write(Fluid.preferences, fld::Tool_Store::USER); +Fluid.layout_list.write(Fluid.preferences, fld::Tool_Store::USER); settings_window->hide();} tooltip {Close this dialog.} xywh {230 550 100 20} labelsize 11 } @@ -1873,7 +1869,7 @@ shell_run_terminal->append("\\033[2J\\033[3J\\033[H");} } Fl_Return_Button shell_run_button { label Close - callback {Fl_Preferences pos(fluid_prefs, "shell_run_Window_pos"); + callback {Fl_Preferences pos(Fluid.preferences, "shell_run_Window_pos"); pos.set("x", shell_run_window->x()); pos.set("y", shell_run_window->y()); pos.set("w", shell_run_window->w()); diff --git a/fluid/panels/settings_panel.h b/fluid/panels/settings_panel.h index 8aea3a221..c864d23b5 100644 --- a/fluid/panels/settings_panel.h +++ b/fluid/panels/settings_panel.h @@ -19,8 +19,8 @@ #ifndef settings_panel_h #define settings_panel_h #include -#include "app/fluid.h" -#include "app/Fd_Snap_Action.h" +#include "Fluid.h" +#include "app/Snap_Action.h" #include "app/shell_command.h" #include "tools/filename.h" #include "widgets/Node_Browser.h" @@ -28,10 +28,6 @@ #include #include #include -/** - // initialize the scheme from preferences -*/ -void init_scheme(void); extern struct Fl_Menu_Item *dbmanager_item; extern void i18n_cb(Fl_Choice *,void *); extern void scheme_cb(Fl_Scheme_Choice *, void *); @@ -52,7 +48,6 @@ extern Fl_Double_Window *settings_window; #include extern Fl_Tabs *w_settings_tabs; extern Fl_Group *w_settings_general_tab; -extern void scheme_cb(Fl_Scheme_Choice*, void*); extern Fl_Scheme_Choice *scheme_choice; #include extern Fl_Check_Button *tooltips_button; diff --git a/fluid/panels/template_panel.cxx b/fluid/panels/template_panel.cxx index 11227a549..7c2a9ac2b 100644 --- a/fluid/panels/template_panel.cxx +++ b/fluid/panels/template_panel.cxx @@ -17,7 +17,7 @@ // generated by Fast Light User Interface Designer (fluid) version 1.0500 #include "template_panel.h" -#include "app/fluid.h" +#include "Fluid.h" #include "tools/filename.h" #include #include @@ -84,7 +84,7 @@ static void cb_template_browser(Fl_Browser*, void*) { char pngfile[1024], *ext; strlcpy(pngfile, flfile, sizeof(pngfile)); - if ((ext = strrchr(pngfile, '.')) == NULL) return; + if ((ext = strrchr(pngfile, '.')) == nullptr) return; strcpy(ext, ".png"); img = Fl_Shared_Image::get(pngfile); @@ -183,7 +183,7 @@ void template_clear() { void *filename; for (i = 1; i <= template_browser->size(); i ++) { - if ((filename = template_browser->data(i)) != NULL) free(filename); + if ((filename = template_browser->data(i)) != nullptr) free(filename); } template_browser->deselect(); @@ -208,7 +208,7 @@ void template_delete_cb(Fl_Button *, void *) { char pngfile[1024], *ext; strlcpy(pngfile, flfile, sizeof(pngfile)); - if ((ext = strrchr(pngfile, '.')) != NULL) { + if ((ext = strrchr(pngfile, '.')) != nullptr) { strcpy(ext, ".png"); fl_unlink(pngfile); } @@ -284,12 +284,12 @@ void template_load() { struct dirent **files; int num_files; - fluid_prefs.getUserdataPath(path, sizeof(path)); + Fluid.preferences.getUserdataPath(path, sizeof(path)); strlcat(path, "templates", sizeof(path)); fl_make_path(path); int sample_templates_generated = 0; - fluid_prefs.get("sample_templates_generated", sample_templates_generated, 0); + Fluid.preferences.get("sample_templates_generated", sample_templates_generated, 0); if (sample_templates_generated < 2) { strcpy(filename, path); @@ -311,8 +311,8 @@ void template_load() { template_install(path, "/FLTK_License.fl", tmpl_FLTK_License_fl, sizeof(tmpl_FLTK_License_fl), tmpl_FLTK_License_fl_size); template_install(path, "/1of7GUIs.fl", tmpl_1of7GUIs_fl, sizeof(tmpl_1of7GUIs_fl), tmpl_1of7GUIs_fl_size); sample_templates_generated = 2; - fluid_prefs.set("sample_templates_generated", sample_templates_generated); - fluid_prefs.flush(); + Fluid.preferences.set("sample_templates_generated", sample_templates_generated); + Fluid.preferences.flush(); } num_files = fl_filename_list(path, &files); diff --git a/fluid/panels/template_panel.fl b/fluid/panels/template_panel.fl index b0ba20968..be0376c2c 100644 --- a/fluid/panels/template_panel.fl +++ b/fluid/panels/template_panel.fl @@ -20,7 +20,7 @@ comment {// } {in_source in_header } -decl {\#include "app/fluid.h"} {private local +decl {\#include "Fluid.h"} {private local } decl {\#include "tools/filename.h"} {selected private local @@ -111,7 +111,7 @@ template_delete->activate(); char pngfile[1024], *ext; strlcpy(pngfile, flfile, sizeof(pngfile)); -if ((ext = strrchr(pngfile, '.')) == NULL) return; +if ((ext = strrchr(pngfile, '.')) == nullptr) return; strcpy(ext, ".png"); img = Fl_Shared_Image::get(pngfile); @@ -179,7 +179,7 @@ Function {template_clear()} {return_type void void *filename; for (i = 1; i <= template_browser->size(); i ++) { - if ((filename = template_browser->data(i)) != NULL) free(filename); + if ((filename = template_browser->data(i)) != nullptr) free(filename); } template_browser->deselect(); @@ -205,7 +205,7 @@ if (fl_unlink(flfile)) { char pngfile[1024], *ext; strlcpy(pngfile, flfile, sizeof(pngfile)); -if ((ext = strrchr(pngfile, '.')) != NULL) { +if ((ext = strrchr(pngfile, '.')) != nullptr) { strcpy(ext, ".png"); fl_unlink(pngfile); } @@ -241,12 +241,12 @@ char name[1024], filename[1400], path[1024], *ptr; struct dirent **files; int num_files; -fluid_prefs.getUserdataPath(path, sizeof(path)); +Fluid.preferences.getUserdataPath(path, sizeof(path)); strlcat(path, "templates", sizeof(path)); fl_make_path(path); int sample_templates_generated = 0; -fluid_prefs.get("sample_templates_generated", sample_templates_generated, 0); +Fluid.preferences.get("sample_templates_generated", sample_templates_generated, 0); if (sample_templates_generated < 2) { strcpy(filename, path); @@ -268,8 +268,8 @@ if (sample_templates_generated < 2) { template_install(path, "/FLTK_License.fl", tmpl_FLTK_License_fl, sizeof(tmpl_FLTK_License_fl), tmpl_FLTK_License_fl_size); template_install(path, "/1of7GUIs.fl", tmpl_1of7GUIs_fl, sizeof(tmpl_1of7GUIs_fl), tmpl_1of7GUIs_fl_size); sample_templates_generated = 2; - fluid_prefs.set("sample_templates_generated", sample_templates_generated); - fluid_prefs.flush(); + Fluid.preferences.set("sample_templates_generated", sample_templates_generated); + Fluid.preferences.flush(); } num_files = fl_filename_list(path, &files); diff --git a/fluid/panels/widget_panel.cxx b/fluid/panels/widget_panel.cxx index df903d4a2..61b480f36 100644 --- a/fluid/panels/widget_panel.cxx +++ b/fluid/panels/widget_panel.cxx @@ -17,11 +17,32 @@ // generated by Fast Light User Interface Designer (fluid) version 1.0500 #include "widget_panel.h" -#include "app/undo.h" -#include "nodes/Fl_Widget_Type.h" -#include "nodes/Fl_Grid_Type.h" +#include "Fluid.h" +#include "app/Snap_Action.h" +#include "app/Image_Asset.h" +#include "proj/undo.h" +#include "nodes/Window_Node.h" +#include "nodes/Grid_Node.h" +#include #include -extern void set_modflag(int mf, int mfc=-1); +#include +#include +#include +#define ZERO_ENTRY 1000 +extern const char* when_symbol_name(int n); +extern void set_whenmenu(int n); +extern void redraw_browser(); +const char *c_check(const char *c, int type=0); +extern Fl_Color fl_show_colormap(Fl_Color oldcol); +extern void labelcolor_common(Fl_Color c); +extern void color_common(Fl_Color c); +extern void color2_common(Fl_Color c); +extern void textcolor_common(Fl_Color c); +extern int widget_i; +extern fld::widget::Formula_Input_Vars widget_vars[]; +extern int numselected; +extern Fl_Menu_Item boxmenu[]; +extern int haderror; Fl_Double_Window *image_panel_window=(Fl_Double_Window *)0; @@ -56,14 +77,14 @@ fld::widget::Formula_Input *image_panel_imagew=(fld::widget::Formula_Input *)0; static void cb_image_panel_imagew(fld::widget::Formula_Input* o, void* v) { if (v == LOAD) { - if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { o->value(current_widget->scale_image_w_); } } else { int mod = 0; - for (Fl_Type *t = Fl_Type::first; t; t = t->next) { + for (Node *t = Fluid.proj.tree.first; t; t = t->next) { if (t->selected && t->is_widget()) { - Fl_Widget_Type* wt = ((Fl_Widget_Type*)t); + Widget_Node* wt = ((Widget_Node*)t); wt->scale_image_w_ = o->value(); Fl_Image *img = wt->o->image(); if (img) { @@ -78,7 +99,7 @@ static void cb_image_panel_imagew(fld::widget::Formula_Input* o, void* v) { mod = 1; } } - if (mod) set_modflag(1); + if (mod) Fluid.proj.set_modflag(1); } } @@ -86,14 +107,14 @@ fld::widget::Formula_Input *image_panel_imageh=(fld::widget::Formula_Input *)0; static void cb_image_panel_imageh(fld::widget::Formula_Input* o, void* v) { if (v == LOAD) { - if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { o->value(current_widget->scale_image_h_); } } else { int mod = 0; - for (Fl_Type *t = Fl_Type::first; t; t = t->next) { + for (Node *t = Fluid.proj.tree.first; t; t = t->next) { if (t->selected && t->is_widget()) { - Fl_Widget_Type* wt = ((Fl_Widget_Type*)t); + Widget_Node* wt = ((Widget_Node*)t); wt->scale_image_h_ = o->value(); Fl_Image *img = wt->o->image(); if (img) { @@ -108,7 +129,7 @@ static void cb_image_panel_imageh(fld::widget::Formula_Input* o, void* v) { mod = 1; } } - if (mod) set_modflag(1); + if (mod) Fluid.proj.set_modflag(1); } } @@ -121,6 +142,42 @@ static void cb_Reset(Fl_Button*, void* v) { } } +static void cb_convert(Fl_Check_Button* o, void* v) { + if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { + o->activate(); + o->value(!current_widget->compress_image_); + } else { + o->deactivate(); + } + } else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->compress_image_ = !o->value(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_bind(Fl_Check_Button* o, void* v) { + if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { + o->activate(); + o->value(current_widget->bind_image_); + } else { + o->deactivate(); + } + } else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->bind_image_ = o->value(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } +} + Fl_Group *image_panel_deimagegroup=(Fl_Group *)0; Fl_Box *image_panel_dedata=(Fl_Box *)0; @@ -148,14 +205,14 @@ fld::widget::Formula_Input *image_panel_deimagew=(fld::widget::Formula_Input *)0 static void cb_image_panel_deimagew(fld::widget::Formula_Input* o, void* v) { if (v == LOAD) { - if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { o->value(current_widget->scale_deimage_w_); } } else { int mod = 0; - for (Fl_Type *t = Fl_Type::first; t; t = t->next) { + for (Node *t = Fluid.proj.tree.first; t; t = t->next) { if (t->selected && t->is_widget()) { - Fl_Widget_Type* wt = ((Fl_Widget_Type*)t); + Widget_Node* wt = ((Widget_Node*)t); wt->scale_deimage_w_ = o->value(); Fl_Image *img = wt->o->deimage(); if (img) { @@ -170,7 +227,7 @@ static void cb_image_panel_deimagew(fld::widget::Formula_Input* o, void* v) { mod = 1; } } - if (mod) set_modflag(1); + if (mod) Fluid.proj.set_modflag(1); } } @@ -178,14 +235,14 @@ fld::widget::Formula_Input *image_panel_deimageh=(fld::widget::Formula_Input *)0 static void cb_image_panel_deimageh(fld::widget::Formula_Input* o, void* v) { if (v == LOAD) { - if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { o->value(current_widget->scale_deimage_h_); } } else { int mod = 0; - for (Fl_Type *t = Fl_Type::first; t; t = t->next) { + for (Node *t = Fluid.proj.tree.first; t; t = t->next) { if (t->selected && t->is_widget()) { - Fl_Widget_Type* wt = ((Fl_Widget_Type*)t); + Widget_Node* wt = ((Widget_Node*)t); wt->scale_deimage_h_ = o->value(); Fl_Image *img = wt->o->deimage(); if (img) { @@ -200,7 +257,7 @@ static void cb_image_panel_deimageh(fld::widget::Formula_Input* o, void* v) { mod = 1; } } - if (mod) set_modflag(1); + if (mod) Fluid.proj.set_modflag(1); } } @@ -213,6 +270,42 @@ static void cb_Reset1(Fl_Button*, void* v) { } } +static void cb_convert1(Fl_Check_Button* o, void* v) { + if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { + o->activate(); + o->value(!current_widget->compress_deimage_); + } else { + o->deactivate(); + } + } else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->compress_deimage_ = !o->value(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_bind1(Fl_Check_Button* o, void* v) { + if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { + o->activate(); + o->value(current_widget->bind_deimage_); + } else { + o->deactivate(); + } + } else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->bind_deimage_ = o->value(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } +} + Fl_Button *image_panel_close=(Fl_Button *)0; static void cb_image_panel_close(Fl_Button*, void* v) { @@ -291,13 +384,13 @@ Fl_Double_Window* make_image_panel() { "ixel data"); o->down_box(FL_DOWN_BOX); o->labelsize(11); - o->callback((Fl_Callback*)compress_image_cb); + o->callback((Fl_Callback*)cb_convert); } // Fl_Check_Button* o { Fl_Check_Button* o = new Fl_Check_Button(75, 120, 170, 20, "bind to widget"); o->tooltip("bind the image to the widget, so it will be deleted automatically"); o->down_box(FL_DOWN_BOX); o->labelsize(11); - o->callback((Fl_Callback*)bind_image_cb); + o->callback((Fl_Callback*)cb_bind); o->window()->hotspot(o); } // Fl_Check_Button* o image_panel_imagegroup->end(); @@ -367,13 +460,13 @@ Fl_Double_Window* make_image_panel() { "ixel data"); o->down_box(FL_DOWN_BOX); o->labelsize(11); - o->callback((Fl_Callback*)compress_deimage_cb); + o->callback((Fl_Callback*)cb_convert1); } // Fl_Check_Button* o { Fl_Check_Button* o = new Fl_Check_Button(75, 260, 170, 20, "bind to widget"); o->tooltip("bind the image to the widget, so it will be deleted automatically"); o->down_box(FL_DOWN_BOX); o->labelsize(11); - o->callback((Fl_Callback*)bind_deimage_cb); + o->callback((Fl_Callback*)cb_bind1); } // Fl_Check_Button* o image_panel_deimagegroup->end(); } // Fl_Group* image_panel_deimagegroup @@ -405,7 +498,29 @@ void run_image_panel() { Fl_Shared_Image *img = (Fl_Shared_Image*)image_panel_data->user_data(); if (img) { img->release(); - image_panel_data->user_data(NULL); + image_panel_data->user_data(nullptr); + } +} + +void flex_margin_cb(Fl_Value_Input* i, void* v, void (*load_margin)(Fl_Flex*,Fl_Value_Input*), int (*update_margin)(Fl_Flex*,int)) { + if (v == LOAD) { + if (current_widget->is_a(Type::Flex)) { + load_margin((Fl_Flex*)current_widget->o, i); + } + } else { + int mod = 0; + int new_value = (int)i->value(); + for (Node *o = Fluid.proj.tree.first; o; o = o->next) { + if (o->selected && o->is_a(Type::Flex)) { + Flex_Node* q = (Flex_Node*)o; + Fl_Flex* w = (Fl_Flex*)q->o; + if (update_margin(w, new_value)) { + w->layout(); + mod = 1; + } + } + } + if (mod) Fluid.proj.set_modflag(1); } } @@ -421,6 +536,42 @@ Fl_Input *wp_gui_label=(Fl_Input *)0; Fl_Input *widget_image_input=(Fl_Input *)0; +static void cb_widget_image_input(Fl_Input* o, void* v) { + if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { + o->activate(); + o->value(((Widget_Node*)current_widget)->image_name()); + } else o->deactivate(); + } else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->image_name(o->value()); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_Browse(Fl_Button* o, void* v) { + if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) + o->activate(); + else + o->deactivate(); + } else { + int mod = 0; + Image_Asset *image_asset = ui_find_image(widget_image_input->value()); + if (image_asset) { + widget_image_input->value(image_asset->filename()); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->image_name(image_asset->filename()); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } + } +} + static void cb_(Fl_Button*, void* v) { if (v != LOAD) { run_image_panel(); @@ -429,6 +580,42 @@ static void cb_(Fl_Button*, void* v) { Fl_Input *widget_deimage_input=(Fl_Input *)0; +static void cb_widget_deimage_input(Fl_Input* o, void* v) { + if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { + o->activate(); + o->value(((Widget_Node*)current_widget)->inactive_name()); + } else o->deactivate(); + } else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->inactive_name(o->value()); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_Browse1(Fl_Button* o, void* v) { + if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) + o->activate(); + else + o->deactivate(); + } else { + int mod = 0; + Image_Asset *image_asset = ui_find_image(widget_deimage_input->value()); + if (image_asset) { + widget_deimage_input->value(image_asset->filename()); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->inactive_name(image_asset->filename()); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } + } +} + Fl_Group *wp_gui_alignment=(Fl_Group *)0; Fl_Menu_Item menu_[] = { @@ -462,12 +649,151 @@ Fl_Menu_Item menu_1[] = { fld::widget::Formula_Input *widget_x_input=(fld::widget::Formula_Input *)0; +static void cb_widget_x_input(fld::widget::Formula_Input* o, void* v) { + if (v == LOAD) { + if (current_widget->is_true_widget()) { + o->value(((Widget_Node *)current_widget)->o->x()); + o->activate(); + } else o->deactivate(); + } else { + Fluid.proj.undo.checkpoint(); + widget_i = 0; + int mod = 0; + int v = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_true_widget()) { + Fl_Widget *w = q->o; + o->variables(widget_vars, q); + v = o->value(); + w->resize(v, w->y(), w->w(), w->h()); + if (w->window()) w->window()->redraw(); + widget_i++; + mod = 1; + } + } + if (mod) { + Fluid.proj.set_modflag(1); + o->value(v); // change the displayed value to the result of the last + // calculation. Keep the formula if it was not used. + } + } +} + fld::widget::Formula_Input *widget_y_input=(fld::widget::Formula_Input *)0; +static void cb_widget_y_input(fld::widget::Formula_Input* o, void* v) { + if (v == LOAD) { + if (current_widget->is_true_widget()) { + o->value(((Widget_Node *)current_widget)->o->y()); + o->activate(); + } else o->deactivate(); + } else { + Fluid.proj.undo.checkpoint(); + widget_i = 0; + int mod = 0; + int v = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_true_widget()) { + Fl_Widget *w = q->o; + o->variables(widget_vars, q); + v = o->value(); + w->resize(w->x(), v, w->w(), w->h()); + if (w->window()) w->window()->redraw(); + widget_i++; + mod = 1; + } + } + if (mod) { + Fluid.proj.set_modflag(1); + o->value(v); + } + } +} + fld::widget::Formula_Input *widget_w_input=(fld::widget::Formula_Input *)0; +static void cb_widget_w_input(fld::widget::Formula_Input* o, void* v) { + if (v == LOAD) { + if (current_widget->is_true_widget()) { + o->value(((Widget_Node *)current_widget)->o->w()); + o->activate(); + } else o->deactivate(); + } else { + Fluid.proj.undo.checkpoint(); + widget_i = 0; + int mod = 0; + int v = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_true_widget()) { + Fl_Widget *w = q->o; + o->variables(widget_vars, q); + v = o->value(); + w->resize(w->x(), w->y(), v, w->h()); + if (w->window()) w->window()->redraw(); + widget_i++; + mod = 1; + } + } + if (mod) { + Fluid.proj.set_modflag(1); + o->value(v); + } + } +} + fld::widget::Formula_Input *widget_h_input=(fld::widget::Formula_Input *)0; +static void cb_widget_h_input(fld::widget::Formula_Input* o, void* v) { + if (v == LOAD) { + if (current_widget->is_true_widget()) { + o->value(((Widget_Node *)current_widget)->o->h()); + o->activate(); + } else o->deactivate(); + } else { + Fluid.proj.undo.checkpoint(); + widget_i = 0; + int mod = 0; + int v = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_true_widget()) { + Fl_Widget *w = q->o; + o->variables(widget_vars, q); + v = o->value(); + w->resize(w->x(), w->y(), w->w(), v); + if (w->window()) w->window()->redraw(); + widget_i++; + mod = 1; + } + } + if (mod) { + Fluid.proj.set_modflag(1); + o->value(v); + } + } +} + +static void cb_Children(Fl_Choice* o, void* v) { + if (v == LOAD) { + if (current_widget->is_a(Type::Widget_Class)) { + o->show(); + o->value(((Widget_Class_Node *)current_widget)->wc_relative); + } else { + o->hide(); + } + } else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Widget_Class)) { + Widget_Class_Node *t = (Widget_Class_Node *)q; + t->wc_relative = o->value(); + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); + } +} + Fl_Menu_Item menu_Children[] = { {"Fixed", 0, 0, 0, 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, {"Reposition", 0, 0, 0, 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, @@ -477,517 +803,1419 @@ Fl_Menu_Item menu_Children[] = { Fl_Group *wp_gui_flexp=(Fl_Group *)0; -Fl_Value_Input *widget_flex_size=(Fl_Value_Input *)0; - -Fl_Check_Button *widget_flex_fixed=(Fl_Check_Button *)0; - -Fl_Group *wp_gui_values=(Fl_Group *)0; - -Fl_Group *wp_gui_margins=(Fl_Group *)0; - -Fl_Group *wp_gui_sizerange=(Fl_Group *)0; - -Fl_Shortcut_Button *wp_gui_shortcut=(Fl_Shortcut_Button *)0; - -Fl_Group *wp_gui_xclass=(Fl_Group *)0; - -Fl_Group *wp_gui_attributes=(Fl_Group *)0; - -Fl_Input *wp_gui_tooltip=(Fl_Input *)0; - -Fl_Group *wp_style_tab=(Fl_Group *)0; - -Fl_Group *wp_style_label=(Fl_Group *)0; - -Fl_Button *w_labelcolor=(Fl_Button *)0; - -Fl_Group *wp_style_box=(Fl_Group *)0; - -Fl_Button *w_color=(Fl_Button *)0; - -Fl_Group *wp_style_downbox=(Fl_Group *)0; - -Fl_Button *w_selectcolor=(Fl_Button *)0; - -Fl_Group *wp_style_text=(Fl_Group *)0; - -Fl_Button *w_textcolor=(Fl_Button *)0; - -Fl_Group *wp_cpp_tab=(Fl_Group *)0; - -Fl_Group *wp_cpp_class=(Fl_Group *)0; - -Fl_Group *wp_cpp_name=(Fl_Group *)0; - -Fl_Menu_Item menu_2[] = { - {"private", 0, 0, (void*)(0), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, - {"public", 0, 0, (void*)(1), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, - {"protected", 0, 0, (void*)(2), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -Fl_Menu_Item menu_3[] = { - {"local", 0, 0, (void*)(0), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, - {"global", 0, 0, (void*)(1), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -Fl_Input *v_input[4]={(Fl_Input *)0}; - -static void cb_1(Fl_Tile*, void* v) { - wComment->do_callback(wComment, v); - wCallback->do_callback(wCallback, v); +static void cb_wp_gui_flexp(Fl_Group* o, void* v) { + if (v == LOAD) { + if (Flex_Node::parent_is_flex(current_widget)) { + o->show(); + propagate_load(o, v); + } else { + o->hide(); + } + } } -Fl_Text_Editor *wComment=(Fl_Text_Editor *)0; - -fld::widget::Code_Editor *wCallback=(fld::widget::Code_Editor *)0; - -Fl_Group *wp_cpp_callback=(Fl_Group *)0; - -Fl_Menu_Item menu_4[] = { - {"void*", 0, 0, 0, 0, (uchar)FL_NORMAL_LABEL, 4, 11, 0}, - {"long", 0, 0, 0, 0, (uchar)FL_NORMAL_LABEL, 4, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -Fl_Box *w_when_box=(Fl_Box *)0; - -Fl_Group *widget_tab_grid_child=(Fl_Group *)0; - -fld::widget::Formula_Input *widget_grid_row_input=(fld::widget::Formula_Input *)0; - -fld::widget::Formula_Input *widget_grid_col_input=(fld::widget::Formula_Input *)0; - -Fl_Box *widget_grid_transient=(Fl_Box *)0; +Fl_Value_Input *widget_flex_size=(Fl_Value_Input *)0; -static void cb_widget_grid_transient(Fl_Box* o, void* v) { - if (v==LOAD) { - Fl_Widget *child = ((Fl_Widget_Type*)current_widget)->o; - Fl_Grid_Proxy *g = ((Fl_Grid_Proxy*)((Fl_Widget_Type*)current_widget->parent)->o); - // Fl_Grid::Cell *cell = g->cell(child); - // Fl_Grid::Cell *tcell = g->transient_cell(child); - widget_grid_transient->hide(); - widget_grid_unlinked->hide(); - if (g->transient_cell(child)) { - widget_grid_transient->show(); - } else if (!g->cell(child)) { - widget_grid_unlinked->show(); +static void cb_widget_flex_size(Fl_Value_Input* o, void* v) { + if (v == LOAD) { + if (Flex_Node::parent_is_flex(current_widget)) { + o->value(Flex_Node::size(current_widget)); + } + } else { + int mod = 0; + int new_size = (int)o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (Flex_Node::parent_is_flex(q)) { + Fl_Widget* w = (Fl_Widget*)q->o; + Fl_Flex* f = (Fl_Flex*)((Flex_Node*)q->parent)->o; + int was_fixed = f->fixed(w); + if (new_size==0) { + if (was_fixed) { + f->fixed(w, 0); + f->layout(); + widget_flex_fixed->value(0); + mod = 1; + } + } else { + int old_size = Flex_Node::size(q); + if (old_size!=new_size || !was_fixed) { + f->fixed(w, new_size); + f->layout(); + widget_flex_fixed->value(1); + mod = 1; + } + } + } } + if (mod) Fluid.proj.set_modflag(1); } } -Fl_Box *widget_grid_unlinked=(Fl_Box *)0; - -Fl_Group *wp_gridc_align=(Fl_Group *)0; - -Fl_Menu_Item menu_Horizontal[] = { - {"GRID_LEFT", 0, 0, (void*)((fl_intptr_t)FL_GRID_LEFT), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, - {"GRID_CENTER", 0, 0, (void*)((fl_intptr_t)FL_GRID_CENTER), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, - {"GRID_RIGHT", 0, 0, (void*)((fl_intptr_t)FL_GRID_RIGHT), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, - {"GRID_FILL", 0, 0, (void*)((fl_intptr_t)FL_GRID_HORIZONTAL), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -Fl_Menu_Item menu_Vertical[] = { - {"GRID_TOP", 0, 0, (void*)((fl_intptr_t)FL_GRID_TOP), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, - {"GRID_CENTER", 0, 0, (void*)((fl_intptr_t)FL_GRID_CENTER), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, - {"GRID_BOTTOM", 0, 0, (void*)((fl_intptr_t)FL_GRID_BOTTOM), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, - {"GRID_FILL", 0, 0, (void*)((fl_intptr_t)FL_GRID_VERTICAL), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, - {0,0,0,0,0,0,0,0,0} -}; - -Fl_Group *wp_gridc_size=(Fl_Group *)0; - -fld::widget::Formula_Input *widget_grid_rowspan_input=(fld::widget::Formula_Input *)0; - -fld::widget::Formula_Input *widget_grid_colspan_input=(fld::widget::Formula_Input *)0; - -Fl_Group *widget_tab_grid=(Fl_Group *)0; - -fld::widget::Formula_Input *widget_grid_rows=(fld::widget::Formula_Input *)0; +Fl_Check_Button *widget_flex_fixed=(Fl_Check_Button *)0; -static void cb_widget_grid_rows(fld::widget::Formula_Input* o, void* v) { - // grid_rows_cb - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; +static void cb_widget_flex_fixed(Fl_Check_Button* o, void* v) { if (v == LOAD) { - o->value(grid->rows()); - } else { - int m = o->value(), old_m = grid->rows(); - if (m < 1) { - m = 1; - o->value(m); - } - if (m < old_m) { - // TODO: verify that this will not unlink existings cells - // Offer a dialog with "delete children", "unlink cells", "cancel" + if (Flex_Node::parent_is_flex(current_widget)) { + o->value(Flex_Node::is_fixed(current_widget)); } - if (m != old_m) { - undo_checkpoint(); - grid->layout(m, grid->cols()); - grid->need_layout(true); - set_modflag(1); - widget_tab_grid->do_callback(widget_tab_grid, LOAD); + } else { + int mod = 0; + int new_fixed = (int)o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (Flex_Node::parent_is_flex(q)) { + Fl_Widget* w = q->o; + Fl_Flex* f = (Fl_Flex*)((Flex_Node*)q->parent)->o; + int was_fixed = f->fixed(w); + if (new_fixed==0) { + if (was_fixed) { + f->fixed(w, 0); + f->layout(); + mod = 1; + } + } else { + if (!was_fixed) { + f->fixed(w, Flex_Node::size(q)); + f->layout(); + mod = 1; + } + } + } } + if (mod) Fluid.proj.set_modflag(1); } } -static void cb_2(Fl_Button*, void* v) { - if (v != LOAD) { - widget_grid_rows->value( widget_grid_rows->value()-1 ); - widget_grid_rows->do_callback(); - } -} +Fl_Group *wp_gui_values=(Fl_Group *)0; -static void cb_3(Fl_Button*, void* v) { - if (v != LOAD) { - widget_grid_rows->value( widget_grid_rows->value()+1 ); - widget_grid_rows->do_callback(); +static void cb_wp_gui_values(Fl_Group* o, void* v) { + if (v == LOAD) { + if ( current_widget->is_a(Type::Flex) + || current_widget->is_a(Type::Grid) + || current_widget->is_a(Type::Window)) + { + o->hide(); + } else { + o->show(); + propagate_load(o, v); + } } } -fld::widget::Formula_Input *widget_grid_cols=(fld::widget::Formula_Input *)0; - -static void cb_widget_grid_cols(fld::widget::Formula_Input* o, void* v) { - // grid_rows_cb - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; +static void cb_Size(Fl_Value_Input* o, void* v) { if (v == LOAD) { - o->value(grid->cols()); + if (!current_widget->is_a(Type::Slider)) {o->deactivate(); return;} + o->activate(); + o->value(((Fl_Slider*)(current_widget->o))->slider_size()); } else { - int m = o->value(), old_m = grid->cols(); - if (m < 1) { - m = 1; - o->value(m); - } - if (m < old_m) { - // TODO: verify that this will not unlink existings cells - // Offer a dialog with "delete children", "unlink cells", "cancel" - } - if (m != old_m) { - undo_checkpoint(); - grid->layout(grid->rows(), m); - grid->need_layout(true); - set_modflag(1); - widget_tab_grid->do_callback(widget_tab_grid, LOAD); + int mod = 0; + Fluid.proj.undo.checkpoint(); + double n = o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Slider)) { + ((Fl_Slider*)(q->o))->slider_size(n); + q->o->redraw(); + mod = 1; + } } + if (mod) Fluid.proj.set_modflag(1); } } -static void cb_4(Fl_Button*, void* v) { - if (v != LOAD) { - widget_grid_cols->value( widget_grid_cols->value()-1 ); - widget_grid_cols->do_callback(); +static void cb_Minimum(Fl_Value_Input* o, void* v) { + if (v == LOAD) { + if (current_widget->is_a(Type::Valuator_)) { + o->activate(); + o->value(((Fl_Valuator*)(current_widget->o))->minimum()); + } else if (current_widget->is_a(Type::Spinner)) { + o->activate(); + o->value(((Fl_Spinner*)(current_widget->o))->minimum()); + } else { + o->deactivate(); + return; + } + } else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + double n = o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Valuator_)) { + ((Fl_Valuator*)(q->o))->minimum(n); + q->o->redraw(); + mod = 1; + } else if (q->is_a(Type::Spinner)) { + ((Fl_Spinner*)(q->o))->minimum(n); + q->o->redraw(); + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_Maximum(Fl_Value_Input* o, void* v) { + if (v == LOAD) { + if (current_widget->is_a(Type::Valuator_)) { + o->activate(); + o->value(((Fl_Valuator*)(current_widget->o))->maximum()); + } else if (current_widget->is_a(Type::Spinner)) { + o->activate(); + o->value(((Fl_Spinner*)(current_widget->o))->maximum()); + } else { + o->deactivate(); + return; + } + } else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + double n = o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Valuator_)) { + ((Fl_Valuator*)(q->o))->maximum(n); + q->o->redraw(); + mod = 1; + } else if (q->is_a(Type::Spinner)) { + ((Fl_Spinner*)(q->o))->maximum(n); + q->o->redraw(); + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_Step(Fl_Value_Input* o, void* v) { + if (v == LOAD) { + if (current_widget->is_a(Type::Valuator_)) { + o->activate(); + o->value(((Fl_Valuator*)(current_widget->o))->step()); + } else if (current_widget->is_a(Type::Spinner)) { + o->activate(); + o->value(((Fl_Spinner*)(current_widget->o))->step()); + } else { + o->deactivate(); + return; + } + } else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + double n = o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Valuator_)) { + ((Fl_Valuator*)(q->o))->step(n); + q->o->redraw(); + mod = 1; + } else if (q->is_a(Type::Spinner)) { + ((Fl_Spinner*)(q->o))->step(n); + q->o->redraw(); + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_Value(Fl_Value_Input* o, void* v) { + if (v == LOAD) { + if (current_widget->is_a(Type::Valuator_)) { + o->activate(); + o->value(((Fl_Valuator*)(current_widget->o))->value()); + } else if (current_widget->is_button()) { + o->activate(); + o->value(((Fl_Button*)(current_widget->o))->value()); + } else if (current_widget->is_a(Type::Spinner)) { + o->activate(); + o->value(((Fl_Spinner*)(current_widget->o))->value()); + } else + o->deactivate(); + } else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + double n = o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Valuator_)) { + ((Fl_Valuator*)(q->o))->value(n); + mod = 1; + } else if (q->is_button()) { + ((Fl_Button*)(q->o))->value(n != 0); + if (q->is_a(Type::Menu_Item)) q->redraw(); + mod = 1; + } else if (q->is_a(Type::Spinner)) { + ((Fl_Spinner*)(q->o))->value(n); + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +Fl_Group *wp_gui_margins=(Fl_Group *)0; + +static void cb_wp_gui_margins(Fl_Group* o, void* v) { + if (v == LOAD) { + if (current_widget->is_a(Type::Flex)) { + o->show(); + propagate_load(o, v); + } else { + o->hide(); + } + } +} + +static void cb_Left(Fl_Value_Input* o, void* v) { + flex_margin_cb(o, v, + [](Fl_Flex *w, Fl_Value_Input* i) -> void + { + int v; + w->margin(&v, nullptr, nullptr, nullptr); + i->value((double)v); + }, + [](Fl_Flex *w, int new_value) -> int + { + int l, t, r, b; + w->margin(&l, &t, &r, &b); + if (new_value!=l) { + w->margin(new_value, t, r, b); + return 1; + } else { + return 0; + } + } + ); +} + +static void cb_Top(Fl_Value_Input* o, void* v) { + flex_margin_cb(o, v, + [](Fl_Flex *w, Fl_Value_Input* i) -> void + { + int v; + w->margin(nullptr, &v, nullptr, nullptr); + i->value((double)v); + }, + [](Fl_Flex *w, int new_value) + { + int l, t, r, b; + w->margin(&l, &t, &r, &b); + if (new_value!=t) { + w->margin(l, new_value, r, b); + return 1; + } else { + return 0; + } + } + ); +} + +static void cb_Right(Fl_Value_Input* o, void* v) { + flex_margin_cb(o, v, + [](Fl_Flex *w, Fl_Value_Input* i) -> void + { + int v; + w->margin(nullptr, nullptr, &v, nullptr); + i->value((double)v); + }, + [](Fl_Flex *w, int new_value) -> int + { + int l, t, r, b; + w->margin(&l, &t, &r, &b); + if (new_value!=r) { + w->margin(l, t, new_value, b); + return 1; + } else { + return 0; + } + } + ); +} + +static void cb_Bottom(Fl_Value_Input* o, void* v) { + flex_margin_cb(o, v, + [](Fl_Flex *w, Fl_Value_Input* i) -> void + { + int v; + w->margin(nullptr, nullptr, nullptr, &v); + i->value((double)v); + }, + [](Fl_Flex *w, int new_value) -> int + { + int l, t, r, b; + w->margin(&l, &t, &r, &b); + if (new_value!=b) { + w->margin(l, t, r, new_value); + return 1; + } else { + return 0; + } + } + ); +} + +static void cb_Gap(Fl_Value_Input* o, void* v) { + flex_margin_cb(o, v, + [](Fl_Flex *w, Fl_Value_Input* o) -> void + { + int v = w->gap(); + o->value((double)v); + }, + [](Fl_Flex *w, int new_value) -> int + { + int g = w->gap(); + if (new_value!=g) { + w->gap(new_value); + return 1; + } else { + return 0; + } + } + ); +} + +Fl_Group *wp_gui_sizerange=(Fl_Group *)0; + +static void cb_wp_gui_sizerange(Fl_Group* o, void* v) { + if (v == LOAD) { + if (current_widget->is_a(Type::Window)) { + o->show(); + propagate_load(o, v); + } else { + o->hide(); + } + } +} + +static void cb_Minimum1(Fl_Value_Input* o, void* v) { + if (v == LOAD) { + if (!current_widget->is_a(Type::Window)) return; + o->value(((Window_Node*)current_widget)->sr_min_w); + } else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + int n = (int)o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Window)) { + ((Window_Node*)q)->sr_min_w = n; + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_1(Fl_Value_Input* o, void* v) { + if (v == LOAD) { + if (!current_widget->is_a(Type::Window)) return; + o->value(((Window_Node*)current_widget)->sr_min_h); + } else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + int n = (int)o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Window)) { + ((Window_Node*)q)->sr_min_h = n; + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_set(Fl_Button* o, void* v) { + if (v == LOAD) { + } else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Window)) { + Window_Node *win = (Window_Node*)q; + win->sr_min_w = win->o->w(); + win->sr_min_h = win->o->h(); + mod = 1; + } + } + propagate_load(the_panel, LOAD); + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_Maximum1(Fl_Value_Input* o, void* v) { + if (v == LOAD) { + if (!current_widget->is_a(Type::Window)) return; + o->value(((Window_Node*)current_widget)->sr_max_w); + } else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + int n = (int)o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Window)) { + ((Window_Node*)q)->sr_max_w = n; + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_2(Fl_Value_Input* o, void* v) { + if (v == LOAD) { + if (!current_widget->is_a(Type::Window)) return; + o->value(((Window_Node*)current_widget)->sr_max_h); + } else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + int n = (int)o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Window)) { + ((Window_Node*)q)->sr_max_h = n; + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_set1(Fl_Button* o, void* v) { + if (v == LOAD) { + } else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Window)) { + Window_Node *win = (Window_Node*)q; + win->sr_max_w = win->o->w(); + win->sr_max_h = win->o->h(); + mod = 1; + } + } + propagate_load(the_panel, LOAD); + if (mod) Fluid.proj.set_modflag(1); + } +} + +Fl_Shortcut_Button *wp_gui_shortcut=(Fl_Shortcut_Button *)0; + +static void cb_wp_gui_shortcut(Fl_Shortcut_Button* o, void* v) { + if (v == LOAD) { + if (current_widget->is_button()) + o->value( ((Fl_Button*)(current_widget->o))->shortcut() ); + else if (current_widget->is_a(Type::Input)) + o->value( ((Fl_Input_*)(current_widget->o))->shortcut() ); + else if (current_widget->is_a(Type::Value_Input)) + o->value( ((Fl_Value_Input*)(current_widget->o))->shortcut() ); + else if (current_widget->is_a(Type::Text_Display)) + o->value( ((Fl_Text_Display*)(current_widget->o))->shortcut() ); + else { + o->hide(); + o->parent()->hide(); + return; + } + //i->default_value( i->value() ); // enable the "undo" capability of the shortcut button + o->show(); + o->parent()->show(); + o->redraw(); + } else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) + if (q->is_button()) { + Fl_Button* b = (Fl_Button*)(q->o); + if (b->shortcut() != (int)o->value()) mod = 1; + b->shortcut(o->value()); + if (q->is_a(Type::Menu_Item)) q->redraw(); + } else if (q->is_a(Type::Input)) { + Fl_Input_* b = (Fl_Input_*)(q->o); + if (b->shortcut() != (int)o->value()) mod = 1; + b->shortcut(o->value()); + } else if (q->is_a(Type::Value_Input)) { + Fl_Value_Input* b = (Fl_Value_Input*)(q->o); + if (b->shortcut() != (int)o->value()) mod = 1; + b->shortcut(o->value()); + } else if (q->is_a(Type::Text_Display)) { + Fl_Text_Display* b = (Fl_Text_Display*)(q->o); + if (b->shortcut() != (int)o->value()) mod = 1; + b->shortcut(o->value()); + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +Fl_Group *wp_gui_xclass=(Fl_Group *)0; + +static void cb_3(Fl_Input* o, void* v) { + if (v == LOAD) { + if (current_widget->is_a(Type::Window)) { + o->show(); + o->parent()->show(); + o->value(((Window_Node *)current_widget)->xclass); + } else { + o->hide(); + o->parent()->hide(); // hides the "X Class:" label as well + } + } else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Window)) { + mod = 1; + Window_Node *wt = (Window_Node *)q; + storestring(o->value(), wt->xclass); + ((Fl_Window*)(wt->o))->xclass(wt->xclass); + } + } + if (mod) Fluid.proj.set_modflag(1); } } -static void cb_5(Fl_Button*, void* v) { +static void cb_Border(Fl_Light_Button* o, void* v) { + if (v == LOAD) { + if (!current_widget->is_a(Type::Window)) {o->hide(); return;} + o->show(); + o->value(((Fl_Window*)(current_widget->o))->border()); + } else { + Fluid.proj.undo.checkpoint(); + ((Fl_Window*)(current_widget->o))->border(o->value()); + Fluid.proj.set_modflag(1); + } +} + +static void cb_Modal(Fl_Light_Button* o, void* v) { + if (v == LOAD) { + if (!current_widget->is_a(Type::Window)) {o->hide(); return;} + o->show(); + o->value(((Window_Node *)current_widget)->modal); + } else { + Fluid.proj.undo.checkpoint(); + ((Window_Node *)current_widget)->modal = o->value(); + Fluid.proj.set_modflag(1); + } +} + +static void cb_Nonmodal(Fl_Light_Button* o, void* v) { + if (v == LOAD) { + if (!current_widget->is_a(Type::Window)) {o->hide(); return;} + o->show(); + o->value(((Window_Node *)current_widget)->non_modal); + } else { + Fluid.proj.undo.checkpoint(); + ((Window_Node *)current_widget)->non_modal = o->value(); + Fluid.proj.set_modflag(1); + } +} + +Fl_Group *wp_gui_attributes=(Fl_Group *)0; + +static void cb_Visible(Fl_Light_Button* o, void* v) { + if (v == LOAD) { + o->value(current_widget->o->visible()); + if (current_widget->is_a(Type::Window)) o->deactivate(); + else o->activate(); + } else { + int mod = 0; + int n = o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (!mod) { + mod = 1; + Fluid.proj.undo.checkpoint(); + } + n ? q->o->show() : q->o->hide(); + q->redraw(); + if (n && q->parent && q->parent->type_name()) { + if (q->parent->is_a(Type::Tabs)) { + ((Fl_Tabs *)q->o->parent())->value(q->o); + } else if (q->parent->is_a(Type::Wizard)) { + ((Fl_Wizard *)q->o->parent())->value(q->o); + } + } + } + if (mod) { + Fluid.proj.set_modflag(1); + redraw_browser(); + } + } +} + +static void cb_Active(Fl_Light_Button* o, void* v) { + if (v == LOAD) { + o->value(current_widget->o->active()); + if (current_widget->is_a(Type::Window)) o->deactivate(); + else o->activate(); + } else { + int mod = 0; + int n = o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (!mod) { + mod = 1; + Fluid.proj.undo.checkpoint(); + } + n ? q->o->activate() : q->o->deactivate(); + q->redraw(); + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_Resizable(Fl_Light_Button* o, void* v) { + if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) {o->deactivate(); return;} + if (numselected > 1) {o->deactivate(); return;} + o->activate(); + o->value(current_widget->resizable()); + } else { + Fluid.proj.undo.checkpoint(); + current_widget->resizable(o->value()); + Fluid.proj.set_modflag(1); + } +} + +static void cb_Hotspot(Fl_Light_Button* o, void* v) { + if (v == LOAD) { + if (numselected > 1) {o->deactivate(); return;} + if (current_widget->is_a(Type::Menu_Item)) o->label("divider"); + else o->label("hotspot"); + o->activate(); + o->value(current_widget->hotspot()); + } else { + Fluid.proj.undo.checkpoint(); + current_widget->hotspot(o->value()); + if (current_widget->is_a(Type::Menu_Item)) { + current_widget->redraw(); + return; + } + if (o->value()) { + Node *p = current_widget->parent; + if (!p || !p->is_widget()) return; + while (!p->is_a(Type::Window)) p = p->parent; + for (Node *q = p->next; q && q->level > p->level; q = q->next) { + if (q->is_widget() && q != current_widget) + ((Widget_Node*)q)->hotspot(0); + } + } + Fluid.proj.set_modflag(1); + } +} + +Fl_Input *wp_gui_tooltip=(Fl_Input *)0; + +static void cb_wp_gui_tooltip(Fl_Input* o, void* v) { + if (v == LOAD) { + if (current_widget->is_widget()) { + o->activate(); + o->value(((Widget_Node*)current_widget)->tooltip()); + } else { + o->deactivate(); + } + } else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->tooltip(o->value()); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +Fl_Group *wp_style_tab=(Fl_Group *)0; + +Fl_Group *wp_style_label=(Fl_Group *)0; + +static void cb_4(Fl_Choice* o, void* v) { + if (v == LOAD) { + int n = current_widget->o->labelfont(); + if (n > 15) n = 0; + o->value(n); + } else { + int mod = 0; + int n = o->value(); + if (n <= 0) n = Fluid.proj.layout->labelfont; + if (n <= 0) n = FL_HELVETICA; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->o->labelfont(n); + q->redraw(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_5(Fl_Value_Input* o, void* v) { + int n; + if (v == LOAD) { + n = current_widget->o->labelsize(); + } else { + int mod = 0; + n = int(o->value()); + if (n <= 0) n = Fluid.proj.layout->labelsize; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->o->labelsize(n); + q->redraw(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } + o->value(n); +} + +Fl_Button *w_labelcolor=(Fl_Button *)0; + +static void cb_w_labelcolor(Fl_Button* o, void* v) { + Fl_Color c = current_widget->o->labelcolor(); + if (v != LOAD) { + Fl_Color d = fl_show_colormap(c); + if (d == c) return; + c = d; + labelcolor_common(c); + } + o->color(c); + o->labelcolor(fl_contrast(FL_BLACK,c)); + o->redraw(); +} + +static void cb_6(Fl_Menu_Button* o, void* v) { + Fl_Color c = current_widget->o->labelcolor(); if (v != LOAD) { - widget_grid_cols->value( widget_grid_cols->value()+1 ); - widget_grid_cols->do_callback(); + Fl_Color d = (Fl_Color)(o->mvalue()->argument()); + if (d == c) return; + c = d; + labelcolor_common(c); + w_labelcolor->color(c); + w_labelcolor->labelcolor(fl_contrast(FL_BLACK,c)); + w_labelcolor->redraw(); + } +} + +Fl_Group *wp_style_box=(Fl_Group *)0; + +static void cb_7(Fl_Choice* o, void* v) { + if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) {o->deactivate(); return;} else o->activate(); + int n = current_widget->o->box(); + if (!n) n = ZERO_ENTRY; + for (int j = 0; j < 72 /*int(sizeof(boxmenu)/sizeof(*boxmenu))*/; j++) + if (boxmenu[j].argument() == n) {o->value(j); break;} + } else { + int mod = 0; + int m = o->value(); + int n = int(boxmenu[m].argument()); + if (!n) return; // should not happen + if (n == ZERO_ENTRY) n = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->o->box((Fl_Boxtype)n); + q->redraw(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +Fl_Button *w_color=(Fl_Button *)0; + +static void cb_w_color(Fl_Button* o, void* v) { + Fl_Color c = current_widget->o->color(); + if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) { + o->deactivate(); + } else { + o->activate(); + } + } else { + Fl_Color d = fl_show_colormap(c); + if (d == c) return; + c = d; + color_common(c); + } + o->color(c); + o->labelcolor(fl_contrast(FL_BLACK,c)); + o->redraw(); +} + +static void cb_8(Fl_Menu_Button* o, void* v) { + Fl_Color c = current_widget->o->color(); + if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) {o->deactivate(); return;} else o->activate(); + } else { + Fl_Color d = (Fl_Color)(o->mvalue()->argument()); + if (d == c) return; + c = d; + color_common(c); + w_color->color(c); + w_color->labelcolor(fl_contrast(FL_BLACK,c)); + w_color->redraw(); } } -Fl_Group *wp_grid_margin=(Fl_Group *)0; +Fl_Group *wp_style_downbox=(Fl_Group *)0; + +static void cb_9(Fl_Choice* o, void* v) { + if (v == LOAD) { + int n; + if (current_widget->is_a(Type::Button)) + n = ((Fl_Button*)(current_widget->o))->down_box(); + else if (current_widget->is_a(Type::Input_Choice)) + n = ((Fl_Input_Choice*)(current_widget->o))->down_box(); + else if (current_widget->is_a(Type::Menu_Manager_)) + n = ((Fl_Menu_*)(current_widget->o))->down_box(); + else { + o->deactivate(); return; + } + o->activate(); + if (!n) n = ZERO_ENTRY; + for (int j = 0; j < 72 /*int(sizeof(boxmenu)/sizeof(*boxmenu))*/; j++) + if (boxmenu[j].argument() == n) {o->value(j); break;} + } else { + int mod = 0; + int m = o->value(); + int n = int(boxmenu[m].argument()); + if (!n) return; // should not happen + if (n == ZERO_ENTRY) n = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Button)) { + ((Fl_Button*)(q->o))->down_box((Fl_Boxtype)n); + if (((Fl_Button*)(q->o))->value()) q->redraw(); + } else if (q->is_a(Type::Input_Choice)) { + ((Fl_Input_Choice*)(q->o))->down_box((Fl_Boxtype)n); + } else if (q->is_a(Type::Menu_Manager_)) { + ((Fl_Menu_*)(q->o))->down_box((Fl_Boxtype)n); + } + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +Fl_Button *w_selectcolor=(Fl_Button *)0; + +static void cb_w_selectcolor(Fl_Button* o, void* v) { + Fl_Color c = current_widget->o->selection_color(); + if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) { + o->deactivate(); + return; + } else { + o->activate(); + } + } else { + Fl_Color d = fl_show_colormap(c); + if (d == c) return; + c = d; + color2_common(c); + } + o->color(c); + o->labelcolor(fl_contrast(FL_BLACK,c)); + o->redraw(); +} + +static void cb_a(Fl_Menu_Button* o, void* v) { + Fl_Color c = current_widget->o->selection_color(); + if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) { + o->deactivate(); + return; + } else { + o->activate(); + } + } else { + Fl_Color d = (Fl_Color)(o->mvalue()->argument()); + if (d == c) return; + c = d; + color2_common(c); + w_selectcolor->color(c); + w_selectcolor->labelcolor(fl_contrast(FL_BLACK,c)); + w_selectcolor->redraw(); + } +} + +Fl_Group *wp_style_text=(Fl_Group *)0; + +static void cb_b(Fl_Choice* o, void* v) { + Fl_Font n; int s; Fl_Color c; + if (v == LOAD) { + if (!current_widget->textstuff(0,n,s,c)) {o->deactivate(); return;} + o->activate(); + if (n > 15) n = FL_HELVETICA; + o->value(n); + } else { + int mod = 0; + n = (Fl_Font)o->value(); + if (n <= 0) n = Fluid.proj.layout->textfont; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->textstuff(1,n,s,c); + q->o->redraw(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_c(Fl_Value_Input* o, void* v) { + Fl_Font n; int s; Fl_Color c; + if (v == LOAD) { + if (!current_widget->textstuff(0,n,s,c)) {o->deactivate(); return;} + o->activate(); + } else { + int mod = 0; + s = int(o->value()); + if (s <= 0) s = Fluid.proj.layout->textsize; + if (s <= 0) s = Fluid.proj.layout->labelsize; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->textstuff(2,n,s,c); + q->o->redraw(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } + o->value(s); +} + +Fl_Button *w_textcolor=(Fl_Button *)0; + +static void cb_w_textcolor(Fl_Button* o, void* v) { + Fl_Font n; int s; Fl_Color c; + if (v == LOAD) { + if (!current_widget->textstuff(0,n,s,c)) { + o->deactivate(); + return; + } + o->activate(); + } else { + c = o->color(); + Fl_Color d = fl_show_colormap(c); + if (d == c) return; + c = d; + textcolor_common(c); + } + o->color(c); + o->labelcolor(fl_contrast(FL_BLACK,c)); + o->redraw(); +} + +static void cb_d(Fl_Menu_Button* o, void* v) { + Fl_Font n; int s; Fl_Color c; + if (v == LOAD) { + if (!current_widget->textstuff(0,n,s,c)) { + o->deactivate(); + return; + } + o->activate(); + } else { + c = o->color(); + Fl_Color d = (Fl_Color)(o->mvalue()->argument()); + if (d == c) return; + c = d; + textcolor_common(c); + w_textcolor->color(c); + w_textcolor->labelcolor(fl_contrast(FL_BLACK,c)); + w_textcolor->redraw(); + } +} + +static void cb_Horizontal(Fl_Value_Input* o, void* v) { + int s; + if (v == LOAD) { + if (!current_widget->is_true_widget()) { + o->deactivate(); + o->value(0); + } else { + o->activate(); + o->value(((Widget_Node*)current_widget)->o->horizontal_label_margin()); + } + } else { + int mod = 0; + s = int(o->value()); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_true_widget()) { + if (q->o->horizontal_label_margin() != s) { + q->o->horizontal_label_margin(s); + if (!(q->o->align() & FL_ALIGN_INSIDE) && q->o->window()) + q->o->window()->damage(FL_DAMAGE_EXPOSE); // outside labels + q->o->redraw(); + mod = 1; + } + } + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_Vertical(Fl_Value_Input* o, void* v) { + int s; + if (v == LOAD) { + if (!current_widget->is_true_widget()) { + o->deactivate(); + o->value(0); + } else { + o->activate(); + o->value(((Widget_Node*)current_widget)->o->vertical_label_margin()); + } + } else { + int mod = 0; + s = int(o->value()); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_true_widget()) { + if (q->o->vertical_label_margin() != s) { + q->o->vertical_label_margin(s); + if (!(q->o->align() & FL_ALIGN_INSIDE) && q->o->window()) + q->o->window()->damage(FL_DAMAGE_EXPOSE); // outside labels + q->o->redraw(); + mod = 1; + } + } + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_Image(Fl_Value_Input* o, void* v) { + int s; + if (v == LOAD) { + if (!current_widget->is_true_widget()) { + o->deactivate(); + o->value(0); + } else { + o->activate(); + o->value(((Widget_Node*)current_widget)->o->label_image_spacing()); + } + } else { + int mod = 0; + s = int(o->value()); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_true_widget()) { + if (q->o->label_image_spacing() != s) { + q->o->label_image_spacing(s); + if (!(q->o->align() & FL_ALIGN_INSIDE) && q->o->window()) + q->o->window()->damage(FL_DAMAGE_EXPOSE); // outside labels + q->o->redraw(); + mod = 1; + } + } + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_Compact(Fl_Light_Button* o, void* v) { + if (v == LOAD) { + uchar n; + if (current_widget->is_a(Type::Button) && !current_widget->is_a(Type::Menu_Item)) { + n = ((Fl_Button*)(current_widget->o))->compact(); + o->value(n); + o->show(); + } else { + o->hide(); + } + } else { + int mod = 0; + uchar n = (uchar)o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Button) && !q->is_a(Type::Menu_Item)) { + uchar v = ((Fl_Button*)(q->o))->compact(); + if (n != v) { + if (!mod) { + mod = 1; + Fluid.proj.undo.checkpoint(); + } + ((Fl_Button*)(q->o))->compact(n); + q->redraw(); + } + } + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +Fl_Group *wp_cpp_tab=(Fl_Group *)0; + +Fl_Group *wp_cpp_class=(Fl_Group *)0; + +static void cb_e(Fl_Input* o, void* v) { + if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) { + o->deactivate(); + } else { + o->activate(); + o->value(current_widget->subclass()); + } + } else { + int mod = 0; + const char *c = o->value(); + for (Widget_Node *t: Fluid.proj.tree.all_selected_widgets()) { + t->subclass(c); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +static void cb_f(Fl_Choice* o, void* v) { + static Fl_Menu_Item empty_type_menu[] = { + {"Normal",0,nullptr,(void*)nullptr}, + {nullptr}}; + + if (v == LOAD) { + Fl_Menu_Item* m = current_widget->subtypes(); + if (!m) { + o->menu(empty_type_menu); + o->value(0); + o->deactivate(); + } else { + o->menu(m); + int j; + for (j = 0;; j++) { + if (!m[j].text) {j = 0; break;} + if (current_widget->is_a(Type::Spinner)) { + if (m[j].argument() == ((Fl_Spinner*)current_widget->o)->type()) break; + } else { + if (m[j].argument() == current_widget->o->type()) break; + } + } + o->value(j); + o->activate(); + } + o->redraw(); + } else { + int mod = 0; + int n = int(o->mvalue()->argument()); + Fl_Menu_Item* m = current_widget->subtypes(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->subtypes()==m) { + if (q->is_a(Type::Spinner)) + ((Fl_Spinner*)q->o)->type(n); + else if (q->is_a(Type::Flex)) + ((Flex_Node*)q)->change_subtype_to(n); + else + q->o->type(n); + q->redraw(); + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); + } +} + +Fl_Group *wp_cpp_name=(Fl_Group *)0; -static void cb_Left(Fl_Value_Input* o, void* v) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; - int m = 0; +static void cb_10(Fl_Input* o, void* v) { if (v == LOAD) { - grid->margin(&m, NULL, NULL, NULL); - o->value(m); - } else { - int m = (int)o->value(), old_m; - grid->margin(&old_m, NULL, NULL, NULL); - if (m != old_m) { - undo_checkpoint(); - grid->margin(m, -1, -1, -1); - grid->need_layout(true); - set_modflag(1); - } - } -} + static char buf[1024]; + if (numselected != 1) { + snprintf(buf, sizeof(buf), "Widget Properties (%d widgets)", numselected); + o->hide(); + } else { + o->value(current_widget->name()); + o->show(); + snprintf(buf, sizeof(buf), "%s Properties", current_widget->title()); + } -static void cb_Top(Fl_Value_Input* o, void* v) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; - int m = 0; - if (v == LOAD) { - grid->margin(NULL, &m, NULL, NULL); - o->value(m); - } else { - int m = (int)o->value(), old_m; - grid->margin(NULL, &old_m, NULL, NULL); - if (m != old_m) { - undo_checkpoint(); - grid->margin(-1, m, -1, -1); - grid->need_layout(true); - set_modflag(1); + the_panel->label(buf); + } else { + if (numselected == 1) { + current_widget->name(o->value()); + // I don't update window title, as it probably is being closed + // and wm2 (a window manager) barfs if you retitle and then + // hide a window: + // ((Fl_Window*)(o->parent()->parent()->parent()))->label(current_widget->title()); + } } - } } -static void cb_Right(Fl_Value_Input* o, void* v) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; - int m = 0; +static void cb_11(Fl_Choice* o, void* v) { if (v == LOAD) { - grid->margin(NULL, NULL, &m, NULL); - o->value(m); + o->value(current_widget->public_); + if (current_widget->is_in_class()) o->show(); else o->hide(); } else { - int m = (int)o->value(), old_m; - grid->margin(NULL, NULL, &old_m, NULL); - if (m != old_m) { - undo_checkpoint(); - grid->margin(-1, -1, m, -1); - grid->need_layout(true); - set_modflag(1); + int mod = 0; + for (Widget_Node *w: Fluid.proj.tree.all_selected_widgets()) { + if (w->is_in_class()) { + w->public_ = o->value(); + } else { + // if this is not in a class, it can be only private or public + w->public_ = (o->value()>0); + } + mod = 1; } - } -} - -static void cb_Bottom(Fl_Value_Input* o, void* v) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; - int m = 0; - if (v == LOAD) { - grid->margin(NULL, NULL, NULL, &m); - o->value(m); - } else { - int m = (int)o->value(), old_m; - grid->margin(NULL, NULL, NULL, &old_m); - if (m != old_m) { - undo_checkpoint(); - grid->margin(-1, -1, -1, m); - grid->need_layout(true); - set_modflag(1); + if (mod) { + Fluid.proj.set_modflag(1); + redraw_browser(); } } } -Fl_Group *wp_grid_gaps=(Fl_Group *)0; +Fl_Menu_Item menu_2[] = { + {"private", 0, 0, (void*)(0), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"public", 0, 0, (void*)(1), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"protected", 0, 0, (void*)(2), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {0,0,0,0,0,0,0,0,0} +}; -static void cb_Row(Fl_Value_Input* o, void* v) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; - if (v == LOAD) { - int m = 0; - grid->gap(&m, NULL); - o->value(m); - } else { - int m = (int)o->value(), old_m, m2; - grid->gap(&old_m, &m2); - if (m != old_m) { - undo_checkpoint(); - grid->gap(m, m2); - grid->need_layout(true); - set_modflag(1); +Fl_Menu_Item menu_3[] = { + {"local", 0, 0, (void*)(0), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"global", 0, 0, (void*)(1), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {0,0,0,0,0,0,0,0,0} +}; + +static void cb_v_input(Fl_Input* o, void* v) { + int n = fl_int(o->user_data()); + if (v == LOAD) { + o->value(current_widget->extra_code(n)); + } else { + int mod = 0; + const char *c = o->value(); + const char *d = c_check(c&&c[0]=='#' ? c+1 : c); + if (d) {fl_message("Error in %s: %s",o->label(),d); haderror = 1; return;} + for (Widget_Node *w: Fluid.proj.tree.all_selected_widgets()) { + w->extra_code(n,c); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); } - } } -static void cb_Col(Fl_Value_Input* o, void* v) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; - if (v == LOAD) { - int m = 0; - grid->gap(NULL, &m); - o->value(m); - } else { - int m = (int)o->value(), old_m, m2; - grid->gap(&m2, &old_m); - if (m != old_m) { - undo_checkpoint(); - grid->gap(m2, m); - grid->need_layout(true); - set_modflag(1); - } - } +static void cb_v_input1(Fl_Input* o, void* v) { + cb_v_input(o, v); } -static void cb_Row1(Fl_Group* o, void* v) { - if (v == LOAD) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (grid) - o->activate(); - else - o->deactivate(); - propagate_load(o, v); - } +static void cb_v_input2(Fl_Input* o, void* v) { + cb_v_input(o, v); } -fld::widget::Formula_Input *widget_grid_curr_row=(fld::widget::Formula_Input *)0; +Fl_Input *v_input[4]={(Fl_Input *)0}; -static void cb_widget_grid_curr_row(fld::widget::Formula_Input* o, void* v) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; - int r = o->value(), old_r = r; - if (r < 0) r = 0; - if (r >= grid->rows()) r = grid->rows()-1; - if (r != old_r) o->value(r); - if (v == LOAD) { - // will automatically propagate - } else { - widget_grid_curr_row_attributes->do_callback(widget_grid_curr_row_attributes, LOAD); - } +static void cb_v_input3(Fl_Input* o, void* v) { + cb_v_input(o, v); } -static void cb_6(Fl_Button*, void* v) { - if (v != LOAD) { - widget_grid_curr_row->value( widget_grid_curr_row->value()-1 ); - widget_grid_curr_row->do_callback(); - } +static void cb_12(Fl_Tile*, void* v) { + wComment->do_callback(wComment, v); + wCallback->do_callback(wCallback, v); } -static void cb_7(Fl_Button*, void* v) { - if (v != LOAD) { - widget_grid_curr_row->value( widget_grid_curr_row->value()+1 ); - widget_grid_curr_row->do_callback(); - } +Fl_Text_Editor *wComment=(Fl_Text_Editor *)0; + +static void cb_wComment(Fl_Text_Editor* o, void* v) { + if (v == LOAD) { + const char *cmttext = current_widget->comment(); + o->buffer()->text( cmttext ? cmttext : "" ); + } else { + int mod = 0; + char *c = o->buffer()->text(); + for (Node *n: Fluid.proj.tree.all_selected_nodes()) { + n->comment(c); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + free(c); + } } -Fl_Group *widget_grid_curr_row_attributes=(Fl_Group *)0; +fld::widget::Code_Editor *wCallback=(fld::widget::Code_Editor *)0; -static void cb_Height(fld::widget::Formula_Input* o, void* v) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; - int r = widget_grid_curr_row->value(); +static void cb_wCallback(fld::widget::Code_Editor* o, void* v) { if (v == LOAD) { - o->value(grid->row_height(r)); - } else { - int h = o->value(), old_h = grid->row_height(r); - if (h < 0) h = 0; - if (h != old_h) { - undo_checkpoint(); - grid->row_height(r, h); - grid->need_layout(true); - set_modflag(1); + const char *cbtext = current_widget->callback(); + o->buffer()->text( cbtext ? cbtext : "" ); + } else { + int mod = 0; + char *c = o->buffer()->text(); + const char *d = c_check(c); + if (d) { + fl_message("Error in callback: %s",d); + if (o->window()) o->window()->make_current(); + haderror = 1; + } + for (Node *n: Fluid.proj.tree.all_selected_nodes()) { + n->callback(c); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + free(c); } - } } -static void cb_Weight(fld::widget::Formula_Input* o, void* v) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; - int r = widget_grid_curr_row->value(); +Fl_Group *wp_cpp_callback=(Fl_Group *)0; + +static void cb_13(Fl_Input* o, void* v) { if (v == LOAD) { - o->value(grid->row_weight(r)); + o->value(current_widget->user_data()); } else { - int h = o->value(), old_h = grid->row_weight(r); - if (h < 0) h = 0; - if (h != old_h) { - undo_checkpoint(); - grid->row_weight(r, h); - grid->need_layout(true); - set_modflag(1); + int mod = 0; + const char *c = o->value(); + const char *d = c_check(c); + if (d) {fl_message("Error in user_data: %s",d); haderror = 1; return;} + for (Node *n: Fluid.proj.tree.all_selected_nodes()) { + n->user_data(c); + mod = 1; } + if (mod) Fluid.proj.set_modflag(1); } } -static void cb_Gap(fld::widget::Formula_Input* o, void* v) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; - int r = widget_grid_curr_row->value(); +static void cb_When(Fl_Menu_Button* o, void* v) { if (v == LOAD) { - o->value(grid->row_gap(r)); + if (current_widget->is_a(Type::Menu_Item)) {o->deactivate(); return;} else o->activate(); + int n = current_widget->o->when(); + set_whenmenu(n); + w_when_box->copy_label(when_symbol_name(n)); } else { - int h = o->value(), old_h = grid->row_gap(r); - if (h < -1) h = -1; - if (h != old_h) { - undo_checkpoint(); - grid->row_gap(r, h); - grid->need_layout(true); - set_modflag(1); + int mod = 0; + int n = 0; + if (o->mvalue() && ((o->mvalue()->flags & FL_MENU_TOGGLE) == 0) ) { + n = (int)o->mvalue()->argument(); + set_whenmenu(n); + } else { + if (whenmenu[0].value()) n |= FL_WHEN_CHANGED; + if (whenmenu[1].value()) n |= FL_WHEN_NOT_CHANGED; + if (whenmenu[2].value()) n |= FL_WHEN_RELEASE; + if (whenmenu[3].value()) n |= FL_WHEN_ENTER_KEY; + if (whenmenu[4].value()) n |= FL_WHEN_CLOSED; } + w_when_box->copy_label(when_symbol_name(n)); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->o->when(n); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); } } -fld::widget::Formula_Input *widget_grid_curr_col=(fld::widget::Formula_Input *)0; - -static void cb_widget_grid_curr_col(fld::widget::Formula_Input* o, void* v) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; - int c = o->value(), old_c = c; - if (c < 0) c = 0; - if (c >= grid->cols()) c = grid->cols()-1; - if (c != old_c) o->value(c); +static void cb_14(Fl_Input_Choice* o, void* v) { + static const char *dflt = "void*"; if (v == LOAD) { - // will automatically propagate + const char *c = current_widget->user_data_type(); + if (!c) c = dflt; + o->value(c); } else { - widget_grid_curr_col_attributes->do_callback(widget_grid_curr_col_attributes, LOAD); + int mod = 0; + const char *c = o->value(); + const char *d = c_check(c); + if (!*c) o->value(dflt); + else if (!strcmp(c,dflt)) c = nullptr; + if (!d) { + if (c && *c && c[strlen(c)-1] != '*' && strcmp(c,"long")) + d = "must be pointer or long"; + } + if (d) {fl_message("Error in type: %s",d); haderror = 1; return;} + for (Node *q: Fluid.proj.tree.all_selected_nodes()) { + q->user_data_type(c); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); } } -static void cb_8(Fl_Button*, void* v) { - if (v != LOAD) { - widget_grid_curr_col->value( widget_grid_curr_col->value()-1 ); - widget_grid_curr_col->do_callback(); - } -} +Fl_Menu_Item menu_4[] = { + {"void*", 0, 0, 0, 0, (uchar)FL_NORMAL_LABEL, 4, 11, 0}, + {"long", 0, 0, 0, 0, (uchar)FL_NORMAL_LABEL, 4, 11, 0}, + {0,0,0,0,0,0,0,0,0} +}; -static void cb_9(Fl_Button*, void* v) { - if (v != LOAD) { - widget_grid_curr_col->value( widget_grid_curr_col->value()+1 ); - widget_grid_curr_col->do_callback(); - } -} +Fl_Box *w_when_box=(Fl_Box *)0; -Fl_Group *widget_grid_curr_col_attributes=(Fl_Group *)0; +Grid_Tab *widget_tab_grid=(Grid_Tab *)0; -static void cb_Width(fld::widget::Formula_Input* o, void* v) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; - int c = widget_grid_curr_col->value(); - if (v == LOAD) { - o->value(grid->col_width(c)); - } else { - int h = o->value(), old_h = grid->col_width(c); - if (h < 0) h = 0; - if (h != old_h) { - undo_checkpoint(); - grid->col_width(c, h); - grid->need_layout(true); - set_modflag(1); - } - } +static void cb_widget_tab_grid(Grid_Tab* o, void*) { + o->callback((Fl_Callback*)propagate_load); } -static void cb_Weight1(fld::widget::Formula_Input* o, void* v) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; - int c = widget_grid_curr_col->value(); - if (v == LOAD) { - o->value(grid->col_weight(c)); - } else { - int h = o->value(), old_h = grid->col_weight(c); - if (h < 0) h = 0; - if (h != old_h) { - undo_checkpoint(); - grid->col_weight(c, h); - grid->need_layout(true); - set_modflag(1); - } - } -} +Grid_Child_Tab *widget_tab_grid_child=(Grid_Child_Tab *)0; -static void cb_Gap1(fld::widget::Formula_Input* o, void* v) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (!grid) return; - int c = widget_grid_curr_col->value(); - if (v == LOAD) { - o->value(grid->col_gap(c)); - } else { - int h = o->value(), old_h = grid->col_gap(c); - if (h < -1) h = -1; - if (h != old_h) { - undo_checkpoint(); - grid->col_gap(c, h); - grid->need_layout(true); - set_modflag(1); - } - } +static void cb_widget_tab_grid_child(Grid_Child_Tab* o, void*) { + o->callback((Fl_Callback*)propagate_load); } Fl_Tabs *widget_tabs_repo=(Fl_Tabs *)0; @@ -1053,13 +2281,13 @@ Fl_Double_Window* make_widget_panel() { widget_image_input->labelfont(1); widget_image_input->labelsize(11); widget_image_input->textsize(11); - widget_image_input->callback((Fl_Callback*)image_cb); + widget_image_input->callback((Fl_Callback*)cb_widget_image_input); Fl_Group::current()->resizable(widget_image_input); } // Fl_Input* widget_image_input { Fl_Button* o = new Fl_Button(295, 65, 89, 20, "Browse..."); o->tooltip("Click to choose the active image."); o->labelsize(11); - o->callback((Fl_Callback*)image_browse_cb); + o->callback((Fl_Callback*)cb_Browse); o->align(Fl_Align(256)); } // Fl_Button* o { Fl_Button* o = new Fl_Button(384, 65, 20, 20, "..."); @@ -1078,13 +2306,13 @@ Fl_Double_Window* make_widget_panel() { widget_deimage_input->labelfont(1); widget_deimage_input->labelsize(11); widget_deimage_input->textsize(11); - widget_deimage_input->callback((Fl_Callback*)inactive_cb); + widget_deimage_input->callback((Fl_Callback*)cb_widget_deimage_input); Fl_Group::current()->resizable(widget_deimage_input); } // Fl_Input* widget_deimage_input { Fl_Button* o = new Fl_Button(295, 90, 89, 20, "Browse..."); o->tooltip("Click to choose the inactive image."); o->labelsize(11); - o->callback((Fl_Callback*)inactive_browse_cb); + o->callback((Fl_Callback*)cb_Browse1); } // Fl_Button* o o->end(); } // Fl_Group* o @@ -1188,7 +2416,7 @@ Fl_Double_Window* make_widget_panel() { widget_x_input->labelsize(11); widget_x_input->labelcolor(FL_FOREGROUND_COLOR); widget_x_input->textsize(11); - widget_x_input->callback((Fl_Callback*)x_cb); + widget_x_input->callback((Fl_Callback*)cb_widget_x_input); widget_x_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); widget_x_input->when(FL_WHEN_RELEASE); } // fld::widget::Formula_Input* widget_x_input @@ -1203,7 +2431,7 @@ Fl_Double_Window* make_widget_panel() { widget_y_input->labelsize(11); widget_y_input->labelcolor(FL_FOREGROUND_COLOR); widget_y_input->textsize(11); - widget_y_input->callback((Fl_Callback*)y_cb); + widget_y_input->callback((Fl_Callback*)cb_widget_y_input); widget_y_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); widget_y_input->when(FL_WHEN_RELEASE); } // fld::widget::Formula_Input* widget_y_input @@ -1218,7 +2446,7 @@ Fl_Double_Window* make_widget_panel() { widget_w_input->labelsize(11); widget_w_input->labelcolor(FL_FOREGROUND_COLOR); widget_w_input->textsize(11); - widget_w_input->callback((Fl_Callback*)w_cb); + widget_w_input->callback((Fl_Callback*)cb_widget_w_input); widget_w_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); widget_w_input->when(FL_WHEN_RELEASE); } // fld::widget::Formula_Input* widget_w_input @@ -1233,7 +2461,7 @@ Fl_Double_Window* make_widget_panel() { widget_h_input->labelsize(11); widget_h_input->labelcolor(FL_FOREGROUND_COLOR); widget_h_input->textsize(11); - widget_h_input->callback((Fl_Callback*)h_cb); + widget_h_input->callback((Fl_Callback*)cb_widget_h_input); widget_h_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); widget_h_input->when(FL_WHEN_RELEASE); } // fld::widget::Formula_Input* widget_h_input @@ -1244,7 +2472,7 @@ Fl_Double_Window* make_widget_panel() { o->down_box(FL_BORDER_BOX); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)wc_relative_cb); + o->callback((Fl_Callback*)cb_Children); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); o->menu(menu_Children); } // Fl_Choice* o @@ -1258,21 +2486,21 @@ Fl_Double_Window* make_widget_panel() { wp_gui_flexp = new Fl_Group(95, 150, 314, 20, "Flex Parent:"); wp_gui_flexp->labelfont(1); wp_gui_flexp->labelsize(11); - wp_gui_flexp->callback((Fl_Callback*)flex_size_group_cb); + wp_gui_flexp->callback((Fl_Callback*)cb_wp_gui_flexp); wp_gui_flexp->align(Fl_Align(FL_ALIGN_LEFT)); wp_gui_flexp->hide(); { widget_flex_size = new Fl_Value_Input(95, 150, 55, 20, "Size:"); widget_flex_size->tooltip("Fixed Width or Height for a horizontal or vertical Fl_Flex Parent."); widget_flex_size->labelsize(11); widget_flex_size->textsize(11); - widget_flex_size->callback((Fl_Callback*)flex_size_cb); + widget_flex_size->callback((Fl_Callback*)cb_widget_flex_size); widget_flex_size->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* widget_flex_size { widget_flex_fixed = new Fl_Check_Button(155, 150, 55, 20, "fixed"); widget_flex_fixed->tooltip("If checked, the size of the widget stays fixed."); widget_flex_fixed->down_box(FL_DOWN_BOX); widget_flex_fixed->labelsize(11); - widget_flex_fixed->callback((Fl_Callback*)flex_fixed_cb); + widget_flex_fixed->callback((Fl_Callback*)cb_widget_flex_fixed); } // Fl_Check_Button* widget_flex_fixed { Fl_Box* o = new Fl_Box(398, 150, 1, 20); Fl_Group::current()->resizable(o); @@ -1282,20 +2510,20 @@ Fl_Double_Window* make_widget_panel() { { wp_gui_values = new Fl_Group(95, 185, 300, 20, "Values:"); wp_gui_values->labelfont(1); wp_gui_values->labelsize(11); - wp_gui_values->callback((Fl_Callback*)values_group_cb); + wp_gui_values->callback((Fl_Callback*)cb_wp_gui_values); wp_gui_values->align(Fl_Align(FL_ALIGN_LEFT)); { Fl_Value_Input* o = new Fl_Value_Input(95, 185, 55, 20, "Size:"); o->tooltip("The size of the slider."); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)slider_size_cb); + o->callback((Fl_Callback*)cb_Size); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(155, 185, 55, 20, "Minimum:"); o->tooltip("The minimum value of the widget."); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)min_cb); + o->callback((Fl_Callback*)cb_Minimum); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(215, 185, 55, 20, "Maximum:"); @@ -1303,21 +2531,21 @@ Fl_Double_Window* make_widget_panel() { o->labelsize(11); o->value(1); o->textsize(11); - o->callback((Fl_Callback*)max_cb); + o->callback((Fl_Callback*)cb_Maximum); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(275, 185, 55, 20, "Step:"); o->tooltip("The resolution of the widget value."); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)step_cb); + o->callback((Fl_Callback*)cb_Step); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(335, 185, 55, 20, "Value:"); o->tooltip("The current widget value."); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)value_cb); + o->callback((Fl_Callback*)cb_Value); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Box* o = new Fl_Box(395, 185, 0, 20); @@ -1329,42 +2557,42 @@ Fl_Double_Window* make_widget_panel() { wp_gui_margins = new Fl_Group(95, 185, 300, 20, "Margins:"); wp_gui_margins->labelfont(1); wp_gui_margins->labelsize(11); - wp_gui_margins->callback((Fl_Callback*)flex_margin_group_cb); + wp_gui_margins->callback((Fl_Callback*)cb_wp_gui_margins); wp_gui_margins->align(Fl_Align(FL_ALIGN_LEFT)); wp_gui_margins->hide(); { Fl_Value_Input* o = new Fl_Value_Input(95, 185, 55, 20, "Left:"); o->tooltip("Left margin in group."); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)flex_margin_left_cb); + o->callback((Fl_Callback*)cb_Left); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(155, 185, 55, 20, "Top:"); o->tooltip("Top margin in group."); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)flex_margin_top_cb); + o->callback((Fl_Callback*)cb_Top); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(215, 185, 55, 20, "Right:"); o->tooltip("Right margin in group."); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)flex_margin_right_cb); + o->callback((Fl_Callback*)cb_Right); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(275, 185, 55, 20, "Bottom:"); o->tooltip("Bottom margin in group."); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)flex_margin_bottom_cb); + o->callback((Fl_Callback*)cb_Bottom); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(335, 185, 55, 20, "Gap:"); o->tooltip("Gap between children."); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)flex_margin_gap_cb); + o->callback((Fl_Callback*)cb_Gap); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Box* o = new Fl_Box(395, 185, 0, 20); @@ -1375,7 +2603,7 @@ Fl_Double_Window* make_widget_panel() { { wp_gui_sizerange = new Fl_Group(95, 185, 300, 20, "Size Range:"); wp_gui_sizerange->labelfont(1); wp_gui_sizerange->labelsize(11); - wp_gui_sizerange->callback((Fl_Callback*)size_range_group_cb); + wp_gui_sizerange->callback((Fl_Callback*)cb_wp_gui_sizerange); wp_gui_sizerange->align(Fl_Align(FL_ALIGN_LEFT)); wp_gui_sizerange->hide(); { Fl_Value_Input* o = new Fl_Value_Input(95, 185, 55, 20, "Minimum Size:"); @@ -1384,7 +2612,7 @@ Fl_Double_Window* make_widget_panel() { o->maximum(2048); o->step(1); o->textsize(11); - o->callback((Fl_Callback*)min_w_cb); + o->callback((Fl_Callback*)cb_Minimum1); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(155, 185, 55, 20); @@ -1393,12 +2621,12 @@ Fl_Double_Window* make_widget_panel() { o->maximum(2048); o->step(1); o->textsize(11); - o->callback((Fl_Callback*)min_h_cb); + o->callback((Fl_Callback*)cb_1); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Button* o = new Fl_Button(215, 185, 25, 20, "set"); o->labelsize(11); - o->callback((Fl_Callback*)set_min_size_cb); + o->callback((Fl_Callback*)cb_set); } // Fl_Button* o { Fl_Value_Input* o = new Fl_Value_Input(245, 185, 55, 20, "Maximum Size:"); o->tooltip("The maximum value of the widget."); @@ -1406,7 +2634,7 @@ Fl_Double_Window* make_widget_panel() { o->maximum(2048); o->step(1); o->textsize(11); - o->callback((Fl_Callback*)max_w_cb); + o->callback((Fl_Callback*)cb_Maximum1); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(305, 185, 55, 20); @@ -1415,12 +2643,12 @@ Fl_Double_Window* make_widget_panel() { o->maximum(2048); o->step(1); o->textsize(11); - o->callback((Fl_Callback*)max_h_cb); + o->callback((Fl_Callback*)cb_2); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Button* o = new Fl_Button(365, 185, 25, 20, "set"); o->labelsize(11); - o->callback((Fl_Callback*)set_max_size_cb); + o->callback((Fl_Callback*)cb_set1); } // Fl_Button* o { Fl_Box* o = new Fl_Box(395, 185, 0, 20); Fl_Group::current()->resizable(o); @@ -1442,7 +2670,7 @@ Fl_Double_Window* make_widget_panel() { wp_gui_shortcut->labelfont(0); wp_gui_shortcut->labelsize(11); wp_gui_shortcut->labelcolor(FL_FOREGROUND_COLOR); - wp_gui_shortcut->callback((Fl_Callback*)shortcut_in_cb); + wp_gui_shortcut->callback((Fl_Callback*)cb_wp_gui_shortcut); wp_gui_shortcut->align(Fl_Align(FL_ALIGN_CENTER)); wp_gui_shortcut->when(FL_WHEN_CHANGED); } // Fl_Shortcut_Button* wp_gui_shortcut @@ -1458,26 +2686,26 @@ Fl_Double_Window* make_widget_panel() { o->labelfont(1); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)xclass_cb); + o->callback((Fl_Callback*)cb_3); Fl_Group::current()->resizable(o); } // Fl_Input* o { Fl_Light_Button* o = new Fl_Light_Button(195, 235, 60, 20, "Border"); o->tooltip("Add a border around the window."); o->selection_color((Fl_Color)1); o->labelsize(11); - o->callback((Fl_Callback*)border_cb); + o->callback((Fl_Callback*)cb_Border); } // Fl_Light_Button* o { Fl_Light_Button* o = new Fl_Light_Button(260, 235, 55, 20, "Modal"); o->tooltip("Make the window modal."); o->selection_color((Fl_Color)1); o->labelsize(11); - o->callback((Fl_Callback*)modal_cb); + o->callback((Fl_Callback*)cb_Modal); } // Fl_Light_Button* o { Fl_Light_Button* o = new Fl_Light_Button(320, 235, 75, 20, "Nonmodal"); o->tooltip("Make the window non-modal."); o->selection_color((Fl_Color)1); o->labelsize(11); - o->callback((Fl_Callback*)non_modal_cb); + o->callback((Fl_Callback*)cb_Nonmodal); o->align(Fl_Align(132|FL_ALIGN_INSIDE)); } // Fl_Light_Button* o wp_gui_xclass->end(); @@ -1491,26 +2719,26 @@ Fl_Double_Window* make_widget_panel() { o->tooltip("Show the widget."); o->selection_color((Fl_Color)1); o->labelsize(11); - o->callback((Fl_Callback*)visible_cb); + o->callback((Fl_Callback*)cb_Visible); } // Fl_Light_Button* o { Fl_Light_Button* o = new Fl_Light_Button(160, 260, 60, 20, "Active"); o->tooltip("Activate the widget."); o->selection_color((Fl_Color)1); o->labelsize(11); - o->callback((Fl_Callback*)active_cb); + o->callback((Fl_Callback*)cb_Active); } // Fl_Light_Button* o { Fl_Light_Button* o = new Fl_Light_Button(225, 260, 75, 20, "Resizable"); o->tooltip("Make the widget resizable."); o->selection_color((Fl_Color)1); o->labelsize(11); - o->callback((Fl_Callback*)resizable_cb); + o->callback((Fl_Callback*)cb_Resizable); o->when(FL_WHEN_CHANGED); } // Fl_Light_Button* o { Fl_Light_Button* o = new Fl_Light_Button(305, 260, 70, 20, "Hotspot"); o->tooltip("Center the window under this widget."); o->selection_color((Fl_Color)1); o->labelsize(11); - o->callback((Fl_Callback*)hotspot_cb); + o->callback((Fl_Callback*)cb_Hotspot); o->when(FL_WHEN_CHANGED); } // Fl_Light_Button* o { Fl_Box* o = new Fl_Box(395, 260, 0, 20); @@ -1524,7 +2752,7 @@ Fl_Double_Window* make_widget_panel() { wp_gui_tooltip->labelfont(1); wp_gui_tooltip->labelsize(11); wp_gui_tooltip->textsize(11); - wp_gui_tooltip->callback((Fl_Callback*)tooltip_cb); + wp_gui_tooltip->callback((Fl_Callback*)cb_wp_gui_tooltip); } // Fl_Input* wp_gui_tooltip { Fl_Box* o = new Fl_Box(95, 305, 300, 5); o->hide(); @@ -1550,7 +2778,7 @@ Fl_Double_Window* make_widget_panel() { o->labelfont(1); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)labelfont_cb); + o->callback((Fl_Callback*)cb_4); Fl_Group::current()->resizable(o); o->menu(fontmenu); } // Fl_Choice* o @@ -1561,15 +2789,15 @@ Fl_Double_Window* make_widget_panel() { o->step(1); o->value(14); o->textsize(11); - o->callback((Fl_Callback*)labelsize_cb); + o->callback((Fl_Callback*)cb_5); } // Fl_Value_Input* o { w_labelcolor = new Fl_Button(296, 40, 90, 20, "Label Color"); w_labelcolor->tooltip("The color of the label text."); w_labelcolor->labelsize(11); - w_labelcolor->callback((Fl_Callback*)labelcolor_cb); + w_labelcolor->callback((Fl_Callback*)cb_w_labelcolor); } // Fl_Button* w_labelcolor { Fl_Menu_Button* o = new Fl_Menu_Button(386, 40, 18, 20); - o->callback((Fl_Callback*)labelcolor_menu_cb); + o->callback((Fl_Callback*)cb_6); o->menu(colormenu); } // Fl_Menu_Button* o wp_style_label->end(); @@ -1586,17 +2814,17 @@ Fl_Double_Window* make_widget_panel() { o->labelfont(1); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)box_cb); + o->callback((Fl_Callback*)cb_7); Fl_Group::current()->resizable(o); o->menu(boxmenu); } // Fl_Choice* o { w_color = new Fl_Button(296, 65, 90, 20, "Color"); w_color->tooltip("The background color of the widget."); w_color->labelsize(11); - w_color->callback((Fl_Callback*)color_cb); + w_color->callback((Fl_Callback*)cb_w_color); } // Fl_Button* w_color { Fl_Menu_Button* o = new Fl_Menu_Button(386, 65, 18, 20); - o->callback((Fl_Callback*)color_menu_cb); + o->callback((Fl_Callback*)cb_8); o->menu(colormenu); } // Fl_Menu_Button* o wp_style_box->end(); @@ -1613,17 +2841,17 @@ Fl_Double_Window* make_widget_panel() { o->labelfont(1); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)down_box_cb); + o->callback((Fl_Callback*)cb_9); Fl_Group::current()->resizable(o); o->menu(boxmenu); } // Fl_Choice* o { w_selectcolor = new Fl_Button(296, 90, 90, 20, "Select Color"); w_selectcolor->tooltip("The selection color of the widget."); w_selectcolor->labelsize(11); - w_selectcolor->callback((Fl_Callback*)color2_cb); + w_selectcolor->callback((Fl_Callback*)cb_w_selectcolor); } // Fl_Button* w_selectcolor { Fl_Menu_Button* o = new Fl_Menu_Button(386, 90, 18, 20); - o->callback((Fl_Callback*)color2_menu_cb); + o->callback((Fl_Callback*)cb_a); o->menu(colormenu); } // Fl_Menu_Button* o wp_style_downbox->end(); @@ -1640,7 +2868,7 @@ Fl_Double_Window* make_widget_panel() { o->labelfont(1); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)textfont_cb); + o->callback((Fl_Callback*)cb_b); Fl_Group::current()->resizable(o); o->menu(fontmenu); } // Fl_Choice* o @@ -1651,15 +2879,15 @@ Fl_Double_Window* make_widget_panel() { o->step(1); o->value(14); o->textsize(11); - o->callback((Fl_Callback*)textsize_cb); + o->callback((Fl_Callback*)cb_c); } // Fl_Value_Input* o { w_textcolor = new Fl_Button(296, 115, 90, 20, "Text Color"); w_textcolor->tooltip("The value text color."); w_textcolor->labelsize(11); - w_textcolor->callback((Fl_Callback*)textcolor_cb); + w_textcolor->callback((Fl_Callback*)cb_w_textcolor); } // Fl_Button* w_textcolor { Fl_Menu_Button* o = new Fl_Menu_Button(386, 115, 18, 20); - o->callback((Fl_Callback*)textcolor_menu_cb); + o->callback((Fl_Callback*)cb_d); o->menu(colormenu); } // Fl_Menu_Button* o wp_style_text->end(); @@ -1676,7 +2904,7 @@ Fl_Double_Window* make_widget_panel() { o->maximum(128); o->step(1); o->textsize(11); - o->callback((Fl_Callback*)h_label_margin_cb); + o->callback((Fl_Callback*)cb_Horizontal); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Value_Input* o = new Fl_Value_Input(159, 150, 55, 20, "Vertical:"); @@ -1686,16 +2914,16 @@ Fl_Double_Window* make_widget_panel() { o->maximum(127); o->step(1); o->textsize(11); - o->callback((Fl_Callback*)v_label_margin_cb); + o->callback((Fl_Callback*)cb_Vertical); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o - { Fl_Value_Input* o = new Fl_Value_Input(219, 150, 55, 20, "Text to Image:"); + { Fl_Value_Input* o = new Fl_Value_Input(219, 150, 55, 20, "Image Gap:"); o->tooltip("Gap between label image and text in pixels"); o->labelsize(11); o->maximum(255); o->step(1); o->textsize(11); - o->callback((Fl_Callback*)image_spacing_cb); + o->callback((Fl_Callback*)cb_Image); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* o { Fl_Box* o = new Fl_Box(281, 150, 60, 20); @@ -1709,7 +2937,7 @@ Fl_Double_Window* make_widget_panel() { o->tooltip("use compact box types for closely set buttons"); o->selection_color((Fl_Color)1); o->labelsize(11); - o->callback((Fl_Callback*)compact_cb); + o->callback((Fl_Callback*)cb_Compact); } // Fl_Light_Button* o { Fl_Box* o = new Fl_Box(195, 205, 40, 40); o->labelsize(11); @@ -1733,7 +2961,7 @@ Fl_Double_Window* make_widget_panel() { o->labelsize(11); o->textfont(4); o->textsize(11); - o->callback((Fl_Callback*)subclass_cb, (void*)(4)); + o->callback((Fl_Callback*)cb_e, (void*)(4)); Fl_Group::current()->resizable(o); } // Fl_Input* o { Fl_Choice* o = new Fl_Choice(267, 40, 138, 20); @@ -1742,7 +2970,7 @@ Fl_Double_Window* make_widget_panel() { o->down_box(FL_BORDER_BOX); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)subtype_cb); + o->callback((Fl_Callback*)cb_f); } // Fl_Choice* o wp_cpp_class->end(); } // Fl_Group* wp_cpp_class @@ -1756,7 +2984,7 @@ Fl_Double_Window* make_widget_panel() { o->labelfont(1); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)name_cb); + o->callback((Fl_Callback*)cb_10); Fl_Group::current()->resizable(o); } // Fl_Input* o { Fl_Choice* o = new Fl_Choice(330, 65, 75, 20); @@ -1764,7 +2992,7 @@ Fl_Double_Window* make_widget_panel() { o->down_box(FL_BORDER_BOX); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)name_public_member_cb); + o->callback((Fl_Callback*)cb_11); o->when(FL_WHEN_CHANGED); o->menu(menu_2); } // Fl_Choice* o @@ -1786,31 +3014,31 @@ Fl_Double_Window* make_widget_panel() { v_input[0]->labelsize(11); v_input[0]->textfont(4); v_input[0]->textsize(11); - v_input[0]->callback((Fl_Callback*)v_input_cb, (void*)(0)); + v_input[0]->callback((Fl_Callback*)cb_v_input, (void*)(0)); } // Fl_Input* v_input[0] { v_input[1] = new Fl_Input(95, 110, 310, 20); v_input[1]->tooltip("Extra initialization code for the widget."); v_input[1]->labelsize(11); v_input[1]->textfont(4); v_input[1]->textsize(11); - v_input[1]->callback((Fl_Callback*)v_input_cb, (void*)(1)); + v_input[1]->callback((Fl_Callback*)cb_v_input1, (void*)(1)); } // Fl_Input* v_input[1] { v_input[2] = new Fl_Input(95, 130, 310, 20); v_input[2]->tooltip("Extra initialization code for the widget."); v_input[2]->labelsize(11); v_input[2]->textfont(4); v_input[2]->textsize(11); - v_input[2]->callback((Fl_Callback*)v_input_cb, (void*)(2)); + v_input[2]->callback((Fl_Callback*)cb_v_input2, (void*)(2)); } // Fl_Input* v_input[2] { v_input[3] = new Fl_Input(95, 150, 310, 20); v_input[3]->tooltip("Extra initialization code for the widget."); v_input[3]->labelsize(11); v_input[3]->textfont(4); v_input[3]->textsize(11); - v_input[3]->callback((Fl_Callback*)v_input_cb, (void*)(3)); + v_input[3]->callback((Fl_Callback*)cb_v_input3, (void*)(3)); } // Fl_Input* v_input[3] { Fl_Tile* o = new Fl_Tile(95, 175, 310, 130); - o->callback((Fl_Callback*)cb_1); + o->callback((Fl_Callback*)cb_12); { Fl_Group* o = new Fl_Group(95, 175, 310, 48); o->box(FL_FLAT_BOX); { wComment = new Fl_Text_Editor(95, 175, 310, 45, "Comment:"); @@ -1822,11 +3050,11 @@ Fl_Double_Window* make_widget_panel() { wComment->textfont(6); wComment->textsize(11); wComment->textcolor((Fl_Color)59); + wComment->callback((Fl_Callback*)cb_wComment); wComment->align(Fl_Align(FL_ALIGN_LEFT)); wComment->when(FL_WHEN_CHANGED); Fl_Group::current()->resizable(wComment); wComment->buffer(new Fl_Text_Buffer()); - wComment->callback((Fl_Callback*)comment_cb); } // Fl_Text_Editor* wComment o->end(); } // Fl_Group* o @@ -1844,7 +3072,7 @@ Fl_Double_Window* make_widget_panel() { wCallback->labelcolor(FL_FOREGROUND_COLOR); wCallback->textfont(4); wCallback->textsize(11); - wCallback->callback((Fl_Callback*)callback_cb); + wCallback->callback((Fl_Callback*)cb_wCallback); wCallback->align(Fl_Align(FL_ALIGN_LEFT)); wCallback->when(FL_WHEN_RELEASE); Fl_Group::current()->resizable(wCallback); @@ -1865,7 +3093,7 @@ Fl_Double_Window* make_widget_panel() { o->labelsize(11); o->textfont(4); o->textsize(11); - o->callback((Fl_Callback*)user_data_cb); + o->callback((Fl_Callback*)cb_13); Fl_Group::current()->resizable(o); } // Fl_Input* o { Fl_Menu_Button* o = new Fl_Menu_Button(260, 310, 145, 20, "When"); @@ -1875,7 +3103,7 @@ Fl_Double_Window* make_widget_panel() { o->labelfont(1); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)when_cb); + o->callback((Fl_Callback*)cb_When); o->when(FL_WHEN_CHANGED); o->menu(whenmenu); } // Fl_Menu_Button* o @@ -1892,7 +3120,7 @@ Fl_Double_Window* make_widget_panel() { o->labelsize(11); o->textfont(4); o->textsize(11); - o->callback((Fl_Callback*)user_data_type_cb); + o->callback((Fl_Callback*)cb_14); Fl_Group::current()->resizable(o); o->menu(menu_4); } // Fl_Input_Choice* o @@ -1906,550 +3134,34 @@ Fl_Double_Window* make_widget_panel() { } // Fl_Group* o wp_cpp_tab->end(); } // Fl_Group* wp_cpp_tab - { widget_tab_grid_child = new Fl_Group(10, 30, 400, 330, "Grid Child"); - widget_tab_grid_child->labelsize(11); - widget_tab_grid_child->callback((Fl_Callback*)propagate_load); - widget_tab_grid_child->hide(); - { Fl_Group* o = new Fl_Group(95, 60, 315, 20, "Location:"); - o->box(FL_FLAT_BOX); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)propagate_load); - o->align(Fl_Align(FL_ALIGN_LEFT)); - { widget_grid_row_input = new fld::widget::Formula_Input(95, 60, 40, 20, "Row:"); - widget_grid_row_input->box(FL_DOWN_BOX); - widget_grid_row_input->color(FL_BACKGROUND2_COLOR); - widget_grid_row_input->selection_color(FL_SELECTION_COLOR); - widget_grid_row_input->labeltype(FL_NORMAL_LABEL); - widget_grid_row_input->labelfont(0); - widget_grid_row_input->labelsize(11); - widget_grid_row_input->labelcolor(FL_FOREGROUND_COLOR); - widget_grid_row_input->textsize(11); - widget_grid_row_input->callback((Fl_Callback*)grid_set_row_cb); - widget_grid_row_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - widget_grid_row_input->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* widget_grid_row_input - { Fl_Group* o = new Fl_Group(135, 60, 30, 20); - { Fl_Button* o = new Fl_Button(135, 60, 15, 20, "-"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)grid_dec_row_cb); - o->clear_visible_focus(); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(150, 60, 15, 20, "+"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)grid_inc_row_cb); - o->clear_visible_focus(); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - { widget_grid_col_input = new fld::widget::Formula_Input(175, 60, 40, 20, "Column:"); - widget_grid_col_input->box(FL_DOWN_BOX); - widget_grid_col_input->color(FL_BACKGROUND2_COLOR); - widget_grid_col_input->selection_color(FL_SELECTION_COLOR); - widget_grid_col_input->labeltype(FL_NORMAL_LABEL); - widget_grid_col_input->labelfont(0); - widget_grid_col_input->labelsize(11); - widget_grid_col_input->labelcolor(FL_FOREGROUND_COLOR); - widget_grid_col_input->textsize(11); - widget_grid_col_input->callback((Fl_Callback*)grid_set_col_cb); - widget_grid_col_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - widget_grid_col_input->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* widget_grid_col_input - { Fl_Group* o = new Fl_Group(215, 60, 30, 20); - { Fl_Button* o = new Fl_Button(215, 60, 15, 20, "-"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)grid_dec_col_cb); - o->clear_visible_focus(); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(230, 60, 15, 20, "+"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)grid_inc_col_cb); - o->clear_visible_focus(); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - { Fl_Box* o = new Fl_Box(395, 60, 1, 20); - o->hide(); - Fl_Group::current()->resizable(o); - } // Fl_Box* o - { widget_grid_transient = new Fl_Box(250, 60, 80, 20, "TRANSIENT"); - widget_grid_transient->labelsize(11); - widget_grid_transient->labelcolor((Fl_Color)1); - widget_grid_transient->callback((Fl_Callback*)cb_widget_grid_transient); - } // Fl_Box* widget_grid_transient - { widget_grid_unlinked = new Fl_Box(250, 60, 80, 20, "UNLINKED"); - widget_grid_unlinked->labelsize(11); - widget_grid_unlinked->labelcolor((Fl_Color)1); - widget_grid_unlinked->hide(); - } // Fl_Box* widget_grid_unlinked - o->end(); - } // Fl_Group* o - { wp_gridc_align = new Fl_Group(95, 100, 315, 20, "Align:"); - wp_gridc_align->labelfont(1); - wp_gridc_align->labelsize(11); - wp_gridc_align->callback((Fl_Callback*)propagate_load); - wp_gridc_align->align(Fl_Align(FL_ALIGN_LEFT)); - { Fl_Choice* o = new Fl_Choice(95, 100, 115, 20, "Horizontal"); - o->down_box(FL_BORDER_BOX); - o->labelsize(11); - o->textsize(11); - o->callback((Fl_Callback*)grid_align_horizontal_cb); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->menu(menu_Horizontal); - } // Fl_Choice* o - { Fl_Choice* o = new Fl_Choice(215, 100, 115, 20, "Vertical"); - o->down_box(FL_BORDER_BOX); - o->labelsize(11); - o->textsize(11); - o->callback((Fl_Callback*)grid_align_vertical_cb); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->menu(menu_Vertical); - } // Fl_Choice* o - { Fl_Box* o = new Fl_Box(395, 100, 1, 20); - o->hide(); - Fl_Group::current()->resizable(o); - } // Fl_Box* o - wp_gridc_align->end(); - } // Fl_Group* wp_gridc_align - { wp_gridc_size = new Fl_Group(95, 135, 315, 20, "Min. Size:"); - wp_gridc_size->labelfont(1); - wp_gridc_size->labelsize(11); - wp_gridc_size->callback((Fl_Callback*)propagate_load); - wp_gridc_size->align(Fl_Align(FL_ALIGN_LEFT)); - { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(95, 135, 55, 20, "Width:"); - o->box(FL_DOWN_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->selection_color(FL_SELECTION_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(11); - o->labelcolor(FL_FOREGROUND_COLOR); - o->textsize(11); - o->callback((Fl_Callback*)grid_set_min_wdt_cb); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* o - { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(155, 135, 55, 20, "Height:"); - o->box(FL_DOWN_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->selection_color(FL_SELECTION_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(11); - o->labelcolor(FL_FOREGROUND_COLOR); - o->textsize(11); - o->callback((Fl_Callback*)grid_set_min_hgt_cb); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* o - { Fl_Box* o = new Fl_Box(395, 135, 1, 20); - o->hide(); - Fl_Group::current()->resizable(o); - } // Fl_Box* o - wp_gridc_size->end(); - } // Fl_Group* wp_gridc_size - { Fl_Group* o = new Fl_Group(95, 170, 315, 20, "Span:"); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)propagate_load); - o->align(Fl_Align(FL_ALIGN_LEFT)); - { widget_grid_rowspan_input = new fld::widget::Formula_Input(95, 170, 40, 20, "Row Span:"); - widget_grid_rowspan_input->box(FL_DOWN_BOX); - widget_grid_rowspan_input->color(FL_BACKGROUND2_COLOR); - widget_grid_rowspan_input->selection_color(FL_SELECTION_COLOR); - widget_grid_rowspan_input->labeltype(FL_NORMAL_LABEL); - widget_grid_rowspan_input->labelfont(0); - widget_grid_rowspan_input->labelsize(11); - widget_grid_rowspan_input->labelcolor(FL_FOREGROUND_COLOR); - widget_grid_rowspan_input->textsize(11); - widget_grid_rowspan_input->callback((Fl_Callback*)grid_set_rowspan_cb); - widget_grid_rowspan_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - widget_grid_rowspan_input->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* widget_grid_rowspan_input - { Fl_Group* o = new Fl_Group(135, 170, 30, 20); - { Fl_Button* o = new Fl_Button(135, 170, 15, 20, "-"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)grid_dec_rowspan_cb); - o->clear_visible_focus(); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(150, 170, 15, 20, "+"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)grid_inc_rowspan_cb); - o->clear_visible_focus(); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - { widget_grid_colspan_input = new fld::widget::Formula_Input(175, 170, 40, 20, "Col. Span:"); - widget_grid_colspan_input->box(FL_DOWN_BOX); - widget_grid_colspan_input->color(FL_BACKGROUND2_COLOR); - widget_grid_colspan_input->selection_color(FL_SELECTION_COLOR); - widget_grid_colspan_input->labeltype(FL_NORMAL_LABEL); - widget_grid_colspan_input->labelfont(0); - widget_grid_colspan_input->labelsize(11); - widget_grid_colspan_input->labelcolor(FL_FOREGROUND_COLOR); - widget_grid_colspan_input->textsize(11); - widget_grid_colspan_input->callback((Fl_Callback*)grid_set_colspan_cb); - widget_grid_colspan_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - widget_grid_colspan_input->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* widget_grid_colspan_input - { Fl_Group* o = new Fl_Group(215, 170, 30, 20); - { Fl_Button* o = new Fl_Button(215, 170, 15, 20, "-"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)grid_dec_colspan_cb); - o->clear_visible_focus(); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(230, 170, 15, 20, "+"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)grid_inc_colspan_cb); - o->clear_visible_focus(); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - { Fl_Box* o = new Fl_Box(395, 170, 1, 20); - o->hide(); - Fl_Group::current()->resizable(o); - } // Fl_Box* o - o->end(); - } // Fl_Group* o - { Fl_Box* o = new Fl_Box(95, 350, 300, 5); - o->labelsize(11); - o->hide(); - Fl_Group::current()->resizable(o); - } // Fl_Box* o - widget_tab_grid_child->end(); - } // Fl_Group* widget_tab_grid_child - { widget_tab_grid = new Fl_Group(10, 30, 400, 330, "Grid"); + { widget_tab_grid = new Grid_Tab(10, 30, 400, 330, "Grid"); + widget_tab_grid->box(FL_NO_BOX); + widget_tab_grid->color(FL_BACKGROUND_COLOR); + widget_tab_grid->selection_color(FL_BACKGROUND_COLOR); + widget_tab_grid->labeltype(FL_NORMAL_LABEL); + widget_tab_grid->labelfont(0); widget_tab_grid->labelsize(11); - widget_tab_grid->callback((Fl_Callback*)propagate_load); + widget_tab_grid->labelcolor(FL_FOREGROUND_COLOR); + widget_tab_grid->callback((Fl_Callback*)cb_widget_tab_grid); + widget_tab_grid->align(Fl_Align(FL_ALIGN_TOP)); + widget_tab_grid->when(FL_WHEN_RELEASE); widget_tab_grid->hide(); - { Fl_Group* o = new Fl_Group(95, 60, 315, 20, "Grid Layout:"); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)propagate_load); - o->align(Fl_Align(FL_ALIGN_LEFT)); - { widget_grid_rows = new fld::widget::Formula_Input(95, 60, 40, 20, "Rows:"); - widget_grid_rows->tooltip("Number of horizontal rows in the Grid group"); - widget_grid_rows->box(FL_DOWN_BOX); - widget_grid_rows->color(FL_BACKGROUND2_COLOR); - widget_grid_rows->selection_color(FL_SELECTION_COLOR); - widget_grid_rows->labeltype(FL_NORMAL_LABEL); - widget_grid_rows->labelfont(0); - widget_grid_rows->labelsize(11); - widget_grid_rows->labelcolor(FL_FOREGROUND_COLOR); - widget_grid_rows->textsize(11); - widget_grid_rows->callback((Fl_Callback*)cb_widget_grid_rows); - widget_grid_rows->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - widget_grid_rows->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* widget_grid_rows - { Fl_Group* o = new Fl_Group(135, 60, 30, 20); - { Fl_Button* o = new Fl_Button(135, 60, 15, 20, "-"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_2); - o->clear_visible_focus(); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(150, 60, 15, 20, "+"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_3); - o->clear_visible_focus(); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - { widget_grid_cols = new fld::widget::Formula_Input(175, 60, 40, 20, "Columns:"); - widget_grid_cols->tooltip("Number of vertical columns in the Grid group"); - widget_grid_cols->box(FL_DOWN_BOX); - widget_grid_cols->color(FL_BACKGROUND2_COLOR); - widget_grid_cols->selection_color(FL_SELECTION_COLOR); - widget_grid_cols->labeltype(FL_NORMAL_LABEL); - widget_grid_cols->labelfont(0); - widget_grid_cols->labelsize(11); - widget_grid_cols->labelcolor(FL_FOREGROUND_COLOR); - widget_grid_cols->textsize(11); - widget_grid_cols->callback((Fl_Callback*)cb_widget_grid_cols); - widget_grid_cols->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - widget_grid_cols->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* widget_grid_cols - { Fl_Group* o = new Fl_Group(215, 60, 30, 20); - { Fl_Button* o = new Fl_Button(215, 60, 15, 20, "-"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_4); - o->clear_visible_focus(); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(230, 60, 15, 20, "+"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_5); - o->clear_visible_focus(); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - { Fl_Box* o = new Fl_Box(396, 60, 0, 20); - Fl_Group::current()->resizable(o); - } // Fl_Box* o - o->end(); - } // Fl_Group* o - { wp_grid_margin = new Fl_Group(95, 100, 315, 20, "Margins:"); - wp_grid_margin->labelfont(1); - wp_grid_margin->labelsize(11); - wp_grid_margin->callback((Fl_Callback*)propagate_load); - wp_grid_margin->align(Fl_Align(FL_ALIGN_LEFT)); - { Fl_Value_Input* o = new Fl_Value_Input(95, 100, 55, 20, "Left:"); - o->tooltip("Left margin in group."); - o->labelsize(11); - o->maximum(1000); - o->step(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Left); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - } // Fl_Value_Input* o - { Fl_Value_Input* o = new Fl_Value_Input(155, 100, 55, 20, "Top:"); - o->tooltip("Top margin in group."); - o->labelsize(11); - o->maximum(1000); - o->step(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Top); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - } // Fl_Value_Input* o - { Fl_Value_Input* o = new Fl_Value_Input(215, 100, 55, 20, "Right:"); - o->tooltip("Right margin in group."); - o->labelsize(11); - o->maximum(1000); - o->step(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Right); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - } // Fl_Value_Input* o - { Fl_Value_Input* o = new Fl_Value_Input(275, 100, 55, 20, "Bottom:"); - o->tooltip("Bottom margin in group."); - o->labelsize(11); - o->maximum(1000); - o->step(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Bottom); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - } // Fl_Value_Input* o - { Fl_Box* o = new Fl_Box(396, 100, 0, 20); - Fl_Group::current()->resizable(o); - } // Fl_Box* o - wp_grid_margin->end(); - } // Fl_Group* wp_grid_margin - { wp_grid_gaps = new Fl_Group(95, 135, 315, 20, "Gaps:"); - wp_grid_gaps->labelfont(1); - wp_grid_gaps->labelsize(11); - wp_grid_gaps->callback((Fl_Callback*)propagate_load); - wp_grid_gaps->align(Fl_Align(FL_ALIGN_LEFT)); - { Fl_Value_Input* o = new Fl_Value_Input(95, 135, 55, 20, "Row:"); - o->tooltip("Gap between children."); - o->labelsize(11); - o->maximum(1000); - o->step(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Row); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - } // Fl_Value_Input* o - { Fl_Value_Input* o = new Fl_Value_Input(155, 135, 55, 20, "Col:"); - o->tooltip("Gap between children."); - o->labelsize(11); - o->maximum(1000); - o->step(1); - o->textsize(11); - o->callback((Fl_Callback*)cb_Col); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - } // Fl_Value_Input* o - { Fl_Box* o = new Fl_Box(396, 135, 0, 20); - Fl_Group::current()->resizable(o); - } // Fl_Box* o - wp_grid_gaps->end(); - } // Fl_Group* wp_grid_gaps - { Fl_Group* o = new Fl_Group(95, 175, 315, 20, "Row:"); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_Row1); - o->align(Fl_Align(FL_ALIGN_LEFT)); - { widget_grid_curr_row = new fld::widget::Formula_Input(95, 175, 40, 20, "Index"); - widget_grid_curr_row->box(FL_DOWN_BOX); - widget_grid_curr_row->color(FL_BACKGROUND2_COLOR); - widget_grid_curr_row->selection_color(FL_SELECTION_COLOR); - widget_grid_curr_row->labeltype(FL_NORMAL_LABEL); - widget_grid_curr_row->labelfont(0); - widget_grid_curr_row->labelsize(11); - widget_grid_curr_row->labelcolor(FL_FOREGROUND_COLOR); - widget_grid_curr_row->textsize(11); - widget_grid_curr_row->callback((Fl_Callback*)cb_widget_grid_curr_row); - widget_grid_curr_row->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - widget_grid_curr_row->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* widget_grid_curr_row - { Fl_Group* o = new Fl_Group(135, 175, 30, 20); - o->callback((Fl_Callback*)propagate_load); - { Fl_Button* o = new Fl_Button(135, 175, 15, 20, "-"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_6); - o->clear_visible_focus(); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(150, 175, 15, 20, "+"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_7); - o->clear_visible_focus(); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - { Fl_Box* o = new Fl_Box(165, 175, 15, 20, ":"); - o->labelsize(11); - } // Fl_Box* o - { widget_grid_curr_row_attributes = new Fl_Group(180, 175, 175, 20); - widget_grid_curr_row_attributes->callback((Fl_Callback*)propagate_load); - { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(180, 175, 55, 20, "Height:"); - o->box(FL_DOWN_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->selection_color(FL_SELECTION_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(11); - o->labelcolor(FL_FOREGROUND_COLOR); - o->textsize(11); - o->callback((Fl_Callback*)cb_Height); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* o - { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(240, 175, 55, 20, "Weight:"); - o->box(FL_DOWN_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->selection_color(FL_SELECTION_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(11); - o->labelcolor(FL_FOREGROUND_COLOR); - o->textsize(11); - o->callback((Fl_Callback*)cb_Weight); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* o - { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(300, 175, 55, 20, "Gap:"); - o->box(FL_DOWN_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->selection_color(FL_SELECTION_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(11); - o->labelcolor(FL_FOREGROUND_COLOR); - o->textsize(11); - o->callback((Fl_Callback*)cb_Gap); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* o - widget_grid_curr_row_attributes->end(); - } // Fl_Group* widget_grid_curr_row_attributes - { Fl_Box* o = new Fl_Box(400, 175, 1, 20); - o->hide(); - Fl_Group::current()->resizable(o); - } // Fl_Box* o - o->end(); - } // Fl_Group* o - { Fl_Group* o = new Fl_Group(95, 210, 315, 20, "Column:"); - o->labelfont(1); - o->labelsize(11); - o->callback((Fl_Callback*)propagate_load); - o->align(Fl_Align(FL_ALIGN_LEFT)); - { widget_grid_curr_col = new fld::widget::Formula_Input(95, 210, 40, 20, "Index"); - widget_grid_curr_col->box(FL_DOWN_BOX); - widget_grid_curr_col->color(FL_BACKGROUND2_COLOR); - widget_grid_curr_col->selection_color(FL_SELECTION_COLOR); - widget_grid_curr_col->labeltype(FL_NORMAL_LABEL); - widget_grid_curr_col->labelfont(0); - widget_grid_curr_col->labelsize(11); - widget_grid_curr_col->labelcolor(FL_FOREGROUND_COLOR); - widget_grid_curr_col->textsize(11); - widget_grid_curr_col->callback((Fl_Callback*)cb_widget_grid_curr_col); - widget_grid_curr_col->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - widget_grid_curr_col->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* widget_grid_curr_col - { Fl_Group* o = new Fl_Group(135, 210, 30, 20); - { Fl_Button* o = new Fl_Button(135, 210, 15, 20, "-"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_8); - o->clear_visible_focus(); - } // Fl_Button* o - { Fl_Button* o = new Fl_Button(150, 210, 15, 20, "+"); - o->compact(1); - o->labelsize(11); - o->callback((Fl_Callback*)cb_9); - o->clear_visible_focus(); - } // Fl_Button* o - o->end(); - } // Fl_Group* o - { Fl_Box* o = new Fl_Box(165, 210, 15, 20, ":"); - o->labelsize(11); - } // Fl_Box* o - { widget_grid_curr_col_attributes = new Fl_Group(180, 210, 175, 20); - widget_grid_curr_col_attributes->callback((Fl_Callback*)propagate_load); - { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(180, 210, 55, 20, "Width:"); - o->box(FL_DOWN_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->selection_color(FL_SELECTION_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(11); - o->labelcolor(FL_FOREGROUND_COLOR); - o->textsize(11); - o->callback((Fl_Callback*)cb_Width); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* o - { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(240, 210, 55, 20, "Weight:"); - o->box(FL_DOWN_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->selection_color(FL_SELECTION_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(11); - o->labelcolor(FL_FOREGROUND_COLOR); - o->textsize(11); - o->callback((Fl_Callback*)cb_Weight1); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* o - { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(300, 210, 55, 20, "Gap:"); - o->box(FL_DOWN_BOX); - o->color(FL_BACKGROUND2_COLOR); - o->selection_color(FL_SELECTION_COLOR); - o->labeltype(FL_NORMAL_LABEL); - o->labelfont(0); - o->labelsize(11); - o->labelcolor(FL_FOREGROUND_COLOR); - o->textsize(11); - o->callback((Fl_Callback*)cb_Gap1); - o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - o->when(FL_WHEN_RELEASE); - } // fld::widget::Formula_Input* o - widget_grid_curr_col_attributes->end(); - } // Fl_Group* widget_grid_curr_col_attributes - { Fl_Box* o = new Fl_Box(400, 210, 1, 20); - o->hide(); - Fl_Group::current()->resizable(o); - } // Fl_Box* o - o->end(); - } // Fl_Group* o - { Fl_Box* o = new Fl_Box(95, 350, 300, 5); - o->labelsize(11); - o->hide(); - Fl_Group::current()->resizable(o); - } // Fl_Box* o widget_tab_grid->end(); - } // Fl_Group* widget_tab_grid + } // Grid_Tab* widget_tab_grid + { widget_tab_grid_child = new Grid_Child_Tab(10, 30, 400, 330, "Grid Child"); + widget_tab_grid_child->box(FL_NO_BOX); + widget_tab_grid_child->color(FL_BACKGROUND_COLOR); + widget_tab_grid_child->selection_color(FL_BACKGROUND_COLOR); + widget_tab_grid_child->labeltype(FL_NORMAL_LABEL); + widget_tab_grid_child->labelfont(0); + widget_tab_grid_child->labelsize(11); + widget_tab_grid_child->labelcolor(FL_FOREGROUND_COLOR); + widget_tab_grid_child->callback((Fl_Callback*)cb_widget_tab_grid_child); + widget_tab_grid_child->align(Fl_Align(FL_ALIGN_TOP)); + widget_tab_grid_child->when(FL_WHEN_RELEASE); + widget_tab_grid_child->hide(); + widget_tab_grid_child->end(); + } // Grid_Child_Tab* widget_tab_grid_child o->show(); widget_tabs->end(); Fl_Group::current()->resizable(widget_tabs); diff --git a/fluid/panels/widget_panel.fl b/fluid/panels/widget_panel.fl index 517271e08..026616714 100644 --- a/fluid/panels/widget_panel.fl +++ b/fluid/panels/widget_panel.fl @@ -25,26 +25,76 @@ comment {// } {in_source in_header } -decl {\#include "app/undo.h"} {private global +decl {\#include "panels/widget_panel/Grid_Child_Tab.h"} {public global } -decl {\#include "nodes/Fl_Widget_Type.h"} {private global +decl {\#include "panels/widget_panel/Grid_Tab.h"} {public global } -decl {\#include "nodes/Fl_Grid_Type.h"} {private global +decl {\#include "widgets/Formula_Input.h"} {public global } -decl {\#include "widgets/Formula_Input.h"} {selected public global +decl {class Fl_Flex;} {public global +} + +decl {\#include "Fluid.h"} {private global +} + +decl {\#include "app/Snap_Action.h"} {private global +} + +decl {\#include "app/Image_Asset.h"} {private global +} + +decl {\#include "proj/undo.h"} {private global +} + +decl {\#include "nodes/Window_Node.h"} {private global +} + +decl {\#include "nodes/Grid_Node.h"} {private global +} + +decl {\#include } {private global } decl {\#include } {private global } -decl {extern void set_modflag(int mf, int mfc=-1);} {private local +decl {\#include } {private global +} + +decl {\#include } {private global +} + +decl {\#include } {private global +} + +decl {\#define ZERO_ENTRY 1000} {private global +} + +decl {extern const char* when_symbol_name(int n); +extern void set_whenmenu(int n); +extern void redraw_browser(); +const char *c_check(const char *c, int type=0); +extern Fl_Color fl_show_colormap(Fl_Color oldcol); +extern void labelcolor_common(Fl_Color c); +extern void color_common(Fl_Color c); +extern void color2_common(Fl_Color c); +extern void textcolor_common(Fl_Color c); +extern int widget_i; +extern fld::widget::Formula_Input_Vars widget_vars[];} {private global +} + +decl {extern int numselected; +extern Fl_Menu_Item boxmenu[];} {private global +} + +decl {extern int haderror;} {private global } Function {make_image_panel()} { - comment {Create a panel for editing widget image data} open + comment {Create a panel for editing widget image data} } { Fl_Window image_panel_window { label {Image Options} @@ -87,14 +137,14 @@ Function {make_image_panel()} { Fl_Input image_panel_imagew { label {Width:} callback {if (v == LOAD) { - if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { o->value(current_widget->scale_image_w_); } } else { int mod = 0; - for (Fl_Type *t = Fl_Type::first; t; t = t->next) { + for (Node *t = Fluid.proj.tree.first; t; t = t->next) { if (t->selected && t->is_widget()) { - Fl_Widget_Type* wt = ((Fl_Widget_Type*)t); + Widget_Node* wt = ((Widget_Node*)t); wt->scale_image_w_ = o->value(); Fl_Image *img = wt->o->image(); if (img) { @@ -109,7 +159,7 @@ Function {make_image_panel()} { mod = 1; } } - if (mod) set_modflag(1); + if (mod) Fluid.proj.set_modflag(1); }} tooltip {Scale image to this width in pixel units} xywh {75 75 55 20} labelsize 11 align 5 textsize 11 class {fld::widget::Formula_Input} @@ -117,14 +167,14 @@ Function {make_image_panel()} { Fl_Input image_panel_imageh { label {Height:} callback {if (v == LOAD) { - if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { o->value(current_widget->scale_image_h_); } } else { int mod = 0; - for (Fl_Type *t = Fl_Type::first; t; t = t->next) { + for (Node *t = Fluid.proj.tree.first; t; t = t->next) { if (t->selected && t->is_widget()) { - Fl_Widget_Type* wt = ((Fl_Widget_Type*)t); + Widget_Node* wt = ((Widget_Node*)t); wt->scale_image_h_ = o->value(); Fl_Image *img = wt->o->image(); if (img) { @@ -139,7 +189,7 @@ Function {make_image_panel()} { mod = 1; } } - if (mod) set_modflag(1); + if (mod) Fluid.proj.set_modflag(1); }} tooltip {Scale image to this height in pixel units} xywh {135 75 55 20} labelsize 11 align 5 textsize 11 class {fld::widget::Formula_Input} @@ -165,12 +215,40 @@ Function {make_image_panel()} { } Fl_Check_Button {} { label {convert to raw pixel data} - callback compress_image_cb + callback {if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { + o->activate(); + o->value(!current_widget->compress_image_); + } else { + o->deactivate(); + } +} else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->compress_image_ = !o->value(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {if unchecked, keep the image in its original format and store the data as is; if checked, convert the image and store it as uncompressed RGB or grayscale pixel data} xywh {75 100 170 20} down_box DOWN_BOX labelsize 11 } Fl_Check_Button {} { label {bind to widget} - callback bind_image_cb + callback {if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { + o->activate(); + o->value(current_widget->bind_image_); + } else { + o->deactivate(); + } +} else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->bind_image_ = o->value(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {bind the image to the widget, so it will be deleted automatically} xywh {75 120 170 20} down_box DOWN_BOX labelsize 11 hotspot } } @@ -209,14 +287,14 @@ Function {make_image_panel()} { Fl_Input image_panel_deimagew { label {Width:} callback {if (v == LOAD) { - if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { o->value(current_widget->scale_deimage_w_); } } else { int mod = 0; - for (Fl_Type *t = Fl_Type::first; t; t = t->next) { + for (Node *t = Fluid.proj.tree.first; t; t = t->next) { if (t->selected && t->is_widget()) { - Fl_Widget_Type* wt = ((Fl_Widget_Type*)t); + Widget_Node* wt = ((Widget_Node*)t); wt->scale_deimage_w_ = o->value(); Fl_Image *img = wt->o->deimage(); if (img) { @@ -231,7 +309,7 @@ Function {make_image_panel()} { mod = 1; } } - if (mod) set_modflag(1); + if (mod) Fluid.proj.set_modflag(1); }} tooltip {Scale image to this width in pixel units} xywh {75 215 55 20} labelsize 11 align 5 textsize 11 class {fld::widget::Formula_Input} @@ -239,14 +317,14 @@ Function {make_image_panel()} { Fl_Input image_panel_deimageh { label {Height:} callback {if (v == LOAD) { - if (current_widget->is_widget() && !current_widget->is_a(ID_Window)) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { o->value(current_widget->scale_deimage_h_); } } else { int mod = 0; - for (Fl_Type *t = Fl_Type::first; t; t = t->next) { + for (Node *t = Fluid.proj.tree.first; t; t = t->next) { if (t->selected && t->is_widget()) { - Fl_Widget_Type* wt = ((Fl_Widget_Type*)t); + Widget_Node* wt = ((Widget_Node*)t); wt->scale_deimage_h_ = o->value(); Fl_Image *img = wt->o->deimage(); if (img) { @@ -261,7 +339,7 @@ Function {make_image_panel()} { mod = 1; } } - if (mod) set_modflag(1); + if (mod) Fluid.proj.set_modflag(1); }} tooltip {Scale image to this height in pixel units} xywh {135 215 55 20} labelsize 11 align 5 textsize 11 class {fld::widget::Formula_Input} @@ -287,12 +365,40 @@ Function {make_image_panel()} { } Fl_Check_Button {} { label {convert to raw pixel data} - callback compress_deimage_cb + callback {if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { + o->activate(); + o->value(!current_widget->compress_deimage_); + } else { + o->deactivate(); + } +} else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->compress_deimage_ = !o->value(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {if unchecked, keep the image in its original format and store the data as is; if checked, convert the image and store it as uncompressed RGB or grayscale pixel data} xywh {75 240 170 20} down_box DOWN_BOX labelsize 11 } Fl_Check_Button {} { label {bind to widget} - callback bind_deimage_cb + callback {if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { + o->activate(); + o->value(current_widget->bind_deimage_); + } else { + o->deactivate(); + } +} else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->bind_deimage_ = o->value(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {bind the image to the widget, so it will be deleted automatically} xywh {75 260 170 20} down_box DOWN_BOX labelsize 11 } } @@ -305,7 +411,7 @@ Function {make_image_panel()} { } } -Function {run_image_panel()} {open return_type void +Function {run_image_panel()} {return_type void } { code {if (!image_panel_window) make_image_panel(); @@ -324,7 +430,30 @@ if (g) Fl_Shared_Image *img = (Fl_Shared_Image*)image_panel_data->user_data(); if (img) { img->release(); - image_panel_data->user_data(NULL); + image_panel_data->user_data(nullptr); +}} {} +} + +Function {flex_margin_cb(Fl_Value_Input* i, void* v, void (*load_margin)(Fl_Flex*,Fl_Value_Input*), int (*update_margin)(Fl_Flex*,int))} {return_type void +} { + code {if (v == LOAD) { + if (current_widget->is_a(Type::Flex)) { + load_margin((Fl_Flex*)current_widget->o, i); + } +} else { + int mod = 0; + int new_value = (int)i->value(); + for (Node *o = Fluid.proj.tree.first; o; o = o->next) { + if (o->selected && o->is_a(Type::Flex)) { + Flex_Node* q = (Flex_Node*)o; + Fl_Flex* w = (Fl_Flex*)q->o; + if (update_margin(w, new_value)) { + w->layout(); + mod = 1; + } + } + } + if (mod) Fluid.proj.set_modflag(1); }} {} } @@ -343,7 +472,7 @@ Function {make_widget_panel()} { } { Fl_Group wp_gui_tab { label GUI - callback propagate_load open + callback propagate_load open selected xywh {10 30 400 330} labelsize 11 when 0 resizable } { Fl_Group {} { @@ -369,12 +498,40 @@ Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 15 t xywh {95 65 309 20} labelfont 1 labelsize 11 align 4 } { Fl_Input widget_image_input { - callback image_cb + callback {if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { + o->activate(); + o->value(((Widget_Node*)current_widget)->image_name()); + } else o->deactivate(); +} else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->image_name(o->value()); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {The active image for the widget.} xywh {95 65 200 20} labelfont 1 labelsize 11 textsize 11 resizable } Fl_Button {} { label {Browse...} - callback image_browse_cb + callback {if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) + o->activate(); + else + o->deactivate(); +} else { + int mod = 0; + Image_Asset *image_asset = ui_find_image(widget_image_input->value()); + if (image_asset) { + widget_image_input->value(image_asset->filename()); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->image_name(image_asset->filename()); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } +}} tooltip {Click to choose the active image.} xywh {295 65 89 20} labelsize 11 align 256 } Fl_Button {} { @@ -391,12 +548,40 @@ Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 15 t xywh {95 90 309 20} labelfont 1 labelsize 11 align 4 } { Fl_Input widget_deimage_input { - callback inactive_cb + callback {if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) { + o->activate(); + o->value(((Widget_Node*)current_widget)->inactive_name()); + } else o->deactivate(); +} else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->inactive_name(o->value()); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {The inactive image for the widget.} xywh {95 90 200 20} labelfont 1 labelsize 11 textsize 11 resizable } Fl_Button {} { label {Browse...} - callback inactive_browse_cb + callback {if (v == LOAD) { + if (current_widget->is_widget() && !current_widget->is_a(Type::Window)) + o->activate(); + else + o->deactivate(); +} else { + int mod = 0; + Image_Asset *image_asset = ui_find_image(widget_deimage_input->value()); + if (image_asset) { + widget_deimage_input->value(image_asset->filename()); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->inactive_name(image_asset->filename()); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + } +}} tooltip {Click to choose the inactive image.} xywh {295 90 89 20} labelsize 11 } } @@ -568,12 +753,38 @@ Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 15 t } Fl_Group {} { label {Position:} - callback position_group_cb open + callback position_group_cb xywh {95 150 314 20} labelfont 1 labelsize 11 align 4 } { Fl_Input widget_x_input { label {X:} - callback x_cb + callback {if (v == LOAD) { + if (current_widget->is_true_widget()) { + o->value(((Widget_Node *)current_widget)->o->x()); + o->activate(); + } else o->deactivate(); +} else { + Fluid.proj.undo.checkpoint(); + widget_i = 0; + int mod = 0; + int v = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_true_widget()) { + Fl_Widget *w = q->o; + o->variables(widget_vars, q); + v = o->value(); + w->resize(v, w->y(), w->w(), w->h()); + if (w->window()) w->window()->redraw(); + widget_i++; + mod = 1; + } + } + if (mod) { + Fluid.proj.set_modflag(1); + o->value(v); // change the displayed value to the result of the last + // calculation. Keep the formula if it was not used. + } +}} tooltip {The X position of the widget as a number or formula. Formulas can be simple math, including the variables x, px, sx, cx, and i} xywh {95 150 55 20} labelsize 11 align 5 textsize 11 @@ -581,7 +792,32 @@ x, px, sx, cx, and i} xywh {95 150 55 20} labelsize 11 align 5 textsize 11 } Fl_Input widget_y_input { label {Y:} - callback y_cb + callback {if (v == LOAD) { + if (current_widget->is_true_widget()) { + o->value(((Widget_Node *)current_widget)->o->y()); + o->activate(); + } else o->deactivate(); +} else { + Fluid.proj.undo.checkpoint(); + widget_i = 0; + int mod = 0; + int v = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_true_widget()) { + Fl_Widget *w = q->o; + o->variables(widget_vars, q); + v = o->value(); + w->resize(w->x(), v, w->w(), w->h()); + if (w->window()) w->window()->redraw(); + widget_i++; + mod = 1; + } + } + if (mod) { + Fluid.proj.set_modflag(1); + o->value(v); + } +}} tooltip {The Y position of the widget as a number or formula. Formulas can be simple math, including the variables y, py, sy, cy, and i} xywh {155 150 55 20} labelsize 11 align 5 textsize 11 @@ -589,7 +825,32 @@ y, py, sy, cy, and i} xywh {155 150 55 20} labelsize 11 align 5 textsize 11 } Fl_Input widget_w_input { label {Width:} - callback w_cb + callback {if (v == LOAD) { + if (current_widget->is_true_widget()) { + o->value(((Widget_Node *)current_widget)->o->w()); + o->activate(); + } else o->deactivate(); +} else { + Fluid.proj.undo.checkpoint(); + widget_i = 0; + int mod = 0; + int v = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_true_widget()) { + Fl_Widget *w = q->o; + o->variables(widget_vars, q); + v = o->value(); + w->resize(w->x(), w->y(), v, w->h()); + if (w->window()) w->window()->redraw(); + widget_i++; + mod = 1; + } + } + if (mod) { + Fluid.proj.set_modflag(1); + o->value(v); + } +}} tooltip {The width of the widget as a number or formula. Formulas can be simple math, including the variables w, pw, sw, cw, and i} xywh {215 150 55 20} labelsize 11 align 5 textsize 11 @@ -597,7 +858,32 @@ w, pw, sw, cw, and i} xywh {215 150 55 20} labelsize 11 align 5 textsize 11 } Fl_Input widget_h_input { label {Height:} - callback h_cb + callback {if (v == LOAD) { + if (current_widget->is_true_widget()) { + o->value(((Widget_Node *)current_widget)->o->h()); + o->activate(); + } else o->deactivate(); +} else { + Fluid.proj.undo.checkpoint(); + widget_i = 0; + int mod = 0; + int v = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_true_widget()) { + Fl_Widget *w = q->o; + o->variables(widget_vars, q); + v = o->value(); + w->resize(w->x(), w->y(), w->w(), v); + if (w->window()) w->window()->redraw(); + widget_i++; + mod = 1; + } + } + if (mod) { + Fluid.proj.set_modflag(1); + o->value(v); + } +}} tooltip {The height of the widget as a number or formula. Formulas can be simple math, including the variables h, ph, sh, ch, and i} xywh {275 150 55 20} labelsize 11 align 5 textsize 11 @@ -605,7 +891,25 @@ h, ph, sh, ch, and i} xywh {275 150 55 20} labelsize 11 align 5 textsize 11 } Fl_Choice {} { label {Children:} - callback wc_relative_cb open + callback {if (v == LOAD) { + if (current_widget->is_a(Type::Widget_Class)) { + o->show(); + o->value(((Widget_Class_Node *)current_widget)->wc_relative); + } else { + o->hide(); + } +} else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Widget_Class)) { + Widget_Class_Node *t = (Widget_Class_Node *)q; + t->wc_relative = o->value(); + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {When instantiating a widget class, the children can either be fixed in their original position, automatically be repositioned, or both repsositioned and resized to fit the container.} xywh {335 150 64 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11 } { MenuItem {} { @@ -627,18 +931,84 @@ h, ph, sh, ch, and i} xywh {275 150 55 20} labelsize 11 align 5 textsize 11 } Fl_Group wp_gui_flexp { label {Flex Parent:} - callback flex_size_group_cb + callback {if (v == LOAD) { + if (Flex_Node::parent_is_flex(current_widget)) { + o->show(); + propagate_load(o, v); + } else { + o->hide(); + } +}} comment {This group is only visible if the parent is an Fl_Flex widget} xywh {95 150 314 20} labelfont 1 labelsize 11 align 4 hide } { Fl_Value_Input widget_flex_size { label {Size:} - callback flex_size_cb + callback {if (v == LOAD) { + if (Flex_Node::parent_is_flex(current_widget)) { + o->value(Flex_Node::size(current_widget)); + } +} else { + int mod = 0; + int new_size = (int)o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (Flex_Node::parent_is_flex(q)) { + Fl_Widget* w = (Fl_Widget*)q->o; + Fl_Flex* f = (Fl_Flex*)((Flex_Node*)q->parent)->o; + int was_fixed = f->fixed(w); + if (new_size==0) { + if (was_fixed) { + f->fixed(w, 0); + f->layout(); + widget_flex_fixed->value(0); + mod = 1; + } + } else { + int old_size = Flex_Node::size(q); + if (old_size!=new_size || !was_fixed) { + f->fixed(w, new_size); + f->layout(); + widget_flex_fixed->value(1); + mod = 1; + } + } + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {Fixed Width or Height for a horizontal or vertical Fl_Flex Parent.} xywh {95 150 55 20} labelsize 11 align 5 textsize 11 } Fl_Check_Button widget_flex_fixed { label fixed - callback flex_fixed_cb + callback {if (v == LOAD) { + if (Flex_Node::parent_is_flex(current_widget)) { + o->value(Flex_Node::is_fixed(current_widget)); + } +} else { + int mod = 0; + int new_fixed = (int)o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (Flex_Node::parent_is_flex(q)) { + Fl_Widget* w = q->o; + Fl_Flex* f = (Fl_Flex*)((Flex_Node*)q->parent)->o; + int was_fixed = f->fixed(w); + if (new_fixed==0) { + if (was_fixed) { + f->fixed(w, 0); + f->layout(); + mod = 1; + } + } else { + if (!was_fixed) { + f->fixed(w, Flex_Node::size(q)); + f->layout(); + mod = 1; + } + } + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {If checked, the size of the widget stays fixed.} xywh {155 150 55 20} down_box DOWN_BOX labelsize 11 } Fl_Box {} { @@ -647,32 +1017,169 @@ h, ph, sh, ch, and i} xywh {275 150 55 20} labelsize 11 align 5 textsize 11 } Fl_Group wp_gui_values { label {Values:} - callback values_group_cb open + callback {if (v == LOAD) { + if ( current_widget->is_a(Type::Flex) + || current_widget->is_a(Type::Grid) + || current_widget->is_a(Type::Window)) + { + o->hide(); + } else { + o->show(); + propagate_load(o, v); + } +}} open xywh {95 185 300 20} labelfont 1 labelsize 11 align 4 } { Fl_Value_Input {} { label {Size:} - callback slider_size_cb + callback {if (v == LOAD) { + if (!current_widget->is_a(Type::Slider)) {o->deactivate(); return;} + o->activate(); + o->value(((Fl_Slider*)(current_widget->o))->slider_size()); +} else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + double n = o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Slider)) { + ((Fl_Slider*)(q->o))->slider_size(n); + q->o->redraw(); + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {The size of the slider.} xywh {95 185 55 20} labelsize 11 align 5 textsize 11 } Fl_Value_Input {} { label {Minimum:} - callback min_cb + callback {if (v == LOAD) { + if (current_widget->is_a(Type::Valuator_)) { + o->activate(); + o->value(((Fl_Valuator*)(current_widget->o))->minimum()); + } else if (current_widget->is_a(Type::Spinner)) { + o->activate(); + o->value(((Fl_Spinner*)(current_widget->o))->minimum()); + } else { + o->deactivate(); + return; + } +} else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + double n = o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Valuator_)) { + ((Fl_Valuator*)(q->o))->minimum(n); + q->o->redraw(); + mod = 1; + } else if (q->is_a(Type::Spinner)) { + ((Fl_Spinner*)(q->o))->minimum(n); + q->o->redraw(); + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {The minimum value of the widget.} xywh {155 185 55 20} labelsize 11 align 5 textsize 11 } Fl_Value_Input {} { label {Maximum:} - callback max_cb + callback {if (v == LOAD) { + if (current_widget->is_a(Type::Valuator_)) { + o->activate(); + o->value(((Fl_Valuator*)(current_widget->o))->maximum()); + } else if (current_widget->is_a(Type::Spinner)) { + o->activate(); + o->value(((Fl_Spinner*)(current_widget->o))->maximum()); + } else { + o->deactivate(); + return; + } +} else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + double n = o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Valuator_)) { + ((Fl_Valuator*)(q->o))->maximum(n); + q->o->redraw(); + mod = 1; + } else if (q->is_a(Type::Spinner)) { + ((Fl_Spinner*)(q->o))->maximum(n); + q->o->redraw(); + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {The maximum value of the widget.} xywh {215 185 55 20} labelsize 11 align 5 value 1 textsize 11 } Fl_Value_Input {} { label {Step:} - callback step_cb + callback {if (v == LOAD) { + if (current_widget->is_a(Type::Valuator_)) { + o->activate(); + o->value(((Fl_Valuator*)(current_widget->o))->step()); + } else if (current_widget->is_a(Type::Spinner)) { + o->activate(); + o->value(((Fl_Spinner*)(current_widget->o))->step()); + } else { + o->deactivate(); + return; + } +} else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + double n = o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Valuator_)) { + ((Fl_Valuator*)(q->o))->step(n); + q->o->redraw(); + mod = 1; + } else if (q->is_a(Type::Spinner)) { + ((Fl_Spinner*)(q->o))->step(n); + q->o->redraw(); + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {The resolution of the widget value.} xywh {275 185 55 20} labelsize 11 align 5 textsize 11 } Fl_Value_Input {} { label {Value:} - callback value_cb + callback {if (v == LOAD) { + if (current_widget->is_a(Type::Valuator_)) { + o->activate(); + o->value(((Fl_Valuator*)(current_widget->o))->value()); + } else if (current_widget->is_button()) { + o->activate(); + o->value(((Fl_Button*)(current_widget->o))->value()); + } else if (current_widget->is_a(Type::Spinner)) { + o->activate(); + o->value(((Fl_Spinner*)(current_widget->o))->value()); + } else + o->deactivate(); +} else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + double n = o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Valuator_)) { + ((Fl_Valuator*)(q->o))->value(n); + mod = 1; + } else if (q->is_button()) { + ((Fl_Button*)(q->o))->value(n != 0); + if (q->is_a(Type::Menu_Item)) q->redraw(); + mod = 1; + } else if (q->is_a(Type::Spinner)) { + ((Fl_Spinner*)(q->o))->value(n); + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {The current widget value.} xywh {335 185 55 20} labelsize 11 align 5 textsize 11 } Fl_Box {} { @@ -681,33 +1188,128 @@ h, ph, sh, ch, and i} xywh {275 150 55 20} labelsize 11 align 5 textsize 11 } Fl_Group wp_gui_margins { label {Margins:} - callback flex_margin_group_cb + callback {if (v == LOAD) { + if (current_widget->is_a(Type::Flex)) { + o->show(); + propagate_load(o, v); + } else { + o->hide(); + } +}} comment {This group is only visible for Fl_Flex widgets} xywh {95 185 300 20} labelfont 1 labelsize 11 align 4 hide } { Fl_Value_Input {} { label {Left:} - callback flex_margin_left_cb + callback {flex_margin_cb(o, v, + [](Fl_Flex *w, Fl_Value_Input* i) -> void + { + int v; + w->margin(&v, nullptr, nullptr, nullptr); + i->value((double)v); + }, + [](Fl_Flex *w, int new_value) -> int + { + int l, t, r, b; + w->margin(&l, &t, &r, &b); + if (new_value!=l) { + w->margin(new_value, t, r, b); + return 1; + } else { + return 0; + } + } +);} tooltip {Left margin in group.} xywh {95 185 55 20} labelsize 11 align 5 textsize 11 } Fl_Value_Input {} { label {Top:} - callback flex_margin_top_cb + callback {flex_margin_cb(o, v, + [](Fl_Flex *w, Fl_Value_Input* i) -> void + { + int v; + w->margin(nullptr, &v, nullptr, nullptr); + i->value((double)v); + }, + [](Fl_Flex *w, int new_value) + { + int l, t, r, b; + w->margin(&l, &t, &r, &b); + if (new_value!=t) { + w->margin(l, new_value, r, b); + return 1; + } else { + return 0; + } + } +);} tooltip {Top margin in group.} xywh {155 185 55 20} labelsize 11 align 5 textsize 11 } Fl_Value_Input {} { label {Right:} - callback flex_margin_right_cb + callback {flex_margin_cb(o, v, + [](Fl_Flex *w, Fl_Value_Input* i) -> void + { + int v; + w->margin(nullptr, nullptr, &v, nullptr); + i->value((double)v); + }, + [](Fl_Flex *w, int new_value) -> int + { + int l, t, r, b; + w->margin(&l, &t, &r, &b); + if (new_value!=r) { + w->margin(l, t, new_value, b); + return 1; + } else { + return 0; + } + } +);} tooltip {Right margin in group.} xywh {215 185 55 20} labelsize 11 align 5 textsize 11 } Fl_Value_Input {} { label {Bottom:} - callback flex_margin_bottom_cb + callback {flex_margin_cb(o, v, + [](Fl_Flex *w, Fl_Value_Input* i) -> void + { + int v; + w->margin(nullptr, nullptr, nullptr, &v); + i->value((double)v); + }, + [](Fl_Flex *w, int new_value) -> int + { + int l, t, r, b; + w->margin(&l, &t, &r, &b); + if (new_value!=b) { + w->margin(l, t, r, new_value); + return 1; + } else { + return 0; + } + } +);} tooltip {Bottom margin in group.} xywh {275 185 55 20} labelsize 11 align 5 textsize 11 } Fl_Value_Input {} { label {Gap:} - callback flex_margin_gap_cb + callback {flex_margin_cb(o, v, + [](Fl_Flex *w, Fl_Value_Input* o) -> void + { + int v = w->gap(); + o->value((double)v); + }, + [](Fl_Flex *w, int new_value) -> int + { + int g = w->gap(); + if (new_value!=g) { + w->gap(new_value); + return 1; + } else { + return 0; + } + } +);} tooltip {Gap between children.} xywh {335 185 55 20} labelsize 11 align 5 textsize 11 } Fl_Box {} { @@ -716,35 +1318,126 @@ h, ph, sh, ch, and i} xywh {275 150 55 20} labelsize 11 align 5 textsize 11 } Fl_Group wp_gui_sizerange { label {Size Range:} - callback size_range_group_cb open + callback {if (v == LOAD) { + if (current_widget->is_a(Type::Window)) { + o->show(); + propagate_load(o, v); + } else { + o->hide(); + } +}} xywh {95 185 300 20} labelfont 1 labelsize 11 align 4 hide } { Fl_Value_Input {} { label {Minimum Size:} - callback min_w_cb + callback {if (v == LOAD) { + if (!current_widget->is_a(Type::Window)) return; + o->value(((Window_Node*)current_widget)->sr_min_w); +} else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + int n = (int)o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Window)) { + ((Window_Node*)q)->sr_min_w = n; + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {The size of the slider.} xywh {95 185 55 20} labelsize 11 align 5 maximum 2048 step 1 textsize 11 } Fl_Value_Input {} { - callback min_h_cb + callback {if (v == LOAD) { + if (!current_widget->is_a(Type::Window)) return; + o->value(((Window_Node*)current_widget)->sr_min_h); +} else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + int n = (int)o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Window)) { + ((Window_Node*)q)->sr_min_h = n; + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {The minimum value of the widget.} xywh {155 185 55 20} labelsize 11 align 5 maximum 2048 step 1 textsize 11 } Fl_Button {} { label set - callback set_min_size_cb + callback {if (v == LOAD) { +} else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Window)) { + Window_Node *win = (Window_Node*)q; + win->sr_min_w = win->o->w(); + win->sr_min_h = win->o->h(); + mod = 1; + } + } + propagate_load(the_panel, LOAD); + if (mod) Fluid.proj.set_modflag(1); +}} xywh {215 185 25 20} labelsize 11 } Fl_Value_Input {} { label {Maximum Size:} - callback max_w_cb + callback {if (v == LOAD) { + if (!current_widget->is_a(Type::Window)) return; + o->value(((Window_Node*)current_widget)->sr_max_w); +} else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + int n = (int)o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Window)) { + ((Window_Node*)q)->sr_max_w = n; + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {The maximum value of the widget.} xywh {245 185 55 20} labelsize 11 align 5 maximum 2048 step 1 textsize 11 } Fl_Value_Input {} { - callback max_h_cb + callback {if (v == LOAD) { + if (!current_widget->is_a(Type::Window)) return; + o->value(((Window_Node*)current_widget)->sr_max_h); +} else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + int n = (int)o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Window)) { + ((Window_Node*)q)->sr_max_h = n; + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {The resolution of the widget value.} xywh {305 185 55 20} labelsize 11 align 5 maximum 2048 step 1 textsize 11 } Fl_Button {} { label set - callback set_max_size_cb + callback {if (v == LOAD) { +} else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Window)) { + Window_Node *win = (Window_Node*)q; + win->sr_max_w = win->o->w(); + win->sr_max_h = win->o->h(); + mod = 1; + } + } + propagate_load(the_panel, LOAD); + if (mod) Fluid.proj.set_modflag(1); +}} xywh {365 185 25 20} labelsize 11 } Fl_Box {} { @@ -753,11 +1446,51 @@ h, ph, sh, ch, and i} xywh {275 150 55 20} labelsize 11 align 5 textsize 11 } Fl_Group {} { label {Shortcut:} - callback propagate_load open + callback propagate_load xywh {95 210 310 20} labelfont 1 labelsize 11 align 4 } { Fl_Button wp_gui_shortcut { - callback shortcut_in_cb + callback {if (v == LOAD) { + if (current_widget->is_button()) + o->value( ((Fl_Button*)(current_widget->o))->shortcut() ); + else if (current_widget->is_a(Type::Input)) + o->value( ((Fl_Input_*)(current_widget->o))->shortcut() ); + else if (current_widget->is_a(Type::Value_Input)) + o->value( ((Fl_Value_Input*)(current_widget->o))->shortcut() ); + else if (current_widget->is_a(Type::Text_Display)) + o->value( ((Fl_Text_Display*)(current_widget->o))->shortcut() ); + else { + o->hide(); + o->parent()->hide(); + return; + } + //i->default_value( i->value() ); // enable the "undo" capability of the shortcut button + o->show(); + o->parent()->show(); + o->redraw(); +} else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) + if (q->is_button()) { + Fl_Button* b = (Fl_Button*)(q->o); + if (b->shortcut() != (int)o->value()) mod = 1; + b->shortcut(o->value()); + if (q->is_a(Type::Menu_Item)) q->redraw(); + } else if (q->is_a(Type::Input)) { + Fl_Input_* b = (Fl_Input_*)(q->o); + if (b->shortcut() != (int)o->value()) mod = 1; + b->shortcut(o->value()); + } else if (q->is_a(Type::Value_Input)) { + Fl_Value_Input* b = (Fl_Value_Input*)(q->o); + if (b->shortcut() != (int)o->value()) mod = 1; + b->shortcut(o->value()); + } else if (q->is_a(Type::Text_Display)) { + Fl_Text_Display* b = (Fl_Text_Display*)(q->o); + if (b->shortcut() != (int)o->value()) mod = 1; + b->shortcut(o->value()); + } + if (mod) Fluid.proj.set_modflag(1); +}} comment {This is a special button that grabs keystrokes directly} tooltip {The shortcut key for the widget. Use 'Backspace' key to clear.} xywh {95 210 310 20} box DOWN_BOX color 7 selection_color 12 labelsize 11 when 1 @@ -772,22 +1505,67 @@ Use 'Backspace' key to clear.} xywh {95 210 310 20} box DOWN_BOX color 7 selecti } { Fl_Input {} { label {:} - callback xclass_cb + callback {if (v == LOAD) { + if (current_widget->is_a(Type::Window)) { + o->show(); + o->parent()->show(); + o->value(((Window_Node *)current_widget)->xclass); + } else { + o->hide(); + o->parent()->hide(); // hides the "X Class:" label as well + } +} else { + int mod = 0; + Fluid.proj.undo.checkpoint(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Window)) { + mod = 1; + Window_Node *wt = (Window_Node *)q; + storestring(o->value(), wt->xclass); + ((Fl_Window*)(wt->o))->xclass(wt->xclass); + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {The X resource class.} xywh {95 235 95 20} labelfont 1 labelsize 11 textsize 11 resizable } Fl_Light_Button {} { label Border - callback border_cb + callback {if (v == LOAD) { + if (!current_widget->is_a(Type::Window)) {o->hide(); return;} + o->show(); + o->value(((Fl_Window*)(current_widget->o))->border()); +} else { + Fluid.proj.undo.checkpoint(); + ((Fl_Window*)(current_widget->o))->border(o->value()); + Fluid.proj.set_modflag(1); +}} tooltip {Add a border around the window.} xywh {195 235 60 20} selection_color 1 labelsize 11 } Fl_Light_Button {} { label Modal - callback modal_cb + callback {if (v == LOAD) { + if (!current_widget->is_a(Type::Window)) {o->hide(); return;} + o->show(); + o->value(((Window_Node *)current_widget)->modal); +} else { + Fluid.proj.undo.checkpoint(); + ((Window_Node *)current_widget)->modal = o->value(); + Fluid.proj.set_modflag(1); +}} tooltip {Make the window modal.} xywh {260 235 55 20} selection_color 1 labelsize 11 } Fl_Light_Button {} { label Nonmodal - callback non_modal_cb + callback {if (v == LOAD) { + if (!current_widget->is_a(Type::Window)) {o->hide(); return;} + o->show(); + o->value(((Window_Node *)current_widget)->non_modal); +} else { + Fluid.proj.undo.checkpoint(); + ((Window_Node *)current_widget)->non_modal = o->value(); + Fluid.proj.set_modflag(1); +}} tooltip {Make the window non-modal.} xywh {320 235 75 20} selection_color 1 labelsize 11 align 148 } } @@ -798,22 +1576,96 @@ Use 'Backspace' key to clear.} xywh {95 210 310 20} box DOWN_BOX color 7 selecti } { Fl_Light_Button {} { label Visible - callback visible_cb + callback {if (v == LOAD) { + o->value(current_widget->o->visible()); + if (current_widget->is_a(Type::Window)) o->deactivate(); + else o->activate(); +} else { + int mod = 0; + int n = o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (!mod) { + mod = 1; + Fluid.proj.undo.checkpoint(); + } + n ? q->o->show() : q->o->hide(); + q->redraw(); + if (n && q->parent && q->parent->type_name()) { + if (q->parent->is_a(Type::Tabs)) { + ((Fl_Tabs *)q->o->parent())->value(q->o); + } else if (q->parent->is_a(Type::Wizard)) { + ((Fl_Wizard *)q->o->parent())->value(q->o); + } + } + } + if (mod) { + Fluid.proj.set_modflag(1); + redraw_browser(); + } +}} tooltip {Show the widget.} xywh {95 260 60 20} selection_color 1 labelsize 11 } Fl_Light_Button {} { label Active - callback active_cb + callback {if (v == LOAD) { + o->value(current_widget->o->active()); + if (current_widget->is_a(Type::Window)) o->deactivate(); + else o->activate(); +} else { + int mod = 0; + int n = o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (!mod) { + mod = 1; + Fluid.proj.undo.checkpoint(); + } + n ? q->o->activate() : q->o->deactivate(); + q->redraw(); + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {Activate the widget.} xywh {160 260 60 20} selection_color 1 labelsize 11 } Fl_Light_Button {} { label Resizable - callback resizable_cb - tooltip {Make the widget resizable.} xywh {225 260 75 20} selection_color 1 labelsize 11 when 1 + callback {if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) {o->deactivate(); return;} + if (numselected > 1) {o->deactivate(); return;} + o->activate(); + o->value(current_widget->resizable()); +} else { + Fluid.proj.undo.checkpoint(); + current_widget->resizable(o->value()); + Fluid.proj.set_modflag(1); +}} + tooltip {Make the widget resizable.} xywh {225 260 75 20} selection_color 1 labelsize 11 when 1 } Fl_Light_Button {} { label Hotspot - callback hotspot_cb + callback {if (v == LOAD) { + if (numselected > 1) {o->deactivate(); return;} + if (current_widget->is_a(Type::Menu_Item)) o->label("divider"); + else o->label("hotspot"); + o->activate(); + o->value(current_widget->hotspot()); +} else { + Fluid.proj.undo.checkpoint(); + current_widget->hotspot(o->value()); + if (current_widget->is_a(Type::Menu_Item)) { + current_widget->redraw(); + return; + } + if (o->value()) { + Node *p = current_widget->parent; + if (!p || !p->is_widget()) return; + while (!p->is_a(Type::Window)) p = p->parent; + for (Node *q = p->next; q && q->level > p->level; q = q->next) { + if (q->is_widget() && q != current_widget) + ((Widget_Node*)q)->hotspot(0); + } + } + Fluid.proj.set_modflag(1); +}} tooltip {Center the window under this widget.} xywh {305 260 70 20} selection_color 1 labelsize 11 when 1 } Fl_Box {} { @@ -822,7 +1674,21 @@ Use 'Backspace' key to clear.} xywh {95 210 310 20} box DOWN_BOX color 7 selecti } Fl_Input wp_gui_tooltip { label {Tooltip:} - callback tooltip_cb + callback {if (v == LOAD) { + if (current_widget->is_widget()) { + o->activate(); + o->value(((Widget_Node*)current_widget)->tooltip()); + } else { + o->deactivate(); + } +} else { + int mod = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->tooltip(o->value()); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {The tooltip text for the widget. Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize 11 } @@ -841,22 +1707,69 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize xywh {99 40 305 20} labelfont 1 labelsize 11 align 4 } { Fl_Choice {} { - callback labelfont_cb open + callback {if (v == LOAD) { + int n = current_widget->o->labelfont(); + if (n > 15) n = 0; + o->value(n); +} else { + int mod = 0; + int n = o->value(); + if (n <= 0) n = Fluid.proj.layout->labelfont; + if (n <= 0) n = FL_HELVETICA; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->o->labelfont(n); + q->redraw(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +}} open tooltip {The style of the label text.} xywh {99 40 148 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable code0 {extern Fl_Menu_Item fontmenu[];} code1 {o->menu(fontmenu);} } {} Fl_Value_Input {} { - callback labelsize_cb + callback {int n; +if (v == LOAD) { + n = current_widget->o->labelsize(); +} else { + int mod = 0; + n = int(o->value()); + if (n <= 0) n = Fluid.proj.layout->labelsize; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->o->labelsize(n); + q->redraw(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +} +o->value(n);} tooltip {The size of the label text.} xywh {247 40 49 20} labelsize 11 maximum 100 step 1 value 14 textsize 11 } Fl_Button w_labelcolor { label {Label Color} - callback labelcolor_cb + callback {Fl_Color c = current_widget->o->labelcolor(); +if (v != LOAD) { + Fl_Color d = fl_show_colormap(c); + if (d == c) return; + c = d; + labelcolor_common(c); +} +o->color(c); +o->labelcolor(fl_contrast(FL_BLACK,c)); +o->redraw();} tooltip {The color of the label text.} xywh {296 40 90 20} labelsize 11 } Fl_Menu_Button {} { - callback labelcolor_menu_cb open + callback {Fl_Color c = current_widget->o->labelcolor(); +if (v != LOAD) { + Fl_Color d = (Fl_Color)(o->mvalue()->argument()); + if (d == c) return; + c = d; + labelcolor_common(c); + w_labelcolor->color(c); + w_labelcolor->labelcolor(fl_contrast(FL_BLACK,c)); + w_labelcolor->redraw(); +}} open xywh {386 40 18 20} code0 {extern Fl_Menu_Item colormenu[];} code1 {o->menu(colormenu);} @@ -868,18 +1781,62 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize xywh {99 65 305 20} labelfont 1 labelsize 11 align 4 } { Fl_Choice {} { - callback box_cb open + callback {if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) {o->deactivate(); return;} else o->activate(); + int n = current_widget->o->box(); + if (!n) n = ZERO_ENTRY; + for (int j = 0; j < 72 /*int(sizeof(boxmenu)/sizeof(*boxmenu))*/; j++) + if (boxmenu[j].argument() == n) {o->value(j); break;} +} else { + int mod = 0; + int m = o->value(); + int n = int(boxmenu[m].argument()); + if (!n) return; // should not happen + if (n == ZERO_ENTRY) n = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->o->box((Fl_Boxtype)n); + q->redraw(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +}} open tooltip {The "up" box of the widget.} xywh {100 65 196 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable code0 {extern Fl_Menu_Item boxmenu[];} code1 {o->menu(boxmenu);} } {} Fl_Button w_color { label Color - callback color_cb + callback {Fl_Color c = current_widget->o->color(); +if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) { + o->deactivate(); + } else { + o->activate(); + } +} else { + Fl_Color d = fl_show_colormap(c); + if (d == c) return; + c = d; + color_common(c); +} +o->color(c); +o->labelcolor(fl_contrast(FL_BLACK,c)); +o->redraw();} tooltip {The background color of the widget.} xywh {296 65 90 20} labelsize 11 } Fl_Menu_Button {} { - callback color_menu_cb open + callback {Fl_Color c = current_widget->o->color(); +if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) {o->deactivate(); return;} else o->activate(); +} else { + Fl_Color d = (Fl_Color)(o->mvalue()->argument()); + if (d == c) return; + c = d; + color_common(c); + w_color->color(c); + w_color->labelcolor(fl_contrast(FL_BLACK,c)); + w_color->redraw(); +}} open xywh {386 65 18 20} code0 {extern Fl_Menu_Item colormenu[];} code1 {o->menu(colormenu);} @@ -891,18 +1848,83 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize xywh {99 90 305 20} labelfont 1 labelsize 11 align 4 } { Fl_Choice {} { - callback down_box_cb open + callback {if (v == LOAD) { + int n; + if (current_widget->is_a(Type::Button)) + n = ((Fl_Button*)(current_widget->o))->down_box(); + else if (current_widget->is_a(Type::Input_Choice)) + n = ((Fl_Input_Choice*)(current_widget->o))->down_box(); + else if (current_widget->is_a(Type::Menu_Manager_)) + n = ((Fl_Menu_*)(current_widget->o))->down_box(); + else { + o->deactivate(); return; + } + o->activate(); + if (!n) n = ZERO_ENTRY; + for (int j = 0; j < 72 /*int(sizeof(boxmenu)/sizeof(*boxmenu))*/; j++) + if (boxmenu[j].argument() == n) {o->value(j); break;} +} else { + int mod = 0; + int m = o->value(); + int n = int(boxmenu[m].argument()); + if (!n) return; // should not happen + if (n == ZERO_ENTRY) n = 0; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Button)) { + ((Fl_Button*)(q->o))->down_box((Fl_Boxtype)n); + if (((Fl_Button*)(q->o))->value()) q->redraw(); + } else if (q->is_a(Type::Input_Choice)) { + ((Fl_Input_Choice*)(q->o))->down_box((Fl_Boxtype)n); + } else if (q->is_a(Type::Menu_Manager_)) { + ((Fl_Menu_*)(q->o))->down_box((Fl_Boxtype)n); + } + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +}} open tooltip {The "down" box of the widget.} xywh {99 90 197 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable code0 {extern Fl_Menu_Item boxmenu[];} code1 {o->menu(boxmenu);} } {} Fl_Button w_selectcolor { label {Select Color} - callback color2_cb + callback {Fl_Color c = current_widget->o->selection_color(); +if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) { + o->deactivate(); + return; + } else { + o->activate(); + } +} else { + Fl_Color d = fl_show_colormap(c); + if (d == c) return; + c = d; + color2_common(c); +} +o->color(c); +o->labelcolor(fl_contrast(FL_BLACK,c)); +o->redraw();} tooltip {The selection color of the widget.} xywh {296 90 90 20} labelsize 11 } Fl_Menu_Button {} { - callback color2_menu_cb open + callback {Fl_Color c = current_widget->o->selection_color(); +if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) { + o->deactivate(); + return; + } else { + o->activate(); + } +} else { + Fl_Color d = (Fl_Color)(o->mvalue()->argument()); + if (d == c) return; + c = d; + color2_common(c); + w_selectcolor->color(c); + w_selectcolor->labelcolor(fl_contrast(FL_BLACK,c)); + w_selectcolor->redraw(); +}} open xywh {386 90 18 20} code0 {extern Fl_Menu_Item colormenu[];} code1 {o->menu(colormenu);} @@ -914,22 +1936,86 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize xywh {99 115 305 20} labelfont 1 labelsize 11 align 4 } { Fl_Choice {} { - callback textfont_cb open + callback {Fl_Font n; int s; Fl_Color c; +if (v == LOAD) { + if (!current_widget->textstuff(0,n,s,c)) {o->deactivate(); return;} + o->activate(); + if (n > 15) n = FL_HELVETICA; + o->value(n); +} else { + int mod = 0; + n = (Fl_Font)o->value(); + if (n <= 0) n = Fluid.proj.layout->textfont; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->textstuff(1,n,s,c); + q->o->redraw(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +}} open tooltip {The value text style.} xywh {99 115 148 20} box DOWN_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable code0 {extern Fl_Menu_Item fontmenu[];} code1 {o->menu(fontmenu);} } {} Fl_Value_Input {} { - callback textsize_cb + callback {Fl_Font n; int s; Fl_Color c; +if (v == LOAD) { + if (!current_widget->textstuff(0,n,s,c)) {o->deactivate(); return;} + o->activate(); +} else { + int mod = 0; + s = int(o->value()); + if (s <= 0) s = Fluid.proj.layout->textsize; + if (s <= 0) s = Fluid.proj.layout->labelsize; + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->textstuff(2,n,s,c); + q->o->redraw(); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +} +o->value(s);} tooltip {The value text size.} xywh {247 115 49 20} labelsize 11 maximum 100 step 1 value 14 textsize 11 } Fl_Button w_textcolor { label {Text Color} - callback textcolor_cb + callback {Fl_Font n; int s; Fl_Color c; +if (v == LOAD) { + if (!current_widget->textstuff(0,n,s,c)) { + o->deactivate(); + return; + } + o->activate(); +} else { + c = o->color(); + Fl_Color d = fl_show_colormap(c); + if (d == c) return; + c = d; + textcolor_common(c); +} +o->color(c); +o->labelcolor(fl_contrast(FL_BLACK,c)); +o->redraw();} tooltip {The value text color.} xywh {296 115 90 20} labelsize 11 } Fl_Menu_Button {} { - callback textcolor_menu_cb open + callback {Fl_Font n; int s; Fl_Color c; +if (v == LOAD) { + if (!current_widget->textstuff(0,n,s,c)) { + o->deactivate(); + return; + } + o->activate(); +} else { + c = o->color(); + Fl_Color d = (Fl_Color)(o->mvalue()->argument()); + if (d == c) return; + c = d; + textcolor_common(c); + w_textcolor->color(c); + w_textcolor->labelcolor(fl_contrast(FL_BLACK,c)); + w_textcolor->redraw(); +}} open xywh {386 115 18 20} code0 {extern Fl_Menu_Item colormenu[];} code1 {o->menu(colormenu);} @@ -942,17 +2028,89 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize } { Fl_Value_Input {} { label {Horizontal:} - callback h_label_margin_cb + callback {int s; +if (v == LOAD) { + if (!current_widget->is_true_widget()) { + o->deactivate(); + o->value(0); + } else { + o->activate(); + o->value(((Widget_Node*)current_widget)->o->horizontal_label_margin()); + } +} else { + int mod = 0; + s = int(o->value()); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_true_widget()) { + if (q->o->horizontal_label_margin() != s) { + q->o->horizontal_label_margin(s); + if (!(q->o->align() & FL_ALIGN_INSIDE) && q->o->window()) + q->o->window()->damage(FL_DAMAGE_EXPOSE); // outside labels + q->o->redraw(); + mod = 1; + } + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {Spacing between label and the horizontally aligned side of the widget.} xywh {99 150 55 20} labelsize 11 align 5 minimum -127 maximum 128 step 1 textsize 11 } Fl_Value_Input {} { label {Vertical:} - callback v_label_margin_cb + callback {int s; +if (v == LOAD) { + if (!current_widget->is_true_widget()) { + o->deactivate(); + o->value(0); + } else { + o->activate(); + o->value(((Widget_Node*)current_widget)->o->vertical_label_margin()); + } +} else { + int mod = 0; + s = int(o->value()); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_true_widget()) { + if (q->o->vertical_label_margin() != s) { + q->o->vertical_label_margin(s); + if (!(q->o->align() & FL_ALIGN_INSIDE) && q->o->window()) + q->o->window()->damage(FL_DAMAGE_EXPOSE); // outside labels + q->o->redraw(); + mod = 1; + } + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {Spacing between label and the vertically aligned side of the widget.} xywh {159 150 55 20} labelsize 11 align 5 minimum -127 maximum 127 step 1 textsize 11 } Fl_Value_Input {} { - label {Text to Image:} - callback image_spacing_cb + label {Image Gap:} + callback {int s; +if (v == LOAD) { + if (!current_widget->is_true_widget()) { + o->deactivate(); + o->value(0); + } else { + o->activate(); + o->value(((Widget_Node*)current_widget)->o->label_image_spacing()); + } +} else { + int mod = 0; + s = int(o->value()); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_true_widget()) { + if (q->o->label_image_spacing() != s) { + q->o->label_image_spacing(s); + if (!(q->o->align() & FL_ALIGN_INSIDE) && q->o->window()) + q->o->window()->damage(FL_DAMAGE_EXPOSE); // outside labels + q->o->redraw(); + mod = 1; + } + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {Gap between label image and text in pixels} xywh {219 150 55 20} labelsize 11 align 5 maximum 255 step 1 textsize 11 } Fl_Box {} { @@ -961,7 +2119,33 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize } Fl_Light_Button {} { label Compact - callback compact_cb + callback {if (v == LOAD) { + uchar n; + if (current_widget->is_a(Type::Button) && !current_widget->is_a(Type::Menu_Item)) { + n = ((Fl_Button*)(current_widget->o))->compact(); + o->value(n); + o->show(); + } else { + o->hide(); + } +} else { + int mod = 0; + uchar n = (uchar)o->value(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->is_a(Type::Button) && !q->is_a(Type::Menu_Item)) { + uchar v = ((Fl_Button*)(q->o))->compact(); + if (n != v) { + if (!mod) { + mod = 1; + Fluid.proj.undo.checkpoint(); + } + ((Fl_Button*)(q->o))->compact(n); + q->redraw(); + } + } + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {use compact box types for closely set buttons} xywh {99 175 90 20} selection_color 1 labelsize 11 } Fl_Box {} { @@ -970,7 +2154,7 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize } Fl_Group wp_cpp_tab { label {C++} - callback propagate_load open + callback propagate_load xywh {10 30 400 330} labelsize 11 when 0 hide } { Fl_Group wp_cpp_class { @@ -980,25 +2164,120 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize } { Fl_Input {} { user_data 4 - callback subclass_cb + callback {if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) { + o->deactivate(); + } else { + o->activate(); + o->value(current_widget->subclass()); + } + } else { + int mod = 0; + const char *c = o->value(); + for (Widget_Node *t: Fluid.proj.tree.all_selected_widgets()) { + t->subclass(c); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + }} tooltip {The widget subclass.} xywh {95 40 172 20} labelfont 1 labelsize 11 textfont 4 textsize 11 resizable } Fl_Choice {} { - callback subtype_cb open + callback {static Fl_Menu_Item empty_type_menu[] = { + {"Normal",0,nullptr,(void*)nullptr}, + {nullptr}}; + + if (v == LOAD) { + Fl_Menu_Item* m = current_widget->subtypes(); + if (!m) { + o->menu(empty_type_menu); + o->value(0); + o->deactivate(); + } else { + o->menu(m); + int j; + for (j = 0;; j++) { + if (!m[j].text) {j = 0; break;} + if (current_widget->is_a(Type::Spinner)) { + if (m[j].argument() == ((Fl_Spinner*)current_widget->o)->type()) break; + } else { + if (m[j].argument() == current_widget->o->type()) break; + } + } + o->value(j); + o->activate(); + } + o->redraw(); + } else { + int mod = 0; + int n = int(o->mvalue()->argument()); + Fl_Menu_Item* m = current_widget->subtypes(); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + if (q->subtypes()==m) { + if (q->is_a(Type::Spinner)) + ((Fl_Spinner*)q->o)->type(n); + else if (q->is_a(Type::Flex)) + ((Flex_Node*)q)->change_subtype_to(n); + else + q->o->type(n); + q->redraw(); + mod = 1; + } + } + if (mod) Fluid.proj.set_modflag(1); + }} open tooltip {The widget subtype.} xywh {267 40 138 20} box THIN_UP_BOX down_box BORDER_BOX labelsize 11 textsize 11 } {} } Fl_Group wp_cpp_name { label {Name:} - callback propagate_load + callback propagate_load open xywh {95 65 310 20} labelfont 1 labelsize 11 align 4 } { Fl_Input {} { - callback name_cb + callback {if (v == LOAD) { + static char buf[1024]; + if (numselected != 1) { + snprintf(buf, sizeof(buf), "Widget Properties (%d widgets)", numselected); + o->hide(); + } else { + o->value(current_widget->name()); + o->show(); + snprintf(buf, sizeof(buf), "%s Properties", current_widget->title()); + } + + the_panel->label(buf); + } else { + if (numselected == 1) { + current_widget->name(o->value()); + // I don't update window title, as it probably is being closed + // and wm2 (a window manager) barfs if you retitle and then + // hide a window: + // ((Fl_Window*)(o->parent()->parent()->parent()))->label(current_widget->title()); + } + }} tooltip {The name of the widget.} xywh {95 65 235 20} labelfont 1 labelsize 11 textsize 11 resizable } Fl_Choice {} { - callback name_public_member_cb open + callback {if (v == LOAD) { + o->value(current_widget->public_); + if (current_widget->is_in_class()) o->show(); else o->hide(); +} else { + int mod = 0; + for (Widget_Node *w: Fluid.proj.tree.all_selected_widgets()) { + if (w->is_in_class()) { + w->public_ = o->value(); + } else { + // if this is not in a class, it can be only private or public + w->public_ = (o->value()>0); + } + mod = 1; + } + if (mod) { + Fluid.proj.set_modflag(1); + redraw_browser(); + } +}} open tooltip {Change member access attribute.} xywh {330 65 75 20} down_box BORDER_BOX labelsize 11 when 1 textsize 11 } { MenuItem {} { @@ -1036,22 +2315,35 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize Fl_Input {v_input[0]} { label {Extra Code:} user_data 0 - callback v_input_cb + callback {int n = fl_int(o->user_data()); + if (v == LOAD) { + o->value(current_widget->extra_code(n)); + } else { + int mod = 0; + const char *c = o->value(); + const char *d = c_check(c&&c[0]=='\#' ? c+1 : c); + if (d) {fl_message("Error in %s: %s",o->label(),d); haderror = 1; return;} + for (Widget_Node *w: Fluid.proj.tree.all_selected_widgets()) { + w->extra_code(n,c); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + }} tooltip {Extra initialization code for the widget.} xywh {95 90 310 20} labelfont 1 labelsize 11 textfont 4 textsize 11 } Fl_Input {v_input[1]} { user_data 1 - callback v_input_cb + callback {cb_v_input(o, v);} tooltip {Extra initialization code for the widget.} xywh {95 110 310 20} labelsize 11 textfont 4 textsize 11 } Fl_Input {v_input[2]} { user_data 2 - callback v_input_cb + callback {cb_v_input(o, v);} tooltip {Extra initialization code for the widget.} xywh {95 130 310 20} labelsize 11 textfont 4 textsize 11 } Fl_Input {v_input[3]} { user_data 3 - callback v_input_cb + callback {cb_v_input(o, v);} tooltip {Extra initialization code for the widget.} xywh {95 150 310 20} labelsize 11 textfont 4 textsize 11 } Fl_Tile {} { @@ -1064,9 +2356,21 @@ wCallback->do_callback(wCallback, v);} open } { Fl_Text_Editor wComment { label {Comment:} + callback {if (v == LOAD) { + const char *cmttext = current_widget->comment(); + o->buffer()->text( cmttext ? cmttext : "" ); + } else { + int mod = 0; + char *c = o->buffer()->text(); + for (Node *n: Fluid.proj.tree.all_selected_nodes()) { + n->comment(c); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + free(c); + }} tooltip {Write a comment that will appear in the source code and in the widget tree overview.} xywh {95 175 310 45} box DOWN_BOX labelfont 1 labelsize 11 align 4 when 1 textfont 6 textsize 11 textcolor 59 resizable code0 {wComment->buffer(new Fl_Text_Buffer());} - code1 {wComment->callback((Fl_Callback*)comment_cb);} } } Fl_Group {} {open @@ -1074,7 +2378,25 @@ wCallback->do_callback(wCallback, v);} open } { Fl_Text_Editor wCallback { label {Callback:} - callback callback_cb + callback {if (v == LOAD) { + const char *cbtext = current_widget->callback(); + o->buffer()->text( cbtext ? cbtext : "" ); + } else { + int mod = 0; + char *c = o->buffer()->text(); + const char *d = c_check(c); + if (d) { + fl_message("Error in callback: %s",d); + if (o->window()) o->window()->make_current(); + haderror = 1; + } + for (Node *n: Fluid.proj.tree.all_selected_nodes()) { + n->callback(c); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); + free(c); + }} tooltip {The callback function or code for the widget. Use the variable name 'o' to access the Widget pointer and 'v' to access the user value.} xywh {95 225 310 80} box DOWN_BOX labelfont 1 labelsize 11 align 4 textfont 4 textsize 11 resizable code0 {\#include "widgets/Code_Editor.h"} class {fld::widget::Code_Editor} @@ -1087,12 +2409,48 @@ wCallback->do_callback(wCallback, v);} open xywh {95 310 310 20} labelfont 1 labelsize 11 align 4 } { Fl_Input {} { - callback user_data_cb + callback {if (v == LOAD) { + o->value(current_widget->user_data()); +} else { + int mod = 0; + const char *c = o->value(); + const char *d = c_check(c); + if (d) {fl_message("Error in user_data: %s",d); haderror = 1; return;} + for (Node *n: Fluid.proj.tree.all_selected_nodes()) { + n->user_data(c); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +}} tooltip {The user data to pass into the callback code.} xywh {95 310 158 20} labelfont 1 labelsize 11 textfont 4 textsize 11 resizable } Fl_Menu_Button {} { label When - callback when_cb open + callback {if (v == LOAD) { + if (current_widget->is_a(Type::Menu_Item)) {o->deactivate(); return;} else o->activate(); + int n = current_widget->o->when(); + set_whenmenu(n); + w_when_box->copy_label(when_symbol_name(n)); +} else { + int mod = 0; + int n = 0; + if (o->mvalue() && ((o->mvalue()->flags & FL_MENU_TOGGLE) == 0) ) { + n = (int)o->mvalue()->argument(); + set_whenmenu(n); + } else { + if (whenmenu[0].value()) n |= FL_WHEN_CHANGED; + if (whenmenu[1].value()) n |= FL_WHEN_NOT_CHANGED; + if (whenmenu[2].value()) n |= FL_WHEN_RELEASE; + if (whenmenu[3].value()) n |= FL_WHEN_ENTER_KEY; + if (whenmenu[4].value()) n |= FL_WHEN_CLOSED; + } + w_when_box->copy_label(when_symbol_name(n)); + for (Widget_Node *q: Fluid.proj.tree.all_selected_widgets()) { + q->o->when(n); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +}} open tooltip {When to call the callback function.} xywh {260 310 145 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 when 1 textsize 11 code0 {extern Fl_Menu_Item whenmenu[];} code1 {o->menu(whenmenu);} @@ -1104,7 +2462,28 @@ wCallback->do_callback(wCallback, v);} open xywh {95 332 310 26} labelfont 1 labelsize 11 align 4 } { Fl_Input_Choice {} { - callback user_data_type_cb open + callback {static const char *dflt = "void*"; +if (v == LOAD) { + const char *c = current_widget->user_data_type(); + if (!c) c = dflt; + o->value(c); +} else { + int mod = 0; + const char *c = o->value(); + const char *d = c_check(c); + if (!*c) o->value(dflt); + else if (!strcmp(c,dflt)) c = nullptr; + if (!d) { + if (c && *c && c[strlen(c)-1] != '*' && strcmp(c,"long")) + d = "must be pointer or long"; + } + if (d) {fl_message("Error in type: %s",d); haderror = 1; return;} + for (Node *q: Fluid.proj.tree.all_selected_nodes()) { + q->user_data_type(c); + mod = 1; + } + if (mod) Fluid.proj.set_modflag(1); +}} open tooltip {The type of the user data.} xywh {95 335 158 20} labelfont 1 labelsize 11 textfont 4 textsize 11 resizable } { MenuItem {} { @@ -1122,720 +2501,18 @@ wCallback->do_callback(wCallback, v);} open } } } - Fl_Group widget_tab_grid_child { - label {Grid Child} - callback propagate_load open - xywh {10 30 400 330} labelsize 11 hide - } { - Fl_Group {} { - label {Location:} - callback propagate_load open - xywh {95 60 315 20} box FLAT_BOX labelfont 1 labelsize 11 align 4 - } { - Fl_Input widget_grid_row_input { - label {Row:} - callback grid_set_row_cb - xywh {95 60 40 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - Fl_Group {} {open - xywh {135 60 30 20} - } { - Fl_Button {} { - label {-} - callback grid_dec_row_cb - xywh {135 60 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - Fl_Button {} { - label {+} - callback grid_inc_row_cb - xywh {150 60 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - } - Fl_Input widget_grid_col_input { - label {Column:} - callback grid_set_col_cb - xywh {175 60 40 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - Fl_Group {} {open - xywh {215 60 30 20} - } { - Fl_Button {} { - label {-} - callback grid_dec_col_cb - xywh {215 60 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - Fl_Button {} { - label {+} - callback grid_inc_col_cb - xywh {230 60 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - } - Fl_Box {} { - xywh {395 60 1 20} hide resizable - } - Fl_Box widget_grid_transient { - label TRANSIENT - callback {if (v==LOAD) { - Fl_Widget *child = ((Fl_Widget_Type*)current_widget)->o; - Fl_Grid_Proxy *g = ((Fl_Grid_Proxy*)((Fl_Widget_Type*)current_widget->parent)->o); -// Fl_Grid::Cell *cell = g->cell(child); -// Fl_Grid::Cell *tcell = g->transient_cell(child); - widget_grid_transient->hide(); - widget_grid_unlinked->hide(); - if (g->transient_cell(child)) { - widget_grid_transient->show(); - } else if (!g->cell(child)) { - widget_grid_unlinked->show(); - } -}} - xywh {250 60 80 20} labelsize 11 labelcolor 1 - } - Fl_Box widget_grid_unlinked { - label UNLINKED - xywh {250 60 80 20} labelsize 11 labelcolor 1 hide - } - } - Fl_Group wp_gridc_align { - label {Align:} - callback propagate_load open - xywh {95 100 315 20} labelfont 1 labelsize 11 align 4 - } { - Fl_Choice {} { - label Horizontal - callback grid_align_horizontal_cb open - xywh {95 100 115 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11 - } { - MenuItem GRID_LEFT { - label GRID_LEFT - user_data {(fl_intptr_t)FL_GRID_LEFT} user_data_type long - xywh {10 10 31 20} labelsize 11 - } - MenuItem {} { - label GRID_CENTER - user_data {(fl_intptr_t)FL_GRID_CENTER} user_data_type long - xywh {10 10 31 20} labelsize 11 - } - MenuItem {} { - label GRID_RIGHT - user_data {(fl_intptr_t)FL_GRID_RIGHT} user_data_type long - xywh {10 10 31 20} labelsize 11 - } - MenuItem {} { - label GRID_FILL - user_data {(fl_intptr_t)FL_GRID_HORIZONTAL} user_data_type long - xywh {10 10 31 20} labelsize 11 - } - } - Fl_Choice {} { - label Vertical - callback grid_align_vertical_cb open - xywh {215 100 115 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11 - } { - MenuItem {} { - label GRID_TOP - user_data {(fl_intptr_t)FL_GRID_TOP} user_data_type long - xywh {10 10 31 20} labelsize 11 - } - MenuItem {} { - label GRID_CENTER - user_data {(fl_intptr_t)FL_GRID_CENTER} user_data_type long - xywh {10 10 31 20} labelsize 11 - } - MenuItem {} { - label GRID_BOTTOM - user_data {(fl_intptr_t)FL_GRID_BOTTOM} user_data_type long - xywh {10 10 31 20} labelsize 11 - } - MenuItem {} { - label GRID_FILL - user_data {(fl_intptr_t)FL_GRID_VERTICAL} user_data_type long - xywh {10 10 31 20} labelsize 11 - } - } - Fl_Box {} { - xywh {395 100 1 20} hide resizable - } - } - Fl_Group wp_gridc_size { - label {Min. Size:} - callback propagate_load open - xywh {95 135 315 20} labelfont 1 labelsize 11 align 4 - } { - Fl_Input {} { - label {Width:} - callback grid_set_min_wdt_cb - xywh {95 135 55 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - Fl_Input {} { - label {Height:} - callback grid_set_min_hgt_cb - xywh {155 135 55 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - Fl_Box {} { - xywh {395 135 1 20} hide resizable - } - } - Fl_Group {} { - label {Span:} - callback propagate_load open - xywh {95 170 315 20} labelfont 1 labelsize 11 align 4 - } { - Fl_Input widget_grid_rowspan_input { - label {Row Span:} - callback grid_set_rowspan_cb - xywh {95 170 40 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - Fl_Group {} {open - xywh {135 170 30 20} - } { - Fl_Button {} { - label {-} - callback grid_dec_rowspan_cb - xywh {135 170 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - Fl_Button {} { - label {+} - callback grid_inc_rowspan_cb - xywh {150 170 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - } - Fl_Input widget_grid_colspan_input { - label {Col. Span:} - callback grid_set_colspan_cb - xywh {175 170 40 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - Fl_Group {} {open - xywh {215 170 30 20} - } { - Fl_Button {} { - label {-} - callback grid_dec_colspan_cb - xywh {215 170 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - Fl_Button {} { - label {+} - callback grid_inc_colspan_cb - xywh {230 170 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - } - Fl_Box {} { - xywh {395 170 1 20} hide resizable - } - } - Fl_Box {} { - xywh {95 350 300 5} labelsize 11 hide resizable - } - } Fl_Group widget_tab_grid { label Grid - callback propagate_load open + callback {o->callback((Fl_Callback*)propagate_load);} open xywh {10 30 400 330} labelsize 11 hide - } { - Fl_Group {} { - label {Grid Layout:} - callback propagate_load open - xywh {95 60 315 20} labelfont 1 labelsize 11 align 4 - } { - Fl_Input widget_grid_rows { - label {Rows:} - callback {// grid_rows_cb -Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -if (v == LOAD) { - o->value(grid->rows()); -} else { - int m = o->value(), old_m = grid->rows(); - if (m < 1) { - m = 1; - o->value(m); - } - if (m < old_m) { - // TODO: verify that this will not unlink existings cells - // Offer a dialog with "delete children", "unlink cells", "cancel" - } - if (m != old_m) { - undo_checkpoint(); - grid->layout(m, grid->cols()); - grid->need_layout(true); - set_modflag(1); - widget_tab_grid->do_callback(widget_tab_grid, LOAD); - } -}} - tooltip {Number of horizontal rows in the Grid group} xywh {95 60 40 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - Fl_Group {} {open - xywh {135 60 30 20} - } { - Fl_Button {} { - label {-} - callback {if (v != LOAD) { - widget_grid_rows->value( widget_grid_rows->value()-1 ); - widget_grid_rows->do_callback(); -}} - xywh {135 60 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - Fl_Button {} { - label {+} - callback {if (v != LOAD) { - widget_grid_rows->value( widget_grid_rows->value()+1 ); - widget_grid_rows->do_callback(); -}} - xywh {150 60 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - } - Fl_Input widget_grid_cols { - label {Columns:} - callback {// grid_rows_cb -Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -if (v == LOAD) { - o->value(grid->cols()); -} else { - int m = o->value(), old_m = grid->cols(); - if (m < 1) { - m = 1; - o->value(m); - } - if (m < old_m) { - // TODO: verify that this will not unlink existings cells - // Offer a dialog with "delete children", "unlink cells", "cancel" - } - if (m != old_m) { - undo_checkpoint(); - grid->layout(grid->rows(), m); - grid->need_layout(true); - set_modflag(1); - widget_tab_grid->do_callback(widget_tab_grid, LOAD); - } -}} - tooltip {Number of vertical columns in the Grid group} xywh {175 60 40 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - Fl_Group {} {open - xywh {215 60 30 20} - } { - Fl_Button {} { - label {-} - callback {if (v != LOAD) { - widget_grid_cols->value( widget_grid_cols->value()-1 ); - widget_grid_cols->do_callback(); -}} - xywh {215 60 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - Fl_Button {} { - label {+} - callback {if (v != LOAD) { - widget_grid_cols->value( widget_grid_cols->value()+1 ); - widget_grid_cols->do_callback(); -}} - xywh {230 60 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - } - Fl_Box {} { - xywh {396 60 0 20} resizable - } - } - Fl_Group wp_grid_margin { - label {Margins:} - callback propagate_load open - xywh {95 100 315 20} labelfont 1 labelsize 11 align 4 - } { - Fl_Value_Input {} { - label {Left:} - callback {Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -int m = 0; -if (v == LOAD) { - grid->margin(&m, NULL, NULL, NULL); - o->value(m); -} else { - int m = (int)o->value(), old_m; - grid->margin(&old_m, NULL, NULL, NULL); - if (m != old_m) { - undo_checkpoint(); - grid->margin(m, -1, -1, -1); - grid->need_layout(true); - set_modflag(1); - } -}} - tooltip {Left margin in group.} xywh {95 100 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 - } - Fl_Value_Input {} { - label {Top:} - callback {Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -int m = 0; -if (v == LOAD) { - grid->margin(NULL, &m, NULL, NULL); - o->value(m); -} else { - int m = (int)o->value(), old_m; - grid->margin(NULL, &old_m, NULL, NULL); - if (m != old_m) { - undo_checkpoint(); - grid->margin(-1, m, -1, -1); - grid->need_layout(true); - set_modflag(1); - } -}} - tooltip {Top margin in group.} xywh {155 100 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 - } - Fl_Value_Input {} { - label {Right:} - callback {Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -int m = 0; -if (v == LOAD) { - grid->margin(NULL, NULL, &m, NULL); - o->value(m); -} else { - int m = (int)o->value(), old_m; - grid->margin(NULL, NULL, &old_m, NULL); - if (m != old_m) { - undo_checkpoint(); - grid->margin(-1, -1, m, -1); - grid->need_layout(true); - set_modflag(1); - } -}} - tooltip {Right margin in group.} xywh {215 100 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 - } - Fl_Value_Input {} { - label {Bottom:} - callback {Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -int m = 0; -if (v == LOAD) { - grid->margin(NULL, NULL, NULL, &m); - o->value(m); -} else { - int m = (int)o->value(), old_m; - grid->margin(NULL, NULL, NULL, &old_m); - if (m != old_m) { - undo_checkpoint(); - grid->margin(-1, -1, -1, m); - grid->need_layout(true); - set_modflag(1); - } -}} - tooltip {Bottom margin in group.} xywh {275 100 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 - } - Fl_Box {} { - xywh {396 100 0 20} resizable - } - } - Fl_Group wp_grid_gaps { - label {Gaps:} - callback propagate_load open - xywh {95 135 315 20} labelfont 1 labelsize 11 align 4 - } { - Fl_Value_Input {} { - label {Row:} - callback {Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -if (v == LOAD) { - int m = 0; - grid->gap(&m, NULL); - o->value(m); -} else { - int m = (int)o->value(), old_m, m2; - grid->gap(&old_m, &m2); - if (m != old_m) { - undo_checkpoint(); - grid->gap(m, m2); - grid->need_layout(true); - set_modflag(1); - } -}} - tooltip {Gap between children.} xywh {95 135 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 - } - Fl_Value_Input {} { - label {Col:} - callback {Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -if (v == LOAD) { - int m = 0; - grid->gap(NULL, &m); - o->value(m); -} else { - int m = (int)o->value(), old_m, m2; - grid->gap(&m2, &old_m); - if (m != old_m) { - undo_checkpoint(); - grid->gap(m2, m); - grid->need_layout(true); - set_modflag(1); - } -}} - tooltip {Gap between children.} xywh {155 135 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 - } - Fl_Box {} { - xywh {396 135 0 20} resizable - } - } - Fl_Group {} { - label {Row:} - callback {if (v == LOAD) { - Fl_Grid *grid = Fl_Grid_Type::selected(); - if (grid) - o->activate(); - else - o->deactivate(); - propagate_load(o, v); -}} open - xywh {95 175 315 20} labelfont 1 labelsize 11 align 4 - } { - Fl_Input widget_grid_curr_row { - label Index - callback {Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -int r = o->value(), old_r = r; -if (r < 0) r = 0; -if (r >= grid->rows()) r = grid->rows()-1; -if (r != old_r) o->value(r); -if (v == LOAD) { - // will automatically propagate -} else { - widget_grid_curr_row_attributes->do_callback(widget_grid_curr_row_attributes, LOAD); -}} - xywh {95 175 40 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - Fl_Group {} { - callback propagate_load open - xywh {135 175 30 20} - } { - Fl_Button {} { - label {-} - callback {if (v != LOAD) { - widget_grid_curr_row->value( widget_grid_curr_row->value()-1 ); - widget_grid_curr_row->do_callback(); -}} - xywh {135 175 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - Fl_Button {} { - label {+} - callback {if (v != LOAD) { - widget_grid_curr_row->value( widget_grid_curr_row->value()+1 ); - widget_grid_curr_row->do_callback(); -}} - xywh {150 175 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - } - Fl_Box {} { - label {:} - xywh {165 175 15 20} labelsize 11 - } - Fl_Group widget_grid_curr_row_attributes { - callback propagate_load open - xywh {180 175 175 20} - } { - Fl_Input {} { - label {Height:} - callback {Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -int r = widget_grid_curr_row->value(); -if (v == LOAD) { - o->value(grid->row_height(r)); -} else { - int h = o->value(), old_h = grid->row_height(r); - if (h < 0) h = 0; - if (h != old_h) { - undo_checkpoint(); - grid->row_height(r, h); - grid->need_layout(true); - set_modflag(1); - } -}} - xywh {180 175 55 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - Fl_Input {} { - label {Weight:} - callback {Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -int r = widget_grid_curr_row->value(); -if (v == LOAD) { - o->value(grid->row_weight(r)); -} else { - int h = o->value(), old_h = grid->row_weight(r); - if (h < 0) h = 0; - if (h != old_h) { - undo_checkpoint(); - grid->row_weight(r, h); - grid->need_layout(true); - set_modflag(1); - } -}} - xywh {240 175 55 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - Fl_Input {} { - label {Gap:} - callback {Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -int r = widget_grid_curr_row->value(); -if (v == LOAD) { - o->value(grid->row_gap(r)); -} else { - int h = o->value(), old_h = grid->row_gap(r); - if (h < -1) h = -1; - if (h != old_h) { - undo_checkpoint(); - grid->row_gap(r, h); - grid->need_layout(true); - set_modflag(1); - } -}} - xywh {300 175 55 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - } - Fl_Box {} { - xywh {400 175 1 20} hide resizable - } - } - Fl_Group {} { - label {Column:} - callback propagate_load open - xywh {95 210 315 20} labelfont 1 labelsize 11 align 4 - } { - Fl_Input widget_grid_curr_col { - label Index - callback {Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -int c = o->value(), old_c = c; -if (c < 0) c = 0; -if (c >= grid->cols()) c = grid->cols()-1; -if (c != old_c) o->value(c); -if (v == LOAD) { - // will automatically propagate -} else { - widget_grid_curr_col_attributes->do_callback(widget_grid_curr_col_attributes, LOAD); -}} - xywh {95 210 40 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - Fl_Group {} {open - xywh {135 210 30 20} - } { - Fl_Button {} { - label {-} - callback {if (v != LOAD) { - widget_grid_curr_col->value( widget_grid_curr_col->value()-1 ); - widget_grid_curr_col->do_callback(); -}} - xywh {135 210 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - Fl_Button {} { - label {+} - callback {if (v != LOAD) { - widget_grid_curr_col->value( widget_grid_curr_col->value()+1 ); - widget_grid_curr_col->do_callback(); -}} - xywh {150 210 15 20} labelsize 11 - code0 {o->clear_visible_focus();} compact 1 - } - } - Fl_Box {} { - label {:} - xywh {165 210 15 20} labelsize 11 - } - Fl_Group widget_grid_curr_col_attributes { - callback propagate_load open - xywh {180 210 175 20} - } { - Fl_Input {} { - label {Width:} - callback {Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -int c = widget_grid_curr_col->value(); -if (v == LOAD) { - o->value(grid->col_width(c)); -} else { - int h = o->value(), old_h = grid->col_width(c); - if (h < 0) h = 0; - if (h != old_h) { - undo_checkpoint(); - grid->col_width(c, h); - grid->need_layout(true); - set_modflag(1); - } -}} - xywh {180 210 55 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - Fl_Input {} { - label {Weight:} - callback {Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -int c = widget_grid_curr_col->value(); -if (v == LOAD) { - o->value(grid->col_weight(c)); -} else { - int h = o->value(), old_h = grid->col_weight(c); - if (h < 0) h = 0; - if (h != old_h) { - undo_checkpoint(); - grid->col_weight(c, h); - grid->need_layout(true); - set_modflag(1); - } -}} - xywh {240 210 55 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - Fl_Input {} { - label {Gap:} - callback {Fl_Grid *grid = Fl_Grid_Type::selected(); -if (!grid) return; -int c = widget_grid_curr_col->value(); -if (v == LOAD) { - o->value(grid->col_gap(c)); -} else { - int h = o->value(), old_h = grid->col_gap(c); - if (h < -1) h = -1; - if (h != old_h) { - undo_checkpoint(); - grid->col_gap(c, h); - grid->need_layout(true); - set_modflag(1); - } -}} - xywh {300 210 55 20} labelsize 11 align 5 textsize 11 - class {fld::widget::Formula_Input} - } - } - Fl_Box {} { - xywh {400 210 1 20} hide resizable - } - } - Fl_Box {} { - xywh {95 350 300 5} labelsize 11 hide resizable - } - } + class Grid_Tab + } {} + Fl_Group widget_tab_grid_child { + label {Grid Child} + callback {o->callback((Fl_Callback*)propagate_load);} open + xywh {10 30 400 330} labelsize 11 hide + class Grid_Child_Tab + } {} } Fl_Tabs widget_tabs_repo { xywh {10 10 400 350} hide diff --git a/fluid/panels/widget_panel.h b/fluid/panels/widget_panel.h index bac21a771..80ccd4171 100644 --- a/fluid/panels/widget_panel.h +++ b/fluid/panels/widget_panel.h @@ -19,7 +19,10 @@ #ifndef widget_panel_h #define widget_panel_h #include +#include "panels/widget_panel/Grid_Child_Tab.h" +#include "panels/widget_panel/Grid_Tab.h" #include "widgets/Formula_Input.h" +class Fl_Flex; #include extern Fl_Double_Window *image_panel_window; #include @@ -32,17 +35,14 @@ extern fld::widget::Formula_Input *image_panel_imagew; extern fld::widget::Formula_Input *image_panel_imageh; #include #include -extern void compress_image_cb(Fl_Check_Button*, void*); -extern void bind_image_cb(Fl_Check_Button*, void*); extern Fl_Group *image_panel_deimagegroup; extern Fl_Box *image_panel_dedata; extern fld::widget::Formula_Input *image_panel_deimagew; extern fld::widget::Formula_Input *image_panel_deimageh; -extern void compress_deimage_cb(Fl_Check_Button*, void*); -extern void bind_deimage_cb(Fl_Check_Button*, void*); extern Fl_Button *image_panel_close; Fl_Double_Window* make_image_panel(); void run_image_panel(); +void flex_margin_cb(Fl_Value_Input* i, void* v, void (*load_margin)(Fl_Flex*,Fl_Value_Input*), int (*update_margin)(Fl_Flex*,int)); #include extern Fl_Tabs *widget_tabs; extern Fl_Group *wp_gui_tab; @@ -52,159 +52,59 @@ extern Fl_Input *wp_gui_label; #include extern Fl_Menu_Item labeltypemenu[]; extern void labeltype_cb(Fl_Choice*, void*); -extern void image_cb(Fl_Input*, void*); extern Fl_Input *widget_image_input; -extern void image_browse_cb(Fl_Button*, void*); -extern void inactive_cb(Fl_Input*, void*); extern Fl_Input *widget_deimage_input; -extern void inactive_browse_cb(Fl_Button*, void*); extern Fl_Group *wp_gui_alignment; extern void align_cb(Fl_Button*, void*); extern void align_text_image_cb(Fl_Choice*, void*); extern void align_position_cb(Fl_Choice*, void*); extern void position_group_cb(Fl_Group*, void*); -extern void x_cb(fld::widget::Formula_Input*, void*); extern fld::widget::Formula_Input *widget_x_input; -extern void y_cb(fld::widget::Formula_Input*, void*); extern fld::widget::Formula_Input *widget_y_input; -extern void w_cb(fld::widget::Formula_Input*, void*); extern fld::widget::Formula_Input *widget_w_input; -extern void h_cb(fld::widget::Formula_Input*, void*); extern fld::widget::Formula_Input *widget_h_input; -extern void wc_relative_cb(Fl_Choice*, void*); -extern void flex_size_group_cb(Fl_Group*, void*); extern Fl_Group *wp_gui_flexp; #include -extern void flex_size_cb(Fl_Value_Input*, void*); extern Fl_Value_Input *widget_flex_size; -extern void flex_fixed_cb(Fl_Check_Button*, void*); extern Fl_Check_Button *widget_flex_fixed; -extern void values_group_cb(Fl_Group*, void*); extern Fl_Group *wp_gui_values; -extern void slider_size_cb(Fl_Value_Input*, void*); -extern void min_cb(Fl_Value_Input*, void*); -extern void max_cb(Fl_Value_Input*, void*); -extern void step_cb(Fl_Value_Input*, void*); -extern void value_cb(Fl_Value_Input*, void*); -extern void flex_margin_group_cb(Fl_Group*, void*); extern Fl_Group *wp_gui_margins; -extern void flex_margin_left_cb(Fl_Value_Input*, void*); -extern void flex_margin_top_cb(Fl_Value_Input*, void*); -extern void flex_margin_right_cb(Fl_Value_Input*, void*); -extern void flex_margin_bottom_cb(Fl_Value_Input*, void*); -extern void flex_margin_gap_cb(Fl_Value_Input*, void*); -extern void size_range_group_cb(Fl_Group*, void*); extern Fl_Group *wp_gui_sizerange; -extern void min_w_cb(Fl_Value_Input*, void*); -extern void min_h_cb(Fl_Value_Input*, void*); -extern void set_min_size_cb(Fl_Button*, void*); -extern void max_w_cb(Fl_Value_Input*, void*); -extern void max_h_cb(Fl_Value_Input*, void*); -extern void set_max_size_cb(Fl_Button*, void*); #include -extern void shortcut_in_cb(Fl_Shortcut_Button*, void*); extern Fl_Shortcut_Button *wp_gui_shortcut; extern Fl_Group *wp_gui_xclass; -extern void xclass_cb(Fl_Input*, void*); #include -extern void border_cb(Fl_Light_Button*, void*); -extern void modal_cb(Fl_Light_Button*, void*); -extern void non_modal_cb(Fl_Light_Button*, void*); extern Fl_Group *wp_gui_attributes; -extern void visible_cb(Fl_Light_Button*, void*); -extern void active_cb(Fl_Light_Button*, void*); -extern void resizable_cb(Fl_Light_Button*, void*); -extern void hotspot_cb(Fl_Light_Button*, void*); -extern void tooltip_cb(Fl_Input*, void*); extern Fl_Input *wp_gui_tooltip; extern Fl_Group *wp_style_tab; extern Fl_Group *wp_style_label; extern Fl_Menu_Item fontmenu[]; -extern void labelfont_cb(Fl_Choice*, void*); -extern void labelsize_cb(Fl_Value_Input*, void*); -extern void labelcolor_cb(Fl_Button*, void*); extern Fl_Button *w_labelcolor; #include extern Fl_Menu_Item colormenu[]; -extern void labelcolor_menu_cb(Fl_Menu_Button*, void*); extern Fl_Group *wp_style_box; extern Fl_Menu_Item boxmenu[]; -extern void box_cb(Fl_Choice*, void*); -extern void color_cb(Fl_Button*, void*); extern Fl_Button *w_color; -extern void color_menu_cb(Fl_Menu_Button*, void*); extern Fl_Group *wp_style_downbox; -extern void down_box_cb(Fl_Choice*, void*); -extern void color2_cb(Fl_Button*, void*); extern Fl_Button *w_selectcolor; -extern void color2_menu_cb(Fl_Menu_Button*, void*); extern Fl_Group *wp_style_text; -extern void textfont_cb(Fl_Choice*, void*); -extern void textsize_cb(Fl_Value_Input*, void*); -extern void textcolor_cb(Fl_Button*, void*); extern Fl_Button *w_textcolor; -extern void textcolor_menu_cb(Fl_Menu_Button*, void*); -extern void h_label_margin_cb(Fl_Value_Input*, void*); -extern void v_label_margin_cb(Fl_Value_Input*, void*); -extern void image_spacing_cb(Fl_Value_Input*, void*); -extern void compact_cb(Fl_Light_Button*, void*); extern Fl_Group *wp_cpp_tab; extern Fl_Group *wp_cpp_class; -extern void subclass_cb(Fl_Input*, void*); -extern void subtype_cb(Fl_Choice*, void*); extern Fl_Group *wp_cpp_name; -extern void name_cb(Fl_Input*, void*); -extern void name_public_member_cb(Fl_Choice*, void*); extern void name_public_cb(Fl_Choice*, void*); -extern void v_input_cb(Fl_Input*, void*); extern Fl_Input *v_input[4]; #include #include extern Fl_Text_Editor *wComment; #include "widgets/Code_Editor.h" -extern void callback_cb(fld::widget::Code_Editor*, void*); extern fld::widget::Code_Editor *wCallback; extern Fl_Group *wp_cpp_callback; -extern void user_data_cb(Fl_Input*, void*); extern Fl_Menu_Item whenmenu[]; -extern void when_cb(Fl_Menu_Button*, void*); #include -extern void user_data_type_cb(Fl_Input_Choice*, void*); extern Fl_Box *w_when_box; -extern Fl_Group *widget_tab_grid_child; -extern void grid_set_row_cb(fld::widget::Formula_Input*, void*); -extern fld::widget::Formula_Input *widget_grid_row_input; -extern void grid_dec_row_cb(Fl_Button*, void*); -extern void grid_inc_row_cb(Fl_Button*, void*); -extern void grid_set_col_cb(fld::widget::Formula_Input*, void*); -extern fld::widget::Formula_Input *widget_grid_col_input; -extern void grid_dec_col_cb(Fl_Button*, void*); -extern void grid_inc_col_cb(Fl_Button*, void*); -extern Fl_Box *widget_grid_transient; -extern Fl_Box *widget_grid_unlinked; -extern Fl_Group *wp_gridc_align; -extern void grid_align_horizontal_cb(Fl_Choice*, void*); -extern void grid_align_vertical_cb(Fl_Choice*, void*); -extern Fl_Group *wp_gridc_size; -extern void grid_set_min_wdt_cb(fld::widget::Formula_Input*, void*); -extern void grid_set_min_hgt_cb(fld::widget::Formula_Input*, void*); -extern void grid_set_rowspan_cb(fld::widget::Formula_Input*, void*); -extern fld::widget::Formula_Input *widget_grid_rowspan_input; -extern void grid_dec_rowspan_cb(Fl_Button*, void*); -extern void grid_inc_rowspan_cb(Fl_Button*, void*); -extern void grid_set_colspan_cb(fld::widget::Formula_Input*, void*); -extern fld::widget::Formula_Input *widget_grid_colspan_input; -extern void grid_dec_colspan_cb(Fl_Button*, void*); -extern void grid_inc_colspan_cb(Fl_Button*, void*); -extern Fl_Group *widget_tab_grid; -extern fld::widget::Formula_Input *widget_grid_rows; -extern fld::widget::Formula_Input *widget_grid_cols; -extern Fl_Group *wp_grid_margin; -extern Fl_Group *wp_grid_gaps; -extern fld::widget::Formula_Input *widget_grid_curr_row; -extern Fl_Group *widget_grid_curr_row_attributes; -extern fld::widget::Formula_Input *widget_grid_curr_col; -extern Fl_Group *widget_grid_curr_col_attributes; +extern Grid_Tab *widget_tab_grid; +extern Grid_Child_Tab *widget_tab_grid_child; extern Fl_Tabs *widget_tabs_repo; extern void live_mode_cb(Fl_Button*, void*); extern Fl_Button *wLiveMode; @@ -219,7 +119,4 @@ extern Fl_Menu_Item menu_Children[]; extern Fl_Menu_Item menu_2[]; extern Fl_Menu_Item menu_3[]; extern Fl_Menu_Item menu_4[]; -extern Fl_Menu_Item menu_Horizontal[]; -#define GRID_LEFT (menu_Horizontal+0) -extern Fl_Menu_Item menu_Vertical[]; #endif diff --git a/fluid/panels/widget_panel/Grid_Child_Tab.cxx b/fluid/panels/widget_panel/Grid_Child_Tab.cxx new file mode 100644 index 000000000..b0f943803 --- /dev/null +++ b/fluid/panels/widget_panel/Grid_Child_Tab.cxx @@ -0,0 +1,538 @@ +// generated by Fast Light User Interface Designer (fluid) version 1.0500 + +#include "Grid_Child_Tab.h" +#include "Fluid.h" +#include "proj/undo.h" +#include "nodes/Grid_Node.h" +extern Grid_Child_Tab *widget_tab_grid_child; + +void Grid_Child_Tab::cb_widget_grid_row_input_i(fld::widget::Formula_Input* o, void* v) { + grid_child_cb(o, v, 8); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); +} +void Grid_Child_Tab::cb_widget_grid_row_input(fld::widget::Formula_Input* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_widget_grid_row_input_i(o,v); +} + +void Grid_Child_Tab::cb__i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_row_input, v, 0x0100 + 8); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb__i(o,v); +} + +void Grid_Child_Tab::cb_1_i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_row_input, v, 0x0200 + 8); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_1(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb_1_i(o,v); +} + +void Grid_Child_Tab::cb_widget_grid_col_input_i(fld::widget::Formula_Input* o, void* v) { + grid_child_cb(o, v, 9); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); +} +void Grid_Child_Tab::cb_widget_grid_col_input(fld::widget::Formula_Input* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_widget_grid_col_input_i(o,v); +} + +void Grid_Child_Tab::cb_2_i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_col_input, v, 0x0100 + 9); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_2(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb_2_i(o,v); +} + +void Grid_Child_Tab::cb_3_i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_col_input, v, 0x0200 + 9); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_3(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb_3_i(o,v); +} + +void Grid_Child_Tab::cb_widget_grid_transient_i(Fl_Box* o, void* v) { + if (v==LOAD) { + Fl_Widget *child = ((Widget_Node*)current_widget)->o; + Fl_Grid_Proxy *g = ((Fl_Grid_Proxy*)((Widget_Node*)current_widget->parent)->o); + // Fl_Grid::Cell *cell = g->cell(child); + // Fl_Grid::Cell *tcell = g->transient_cell(child); + widget_grid_transient->hide(); + widget_grid_unlinked->hide(); + if (g->transient_cell(child)) { + widget_grid_transient->show(); + } else if (!g->cell(child)) { + widget_grid_unlinked->show(); + } + } +} +void Grid_Child_Tab::cb_widget_grid_transient(Fl_Box* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_widget_grid_transient_i(o,v); +} + +void Grid_Child_Tab::cb_Horizontal_i(Fl_Choice* o, void* v) { + if ( !current_widget + || !current_widget->parent + || !current_widget->parent->is_a(Type::Grid)) + { + return; + } + int mask = (FL_GRID_LEFT | FL_GRID_RIGHT | FL_GRID_HORIZONTAL); + Fl_Grid *g = ((Fl_Grid*)((Widget_Node*)current_widget->parent)->o); + if (v == LOAD) { + int a = FL_GRID_FILL & mask; + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + a = cell->align() & mask; + } + const Fl_Menu_Item *mi = o->find_item_with_argument(a); + if (mi) o->value(mi); + } else { + Fluid.proj.undo.checkpoint(); + int v = FL_GRID_FILL & mask, old_v = FL_GRID_FILL & mask; + const Fl_Menu_Item *mi = o->mvalue(); + if (mi) v = (int)mi->argument(); + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + old_v = cell->align() & mask; + if (old_v != v) { + cell->align((Fl_Grid_Align)(v | (cell->align() & ~mask))); + g->need_layout(true); + g->redraw(); + Fluid.proj.set_modflag(1); + } + } + } +} +void Grid_Child_Tab::cb_Horizontal(Fl_Choice* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_Horizontal_i(o,v); +} + +Fl_Menu_Item Grid_Child_Tab::menu_Horizontal[] = { + {"GRID_LEFT", 0, 0, (void*)((fl_intptr_t)FL_GRID_LEFT), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"GRID_CENTER", 0, 0, (void*)((fl_intptr_t)FL_GRID_CENTER), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"GRID_RIGHT", 0, 0, (void*)((fl_intptr_t)FL_GRID_RIGHT), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"GRID_FILL", 0, 0, (void*)((fl_intptr_t)FL_GRID_HORIZONTAL), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {0,0,0,0,0,0,0,0,0} +}; +Fl_Menu_Item* Grid_Child_Tab::GRID_LEFT = Grid_Child_Tab::menu_Horizontal + 0; + +void Grid_Child_Tab::cb_Vertical_i(Fl_Choice* o, void* v) { + if ( !current_widget + || !current_widget->parent + || !current_widget->parent->is_a(Type::Grid)) + { + return; + } + int mask = (FL_GRID_TOP | FL_GRID_BOTTOM | FL_GRID_VERTICAL); + Fl_Grid *g = ((Fl_Grid*)((Widget_Node*)current_widget->parent)->o); + if (v == LOAD) { + int a = FL_GRID_FILL & mask; + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + a = cell->align() & mask; + } + const Fl_Menu_Item *mi = o->find_item_with_argument(a); + if (mi) o->value(mi); + } else { + Fluid.proj.undo.checkpoint(); + int v = FL_GRID_FILL & mask, old_v = FL_GRID_FILL & mask; + const Fl_Menu_Item *mi = o->mvalue(); + if (mi) v = (int)mi->argument(); + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + old_v = cell->align() & mask; + if (old_v != v) { + cell->align((Fl_Grid_Align)(v | (cell->align() & ~mask))); + g->need_layout(true); + g->redraw(); + Fluid.proj.set_modflag(1); + } + } + } +} +void Grid_Child_Tab::cb_Vertical(Fl_Choice* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_Vertical_i(o,v); +} + +Fl_Menu_Item Grid_Child_Tab::menu_Vertical[] = { + {"GRID_TOP", 0, 0, (void*)((fl_intptr_t)FL_GRID_TOP), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"GRID_CENTER", 0, 0, (void*)((fl_intptr_t)FL_GRID_CENTER), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"GRID_BOTTOM", 0, 0, (void*)((fl_intptr_t)FL_GRID_BOTTOM), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {"GRID_FILL", 0, 0, (void*)((fl_intptr_t)FL_GRID_VERTICAL), 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, + {0,0,0,0,0,0,0,0,0} +}; + +void Grid_Child_Tab::cb_Width_i(fld::widget::Formula_Input* o, void* v) { + grid_child_cb(o, v, 12); +} +void Grid_Child_Tab::cb_Width(fld::widget::Formula_Input* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_Width_i(o,v); +} + +void Grid_Child_Tab::cb_Height_i(fld::widget::Formula_Input* o, void* v) { + grid_child_cb(o, v, 13); +} +void Grid_Child_Tab::cb_Height(fld::widget::Formula_Input* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_Height_i(o,v); +} + +void Grid_Child_Tab::cb_widget_grid_rowspan_input_i(fld::widget::Formula_Input* o, void* v) { + grid_child_cb(o, v, 10); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); +} +void Grid_Child_Tab::cb_widget_grid_rowspan_input(fld::widget::Formula_Input* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_widget_grid_rowspan_input_i(o,v); +} + +void Grid_Child_Tab::cb_4_i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_rowspan_input, v, 0x0100 + 10); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_4(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb_4_i(o,v); +} + +void Grid_Child_Tab::cb_5_i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_rowspan_input, v, 0x0200 + 10); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_5(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb_5_i(o,v); +} + +void Grid_Child_Tab::cb_widget_grid_colspan_input_i(fld::widget::Formula_Input* o, void* v) { + grid_child_cb(o, v, 11); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); +} +void Grid_Child_Tab::cb_widget_grid_colspan_input(fld::widget::Formula_Input* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()))->cb_widget_grid_colspan_input_i(o,v); +} + +void Grid_Child_Tab::cb_6_i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_colspan_input, v, 0x0100 + 11); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_6(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb_6_i(o,v); +} + +void Grid_Child_Tab::cb_7_i(Fl_Button*, void* v) { + if (v!=LOAD) { + grid_child_cb(widget_grid_colspan_input, v, 0x0200 + 11); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + } +} +void Grid_Child_Tab::cb_7(Fl_Button* o, void* v) { + ((Grid_Child_Tab*)(o->parent()->parent()->parent()))->cb_7_i(o,v); +} + +Grid_Child_Tab::Grid_Child_Tab(int X, int Y, int W, int H, const char *L) : + Fl_Group(0, 0, 400, 330, L) +{ + this->labelsize(11); + this->callback((Fl_Callback*)propagate_load); + { Fl_Group* o = new Fl_Group(85, 30, 315, 20, "Location:"); + o->box(FL_FLAT_BOX); + o->labelfont(1); + o->labelsize(11); + o->callback((Fl_Callback*)propagate_load); + o->align(Fl_Align(FL_ALIGN_LEFT)); + { widget_grid_row_input = new fld::widget::Formula_Input(85, 30, 40, 20, "Row:"); + widget_grid_row_input->box(FL_DOWN_BOX); + widget_grid_row_input->color(FL_BACKGROUND2_COLOR); + widget_grid_row_input->selection_color(FL_SELECTION_COLOR); + widget_grid_row_input->labeltype(FL_NORMAL_LABEL); + widget_grid_row_input->labelfont(0); + widget_grid_row_input->labelsize(11); + widget_grid_row_input->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_row_input->textsize(11); + widget_grid_row_input->callback((Fl_Callback*)cb_widget_grid_row_input); + widget_grid_row_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_row_input->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_row_input + { Fl_Group* o = new Fl_Group(125, 30, 30, 20); + { Fl_Button* o = new Fl_Button(125, 30, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(140, 30, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_1); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { widget_grid_col_input = new fld::widget::Formula_Input(165, 30, 40, 20, "Column:"); + widget_grid_col_input->box(FL_DOWN_BOX); + widget_grid_col_input->color(FL_BACKGROUND2_COLOR); + widget_grid_col_input->selection_color(FL_SELECTION_COLOR); + widget_grid_col_input->labeltype(FL_NORMAL_LABEL); + widget_grid_col_input->labelfont(0); + widget_grid_col_input->labelsize(11); + widget_grid_col_input->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_col_input->textsize(11); + widget_grid_col_input->callback((Fl_Callback*)cb_widget_grid_col_input); + widget_grid_col_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_col_input->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_col_input + { Fl_Group* o = new Fl_Group(205, 30, 30, 20); + { Fl_Button* o = new Fl_Button(205, 30, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_2); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(220, 30, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_3); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { Fl_Box* o = new Fl_Box(385, 30, 1, 20); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + { widget_grid_transient = new Fl_Box(240, 30, 80, 20, "TRANSIENT"); + widget_grid_transient->labelsize(11); + widget_grid_transient->labelcolor((Fl_Color)1); + widget_grid_transient->callback((Fl_Callback*)cb_widget_grid_transient); + } // Fl_Box* widget_grid_transient + { widget_grid_unlinked = new Fl_Box(240, 30, 80, 20, "UNLINKED"); + widget_grid_unlinked->labelsize(11); + widget_grid_unlinked->labelcolor((Fl_Color)1); + widget_grid_unlinked->hide(); + } // Fl_Box* widget_grid_unlinked + o->end(); + } // Fl_Group* o + { wp_gridc_align = new Fl_Group(85, 70, 315, 20, "Align:"); + wp_gridc_align->labelfont(1); + wp_gridc_align->labelsize(11); + wp_gridc_align->callback((Fl_Callback*)propagate_load); + wp_gridc_align->align(Fl_Align(FL_ALIGN_LEFT)); + { Fl_Choice* o = new Fl_Choice(85, 70, 115, 20, "Horizontal"); + o->down_box(FL_BORDER_BOX); + o->labelsize(11); + o->textsize(11); + o->callback((Fl_Callback*)cb_Horizontal); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->menu(menu_Horizontal); + } // Fl_Choice* o + { Fl_Choice* o = new Fl_Choice(205, 70, 115, 20, "Vertical"); + o->down_box(FL_BORDER_BOX); + o->labelsize(11); + o->textsize(11); + o->callback((Fl_Callback*)cb_Vertical); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->menu(menu_Vertical); + } // Fl_Choice* o + { Fl_Box* o = new Fl_Box(385, 70, 1, 20); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + wp_gridc_align->end(); + } // Fl_Group* wp_gridc_align + { wp_gridc_size = new Fl_Group(85, 105, 315, 20, "Min. Size:"); + wp_gridc_size->labelfont(1); + wp_gridc_size->labelsize(11); + wp_gridc_size->callback((Fl_Callback*)propagate_load); + wp_gridc_size->align(Fl_Align(FL_ALIGN_LEFT)); + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(85, 105, 55, 20, "Width:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Width); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(145, 105, 55, 20, "Height:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Height); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + { Fl_Box* o = new Fl_Box(385, 105, 1, 20); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + wp_gridc_size->end(); + } // Fl_Group* wp_gridc_size + { Fl_Group* o = new Fl_Group(85, 140, 315, 20, "Span:"); + o->labelfont(1); + o->labelsize(11); + o->callback((Fl_Callback*)propagate_load); + o->align(Fl_Align(FL_ALIGN_LEFT)); + { widget_grid_rowspan_input = new fld::widget::Formula_Input(85, 140, 40, 20, "Row Span:"); + widget_grid_rowspan_input->box(FL_DOWN_BOX); + widget_grid_rowspan_input->color(FL_BACKGROUND2_COLOR); + widget_grid_rowspan_input->selection_color(FL_SELECTION_COLOR); + widget_grid_rowspan_input->labeltype(FL_NORMAL_LABEL); + widget_grid_rowspan_input->labelfont(0); + widget_grid_rowspan_input->labelsize(11); + widget_grid_rowspan_input->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_rowspan_input->textsize(11); + widget_grid_rowspan_input->callback((Fl_Callback*)cb_widget_grid_rowspan_input); + widget_grid_rowspan_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_rowspan_input->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_rowspan_input + { Fl_Group* o = new Fl_Group(125, 140, 30, 20); + { Fl_Button* o = new Fl_Button(125, 140, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_4); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(140, 140, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_5); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { widget_grid_colspan_input = new fld::widget::Formula_Input(165, 140, 40, 20, "Col. Span:"); + widget_grid_colspan_input->box(FL_DOWN_BOX); + widget_grid_colspan_input->color(FL_BACKGROUND2_COLOR); + widget_grid_colspan_input->selection_color(FL_SELECTION_COLOR); + widget_grid_colspan_input->labeltype(FL_NORMAL_LABEL); + widget_grid_colspan_input->labelfont(0); + widget_grid_colspan_input->labelsize(11); + widget_grid_colspan_input->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_colspan_input->textsize(11); + widget_grid_colspan_input->callback((Fl_Callback*)cb_widget_grid_colspan_input); + widget_grid_colspan_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_colspan_input->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_colspan_input + { Fl_Group* o = new Fl_Group(205, 140, 30, 20); + { Fl_Button* o = new Fl_Button(205, 140, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_6); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(220, 140, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_7); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { Fl_Box* o = new Fl_Box(385, 140, 1, 20); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + o->end(); + } // Fl_Group* o + { Fl_Box* o = new Fl_Box(85, 320, 300, 5); + o->labelsize(11); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + end(); + resize(X, Y, W, H); +} + +void Grid_Child_Tab::grid_child_cb(fld::widget::Formula_Input* i, void* v, int what) { + if ( !current_widget + || !current_widget->parent + || !current_widget->parent->is_a(Type::Grid)) + { + return; + } + Fl_Widget *child = ((Widget_Node*)current_widget)->o; + Fl_Grid_Proxy *g = ((Fl_Grid_Proxy*)((Widget_Node*)current_widget->parent)->o); + Fl_Grid::Cell *cell = g->any_cell(child); + if (v == LOAD) { + int v = -1; + if (cell) { + switch (what & 0x00ff) { + case 8: v = cell->row(); break; + case 9: v = cell->col(); break; + case 10: v = cell->rowspan(); break; + case 11: v = cell->colspan(); break; + case 12: cell->minimum_size(&v, nullptr); break; + case 13: cell->minimum_size(nullptr, &v); break; + } + } + i->value(v); + } else { + Fluid.proj.undo.checkpoint(); + int v2 = -2, old_v = -2, v = i->value(); + if (i==widget_grid_row_input) v2 = widget_grid_col_input->value(); + if (i==widget_grid_col_input) v2 = widget_grid_row_input->value(); + Fl_Grid::Cell *new_cell = nullptr; + if (cell) { + switch (what & 0x00ff) { + case 8: old_v = cell->row(); v2 = cell->col(); break; + case 9: old_v = cell->col(); v2 = cell->row(); break; + case 10: old_v = cell->rowspan(); break; + case 11: old_v = cell->colspan(); break; + case 12: cell->minimum_size(&old_v, &v2); break; + case 13: cell->minimum_size(&v2, &old_v); break; + } + } + switch (what & 0xff00) { + case 0x0100: v--; break; + case 0x0200: v++; break; + } + if (old_v != v) { + switch (what & 0x00ff) { + case 8: + if (v2 == -1 && v >= 0) v2 = 0; + g->move_cell(current_widget->o, v, v2, 2); i->value(v); + break; + case 9: + if (v2 == -1 && v >= 0) v2 = 0; + g->move_cell(current_widget->o, v2, v, 2); i->value(v); + break; + case 10: if (cell && cell->row()+v<=g->rows() && v>0) cell->rowspan(v); + break; + case 11: if (cell && cell->col()+v<=g->cols() && v>0) cell->colspan(v); + break; + case 12: if (cell && v>=0) cell->minimum_size(v, v2); + break; + case 13: if (cell && v>=0) cell->minimum_size(v2, v); + break; + } + if (!cell && new_cell) + new_cell->minimum_size(20, 20); + g->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} diff --git a/fluid/panels/widget_panel/Grid_Child_Tab.fl b/fluid/panels/widget_panel/Grid_Child_Tab.fl new file mode 100644 index 000000000..161eab696 --- /dev/null +++ b/fluid/panels/widget_panel/Grid_Child_Tab.fl @@ -0,0 +1,397 @@ +# data file for the Fltk User Interface Designer (fluid) +version 1.0500 +header_name {.h} +code_name {.cxx} +decl {\#include "widgets/Formula_Input.h"} {public global +} + +decl {\#include "Fluid.h"} {private global +} + +decl {\#include "proj/undo.h"} {private global +} + +decl {\#include "nodes/Grid_Node.h"} {private global +} + +decl {extern Grid_Child_Tab *widget_tab_grid_child;} {private global +} + +widget_class Grid_Child_Tab { + label Grid + callback propagate_load open + xywh {480 287 400 330} labelsize 11 resizable visible position_relative_rescale +} { + Fl_Group {} { + label {Location:} + callback propagate_load open + xywh {85 30 315 20} box FLAT_BOX labelfont 1 labelsize 11 align 4 + } { + Fl_Input widget_grid_row_input { + label {Row:} + callback {grid_child_cb(o, v, 8); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);} + xywh {85 30 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} {open + xywh {125 30 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_row_input, v, 0x0100 + 8); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {125 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_row_input, v, 0x0200 + 8); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {140 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Input widget_grid_col_input { + label {Column:} + callback {grid_child_cb(o, v, 9); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);} + xywh {165 30 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} {open + xywh {205 30 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_col_input, v, 0x0100 + 9); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {205 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_col_input, v, 0x0200 + 9); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {220 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Box {} { + xywh {385 30 1 20} hide resizable + } + Fl_Box widget_grid_transient { + label TRANSIENT + callback {if (v==LOAD) { + Fl_Widget *child = ((Widget_Node*)current_widget)->o; + Fl_Grid_Proxy *g = ((Fl_Grid_Proxy*)((Widget_Node*)current_widget->parent)->o); +// Fl_Grid::Cell *cell = g->cell(child); +// Fl_Grid::Cell *tcell = g->transient_cell(child); + widget_grid_transient->hide(); + widget_grid_unlinked->hide(); + if (g->transient_cell(child)) { + widget_grid_transient->show(); + } else if (!g->cell(child)) { + widget_grid_unlinked->show(); + } +}} + xywh {240 30 80 20} labelsize 11 labelcolor 1 + } + Fl_Box widget_grid_unlinked { + label UNLINKED + xywh {240 30 80 20} labelsize 11 labelcolor 1 hide + } + } + Fl_Group wp_gridc_align { + label {Align:} + callback propagate_load + xywh {85 70 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Choice {} { + label Horizontal + callback {if ( !current_widget + || !current_widget->parent + || !current_widget->parent->is_a(Type::Grid)) + { + return; + } + int mask = (FL_GRID_LEFT | FL_GRID_RIGHT | FL_GRID_HORIZONTAL); + Fl_Grid *g = ((Fl_Grid*)((Widget_Node*)current_widget->parent)->o); + if (v == LOAD) { + int a = FL_GRID_FILL & mask; + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + a = cell->align() & mask; + } + const Fl_Menu_Item *mi = o->find_item_with_argument(a); + if (mi) o->value(mi); + } else { + Fluid.proj.undo.checkpoint(); + int v = FL_GRID_FILL & mask, old_v = FL_GRID_FILL & mask; + const Fl_Menu_Item *mi = o->mvalue(); + if (mi) v = (int)mi->argument(); + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + old_v = cell->align() & mask; + if (old_v != v) { + cell->align((Fl_Grid_Align)(v | (cell->align() & ~mask))); + g->need_layout(true); + g->redraw(); + Fluid.proj.set_modflag(1); + } + } + }} open + xywh {85 70 115 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11 + } { + MenuItem GRID_LEFT { + label GRID_LEFT + user_data {(fl_intptr_t)FL_GRID_LEFT} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + MenuItem {} { + label GRID_CENTER + user_data {(fl_intptr_t)FL_GRID_CENTER} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + MenuItem {} { + label GRID_RIGHT + user_data {(fl_intptr_t)FL_GRID_RIGHT} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + MenuItem {} { + label GRID_FILL + user_data {(fl_intptr_t)FL_GRID_HORIZONTAL} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + } + Fl_Choice {} { + label Vertical + callback {if ( !current_widget + || !current_widget->parent + || !current_widget->parent->is_a(Type::Grid)) + { + return; + } + int mask = (FL_GRID_TOP | FL_GRID_BOTTOM | FL_GRID_VERTICAL); + Fl_Grid *g = ((Fl_Grid*)((Widget_Node*)current_widget->parent)->o); + if (v == LOAD) { + int a = FL_GRID_FILL & mask; + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + a = cell->align() & mask; + } + const Fl_Menu_Item *mi = o->find_item_with_argument(a); + if (mi) o->value(mi); + } else { + Fluid.proj.undo.checkpoint(); + int v = FL_GRID_FILL & mask, old_v = FL_GRID_FILL & mask; + const Fl_Menu_Item *mi = o->mvalue(); + if (mi) v = (int)mi->argument(); + Fl_Grid::Cell *cell = g->cell(current_widget->o); + if (cell) { + old_v = cell->align() & mask; + if (old_v != v) { + cell->align((Fl_Grid_Align)(v | (cell->align() & ~mask))); + g->need_layout(true); + g->redraw(); + Fluid.proj.set_modflag(1); + } + } + }} open selected + xywh {205 70 115 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11 + } { + MenuItem {} { + label GRID_TOP + user_data {(fl_intptr_t)FL_GRID_TOP} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + MenuItem {} { + label GRID_CENTER + user_data {(fl_intptr_t)FL_GRID_CENTER} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + MenuItem {} { + label GRID_BOTTOM + user_data {(fl_intptr_t)FL_GRID_BOTTOM} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + MenuItem {} { + label GRID_FILL + user_data {(fl_intptr_t)FL_GRID_VERTICAL} user_data_type long + xywh {20 20 31 20} labelsize 11 + } + } + Fl_Box {} { + xywh {385 70 1 20} hide resizable + } + } + Fl_Group wp_gridc_size { + label {Min. Size:} + callback propagate_load + xywh {85 105 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Input {} { + label {Width:} + callback {grid_child_cb(o, v, 12);} + xywh {85 105 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Input {} { + label {Height:} + callback {grid_child_cb(o, v, 13);} + xywh {145 105 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Box {} { + xywh {385 105 1 20} hide resizable + } + } + Fl_Group {} { + label {Span:} + callback propagate_load + xywh {85 140 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Input widget_grid_rowspan_input { + label {Row Span:} + callback {grid_child_cb(o, v, 10); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);} + xywh {85 140 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} {open + xywh {125 140 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_rowspan_input, v, 0x0100 + 10); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {125 140 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_rowspan_input, v, 0x0200 + 10); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {140 140 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Input widget_grid_colspan_input { + label {Col. Span:} + callback {grid_child_cb(o, v, 11); + if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD);} + xywh {165 140 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} {open + xywh {205 140 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_colspan_input, v, 0x0100 + 11); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {205 140 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v!=LOAD) { + grid_child_cb(widget_grid_colspan_input, v, 0x0200 + 11); + widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); + }} + xywh {220 140 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Box {} { + xywh {385 140 1 20} hide resizable + } + } + Fl_Box {} { + xywh {85 320 300 5} labelsize 11 hide resizable + } + Function {grid_child_cb(fld::widget::Formula_Input* i, void* v, int what)} {open return_type void + } { + code {if ( !current_widget + || !current_widget->parent + || !current_widget->parent->is_a(Type::Grid)) + { + return; + } + Fl_Widget *child = ((Widget_Node*)current_widget)->o; + Fl_Grid_Proxy *g = ((Fl_Grid_Proxy*)((Widget_Node*)current_widget->parent)->o); + Fl_Grid::Cell *cell = g->any_cell(child); + if (v == LOAD) { + int v = -1; + if (cell) { + switch (what & 0x00ff) { + case 8: v = cell->row(); break; + case 9: v = cell->col(); break; + case 10: v = cell->rowspan(); break; + case 11: v = cell->colspan(); break; + case 12: cell->minimum_size(&v, nullptr); break; + case 13: cell->minimum_size(nullptr, &v); break; + } + } + i->value(v); + } else { + Fluid.proj.undo.checkpoint(); + int v2 = -2, old_v = -2, v = i->value(); + if (i==widget_grid_row_input) v2 = widget_grid_col_input->value(); + if (i==widget_grid_col_input) v2 = widget_grid_row_input->value(); + Fl_Grid::Cell *new_cell = nullptr; + if (cell) { + switch (what & 0x00ff) { + case 8: old_v = cell->row(); v2 = cell->col(); break; + case 9: old_v = cell->col(); v2 = cell->row(); break; + case 10: old_v = cell->rowspan(); break; + case 11: old_v = cell->colspan(); break; + case 12: cell->minimum_size(&old_v, &v2); break; + case 13: cell->minimum_size(&v2, &old_v); break; + } + } + switch (what & 0xff00) { + case 0x0100: v--; break; + case 0x0200: v++; break; + } + if (old_v != v) { + switch (what & 0x00ff) { + case 8: + if (v2 == -1 && v >= 0) v2 = 0; + g->move_cell(current_widget->o, v, v2, 2); i->value(v); + break; + case 9: + if (v2 == -1 && v >= 0) v2 = 0; + g->move_cell(current_widget->o, v2, v, 2); i->value(v); + break; + case 10: if (cell && cell->row()+v<=g->rows() && v>0) cell->rowspan(v); + break; + case 11: if (cell && cell->col()+v<=g->cols() && v>0) cell->colspan(v); + break; + case 12: if (cell && v>=0) cell->minimum_size(v, v2); + break; + case 13: if (cell && v>=0) cell->minimum_size(v2, v); + break; + } + if (!cell && new_cell) + new_cell->minimum_size(20, 20); + g->need_layout(true); + Fluid.proj.set_modflag(1); + } + }} {} + } +} diff --git a/fluid/panels/widget_panel/Grid_Child_Tab.h b/fluid/panels/widget_panel/Grid_Child_Tab.h new file mode 100644 index 000000000..93cfda78b --- /dev/null +++ b/fluid/panels/widget_panel/Grid_Child_Tab.h @@ -0,0 +1,79 @@ +// generated by Fast Light User Interface Designer (fluid) version 1.0500 + +#ifndef Grid_Child_Tab_h +#define Grid_Child_Tab_h +#include +#include "widgets/Formula_Input.h" +#include +extern void propagate_load(Fl_Group*, void*); +#include +#include +#include + +class Grid_Child_Tab : public Fl_Group { +public: + Grid_Child_Tab(int X, int Y, int W, int H, const char *L = 0); + fld::widget::Formula_Input *widget_grid_row_input; +private: + inline void cb_widget_grid_row_input_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_row_input(fld::widget::Formula_Input*, void*); + inline void cb__i(Fl_Button*, void*); + static void cb_(Fl_Button*, void*); + inline void cb_1_i(Fl_Button*, void*); + static void cb_1(Fl_Button*, void*); +public: + fld::widget::Formula_Input *widget_grid_col_input; +private: + inline void cb_widget_grid_col_input_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_col_input(fld::widget::Formula_Input*, void*); + inline void cb_2_i(Fl_Button*, void*); + static void cb_2(Fl_Button*, void*); + inline void cb_3_i(Fl_Button*, void*); + static void cb_3(Fl_Button*, void*); +public: + Fl_Box *widget_grid_transient; +private: + inline void cb_widget_grid_transient_i(Fl_Box*, void*); + static void cb_widget_grid_transient(Fl_Box*, void*); +public: + Fl_Box *widget_grid_unlinked; + Fl_Group *wp_gridc_align; +private: + inline void cb_Horizontal_i(Fl_Choice*, void*); + static void cb_Horizontal(Fl_Choice*, void*); + static Fl_Menu_Item menu_Horizontal[]; +public: + static Fl_Menu_Item *GRID_LEFT; +private: + inline void cb_Vertical_i(Fl_Choice*, void*); + static void cb_Vertical(Fl_Choice*, void*); + static Fl_Menu_Item menu_Vertical[]; +public: + Fl_Group *wp_gridc_size; +private: + inline void cb_Width_i(fld::widget::Formula_Input*, void*); + static void cb_Width(fld::widget::Formula_Input*, void*); + inline void cb_Height_i(fld::widget::Formula_Input*, void*); + static void cb_Height(fld::widget::Formula_Input*, void*); +public: + fld::widget::Formula_Input *widget_grid_rowspan_input; +private: + inline void cb_widget_grid_rowspan_input_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_rowspan_input(fld::widget::Formula_Input*, void*); + inline void cb_4_i(Fl_Button*, void*); + static void cb_4(Fl_Button*, void*); + inline void cb_5_i(Fl_Button*, void*); + static void cb_5(Fl_Button*, void*); +public: + fld::widget::Formula_Input *widget_grid_colspan_input; +private: + inline void cb_widget_grid_colspan_input_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_colspan_input(fld::widget::Formula_Input*, void*); + inline void cb_6_i(Fl_Button*, void*); + static void cb_6(Fl_Button*, void*); + inline void cb_7_i(Fl_Button*, void*); + static void cb_7(Fl_Button*, void*); +public: + void grid_child_cb(fld::widget::Formula_Input* i, void* v, int what); +}; +#endif diff --git a/fluid/panels/widget_panel/Grid_Tab.cxx b/fluid/panels/widget_panel/Grid_Tab.cxx new file mode 100644 index 000000000..756d957ac --- /dev/null +++ b/fluid/panels/widget_panel/Grid_Tab.cxx @@ -0,0 +1,778 @@ +// generated by Fast Light User Interface Designer (fluid) version 1.0500 + +#include "Grid_Tab.h" +#include "Fluid.h" +#include "proj/undo.h" +#include "nodes/Grid_Node.h" +extern Grid_Tab *widget_tab_grid; + +void Grid_Tab::cb_widget_grid_rows_i(fld::widget::Formula_Input* o, void* v) { + // grid_rows_cb + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + if (v == LOAD) { + o->value(grid->rows()); + } else { + int m = o->value(), old_m = grid->rows(); + if (m < 1) { + m = 1; + o->value(m); + } + if (m < old_m) { + // TODO: verify that this will not unlink existings cells + // Offer a dialog with "delete children", "unlink cells", "cancel" + } + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->layout(m, grid->cols()); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + widget_tab_grid->do_callback(widget_tab_grid, LOAD); + } + } +} +void Grid_Tab::cb_widget_grid_rows(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_widget_grid_rows_i(o,v); +} + +void Grid_Tab::cb__i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_rows->value( widget_grid_rows->value()-1 ); + widget_grid_rows->do_callback(); + } +} +void Grid_Tab::cb_(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb__i(o,v); +} + +void Grid_Tab::cb_1_i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_rows->value( widget_grid_rows->value()+1 ); + widget_grid_rows->do_callback(); + } +} +void Grid_Tab::cb_1(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_1_i(o,v); +} + +void Grid_Tab::cb_widget_grid_cols_i(fld::widget::Formula_Input* o, void* v) { + // grid_rows_cb + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + if (v == LOAD) { + o->value(grid->cols()); + } else { + int m = o->value(), old_m = grid->cols(); + if (m < 1) { + m = 1; + o->value(m); + } + if (m < old_m) { + // TODO: verify that this will not unlink existings cells + // Offer a dialog with "delete children", "unlink cells", "cancel" + } + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->layout(grid->rows(), m); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + widget_tab_grid->do_callback(widget_tab_grid, LOAD); + } + } +} +void Grid_Tab::cb_widget_grid_cols(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_widget_grid_cols_i(o,v); +} + +void Grid_Tab::cb_2_i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_cols->value( widget_grid_cols->value()-1 ); + widget_grid_cols->do_callback(); + } +} +void Grid_Tab::cb_2(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_2_i(o,v); +} + +void Grid_Tab::cb_3_i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_cols->value( widget_grid_cols->value()+1 ); + widget_grid_cols->do_callback(); + } +} +void Grid_Tab::cb_3(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_3_i(o,v); +} + +void Grid_Tab::cb_Left_i(Fl_Value_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int m = 0; + if (v == LOAD) { + grid->margin(&m, nullptr, nullptr, nullptr); + o->value(m); + } else { + int m = (int)o->value(), old_m; + grid->margin(&old_m, nullptr, nullptr, nullptr); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(m, -1, -1, -1); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Left(Fl_Value_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_Left_i(o,v); +} + +void Grid_Tab::cb_Top_i(Fl_Value_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int m = 0; + if (v == LOAD) { + grid->margin(nullptr, &m, nullptr, nullptr); + o->value(m); + } else { + int m = (int)o->value(), old_m; + grid->margin(nullptr, &old_m, nullptr, nullptr); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(-1, m, -1, -1); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Top(Fl_Value_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_Top_i(o,v); +} + +void Grid_Tab::cb_Right_i(Fl_Value_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int m = 0; + if (v == LOAD) { + grid->margin(nullptr, nullptr, &m, nullptr); + o->value(m); + } else { + int m = (int)o->value(), old_m; + grid->margin(nullptr, nullptr, &old_m, nullptr); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(-1, -1, m, -1); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Right(Fl_Value_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_Right_i(o,v); +} + +void Grid_Tab::cb_Bottom_i(Fl_Value_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int m = 0; + if (v == LOAD) { + grid->margin(nullptr, nullptr, nullptr, &m); + o->value(m); + } else { + int m = (int)o->value(), old_m; + grid->margin(nullptr, nullptr, nullptr, &old_m); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(-1, -1, -1, m); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Bottom(Fl_Value_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_Bottom_i(o,v); +} + +void Grid_Tab::cb_Row_i(Fl_Value_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + if (v == LOAD) { + int m = 0; + grid->gap(&m, nullptr); + o->value(m); + } else { + int m = (int)o->value(), old_m, m2; + grid->gap(&old_m, &m2); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->gap(m, m2); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Row(Fl_Value_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_Row_i(o,v); +} + +void Grid_Tab::cb_Col_i(Fl_Value_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + if (v == LOAD) { + int m = 0; + grid->gap(nullptr, &m); + o->value(m); + } else { + int m = (int)o->value(), old_m, m2; + grid->gap(&m2, &old_m); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->gap(m2, m); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Col(Fl_Value_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_Col_i(o,v); +} + +void Grid_Tab::cb_Row1_i(Fl_Group* o, void* v) { + if (v == LOAD) { + Fl_Grid *grid = Grid_Node::selected(); + if (grid) + o->activate(); + else + o->deactivate(); + propagate_load(o, v); + } +} +void Grid_Tab::cb_Row1(Fl_Group* o, void* v) { + ((Grid_Tab*)(o->parent()))->cb_Row1_i(o,v); +} + +void Grid_Tab::cb_widget_grid_curr_row_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int r = o->value(), old_r = r; + if (r < 0) r = 0; + if (r >= grid->rows()) r = grid->rows()-1; + if (r != old_r) o->value(r); + if (v == LOAD) { + // will automatically propagate + } else { + widget_grid_curr_row_attributes->do_callback(widget_grid_curr_row_attributes, LOAD); + } +} +void Grid_Tab::cb_widget_grid_curr_row(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_widget_grid_curr_row_i(o,v); +} + +void Grid_Tab::cb_4_i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_curr_row->value( widget_grid_curr_row->value()-1 ); + widget_grid_curr_row->do_callback(); + } +} +void Grid_Tab::cb_4(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_4_i(o,v); +} + +void Grid_Tab::cb_5_i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_curr_row->value( widget_grid_curr_row->value()+1 ); + widget_grid_curr_row->do_callback(); + } +} +void Grid_Tab::cb_5(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_5_i(o,v); +} + +void Grid_Tab::cb_Height_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int r = widget_grid_curr_row->value(); + if (v == LOAD) { + o->value(grid->row_height(r)); + } else { + int h = o->value(), old_h = grid->row_height(r); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->row_height(r, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Height(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_Height_i(o,v); +} + +void Grid_Tab::cb_Weight_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int r = widget_grid_curr_row->value(); + if (v == LOAD) { + o->value(grid->row_weight(r)); + } else { + int h = o->value(), old_h = grid->row_weight(r); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->row_weight(r, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Weight(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_Weight_i(o,v); +} + +void Grid_Tab::cb_Gap_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int r = widget_grid_curr_row->value(); + if (v == LOAD) { + o->value(grid->row_gap(r)); + } else { + int h = o->value(), old_h = grid->row_gap(r); + if (h < -1) h = -1; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->row_gap(r, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Gap(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_Gap_i(o,v); +} + +void Grid_Tab::cb_widget_grid_curr_col_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int c = o->value(), old_c = c; + if (c < 0) c = 0; + if (c >= grid->cols()) c = grid->cols()-1; + if (c != old_c) o->value(c); + if (v == LOAD) { + // will automatically propagate + } else { + widget_grid_curr_col_attributes->do_callback(widget_grid_curr_col_attributes, LOAD); + } +} +void Grid_Tab::cb_widget_grid_curr_col(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()))->cb_widget_grid_curr_col_i(o,v); +} + +void Grid_Tab::cb_6_i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_curr_col->value( widget_grid_curr_col->value()-1 ); + widget_grid_curr_col->do_callback(); + } +} +void Grid_Tab::cb_6(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_6_i(o,v); +} + +void Grid_Tab::cb_7_i(Fl_Button*, void* v) { + if (v != LOAD) { + widget_grid_curr_col->value( widget_grid_curr_col->value()+1 ); + widget_grid_curr_col->do_callback(); + } +} +void Grid_Tab::cb_7(Fl_Button* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_7_i(o,v); +} + +void Grid_Tab::cb_Width_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int c = widget_grid_curr_col->value(); + if (v == LOAD) { + o->value(grid->col_width(c)); + } else { + int h = o->value(), old_h = grid->col_width(c); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->col_width(c, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Width(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_Width_i(o,v); +} + +void Grid_Tab::cb_Weight1_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int c = widget_grid_curr_col->value(); + if (v == LOAD) { + o->value(grid->col_weight(c)); + } else { + int h = o->value(), old_h = grid->col_weight(c); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->col_weight(c, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Weight1(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_Weight1_i(o,v); +} + +void Grid_Tab::cb_Gap1_i(fld::widget::Formula_Input* o, void* v) { + Fl_Grid *grid = Grid_Node::selected(); + if (!grid) return; + int c = widget_grid_curr_col->value(); + if (v == LOAD) { + o->value(grid->col_gap(c)); + } else { + int h = o->value(), old_h = grid->col_gap(c); + if (h < -1) h = -1; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->col_gap(c, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } + } +} +void Grid_Tab::cb_Gap1(fld::widget::Formula_Input* o, void* v) { + ((Grid_Tab*)(o->parent()->parent()->parent()))->cb_Gap1_i(o,v); +} + +Grid_Tab::Grid_Tab(int X, int Y, int W, int H, const char *L) : + Fl_Group(0, 0, 400, 330, L) +{ + this->labelsize(11); + this->callback((Fl_Callback*)propagate_load); + { Fl_Group* o = new Fl_Group(85, 30, 315, 20, "Grid Layout:"); + o->labelfont(1); + o->labelsize(11); + o->callback((Fl_Callback*)propagate_load); + o->align(Fl_Align(FL_ALIGN_LEFT)); + { widget_grid_rows = new fld::widget::Formula_Input(85, 30, 40, 20, "Rows:"); + widget_grid_rows->tooltip("Number of horizontal rows in the Grid group"); + widget_grid_rows->box(FL_DOWN_BOX); + widget_grid_rows->color(FL_BACKGROUND2_COLOR); + widget_grid_rows->selection_color(FL_SELECTION_COLOR); + widget_grid_rows->labeltype(FL_NORMAL_LABEL); + widget_grid_rows->labelfont(0); + widget_grid_rows->labelsize(11); + widget_grid_rows->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_rows->textsize(11); + widget_grid_rows->callback((Fl_Callback*)cb_widget_grid_rows); + widget_grid_rows->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_rows->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_rows + { Fl_Group* o = new Fl_Group(125, 30, 30, 20); + { Fl_Button* o = new Fl_Button(125, 30, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(140, 30, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_1); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { widget_grid_cols = new fld::widget::Formula_Input(165, 30, 40, 20, "Columns:"); + widget_grid_cols->tooltip("Number of vertical columns in the Grid group"); + widget_grid_cols->box(FL_DOWN_BOX); + widget_grid_cols->color(FL_BACKGROUND2_COLOR); + widget_grid_cols->selection_color(FL_SELECTION_COLOR); + widget_grid_cols->labeltype(FL_NORMAL_LABEL); + widget_grid_cols->labelfont(0); + widget_grid_cols->labelsize(11); + widget_grid_cols->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_cols->textsize(11); + widget_grid_cols->callback((Fl_Callback*)cb_widget_grid_cols); + widget_grid_cols->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_cols->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_cols + { Fl_Group* o = new Fl_Group(205, 30, 30, 20); + { Fl_Button* o = new Fl_Button(205, 30, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_2); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(220, 30, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_3); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { Fl_Box* o = new Fl_Box(386, 30, 0, 20); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + o->end(); + } // Fl_Group* o + { wp_grid_margin = new Fl_Group(85, 70, 315, 20, "Margins:"); + wp_grid_margin->labelfont(1); + wp_grid_margin->labelsize(11); + wp_grid_margin->callback((Fl_Callback*)propagate_load); + wp_grid_margin->align(Fl_Align(FL_ALIGN_LEFT)); + { Fl_Value_Input* o = new Fl_Value_Input(85, 70, 55, 20, "Left:"); + o->tooltip("Left margin in group."); + o->labelsize(11); + o->maximum(1000); + o->step(1); + o->textsize(11); + o->callback((Fl_Callback*)cb_Left); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + } // Fl_Value_Input* o + { Fl_Value_Input* o = new Fl_Value_Input(145, 70, 55, 20, "Top:"); + o->tooltip("Top margin in group."); + o->labelsize(11); + o->maximum(1000); + o->step(1); + o->textsize(11); + o->callback((Fl_Callback*)cb_Top); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + } // Fl_Value_Input* o + { Fl_Value_Input* o = new Fl_Value_Input(205, 70, 55, 20, "Right:"); + o->tooltip("Right margin in group."); + o->labelsize(11); + o->maximum(1000); + o->step(1); + o->textsize(11); + o->callback((Fl_Callback*)cb_Right); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + } // Fl_Value_Input* o + { Fl_Value_Input* o = new Fl_Value_Input(265, 70, 55, 20, "Bottom:"); + o->tooltip("Bottom margin in group."); + o->labelsize(11); + o->maximum(1000); + o->step(1); + o->textsize(11); + o->callback((Fl_Callback*)cb_Bottom); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + } // Fl_Value_Input* o + { Fl_Box* o = new Fl_Box(386, 70, 0, 20); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + wp_grid_margin->end(); + } // Fl_Group* wp_grid_margin + { wp_grid_gaps = new Fl_Group(85, 105, 315, 20, "Gaps:"); + wp_grid_gaps->labelfont(1); + wp_grid_gaps->labelsize(11); + wp_grid_gaps->callback((Fl_Callback*)propagate_load); + wp_grid_gaps->align(Fl_Align(FL_ALIGN_LEFT)); + { Fl_Value_Input* o = new Fl_Value_Input(85, 105, 55, 20, "Row:"); + o->tooltip("Gap between children."); + o->labelsize(11); + o->maximum(1000); + o->step(1); + o->textsize(11); + o->callback((Fl_Callback*)cb_Row); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + } // Fl_Value_Input* o + { Fl_Value_Input* o = new Fl_Value_Input(145, 105, 55, 20, "Col:"); + o->tooltip("Gap between children."); + o->labelsize(11); + o->maximum(1000); + o->step(1); + o->textsize(11); + o->callback((Fl_Callback*)cb_Col); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + } // Fl_Value_Input* o + { Fl_Box* o = new Fl_Box(386, 105, 0, 20); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + wp_grid_gaps->end(); + } // Fl_Group* wp_grid_gaps + { Fl_Group* o = new Fl_Group(85, 145, 315, 20, "Row:"); + o->labelfont(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_Row1); + o->align(Fl_Align(FL_ALIGN_LEFT)); + { widget_grid_curr_row = new fld::widget::Formula_Input(85, 145, 40, 20, "Index"); + widget_grid_curr_row->box(FL_DOWN_BOX); + widget_grid_curr_row->color(FL_BACKGROUND2_COLOR); + widget_grid_curr_row->selection_color(FL_SELECTION_COLOR); + widget_grid_curr_row->labeltype(FL_NORMAL_LABEL); + widget_grid_curr_row->labelfont(0); + widget_grid_curr_row->labelsize(11); + widget_grid_curr_row->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_curr_row->textsize(11); + widget_grid_curr_row->callback((Fl_Callback*)cb_widget_grid_curr_row); + widget_grid_curr_row->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_curr_row->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_curr_row + { Fl_Group* o = new Fl_Group(125, 145, 30, 20); + o->callback((Fl_Callback*)propagate_load); + { Fl_Button* o = new Fl_Button(125, 145, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_4); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(140, 145, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_5); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { Fl_Box* o = new Fl_Box(155, 145, 15, 20, ":"); + o->labelsize(11); + } // Fl_Box* o + { widget_grid_curr_row_attributes = new Fl_Group(170, 145, 175, 20); + widget_grid_curr_row_attributes->callback((Fl_Callback*)propagate_load); + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(170, 145, 55, 20, "Height:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Height); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(230, 145, 55, 20, "Weight:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Weight); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(290, 145, 55, 20, "Gap:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Gap); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + widget_grid_curr_row_attributes->end(); + } // Fl_Group* widget_grid_curr_row_attributes + { Fl_Box* o = new Fl_Box(390, 145, 1, 20); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + o->end(); + } // Fl_Group* o + { Fl_Group* o = new Fl_Group(85, 180, 315, 20, "Column:"); + o->labelfont(1); + o->labelsize(11); + o->callback((Fl_Callback*)propagate_load); + o->align(Fl_Align(FL_ALIGN_LEFT)); + { widget_grid_curr_col = new fld::widget::Formula_Input(85, 180, 40, 20, "Index"); + widget_grid_curr_col->box(FL_DOWN_BOX); + widget_grid_curr_col->color(FL_BACKGROUND2_COLOR); + widget_grid_curr_col->selection_color(FL_SELECTION_COLOR); + widget_grid_curr_col->labeltype(FL_NORMAL_LABEL); + widget_grid_curr_col->labelfont(0); + widget_grid_curr_col->labelsize(11); + widget_grid_curr_col->labelcolor(FL_FOREGROUND_COLOR); + widget_grid_curr_col->textsize(11); + widget_grid_curr_col->callback((Fl_Callback*)cb_widget_grid_curr_col); + widget_grid_curr_col->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + widget_grid_curr_col->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* widget_grid_curr_col + { Fl_Group* o = new Fl_Group(125, 180, 30, 20); + { Fl_Button* o = new Fl_Button(125, 180, 15, 20, "-"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_6); + o->clear_visible_focus(); + } // Fl_Button* o + { Fl_Button* o = new Fl_Button(140, 180, 15, 20, "+"); + o->compact(1); + o->labelsize(11); + o->callback((Fl_Callback*)cb_7); + o->clear_visible_focus(); + } // Fl_Button* o + o->end(); + } // Fl_Group* o + { Fl_Box* o = new Fl_Box(155, 180, 15, 20, ":"); + o->labelsize(11); + } // Fl_Box* o + { widget_grid_curr_col_attributes = new Fl_Group(170, 180, 175, 20); + widget_grid_curr_col_attributes->callback((Fl_Callback*)propagate_load); + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(170, 180, 55, 20, "Width:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Width); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(230, 180, 55, 20, "Weight:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Weight1); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + { fld::widget::Formula_Input* o = new fld::widget::Formula_Input(290, 180, 55, 20, "Gap:"); + o->box(FL_DOWN_BOX); + o->color(FL_BACKGROUND2_COLOR); + o->selection_color(FL_SELECTION_COLOR); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(11); + o->labelcolor(FL_FOREGROUND_COLOR); + o->textsize(11); + o->callback((Fl_Callback*)cb_Gap1); + o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + o->when(FL_WHEN_RELEASE); + } // fld::widget::Formula_Input* o + widget_grid_curr_col_attributes->end(); + } // Fl_Group* widget_grid_curr_col_attributes + { Fl_Box* o = new Fl_Box(390, 180, 1, 20); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + o->end(); + } // Fl_Group* o + { Fl_Box* o = new Fl_Box(85, 320, 300, 5); + o->labelsize(11); + o->hide(); + Fl_Group::current()->resizable(o); + } // Fl_Box* o + end(); + resize(X, Y, W, H); +} diff --git a/fluid/panels/widget_panel/Grid_Tab.fl b/fluid/panels/widget_panel/Grid_Tab.fl new file mode 100644 index 000000000..e37610ca5 --- /dev/null +++ b/fluid/panels/widget_panel/Grid_Tab.fl @@ -0,0 +1,515 @@ +# data file for the Fltk User Interface Designer (fluid) +version 1.0500 +header_name {.h} +code_name {.cxx} +decl {\#include "widgets/Formula_Input.h"} {public global +} + +decl {\#include "Fluid.h"} {private global +} + +decl {\#include "proj/undo.h"} {private global +} + +decl {\#include "nodes/Grid_Node.h"} {private global +} + +decl {extern Grid_Tab *widget_tab_grid;} {selected private global +} + +widget_class Grid_Tab { + label Grid + callback propagate_load open + xywh {480 287 400 330} labelsize 11 resizable visible position_relative_rescale +} { + Fl_Group {} { + label {Grid Layout:} + callback propagate_load open + xywh {85 30 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Input widget_grid_rows { + label {Rows:} + callback {// grid_rows_cb +Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +if (v == LOAD) { + o->value(grid->rows()); +} else { + int m = o->value(), old_m = grid->rows(); + if (m < 1) { + m = 1; + o->value(m); + } + if (m < old_m) { + // TODO: verify that this will not unlink existings cells + // Offer a dialog with "delete children", "unlink cells", "cancel" + } + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->layout(m, grid->cols()); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + widget_tab_grid->do_callback(widget_tab_grid, LOAD); + } +}} + tooltip {Number of horizontal rows in the Grid group} xywh {85 30 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} {open + xywh {125 30 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v != LOAD) { + widget_grid_rows->value( widget_grid_rows->value()-1 ); + widget_grid_rows->do_callback(); +}} + xywh {125 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v != LOAD) { + widget_grid_rows->value( widget_grid_rows->value()+1 ); + widget_grid_rows->do_callback(); +}} + xywh {140 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Input widget_grid_cols { + label {Columns:} + callback {// grid_rows_cb +Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +if (v == LOAD) { + o->value(grid->cols()); +} else { + int m = o->value(), old_m = grid->cols(); + if (m < 1) { + m = 1; + o->value(m); + } + if (m < old_m) { + // TODO: verify that this will not unlink existings cells + // Offer a dialog with "delete children", "unlink cells", "cancel" + } + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->layout(grid->rows(), m); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + widget_tab_grid->do_callback(widget_tab_grid, LOAD); + } +}} + tooltip {Number of vertical columns in the Grid group} xywh {165 30 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} {open + xywh {205 30 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v != LOAD) { + widget_grid_cols->value( widget_grid_cols->value()-1 ); + widget_grid_cols->do_callback(); +}} + xywh {205 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v != LOAD) { + widget_grid_cols->value( widget_grid_cols->value()+1 ); + widget_grid_cols->do_callback(); +}} + xywh {220 30 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Box {} { + xywh {386 30 0 20} resizable + } + } + Fl_Group wp_grid_margin { + label {Margins:} + callback propagate_load open + xywh {85 70 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Value_Input {} { + label {Left:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int m = 0; +if (v == LOAD) { + grid->margin(&m, nullptr, nullptr, nullptr); + o->value(m); +} else { + int m = (int)o->value(), old_m; + grid->margin(&old_m, nullptr, nullptr, nullptr); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(m, -1, -1, -1); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + tooltip {Left margin in group.} xywh {85 70 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 + } + Fl_Value_Input {} { + label {Top:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int m = 0; +if (v == LOAD) { + grid->margin(nullptr, &m, nullptr, nullptr); + o->value(m); +} else { + int m = (int)o->value(), old_m; + grid->margin(nullptr, &old_m, nullptr, nullptr); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(-1, m, -1, -1); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + tooltip {Top margin in group.} xywh {145 70 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 + } + Fl_Value_Input {} { + label {Right:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int m = 0; +if (v == LOAD) { + grid->margin(nullptr, nullptr, &m, nullptr); + o->value(m); +} else { + int m = (int)o->value(), old_m; + grid->margin(nullptr, nullptr, &old_m, nullptr); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(-1, -1, m, -1); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + tooltip {Right margin in group.} xywh {205 70 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 + } + Fl_Value_Input {} { + label {Bottom:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int m = 0; +if (v == LOAD) { + grid->margin(nullptr, nullptr, nullptr, &m); + o->value(m); +} else { + int m = (int)o->value(), old_m; + grid->margin(nullptr, nullptr, nullptr, &old_m); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->margin(-1, -1, -1, m); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + tooltip {Bottom margin in group.} xywh {265 70 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 + } + Fl_Box {} { + xywh {386 70 0 20} resizable + } + } + Fl_Group wp_grid_gaps { + label {Gaps:} + callback propagate_load open + xywh {85 105 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Value_Input {} { + label {Row:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +if (v == LOAD) { + int m = 0; + grid->gap(&m, nullptr); + o->value(m); +} else { + int m = (int)o->value(), old_m, m2; + grid->gap(&old_m, &m2); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->gap(m, m2); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + tooltip {Gap between children.} xywh {85 105 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 + } + Fl_Value_Input {} { + label {Col:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +if (v == LOAD) { + int m = 0; + grid->gap(nullptr, &m); + o->value(m); +} else { + int m = (int)o->value(), old_m, m2; + grid->gap(&m2, &old_m); + if (m != old_m) { + Fluid.proj.undo.checkpoint(); + grid->gap(m2, m); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + tooltip {Gap between children.} xywh {145 105 55 20} labelsize 11 align 5 maximum 1000 step 1 textsize 11 + } + Fl_Box {} { + xywh {386 105 0 20} resizable + } + } + Fl_Group {} { + label {Row:} + callback {if (v == LOAD) { + Fl_Grid *grid = Grid_Node::selected(); + if (grid) + o->activate(); + else + o->deactivate(); + propagate_load(o, v); +}} open + xywh {85 145 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Input widget_grid_curr_row { + label Index + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int r = o->value(), old_r = r; +if (r < 0) r = 0; +if (r >= grid->rows()) r = grid->rows()-1; +if (r != old_r) o->value(r); +if (v == LOAD) { + // will automatically propagate +} else { + widget_grid_curr_row_attributes->do_callback(widget_grid_curr_row_attributes, LOAD); +}} + xywh {85 145 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} { + callback propagate_load open + xywh {125 145 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v != LOAD) { + widget_grid_curr_row->value( widget_grid_curr_row->value()-1 ); + widget_grid_curr_row->do_callback(); +}} + xywh {125 145 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v != LOAD) { + widget_grid_curr_row->value( widget_grid_curr_row->value()+1 ); + widget_grid_curr_row->do_callback(); +}} + xywh {140 145 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Box {} { + label {:} + xywh {155 145 15 20} labelsize 11 + } + Fl_Group widget_grid_curr_row_attributes { + callback propagate_load open + xywh {170 145 175 20} + } { + Fl_Input {} { + label {Height:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int r = widget_grid_curr_row->value(); +if (v == LOAD) { + o->value(grid->row_height(r)); +} else { + int h = o->value(), old_h = grid->row_height(r); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->row_height(r, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + xywh {170 145 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Input {} { + label {Weight:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int r = widget_grid_curr_row->value(); +if (v == LOAD) { + o->value(grid->row_weight(r)); +} else { + int h = o->value(), old_h = grid->row_weight(r); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->row_weight(r, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + xywh {230 145 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Input {} { + label {Gap:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int r = widget_grid_curr_row->value(); +if (v == LOAD) { + o->value(grid->row_gap(r)); +} else { + int h = o->value(), old_h = grid->row_gap(r); + if (h < -1) h = -1; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->row_gap(r, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + xywh {290 145 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + } + Fl_Box {} { + xywh {390 145 1 20} hide resizable + } + } + Fl_Group {} { + label {Column:} + callback propagate_load open + xywh {85 180 315 20} labelfont 1 labelsize 11 align 4 + } { + Fl_Input widget_grid_curr_col { + label Index + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int c = o->value(), old_c = c; +if (c < 0) c = 0; +if (c >= grid->cols()) c = grid->cols()-1; +if (c != old_c) o->value(c); +if (v == LOAD) { + // will automatically propagate +} else { + widget_grid_curr_col_attributes->do_callback(widget_grid_curr_col_attributes, LOAD); +}} + xywh {85 180 40 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Group {} {open + xywh {125 180 30 20} + } { + Fl_Button {} { + label {-} + callback {if (v != LOAD) { + widget_grid_curr_col->value( widget_grid_curr_col->value()-1 ); + widget_grid_curr_col->do_callback(); +}} + xywh {125 180 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + Fl_Button {} { + label {+} + callback {if (v != LOAD) { + widget_grid_curr_col->value( widget_grid_curr_col->value()+1 ); + widget_grid_curr_col->do_callback(); +}} + xywh {140 180 15 20} labelsize 11 + code0 {o->clear_visible_focus();} compact 1 + } + } + Fl_Box {} { + label {:} + xywh {155 180 15 20} labelsize 11 + } + Fl_Group widget_grid_curr_col_attributes { + callback propagate_load open + xywh {170 180 175 20} + } { + Fl_Input {} { + label {Width:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int c = widget_grid_curr_col->value(); +if (v == LOAD) { + o->value(grid->col_width(c)); +} else { + int h = o->value(), old_h = grid->col_width(c); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->col_width(c, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + xywh {170 180 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Input {} { + label {Weight:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int c = widget_grid_curr_col->value(); +if (v == LOAD) { + o->value(grid->col_weight(c)); +} else { + int h = o->value(), old_h = grid->col_weight(c); + if (h < 0) h = 0; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->col_weight(c, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + xywh {230 180 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + Fl_Input {} { + label {Gap:} + callback {Fl_Grid *grid = Grid_Node::selected(); +if (!grid) return; +int c = widget_grid_curr_col->value(); +if (v == LOAD) { + o->value(grid->col_gap(c)); +} else { + int h = o->value(), old_h = grid->col_gap(c); + if (h < -1) h = -1; + if (h != old_h) { + Fluid.proj.undo.checkpoint(); + grid->col_gap(c, h); + grid->need_layout(true); + Fluid.proj.set_modflag(1); + } +}} + xywh {290 180 55 20} labelsize 11 align 5 textsize 11 + class {fld::widget::Formula_Input} + } + } + Fl_Box {} { + xywh {390 180 1 20} hide resizable + } + } + Fl_Box {} { + xywh {85 320 300 5} labelsize 11 hide resizable + } +} diff --git a/fluid/panels/widget_panel/Grid_Tab.h b/fluid/panels/widget_panel/Grid_Tab.h new file mode 100644 index 000000000..4b06a9e43 --- /dev/null +++ b/fluid/panels/widget_panel/Grid_Tab.h @@ -0,0 +1,90 @@ +// generated by Fast Light User Interface Designer (fluid) version 1.0500 + +#ifndef Grid_Tab_h +#define Grid_Tab_h +#include +#include "widgets/Formula_Input.h" +#include +extern void propagate_load(Fl_Group*, void*); +#include +#include +#include + +class Grid_Tab : public Fl_Group { +public: + Grid_Tab(int X, int Y, int W, int H, const char *L = 0); + fld::widget::Formula_Input *widget_grid_rows; +private: + inline void cb_widget_grid_rows_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_rows(fld::widget::Formula_Input*, void*); + inline void cb__i(Fl_Button*, void*); + static void cb_(Fl_Button*, void*); + inline void cb_1_i(Fl_Button*, void*); + static void cb_1(Fl_Button*, void*); +public: + fld::widget::Formula_Input *widget_grid_cols; +private: + inline void cb_widget_grid_cols_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_cols(fld::widget::Formula_Input*, void*); + inline void cb_2_i(Fl_Button*, void*); + static void cb_2(Fl_Button*, void*); + inline void cb_3_i(Fl_Button*, void*); + static void cb_3(Fl_Button*, void*); +public: + Fl_Group *wp_grid_margin; +private: + inline void cb_Left_i(Fl_Value_Input*, void*); + static void cb_Left(Fl_Value_Input*, void*); + inline void cb_Top_i(Fl_Value_Input*, void*); + static void cb_Top(Fl_Value_Input*, void*); + inline void cb_Right_i(Fl_Value_Input*, void*); + static void cb_Right(Fl_Value_Input*, void*); + inline void cb_Bottom_i(Fl_Value_Input*, void*); + static void cb_Bottom(Fl_Value_Input*, void*); +public: + Fl_Group *wp_grid_gaps; +private: + inline void cb_Row_i(Fl_Value_Input*, void*); + static void cb_Row(Fl_Value_Input*, void*); + inline void cb_Col_i(Fl_Value_Input*, void*); + static void cb_Col(Fl_Value_Input*, void*); + inline void cb_Row1_i(Fl_Group*, void*); + static void cb_Row1(Fl_Group*, void*); +public: + fld::widget::Formula_Input *widget_grid_curr_row; +private: + inline void cb_widget_grid_curr_row_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_curr_row(fld::widget::Formula_Input*, void*); + inline void cb_4_i(Fl_Button*, void*); + static void cb_4(Fl_Button*, void*); + inline void cb_5_i(Fl_Button*, void*); + static void cb_5(Fl_Button*, void*); +public: + Fl_Group *widget_grid_curr_row_attributes; +private: + inline void cb_Height_i(fld::widget::Formula_Input*, void*); + static void cb_Height(fld::widget::Formula_Input*, void*); + inline void cb_Weight_i(fld::widget::Formula_Input*, void*); + static void cb_Weight(fld::widget::Formula_Input*, void*); + inline void cb_Gap_i(fld::widget::Formula_Input*, void*); + static void cb_Gap(fld::widget::Formula_Input*, void*); +public: + fld::widget::Formula_Input *widget_grid_curr_col; +private: + inline void cb_widget_grid_curr_col_i(fld::widget::Formula_Input*, void*); + static void cb_widget_grid_curr_col(fld::widget::Formula_Input*, void*); + inline void cb_6_i(Fl_Button*, void*); + static void cb_6(Fl_Button*, void*); + inline void cb_7_i(Fl_Button*, void*); + static void cb_7(Fl_Button*, void*); +public: + Fl_Group *widget_grid_curr_col_attributes; +private: + inline void cb_Width_i(fld::widget::Formula_Input*, void*); + static void cb_Width(fld::widget::Formula_Input*, void*); + inline void cb_Weight1_i(fld::widget::Formula_Input*, void*); + static void cb_Weight1(fld::widget::Formula_Input*, void*); + inline void cb_Gap1_i(fld::widget::Formula_Input*, void*); + static void cb_Gap1(fld::widget::Formula_Input*, void*); +}; +#endif -- cgit v1.2.3