Cleaning up widget browser, renamed to Node_Browser.

This commit is contained in:
Matthias Melcher 2025-03-07 19:52:54 +01:00
parent c3571838cb
commit 70e5dc23ae
19 changed files with 140 additions and 128 deletions

View File

@ -56,7 +56,7 @@ set(CPPFILES
widgets/Formula_Input.cxx widgets/Formula_Input.cxx
widgets/Bin_Button.cxx widgets/Bin_Button.cxx
widgets/Style_Parser.cxx widgets/Style_Parser.cxx
widgets/widget_browser.cxx widgets/Node_Browser.cxx
) )
# List header files in Apple's Xcode IDE # List header files in Apple's Xcode IDE
@ -96,7 +96,7 @@ set(HEADERFILES
widgets/Formula_Input.h widgets/Formula_Input.h
widgets/Bin_Button.h widgets/Bin_Button.h
widgets/Style_Parser.h widgets/Style_Parser.h
widgets/widget_browser.h widgets/Node_Browser.h
) )
# Add ExternalCodeEditor: platform specific files # Add ExternalCodeEditor: platform specific files

View File

@ -33,7 +33,7 @@
#include "rsrcs/pixmaps.h" #include "rsrcs/pixmaps.h"
#include "app/shell_command.h" #include "app/shell_command.h"
#include "tools/autodoc.h" #include "tools/autodoc.h"
#include "widgets/widget_browser.h" #include "widgets/Node_Browser.h"
#include <FL/Fl.H> #include <FL/Fl.H>
#ifdef __APPLE__ #ifdef __APPLE__

View File

@ -20,7 +20,7 @@
#include "io/file.h" #include "io/file.h"
#include "nodes/Fl_Type.h" #include "nodes/Fl_Type.h"
#include "nodes/Fl_Widget_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.H>
#include <FL/Fl_Window.H> #include <FL/Fl_Window.H>

View File

@ -31,7 +31,7 @@
#include "nodes/Fl_Grid_Type.h" #include "nodes/Fl_Grid_Type.h"
#include "nodes/Fl_Window_Type.h" #include "nodes/Fl_Window_Type.h"
#include "panels/settings_panel.h" #include "panels/settings_panel.h"
#include "widgets/widget_browser.h" #include "widgets/Node_Browser.h"
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Group.H> #include <FL/Fl_Group.H>

View File

@ -25,7 +25,7 @@
#include "nodes/Fl_Group_Type.h" #include "nodes/Fl_Group_Type.h"
#include "panels/function_panel.h" #include "panels/function_panel.h"
#include "rsrcs/comments.h" #include "rsrcs/comments.h"
#include "widgets/widget_browser.h" #include "widgets/Node_Browser.h"
#include <FL/fl_string_functions.h> #include <FL/fl_string_functions.h>
#include <FL/Fl_File_Chooser.H> #include <FL/Fl_File_Chooser.H>

View File

@ -21,7 +21,7 @@
#include "app/undo.h" #include "app/undo.h"
#include "io/file.h" #include "io/file.h"
#include "io/code.h" #include "io/code.h"
#include "widgets/widget_browser.h" #include "widgets/Node_Browser.h"
#include "widgets/Formula_Input.h" #include "widgets/Formula_Input.h"
#include <FL/Fl_Grid.H> #include <FL/Fl_Grid.H>

View File

@ -25,7 +25,7 @@
#include "app/Fd_Snap_Action.h" #include "app/Fd_Snap_Action.h"
#include "io/file.h" #include "io/file.h"
#include "io/code.h" #include "io/code.h"
#include "widgets/widget_browser.h" #include "widgets/Node_Browser.h"
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Group.H> #include <FL/Fl_Group.H>

View File

@ -30,7 +30,7 @@
#include "io/code.h" #include "io/code.h"
#include "nodes/Fl_Window_Type.h" #include "nodes/Fl_Window_Type.h"
#include "widgets/Formula_Input.h" #include "widgets/Formula_Input.h"
#include "widgets/widget_browser.h" #include "widgets/Node_Browser.h"
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/fl_message.H> #include <FL/fl_message.H>

View File

