diff --git a/fluid/CMakeLists.txt b/fluid/CMakeLists.txt index afde756aa03db058874b6f36e3d1cfb1e0e336ec..e4977a8ceafa274e2d7c8b65e79bb348c4cbb2c1 100644 --- a/fluid/CMakeLists.txt +++ b/fluid/CMakeLists.txt @@ -56,7 +56,7 @@ set(CPPFILES widgets/Formula_Input.cxx widgets/Bin_Button.cxx widgets/Style_Parser.cxx - widgets/widget_browser.cxx + widgets/Node_Browser.cxx ) # List header files in Apple's Xcode IDE @@ -96,7 +96,7 @@ set(HEADERFILES widgets/Formula_Input.h widgets/Bin_Button.h widgets/Style_Parser.h - widgets/widget_browser.h + widgets/Node_Browser.h ) # Add ExternalCodeEditor: platform specific files diff --git a/fluid/app/fluid.cxx b/fluid/app/fluid.cxx index e9d473fb26dabb21e190472e359c51993c0be4d9..baa3c9afbc664c03990881e109328eeba6d24ff1 100644 --- a/fluid/app/fluid.cxx +++ b/fluid/app/fluid.cxx @@ -33,7 +33,7 @@ #include "rsrcs/pixmaps.h" #include "app/shell_command.h" #include "tools/autodoc.h" -#include "widgets/widget_browser.h" +#include "widgets/Node_Browser.h" #include <FL/Fl.H> #ifdef __APPLE__ diff --git a/fluid/app/undo.cxx b/fluid/app/undo.cxx index eb50014688f0a7e112c3680029ac8b5208b1e20e..f5e5fbbacdbecef7ca85718802be156e1f299926 100644 --- a/fluid/app/undo.cxx +++ b/fluid/app/undo.cxx @@ -20,7 +20,7 @@ #include "io/file.h" #include "nodes/Fl_Type.h" #include "nodes/Fl_Widget_Type.h" -#include "widgets/widget_browser.h" +#include "widgets/Node_Browser.h" #include <FL/Fl.H> #include <FL/Fl_Window.H> diff --git a/fluid/io/file.cxx b/fluid/io/file.cxx index b697325dcbd51ea12bbcece8c4598a81361ca8af..ba1afeb1b970ec3cb087e8f9f4659c00152afcc8 100644 --- a/fluid/io/file.cxx +++ b/fluid/io/file.cxx @@ -31,7 +31,7 @@ #include "nodes/Fl_Grid_Type.h" #include "nodes/Fl_Window_Type.h" #include "panels/settings_panel.h" -#include "widgets/widget_browser.h" +#include "widgets/Node_Browser.h" #include <FL/Fl.H> #include <FL/Fl_Group.H> diff --git a/fluid/nodes/Fl_Function_Type.cxx b/fluid/nodes/Fl_Function_Type.cxx index 1f0a4fea501f834cfa2e260563173af70a64306a..f8845dcdd4c5c1042200ff741e0bdb9972d05869 100644 --- a/fluid/nodes/Fl_Function_Type.cxx +++ b/fluid/nodes/Fl_Function_Type.cxx @@ -25,7 +25,7 @@ #include "nodes/Fl_Group_Type.h" #include "panels/function_panel.h" #include "rsrcs/comments.h" -#include "widgets/widget_browser.h" +#include "widgets/Node_Browser.h" #include <FL/fl_string_functions.h> #include <FL/Fl_File_Chooser.H> diff --git a/fluid/nodes/Fl_Grid_Type.cxx b/fluid/nodes/Fl_Grid_Type.cxx index ea22323051476a725a736dc6a7eb7f54dc367ce8..c2a803c190d1a722fe65c2d7fd10bd95c28a1912 100644 --- a/fluid/nodes/Fl_Grid_Type.cxx +++ b/fluid/nodes/Fl_Grid_Type.cxx @@ -21,7 +21,7 @@ #include "app/undo.h" #include "io/file.h" #include "io/code.h" -#include "widgets/widget_browser.h" +#include "widgets/Node_Browser.h" #include "widgets/Formula_Input.h" #include <FL/Fl_Grid.H> diff --git a/fluid/nodes/Fl_Group_Type.cxx b/fluid/nodes/Fl_Group_Type.cxx index a7ab20473bf2b95a8f4cde046b55022d200bf7f5..dc602e870ab8f4988da0bc330b0652e577e1c02e 100644 --- a/fluid/nodes/Fl_Group_Type.cxx +++ b/fluid/nodes/Fl_Group_Type.cxx @@ -25,7 +25,7 @@ #include "app/Fd_Snap_Action.h" #include "io/file.h" #include "io/code.h" -#include "widgets/widget_browser.h" +#include "widgets/Node_Browser.h" #include <FL/Fl.H> #include <FL/Fl_Group.H> diff --git a/fluid/nodes/Fl_Menu_Type.cxx b/fluid/nodes/Fl_Menu_Type.cxx index 2fb80fec2144b3cf269f7410cccffc3fd9467859..145f0082d10ded8a19ebff0433275d41c05f10b9 100644 --- a/fluid/nodes/Fl_Menu_Type.cxx +++ b/fluid/nodes/Fl_Menu_Type.cxx @@ -30,7 +30,7 @@ #include "io/code.h" #include "nodes/Fl_Window_Type.h" #include "widgets/Formula_Input.h" -#include "widgets/widget_browser.h" +#include "widgets/Node_Browser.h" #include <FL/Fl.H> #include <FL/fl_message.H> diff --git a/fluid/nodes/Fl_Type.cxx b/fluid/nodes/Fl_Type.cxx index 56a15175ecdc1bc37f2f11e89b3abc2954586f2d..02b95888e38f26c613d75ee27999e60ea3f48d24 100644 --- a/fluid/nodes/Fl_Type.cxx +++ b/fluid/nodes/Fl_Type.cxx @@ -107,7 +107,7 @@ #include "nodes/Fl_Window_Type.h" #include "nodes/Fl_Group_Type.h" #include "rsrcs/pixmaps.h" -#include "widgets/widget_browser.h" +#include "widgets/Node_Browser.h" #include <FL/Fl.H> #include <FL/Fl_Browser_.H> @@ -739,7 +739,7 @@ void Fl_Type::add(Fl_Type *anchor, Strategy strategy) { \param[in] g pointer to a node within the tree */ void Fl_Type::insert(Fl_Type *g) { - // 'this' is not in the Widget_Browser, so we must run the linked list to find the last entry + // 'this' is not in the Node_Browser, so we must run the linked list to find the last entry Fl_Type *end = this; while (end->next) end = end->next; // 'this' will get the same parent as 'g' diff --git a/fluid/nodes/Fl_Window_Type.cxx b/fluid/nodes/Fl_Window_Type.cxx index c26191b7236a930ff436b8dc3b9131879c4d8274..7de2ba3dc7f4eec972bc09bd0e75ceb3e97a7591 100644 --- a/fluid/nodes/Fl_Window_Type.cxx +++ b/fluid/nodes/Fl_Window_Type.cxx @@ -30,7 +30,7 @@ #include "nodes/Fl_Grid_Type.h" #include "panels/settings_panel.h" #include "panels/widget_panel.h" -#include "widgets/widget_browser.h" +#include "widgets/Node_Browser.h" #include <FL/Fl.H> #include <FL/Fl_Overlay_Window.H> diff --git a/fluid/panels/function_panel.cxx b/fluid/panels/function_panel.cxx index 34f67b881a6dba2708d61cfdbe77d93c0ee0a675..4ef8fac644a61ae33a8291e90a8527aa75e3aeea 100644 --- a/fluid/panels/function_panel.cxx +++ b/fluid/panels/function_panel.cxx @@ -23,7 +23,7 @@ #include "nodes/factory.h" #include "rsrcs/pixmaps.h" #include "widgets/Bin_Button.h" -#include "widgets/widget_browser.h" +#include "widgets/Node_Browser.h" /** Allow widget navigation on text fields with Tab. diff --git a/fluid/panels/function_panel.fl b/fluid/panels/function_panel.fl index b63b4bf5099d7b9829d5906177aec22ec1a940d0..7adb2eceadd907c3ef57cc103133b6f69c927cb4 100644 --- a/fluid/panels/function_panel.fl +++ b/fluid/panels/function_panel.fl @@ -43,7 +43,7 @@ decl {\#include "rsrcs/pixmaps.h"} {private local decl {\#include "widgets/Bin_Button.h"} {private global } -decl {\#include "widgets/widget_browser.h"} {private local +decl {\#include "widgets/Node_Browser.h"} {private local } Function {use_tab_navigation(int, Fl_Text_Editor*)} { diff --git a/fluid/panels/settings_panel.cxx b/fluid/panels/settings_panel.cxx index a0e2092a89f88f41ce10e8b4f9cb631c7d382019..fd67676c63d7d762428a118390d8d403559b6e82 100644 --- a/fluid/panels/settings_panel.cxx +++ b/fluid/panels/settings_panel.cxx @@ -23,6 +23,7 @@ #include <FL/fl_ask.H> #include "../src/flstring.h" #include <string.h> +using namespace fld::widget; void scheme_cb(Fl_Scheme_Choice *, void *); int w_settings_shell_list_selected; @@ -3355,16 +3356,16 @@ Fl_Double_Window* make_settings_window() { o->labelfont(1); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)cb_Comments, (void*)(&Widget_Browser::label_font)); + o->callback((Fl_Callback*)cb_Comments, (void*)(&Node_Browser::label_font)); Fl_Group::current()->resizable(o); o->menu(fontmenu); } // Fl_Choice* o { Fl_Button* o = new Fl_Button(251, 112, 51, 20); o->labelsize(11); - o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Widget_Browser::label_color)); + o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Node_Browser::label_color)); } // Fl_Button* o { Fl_Menu_Button* o = new Fl_Menu_Button(302, 112, 18, 20); - o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Widget_Browser::label_color)); + o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Node_Browser::label_color)); o->menu(colormenu); } // Fl_Menu_Button* o o->end(); @@ -3377,16 +3378,16 @@ Fl_Double_Window* make_settings_window() { o->labelfont(1); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)cb_Comments, (void*)(&Widget_Browser::class_font)); + o->callback((Fl_Callback*)cb_Comments, (void*)(&Node_Browser::class_font)); Fl_Group::current()->resizable(o); o->menu(fontmenu); } // Fl_Choice* o { Fl_Button* o = new Fl_Button(251, 137, 51, 20); o->labelsize(11); - o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Widget_Browser::class_color)); + o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Node_Browser::class_color)); } // Fl_Button* o { Fl_Menu_Button* o = new Fl_Menu_Button(302, 137, 18, 20); - o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Widget_Browser::class_color)); + o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Node_Browser::class_color)); o->menu(colormenu); } // Fl_Menu_Button* o o->end(); @@ -3399,16 +3400,16 @@ Fl_Double_Window* make_settings_window() { o->labelfont(1); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)cb_Comments, (void*)(&Widget_Browser::func_font)); + o->callback((Fl_Callback*)cb_Comments, (void*)(&Node_Browser::func_font)); Fl_Group::current()->resizable(o); o->menu(fontmenu); } // Fl_Choice* o { Fl_Button* o = new Fl_Button(251, 162, 51, 20); o->labelsize(11); - o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Widget_Browser::func_color)); + o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Node_Browser::func_color)); } // Fl_Button* o { Fl_Menu_Button* o = new Fl_Menu_Button(302, 162, 18, 20); - o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Widget_Browser::func_color)); + o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Node_Browser::func_color)); o->menu(colormenu); } // Fl_Menu_Button* o o->end(); @@ -3421,16 +3422,16 @@ Fl_Double_Window* make_settings_window() { o->labelfont(1); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)cb_Comments, (void*)(&Widget_Browser::name_font)); + o->callback((Fl_Callback*)cb_Comments, (void*)(&Node_Browser::name_font)); Fl_Group::current()->resizable(o); o->menu(fontmenu); } // Fl_Choice* o { Fl_Button* o = new Fl_Button(251, 187, 51, 20); o->labelsize(11); - o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Widget_Browser::name_color)); + o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Node_Browser::name_color)); } // Fl_Button* o { Fl_Menu_Button* o = new Fl_Menu_Button(302, 187, 18, 20); - o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Widget_Browser::name_color)); + o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Node_Browser::name_color)); o->menu(colormenu); } // Fl_Menu_Button* o o->end(); @@ -3443,16 +3444,16 @@ Fl_Double_Window* make_settings_window() { o->labelfont(1); o->labelsize(11); o->textsize(11); - o->callback((Fl_Callback*)cb_Comments, (void*)(&Widget_Browser::code_font)); + o->callback((Fl_Callback*)cb_Comments, (void*)(&Node_Browser::code_font)); Fl_Group::current()->resizable(o); o->menu(fontmenu); } // Fl_Choice* o { Fl_Button* o = new Fl_Button(251, 212, 51, 20); o->labelsize(11); - o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Widget_Browser::code_color)); + o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Node_Browser::code_color)); } // Fl_Button* o { Fl_Menu_Button* o = new Fl_Menu_Button(302, 212, 18, 20); - o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Widget_Browser::code_color)); + o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Node_Browser::code_color)); o->menu(colormenu); } // Fl_Menu_Button* o o->end(); @@ -3465,16 +3466,16 @@ Fl_Double_Window* make_settings_window() { w_settings_user_commenttext->labelfont(1); w_settings_user_commenttext->labelsize(11); w_settings_user_commenttext->textsize(11); - w_settings_user_commenttext->callback((Fl_Callback*)cb_Comments, (void*)(&Widget_Browser::comment_font)); + w_settings_user_commenttext->callback((Fl_Callback*)cb_Comments, (void*)(&Node_Browser::comment_font)); Fl_Group::current()->resizable(w_settings_user_commenttext); o->menu(fontmenu); } // Fl_Choice* w_settings_user_commenttext { Fl_Button* o = new Fl_Button(251, 237, 51, 20); o->labelsize(11); - o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Widget_Browser::comment_color)); + o->callback((Fl_Callback*)cb_Color_Chip, (void*)(&Node_Browser::comment_color)); } // Fl_Button* o { Fl_Menu_Button* o = new Fl_Menu_Button(302, 237, 18, 20); - o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Widget_Browser::comment_color)); + o->callback((Fl_Callback*)cb_Color_Choice, (void*)(&Node_Browser::comment_color)); o->menu(colormenu); } // Fl_Menu_Button* o o->end(); diff --git a/fluid/panels/settings_panel.fl b/fluid/panels/settings_panel.fl index a53e96b4b2aff0bc13b05ecccee945eb25179f29..fad6580afa8fcfc90da660b42f61ce33b4b8dfca 100644 --- a/fluid/panels/settings_panel.fl +++ b/fluid/panels/settings_panel.fl @@ -64,7 +64,7 @@ decl {\#include "app/shell_command.h"} {public global decl {\#include "tools/fluid_filename.h"} {public local } -decl {\#include "widgets/widget_browser.h"} {public global +decl {\#include "widgets/Node_Browser.h"} {public global } decl {\#include <FL/Fl_Text_Buffer.H>} {public local @@ -88,12 +88,15 @@ decl {\#include <FL/Fl_Tooltip.H>} {private global decl {\#include <FL/fl_ask.H>} {private global } -decl {\#include "../src/flstring.h"} {selected private global +decl {\#include "../src/flstring.h"} {private global } decl {\#include <string.h>} {private global } +decl {using namespace fld::widget;} {selected private global +} + decl {void init_scheme(void);} { comment {// initialize the scheme from preferences} public global } @@ -1677,19 +1680,19 @@ if (v == LOAD) { } { Fl_Choice {} { label {Label:} - user_data {&Widget_Browser::label_font} + user_data {&Node_Browser::label_font} callback cb_Comments open xywh {100 112 151 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_Button {} { - user_data {&Widget_Browser::label_color} + user_data {&Node_Browser::label_color} callback cb_Color_Chip xywh {251 112 51 20} labelsize 11 } Fl_Menu_Button {} { - user_data {&Widget_Browser::label_color} + user_data {&Node_Browser::label_color} callback cb_Color_Choice open xywh {302 112 18 20} code0 {extern Fl_Menu_Item colormenu[];} @@ -1702,19 +1705,19 @@ if (v == LOAD) { } { Fl_Choice {} { label {Class:} - user_data {&Widget_Browser::class_font} + user_data {&Node_Browser::class_font} callback cb_Comments open xywh {100 137 151 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_Button {} { - user_data {&Widget_Browser::class_color} + user_data {&Node_Browser::class_color} callback cb_Color_Chip xywh {251 137 51 20} labelsize 11 } Fl_Menu_Button {} { - user_data {&Widget_Browser::class_color} + user_data {&Node_Browser::class_color} callback cb_Color_Choice open xywh {302 137 18 20} code0 {extern Fl_Menu_Item colormenu[];} @@ -1727,19 +1730,19 @@ if (v == LOAD) { } { Fl_Choice {} { label {Function:} - user_data {&Widget_Browser::func_font} + user_data {&Node_Browser::func_font} callback cb_Comments open xywh {100 162 151 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_Button {} { - user_data {&Widget_Browser::func_color} + user_data {&Node_Browser::func_color} callback cb_Color_Chip xywh {251 162 51 20} labelsize 11 } Fl_Menu_Button {} { - user_data {&Widget_Browser::func_color} + user_data {&Node_Browser::func_color} callback cb_Color_Choice open xywh {302 162 18 20} code0 {extern Fl_Menu_Item colormenu[];} @@ -1752,19 +1755,19 @@ if (v == LOAD) { } { Fl_Choice {} { label {Name:} - user_data {&Widget_Browser::name_font} + user_data {&Node_Browser::name_font} callback cb_Comments open xywh {100 187 151 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_Button {} { - user_data {&Widget_Browser::name_color} + user_data {&Node_Browser::name_color} callback cb_Color_Chip xywh {251 187 51 20} labelsize 11 } Fl_Menu_Button {} { - user_data {&Widget_Browser::name_color} + user_data {&Node_Browser::name_color} callback cb_Color_Choice open xywh {302 187 18 20} code0 {extern Fl_Menu_Item colormenu[];} @@ -1777,19 +1780,19 @@ if (v == LOAD) { } { Fl_Choice {} { label {Code:} - user_data {&Widget_Browser::code_font} + user_data {&Node_Browser::code_font} callback cb_Comments open xywh {100 212 151 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_Button {} { - user_data {&Widget_Browser::code_color} + user_data {&Node_Browser::code_color} callback cb_Color_Chip xywh {251 212 51 20} labelsize 11 } Fl_Menu_Button {} { - user_data {&Widget_Browser::code_color} + user_data {&Node_Browser::code_color} callback cb_Color_Choice open xywh {302 212 18 20} code0 {extern Fl_Menu_Item colormenu[];} @@ -1802,19 +1805,19 @@ if (v == LOAD) { } { Fl_Choice w_settings_user_commenttext { label {Comments:} - user_data {&Widget_Browser::comment_font} + user_data {&Node_Browser::comment_font} callback cb_Comments open xywh {100 237 151 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_Button {} { - user_data {&Widget_Browser::comment_color} + user_data {&Node_Browser::comment_color} callback cb_Color_Chip xywh {251 237 51 20} labelsize 11 } Fl_Menu_Button {} { - user_data {&Widget_Browser::comment_color} + user_data {&Node_Browser::comment_color} callback cb_Color_Choice open xywh {302 237 18 20} code0 {extern Fl_Menu_Item colormenu[];} diff --git a/fluid/panels/settings_panel.h b/fluid/panels/settings_panel.h index 918e69c8aa7f2ec58b50facb44eed849490be075..c26b165c5425fabaf35ba6a352d5dbcf9c50e9aa 100644 --- a/fluid/panels/settings_panel.h +++ b/fluid/panels/settings_panel.h @@ -23,7 +23,7 @@ #include "app/Fd_Snap_Action.h" #include "app/shell_command.h" #include "tools/fluid_filename.h" -#include "widgets/widget_browser.h" +#include "widgets/Node_Browser.h" #include <FL/Fl_Text_Buffer.H> #include <FL/Fl_Text_Display.H> #include <FL/fl_string_functions.h> diff --git a/fluid/tools/autodoc.cxx b/fluid/tools/autodoc.cxx index 59f9a7b27aded812874044593747cca4acee63a7..857c5c12b484e734fd6e9261bcf20c98b94ccd27 100644 --- a/fluid/tools/autodoc.cxx +++ b/fluid/tools/autodoc.cxx @@ -26,7 +26,7 @@ #include "panels/function_panel.h" #include "panels/settings_panel.h" #include "panels/codeview_panel.h" -#include "widgets/widget_browser.h" +#include "widgets/Node_Browser.h" #include <FL/Enumerations.H> #include <FL/fl_draw.H> diff --git a/fluid/widgets/Bin_Button.cxx b/fluid/widgets/Bin_Button.cxx index cc351085d93d5aa2bb657ea7d6ebeb566b9b122c..308d12234bc551b0e96f4cebefdffc4cad5b6e96 100644 --- a/fluid/widgets/Bin_Button.cxx +++ b/fluid/widgets/Bin_Button.cxx @@ -19,7 +19,7 @@ #include "app/fluid.h" #include "nodes/factory.h" #include "nodes/Fl_Window_Type.h" -#include "widgets/widget_browser.h" +#include "widgets/Node_Browser.h" #include <FL/Fl_Button.H> #include <FL/Fl_Window.H> diff --git a/fluid/widgets/widget_browser.cxx b/fluid/widgets/Node_Browser.cxx similarity index 91% rename from fluid/widgets/widget_browser.cxx rename to fluid/widgets/Node_Browser.cxx index 9f7c8ff6c7249a40eab65bc74da475d1dae86e54..fafe236cf15f0c1b11d598da0afbcafffa774d27 100644 --- a/fluid/widgets/widget_browser.cxx +++ b/fluid/widgets/Node_Browser.cxx @@ -14,7 +14,7 @@ // https://www.fltk.org/bugs.php // -#include "widgets/widget_browser.h" +#include "widgets/Node_Browser.h" #include "app/fluid.h" #include "nodes/Fl_Widget_Type.h" @@ -24,8 +24,18 @@ #include <FL/Fl_Browser_.H> #include <FL/fl_draw.H> + +// ---- global variables + +/// Global access to the widget browser. +fld::widget::Node_Browser *widget_browser = nullptr; + +using namespace fld; +using namespace fld::widget; + + /** - \class Widget_Browser + \class Node_Browser A widget that displays the nodes in the widget tree. @@ -36,25 +46,21 @@ \see Fl_Type */ -// ---- global variables - -/// Global access to the widget browser. -Widget_Browser *widget_browser = NULL; // ---- static variables -Fl_Color Widget_Browser::label_color = 72; -Fl_Font Widget_Browser::label_font = FL_HELVETICA; -Fl_Color Widget_Browser::class_color = FL_FOREGROUND_COLOR; -Fl_Font Widget_Browser::class_font = FL_HELVETICA_BOLD; -Fl_Color Widget_Browser::func_color = FL_FOREGROUND_COLOR; -Fl_Font Widget_Browser::func_font = FL_HELVETICA; -Fl_Color Widget_Browser::name_color = FL_FOREGROUND_COLOR; -Fl_Font Widget_Browser::name_font = FL_HELVETICA; -Fl_Color Widget_Browser::code_color = FL_FOREGROUND_COLOR; -Fl_Font Widget_Browser::code_font = FL_HELVETICA; -Fl_Color Widget_Browser::comment_color = FL_DARK_GREEN; -Fl_Font Widget_Browser::comment_font = FL_HELVETICA; +Fl_Color Node_Browser::label_color = 72; +Fl_Font Node_Browser::label_font = FL_HELVETICA; +Fl_Color Node_Browser::class_color = FL_FOREGROUND_COLOR; +Fl_Font Node_Browser::class_font = FL_HELVETICA_BOLD; +Fl_Color Node_Browser::func_color = FL_FOREGROUND_COLOR; +Fl_Font Node_Browser::func_font = FL_HELVETICA; +Fl_Color Node_Browser::name_color = FL_FOREGROUND_COLOR; +Fl_Font Node_Browser::name_font = FL_HELVETICA; +Fl_Color Node_Browser::code_color = FL_FOREGROUND_COLOR; +Fl_Font Node_Browser::code_font = FL_HELVETICA; +Fl_Color Node_Browser::comment_color = FL_DARK_GREEN; +Fl_Font Node_Browser::comment_font = FL_HELVETICA; // ---- global functions @@ -69,7 +75,7 @@ void redraw_browser() { Shortcut to create the widget browser. */ Fl_Widget *make_widget_browser(int x,int y,int w,int h) { - return (widget_browser = new Widget_Browser(x,y,w,h)); + return (widget_browser = new Node_Browser(x,y,w,h)); } /** @@ -193,10 +199,10 @@ static char *copy_trunc(char *p, const char *str, int maxl, int quote, int trunc return p; } -// ---- Widget_Browser implementation +// ---- Node_Browser implementation /** - Create a new instance of the Widget_Browser widget. + Create a new instance of the Node_Browser widget. Fluid currently generates only one instance of this browser. If we want to use multiple browser at some point, we need to refactor a few global @@ -207,11 +213,8 @@ static char *copy_trunc(char *p, const char *str, int maxl, int quote, int trunc \todo It would be nice to be able to grab one or more nodes and move them within the hierarchy. */ -Widget_Browser::Widget_Browser(int X,int Y,int W,int H,const char*l) : - Fl_Browser_(X,Y,W,H,l), - pushedtitle(NULL), - saved_h_scroll_(0), - saved_v_scroll_(0) +Node_Browser::Node_Browser(int X,int Y,int W,int H,const char*l) : + Fl_Browser_(X,Y,W,H,l) { type(FL_MULTI_BROWSER); Fl_Widget::callback(callback_stub); @@ -222,7 +225,7 @@ Widget_Browser::Widget_Browser(int X,int Y,int W,int H,const char*l) : Override the method to find the first item in the list of elements. \return the first item */ -void *Widget_Browser::item_first() const { +void *Node_Browser::item_first() const { return Fl_Type::first; } @@ -231,7 +234,7 @@ void *Widget_Browser::item_first() const { \param l this item \return the next item, irregardless of tree depth, or NULL at the end */ -void *Widget_Browser::item_next(void *l) const { +void *Node_Browser::item_next(void *l) const { return ((Fl_Type*)l)->next; } @@ -240,7 +243,7 @@ void *Widget_Browser::item_next(void *l) const { \param l this item \return the previous item, irregardless of tree depth, or NULL at the start */ -void *Widget_Browser::item_prev(void *l) const { +void *Node_Browser::item_prev(void *l) const { return ((Fl_Type*)l)->prev; } @@ -250,7 +253,7 @@ void *Widget_Browser::item_prev(void *l) const { \return 1 if selected, 0 if not \todo what is the difference between selected and new_selected, and why do we do this? */ -int Widget_Browser::item_selected(void *l) const { +int Node_Browser::item_selected(void *l) const { return ((Fl_Type*)l)->new_selected; } @@ -259,7 +262,7 @@ int Widget_Browser::item_selected(void *l) const { \param l this item \param[in] v 1 if selecting, 0 if not */ -void Widget_Browser::item_select(void *l,int v) { +void Node_Browser::item_select(void *l,int v) { ((Fl_Type*)l)->new_selected = v; } @@ -268,7 +271,7 @@ void Widget_Browser::item_select(void *l,int v) { \param l this item \return height in FLTK units (used to be pixels before high res screens) */ -int Widget_Browser::item_height(void *l) const { +int Node_Browser::item_height(void *l) const { Fl_Type *t = (Fl_Type*)l; if (t->visible) { if (show_comments && t->comment()) @@ -283,7 +286,7 @@ int Widget_Browser::item_height(void *l) const { Override the method to return the estimated height of all items. \return height in FLTK units */ -int Widget_Browser::incr_height() const { +int Node_Browser::incr_height() const { return textsize() + 5 + linespacing(); } @@ -308,7 +311,7 @@ int Widget_Browser::incr_height() const { \param X,Y these give the position in window coordinates of the top left corner of this line */ -void Widget_Browser::item_draw(void *v, int X, int Y, int, int) const { +void Node_Browser::item_draw(void *v, int X, int Y, int, int) const { // cast to a more general type Fl_Type *l = (Fl_Type *)v; @@ -451,7 +454,7 @@ void Widget_Browser::item_draw(void *v, int X, int Y, int, int) const { \param v this item \return width in FLTK units */ -int Widget_Browser::item_width(void *v) const { +int Node_Browser::item_width(void *v) const { char buf[500]; // edit buffer: large enough to hold 80 UTF-8 chars + nul @@ -486,7 +489,7 @@ int Widget_Browser::item_width(void *v) const { /** Callback to tell the Fluid UI when the list of selected items changed. */ -void Widget_Browser::callback() { +void Node_Browser::callback() { selection_changed((Fl_Type*)selection()); } @@ -504,7 +507,7 @@ void Widget_Browser::callback() { \param[in] e the incoming event type \return 0 if the event is not supported, and 1 if the event was "used up" */ -int Widget_Browser::handle(int e) { +int Node_Browser::handle(int e) { static Fl_Type *title; Fl_Type *l; int X,Y,W,H; bbox(X,Y,W,H); @@ -571,7 +574,7 @@ int Widget_Browser::handle(int e) { /** Save the current scrollbar position during rebuild. */ -void Widget_Browser::save_scroll_position() { +void Node_Browser::save_scroll_position() { saved_h_scroll_ = hposition(); saved_v_scroll_ = vposition(); } @@ -579,7 +582,7 @@ void Widget_Browser::save_scroll_position() { /** Restore the previous scrollbar position after rebuild. */ -void Widget_Browser::restore_scroll_position() { +void Node_Browser::restore_scroll_position() { hposition(saved_h_scroll_); vposition(saved_v_scroll_); } @@ -589,7 +592,7 @@ void Widget_Browser::restore_scroll_position() { This clears internal caches, recalculates the scroll bar sizes, and sends a redraw() request to the widget. */ -void Widget_Browser::rebuild() { +void Node_Browser::rebuild() { save_scroll_position(); new_list(); damage(FL_DAMAGE_SCROLL); @@ -601,7 +604,7 @@ void Widget_Browser::rebuild() { Rebuild the browser layout and make sure that the given item is visible. \param[in] inNode pointer to a widget node derived from Fl_Type. */ -void Widget_Browser::display(Fl_Type *inNode) { +void Node_Browser::display(Fl_Type *inNode) { if (!inNode) { // Alternative: find the first (last?) visible selected item. return; @@ -635,7 +638,7 @@ void Widget_Browser::display(Fl_Type *inNode) { vposition(newV); } -void Widget_Browser::load_prefs() { +void Node_Browser::load_prefs() { int c; Fl_Preferences p(fluid_prefs, "widget_browser"); p.get("label_color", c, 72); label_color = c; @@ -652,7 +655,7 @@ void Widget_Browser::load_prefs() { p.get("comment_font", c, FL_HELVETICA); comment_font = c; } -void Widget_Browser::save_prefs() { +void Node_Browser::save_prefs() { Fl_Preferences p(fluid_prefs, "widget_browser"); p.set("label_color", (int)label_color); p.set("label_font", (int)label_font); diff --git a/fluid/widgets/widget_browser.h b/fluid/widgets/Node_Browser.h similarity index 61% rename from fluid/widgets/widget_browser.h rename to fluid/widgets/Node_Browser.h index 86c60777c717b561f0ed505d676f79e4b250dd6d..5ac74b50a28405c359a672a770ede070f93b37d4 100644 --- a/fluid/widgets/widget_browser.h +++ b/fluid/widgets/Node_Browser.h @@ -1,7 +1,7 @@ // // Widget Browser code for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2021 by Bill Spitzak and others. +// Copyright 1998-2025 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 @@ -14,50 +14,42 @@ // https://www.fltk.org/bugs.php // -#ifndef _FLUID_WIDGET_BROWSER_H -#define _FLUID_WIDGET_BROWSER_H +#ifndef FLUID_WIDGETS_NODE_BROWSER_H +#define FLUID_WIDGETS_NODE_BROWSER_H #include <FL/Fl_Browser_.H> class Fl_Type; -class Widget_Browser; -extern Widget_Browser *widget_browser; +namespace fld { +namespace widget { -extern void redraw_browser(); -extern Fl_Widget *make_widget_browser(int x,int y,int w,int h); -extern void redraw_widget_browser(Fl_Type *caller); -extern void select(Fl_Type *o, int v); -extern void select_only(Fl_Type *o); -extern void deselect(); -extern void reveal_in_browser(Fl_Type *t); - -class Widget_Browser : public Fl_Browser_ +class Node_Browser : public Fl_Browser_ { friend class Fl_Type; static void callback_stub(Fl_Widget *o, void *) { - ((Widget_Browser *)o)->callback(); + ((Node_Browser *)o)->callback(); } - Fl_Type* pushedtitle; - int saved_h_scroll_; - int saved_v_scroll_; + Fl_Type* pushedtitle { nullptr }; + int saved_h_scroll_ { 0 }; + int saved_v_scroll_ { 0 }; // required routines for Fl_Browser_ subclass: - void *item_first() const FL_OVERRIDE; - void *item_next(void *) const FL_OVERRIDE; - void *item_prev(void *) const FL_OVERRIDE; - int item_selected(void *) const FL_OVERRIDE; - void item_select(void *,int) FL_OVERRIDE; - int item_width(void *) const FL_OVERRIDE; - int item_height(void *) const FL_OVERRIDE; - void item_draw(void *,int,int,int,int) const FL_OVERRIDE; - int incr_height() const FL_OVERRIDE; + void *item_first() const override; + void *item_next(void *) const override; + void *item_prev(void *) const override; + int item_selected(void *) const override; + void item_select(void *,int) override; + int item_width(void *) const override; + int item_height(void *) const override; + void item_draw(void *,int,int,int,int) const override; + int incr_height() const override; public: - Widget_Browser(int,int,int,int,const char * =NULL); - int handle(int) FL_OVERRIDE; + Node_Browser(int,int,int,int,const char * = nullptr); + int handle(int) override; void callback(); void save_scroll_position(); void restore_scroll_position(); @@ -81,4 +73,17 @@ public: static Fl_Font comment_font; }; -#endif // _FLUID_WIDGET_BROWSER_H +} // namespace widget +} // namespace fld + +extern void redraw_browser(); +extern Fl_Widget *make_widget_browser(int x,int y,int w,int h); +extern void redraw_widget_browser(Fl_Type *caller); +extern void select(Fl_Type *o, int v); +extern void select_only(Fl_Type *o); +extern void deselect(); +extern void reveal_in_browser(Fl_Type *t); + +extern fld::widget::Node_Browser *widget_browser; + +#endif // FLUID_WIDGETS_NODE_BROWSER_H