From 51a55bc73660f64e8f4b32b8b4d3858f2a786f7b Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sun, 16 Mar 2025 17:16:12 -0400 Subject: Fluid: restructuring and rejuvenation of the source code. * Add classes for application and project * Removed all globals from Fluid.h * Extracting args and project history into their own classes * Moving globals into Application class * Initialize values inside headers for some classes. * Undo functionality wrapped in a class inside Project. * File reader and writer are now linked to a project. * Avoid global project access * Nodes (former Types) will be managed by a new Tree class. * Removed static members (hidden globals) form Node/Fl_Type. * Adding Tree iterator. * Use nullptr instead of 0, NULL, or 0L * Renamed Fl_..._Type to ..._Node, FL_OVERRIDE -> override * Renaming ..._type to ...::prototype * Splitting Widget Panel into multiple files. * Moved callback code into widget panel file. * Cleaning up Fluid_Image -> Image_asset * Moving Fd_Snap_Action into new namespace fld::app::Snap_Action etc. * Moved mergeback into proj folder. * `enum ID` is now `enum class Type`. --- fluid/widgets/Bin_Button.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'fluid/widgets/Bin_Button.cxx') diff --git a/fluid/widgets/Bin_Button.cxx b/fluid/widgets/Bin_Button.cxx index 308d12234..32630369a 100644 --- a/fluid/widgets/Bin_Button.cxx +++ b/fluid/widgets/Bin_Button.cxx @@ -16,9 +16,9 @@ #include "widgets/Bin_Button.h" -#include "app/fluid.h" +#include "Fluid.h" #include "nodes/factory.h" -#include "nodes/Fl_Window_Type.h" +#include "nodes/Window_Node.h" #include "widgets/Node_Browser.h" #include @@ -57,7 +57,7 @@ int fld::widget::Bin_Button::handle(int inEvent) 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; + Fluid.proj.tree.current_dnd = Fluid.proj.tree.current; Fl::copy(type_name, (int)strlen(type_name)+1, 0); Fl::dnd(); return 1; @@ -81,7 +81,7 @@ int fld::widget::Bin_Button::handle(int inEvent) */ int fld::widget::Bin_Window_Button::handle(int inEvent) { - static Fl_Window *drag_win = NULL; + static Fl_Window *drag_win = nullptr; int ret = 0; switch (inEvent) { case FL_PUSH: @@ -107,18 +107,18 @@ int fld::widget::Bin_Window_Button::handle(int inEvent) case FL_RELEASE: if (drag_win) { Fl::delete_widget(drag_win); - drag_win = NULL; + drag_win = nullptr; // create a new window here - Fl_Type *prototype = typename_to_prototype((char*)user_data()); + Node *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; + Node *new_type = add_new_widget_from_user(prototype, Strategy::AFTER_CURRENT); + if (new_type && new_type->is_a(Type::Window)) { + Window_Node *new_window = (Window_Node*)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->display(Fluid.proj.tree.current); widget_browser->rebuild(); } return Fl_Button::handle(inEvent); -- cgit v1.2.3