@ -107,7 +107,7 @@
#include "nodes/Fl_Window_Type.h" #include "nodes/Fl_Window_Type.h"
#include "nodes/Fl_Group_Type.h" #include "nodes/Fl_Group_Type.h"
#include "rsrcs/pixmaps.h" #include "rsrcs/pixmaps.h"
#include "widgets/widget_browser.h" #include "widgets/Node_Browser.h"
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Browser_.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 \param[in] g pointer to a node within the tree
*/ */
void Fl_Type::insert(Fl_Type *g) { 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; Fl_Type *end = this;
while (end->next) end = end->next; while (end->next) end = end->next;
// 'this' will get the same parent as 'g' // 'this' will get the same parent as 'g'

View File

@ -30,7 +30,7 @@
#include "nodes/Fl_Grid_Type.h" #include "nodes/Fl_Grid_Type.h"
#include "panels/settings_panel.h" #include "panels/settings_panel.h"
#include "panels/widget_panel.h" #include "panels/widget_panel.h"
#include "widgets/widget_browser.h" #include "widgets/Node_Browser.h"
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Overlay_Window.H> #include <FL/Fl_Overlay_Window.H>

View File

@ -23,7 +23,7 @@
#include "nodes/factory.h" #include "nodes/factory.h"
#include "rsrcs/pixmaps.h" #include "rsrcs/pixmaps.h"
#include "widgets/Bin_Button.h" #include "widgets/Bin_Button.h"
#include "widgets/widget_browser.h" #include "widgets/Node_Browser.h"
/** /**
Allow widget navigation on text fields with Tab. Allow widget navigation on text fields with Tab.

View File

@ -43,7 +43,7 @@ decl {\#include "rsrcs/pixmaps.h"} {private local
decl {\#include "widgets/Bin_Button.h"} {private global 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*)} { Function {use_tab_navigation(int, Fl_Text_Editor*)} {

View File

@ -23,6 +23,7 @@
#include <FL/fl_ask.H> #include <FL/fl_ask.H>
#include "../src/flstring.h" #include "../src/flstring.h"
#include <string.h> #include <string.h>
using namespace fld::widget;
void scheme_cb(Fl_Scheme_Choice *, void *); void scheme_cb(Fl_Scheme_Choice *, void *);
int w_settings_shell_list_selected; int w_settings_shell_list_selected;
@ -3355,16 +3356,16 @@ Fl_Double_Window* make_settings_window() {
o->labelfont(1); o->labelfont(1);
o->labelsize(11); o->labelsize(11);
o->textsize(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); Fl_Group::current()->resizable(o);
o->menu(fontmenu); o->menu(fontmenu);
} // Fl_Choice* o } // Fl_Choice* o
{ Fl_Button* o = new Fl_Button(251, 112, 51, 20); { Fl_Button* o = new Fl_Button(251, 112, 51, 20);
o->labelsize(11); 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_Button* o
{ Fl_Menu_Button* o = new Fl_Menu_Button(302, 112, 18, 20); { 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); o->menu(colormenu);
} // Fl_Menu_Button* o } // Fl_Menu_Button* o
o->end(); o->end();
@ -3377,16 +3378,16 @@ Fl_Double_Window* make_settings_window() {
o->labelfont(1); o->labelfont(1);
o->labelsize(11); o->labelsize(11);
o->textsize(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); Fl_Group::current()->resizable(o);
o->menu(fontmenu); o->menu(fontmenu);
} // Fl_Choice* o } // Fl_Choice* o
{ Fl_Button* o = new Fl_Button(251, 137, 51, 20); { Fl_Button* o = new Fl_Button(251, 137, 51, 20);
o->labelsize(11); 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_Button* o
{ Fl_Menu_Button* o = new Fl_Menu_Button(302, 137, 18, 20); { 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); o->menu(colormenu);
} // Fl_Menu_Button* o } // Fl_Menu_Button* o
o->end(); o->end();
@ -3399,16 +3400,16 @@ Fl_Double_Window* make_settings_window() {
o->labelfont(1); o->labelfont(1);
o->labelsize(11); o->labelsize(11);
o->textsize(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); Fl_Group::current()->resizable(o);
o->menu(fontmenu); o->menu(fontmenu);
} // Fl_Choice* o } // Fl_Choice* o
{ Fl_Button* o = new Fl_Button(251, 162, 51, 20); { Fl_Button* o = new Fl_Button(251, 162, 51, 20);
o->labelsize(11); 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_Button* o
{ Fl_Menu_Button* o = new Fl_Menu_Button(302, 162, 18, 20); { 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); o->menu(colormenu);
} // Fl_Menu_Button* o } // Fl_Menu_Button* o
o->end(); o->end();
@ -3421,16 +3422,16 @@ Fl_Double_Window* make_settings_window() {
o->labelfont(1); o->labelfont(1);
o->labelsize(11); o->labelsize(11);
o->textsize(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); Fl_Group::current()->resizable(o);
o->menu(fontmenu); o->menu(fontmenu);
} // Fl_Choice* o } // Fl_Choice* o
{ Fl_Button* o = new Fl_Button(251, 187, 51, 20); { Fl_Button* o = new Fl_Button(251, 187, 51, 20);
o->labelsize(11); 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_Button* o
{ Fl_Menu_Button* o = new Fl_Menu_Button(302, 187, 18, 20); { 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); o->menu(colormenu);
} // Fl_Menu_Button* o } // Fl_Menu_Button* o
o->end(); o->end();
@ -3443,16 +3444,16 @@ Fl_Double_Window* make_settings_window() {
o->labelfont(1); o->labelfont(1);
o->labelsize(11); o->labelsize(11);
o->textsize(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); Fl_Group::current()->resizable(o);
o->menu(fontmenu); o->menu(fontmenu);
} // Fl_Choice* o } // Fl_Choice* o
{ Fl_Button* o = new Fl_Button(251, 212, 51, 20); { Fl_Button* o = new Fl_Button(251, 212, 51, 20);
o->labelsize(11); 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_Button* o
{ Fl_Menu_Button* o = new Fl_Menu_Button(302, 212, 18, 20); { 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); o->menu(colormenu);
} // Fl_Menu_Button* o } // Fl_Menu_Button* o
o->end(); o->end();
@ -3465,16 +3466,16 @@ Fl_Double_Window* make_settings_window() {
w_settings_user_commenttext->labelfont(1); w_settings_user_commenttext->labelfont(1);
w_settings_user_commenttext->labelsize(11); w_settings_user_commenttext->labelsize(11);
w_settings_user_commenttext->textsize(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); Fl_Group::current()->resizable(w_settings_user_commenttext);
o->menu(fontmenu); o->menu(fontmenu);
} // Fl_Choice* w_settings_user_commenttext } // Fl_Choice* w_settings_user_commenttext
{ Fl_Button* o = new Fl_Button(251, 237, 51, 20); { Fl_Button* o = new Fl_Button(251, 237, 51, 20);
o->labelsize(11); 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_Button* o
{ Fl_Menu_Button* o = new Fl_Menu_Button(302, 237, 18, 20); { 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); o->menu(colormenu);
} // Fl_Menu_Button* o } // Fl_Menu_Button* o
o->end(); o->end();

View File

@ -64,7 +64,7 @@ decl {\#include "app/shell_command.h"} {public global
decl {\#include "tools/fluid_filename.h"} {public local 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 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 <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 {\#include <string.h>} {private global
} }
decl {using namespace fld::widget;} {selected private global
}
decl {void init_scheme(void);} { decl {void init_scheme(void);} {
comment {// initialize the scheme from preferences} public global comment {// initialize the scheme from preferences} public global
} }
@ -1677,19 +1680,19 @@ if (v == LOAD) {
} { } {
Fl_Choice {} { Fl_Choice {} {
label {Label:} label {Label:}
user_data {&Widget_Browser::label_font} user_data {&Node_Browser::label_font}
callback cb_Comments open callback cb_Comments open
xywh {100 112 151 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable 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[];} code0 {extern Fl_Menu_Item fontmenu[];}
code1 {o->menu(fontmenu);} code1 {o->menu(fontmenu);}
} {} } {}
Fl_Button {} { Fl_Button {} {
user_data {&Widget_Browser::label_color} user_data {&Node_Browser::label_color}
callback cb_Color_Chip callback cb_Color_Chip
xywh {251 112 51 20} labelsize 11 xywh {251 112 51 20} labelsize 11
} }
Fl_Menu_Button {} { Fl_Menu_Button {} {
user_data {&Widget_Browser::label_color} user_data {&Node_Browser::label_color}
callback cb_Color_Choice open callback cb_Color_Choice open
xywh {302 112 18 20} xywh {302 112 18 20}
code0 {extern Fl_Menu_Item colormenu[];} code0 {extern Fl_Menu_Item colormenu[];}
@ -1702,19 +1705,19 @@ if (v == LOAD) {
} { } {
Fl_Choice {} { Fl_Choice {} {
label {Class:} label {Class:}
user_data {&Widget_Browser::class_font} user_data {&Node_Browser::class_font}
callback cb_Comments open callback cb_Comments open
xywh {100 137 151 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable 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[];} code0 {extern Fl_Menu_Item fontmenu[];}
code1 {o->menu(fontmenu);} code1 {o->menu(fontmenu);}
} {} } {}
Fl_Button {} { Fl_Button {} {
user_data {&Widget_Browser::class_color} user_data {&Node_Browser::class_color}
callback cb_Color_Chip callback cb_Color_Chip
xywh {251 137 51 20} labelsize 11 xywh {251 137 51 20} labelsize 11
} }
Fl_Menu_Button {} { Fl_Menu_Button {} {
user_data {&Widget_Browser::class_color} user_data {&Node_Browser::class_color}
callback cb_Color_Choice open callback cb_Color_Choice open
xywh {302 137 18 20} xywh {302 137 18 20}
code0 {extern Fl_Menu_Item colormenu[];} code0 {extern Fl_Menu_Item colormenu[];}
@ -1727,19 +1730,19 @@ if (v == LOAD) {
} { } {
Fl_Choice {} { Fl_Choice {} {
label {Function:} label {Function:}
user_data {&Widget_Browser::func_font} user_data {&Node_Browser::func_font}
callback cb_Comments open callback cb_Comments open
xywh {100 162 151 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable 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[];} code0 {extern Fl_Menu_Item fontmenu[];}
code1 {o->menu(fontmenu);} code1 {o->menu(fontmenu);}
} {} } {}
Fl_Button {} { Fl_Button {} {
user_data {&Widget_Browser::func_color} user_data {&Node_Browser::func_color}
callback cb_Color_Chip callback cb_Color_Chip
xywh {251 162 51 20} labelsize 11 xywh {251 162 51 20} labelsize 11
} }
Fl_Menu_Button {} { Fl_Menu_Button {} {
user_data {&Widget_Browser::func_color} user_data {&Node_Browser::func_color}
callback cb_Color_Choice open callback cb_Color_Choice open
xywh {302 162 18 20} xywh {302 162 18 20}
code0 {extern Fl_Menu_Item colormenu[];} code0 {extern Fl_Menu_Item colormenu[];}
@ -1752,19 +1755,19 @@ if (v == LOAD) {
} { } {
Fl_Choice {} { Fl_Choice {} {
label {Name:} label {Name:}
user_data {&Widget_Browser::name_font} user_data {&Node_Browser::name_font}
callback cb_Comments open callback cb_Comments open
xywh {100 187 151 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable 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[];} code0 {extern Fl_Menu_Item fontmenu[];}
code1 {o->menu(fontmenu);} code1 {o->menu(fontmenu);}
} {} } {}
Fl_Button {} { Fl_Button {} {
user_data {&Widget_Browser::name_color} user_data {&Node_Browser::name_color}
callback cb_Color_Chip callback cb_Color_Chip
xywh {251 187 51 20} labelsize 11 xywh {251 187 51 20} labelsize 11
} }
Fl_Menu_Button {} { Fl_Menu_Button {} {
user_data {&Widget_Browser::name_color} user_data {&Node_Browser::name_color}
callback cb_Color_Choice open callback cb_Color_Choice open
xywh {302 187 18 20} xywh {302 187 18 20}
code0 {extern Fl_Menu_Item colormenu[];} code0 {extern Fl_Menu_Item colormenu[];}
@ -1777,19 +1780,19 @@ if (v == LOAD) {
} { } {
Fl_Choice {} { Fl_Choice {} {
label {Code:} label {Code:}
user_data {&Widget_Browser::code_font} user_data {&Node_Browser::code_font}
callback cb_Comments open callback cb_Comments open
xywh {100 212 151 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable 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[];} code0 {extern Fl_Menu_Item fontmenu[];}
code1 {o->menu(fontmenu);} code1 {o->menu(fontmenu);}
} {} } {}
Fl_Button {} { Fl_Button {} {
user_data {&Widget_Browser::code_color} user_data {&Node_Browser::code_color}
callback cb_Color_Chip callback cb_Color_Chip
xywh {251 212 51 20} labelsize 11 xywh {251 212 51 20} labelsize 11
} }
Fl_Menu_Button {} { Fl_Menu_Button {} {
user_data {&Widget_Browser::code_color} user_data {&Node_Browser::code_color}
callback cb_Color_Choice open callback cb_Color_Choice open
xywh {302 212 18 20} xywh {302 212 18 20}
code0 {extern Fl_Menu_Item colormenu[];} code0 {extern Fl_Menu_Item colormenu[];}
@ -1802,19 +1805,19 @@ if (v == LOAD) {
} { } {
Fl_Choice w_settings_user_commenttext { Fl_Choice w_settings_user_commenttext {
label {Comments:} label {Comments:}
user_data {&Widget_Browser::comment_font} user_data {&Node_Browser::comment_font}
callback cb_Comments open callback cb_Comments open
xywh {100 237 151 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 textsize 11 resizable 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[];} code0 {extern Fl_Menu_Item fontmenu[];}
code1 {o->menu(fontmenu);} code1 {o->menu(fontmenu);}
} {} } {}
Fl_Button {} { Fl_Button {} {
user_data {&Widget_Browser::comment_color} user_data {&Node_Browser::comment_color}
callback cb_Color_Chip callback cb_Color_Chip
xywh {251 237 51 20} labelsize 11 xywh {251 237 51 20} labelsize 11
} }
Fl_Menu_Button {} { Fl_Menu_Button {} {
user_data {&Widget_Browser::comment_color} user_data {&Node_Browser::comment_color}
callback cb_Color_Choice open callback cb_Color_Choice open
xywh {302 237 18 20} xywh {302 237 18 20}
code0 {extern Fl_Menu_Item colormenu[];} code0 {extern Fl_Menu_Item colormenu[];}

View File

@ -23,7 +23,7 @@
#include "app/Fd_Snap_Action.h" #include "app/Fd_Snap_Action.h"
#include "app/shell_command.h" #include "app/shell_command.h"
#include "tools/fluid_filename.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_Buffer.H>
#include <FL/Fl_Text_Display.H> #include <FL/Fl_Text_Display.H>
#include <FL/fl_string_functions.h> #include <FL/fl_string_functions.h>

View File

@ -26,7 +26,7 @@
#include "panels/function_panel.h" #include "panels/function_panel.h"
#include "panels/settings_panel.h" #include "panels/settings_panel.h"
#include "panels/codeview_panel.h" #include "panels/codeview_panel.h"
#include "widgets/widget_browser.h" #include "widgets/Node_Browser.h"
#include <FL/Enumerations.H> #include <FL/Enumerations.H>
#include <FL/fl_draw.H> #include <FL/fl_draw.H>

View File

@ -19,7 +19,7 @@
#include "app/fluid.h" #include "app/fluid.h"
#include "nodes/factory.h" #include "nodes/factory.h"
#include "nodes/Fl_Window_Type.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_Button.H>
#include <FL/Fl_Window.H> #include <FL/Fl_Window.H>

View File

@ -14,7 +14,7 @@
// https://www.fltk.org/bugs.php // https://www.fltk.org/bugs.php
// //
#include "widgets/widget_browser.h" #include "widgets/Node_Browser.h"
#include "app/fluid.h" #include "app/fluid.h"
#include "nodes/Fl_Widget_Type.h" #include "nodes/Fl_Widget_Type.h"
@ -24,8 +24,18 @@
#include <FL/Fl_Browser_.H> #include <FL/Fl_Browser_.H>
#include <FL/fl_draw.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. A widget that displays the nodes in the widget tree.
@ -36,25 +46,21 @@
\see Fl_Type \see Fl_Type
*/ */
// ---- global variables
/// Global access to the widget browser.
Widget_Browser *widget_browser = NULL;
// ---- static variables // ---- static variables
Fl_Color Widget_Browser::label_color = 72; Fl_Color Node_Browser::label_color = 72;
Fl_Font Widget_Browser::label_font = FL_HELVETICA; Fl_Font Node_Browser::label_font = FL_HELVETICA;
Fl_Color Widget_Browser::class_color = FL_FOREGROUND_COLOR; Fl_Color Node_Browser::class_color = FL_FOREGROUND_COLOR;
Fl_Font Widget_Browser::class_font = FL_HELVETICA_BOLD; Fl_Font Node_Browser::class_font = FL_HELVETICA_BOLD;
Fl_Color Widget_Browser::func_color = FL_FOREGROUND_COLOR; Fl_Color Node_Browser::func_color = FL_FOREGROUND_COLOR;
Fl_Font Widget_Browser::func_font = FL_HELVETICA; Fl_Font Node_Browser::func_font = FL_HELVETICA;
Fl_Color Widget_Browser::name_color = FL_FOREGROUND_COLOR; Fl_Color Node_Browser::name_color = FL_FOREGROUND_COLOR;
Fl_Font Widget_Browser::name_font = FL_HELVETICA; Fl_Font Node_Browser::name_font = FL_HELVETICA;
Fl_Color Widget_Browser::code_color = FL_FOREGROUND_COLOR; Fl_Color Node_Browser::code_color = FL_FOREGROUND_COLOR;
Fl_Font Widget_Browser::code_font = FL_HELVETICA; Fl_Font Node_Browser::code_font = FL_HELVETICA;
Fl_Color Widget_Browser::comment_color = FL_DARK_GREEN; Fl_Color Node_Browser::comment_color = FL_DARK_GREEN;
Fl_Font Widget_Browser::comment_font = FL_HELVETICA; Fl_Font Node_Browser::comment_font = FL_HELVETICA;
// ---- global functions // ---- global functions
@ -69,7 +75,7 @@ void redraw_browser() {
Shortcut to create the widget browser. Shortcut to create the widget browser.
*/ */
Fl_Widget *make_widget_browser(int x,int y,int w,int h) { 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; 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 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 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 \todo It would be nice to be able to grab one or more nodes and move them
within the hierarchy. within the hierarchy.
*/ */
Widget_Browser::Widget_Browser(int X,int Y,int W,int H,const char*l) : Node_Browser::Node_Browser(int X,int Y,int W,int H,const char*l) :
Fl_Browser_(X,Y,W,H,l), Fl_Browser_(X,Y,W,H,l)
pushedtitle(NULL),
saved_h_scroll_(0),
saved_v_scroll_(0)
{ {
type(FL_MULTI_BROWSER); type(FL_MULTI_BROWSER);
Fl_Widget::callback(callback_stub); 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. Override the method to find the first item in the list of elements.
\return the first item \return the first item
*/ */
void *Widget_Browser::item_first() const { void *Node_Browser::item_first() const {
return Fl_Type::first; return Fl_Type::first;
} }
@ -231,7 +234,7 @@ void *Widget_Browser::item_first() const {
\param l this item \param l this item
\return the next item, irregardless of tree depth, or NULL at the end \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; return ((Fl_Type*)l)->next;
} }
@ -240,7 +243,7 @@ void *Widget_Browser::item_next(void *l) const {
\param l this item \param l this item
\return the previous item, irregardless of tree depth, or NULL at the start \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; return ((Fl_Type*)l)->prev;
} }
@ -250,7 +253,7 @@ void *Widget_Browser::item_prev(void *l) const {
\return 1 if selected, 0 if not \return 1 if selected, 0 if not
\todo what is the difference between selected and new_selected, and why do we do this? \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; return ((Fl_Type*)l)->new_selected;
} }
@ -259,7 +262,7 @@ int Widget_Browser::item_selected(void *l) const {
\param l this item \param l this item
\param[in] v 1 if selecting, 0 if not \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; ((Fl_Type*)l)->new_selected = v;
} }
@ -268,7 +271,7 @@ void Widget_Browser::item_select(void *l,int v) {
\param l this item \param l this item
\return height in FLTK units (used to be pixels before high res screens) \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; Fl_Type *t = (Fl_Type*)l;
if (t->visible) { if (t->visible) {
if (show_comments && t->comment()) 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. Override the method to return the estimated height of all items.
\return height in FLTK units \return height in FLTK units
*/ */
int Widget_Browser::incr_height() const { int Node_Browser::incr_height() const {
return textsize() + 5 + linespacing(); 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 \param X,Y these give the position in window coordinates of the top left
corner of this line 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 // cast to a more general type
Fl_Type *l = (Fl_Type *)v; 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 \param v this item
\return width in FLTK units \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 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. 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()); selection_changed((Fl_Type*)selection());
} }
@ -504,7 +507,7 @@ void Widget_Browser::callback() {
\param[in] e the incoming event type \param[in] e the incoming event type
\return 0 if the event is not supported, and 1 if the event was "used up" \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; static Fl_Type *title;
Fl_Type *l; Fl_Type *l;
int X,Y,W,H; bbox(X,Y,W,H); 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. Save the current scrollbar position during rebuild.
*/ */
void Widget_Browser::save_scroll_position() { void Node_Browser::save_scroll_position() {
saved_h_scroll_ = hposition(); saved_h_scroll_ = hposition();
saved_v_scroll_ = vposition(); saved_v_scroll_ = vposition();
} }
@ -579,7 +582,7 @@ void Widget_Browser::save_scroll_position() {
/** /**
Restore the previous scrollbar position after rebuild. Restore the previous scrollbar position after rebuild.
*/ */
void Widget_Browser::restore_scroll_position() { void Node_Browser::restore_scroll_position() {
hposition(saved_h_scroll_); hposition(saved_h_scroll_);
vposition(saved_v_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 This clears internal caches, recalculates the scroll bar sizes, and
sends a redraw() request to the widget. sends a redraw() request to the widget.
*/ */
void Widget_Browser::rebuild() { void Node_Browser::rebuild() {
save_scroll_position(); save_scroll_position();
new_list(); new_list();
damage(FL_DAMAGE_SCROLL); 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. 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. \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) { if (!inNode) {
// Alternative: find the first (last?) visible selected item. // Alternative: find the first (last?) visible selected item.
return; return;
@ -635,7 +638,7 @@ void Widget_Browser::display(Fl_Type *inNode) {
vposition(newV); vposition(newV);
} }
void Widget_Browser::load_prefs() { void Node_Browser::load_prefs() {
int c; int c;
Fl_Preferences p(fluid_prefs, "widget_browser"); Fl_Preferences p(fluid_prefs, "widget_browser");
p.get("label_color", c, 72); label_color = c; 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; 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"); Fl_Preferences p(fluid_prefs, "widget_browser");
p.set("label_color", (int)label_color); p.set("label_color", (int)label_color);
p.set("label_font", (int)label_font); p.set("label_font", (int)label_font);

View File

@ -1,7 +1,7 @@
// //
// Widget Browser code for the Fast Light Tool Kit (FLTK). // 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 // 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 // the file "COPYING" which should have been included with this file. If this
@ -14,50 +14,42 @@
// https://www.fltk.org/bugs.php // https://www.fltk.org/bugs.php
// //
#ifndef _FLUID_WIDGET_BROWSER_H #ifndef FLUID_WIDGETS_NODE_BROWSER_H
#define _FLUID_WIDGET_BROWSER_H #define FLUID_WIDGETS_NODE_BROWSER_H
#include <FL/Fl_Browser_.H> #include <FL/Fl_Browser_.H>
class Fl_Type; class Fl_Type;
class Widget_Browser;
extern Widget_Browser *widget_browser; namespace fld {
namespace widget {
extern void redraw_browser(); class Node_Browser : public Fl_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_
{ {
friend class Fl_Type; friend class Fl_Type;
static void callback_stub(Fl_Widget *o, void *) { static void callback_stub(Fl_Widget *o, void *) {
((Widget_Browser *)o)->callback(); ((Node_Browser *)o)->callback();
} }
Fl_Type* pushedtitle; Fl_Type* pushedtitle { nullptr };
int saved_h_scroll_; int saved_h_scroll_ { 0 };
int saved_v_scroll_; int saved_v_scroll_ { 0 };
// required routines for Fl_Browser_ subclass: // required routines for Fl_Browser_ subclass:
void *item_first() const FL_OVERRIDE; void *item_first() const override;
void *item_next(void *) const FL_OVERRIDE; void *item_next(void *) const override;
void *item_prev(void *) const FL_OVERRIDE; void *item_prev(void *) const override;
int item_selected(void *) const FL_OVERRIDE; int item_selected(void *) const override;
void item_select(void *,int) FL_OVERRIDE; void item_select(void *,int) override;
int item_width(void *) const FL_OVERRIDE; int item_width(void *) const override;
int item_height(void *) const FL_OVERRIDE; int item_height(void *) const override;
void item_draw(void *,int,int,int,int) const FL_OVERRIDE; void item_draw(void *,int,int,int,int) const override;
int incr_height() const FL_OVERRIDE; int incr_height() const override;
public: public:
Widget_Browser(int,int,int,int,const char * =NULL); Node_Browser(int,int,int,int,const char * = nullptr);
int handle(int) FL_OVERRIDE; int handle(int) override;
void callback(); void callback();
void save_scroll_position(); void save_scroll_position();
void restore_scroll_position(); void restore_scroll_position();
@ -81,4 +73,17 @@ public:
static Fl_Font comment_font; 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