From c3571838cb10133aa913efd7523b9543a65459c1 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 7 Mar 2025 18:54:03 +0100 Subject: Fluid: Rebuilding most of the widget directory. One file per logical unit. Namespaces. Non-static data member initializers to never get an uninitialized field again. --- fluid/CMakeLists.txt | 18 ++- fluid/nodes/Fl_Grid_Type.cxx | 18 +-- fluid/nodes/Fl_Menu_Type.cxx | 2 +- fluid/nodes/Fl_Widget_Type.cxx | 48 +++--- fluid/panels/codeview_panel.cxx | 24 +-- fluid/panels/codeview_panel.fl | 14 +- fluid/panels/codeview_panel.h | 11 +- fluid/panels/function_panel.cxx | 210 ++++++++++++------------- fluid/panels/function_panel.fl | 112 ++++++------- fluid/panels/function_panel.h | 6 +- fluid/panels/template_panel.cxx | 38 ++--- fluid/panels/widget_panel.cxx | 162 +++++++++---------- fluid/panels/widget_panel.fl | 54 +++---- fluid/panels/widget_panel.h | 60 +++---- fluid/widgets/Bin_Button.cxx | 128 +++++++++++++++ fluid/widgets/Bin_Button.h | 44 ++++++ fluid/widgets/CodeEditor.cxx | 316 ------------------------------------- fluid/widgets/CodeEditor.h | 105 ------------- fluid/widgets/Code_Editor.cxx | 254 ++++++++++++++++++++++++++++++ fluid/widgets/Code_Editor.h | 70 +++++++++ fluid/widgets/Code_Viewer.cxx | 51 ++++++ fluid/widgets/Code_Viewer.h | 51 ++++++ fluid/widgets/Formula_Input.cxx | 217 +++++++++++++++++++++++++ fluid/widgets/Formula_Input.h | 73 +++++++++ fluid/widgets/StyleParse.cxx | 328 -------------------------------------- fluid/widgets/StyleParse.h | 61 -------- fluid/widgets/Style_Parser.cxx | 331 +++++++++++++++++++++++++++++++++++++++ fluid/widgets/Style_Parser.h | 59 +++++++ fluid/widgets/Text_Viewer.cxx | 58 +++++++ fluid/widgets/Text_Viewer.h | 46 ++++++ fluid/widgets/custom_widgets.cxx | 311 ------------------------------------ fluid/widgets/custom_widgets.h | 90 ----------- 32 files changed, 1775 insertions(+), 1595 deletions(-) create mode 100644 fluid/widgets/Bin_Button.cxx create mode 100644 fluid/widgets/Bin_Button.h delete mode 100644 fluid/widgets/CodeEditor.cxx delete mode 100644 fluid/widgets/CodeEditor.h create mode 100644 fluid/widgets/Code_Editor.cxx create mode 100644 fluid/widgets/Code_Editor.h create mode 100644 fluid/widgets/Code_Viewer.cxx create mode 100644 fluid/widgets/Code_Viewer.h create mode 100644 fluid/widgets/Formula_Input.cxx create mode 100644 fluid/widgets/Formula_Input.h delete mode 100644 fluid/widgets/StyleParse.cxx delete mode 100644 fluid/widgets/StyleParse.h create mode 100644 fluid/widgets/Style_Parser.cxx create mode 100644 fluid/widgets/Style_Parser.h create mode 100644 fluid/widgets/Text_Viewer.cxx create mode 100644 fluid/widgets/Text_Viewer.h delete mode 100644 fluid/widgets/custom_widgets.cxx delete mode 100644 fluid/widgets/custom_widgets.h (limited to 'fluid') diff --git a/fluid/CMakeLists.txt b/fluid/CMakeLists.txt index 4e53bd406..afde756aa 100644 --- a/fluid/CMakeLists.txt +++ b/fluid/CMakeLists.txt @@ -50,9 +50,12 @@ set(CPPFILES rsrcs/pixmaps.cxx tools/autodoc.cxx tools/fluid_filename.cxx - widgets/CodeEditor.cxx - widgets/custom_widgets.cxx - widgets/StyleParse.cxx + widgets/Code_Editor.cxx + widgets/Code_Viewer.cxx + widgets/Text_Viewer.cxx + widgets/Formula_Input.cxx + widgets/Bin_Button.cxx + widgets/Style_Parser.cxx widgets/widget_browser.cxx ) @@ -87,9 +90,12 @@ set(HEADERFILES rsrcs/pixmaps.h tools/autodoc.h tools/fluid_filename.h - widgets/CodeEditor.h - widgets/custom_widgets.h - widgets/StyleParse.h + widgets/Code_Editor.h + widgets/Code_Viewer.h + widgets/Text_Viewer.h + widgets/Formula_Input.h + widgets/Bin_Button.h + widgets/Style_Parser.h widgets/widget_browser.h ) diff --git a/fluid/nodes/Fl_Grid_Type.cxx b/fluid/nodes/Fl_Grid_Type.cxx index 2ae05a0ce..ea2232305 100644 --- a/fluid/nodes/Fl_Grid_Type.cxx +++ b/fluid/nodes/Fl_Grid_Type.cxx @@ -22,7 +22,7 @@ #include "io/file.h" #include "io/code.h" #include "widgets/widget_browser.h" -#include "widgets/custom_widgets.h" +#include "widgets/Formula_Input.h" #include #include @@ -777,11 +777,11 @@ void Fl_Grid_Type::layout_widget() { // TODO: ways to resize rows and columns, add and delete them in the project window, pulldown menu? // TODO: alignment can be FL_GRID_LEFT|FL_GRID_VERTICAL? -extern Fluid_Coord_Input *widget_grid_row_input, *widget_grid_col_input, +extern fld::widget::Formula_Input *widget_grid_row_input, *widget_grid_col_input, *widget_grid_rowspan_input, *widget_grid_colspan_input; extern Fl_Group *widget_tab_grid_child; -void grid_child_cb(Fluid_Coord_Input* i, void* v, int what) { +void grid_child_cb(fld::widget::Formula_Input* i, void* v, int what) { if ( !current_widget || !current_widget->parent || !current_widget->parent->is_a(ID_Grid)) @@ -850,7 +850,7 @@ void grid_child_cb(Fluid_Coord_Input* i, void* v, int what) { } } } -void grid_set_row_cb(Fluid_Coord_Input* i, void* v) { +void grid_set_row_cb(fld::widget::Formula_Input* i, void* v) { grid_child_cb(i, v, 8); if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); } @@ -866,7 +866,7 @@ void grid_inc_row_cb(Fl_Button* i, void* v) { widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); } } -void grid_set_col_cb(Fluid_Coord_Input* i, void* v) { +void grid_set_col_cb(fld::widget::Formula_Input* i, void* v) { grid_child_cb(i, v, 9); if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); } @@ -882,7 +882,7 @@ void grid_inc_col_cb(Fl_Button* i, void* v) { widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); } } -void grid_set_rowspan_cb(Fluid_Coord_Input* i, void* v) { +void grid_set_rowspan_cb(fld::widget::Formula_Input* i, void* v) { grid_child_cb(i, v, 10); if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); } @@ -898,7 +898,7 @@ void grid_inc_rowspan_cb(Fl_Button* i, void* v) { widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); } } -void grid_set_colspan_cb(Fluid_Coord_Input* i, void* v) { +void grid_set_colspan_cb(fld::widget::Formula_Input* i, void* v) { grid_child_cb(i, v, 11); if (v!=LOAD) widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); } @@ -914,10 +914,10 @@ void grid_inc_colspan_cb(Fl_Button* i, void* v) { widget_tab_grid_child->do_callback(widget_tab_grid_child, LOAD); } } -void grid_set_min_wdt_cb(Fluid_Coord_Input* i, void* v) { +void grid_set_min_wdt_cb(fld::widget::Formula_Input* i, void* v) { grid_child_cb(i, v, 12); } -void grid_set_min_hgt_cb(Fluid_Coord_Input* i, void* v) { +void grid_set_min_hgt_cb(fld::widget::Formula_Input* i, void* v) { grid_child_cb(i, v, 13); } diff --git a/fluid/nodes/Fl_Menu_Type.cxx b/fluid/nodes/Fl_Menu_Type.cxx index 684d765f8..2fb80fec2 100644 --- a/fluid/nodes/Fl_Menu_Type.cxx +++ b/fluid/nodes/Fl_Menu_Type.cxx @@ -29,7 +29,7 @@ #include "io/file.h" #include "io/code.h" #include "nodes/Fl_Window_Type.h" -#include "widgets/custom_widgets.h" +#include "widgets/Formula_Input.h" #include "widgets/widget_browser.h" #include diff --git a/fluid/nodes/Fl_Widget_Type.cxx b/fluid/nodes/Fl_Widget_Type.cxx index 27e309cbe..2ed31f0d8 100644 --- a/fluid/nodes/Fl_Widget_Type.cxx +++ b/fluid/nodes/Fl_Widget_Type.cxx @@ -627,92 +627,92 @@ void tooltip_cb(Fl_Input* i, void *v) { } } -Fluid_Coord_Input *x_input, *y_input, *w_input, *h_input; +fld::widget::Formula_Input *x_input, *y_input, *w_input, *h_input; static int widget_i = 0; -static int vars_i_cb(const Fluid_Coord_Input*, void *v) { +static int vars_i_cb(const fld::widget::Formula_Input*, void *v) { return widget_i; } -static int vars_x_cb(const Fluid_Coord_Input*, void *v) { +static int vars_x_cb(const fld::widget::Formula_Input*, void *v) { Fl_Type *t = (Fl_Type*)v; if (t->is_widget()) return ((Fl_Widget_Type*)t)->o->x(); return 0; } -static int vars_y_cb(const Fluid_Coord_Input*, void *v) { +static int vars_y_cb(const fld::widget::Formula_Input*, void *v) { Fl_Type *t = (Fl_Type*)v; if (t->is_widget()) return ((Fl_Widget_Type*)t)->o->y(); return 0; } -static int vars_w_cb(const Fluid_Coord_Input*, void *v) { +static int vars_w_cb(const fld::widget::Formula_Input*, void *v) { Fl_Type *t = (Fl_Type*)v; if (t->is_widget()) return ((Fl_Widget_Type*)t)->o->w(); return 0; } -static int vars_h_cb(const Fluid_Coord_Input*, void *v) { +static int vars_h_cb(const fld::widget::Formula_Input*, void *v) { Fl_Type *t = (Fl_Type*)v; if (t->is_widget()) return ((Fl_Widget_Type*)t)->o->h(); return 0; } -static int vars_px_cb(const Fluid_Coord_Input*, void *v) { +static int vars_px_cb(const fld::widget::Formula_Input*, void *v) { Fl_Type *t = ((Fl_Type*)v)->parent; if (t && t->is_widget()) return ((Fl_Widget_Type*)t)->o->x(); return 0; } -static int vars_py_cb(const Fluid_Coord_Input*, void *v) { +static int vars_py_cb(const fld::widget::Formula_Input*, void *v) { Fl_Type *t = ((Fl_Type*)v)->parent; if (t && t->is_widget()) return ((Fl_Widget_Type*)t)->o->y(); return 0; } -static int vars_pw_cb(const Fluid_Coord_Input*, void *v) { +static int vars_pw_cb(const fld::widget::Formula_Input*, void *v) { Fl_Type *t = ((Fl_Type*)v)->parent; if (t && t->is_widget()) return ((Fl_Widget_Type*)t)->o->w(); return 0; } -static int vars_ph_cb(const Fluid_Coord_Input*, void *v) { +static int vars_ph_cb(const fld::widget::Formula_Input*, void *v) { Fl_Type *t = ((Fl_Type*)v)->parent; if (t && t->is_widget()) return ((Fl_Widget_Type*)t)->o->h(); return 0; } -static int vars_sx_cb(const Fluid_Coord_Input*, void *v) { +static int vars_sx_cb(const fld::widget::Formula_Input*, void *v) { Fl_Type *t = ((Fl_Type*)v)->prev_sibling(); if (t && t->is_widget()) return ((Fl_Widget_Type*)t)->o->x(); return 0; } -static int vars_sy_cb(const Fluid_Coord_Input*, void *v) { +static int vars_sy_cb(const fld::widget::Formula_Input*, void *v) { Fl_Type *t = ((Fl_Type*)v)->prev_sibling(); if (t && t->is_widget()) return ((Fl_Widget_Type*)t)->o->y(); return 0; } -static int vars_sw_cb(const Fluid_Coord_Input*, void *v) { +static int vars_sw_cb(const fld::widget::Formula_Input*, void *v) { Fl_Type *t = ((Fl_Type*)v)->prev_sibling(); if (t && t->is_widget()) return ((Fl_Widget_Type*)t)->o->w(); return 0; } -static int vars_sh_cb(const Fluid_Coord_Input*, void *v) { +static int vars_sh_cb(const fld::widget::Formula_Input*, void *v) { Fl_Type *t = ((Fl_Type*)v)->prev_sibling(); if (t && t->is_widget()) return ((Fl_Widget_Type*)t)->o->h(); @@ -743,27 +743,27 @@ static void calculate_bbox(Fl_Type *p) { } } -static int vars_cx_cb(const Fluid_Coord_Input*, void *v) { +static int vars_cx_cb(const fld::widget::Formula_Input*, void *v) { calculate_bbox((Fl_Type*)v); return bbox_x; } -static int vars_cy_cb(const Fluid_Coord_Input*, void *v) { +static int vars_cy_cb(const fld::widget::Formula_Input*, void *v) { calculate_bbox((Fl_Type*)v); return bbox_y; } -static int vars_cw_cb(const Fluid_Coord_Input*, void *v) { +static int vars_cw_cb(const fld::widget::Formula_Input*, void *v) { calculate_bbox((Fl_Type*)v); return bbox_r - bbox_x; } -static int vars_ch_cb(const Fluid_Coord_Input*, void *v) { +static int vars_ch_cb(const fld::widget::Formula_Input*, void *v) { calculate_bbox((Fl_Type*)v); return bbox_b - bbox_y; } -Fluid_Coord_Input_Vars widget_vars[] = { +fld::widget::Formula_Input_Vars widget_vars[] = { { "i", vars_i_cb }, // zero based counter of selected widgets { "x", vars_x_cb }, // position and size of current widget { "y", vars_y_cb }, @@ -784,7 +784,7 @@ Fluid_Coord_Input_Vars widget_vars[] = { { 0 } }; -void x_cb(Fluid_Coord_Input *i, void *v) { +void x_cb(fld::widget::Formula_Input *i, void *v) { if (v == LOAD) { x_input = i; if (current_widget->is_true_widget()) { @@ -815,7 +815,7 @@ void x_cb(Fluid_Coord_Input *i, void *v) { } } -void y_cb(Fluid_Coord_Input *i, void *v) { +void y_cb(fld::widget::Formula_Input *i, void *v) { if (v == LOAD) { y_input = i; if (current_widget->is_true_widget()) { @@ -845,7 +845,7 @@ void y_cb(Fluid_Coord_Input *i, void *v) { } } -void w_cb(Fluid_Coord_Input *i, void *v) { +void w_cb(fld::widget::Formula_Input *i, void *v) { if (v == LOAD) { w_input = i; if (current_widget->is_true_widget()) { @@ -875,7 +875,7 @@ void w_cb(Fluid_Coord_Input *i, void *v) { } } -void h_cb(Fluid_Coord_Input *i, void *v) { +void h_cb(fld::widget::Formula_Input *i, void *v) { if (v == LOAD) { h_input = i; if (current_widget->is_true_widget()) { @@ -1739,7 +1739,7 @@ void align_text_image_cb(Fl_Choice *i, void *v) { //////////////////////////////////////////////////////////////// -void callback_cb(CodeEditor* i, void *v) { +void callback_cb(fld::widget::Code_Editor* i, void *v) { if (v == LOAD) { const char *cbtext = current_widget->callback(); i->buffer()->text( cbtext ? cbtext : "" ); diff --git a/fluid/panels/codeview_panel.cxx b/fluid/panels/codeview_panel.cxx index 33fb92ebd..6a877896d 100644 --- a/fluid/panels/codeview_panel.cxx +++ b/fluid/panels/codeview_panel.cxx @@ -265,13 +265,13 @@ Fl_Tabs *cv_tab=(Fl_Tabs *)0; Fl_Group *cv_source_tab=(Fl_Group *)0; -CodeViewer *cv_source=(CodeViewer *)0; +fld::widget::Code_Viewer *cv_source=(fld::widget::Code_Viewer *)0; -CodeViewer *cv_header=(CodeViewer *)0; +fld::widget::Code_Viewer *cv_header=(fld::widget::Code_Viewer *)0; -TextViewer *cv_strings=(TextViewer *)0; +fld::widget::Text_Viewer *cv_strings=(fld::widget::Text_Viewer *)0; -TextViewer *cv_project=(TextViewer *)0; +fld::widget::Text_Viewer *cv_project=(fld::widget::Text_Viewer *)0; Fl_Group *cv_find_row=(Fl_Group *)0; @@ -400,7 +400,7 @@ Fl_Double_Window* make_codeview() { cv_tab->callback((Fl_Callback*)update_codeview_position_cb); { cv_source_tab = new Fl_Group(10, 35, 500, 415, "Source"); cv_source_tab->labelsize(13); - { CodeViewer* o = cv_source = new CodeViewer(10, 40, 500, 410); + { fld::widget::Code_Viewer* o = cv_source = new fld::widget::Code_Viewer(10, 40, 500, 410); cv_source->box(FL_DOWN_FRAME); cv_source->color(FL_BACKGROUND2_COLOR); cv_source->selection_color(FL_SELECTION_COLOR); @@ -415,14 +415,14 @@ Fl_Double_Window* make_codeview() { Fl_Group::current()->resizable(cv_source); o->linenumber_width(60); o->linenumber_size(o->Fl_Text_Display::textsize()); - } // CodeViewer* cv_source + } // fld::widget::Code_Viewer* cv_source cv_source_tab->end(); Fl_Group::current()->resizable(cv_source_tab); } // Fl_Group* cv_source_tab { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Header"); o->labelsize(13); o->hide(); - { CodeViewer* o = cv_header = new CodeViewer(10, 40, 500, 410); + { fld::widget::Code_Viewer* o = cv_header = new fld::widget::Code_Viewer(10, 40, 500, 410); cv_header->box(FL_DOWN_FRAME); cv_header->color(FL_BACKGROUND2_COLOR); cv_header->selection_color(FL_SELECTION_COLOR); @@ -437,13 +437,13 @@ Fl_Double_Window* make_codeview() { Fl_Group::current()->resizable(cv_header); o->linenumber_width(60); o->linenumber_size(o->Fl_Text_Display::textsize()); - } // CodeViewer* cv_header + } // fld::widget::Code_Viewer* cv_header o->end(); } // Fl_Group* o { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Strings"); o->labelsize(13); o->hide(); - { TextViewer* o = cv_strings = new TextViewer(10, 40, 500, 410); + { fld::widget::Text_Viewer* o = cv_strings = new fld::widget::Text_Viewer(10, 40, 500, 410); cv_strings->box(FL_DOWN_FRAME); cv_strings->color(FL_BACKGROUND2_COLOR); cv_strings->selection_color(FL_SELECTION_COLOR); @@ -458,13 +458,13 @@ Fl_Double_Window* make_codeview() { Fl_Group::current()->resizable(cv_strings); o->linenumber_width(60); o->linenumber_size(o->Fl_Text_Display::textsize()); - } // TextViewer* cv_strings + } // fld::widget::Text_Viewer* cv_strings o->end(); } // Fl_Group* o { Fl_Group* o = new Fl_Group(10, 35, 500, 415, "Project"); o->labelsize(13); o->hide(); - { TextViewer* o = cv_project = new TextViewer(10, 40, 500, 410); + { fld::widget::Text_Viewer* o = cv_project = new fld::widget::Text_Viewer(10, 40, 500, 410); cv_project->box(FL_DOWN_FRAME); cv_project->color(FL_BACKGROUND2_COLOR); cv_project->selection_color(FL_SELECTION_COLOR); @@ -479,7 +479,7 @@ Fl_Double_Window* make_codeview() { Fl_Group::current()->resizable(cv_project); o->linenumber_width(60); o->linenumber_size(o->Fl_Text_Display::textsize()); - } // TextViewer* cv_project + } // fld::widget::Text_Viewer* cv_project o->end(); } // Fl_Group* o cv_tab->end(); diff --git a/fluid/panels/codeview_panel.fl b/fluid/panels/codeview_panel.fl index 54f0d790f..e2ae3e888 100644 --- a/fluid/panels/codeview_panel.fl +++ b/fluid/panels/codeview_panel.fl @@ -296,10 +296,10 @@ Function {make_codeview()} {open } { Fl_Text_Editor cv_source { xywh {10 40 500 410} textfont 4 textsize 11 resizable - code0 {\#include "widgets/CodeEditor.h"} + code0 {\#include "widgets/Code_Viewer.h"} code1 {o->linenumber_width(60);} code2 {o->linenumber_size(o->Fl_Text_Display::textsize());} - class CodeViewer + class {fld::widget::Code_Viewer} } } Fl_Group {} { @@ -308,10 +308,10 @@ Function {make_codeview()} {open } { Fl_Text_Editor cv_header { xywh {10 40 500 410} textfont 4 textsize 11 resizable - code0 {\#include "widgets/CodeEditor.h"} + code0 {\#include "widgets/Code_Viewer.h"} code1 {o->linenumber_width(60);} code2 {o->linenumber_size(o->Fl_Text_Display::textsize());} - class CodeViewer + class {fld::widget::Code_Viewer} } } Fl_Group {} { @@ -320,9 +320,10 @@ Function {make_codeview()} {open } { Fl_Text_Display cv_strings { xywh {10 40 500 410} textfont 4 textsize 11 resizable + code0 {\#include "widgets/Text_Viewer.h"} code1 {o->linenumber_width(60);} code2 {o->linenumber_size(o->Fl_Text_Display::textsize());} - class TextViewer + class {fld::widget::Text_Viewer} } } Fl_Group {} { @@ -331,9 +332,10 @@ Function {make_codeview()} {open } { Fl_Text_Display cv_project { xywh {10 40 500 410} textfont 4 textsize 11 resizable + code0 {\#include "widgets/Text_Viewer.h"} code1 {o->linenumber_width(60);} code2 {o->linenumber_size(o->Fl_Text_Display::textsize());} - class TextViewer + class {fld::widget::Text_Viewer} } } } diff --git a/fluid/panels/codeview_panel.h b/fluid/panels/codeview_panel.h index 6dbbde1b4..ba30336df 100644 --- a/fluid/panels/codeview_panel.h +++ b/fluid/panels/codeview_panel.h @@ -33,11 +33,12 @@ extern Fl_Double_Window *codeview_panel; extern Fl_Tabs *cv_tab; #include extern Fl_Group *cv_source_tab; -#include "widgets/CodeEditor.h" -extern CodeViewer *cv_source; -extern CodeViewer *cv_header; -extern TextViewer *cv_strings; -extern TextViewer *cv_project; +#include "widgets/Code_Viewer.h" +extern fld::widget::Code_Viewer *cv_source; +extern fld::widget::Code_Viewer *cv_header; +#include "widgets/Text_Viewer.h" +extern fld::widget::Text_Viewer *cv_strings; +extern fld::widget::Text_Viewer *cv_project; extern Fl_Group *cv_find_row; #include extern Fl_Button *cv_find_text_case; diff --git a/fluid/panels/function_panel.cxx b/fluid/panels/function_panel.cxx index 2f8f72817..34f67b881 100644 --- a/fluid/panels/function_panel.cxx +++ b/fluid/panels/function_panel.cxx @@ -22,7 +22,7 @@ #include "nodes/Fl_Type.h" #include "nodes/factory.h" #include "rsrcs/pixmaps.h" -#include "widgets/custom_widgets.h" +#include "widgets/Bin_Button.h" #include "widgets/widget_browser.h" /** @@ -152,7 +152,7 @@ static void cb_code_panel(Fl_Double_Window*, void*) { code_panel->hide(); // otherwise hide..; } -CodeEditor *code_input=(CodeEditor *)0; +fld::widget::Code_Editor *code_input=(fld::widget::Code_Editor *)0; Fl_Return_Button *code_panel_ok=(Fl_Return_Button *)0; @@ -162,7 +162,7 @@ Fl_Double_Window* make_code_panel() { { Fl_Double_Window* o = code_panel = new Fl_Double_Window(540, 180, "Code Properties"); code_panel->labelsize(11); code_panel->callback((Fl_Callback*)cb_code_panel); - { CodeEditor* o = code_input = new CodeEditor(10, 10, 520, 130); + { fld::widget::Code_Editor* o = code_input = new fld::widget::Code_Editor(10, 10, 520, 130); code_input->box(FL_DOWN_BOX); code_input->color(FL_BACKGROUND2_COLOR); code_input->selection_color(FL_SELECTION_COLOR); @@ -176,7 +176,7 @@ Fl_Double_Window* make_code_panel() { code_input->when(FL_WHEN_RELEASE); Fl_Group::current()->resizable(code_input); o->when(FL_WHEN_ENTER_KEY_CHANGED|FL_WHEN_RELEASE); - } // CodeEditor* code_input + } // fld::widget::Code_Editor* code_input { Fl_Group* o = new Fl_Group(10, 150, 520, 20); o->labelsize(11); { code_panel_ok = new Fl_Return_Button(400, 150, 60, 20, "OK"); @@ -385,7 +385,7 @@ Fl_Menu_Item menu_decl_class_choice[] = { {0,0,0,0,0,0,0,0,0} }; -CodeEditor *decl_input=(CodeEditor *)0; +fld::widget::Code_Editor *decl_input=(fld::widget::Code_Editor *)0; Fl_Text_Editor *decl_comment_input=(Fl_Text_Editor *)0; @@ -417,7 +417,7 @@ Fl_Double_Window* make_decl_panel() { { Fl_Tile* o = new Fl_Tile(10, 40, 320, 180); { Fl_Group* o = new Fl_Group(10, 40, 320, 100); o->box(FL_FLAT_BOX); - { decl_input = new CodeEditor(10, 40, 320, 45, "This can be any declaration, like \"int x;\", an external symbol like \"exter" + { decl_input = new fld::widget::Code_Editor(10, 40, 320, 45, "This can be any declaration, like \"int x;\", an external symbol like \"exter" "n int foo();\", a #directive like \"#include \", a comment like \"//foo" "\" or \"/*foo*/\", or typedef like \"typedef char byte;\" or \"using std::list" ";\"."); @@ -431,7 +431,7 @@ Fl_Double_Window* make_decl_panel() { decl_input->align(Fl_Align(134)); decl_input->when(FL_WHEN_RELEASE); Fl_Group::current()->resizable(decl_input); - } // CodeEditor* decl_input + } // fld::widget::Code_Editor* decl_input { Fl_Box* o = new Fl_Box(20, 139, 300, 1); o->box(FL_BORDER_FRAME); o->color((Fl_Color)43); @@ -816,7 +816,7 @@ Fl_Window* make_widgetbin() { o->callback((Fl_Callback*)type_make_cb, (void*)("CodeBlock")); o->image(pixmap[ID_CodeBlock]); } // Fl_Button* o - { Widget_Bin_Window_Button* o = new Widget_Bin_Window_Button(55, 46, 24, 24); + { fld::widget::Bin_Window_Button* o = new fld::widget::Bin_Window_Button(55, 46, 24, 24); o->tooltip("Widget Class"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -829,7 +829,7 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Widget_Class]); - } // Widget_Bin_Window_Button* o + } // 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); @@ -852,7 +852,7 @@ Fl_Window* make_widgetbin() { } // Fl_Group* o { Fl_Group* o = new Fl_Group(87, 19, 79, 79, "Groups"); o->labelsize(12); - { Widget_Bin_Window_Button* o = new Widget_Bin_Window_Button(89, 21, 24, 24); + { fld::widget::Bin_Window_Button* o = new fld::widget::Bin_Window_Button(89, 21, 24, 24); o->tooltip("Window"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -865,8 +865,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Window]); - } // Widget_Bin_Window_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(114, 21, 24, 24); + } // fld::widget::Bin_Window_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(114, 21, 24, 24); o->tooltip("Group"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -879,8 +879,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Group]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(139, 21, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(139, 21, 24, 24); o->tooltip("Pack"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -893,8 +893,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Pack]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(89, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(89, 46, 24, 24); o->tooltip("Tabs"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -907,8 +907,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Tabs]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(114, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(114, 46, 24, 24); o->tooltip("Scroll"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -921,8 +921,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Scroll]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(139, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(139, 46, 24, 24); o->tooltip("Flex"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -935,8 +935,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Flex]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(89, 71, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(89, 71, 24, 24); o->tooltip("Tile"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -949,8 +949,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Tile]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(114, 71, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(114, 71, 24, 24); o->tooltip("Wizard"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -963,8 +963,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Wizard]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(139, 71, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(139, 71, 24, 24); o->tooltip("Grid"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -977,12 +977,12 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Grid]); - } // Widget_Bin_Button* o + } // fld::widget::Bin_Button* o o->end(); } // Fl_Group* o { Fl_Group* o = new Fl_Group(171, 19, 54, 79, "Buttons"); o->labelsize(12); - { Widget_Bin_Button* o = new Widget_Bin_Button(173, 21, 24, 24); + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(173, 21, 24, 24); o->tooltip("Button"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -995,8 +995,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Button]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(198, 21, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(198, 21, 24, 24); o->tooltip("Return Button"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1009,8 +1009,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Return_Button]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(173, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(173, 46, 24, 24); o->tooltip("Light Button"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1023,8 +1023,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Light_Button]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(198, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(198, 46, 24, 24); o->tooltip("Repeat Button"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1037,8 +1037,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Repeat_Button]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(173, 71, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(173, 71, 24, 24); o->tooltip("Check Button"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1051,8 +1051,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Check_Button]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(198, 71, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(198, 71, 24, 24); o->tooltip("Round Button"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1065,12 +1065,12 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Round_Button]); - } // Widget_Bin_Button* o + } // fld::widget::Bin_Button* o o->end(); } // Fl_Group* o { Fl_Group* o = new Fl_Group(230, 19, 104, 79, "Valuators"); o->labelsize(12); - { Widget_Bin_Button* o = new Widget_Bin_Button(232, 21, 24, 24); + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(232, 21, 24, 24); o->tooltip("Slider"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1083,8 +1083,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Slider]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(257, 21, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(257, 21, 24, 24); o->tooltip("Scroll Bar"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1097,8 +1097,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Scrollbar]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(282, 21, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(282, 21, 24, 24); o->tooltip("Value Slider"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1111,8 +1111,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Value_Slider]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(307, 21, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(307, 21, 24, 24); o->tooltip("Value Output"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1125,8 +1125,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Value_Output]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(232, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(232, 46, 24, 24); o->tooltip("Adjuster"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1139,8 +1139,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Adjuster]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(257, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(257, 46, 24, 24); o->tooltip("Counter"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1153,8 +1153,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Counter]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(282, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(282, 46, 24, 24); o->tooltip("Dial"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1167,8 +1167,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Dial]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(232, 71, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(232, 71, 24, 24); o->tooltip("Roller"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1181,8 +1181,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Roller]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(257, 71, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(257, 71, 24, 24); o->tooltip("Spinner"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1195,8 +1195,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Spinner]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(282, 71, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(282, 71, 24, 24); o->tooltip("Value Input"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1209,12 +1209,12 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Value_Input]); - } // Widget_Bin_Button* o + } // fld::widget::Bin_Button* o o->end(); } // Fl_Group* o { Fl_Group* o = new Fl_Group(339, 19, 54, 79, "Text"); o->labelsize(12); - { Widget_Bin_Button* o = new Widget_Bin_Button(341, 21, 24, 24); + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(341, 21, 24, 24); o->tooltip("Input"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1227,8 +1227,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Input]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(366, 21, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(366, 21, 24, 24); o->tooltip("Output"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1241,8 +1241,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Output]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(341, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(341, 46, 24, 24); o->tooltip("Text Edit"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1255,8 +1255,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Text_Editor]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(366, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(366, 46, 24, 24); o->tooltip("Text Display"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1269,8 +1269,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Text_Display]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(341, 71, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(341, 71, 24, 24); o->tooltip("File Input"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1283,8 +1283,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_File_Input]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(366, 71, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(366, 71, 24, 24); o->tooltip("Terminal"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1297,12 +1297,12 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Terminal]); - } // Widget_Bin_Button* o + } // fld::widget::Bin_Button* o o->end(); } // Fl_Group* o { Fl_Group* o = new Fl_Group(398, 19, 79, 79, "Menus"); o->labelsize(12); - { Widget_Bin_Button* o = new Widget_Bin_Button(400, 22, 24, 24); + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(400, 22, 24, 24); o->tooltip("Input Choice"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1315,8 +1315,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Input_Choice]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(425, 21, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(425, 21, 24, 24); o->tooltip("Menu Item"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1329,8 +1329,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Menu_Item]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(450, 21, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(450, 21, 24, 24); o->tooltip("Menu Bar"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1343,8 +1343,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Menu_Bar]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(400, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(400, 46, 24, 24); o->tooltip("Menu Button"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1357,8 +1357,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Menu_Button]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(425, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(425, 46, 24, 24); o->tooltip("Checkbox Menu Item"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1371,8 +1371,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Checkbox_Menu_Item]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(450, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(450, 46, 24, 24); o->tooltip("Sub Menu"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1385,8 +1385,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Submenu]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(400, 71, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(400, 71, 24, 24); o->tooltip("Choice"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1399,8 +1399,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Choice]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(425, 71, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(425, 71, 24, 24); o->tooltip("Radio Menu Item"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1413,12 +1413,12 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Radio_Menu_Item]); - } // Widget_Bin_Button* o + } // fld::widget::Bin_Button* o o->end(); } // Fl_Group* o { Fl_Group* o = new Fl_Group(482, 19, 54, 79, "Browsers"); o->labelsize(12); - { Widget_Bin_Button* o = new Widget_Bin_Button(484, 21, 24, 24); + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(484, 21, 24, 24); o->tooltip("Browser"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1431,8 +1431,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Browser]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(509, 21, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(509, 21, 24, 24); o->tooltip("Tree"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1445,8 +1445,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Tree]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(484, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(484, 46, 24, 24); o->tooltip("Check Browser"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1459,8 +1459,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Check_Browser]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(509, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(509, 46, 24, 24); o->tooltip("Help Browser"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1473,8 +1473,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Help_View]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(484, 71, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(484, 71, 24, 24); o->tooltip("File Browser"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1487,8 +1487,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_File_Browser]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(509, 71, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(509, 71, 24, 24); o->tooltip("Table"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1501,12 +1501,12 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Table]); - } // Widget_Bin_Button* o + } // fld::widget::Bin_Button* o o->end(); } // Fl_Group* o { Fl_Group* o = new Fl_Group(540, 19, 55, 79, "Misc"); o->labelsize(12); - { Widget_Bin_Button* o = new Widget_Bin_Button(542, 21, 24, 24); + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(542, 21, 24, 24); o->tooltip("Box"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1519,8 +1519,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Box]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(567, 21, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(567, 21, 24, 24); o->tooltip("Clock"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1533,8 +1533,8 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Clock]); - } // Widget_Bin_Button* o - { Widget_Bin_Button* o = new Widget_Bin_Button(542, 46, 24, 24); + } // fld::widget::Bin_Button* o + { fld::widget::Bin_Button* o = new fld::widget::Bin_Button(542, 46, 24, 24); o->tooltip("Progress"); o->box(FL_THIN_UP_BOX); o->color(FL_BACKGROUND_COLOR); @@ -1547,7 +1547,7 @@ Fl_Window* make_widgetbin() { o->align(Fl_Align(FL_ALIGN_CENTER)); o->when(FL_WHEN_RELEASE); o->image(pixmap[ID_Progress]); - } // Widget_Bin_Button* o + } // fld::widget::Bin_Button* o o->end(); } // Fl_Group* o widgetbin_panel->set_non_modal(); diff --git a/fluid/panels/function_panel.fl b/fluid/panels/function_panel.fl index 5ad6325fc..b63b4bf50 100644 --- a/fluid/panels/function_panel.fl +++ b/fluid/panels/function_panel.fl @@ -28,7 +28,7 @@ comment {// decl {\#include "app/fluid.h"} {private local } -decl {\#include "app/undo.h"} {selected private local +decl {\#include "app/undo.h"} {private local } decl {\#include "nodes/Fl_Type.h"} {private local @@ -40,7 +40,7 @@ decl {\#include "nodes/factory.h"} {private local decl {\#include "rsrcs/pixmaps.h"} {private local } -decl {\#include "widgets/custom_widgets.h"} {private global +decl {\#include "widgets/Bin_Button.h"} {private global } decl {\#include "widgets/widget_browser.h"} {private local @@ -152,8 +152,8 @@ code_panel->hide(); // otherwise hide..} Fl_Text_Editor code_input { xywh {10 10 520 130} box DOWN_BOX labelsize 11 textfont 4 textsize 11 resizable code0 {o->when(FL_WHEN_ENTER_KEY_CHANGED|FL_WHEN_RELEASE);} - code1 {\#include "widgets/CodeEditor.h"} - class CodeEditor + code1 {\#include "widgets/Code_Editor.h"} + class {fld::widget::Code_Editor} } Fl_Group {} {open xywh {10 150 520 20} labelsize 11 @@ -343,8 +343,8 @@ Function {make_decl_panel()} {open Fl_Text_Editor decl_input { label {This can be any declaration, like "int x;", an external symbol like "extern int foo();", a \#directive like "\#include ", a comment like "//foo" or "/*foo*/", or typedef like "typedef char byte;" or "using std::list;".} xywh {10 40 320 45} labelsize 11 align 134 resizable - code0 {\#include "widgets/CodeEditor.h"} - class CodeEditor + code0 {\#include "widgets/Code_Editor.h"} + class {fld::widget::Code_Editor} } Fl_Box {} { xywh {20 139 300 1} box BORDER_FRAME color 43 @@ -643,7 +643,7 @@ else callback type_make_cb tooltip {Widget Class} xywh {55 46 24 24} box THIN_UP_BOX code0 {o->image(pixmap[ID_Widget_Class]);} - class Widget_Bin_Window_Button + class {fld::widget::Bin_Window_Button} } Fl_Button {} { user_data {"decl"} @@ -673,63 +673,63 @@ else callback type_make_cb tooltip Window xywh {89 21 24 24} box THIN_UP_BOX code0 {o->image(pixmap[ID_Window]);} - class Widget_Bin_Window_Button + class {fld::widget::Bin_Window_Button} } Fl_Button {} { user_data {"Fl_Group"} - callback type_make_cb + callback type_make_cb selected tooltip Group xywh {114 21 24 24} box THIN_UP_BOX code0 {o->image(pixmap[ID_Group]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + class {fld::widget::Bin_Button} } } Fl_Group {} { @@ -741,42 +741,42 @@ else callback type_make_cb tooltip Button xywh {173 21 24 24} box THIN_UP_BOX code0 {o->image(pixmap[ID_Button]);} - class Widget_Bin_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]);} - class Widget_Bin_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]);} - class Widget_Bin_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]);} - class Widget_Bin_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]);} - class Widget_Bin_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]);} - class Widget_Bin_Button + class {fld::widget::Bin_Button} } } Fl_Group {} { @@ -788,70 +788,70 @@ else callback type_make_cb tooltip Slider xywh {232 21 24 24} box THIN_UP_BOX code0 {o->image(pixmap[ID_Slider]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + class {fld::widget::Bin_Button} } } Fl_Group {} { @@ -863,42 +863,42 @@ else callback type_make_cb tooltip Input xywh {341 21 24 24} box THIN_UP_BOX code0 {o->image(pixmap[ID_Input]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + class {fld::widget::Bin_Button} } } Fl_Group {} { @@ -910,56 +910,56 @@ else callback type_make_cb tooltip {Input Choice} xywh {400 22 24 24} box THIN_UP_BOX code0 {o->image(pixmap[ID_Input_Choice]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + class {fld::widget::Bin_Button} } } Fl_Group {} { @@ -971,42 +971,42 @@ else callback type_make_cb tooltip Browser xywh {484 21 24 24} box THIN_UP_BOX code0 {o->image(pixmap[ID_Browser]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + class {fld::widget::Bin_Button} } } Fl_Group {} { @@ -1018,21 +1018,21 @@ else callback type_make_cb tooltip Box xywh {542 21 24 24} box THIN_UP_BOX code0 {o->image(pixmap[ID_Box]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + 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]);} - class Widget_Bin_Button + class {fld::widget::Bin_Button} } } } diff --git a/fluid/panels/function_panel.h b/fluid/panels/function_panel.h index 9dffa5c04..b7c9f749d 100644 --- a/fluid/panels/function_panel.h +++ b/fluid/panels/function_panel.h @@ -41,8 +41,8 @@ Fl_Double_Window* make_function_panel(); extern Fl_Menu_Item menu_f_public_member_choice[]; extern Fl_Menu_Item menu_f_public_choice[]; extern Fl_Double_Window *code_panel; -#include "widgets/CodeEditor.h" -extern CodeEditor *code_input; +#include "widgets/Code_Editor.h" +extern fld::widget::Code_Editor *code_input; extern Fl_Return_Button *code_panel_ok; extern Fl_Button *code_panel_cancel; Fl_Double_Window* make_code_panel(); @@ -68,7 +68,7 @@ extern Fl_Double_Window *decl_panel; extern Fl_Choice *decl_choice; extern Fl_Choice *decl_class_choice; #include -extern CodeEditor *decl_input; +extern fld::widget::Code_Editor *decl_input; extern Fl_Text_Editor *decl_comment_input; extern Fl_Return_Button *decl_panel_ok; extern Fl_Button *decl_panel_cancel; diff --git a/fluid/panels/template_panel.cxx b/fluid/panels/template_panel.cxx index ec4a5e29a..c93500d72 100644 --- a/fluid/panels/template_panel.cxx +++ b/fluid/panels/template_panel.cxx @@ -219,25 +219,25 @@ void template_delete_cb(Fl_Button *, void *) { static int tmpl_FLTK_License_fl_size = 614; static unsigned char tmpl_FLTK_License_fl[397] = /* data compressed and inlined from ../templates/FLTK_License.fl */ -{120,156,133,82,77,79,27,49,16,189,239,175,120,162,23,144,202,110,130,56,20, -78,208,80,170,8,148,34,17,14,61,33,239,122,118,61,194,177,87,246,44,75,26,229, -191,215,94,18,245,88,159,236,241,251,154,177,191,64,43,81,104,217,18,90,31,32, -134,112,111,229,13,47,145,2,150,78,40,180,170,33,220,81,228,206,165,210,105,107, -7,214,103,197,59,133,200,222,97,94,206,46,103,243,194,144,210,20,94,157,218, -16,118,165,217,23,141,215,116,60,54,31,31,185,176,217,144,19,236,170,170,168, -42,220,44,87,207,235,219,213,226,199,205,63,95,21,5,143,220,25,193,218,123,139, -7,22,156,222,63,174,31,206,202,226,147,180,240,253,54,76,128,249,213,213,183, -243,139,217,197,37,234,45,190,179,181,120,238,89,254,168,55,40,167,225,147,92, -136,71,214,218,112,132,229,58,168,176,69,218,182,129,8,209,183,50,170,64,37,238, -56,74,224,122,144,220,78,102,15,145,48,185,68,36,0,252,32,150,29,105,176,203, -106,57,233,52,174,147,197,175,167,223,203,213,207,19,140,134,27,131,104,252,96, -53,140,122,39,212,68,46,225,27,59,232,68,28,89,76,226,101,235,68,44,129,101,59, -29,179,220,36,149,110,54,28,35,187,14,105,22,90,109,84,71,250,43,98,202,153, -237,44,55,228,82,40,37,215,135,150,242,50,34,125,188,174,170,113,28,203,54,61, -89,233,67,87,29,50,149,189,233,15,208,39,75,42,113,143,90,173,183,214,143,217, -169,79,38,72,45,27,63,66,60,2,245,62,8,234,161,139,211,20,82,158,129,226,127,13, -51,254,232,182,199,142,221,107,244,67,72,63,38,237,62,63,69,177,47,254,2,228, -190,201,192}; +{120,156,133,82,77,79,27,49,16,189,239,175,120,130,11,72,237,110,130,90,169, +112,130,134,82,69,160,20,137,244,208,19,242,174,103,215,35,28,123,101,123,89, +210,40,255,157,241,146,168,199,250,100,143,223,215,140,125,10,173,146,66,203, +150,208,250,128,100,8,119,54,189,224,119,164,128,165,75,20,90,213,16,110,41,114, +231,164,116,214,218,129,245,121,241,74,33,178,119,152,151,179,47,179,121,97,72, +105,10,207,78,109,8,187,210,236,139,198,107,58,30,155,183,183,92,216,108,200,37, +236,170,170,168,42,92,47,87,79,235,155,213,226,199,245,63,95,21,19,30,184,51,9, +107,239,45,238,57,225,236,238,97,125,127,94,22,31,164,133,239,183,97,2,204,47, +47,191,125,190,152,93,124,69,189,197,119,182,22,79,61,167,191,234,5,202,105, +120,145,11,241,200,90,27,142,176,92,7,21,182,144,109,27,136,16,125,155,70,21, +168,196,45,199,20,184,30,82,110,39,179,135,72,152,92,34,4,0,63,36,203,142,52, +216,101,181,156,116,26,215,201,226,215,227,159,229,234,231,9,70,195,141,65,52, +126,176,26,70,189,18,106,34,39,248,198,14,90,136,35,39,35,188,108,45,196,18,88, +182,211,49,203,77,82,114,179,225,24,217,117,144,89,104,181,81,29,233,79,136,146, +51,219,89,110,200,73,40,149,174,14,45,229,101,82,234,227,85,85,141,227,88,182, +242,100,165,15,93,117,200,84,246,166,63,64,31,45,41,225,30,181,90,111,173,31, +179,83,47,38,144,150,141,31,145,60,2,245,62,36,212,67,23,167,41,72,158,129,226, +127,13,51,254,232,182,199,142,221,115,244,67,144,31,35,187,143,79,81,236,139, +119,230,100,201,193}; static int tmpl_1of7GUIs_fl_size = 763; static unsigned char tmpl_1of7GUIs_fl[486] = /* data compressed and inlined from ../templates/1of7GUIs.fl */ diff --git a/fluid/panels/widget_panel.cxx b/fluid/panels/widget_panel.cxx index cd3779851..df903d4a2 100644 --- a/fluid/panels/widget_panel.cxx +++ b/fluid/panels/widget_panel.cxx @@ -52,9 +52,9 @@ static void cb_image_panel_data(Fl_Box* o, void* v) { } } -Fluid_Coord_Input *image_panel_imagew=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *image_panel_imagew=(fld::widget::Formula_Input *)0; -static void cb_image_panel_imagew(Fluid_Coord_Input* o, void* v) { +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)) { o->value(current_widget->scale_image_w_); @@ -82,9 +82,9 @@ static void cb_image_panel_imagew(Fluid_Coord_Input* o, void* v) { } } -Fluid_Coord_Input *image_panel_imageh=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *image_panel_imageh=(fld::widget::Formula_Input *)0; -static void cb_image_panel_imageh(Fluid_Coord_Input* o, void* v) { +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)) { o->value(current_widget->scale_image_h_); @@ -144,9 +144,9 @@ static void cb_image_panel_dedata(Fl_Box* o, void* v) { } } -Fluid_Coord_Input *image_panel_deimagew=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *image_panel_deimagew=(fld::widget::Formula_Input *)0; -static void cb_image_panel_deimagew(Fluid_Coord_Input* o, void* v) { +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)) { o->value(current_widget->scale_deimage_w_); @@ -174,9 +174,9 @@ static void cb_image_panel_deimagew(Fluid_Coord_Input* o, void* v) { } } -Fluid_Coord_Input *image_panel_deimageh=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *image_panel_deimageh=(fld::widget::Formula_Input *)0; -static void cb_image_panel_deimageh(Fluid_Coord_Input* o, void* v) { +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)) { o->value(current_widget->scale_deimage_h_); @@ -240,7 +240,7 @@ Fl_Double_Window* make_image_panel() { } // Fl_Box* image_panel_data { Fl_Group* o = new Fl_Group(75, 75, 170, 20); o->callback((Fl_Callback*)propagate_load); - { image_panel_imagew = new Fluid_Coord_Input(75, 75, 55, 20, "Width:"); + { image_panel_imagew = new fld::widget::Formula_Input(75, 75, 55, 20, "Width:"); image_panel_imagew->tooltip("Scale image to this width in pixel units"); image_panel_imagew->box(FL_DOWN_BOX); image_panel_imagew->color(FL_BACKGROUND2_COLOR); @@ -253,8 +253,8 @@ Fl_Double_Window* make_image_panel() { image_panel_imagew->callback((Fl_Callback*)cb_image_panel_imagew); image_panel_imagew->align(Fl_Align(FL_ALIGN_TOP_LEFT)); image_panel_imagew->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* image_panel_imagew - { image_panel_imageh = new Fluid_Coord_Input(135, 75, 55, 20, "Height:"); + } // fld::widget::Formula_Input* image_panel_imagew + { image_panel_imageh = new fld::widget::Formula_Input(135, 75, 55, 20, "Height:"); image_panel_imageh->tooltip("Scale image to this height in pixel units"); image_panel_imageh->box(FL_DOWN_BOX); image_panel_imageh->color(FL_BACKGROUND2_COLOR); @@ -267,7 +267,7 @@ Fl_Double_Window* make_image_panel() { image_panel_imageh->callback((Fl_Callback*)cb_image_panel_imageh); image_panel_imageh->align(Fl_Align(FL_ALIGN_TOP_LEFT)); image_panel_imageh->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* image_panel_imageh + } // fld::widget::Formula_Input* image_panel_imageh { Fl_Button* o = new Fl_Button(195, 75, 50, 20, "Reset"); o->tooltip("Reset scale to original size"); o->labelsize(11); @@ -316,7 +316,7 @@ Fl_Double_Window* make_image_panel() { } // Fl_Box* image_panel_dedata { Fl_Group* o = new Fl_Group(75, 215, 170, 20); o->callback((Fl_Callback*)propagate_load); - { image_panel_deimagew = new Fluid_Coord_Input(75, 215, 55, 20, "Width:"); + { image_panel_deimagew = new fld::widget::Formula_Input(75, 215, 55, 20, "Width:"); image_panel_deimagew->tooltip("Scale image to this width in pixel units"); image_panel_deimagew->box(FL_DOWN_BOX); image_panel_deimagew->color(FL_BACKGROUND2_COLOR); @@ -329,8 +329,8 @@ Fl_Double_Window* make_image_panel() { image_panel_deimagew->callback((Fl_Callback*)cb_image_panel_deimagew); image_panel_deimagew->align(Fl_Align(FL_ALIGN_TOP_LEFT)); image_panel_deimagew->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* image_panel_deimagew - { image_panel_deimageh = new Fluid_Coord_Input(135, 215, 55, 20, "Height:"); + } // fld::widget::Formula_Input* image_panel_deimagew + { image_panel_deimageh = new fld::widget::Formula_Input(135, 215, 55, 20, "Height:"); image_panel_deimageh->tooltip("Scale image to this height in pixel units"); image_panel_deimageh->box(FL_DOWN_BOX); image_panel_deimageh->color(FL_BACKGROUND2_COLOR); @@ -343,7 +343,7 @@ Fl_Double_Window* make_image_panel() { image_panel_deimageh->callback((Fl_Callback*)cb_image_panel_deimageh); image_panel_deimageh->align(Fl_Align(FL_ALIGN_TOP_LEFT)); image_panel_deimageh->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* image_panel_deimageh + } // fld::widget::Formula_Input* image_panel_deimageh { Fl_Button* o = new Fl_Button(195, 215, 50, 20, "Reset"); o->tooltip("Reset scale to original size"); o->labelsize(11); @@ -460,13 +460,13 @@ Fl_Menu_Item menu_1[] = { {0,0,0,0,0,0,0,0,0} }; -Fluid_Coord_Input *widget_x_input=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *widget_x_input=(fld::widget::Formula_Input *)0; -Fluid_Coord_Input *widget_y_input=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *widget_y_input=(fld::widget::Formula_Input *)0; -Fluid_Coord_Input *widget_w_input=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *widget_w_input=(fld::widget::Formula_Input *)0; -Fluid_Coord_Input *widget_h_input=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *widget_h_input=(fld::widget::Formula_Input *)0; Fl_Menu_Item menu_Children[] = { {"Fixed", 0, 0, 0, 0, (uchar)FL_NORMAL_LABEL, 0, 11, 0}, @@ -541,7 +541,7 @@ static void cb_1(Fl_Tile*, void* v) { Fl_Text_Editor *wComment=(Fl_Text_Editor *)0; -CodeEditor *wCallback=(CodeEditor *)0; +fld::widget::Code_Editor *wCallback=(fld::widget::Code_Editor *)0; Fl_Group *wp_cpp_callback=(Fl_Group *)0; @@ -555,9 +555,9 @@ Fl_Box *w_when_box=(Fl_Box *)0; Fl_Group *widget_tab_grid_child=(Fl_Group *)0; -Fluid_Coord_Input *widget_grid_row_input=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *widget_grid_row_input=(fld::widget::Formula_Input *)0; -Fluid_Coord_Input *widget_grid_col_input=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *widget_grid_col_input=(fld::widget::Formula_Input *)0; Fl_Box *widget_grid_transient=(Fl_Box *)0; @@ -599,15 +599,15 @@ Fl_Menu_Item menu_Vertical[] = { Fl_Group *wp_gridc_size=(Fl_Group *)0; -Fluid_Coord_Input *widget_grid_rowspan_input=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *widget_grid_rowspan_input=(fld::widget::Formula_Input *)0; -Fluid_Coord_Input *widget_grid_colspan_input=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *widget_grid_colspan_input=(fld::widget::Formula_Input *)0; Fl_Group *widget_tab_grid=(Fl_Group *)0; -Fluid_Coord_Input *widget_grid_rows=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *widget_grid_rows=(fld::widget::Formula_Input *)0; -static void cb_widget_grid_rows(Fluid_Coord_Input* o, void* v) { +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; @@ -647,9 +647,9 @@ static void cb_3(Fl_Button*, void* v) { } } -Fluid_Coord_Input *widget_grid_cols=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *widget_grid_cols=(fld::widget::Formula_Input *)0; -static void cb_widget_grid_cols(Fluid_Coord_Input* o, void* v) { +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; @@ -818,9 +818,9 @@ static void cb_Row1(Fl_Group* o, void* v) { } } -Fluid_Coord_Input *widget_grid_curr_row=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *widget_grid_curr_row=(fld::widget::Formula_Input *)0; -static void cb_widget_grid_curr_row(Fluid_Coord_Input* o, void* v) { +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; @@ -850,7 +850,7 @@ static void cb_7(Fl_Button*, void* v) { Fl_Group *widget_grid_curr_row_attributes=(Fl_Group *)0; -static void cb_Height(Fluid_Coord_Input* o, void* v) { +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(); @@ -868,7 +868,7 @@ static void cb_Height(Fluid_Coord_Input* o, void* v) { } } -static void cb_Weight(Fluid_Coord_Input* o, void* v) { +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(); @@ -886,7 +886,7 @@ static void cb_Weight(Fluid_Coord_Input* o, void* v) { } } -static void cb_Gap(Fluid_Coord_Input* o, void* v) { +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(); @@ -904,9 +904,9 @@ static void cb_Gap(Fluid_Coord_Input* o, void* v) { } } -Fluid_Coord_Input *widget_grid_curr_col=(Fluid_Coord_Input *)0; +fld::widget::Formula_Input *widget_grid_curr_col=(fld::widget::Formula_Input *)0; -static void cb_widget_grid_curr_col(Fluid_Coord_Input* o, void* v) { +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; @@ -936,7 +936,7 @@ static void cb_9(Fl_Button*, void* v) { Fl_Group *widget_grid_curr_col_attributes=(Fl_Group *)0; -static void cb_Width(Fluid_Coord_Input* o, void* v) { +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(); @@ -954,7 +954,7 @@ static void cb_Width(Fluid_Coord_Input* o, void* v) { } } -static void cb_Weight1(Fluid_Coord_Input* o, void* v) { +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(); @@ -972,7 +972,7 @@ static void cb_Weight1(Fluid_Coord_Input* o, void* v) { } } -static void cb_Gap1(Fluid_Coord_Input* o, void* v) { +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(); @@ -1177,7 +1177,7 @@ Fl_Double_Window* make_widget_panel() { o->labelsize(11); o->callback((Fl_Callback*)position_group_cb); o->align(Fl_Align(FL_ALIGN_LEFT)); - { widget_x_input = new Fluid_Coord_Input(95, 150, 55, 20, "X:"); + { widget_x_input = new fld::widget::Formula_Input(95, 150, 55, 20, "X:"); widget_x_input->tooltip("The X position of the widget as a number or formula.\nFormulas can be simple " "math, including the variables\nx, px, sx, cx, and i"); widget_x_input->box(FL_DOWN_BOX); @@ -1191,8 +1191,8 @@ Fl_Double_Window* make_widget_panel() { widget_x_input->callback((Fl_Callback*)x_cb); widget_x_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); widget_x_input->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* widget_x_input - { widget_y_input = new Fluid_Coord_Input(155, 150, 55, 20, "Y:"); + } // fld::widget::Formula_Input* widget_x_input + { widget_y_input = new fld::widget::Formula_Input(155, 150, 55, 20, "Y:"); widget_y_input->tooltip("The Y position of the widget as a number or formula.\nFormulas can be simple " "math, including the variables\ny, py, sy, cy, and i"); widget_y_input->box(FL_DOWN_BOX); @@ -1206,8 +1206,8 @@ Fl_Double_Window* make_widget_panel() { widget_y_input->callback((Fl_Callback*)y_cb); widget_y_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); widget_y_input->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* widget_y_input - { widget_w_input = new Fluid_Coord_Input(215, 150, 55, 20, "Width:"); + } // fld::widget::Formula_Input* widget_y_input + { widget_w_input = new fld::widget::Formula_Input(215, 150, 55, 20, "Width:"); widget_w_input->tooltip("The width of the widget as a number or formula.\nFormulas can be simple math," " including the variables\nw, pw, sw, cw, and i"); widget_w_input->box(FL_DOWN_BOX); @@ -1221,8 +1221,8 @@ Fl_Double_Window* make_widget_panel() { widget_w_input->callback((Fl_Callback*)w_cb); widget_w_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); widget_w_input->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* widget_w_input - { widget_h_input = new Fluid_Coord_Input(275, 150, 55, 20, "Height:"); + } // fld::widget::Formula_Input* widget_w_input + { widget_h_input = new fld::widget::Formula_Input(275, 150, 55, 20, "Height:"); widget_h_input->tooltip("The height of the widget as a number or formula.\nFormulas can be simple math" ", including the variables\nh, ph, sh, ch, and i"); widget_h_input->box(FL_DOWN_BOX); @@ -1236,7 +1236,7 @@ Fl_Double_Window* make_widget_panel() { widget_h_input->callback((Fl_Callback*)h_cb); widget_h_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); widget_h_input->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* widget_h_input + } // fld::widget::Formula_Input* widget_h_input { Fl_Choice* o = new Fl_Choice(335, 150, 64, 20, "Children:"); o->tooltip("When instantiating a widget class, the children can either be fixed in their " "original position, automatically be repositioned, or both repsositioned and re" @@ -1832,7 +1832,7 @@ Fl_Double_Window* make_widget_panel() { } // Fl_Group* o { Fl_Group* o = new Fl_Group(95, 223, 310, 82); o->box(FL_FLAT_BOX); - { wCallback = new CodeEditor(95, 225, 310, 80, "Callback:"); + { wCallback = new fld::widget::Code_Editor(95, 225, 310, 80, "Callback:"); wCallback->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."); wCallback->box(FL_DOWN_BOX); @@ -1848,7 +1848,7 @@ Fl_Double_Window* make_widget_panel() { wCallback->align(Fl_Align(FL_ALIGN_LEFT)); wCallback->when(FL_WHEN_RELEASE); Fl_Group::current()->resizable(wCallback); - } // CodeEditor* wCallback + } // fld::widget::Code_Editor* wCallback o->end(); } // Fl_Group* o o->end(); @@ -1916,7 +1916,7 @@ Fl_Double_Window* make_widget_panel() { o->labelsize(11); o->callback((Fl_Callback*)propagate_load); o->align(Fl_Align(FL_ALIGN_LEFT)); - { widget_grid_row_input = new Fluid_Coord_Input(95, 60, 40, 20, "Row:"); + { 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); @@ -1928,7 +1928,7 @@ Fl_Double_Window* make_widget_panel() { 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); - } // Fluid_Coord_Input* widget_grid_row_input + } // 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); @@ -1944,7 +1944,7 @@ Fl_Double_Window* make_widget_panel() { } // Fl_Button* o o->end(); } // Fl_Group* o - { widget_grid_col_input = new Fluid_Coord_Input(175, 60, 40, 20, "Column:"); + { 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); @@ -1956,7 +1956,7 @@ Fl_Double_Window* make_widget_panel() { 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); - } // Fluid_Coord_Input* widget_grid_col_input + } // 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); @@ -2020,7 +2020,7 @@ Fl_Double_Window* make_widget_panel() { wp_gridc_size->labelsize(11); wp_gridc_size->callback((Fl_Callback*)propagate_load); wp_gridc_size->align(Fl_Align(FL_ALIGN_LEFT)); - { Fluid_Coord_Input* o = new Fluid_Coord_Input(95, 135, 55, 20, "Width:"); + { 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); @@ -2032,8 +2032,8 @@ Fl_Double_Window* make_widget_panel() { o->callback((Fl_Callback*)grid_set_min_wdt_cb); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); o->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* o - { Fluid_Coord_Input* o = new Fluid_Coord_Input(155, 135, 55, 20, "Height:"); + } // 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); @@ -2045,7 +2045,7 @@ Fl_Double_Window* make_widget_panel() { o->callback((Fl_Callback*)grid_set_min_hgt_cb); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); o->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* o + } // fld::widget::Formula_Input* o { Fl_Box* o = new Fl_Box(395, 135, 1, 20); o->hide(); Fl_Group::current()->resizable(o); @@ -2057,7 +2057,7 @@ Fl_Double_Window* make_widget_panel() { o->labelsize(11); o->callback((Fl_Callback*)propagate_load); o->align(Fl_Align(FL_ALIGN_LEFT)); - { widget_grid_rowspan_input = new Fluid_Coord_Input(95, 170, 40, 20, "Row Span:"); + { 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); @@ -2069,7 +2069,7 @@ Fl_Double_Window* make_widget_panel() { 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); - } // Fluid_Coord_Input* widget_grid_rowspan_input + } // 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); @@ -2085,7 +2085,7 @@ Fl_Double_Window* make_widget_panel() { } // Fl_Button* o o->end(); } // Fl_Group* o - { widget_grid_colspan_input = new Fluid_Coord_Input(175, 170, 40, 20, "Col. Span:"); + { 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); @@ -2097,7 +2097,7 @@ Fl_Double_Window* make_widget_panel() { 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); - } // Fluid_Coord_Input* widget_grid_colspan_input + } // 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); @@ -2135,7 +2135,7 @@ Fl_Double_Window* make_widget_panel() { o->labelsize(11); o->callback((Fl_Callback*)propagate_load); o->align(Fl_Align(FL_ALIGN_LEFT)); - { widget_grid_rows = new Fluid_Coord_Input(95, 60, 40, 20, "Rows:"); + { 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); @@ -2148,7 +2148,7 @@ Fl_Double_Window* make_widget_panel() { 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); - } // Fluid_Coord_Input* widget_grid_rows + } // 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); @@ -2164,7 +2164,7 @@ Fl_Double_Window* make_widget_panel() { } // Fl_Button* o o->end(); } // Fl_Group* o - { widget_grid_cols = new Fluid_Coord_Input(175, 60, 40, 20, "Columns:"); + { 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); @@ -2177,7 +2177,7 @@ Fl_Double_Window* make_widget_panel() { 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); - } // Fluid_Coord_Input* widget_grid_cols + } // 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); @@ -2277,7 +2277,7 @@ Fl_Double_Window* make_widget_panel() { o->labelsize(11); o->callback((Fl_Callback*)cb_Row1); o->align(Fl_Align(FL_ALIGN_LEFT)); - { widget_grid_curr_row = new Fluid_Coord_Input(95, 175, 40, 20, "Index"); + { 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); @@ -2289,7 +2289,7 @@ Fl_Double_Window* make_widget_panel() { 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); - } // Fluid_Coord_Input* widget_grid_curr_row + } // 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, "-"); @@ -2311,7 +2311,7 @@ Fl_Double_Window* make_widget_panel() { } // 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); - { Fluid_Coord_Input* o = new Fluid_Coord_Input(180, 175, 55, 20, "Height:"); + { 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); @@ -2323,8 +2323,8 @@ Fl_Double_Window* make_widget_panel() { o->callback((Fl_Callback*)cb_Height); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); o->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* o - { Fluid_Coord_Input* o = new Fluid_Coord_Input(240, 175, 55, 20, "Weight:"); + } // 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); @@ -2336,8 +2336,8 @@ Fl_Double_Window* make_widget_panel() { o->callback((Fl_Callback*)cb_Weight); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); o->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* o - { Fluid_Coord_Input* o = new Fluid_Coord_Input(300, 175, 55, 20, "Gap:"); + } // 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); @@ -2349,7 +2349,7 @@ Fl_Double_Window* make_widget_panel() { o->callback((Fl_Callback*)cb_Gap); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); o->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* o + } // 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); @@ -2363,7 +2363,7 @@ Fl_Double_Window* make_widget_panel() { o->labelsize(11); o->callback((Fl_Callback*)propagate_load); o->align(Fl_Align(FL_ALIGN_LEFT)); - { widget_grid_curr_col = new Fluid_Coord_Input(95, 210, 40, 20, "Index"); + { 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); @@ -2375,7 +2375,7 @@ Fl_Double_Window* make_widget_panel() { 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); - } // Fluid_Coord_Input* widget_grid_curr_col + } // 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); @@ -2396,7 +2396,7 @@ Fl_Double_Window* make_widget_panel() { } // 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); - { Fluid_Coord_Input* o = new Fluid_Coord_Input(180, 210, 55, 20, "Width:"); + { 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); @@ -2408,8 +2408,8 @@ Fl_Double_Window* make_widget_panel() { o->callback((Fl_Callback*)cb_Width); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); o->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* o - { Fluid_Coord_Input* o = new Fluid_Coord_Input(240, 210, 55, 20, "Weight:"); + } // 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); @@ -2421,8 +2421,8 @@ Fl_Double_Window* make_widget_panel() { o->callback((Fl_Callback*)cb_Weight1); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); o->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* o - { Fluid_Coord_Input* o = new Fluid_Coord_Input(300, 210, 55, 20, "Gap:"); + } // 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); @@ -2434,7 +2434,7 @@ Fl_Double_Window* make_widget_panel() { o->callback((Fl_Callback*)cb_Gap1); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); o->when(FL_WHEN_RELEASE); - } // Fluid_Coord_Input* o + } // 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); diff --git a/fluid/panels/widget_panel.fl b/fluid/panels/widget_panel.fl index 57ae30273..517271e08 100644 --- a/fluid/panels/widget_panel.fl +++ b/fluid/panels/widget_panel.fl @@ -34,7 +34,7 @@ decl {\#include "nodes/Fl_Widget_Type.h"} {private global decl {\#include "nodes/Fl_Grid_Type.h"} {private global } -decl {\#include "widgets/custom_widgets.h"} {selected public global +decl {\#include "widgets/Formula_Input.h"} {selected public global } decl {\#include } {private global @@ -112,7 +112,7 @@ Function {make_image_panel()} { if (mod) set_modflag(1); }} tooltip {Scale image to this width in pixel units} xywh {75 75 55 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Input image_panel_imageh { label {Height:} @@ -142,7 +142,7 @@ Function {make_image_panel()} { if (mod) set_modflag(1); }} tooltip {Scale image to this height in pixel units} xywh {135 75 55 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Button {} { label Reset @@ -234,7 +234,7 @@ Function {make_image_panel()} { if (mod) set_modflag(1); }} tooltip {Scale image to this width in pixel units} xywh {75 215 55 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Input image_panel_deimageh { label {Height:} @@ -264,7 +264,7 @@ Function {make_image_panel()} { if (mod) set_modflag(1); }} tooltip {Scale image to this height in pixel units} xywh {135 215 55 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Button {} { label Reset @@ -577,7 +577,7 @@ Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 15 t 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 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Input widget_y_input { label {Y:} @@ -585,7 +585,7 @@ x, px, sx, cx, and i} xywh {95 150 55 20} labelsize 11 align 5 textsize 11 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 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Input widget_w_input { label {Width:} @@ -593,7 +593,7 @@ y, py, sy, cy, and i} xywh {155 150 55 20} labelsize 11 align 5 textsize 11 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 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Input widget_h_input { label {Height:} @@ -601,7 +601,7 @@ w, pw, sw, cw, and i} xywh {215 150 55 20} labelsize 11 align 5 textsize 11 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 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Choice {} { label {Children:} @@ -1076,8 +1076,8 @@ wCallback->do_callback(wCallback, v);} open label {Callback:} callback callback_cb 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/CodeEditor.h"} - class CodeEditor + code0 {\#include "widgets/Code_Editor.h"} + class {fld::widget::Code_Editor} } } } @@ -1136,7 +1136,7 @@ wCallback->do_callback(wCallback, v);} open label {Row:} callback grid_set_row_cb xywh {95 60 40 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Group {} {open xywh {135 60 30 20} @@ -1158,7 +1158,7 @@ wCallback->do_callback(wCallback, v);} open label {Column:} callback grid_set_col_cb xywh {175 60 40 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Group {} {open xywh {215 60 30 20} @@ -1271,13 +1271,13 @@ wCallback->do_callback(wCallback, v);} open label {Width:} callback grid_set_min_wdt_cb xywh {95 135 55 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + 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 Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Box {} { xywh {395 135 1 20} hide resizable @@ -1292,7 +1292,7 @@ wCallback->do_callback(wCallback, v);} open label {Row Span:} callback grid_set_rowspan_cb xywh {95 170 40 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Group {} {open xywh {135 170 30 20} @@ -1314,7 +1314,7 @@ wCallback->do_callback(wCallback, v);} open label {Col. Span:} callback grid_set_colspan_cb xywh {175 170 40 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Group {} {open xywh {215 170 30 20} @@ -1376,7 +1376,7 @@ if (v == LOAD) { } }} tooltip {Number of horizontal rows in the Grid group} xywh {95 60 40 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Group {} {open xywh {135 60 30 20} @@ -1426,7 +1426,7 @@ if (v == LOAD) { } }} tooltip {Number of vertical columns in the Grid group} xywh {175 60 40 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Group {} {open xywh {215 60 30 20} @@ -1618,7 +1618,7 @@ if (v == LOAD) { 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 Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Group {} { callback propagate_load open @@ -1669,7 +1669,7 @@ if (v == LOAD) { } }} xywh {180 175 55 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Input {} { label {Weight:} @@ -1689,7 +1689,7 @@ if (v == LOAD) { } }} xywh {240 175 55 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Input {} { label {Gap:} @@ -1709,7 +1709,7 @@ if (v == LOAD) { } }} xywh {300 175 55 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } } Fl_Box {} { @@ -1735,7 +1735,7 @@ if (v == LOAD) { 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 Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Group {} {open xywh {135 210 30 20} @@ -1785,7 +1785,7 @@ if (v == LOAD) { } }} xywh {180 210 55 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Input {} { label {Weight:} @@ -1805,7 +1805,7 @@ if (v == LOAD) { } }} xywh {240 210 55 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } Fl_Input {} { label {Gap:} @@ -1825,7 +1825,7 @@ if (v == LOAD) { } }} xywh {300 210 55 20} labelsize 11 align 5 textsize 11 - class Fluid_Coord_Input + class {fld::widget::Formula_Input} } } Fl_Box {} { diff --git a/fluid/panels/widget_panel.h b/fluid/panels/widget_panel.h index de827464e..bac21a771 100644 --- a/fluid/panels/widget_panel.h +++ b/fluid/panels/widget_panel.h @@ -19,7 +19,7 @@ #ifndef widget_panel_h #define widget_panel_h #include -#include "widgets/custom_widgets.h" +#include "widgets/Formula_Input.h" #include extern Fl_Double_Window *image_panel_window; #include @@ -28,16 +28,16 @@ extern Fl_Group *image_panel_imagegroup; #include #include extern Fl_Box *image_panel_data; -extern Fluid_Coord_Input *image_panel_imagew; -extern Fluid_Coord_Input *image_panel_imageh; +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 Fluid_Coord_Input *image_panel_deimagew; -extern Fluid_Coord_Input *image_panel_deimageh; +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; @@ -63,14 +63,14 @@ 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(Fluid_Coord_Input*, void*); -extern Fluid_Coord_Input *widget_x_input; -extern void y_cb(Fluid_Coord_Input*, void*); -extern Fluid_Coord_Input *widget_y_input; -extern void w_cb(Fluid_Coord_Input*, void*); -extern Fluid_Coord_Input *widget_w_input; -extern void h_cb(Fluid_Coord_Input*, void*); -extern Fluid_Coord_Input *widget_h_input; +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; @@ -161,9 +161,9 @@ extern Fl_Input *v_input[4]; #include #include extern Fl_Text_Editor *wComment; -#include "widgets/CodeEditor.h" -extern void callback_cb(CodeEditor*, void*); -extern CodeEditor *wCallback; +#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[]; @@ -172,12 +172,12 @@ extern void when_cb(Fl_Menu_Button*, void*); 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(Fluid_Coord_Input*, void*); -extern Fluid_Coord_Input *widget_grid_row_input; +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(Fluid_Coord_Input*, void*); -extern Fluid_Coord_Input *widget_grid_col_input; +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; @@ -186,24 +186,24 @@ 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(Fluid_Coord_Input*, void*); -extern void grid_set_min_hgt_cb(Fluid_Coord_Input*, void*); -extern void grid_set_rowspan_cb(Fluid_Coord_Input*, void*); -extern Fluid_Coord_Input *widget_grid_rowspan_input; +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(Fluid_Coord_Input*, void*); -extern Fluid_Coord_Input *widget_grid_colspan_input; +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 Fluid_Coord_Input *widget_grid_rows; -extern Fluid_Coord_Input *widget_grid_cols; +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 Fluid_Coord_Input *widget_grid_curr_row; +extern fld::widget::Formula_Input *widget_grid_curr_row; extern Fl_Group *widget_grid_curr_row_attributes; -extern Fluid_Coord_Input *widget_grid_curr_col; +extern fld::widget::Formula_Input *widget_grid_curr_col; extern Fl_Group *widget_grid_curr_col_attributes; extern Fl_Tabs *widget_tabs_repo; extern void live_mode_cb(Fl_Button*, void*); diff --git a/fluid/widgets/Bin_Button.cxx b/fluid/widgets/Bin_Button.cxx new file mode 100644 index 000000000..cc351085d --- /dev/null +++ b/fluid/widgets/Bin_Button.cxx @@ -0,0 +1,128 @@ +// +// Widget Bin Button code for the Fast Light Tool Kit (FLTK). +// +// 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 +// 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 +// + +#include "widgets/Bin_Button.h" + +#include "app/fluid.h" +#include "nodes/factory.h" +#include "nodes/Fl_Window_Type.h" +#include "widgets/widget_browser.h" + +#include +#include + +using namespace fld; +using namespace fld::widget; + + +/** \class fld::widget::Bin_Button + The Bin_Button button is a button that can be used in the widget bin to + allow the user to drag and drop widgets into a window or group. This feature + makes it easy for the user to position a widget at a specific location within + the window or group. + */ + +/** + Convert mouse dragging into a drag and drop event. + */ +int fld::widget::Bin_Button::handle(int inEvent) +{ + int ret = 0; + switch (inEvent) { + case FL_PUSH: + Fl_Button::handle(inEvent); + return 1; // make sure that we get drag events + case FL_DRAG: + ret = Fl_Button::handle(inEvent); + if (!user_data()) + return ret; + if (!Fl::event_is_click()) { // make it a dnd event + // fake a drag outside of the widget + Fl::e_x = x()-1; + Fl_Button::handle(inEvent); + // fake a button release + Fl_Button::handle(FL_RELEASE); + // make it into a dnd event + const char *type_name = (const char*)user_data(); + Fl_Type::current_dnd = Fl_Type::current; + Fl::copy(type_name, (int)strlen(type_name)+1, 0); + Fl::dnd(); + return 1; + } + return ret; + } + return Fl_Button::handle(inEvent); +} + +/** \class fld::widget::Bin_Window_Button + The Bin_Window_Button button is used in the widget bin to create new + windows by dragging and dropping. When the button is dragged and dropped onto + the desktop, a new window will be created at the drop location. + + This does not work in Wayland because Wayland does not allow client + applications to control window placement. + */ + +/** + Convert mouse dragging into a drag and drop event. + */ +int fld::widget::Bin_Window_Button::handle(int inEvent) +{ + static Fl_Window *drag_win = NULL; + int ret = 0; + switch (inEvent) { + case FL_PUSH: + Fl_Button::handle(inEvent); + return 1; // make sure that we get drag events + case FL_DRAG: + ret = Fl_Button::handle(inEvent); + if (!user_data()) + return ret; + if (!Fl::event_is_click()) { + if (!drag_win) { + drag_win = new Fl_Window(0, 0, 480, 320); + drag_win->border(0); + drag_win->set_non_modal(); + } + if (drag_win) { + drag_win->position(Fl::event_x_root()+1, Fl::event_y_root()+1); + drag_win->show(); + } + // Does not work outside window: fl_cursor(FL_CURSOR_HAND); + } + return ret; + case FL_RELEASE: + if (drag_win) { + Fl::delete_widget(drag_win); + drag_win = NULL; + // create a new window here + Fl_Type *prototype = typename_to_prototype((char*)user_data()); + if (prototype) { + Fl_Type *new_type = add_new_widget_from_user(prototype, Strategy::AFTER_CURRENT); + if (new_type && new_type->is_a(ID_Window)) { + Fl_Window_Type *new_window = (Fl_Window_Type*)new_type; + Fl_Window *w = (Fl_Window *)new_window->o; + w->position(Fl::event_x_root(), Fl::event_y_root()); + } + } + widget_browser->display(Fl_Type::current); + widget_browser->rebuild(); + } + return Fl_Button::handle(inEvent); + } + return Fl_Button::handle(inEvent); +} + diff --git a/fluid/widgets/Bin_Button.h b/fluid/widgets/Bin_Button.h new file mode 100644 index 000000000..342fe0eac --- /dev/null +++ b/fluid/widgets/Bin_Button.h @@ -0,0 +1,44 @@ +// +// Widget Bin Button header file for the Fast Light Tool Kit (FLTK). +// +// 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 +// 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 +// + +#ifndef FLUID_WIDGETS_BIN_BUTTON_H +#define FLUID_WIDGETS_BIN_BUTTON_H + +#include + +namespace fld { +namespace widget { + +// Adding drag and drop for dragging widgets into windows. +class Bin_Button : public Fl_Button { +public: + int handle(int) override; + Bin_Button(int X,int Y,int W,int H, const char* l = nullptr) : + Fl_Button(X,Y,W,H,l) { } +}; + +// Adding drag and drop functionality to drag window prototypes onto the desktop. +class Bin_Window_Button : public Fl_Button { +public: + int handle(int) override; + Bin_Window_Button(int X,int Y,int W,int H, const char* l = nullptr) : + Fl_Button(X,Y,W,H,l) { } +}; + +} // namespace widget +} // namespace fld + +#endif // FLUID_WIDGETS_BIN_BUTTON_H diff --git a/fluid/widgets/CodeEditor.cxx b/fluid/widgets/CodeEditor.cxx deleted file mode 100644 index ca114b577..000000000 --- a/fluid/widgets/CodeEditor.cxx +++ /dev/null @@ -1,316 +0,0 @@ -// -// Code editor widget for the Fast Light Tool Kit (FLTK). -// Syntax highlighting rewritten by erco@seriss.com 09/15/20. -// -// 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 -// 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 -// - -// -// Include necessary headers... -// - -#include "widgets/CodeEditor.h" - -#include -#include -#include -#include - -// ---- CodeEditor implementation - -/** - Lookup table for all supported styles. - Every table entry describes a rendering style for the corresponding text. - */ -Fl_Text_Display::Style_Table_Entry CodeEditor::styletable[] = { // Style table - { FL_FOREGROUND_COLOR, FL_COURIER, 11 }, // A - Plain - { FL_DARK_GREEN, FL_COURIER_ITALIC, 11 }, // B - Line comments - { FL_DARK_GREEN, FL_COURIER_ITALIC, 11 }, // C - Block comments - { FL_BLUE, FL_COURIER, 11 }, // D - Strings - { FL_DARK_RED, FL_COURIER, 11 }, // E - Directives - { FL_DARK_RED, FL_COURIER_BOLD, 11 }, // F - Types - { FL_BLUE, FL_COURIER_BOLD, 11 }, // G - Keywords - { 220, /* med cyan */ FL_COURIER, 11 } // H - Single quote chars - }; - -/** - Parse text and produce style data. - \param[in] in_tbuff text buffer to parse - \param[inout] in_sbuff style buffer we modify - \param[in] in_len byte length to parse - \param[in] in_style starting style letter - */ -void CodeEditor::style_parse(const char *in_tbuff, // text buffer to parse - char *in_sbuff, // style buffer we modify - int in_len, // byte length to parse - char in_style) { // starting style letter - // Style letters: - // - // 'A' - Plain - // 'B' - Line comments // .. - // 'C' - Block comments /*..*/ - // 'D' - Strings "xxx" - // 'E' - Directives #define, #include.. - // 'F' - Types void, char.. - // 'G' - Keywords if, while.. - // 'H' - Chars 'x' - - StyleParse sp; - sp.tbuff = in_tbuff; - sp.sbuff = in_sbuff; - sp.len = in_len; - sp.style = in_style; - sp.lwhite = 1; // 1:while parsing over leading white and first char past, 0:past white - sp.col = 0; - sp.last = 0; - - // Loop through the code, updating style buffer - char c; - while ( sp.len > 0 ) { - c = sp.tbuff[0]; // current char - if ( sp.style == 'C' ) { // Started in middle of comment block? - if ( !sp.parse_block_comment() ) break; - } else if ( strncmp(sp.tbuff, "/*", 2)==0 ) { // C style comment block? - if ( !sp.parse_block_comment() ) break; - } else if ( c == '\\' ) { // Backslash escape char? - if ( !sp.parse_escape() ) break; - } else if ( strncmp(sp.tbuff, "//", 2)==0 ) { // Line comment? - if ( !sp.parse_line_comment() ) break; - } else if ( c == '"' ) { // Start of double quoted string? - if ( !sp.parse_quoted_string('"', 'D') ) break; - } else if ( c == '\'' ) { // Start of single quoted string? - if ( !sp.parse_quoted_string('\'', 'H') ) break; - } else if ( c == '#' && sp.lwhite ) { // Start of '#' directive? - if ( !sp.parse_directive() ) break; - } else if ( !sp.last && (islower(c) || c == '_') ) { // Possible C/C++ keyword? - if ( !sp.parse_keyword() ) break; - } else { // All other chars? - if ( !sp.parse_all_else() ) break; - } - } -} - -/** - Update unfinished styles. - */ -void CodeEditor::style_unfinished_cb(int, void*) { -} - -/** - Update the style buffer. - \param[in] pos insert position in text - \param[in] nInserted number of bytes inserted - \param[in] nDeleted number of bytes deleted - \param[in] cbArg pointer back to the code editor - */ -void CodeEditor::style_update(int pos, int nInserted, int nDeleted, - int /*nRestyled*/, const char * /*deletedText*/, - void *cbArg) { - CodeEditor *editor = (CodeEditor*)cbArg; - char *style, // Style data - *text; // Text data - - - // If this is just a selection change, just unselect the style buffer... - if (nInserted == 0 && nDeleted == 0) { - editor->mStyleBuffer->unselect(); - return; - } - - // Track changes in the text buffer... - if (nInserted > 0) { - // Insert characters into the style buffer... - style = new char[nInserted + 1]; - memset(style, 'A', nInserted); - style[nInserted] = '\0'; - - editor->mStyleBuffer->replace(pos, pos + nDeleted, style); - delete[] style; - } else { - // Just delete characters in the style buffer... - editor->mStyleBuffer->remove(pos, pos + nDeleted); - } - - // Select the area that was just updated to avoid unnecessary - // callbacks... - editor->mStyleBuffer->select(pos, pos + nInserted - nDeleted); - - // Reparse whole buffer, don't get cute. Maybe optimize range later - int len = editor->buffer()->length(); - text = editor->mBuffer->text_range(0, len); - style = editor->mStyleBuffer->text_range(0, len); - - style_parse(text, style, editor->mBuffer->length(), 'A'); - - editor->mStyleBuffer->replace(0, len, style); - editor->redisplay_range(0, len); - editor->redraw(); - - free(text); - free(style); -} - -/** - Find the right indentation depth after pressing the Enter key. - \param[in] e pointer back to the code editor - */ -int CodeEditor::auto_indent(int, CodeEditor* e) { - if (e->buffer()->selected()) { - e->insert_position(e->buffer()->primary_selection()->start()); - e->buffer()->remove_selection(); - } - - int pos = e->insert_position(); - int start = e->line_start(pos); - char *text = e->buffer()->text_range(start, pos); - char *ptr; - - for (ptr = text; isspace(*ptr); ptr ++) {/*empty*/} - *ptr = '\0'; - if (*text) { - // use only a single 'insert' call to avoid redraw issues - size_t n = strlen(text); - char *b = (char*)malloc(n+2); - *b = '\n'; - strcpy(b+1, text); - e->insert(b); - free(b); - } else { - e->insert("\n"); - } - e->show_insert_position(); - e->set_changed(); - if (e->when()&FL_WHEN_CHANGED) e->do_callback(FL_REASON_CHANGED); - - free(text); - - return 1; -} - -/** - Create a CodeEditor widget. - \param[in] X, Y, W, H position and size of the widget - \param[in] L optional label - */ -CodeEditor::CodeEditor(int X, int Y, int W, int H, const char *L) : - Fl_Text_Editor(X, Y, W, H, L) { - buffer(new Fl_Text_Buffer); - - char *style = new char[mBuffer->length() + 1]; - char *text = mBuffer->text(); - - memset(style, 'A', mBuffer->length()); - style[mBuffer->length()] = '\0'; - - highlight_data(new Fl_Text_Buffer(mBuffer->length()), styletable, - sizeof(styletable) / sizeof(styletable[0]), - 'A', style_unfinished_cb, this); - - style_parse(text, style, mBuffer->length(), 'A'); - - mStyleBuffer->text(style); - delete[] style; - free(text); - - mBuffer->add_modify_callback(style_update, this); - add_key_binding(FL_Enter, FL_TEXT_EDITOR_ANY_STATE, - (Fl_Text_Editor::Key_Func)auto_indent); -} - -/** - Destroy a CodeEditor widget. - */ -CodeEditor::~CodeEditor() { - Fl_Text_Buffer *buf = mStyleBuffer; - mStyleBuffer = 0; - delete buf; - - buf = mBuffer; - buffer(0); - delete buf; -} - -/** - Attempt to make the fluid code editor widget honor textsize setting. - This works by updating the fontsizes in the style table. - \param[in] s the new general height of the text font - */ -void CodeEditor::textsize(Fl_Fontsize s) { - Fl_Text_Editor::textsize(s); // call base class method - // now attempt to update our styletable to honor the new size... - int entries = sizeof(styletable) / sizeof(styletable[0]); - for(int iter = 0; iter < entries; iter++) { - styletable[iter].size = s; - } -} // textsize - -// ---- CodeViewer implementation - -/** - Create a CodeViewer widget. - \param[in] X, Y, W, H position and size of the widget - \param[in] L optional label - */ -CodeViewer::CodeViewer(int X, int Y, int W, int H, const char *L) -: CodeEditor(X, Y, W, H, L) -{ - default_key_function(kf_ignore); - remove_all_key_bindings(&key_bindings); - cursor_style(CARET_CURSOR); -} - -/** - Tricking Fl_Text_Display into using bearable colors for this specific task. - */ -void CodeViewer::draw() -{ - Fl_Color c = Fl::get_color(FL_SELECTION_COLOR); - Fl::set_color(FL_SELECTION_COLOR, fl_color_average(FL_BACKGROUND_COLOR, FL_FOREGROUND_COLOR, 0.9f)); - CodeEditor::draw(); - Fl::set_color(FL_SELECTION_COLOR, c); -} - -// ---- TextViewer implementation - -/** - Create a TextViewer widget. - \param[in] X, Y, W, H position and size of the widget - \param[in] L optional label - */ -TextViewer::TextViewer(int X, int Y, int W, int H, const char *L) -: Fl_Text_Display(X, Y, W, H, L) -{ - buffer(new Fl_Text_Buffer); -} - -/** - Avoid memory leaks. - */ -TextViewer::~TextViewer() { - Fl_Text_Buffer *buf = mBuffer; - buffer(0); - delete buf; -} - -/** - Tricking Fl_Text_Display into using bearable colors for this specific task. - */ -void TextViewer::draw() -{ - Fl_Color c = Fl::get_color(FL_SELECTION_COLOR); - Fl::set_color(FL_SELECTION_COLOR, fl_color_average(FL_BACKGROUND_COLOR, FL_FOREGROUND_COLOR, 0.9f)); - Fl_Text_Display::draw(); - Fl::set_color(FL_SELECTION_COLOR, c); -} - - diff --git a/fluid/widgets/CodeEditor.h b/fluid/widgets/CodeEditor.h deleted file mode 100644 index cc720d618..000000000 --- a/fluid/widgets/CodeEditor.h +++ /dev/null @@ -1,105 +0,0 @@ -// -// Code editor widget for the Fast Light Tool Kit (FLTK). -// Syntax highlighting rewritten by erco@seriss.com 09/15/20. -// -// 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 -// 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 -// - -#ifndef CodeEditor_h -#define CodeEditor_h - -// -// Include necessary headers... -// - -#include "StyleParse.h" - -#include -#include -#include - -#include -#include -#include -#include - -// ---- CodeEditor declaration - -/** - A widget derived from Fl_Text_Editor that implements C++ code highlighting. - - CodeEditor is used in Fluid whenever the user can edit C++ source - code or header text. - */ -class CodeEditor : public Fl_Text_Editor { - friend class StyleParse; - - static Fl_Text_Display::Style_Table_Entry styletable[]; - static void style_parse(const char *tbuff, char *sbuff, int len, char style); - static void style_unfinished_cb(int, void*); - static void style_update(int pos, int nInserted, int nDeleted, - int /*nRestyled*/, const char * /*deletedText*/, - void *cbArg); - static int auto_indent(int, CodeEditor* e); - -public: - CodeEditor(int X, int Y, int W, int H, const char *L=0); - ~CodeEditor(); - void textsize(Fl_Fontsize s); - - /// access to protected member get_absolute_top_line_number() - int top_line() { return get_absolute_top_line_number(); } - - /// access to protected member mTopLineNum - int scroll_row() { return mTopLineNum; } - - /// access to protected member mHorizOffset - int scroll_col() { return mHorizOffset; } -}; - -// ---- CodeViewer declaration - -/** - A widget derived from CodeEditor with highlighting for code blocks. - - This widget is used by the codeview system to show the design's - source and header code. The secondary highlighting show the text - part that corresponds to the selected widget(s). - */ -class CodeViewer : public CodeEditor { -public: - CodeViewer(int X, int Y, int W, int H, const char *L=0); - -protected: - void draw() FL_OVERRIDE; - - /// Limit event handling to viewing, not editing - int handle(int ev) FL_OVERRIDE { return Fl_Text_Display::handle(ev); } -}; - -// ---- Project File Text Viewer declaration - -/** - A text viewer with an additional highlighting color scheme. - */ -class TextViewer : public Fl_Text_Display { -public: - TextViewer(int X, int Y, int W, int H, const char *L=0); - ~TextViewer(); - void draw() FL_OVERRIDE; - - /// access to protected member get_absolute_top_line_number() - int top_line() { return get_absolute_top_line_number(); } -}; - -#endif // !CodeEditor_h diff --git a/fluid/widgets/Code_Editor.cxx b/fluid/widgets/Code_Editor.cxx new file mode 100644 index 000000000..a145b5055 --- /dev/null +++ b/fluid/widgets/Code_Editor.cxx @@ -0,0 +1,254 @@ +// +// Code editor widget for the Fast Light Tool Kit (FLTK). +// Syntax highlighting rewritten by erco@seriss.com 09/15/20. +// +// 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 +// 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 +// + +// +// Include necessary headers... +// + +#include "widgets/Code_Editor.h" + +using namespace fld; +using namespace fld::widget; + +// ---- Code_Editor implementation + +/** + Lookup table for all supported styles. + Every table entry describes a rendering style for the corresponding text. + */ +Fl_Text_Display::Style_Table_Entry Code_Editor::styletable[] = { // Style table + { FL_FOREGROUND_COLOR, FL_COURIER, 11 }, // A - Plain + { FL_DARK_GREEN, FL_COURIER_ITALIC, 11 }, // B - Line comments + { FL_DARK_GREEN, FL_COURIER_ITALIC, 11 }, // C - Block comments + { FL_BLUE, FL_COURIER, 11 }, // D - Strings + { FL_DARK_RED, FL_COURIER, 11 }, // E - Directives + { FL_DARK_RED, FL_COURIER_BOLD, 11 }, // F - Types + { FL_BLUE, FL_COURIER_BOLD, 11 }, // G - Keywords + { 220, /* med cyan */ FL_COURIER, 11 } // H - Single quote chars + }; + +/** + Parse text and produce style data. + \param[in] in_tbuff text buffer to parse + \param[inout] in_sbuff style buffer we modify + \param[in] in_len byte length to parse + \param[in] in_style starting style letter + */ +void Code_Editor::style_parse(const char *in_tbuff, // text buffer to parse + char *in_sbuff, // style buffer we modify + int in_len, // byte length to parse + char in_style) { // starting style letter + // Style letters: + // + // 'A' - Plain + // 'B' - Line comments // .. + // 'C' - Block comments /*..*/ + // 'D' - Strings "xxx" + // 'E' - Directives #define, #include.. + // 'F' - Types void, char.. + // 'G' - Keywords if, while.. + // 'H' - Chars 'x' + + Style_Parser sp; + sp.tbuff = in_tbuff; + sp.sbuff = in_sbuff; + sp.len = in_len; + sp.style = in_style; + sp.lwhite = 1; // 1:while parsing over leading white and first char past, 0:past white + sp.col = 0; + sp.last = 0; + + // Loop through the code, updating style buffer + char c; + while ( sp.len > 0 ) { + c = sp.tbuff[0]; // current char + if ( sp.style == 'C' ) { // Started in middle of comment block? + if ( !sp.parse_block_comment() ) break; + } else if ( strncmp(sp.tbuff, "/*", 2)==0 ) { // C style comment block? + if ( !sp.parse_block_comment() ) break; + } else if ( c == '\\' ) { // Backslash escape char? + if ( !sp.parse_escape() ) break; + } else if ( strncmp(sp.tbuff, "//", 2)==0 ) { // Line comment? + if ( !sp.parse_line_comment() ) break; + } else if ( c == '"' ) { // Start of double quoted string? + if ( !sp.parse_quoted_string('"', 'D') ) break; + } else if ( c == '\'' ) { // Start of single quoted string? + if ( !sp.parse_quoted_string('\'', 'H') ) break; + } else if ( c == '#' && sp.lwhite ) { // Start of '#' directive? + if ( !sp.parse_directive() ) break; + } else if ( !sp.last && (islower(c) || c == '_') ) { // Possible C/C++ keyword? + if ( !sp.parse_keyword() ) break; + } else { // All other chars? + if ( !sp.parse_all_else() ) break; + } + } +} + +/** + Update unfinished styles. + */ +void Code_Editor::style_unfinished_cb(int, void*) { +} + +/** + Update the style buffer. + \param[in] pos insert position in text + \param[in] nInserted number of bytes inserted + \param[in] nDeleted number of bytes deleted + \param[in] cbArg pointer back to the code editor + */ +void Code_Editor::style_update(int pos, int nInserted, int nDeleted, + int /*nRestyled*/, const char * /*deletedText*/, + void *cbArg) { + Code_Editor *editor = (Code_Editor*)cbArg; + char *style, // Style data + *text; // Text data + + + // If this is just a selection change, just unselect the style buffer... + if (nInserted == 0 && nDeleted == 0) { + editor->mStyleBuffer->unselect(); + return; + } + + // Track changes in the text buffer... + if (nInserted > 0) { + // Insert characters into the style buffer... + style = new char[nInserted + 1]; + memset(style, 'A', nInserted); + style[nInserted] = '\0'; + + editor->mStyleBuffer->replace(pos, pos + nDeleted, style); + delete[] style; + } else { + // Just delete characters in the style buffer... + editor->mStyleBuffer->remove(pos, pos + nDeleted); + } + + // Select the area that was just updated to avoid unnecessary + // callbacks... + editor->mStyleBuffer->select(pos, pos + nInserted - nDeleted); + + // Reparse whole buffer, don't get cute. Maybe optimize range later + int len = editor->buffer()->length(); + text = editor->mBuffer->text_range(0, len); + style = editor->mStyleBuffer->text_range(0, len); + + style_parse(text, style, editor->mBuffer->length(), 'A'); + + editor->mStyleBuffer->replace(0, len, style); + editor->redisplay_range(0, len); + editor->redraw(); + + free(text); + free(style); +} + +/** + Find the right indentation depth after pressing the Enter key. + \param[in] e pointer back to the code editor + */ +int Code_Editor::auto_indent(int, Code_Editor* e) { + if (e->buffer()->selected()) { + e->insert_position(e->buffer()->primary_selection()->start()); + e->buffer()->remove_selection(); + } + + int pos = e->insert_position(); + int start = e->line_start(pos); + char *text = e->buffer()->text_range(start, pos); + char *ptr; + + for (ptr = text; isspace(*ptr); ptr ++) {/*empty*/} + *ptr = '\0'; + if (*text) { + // use only a single 'insert' call to avoid redraw issues + size_t n = strlen(text); + char *b = (char*)malloc(n+2); + *b = '\n'; + strcpy(b+1, text); + e->insert(b); + free(b); + } else { + e->insert("\n"); + } + e->show_insert_position(); + e->set_changed(); + if (e->when()&FL_WHEN_CHANGED) e->do_callback(FL_REASON_CHANGED); + + free(text); + + return 1; +} + +/** + Create a Code_Editor widget. + \param[in] X, Y, W, H position and size of the widget + \param[in] L optional label + */ +Code_Editor::Code_Editor(int X, int Y, int W, int H, const char *L) : + Fl_Text_Editor(X, Y, W, H, L) { + buffer(new Fl_Text_Buffer); + + char *style = new char[mBuffer->length() + 1]; + char *text = mBuffer->text(); + + memset(style, 'A', mBuffer->length()); + style[mBuffer->length()] = '\0'; + + highlight_data(new Fl_Text_Buffer(mBuffer->length()), styletable, + sizeof(styletable) / sizeof(styletable[0]), + 'A', style_unfinished_cb, this); + + style_parse(text, style, mBuffer->length(), 'A'); + + mStyleBuffer->text(style); + delete[] style; + free(text); + + mBuffer->add_modify_callback(style_update, this); + add_key_binding(FL_Enter, FL_TEXT_EDITOR_ANY_STATE, + (Fl_Text_Editor::Key_Func)auto_indent); +} + +/** + Destroy a Code_Editor widget. + */ +Code_Editor::~Code_Editor() { + Fl_Text_Buffer *buf = mStyleBuffer; + mStyleBuffer = 0; + delete buf; + + buf = mBuffer; + buffer(0); + delete buf; +} + +/** + Attempt to make the fluid code editor widget honor textsize setting. + This works by updating the fontsizes in the style table. + \param[in] s the new general height of the text font + */ +void Code_Editor::textsize(Fl_Fontsize s) { + Fl_Text_Editor::textsize(s); // call base class method + // now attempt to update our styletable to honor the new size... + int entries = sizeof(styletable) / sizeof(styletable[0]); + for(int iter = 0; iter < entries; iter++) { + styletable[iter].size = s; + } +} // textsize + diff --git a/fluid/widgets/Code_Editor.h b/fluid/widgets/Code_Editor.h new file mode 100644 index 000000000..ef8df0e0d --- /dev/null +++ b/fluid/widgets/Code_Editor.h @@ -0,0 +1,70 @@ +// +// Code editor widget for the Fast Light Tool Kit (FLTK). +// Syntax highlighting rewritten by erco@seriss.com 09/15/20. +// +// 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 +// 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 +// + +#ifndef FLUID_WIDGETS_CODE_EDITOR_H +#define FLUID_WIDGETS_CODE_EDITOR_H + +// +// Include necessary headers... +// + +#include "Style_Parser.h" + +#include + +namespace fld { +namespace widget { + +// ---- Code_Editor declaration + +/** + A widget derived from Fl_Text_Editor that implements C++ code highlighting. + + Code_Editor is used in Fluid whenever the user can edit C++ source + code or header text. + */ +class Code_Editor : public Fl_Text_Editor { + friend class Style_Parser; + + static Fl_Text_Display::Style_Table_Entry styletable[]; + static void style_parse(const char *tbuff, char *sbuff, int len, char style); + static void style_unfinished_cb(int, void*); + static void style_update(int pos, int nInserted, int nDeleted, + int /*nRestyled*/, const char * /*deletedText*/, + void *cbArg); + static int auto_indent(int, Code_Editor* e); + +public: + Code_Editor(int X, int Y, int W, int H, const char *L=0); + ~Code_Editor(); + void textsize(Fl_Fontsize s); + + /// access to protected member get_absolute_top_line_number() + int top_line() { return get_absolute_top_line_number(); } + + /// access to protected member mTopLineNum + int scroll_row() { return mTopLineNum; } + + /// access to protected member mHorizOffset + int scroll_col() { return mHorizOffset; } +}; + +} // namespace widget +} // namespace fld + + +#endif // FLUID_WIDGETS_CODE_EDITOR_H diff --git a/fluid/widgets/Code_Viewer.cxx b/fluid/widgets/Code_Viewer.cxx new file mode 100644 index 000000000..82a71f4f6 --- /dev/null +++ b/fluid/widgets/Code_Viewer.cxx @@ -0,0 +1,51 @@ +// +// Code editor widget for the Fast Light Tool Kit (FLTK). +// Syntax highlighting rewritten by erco@seriss.com 09/15/20. +// +// 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 +// 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 +// + +// +// Include necessary headers... +// + +#include "widgets/Code_Viewer.h" + +using namespace fld; +using namespace fld::widget; + +/** + Create a fld::widget::Code_Viewer widget. + \param[in] X, Y, W, H position and size of the widget + \param[in] L optional label + */ +Code_Viewer::Code_Viewer(int X, int Y, int W, int H, const char *L) +: Code_Editor(X, Y, W, H, L) +{ + default_key_function(kf_ignore); + remove_all_key_bindings(&key_bindings); + cursor_style(CARET_CURSOR); +} + +/** + Tricking Fl_Text_Display into using bearable colors for this specific task. + */ +void Code_Viewer::draw() +{ + Fl_Color c = Fl::get_color(FL_SELECTION_COLOR); + Fl::set_color(FL_SELECTION_COLOR, fl_color_average(FL_BACKGROUND_COLOR, FL_FOREGROUND_COLOR, 0.9f)); + Code_Editor::draw(); + Fl::set_color(FL_SELECTION_COLOR, c); +} + + diff --git a/fluid/widgets/Code_Viewer.h b/fluid/widgets/Code_Viewer.h new file mode 100644 index 000000000..5bf8b870a --- /dev/null +++ b/fluid/widgets/Code_Viewer.h @@ -0,0 +1,51 @@ +// +// Code editor widget for the Fast Light Tool Kit (FLTK). +// Syntax highlighting rewritten by erco@seriss.com 09/15/20. +// +// 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 +// 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 +// + +#ifndef FLUID_WIDGETS_CODE_VIEWER_H +#define FLUID_WIDGETS_CODE_VIEWER_H + +// +// Include necessary headers... +// + +#include "widgets/Code_Editor.h" + +namespace fld { +namespace widget { + +/** + A widget derived from Code_Editor with highlighting for code blocks. + + This widget is used by the codeview system to show the design's + source and header code. The secondary highlighting show the text + part that corresponds to the selected widget(s). + */ +class Code_Viewer : public Code_Editor { +public: + Code_Viewer(int X, int Y, int W, int H, const char *L = nullptr); + +protected: + void draw() override; + + /// Limit event handling to viewing, not editing + int handle(int ev) override { return Fl_Text_Display::handle(ev); } +}; + +} // namespace widget +} // namespace fld + +#endif // FLUID_WIDGETS_CODE_VIEWER_H diff --git a/fluid/widgets/Formula_Input.cxx b/fluid/widgets/Formula_Input.cxx new file mode 100644 index 000000000..b26bd83e3 --- /dev/null +++ b/fluid/widgets/Formula_Input.cxx @@ -0,0 +1,217 @@ +// +// Widget type code for the Fast Light Tool Kit (FLTK). +// +// 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 +// 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 +// + +#include "widgets/Formula_Input.h" + +#include +#include "../src/flstring.h" + +#include +#include +#include + +using namespace fld; +using namespace fld::widget; + +/** \class fld::widget::Formula_Input + The Formula_Input widget is an input field for entering widget coordinates + and sizes. It includes basic math capabilities and allows the use of variables + in formulas. This widget is useful for specifying precise positions and + dimensions for widgets in a graphical user interface. + */ + +/** + Create an input field. + */ +Formula_Input::Formula_Input(int x, int y, int w, int h, const char *l) +: Fl_Input(x, y, w, h, l) +{ + Fl_Input::callback((Fl_Callback*)callback_handler_cb); + text("0"); +} + +void Formula_Input::callback_handler_cb(Formula_Input *This, void *v) { + This->callback_handler(v); +} + +void Formula_Input::callback_handler(void *v) { + if (user_callback_) + (*user_callback_)(this, v); + // do *not* update the value to show the evaluated formula here, because the + // values of the variables have already updated after the user callback. +} + +/** + \brief Get the value of a variable. + Collects all consecutive ASCII letters into a variable name, scans the + Variable list for that name, and then calls the corresponding callback from + the Variable array. + \param s points to the first character of the variable name, must point after + the last character of the variable name when returning. + \return the integer value that was found or calculated + */ +int Formula_Input::eval_var(uchar *&s) const { + if (!vars_) + return 0; + // find the end of the variable name + uchar *v = s; + while (isalpha(*s)) s++; + int n = (int)(s-v); + // find the variable in the list + for (Formula_Input_Vars *vars = vars_; vars->name_; vars++) { + if (strncmp((char*)v, vars->name_, n)==0 && vars->name_[n]==0) + return vars->callback_(this, vars_user_data_); + } + return 0; +} + +/** + Evaluate a formula into an integer, recursive part. + \param s remaining text in this formula, must return a pointer to the next + character that will be interpreted. + \param prio priority of current operation + \return the value so far + */ +int Formula_Input::eval(uchar *&s, int prio) const { + int v = 0, sgn = 1; + uchar c = *s++; + + // check for end of text + if (c==0) { s--; return sgn*v; } + + // check for unary operator + if (c=='-') { sgn = -1; c = *s++; } + else if (c=='+') { sgn = 1; c = *s++; } + + // read value, variable, or bracketed term + if (c==0) { + s--; return sgn*v; + } else if (c>='0' && c<='9') { + // numeric value + while (c>='0' && c<='9') { + v = v*10 + (c-'0'); + c = *s++; + } + } else if (isalpha(c)) { + v = eval_var(--s); + c = *s++; + } else if (c=='(') { + // opening bracket + v = eval(s, 5); + } else { + return sgn*v; // syntax error + } + if (sgn==-1) v = -v; + + // Now evaluate all following binary operators + for (;;) { + if (c==0) { + s--; + return v; + } else if (c=='+' || c=='-') { + if (prio<=4) { s--; return v; } + if (c=='+') { v += eval(s, 4); } + else if (c=='-') { v -= eval(s, 4); } + } else if (c=='*' || c=='/') { + if (prio<=3) { s--; return v; } + if (c=='*') { v *= eval(s, 3); } + else if (c=='/') { + int x = eval(s, 3); + if (x!=0) // if x is zero, don't divide + v /= x; + } + } else if (c==')') { + return v; + } else { + return v; // syntax error + } + c = *s++; + } + return v; +} + +/** + Evaluate a formula into an integer. + + The Formula_Input widget includes a formula interpreter that allows you + to evaluate a string containing a mathematical formula and obtain the result + as an integer. The interpreter supports unary plus and minus, basic integer + math operations (such as addition, subtraction, multiplication, and division), + and brackets. It also allows you to define a list of variables by name and use + them in the formula. The interpreter does not perform error checking, so it is + assumed that the formula is entered correctly. + + \param s formula as a C string + \return the calculated value + */ +int Formula_Input::eval(const char *s) const +{ + // duplicate the text, so we can modify it + uchar *buf = (uchar*)fl_strdup(s); + uchar *src = buf, *dst = buf; + // remove all whitespace to make the parser easier + for (;;) { + uchar c = *src++; + if (c==' ' || c=='\t') continue; + *dst++ = c; + if (c==0) break; + } + src = buf; + // now jump into the recursion + int ret = eval(src, 5); + ::free(buf); + return ret; +} + +/** + Evaluate the formula and return the result. + */ +int Formula_Input::value() const { + return eval(text()); +} + +/** + Set the field to an integer value, replacing previous texts. + */ +void Formula_Input::value(int v) { + char buf[32]; + fl_snprintf(buf, sizeof(buf), "%d", v); + text(buf); +} + +/** + Allow vertical mouse dragging and mouse wheel to interactively change the value. + */ +int Formula_Input::handle(int event) { + switch (event) { + case FL_MOUSEWHEEL: + if (Fl::event_dy()) { + value( value() - Fl::event_dy() ); + set_changed(); + do_callback(FL_REASON_CHANGED); + } + return 1; + } + return Fl_Input::handle(event); +} + +/** Set the list of the available variables + \param vars array of variables, last entry `has name_` set to `NULL` + \param user_data is forwarded to the Variable callback */ +void Formula_Input::variables(Formula_Input_Vars *vars, void *user_data) { + vars_ = vars; + vars_user_data_ = user_data; +} diff --git a/fluid/widgets/Formula_Input.h b/fluid/widgets/Formula_Input.h new file mode 100644 index 000000000..5307cdc88 --- /dev/null +++ b/fluid/widgets/Formula_Input.h @@ -0,0 +1,73 @@ +// +// Formula_Input widget header file for the Fast Light Tool Kit (FLTK). +// +// 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 +// 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 +// + +#ifndef FLUID_WIDGETS_FORMULA_INPUT_H +#define FLUID_WIDGETS_FORMULA_INPUT_H + +#include + +namespace fld { +namespace widget { + +class Formula_Input; + +// Callback signature for function returning the value of a variable. +typedef int (Fluid_Coord_Callback)(Formula_Input const *, void*); + +// Entry for a list of variables available to an input field. +// Formula_Input::variables() expects an array of +// Formula_Input_Vars with the last entry's name_ set to NULL. +typedef struct Formula_Input_Vars { + const char *name_; + Fluid_Coord_Callback *callback_; +} Formula_Input_Vars; + +// A text input widget that understands simple math. +class Formula_Input : public Fl_Input +{ + Fl_Callback *user_callback_ { nullptr }; + Formula_Input_Vars *vars_ { nullptr }; + void *vars_user_data_ { nullptr }; + + static void callback_handler_cb(Formula_Input *This, void *v); + void callback_handler(void *v); + int eval_var(uchar *&s) const; + int eval(uchar *&s, int prio) const; + int eval(const char *s) const; + +public: + Formula_Input(int x, int y, int w, int h, const char *l = nullptr); + + /** Return the text in the widget text field. */ + const char *text() const { return Fl_Input::value(); } + + /** Set the text in the text field */ + void text(const char *v) { Fl_Input::value(v); } + + int value() const; + void value(int v); + + /** Set the general callback for this widget. */ + void callback(Fl_Callback *cb) { user_callback_ = cb; } + + void variables(fld::widget::Formula_Input_Vars *vars, void *user_data); + int handle(int) override; +}; + +} // namespace widget +} // namespace fld + +#endif // FLUID_WIDGETS_FORMULA_INPUT_H diff --git a/fluid/widgets/StyleParse.cxx b/fluid/widgets/StyleParse.cxx deleted file mode 100644 index b8b8ff4f0..000000000 --- a/fluid/widgets/StyleParse.cxx +++ /dev/null @@ -1,328 +0,0 @@ -// -// Syntax highlighting for the Fast Light Tool Kit (FLTK). -// -// Copyright 1998-2020 by Bill Spitzak and others. -// Copyright 2020 Greg Ercolano. -// -// 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 -// - -#include "StyleParse.h" - -#include -#include -#include -#include // bsearch() - -// Sorted list of C/C++ keywords... -static const char * const code_keywords[] = { - "and", - "and_eq", - "asm", - "bitand", - "bitor", - "break", - "case", - "catch", - "compl", - "continue", - "default", - "delete", - "do", - "else", - "false", - "for", - "goto", - "if", - "new", - "not", - "not_eq", - "operator", - "or", - "or_eq", - "return", - "switch", - "template", - "this", - "throw", - "true", - "try", - "while", - "xor", - "xor_eq" -}; - -// Sorted list of C/C++ types... -static const char * const code_types[] = { - "auto", - "bool", - "char", - "class", - "const", - "const_cast", - "double", - "dynamic_cast", - "enum", - "explicit", - "extern", - "float", - "friend", - "inline", - "int", - "long", - "mutable", - "namespace", - "private", - "protected", - "public", - "register", - "short", - "signed", - "sizeof", - "static", - "static_cast", - "struct", - "template", - "typedef", - "typename", - "union", - "unsigned", - "virtual", - "void", - "volatile" -}; - -// 'compare_keywords()' - Compare two keywords... -extern "C" { - static int compare_keywords(const void *a, const void *b) { - return strcmp(*((const char **)a), *((const char **)b)); - } -} - -// See if 'find' is a C/C++ keyword. -// Refer to bsearch(3) for return value. -// -static void* search_keywords(char *find) { - return bsearch(&find, code_keywords, - sizeof(code_keywords) / sizeof(code_keywords[0]), - sizeof(code_keywords[0]), compare_keywords); -} - -// See if 'find' is a C/C++ type. -// Refer to bsearch(3) for return value. -// -static void* search_types(char *find) { - return bsearch(&find, code_types, - sizeof(code_types) / sizeof(code_types[0]), - sizeof(code_types[0]), compare_keywords); -} - -// Handle style parsing over a character -// Handles updating col counter when \n encountered. -// Applies the current style, advances to next text + style char. -// Returns 0 if hit end of buffer, 1 otherwise. -// -int StyleParse::parse_over_char(int handle_crlf) { - char c = *tbuff; - - // End of line? - if ( handle_crlf ) { - if ( c == '\n' ) { - lwhite = 1; // restart leading white flag - } else { - // End of leading white? (used by #directive) - if ( !strchr(" \t", c) ) lwhite = 0; - } - } - - // Adjust and advance - // If handling crlfs, zero col on crlf. If not handling, let col continue to count past crlf - // e.g. for multiline #define's that have lines ending in backslashes. - // - col = (c=='\n') ? (handle_crlf ? 0 : col) : col+1; // column counter - tbuff++; // advance text ptr - *sbuff++ = style; // apply style & advance its ptr - if ( --len <= 0 ) return 0; // keep track of length - return 1; -} - -// Parse over white space using current style -// Returns 0 if hit end of buffer, 1 otherwise. -// -int StyleParse::parse_over_white() { - while ( len > 0 && strchr(" \t", *tbuff)) - { if ( !parse_over_char() ) return 0; } - return 1; -} - -// Parse over non-white alphabetic text -// Returns 0 if hit end of buffer, 1 otherwise. -// -int StyleParse::parse_over_alpha() { - while ( len > 0 && isalpha(*tbuff) ) - { if ( !parse_over_char() ) return 0; } - return 1; -} - -// Parse to end of line in specified style. -// Returns 0 if hit end of buffer, 1 otherwise. -// -int StyleParse::parse_to_eol(char s) { - char save = style; - style = s; - while ( *tbuff != '\n' ) - { if ( !parse_over_char() ) return 0; } - style = save; - return 1; -} - -// Parse a block comment until end of comment or buffer. -// Returns 0 if hit end of buffer, 1 otherwise. -// -int StyleParse::parse_block_comment() { - char save = style; - style = 'C'; // block comment style - while ( len > 0 ) { - if ( strncmp(tbuff, "*/", 2) == 0 ) { - if ( !parse_over_char() ) return 0; // handle '*' - if ( !parse_over_char() ) return 0; // handle '/' - break; - } - if ( !parse_over_char() ) return 0; // handle comment text - } - style = save; // revert style - return 1; -} - -// Copy keyword from tbuff -> keyword[] buffer -void StyleParse::buffer_keyword() { - char *key = keyword; - char *kend = key + sizeof(keyword) - 1; // end of buffer - for ( const char *s=tbuff; - (islower(*s) || *s=='_') && (key < kend); - *key++ = *s++ ) { } - *key = 0; // terminate -} - -// Parse over specified 'key'word in specified style 's'. -// Returns 0 if hit end of buffer, 1 otherwise. -// -int StyleParse::parse_over_key(const char *key, char s) { - char save = style; - style = s; - // Parse over the keyword while applying style to sbuff - while ( *key++ ) - { if ( !parse_over_char() ) return 0; } - last = 1; - style = save; - return 1; -} - -// Parse over angle brackets <..> in specified style. -// Returns 0 if hit end of buffer, 1 otherwise. -// -int StyleParse::parse_over_angles(char s) { - if ( *tbuff != '<' ) return 1; // not <..>, early exit - char save = style; - style = s; - // Parse over angle brackets in specified style - while ( len > 0 && *tbuff != '>' ) - { if ( !parse_over_char() ) return 0; } // parse over '<' and angle content - if ( !parse_over_char() ) return 0; // parse over trailing '>' - style = save; - return 1; -} - -// Parse line for possible keyword -// spi.keyword[] will contain parsed word. -// Returns 0 if hit end of buffer, 1 otherwise. -// -int StyleParse::parse_keyword() { - // Parse into 'keyword' buffer - buffer_keyword(); - char *key = keyword; - // C/C++ type? (void, char..) - if ( search_types(key) ) - return parse_over_key(key, 'F'); // 'type' style - // C/C++ Keyword? (switch, return..) - else if ( search_keywords(key) ) - return parse_over_key(key, 'G'); // 'keyword' style - // Not a type or keyword? Parse over it - return parse_over_key(key, style); -} - -// Style parse a quoted string, either "" or ''. -// Returns 0 if hit end of buffer, 1 otherwise. -// -int StyleParse::parse_quoted_string(char quote_char, // e.g. '"' or '\'' - char in_style) { // style for quoted text - style = in_style; // start string style - if ( !parse_over_char() ) return 0; // parse over opening quote - - // Parse until closing quote reached - char c; - while ( len > 0 ) { - c = tbuff[0]; - if ( c == quote_char ) { // Closing quote? Parse and done - if ( !parse_over_char() ) return 0; // close quote - break; - } else if ( c == '\\' ) { // Escape sequence? Parse over, continue - if ( !parse_over_char() ) return 0; // escape - if ( !parse_over_char() ) return 0; // char being escaped - continue; - } - // Keep parsing until end of buffer or closing quote.. - if ( !parse_over_char() ) return 0; - } - style = 'A'; // revert normal style - return 1; -} - -// Style parse a directive (#include, #define..) -// Returns 0 if hit end of buffer, 1 otherwise. -// -int StyleParse::parse_directive() { - style = 'E'; // start directive style - if ( !parse_over_char() ) return 0; // Parse over '#' - if ( !parse_over_white() ) return 0; // Parse over any whitespace after '#' - if ( !parse_over_alpha() ) return 0; // Parse over the directive - style = 'A'; // revert normal style - if ( !parse_over_white() ) return 0; // Parse over white after directive - if ( !parse_over_angles('D')) return 0; // #include <..> (if any) - return 1; -} - -// Style parse a line comment to end of line. -// Returns 0 if hit end of buffer, 1 otherwise. -// -int StyleParse::parse_line_comment() { - return parse_to_eol('B'); -} - -// Parse a backslash escape character sequence. -// Purposefully don't 'handle' \n, since an escaped \n should be -// a continuation of a line, such as in a multiline #directive. -// Returns 0 if hit end of buffer, 1 otherwise. -// -int StyleParse::parse_escape() { - const char no_crlf = 0; - if ( !parse_over_char(no_crlf) ) return 0; // backslash - if ( !parse_over_char(no_crlf) ) return 0; // char escaped - return 1; -} - -// Parse all other non-specific characters -// Returns 0 if hit end of buffer, 1 otherwise. -// -int StyleParse::parse_all_else() { - last = isalnum(*tbuff) || *tbuff == '_' || *tbuff == '.'; - return parse_over_char(); -} diff --git a/fluid/widgets/StyleParse.h b/fluid/widgets/StyleParse.h deleted file mode 100644 index 2fcc4f4db..000000000 --- a/fluid/widgets/StyleParse.h +++ /dev/null @@ -1,61 +0,0 @@ -// -// Syntax highlighting for the Fast Light Tool Kit (FLTK). -// -// Copyright 1998-2020 by Bill Spitzak and others. -// Copyright 2020 Greg Ercolano. -// -// 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 -// - -#ifndef StyleParse_h -#define StyleParse_h - -// Class to manage style parsing, friend of CodeEditor -class StyleParse { -public: - const char *tbuff; // text buffer - char *sbuff; // style buffer - int len; // running length - char style; // current style - char lwhite; // leading white space (1=white, 0=past white) - int col; // line's column counter - char keyword[40]; // keyword parsing buffer - char last; // flag for keyword parsing - - StyleParse() { - tbuff = 0; - sbuff = 0; - len = 0; - style = 0; - lwhite = 1; - col = 0; - last = 0; - } - - // Methods to aid in parsing - int parse_over_char(int handle_crlf=1); - int parse_over_white(); - int parse_over_alpha(); - int parse_to_eol(char s); - int parse_block_comment(); // "/* text.. */" - void buffer_keyword(); - int parse_over_key(const char *key, char s); - int parse_over_angles(char s); - int parse_keyword(); // "switch" - int parse_quoted_string(char quote_char, char in_style); - // "hello", 'x' - int parse_directive(); // "#define" - int parse_line_comment(); // "// text.." - int parse_escape(); // "\'" - int parse_all_else(); // all other code -}; - -#endif // StyleParse_h diff --git a/fluid/widgets/Style_Parser.cxx b/fluid/widgets/Style_Parser.cxx new file mode 100644 index 000000000..9929cc01a --- /dev/null +++ b/fluid/widgets/Style_Parser.cxx @@ -0,0 +1,331 @@ +// +// Syntax highlighting for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2025 by Bill Spitzak and others. +// Copyright 2020 Greg Ercolano. +// +// 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 +// + +#include "Style_Parser.h" + +#include +#include +#include +#include // bsearch() + +using namespace fld; +using namespace fld::widget; + +// Sorted list of C/C++ keywords... +static const char * const code_keywords[] = { + "and", + "and_eq", + "asm", + "bitand", + "bitor", + "break", + "case", + "catch", + "compl", + "continue", + "default", + "delete", + "do", + "else", + "false", + "for", + "goto", + "if", + "new", + "not", + "not_eq", + "operator", + "or", + "or_eq", + "return", + "switch", + "template", + "this", + "throw", + "true", + "try", + "while", + "xor", + "xor_eq" +}; + +// Sorted list of C/C++ types... +static const char * const code_types[] = { + "auto", + "bool", + "char", + "class", + "const", + "const_cast", + "double", + "dynamic_cast", + "enum", + "explicit", + "extern", + "float", + "friend", + "inline", + "int", + "long", + "mutable", + "namespace", + "private", + "protected", + "public", + "register", + "short", + "signed", + "sizeof", + "static", + "static_cast", + "struct", + "template", + "typedef", + "typename", + "union", + "unsigned", + "virtual", + "void", + "volatile" +}; + +// 'compare_keywords()' - Compare two keywords... +extern "C" { + static int compare_keywords(const void *a, const void *b) { + return strcmp(*((const char **)a), *((const char **)b)); + } +} + +// See if 'find' is a C/C++ keyword. +// Refer to bsearch(3) for return value. +// +static void* search_keywords(char *find) { + return bsearch(&find, code_keywords, + sizeof(code_keywords) / sizeof(code_keywords[0]), + sizeof(code_keywords[0]), compare_keywords); +} + +// See if 'find' is a C/C++ type. +// Refer to bsearch(3) for return value. +// +static void* search_types(char *find) { + return bsearch(&find, code_types, + sizeof(code_types) / sizeof(code_types[0]), + sizeof(code_types[0]), compare_keywords); +} + +// Handle style parsing over a character +// Handles updating col counter when \n encountered. +// Applies the current style, advances to next text + style char. +// Returns 0 if hit end of buffer, 1 otherwise. +// +int Style_Parser::parse_over_char(int handle_crlf) { + char c = *tbuff; + + // End of line? + if ( handle_crlf ) { + if ( c == '\n' ) { + lwhite = 1; // restart leading white flag + } else { + // End of leading white? (used by #directive) + if ( !strchr(" \t", c) ) lwhite = 0; + } + } + + // Adjust and advance + // If handling crlfs, zero col on crlf. If not handling, let col continue to count past crlf + // e.g. for multiline #define's that have lines ending in backslashes. + // + col = (c=='\n') ? (handle_crlf ? 0 : col) : col+1; // column counter + tbuff++; // advance text ptr + *sbuff++ = style; // apply style & advance its ptr + if ( --len <= 0 ) return 0; // keep track of length + return 1; +} + +// Parse over white space using current style +// Returns 0 if hit end of buffer, 1 otherwise. +// +int Style_Parser::parse_over_white() { + while ( len > 0 && strchr(" \t", *tbuff)) + { if ( !parse_over_char() ) return 0; } + return 1; +} + +// Parse over non-white alphabetic text +// Returns 0 if hit end of buffer, 1 otherwise. +// +int Style_Parser::parse_over_alpha() { + while ( len > 0 && isalpha(*tbuff) ) + { if ( !parse_over_char() ) return 0; } + return 1; +} + +// Parse to end of line in specified style. +// Returns 0 if hit end of buffer, 1 otherwise. +// +int Style_Parser::parse_to_eol(char s) { + char save = style; + style = s; + while ( *tbuff != '\n' ) + { if ( !parse_over_char() ) return 0; } + style = save; + return 1; +} + +// Parse a block comment until end of comment or buffer. +// Returns 0 if hit end of buffer, 1 otherwise. +// +int Style_Parser::parse_block_comment() { + char save = style; + style = 'C'; // block comment style + while ( len > 0 ) { + if ( strncmp(tbuff, "*/", 2) == 0 ) { + if ( !parse_over_char() ) return 0; // handle '*' + if ( !parse_over_char() ) return 0; // handle '/' + break; + } + if ( !parse_over_char() ) return 0; // handle comment text + } + style = save; // revert style + return 1; +} + +// Copy keyword from tbuff -> keyword[] buffer +void Style_Parser::buffer_keyword() { + char *key = keyword; + char *kend = key + sizeof(keyword) - 1; // end of buffer + for ( const char *s=tbuff; + (islower(*s) || *s=='_') && (key < kend); + *key++ = *s++ ) { } + *key = 0; // terminate +} + +// Parse over specified 'key'word in specified style 's'. +// Returns 0 if hit end of buffer, 1 otherwise. +// +int Style_Parser::parse_over_key(const char *key, char s) { + char save = style; + style = s; + // Parse over the keyword while applying style to sbuff + while ( *key++ ) + { if ( !parse_over_char() ) return 0; } + last = 1; + style = save; + return 1; +} + +// Parse over angle brackets <..> in specified style. +// Returns 0 if hit end of buffer, 1 otherwise. +// +int Style_Parser::parse_over_angles(char s) { + if ( *tbuff != '<' ) return 1; // not <..>, early exit + char save = style; + style = s; + // Parse over angle brackets in specified style + while ( len > 0 && *tbuff != '>' ) + { if ( !parse_over_char() ) return 0; } // parse over '<' and angle content + if ( !parse_over_char() ) return 0; // parse over trailing '>' + style = save; + return 1; +} + +// Parse line for possible keyword +// spi.keyword[] will contain parsed word. +// Returns 0 if hit end of buffer, 1 otherwise. +// +int Style_Parser::parse_keyword() { + // Parse into 'keyword' buffer + buffer_keyword(); + char *key = keyword; + // C/C++ type? (void, char..) + if ( search_types(key) ) + return parse_over_key(key, 'F'); // 'type' style + // C/C++ Keyword? (switch, return..) + else if ( search_keywords(key) ) + return parse_over_key(key, 'G'); // 'keyword' style + // Not a type or keyword? Parse over it + return parse_over_key(key, style); +} + +// Style parse a quoted string, either "" or ''. +// Returns 0 if hit end of buffer, 1 otherwise. +// +int Style_Parser::parse_quoted_string(char quote_char, // e.g. '"' or '\'' + char in_style) { // style for quoted text + style = in_style; // start string style + if ( !parse_over_char() ) return 0; // parse over opening quote + + // Parse until closing quote reached + char c; + while ( len > 0 ) { + c = tbuff[0]; + if ( c == quote_char ) { // Closing quote? Parse and done + if ( !parse_over_char() ) return 0; // close quote + break; + } else if ( c == '\\' ) { // Escape sequence? Parse over, continue + if ( !parse_over_char() ) return 0; // escape + if ( !parse_over_char() ) return 0; // char being escaped + continue; + } + // Keep parsing until end of buffer or closing quote.. + if ( !parse_over_char() ) return 0; + } + style = 'A'; // revert normal style + return 1; +} + +// Style parse a directive (#include, #define..) +// Returns 0 if hit end of buffer, 1 otherwise. +// +int Style_Parser::parse_directive() { + style = 'E'; // start directive style + if ( !parse_over_char() ) return 0; // Parse over '#' + if ( !parse_over_white() ) return 0; // Parse over any whitespace after '#' + if ( !parse_over_alpha() ) return 0; // Parse over the directive + style = 'A'; // revert normal style + if ( !parse_over_white() ) return 0; // Parse over white after directive + if ( !parse_over_angles('D')) return 0; // #include <..> (if any) + return 1; +} + +// Style parse a line comment to end of line. +// Returns 0 if hit end of buffer, 1 otherwise. +// +int Style_Parser::parse_line_comment() { + return parse_to_eol('B'); +} + +// Parse a backslash escape character sequence. +// Purposefully don't 'handle' \n, since an escaped \n should be +// a continuation of a line, such as in a multiline #directive. +// Returns 0 if hit end of buffer, 1 otherwise. +// +int Style_Parser::parse_escape() { + const char no_crlf = 0; + if ( !parse_over_char(no_crlf) ) return 0; // backslash + if ( !parse_over_char(no_crlf) ) return 0; // char escaped + return 1; +} + +// Parse all other non-specific characters +// Returns 0 if hit end of buffer, 1 otherwise. +// +int Style_Parser::parse_all_else() { + last = isalnum(*tbuff) || *tbuff == '_' || *tbuff == '.'; + return parse_over_char(); +} diff --git a/fluid/widgets/Style_Parser.h b/fluid/widgets/Style_Parser.h new file mode 100644 index 000000000..287ea6b21 --- /dev/null +++ b/fluid/widgets/Style_Parser.h @@ -0,0 +1,59 @@ +// +// Syntax highlighting for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2025 by Bill Spitzak and others. +// Copyright 2020 Greg Ercolano. +// +// 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 +// + +#ifndef FLUID_WIDGETS_STYLE_PARSER_H +#define FLUID_WIDGETS_STYLE_PARSER_H + +namespace fld { +namespace widget { + +// Class to manage style parsing, friend of Code_Editor +class Style_Parser { +public: + const char *tbuff { nullptr }; // text buffer + char *sbuff { nullptr }; // style buffer + int len { 0 }; // running length + char style { 0 }; // current style + char lwhite { 1 }; // leading white space (1=white, 0=past white) + int col { 0 }; // line's column counter + char keyword[40] { }; // keyword parsing buffer + char last { 0 }; // flag for keyword parsing + + Style_Parser() = default; + + // Methods to aid in parsing + int parse_over_char(int handle_crlf=1); + int parse_over_white(); + int parse_over_alpha(); + int parse_to_eol(char s); + int parse_block_comment(); // "/* text.. */" + void buffer_keyword(); + int parse_over_key(const char *key, char s); + int parse_over_angles(char s); + int parse_keyword(); // "switch" + int parse_quoted_string(char quote_char, char in_style); + // "hello", 'x' + int parse_directive(); // "#define" + int parse_line_comment(); // "// text.." + int parse_escape(); // "\'" + int parse_all_else(); // all other code +}; + +} // namespace widget +} // namespace fld + +#endif // FLUID_WIDGETS_STYLE_PARSER_H diff --git a/fluid/widgets/Text_Viewer.cxx b/fluid/widgets/Text_Viewer.cxx new file mode 100644 index 000000000..ba2d145fe --- /dev/null +++ b/fluid/widgets/Text_Viewer.cxx @@ -0,0 +1,58 @@ +// +// Code editor widget for the Fast Light Tool Kit (FLTK). +// Syntax highlighting rewritten by erco@seriss.com 09/15/20. +// +// 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 +// 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 +// + +// +// Include necessary headers... +// + +#include "widgets/Text_Viewer.h" + +using namespace fld; +using namespace fld::widget; + +/** + Create a fld::widget::Text_Viewer widget. + \param[in] X, Y, W, H position and size of the widget + \param[in] L optional label + */ +Text_Viewer::Text_Viewer(int X, int Y, int W, int H, const char *L) +: Fl_Text_Display(X, Y, W, H, L) +{ + buffer(new Fl_Text_Buffer); +} + +/** + Avoid memory leaks. + */ +Text_Viewer::~Text_Viewer() { + Fl_Text_Buffer *buf = mBuffer; + buffer(0); + delete buf; +} + +/** + Tricking Fl_Text_Display into using bearable colors for this specific task. + */ +void Text_Viewer::draw() +{ + Fl_Color c = Fl::get_color(FL_SELECTION_COLOR); + Fl::set_color(FL_SELECTION_COLOR, fl_color_average(FL_BACKGROUND_COLOR, FL_FOREGROUND_COLOR, 0.9f)); + Fl_Text_Display::draw(); + Fl::set_color(FL_SELECTION_COLOR, c); +} + + diff --git a/fluid/widgets/Text_Viewer.h b/fluid/widgets/Text_Viewer.h new file mode 100644 index 000000000..1e5810d50 --- /dev/null +++ b/fluid/widgets/Text_Viewer.h @@ -0,0 +1,46 @@ +// +// Code editor widget for the Fast Light Tool Kit (FLTK). +// Syntax highlighting rewritten by erco@seriss.com 09/15/20. +// +// 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 +// 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 +// + +#ifndef FLUID_WIDGETS_TEXT_VIEWER_H +#define FLUID_WIDGETS_TEXT_VIEWER_H + +// +// Include necessary headers... +// + +#include + +namespace fld { +namespace widget { + +/** + A text viewer with an additional highlighting color scheme. + */ +class Text_Viewer : public Fl_Text_Display { +public: + Text_Viewer(int X, int Y, int W, int H, const char *L = nullptr); + ~Text_Viewer(); + void draw() override; + + /// access to protected member get_absolute_top_line_number() + int top_line() { return get_absolute_top_line_number(); } +}; + +} // namespace widget +} // namespace fld + +#endif // FLUID_WIDGETS_TEXT_VIEWER_H diff --git a/fluid/widgets/custom_widgets.cxx b/fluid/widgets/custom_widgets.cxx deleted file mode 100644 index 25a630783..000000000 --- a/fluid/widgets/custom_widgets.cxx +++ /dev/null @@ -1,311 +0,0 @@ -// -// Widget type code for the Fast Light Tool Kit (FLTK). -// -// Copyright 1998-2023 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 -// - -#include "widgets/custom_widgets.h" - -#include "app/fluid.h" -#include "nodes/Fl_Window_Type.h" -#include "nodes/factory.h" -#include "panels/widget_panel.h" -#include "widgets/widget_browser.h" - -#include -#include -#include -#include -#include -#include -#include "../src/flstring.h" - -/** \class Widget_Bin_Button - The Widget_Bin_Button button is a button that can be used in the widget bin to - allow the user to drag and drop widgets into a window or group. This feature - makes it easy for the user to position a widget at a specific location within - the window or group. - */ - -/** - Convert mouse dragging into a drag and drop event. - */ -int Widget_Bin_Button::handle(int inEvent) -{ - int ret = 0; - switch (inEvent) { - case FL_PUSH: - Fl_Button::handle(inEvent); - return 1; // make sure that we get drag events - case FL_DRAG: - ret = Fl_Button::handle(inEvent); - if (!user_data()) - return ret; - if (!Fl::event_is_click()) { // make it a dnd event - // fake a drag outside of the widget - Fl::e_x = x()-1; - Fl_Button::handle(inEvent); - // fake a button release - Fl_Button::handle(FL_RELEASE); - // make it into a dnd event - const char *type_name = (const char*)user_data(); - Fl_Type::current_dnd = Fl_Type::current; - Fl::copy(type_name, (int)strlen(type_name)+1, 0); - Fl::dnd(); - return 1; - } - return ret; - } - return Fl_Button::handle(inEvent); -} - -/** \class Widget_Bin_Window_Button - The Widget_Bin_Window_Button button is used in the widget bin to create new - windows by dragging and dropping. When the button is dragged and dropped onto - the desktop, a new window will be created at the drop location. - */ - -/** - Convert mouse dragging into a drag and drop event. - */ -int Widget_Bin_Window_Button::handle(int inEvent) -{ - static Fl_Window *drag_win = NULL; - int ret = 0; - switch (inEvent) { - case FL_PUSH: - Fl_Button::handle(inEvent); - return 1; // make sure that we get drag events - case FL_DRAG: - ret = Fl_Button::handle(inEvent); - if (!user_data()) - return ret; - if (!Fl::event_is_click()) { - if (!drag_win) { - drag_win = new Fl_Window(0, 0, 480, 320); - drag_win->border(0); - drag_win->set_non_modal(); - } - if (drag_win) { - drag_win->position(Fl::event_x_root()+1, Fl::event_y_root()+1); - drag_win->show(); - } - // Does not work outside window: fl_cursor(FL_CURSOR_HAND); - } - return ret; - case FL_RELEASE: - if (drag_win) { - Fl::delete_widget(drag_win); - drag_win = NULL; - // create a new window here - Fl_Type *prototype = typename_to_prototype((char*)user_data()); - if (prototype) { - Fl_Type *new_type = add_new_widget_from_user(prototype, Strategy::AFTER_CURRENT); - if (new_type && new_type->is_a(ID_Window)) { - Fl_Window_Type *new_window = (Fl_Window_Type*)new_type; - Fl_Window *w = (Fl_Window *)new_window->o; - w->position(Fl::event_x_root(), Fl::event_y_root()); - } - } - widget_browser->display(Fl_Type::current); - widget_browser->rebuild(); - } - return Fl_Button::handle(inEvent); - } - return Fl_Button::handle(inEvent); -} - -/** \class Fluid_Coord_Input - The Fluid_Coord_Input widget is an input field for entering widget coordinates - and sizes. It includes basic math capabilities and allows the use of variables - in formulas. This widget is useful for specifying precise positions and - dimensions for widgets in a graphical user interface. - */ - -/** - Create an input field. - */ -Fluid_Coord_Input::Fluid_Coord_Input(int x, int y, int w, int h, const char *l) : -Fl_Input(x, y, w, h, l), -user_callback_(0L), -vars_(0L), -vars_user_data_(0L) -{ - Fl_Input::callback((Fl_Callback*)callback_handler_cb); - text("0"); -} - -void Fluid_Coord_Input::callback_handler_cb(Fluid_Coord_Input *This, void *v) { - This->callback_handler(v); -} - -void Fluid_Coord_Input::callback_handler(void *v) { - if (user_callback_) - (*user_callback_)(this, v); - // do *not* update the value to show the evaluated formula here, because the - // values of the variables have already updated after the user callback. -} - -/** - \brief Get the value of a variable. - Collects all consecutive ASCII letters into a variable name, scans the - Variable list for that name, and then calls the corresponding callback from - the Variable array. - \param s points to the first character of the variable name, must point after - the last character of the variable name when returning. - \return the integer value that was found or calculated - */ -int Fluid_Coord_Input::eval_var(uchar *&s) const { - if (!vars_) - return 0; - // find the end of the variable name - uchar *v = s; - while (isalpha(*s)) s++; - int n = (int)(s-v); - // find the variable in the list - for (Fluid_Coord_Input_Vars *vars = vars_; vars->name_; vars++) { - if (strncmp((char*)v, vars->name_, n)==0 && vars->name_[n]==0) - return vars->callback_(this, vars_user_data_); - } - return 0; -} - -/** - Evaluate a formula into an integer, recursive part. - \param s remaining text in this formula, must return a pointer to the next - character that will be interpreted. - \param prio priority of current operation - \return the value so far - */ -int Fluid_Coord_Input::eval(uchar *&s, int prio) const { - int v = 0, sgn = 1; - uchar c = *s++; - - // check for end of text - if (c==0) { s--; return sgn*v; } - - // check for unary operator - if (c=='-') { sgn = -1; c = *s++; } - else if (c=='+') { sgn = 1; c = *s++; } - - // read value, variable, or bracketed term - if (c==0) { - s--; return sgn*v; - } else if (c>='0' && c<='9') { - // numeric value - while (c>='0' && c<='9') { - v = v*10 + (c-'0'); - c = *s++; - } - } else if (isalpha(c)) { - v = eval_var(--s); - c = *s++; - } else if (c=='(') { - // opening bracket - v = eval(s, 5); - } else { - return sgn*v; // syntax error - } - if (sgn==-1) v = -v; - - // Now evaluate all following binary operators - for (;;) { - if (c==0) { - s--; - return v; - } else if (c=='+' || c=='-') { - if (prio<=4) { s--; return v; } - if (c=='+') { v += eval(s, 4); } - else if (c=='-') { v -= eval(s, 4); } - } else if (c=='*' || c=='/') { - if (prio<=3) { s--; return v; } - if (c=='*') { v *= eval(s, 3); } - else if (c=='/') { - int x = eval(s, 3); - if (x!=0) // if x is zero, don't divide - v /= x; - } - } else if (c==')') { - return v; - } else { - return v; // syntax error - } - c = *s++; - } - return v; -} - -/** - Evaluate a formula into an integer. - - The Fluid_Coord_Input widget includes a formula interpreter that allows you - to evaluate a string containing a mathematical formula and obtain the result - as an integer. The interpreter supports unary plus and minus, basic integer - math operations (such as addition, subtraction, multiplication, and division), - and brackets. It also allows you to define a list of variables by name and use - them in the formula. The interpreter does not perform error checking, so it is - assumed that the formula is entered correctly. - - \param s formula as a C string - \return the calculated value - */ -int Fluid_Coord_Input::eval(const char *s) const -{ - // duplicate the text, so we can modify it - uchar *buf = (uchar*)fl_strdup(s); - uchar *src = buf, *dst = buf; - // remove all whitespace to make the parser easier - for (;;) { - uchar c = *src++; - if (c==' ' || c=='\t') continue; - *dst++ = c; - if (c==0) break; - } - src = buf; - // now jump into the recursion - int ret = eval(src, 5); - ::free(buf); - return ret; -} - -/** - Evaluate the formula and return the result. - */ -int Fluid_Coord_Input::value() const { - return eval(text()); -} - -/** - Set the field to an integer value, replacing previous texts. - */ -void Fluid_Coord_Input::value(int v) { - char buf[32]; - fl_snprintf(buf, sizeof(buf), "%d", v); - text(buf); -} - -/** - Allow vertical mouse dragging and mouse wheel to interactively change the value. - */ -int Fluid_Coord_Input::handle(int event) { - switch (event) { - case FL_MOUSEWHEEL: - if (Fl::event_dy()) { - value( value() - Fl::event_dy() ); - set_changed(); - do_callback(FL_REASON_CHANGED); - } - return 1; - } - return Fl_Input::handle(event); -} diff --git a/fluid/widgets/custom_widgets.h b/fluid/widgets/custom_widgets.h deleted file mode 100644 index 875496b8e..000000000 --- a/fluid/widgets/custom_widgets.h +++ /dev/null @@ -1,90 +0,0 @@ -// -// Shortcut header file for the Fast Light Tool Kit (FLTK). -// -// Copyright 1998-2023 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 -// - -#ifndef _FLUID_SHORTCUT_BUTTON_H -#define _FLUID_SHORTCUT_BUTTON_H - -#include -#include - -// Adding drag and drop for dragging widgets into windows. -class Widget_Bin_Button : public Fl_Button { -public: - int handle(int) FL_OVERRIDE; - Widget_Bin_Button(int X,int Y,int W,int H, const char* l = 0) : - Fl_Button(X,Y,W,H,l) { } -}; - -// Adding drag and drop functionality to drag window prototypes onto the desktop. -class Widget_Bin_Window_Button : public Fl_Button { -public: - int handle(int) FL_OVERRIDE; - Widget_Bin_Window_Button(int X,int Y,int W,int H, const char* l = 0) : - Fl_Button(X,Y,W,H,l) { } -}; - -// Callback signature for function returning the value of a variable. -typedef int (Fluid_Coord_Callback)(class Fluid_Coord_Input const *, void*); - -// Entry for a list of variables available to an input field. -// Fluid_Coord_Input::variables() expects an array of Fluid_Coord_Input_Vars -// with the last entry's name_ set to NULL. -typedef struct Fluid_Coord_Input_Vars { - const char *name_; - Fluid_Coord_Callback *callback_; -} Fluid_Coord_Input_Vars; - -// A text input widget that understands simple math. -class Fluid_Coord_Input : public Fl_Input -{ - Fl_Callback *user_callback_; - Fluid_Coord_Input_Vars *vars_; - void *vars_user_data_; - static void callback_handler_cb(Fluid_Coord_Input *This, void *v); - void callback_handler(void *v); - int eval_var(uchar *&s) const; - int eval(uchar *&s, int prio) const; - int eval(const char *s) const; - -public: - Fluid_Coord_Input(int x, int y, int w, int h, const char *l=0L); - - /** Return the text in the widget text field. */ - const char *text() const { return Fl_Input::value(); } - - /** Set the text in the text field */ - void text(const char *v) { Fl_Input::value(v); } - - int value() const; - void value(int v); - - /** Set the general callback for this widget. */ - void callback(Fl_Callback *cb) { - user_callback_ = cb; - } - - /** Set the list of the available variables - \param vars array of variables, last entry `has name_` set to `NULL` - \param user_data is forwarded to the Variable callback */ - void variables(Fluid_Coord_Input_Vars *vars, void *user_data) { - vars_ = vars; - vars_user_data_ = user_data; - } - - int handle(int) FL_OVERRIDE; -}; - -#endif -- cgit v1.2.3