summaryrefslogtreecommitdiff
path: root/fluid/Fluid.h
diff options
context:
space:
mode:
authormaxim nikonov <maxim.nikonov@hqo.co>2026-02-06 02:33:41 +0500
committermaxim nikonov <maxim.nikonov@hqo.co>2026-02-06 02:33:41 +0500
commit43e0a37906afabb0b3b091b8d3eac9a910cae50c (patch)
treed2a037c2bf0dc395fddb08e32ebfcf2795503b7c /fluid/Fluid.h
parent4ce4967c33d56e4b56d85d11fe0e0be91e159f5d (diff)
wip
Diffstat (limited to 'fluid/Fluid.h')
-rw-r--r--fluid/Fluid.h87
1 files changed, 42 insertions, 45 deletions
diff --git a/fluid/Fluid.h b/fluid/Fluid.h
index 1498760e3..4e5a053a4 100644
--- a/fluid/Fluid.h
+++ b/fluid/Fluid.h
@@ -27,8 +27,6 @@
#include <FL/Fl_Menu_Item.H>
#include <FL/filename.H>
-#include <string>
-
#define FLD_BROWSERWIDTH 300
#define FLD_BROWSERHEIGHT 500
#define FLD_WINWIDTH 300
@@ -58,13 +56,13 @@ class Project;
class Application {
/// Currently selected project.
- Project *current_project_ = new Project();
+ Project *current_project_;
/// Working directory at application launch.
- std::string launch_path_;
+ char launch_path_[FL_PATH_MAX];
/// Path to store temporary files during app run.
- std::string tmpdir_path;
+ char tmpdir_path_[FL_PATH_MAX];
/// True if the temporary file path was already created.
- bool tmpdir_create_called = false;
+ int tmpdir_create_called;
// Generate a path to a directory for temporary data storage.
void create_tmpdir();
// Delete the temporary directory and all its contents.
@@ -78,85 +76,84 @@ public: // Member Variables
/// Command line arguments
app::Args args;
/// List of available layouts
- app::Layout_List layout_list;
+ app::Layout_List *layout_list;
/// Set, if Fluid runs in batch mode, and no user interface is activated.
- int batch_mode { 0 }; // fluid + any code generators (-u, -c, -cs)
+ int batch_mode;
// TODO: make this into a class: app::Settings
/// Show guides in the design window when positioning widgets, saved in app preferences.
- int show_guides { 1 };
+ int show_guides;
/// Show areas of restricted use in overlay plane.
/// Restricted areas are widget that overlap each other, widgets that are outside
/// of their parent's bounds (except children of Scroll groups), and areas
/// within an Fl_Tile that are not covered by children.
- int show_restricted { 1 };
+ int show_restricted;
/// Show a ghosted outline for groups that have very little contrast.
/// This makes groups with NO_BOX or FLAT_BOX better editable.
- int show_ghosted_outline { 1 };
+ int show_ghosted_outline;
/// Show widget comments in the browser, saved in app preferences.
- int show_comments { 1 };
+ int show_comments;
// TODO: make this into a class: app::External_Editor
/// Use external editor for editing Code_Node, saved in app preferences.
- int use_external_editor { 0 };
+ int use_external_editor;
/// Debugging help for external Code_Node editor.
- int debug_external_editor { 0 };
+ int debug_external_editor;
/// Run this command to load an Code_Node into an external editor, save in app preferences.
- // TODO: make this into a std::string
- char external_editor_command[512] { };
+ char external_editor_command[512];
// TODO: make this into a class: app::GUI
- Fl_Window *main_window { nullptr };
+ Fl_Window *main_window;
static Fl_Menu_Item main_menu[];
- fld::widget::App_Menu_Bar *main_menubar { nullptr };
- Fl_Menu_Item *save_item { nullptr };
- Fl_Menu_Item *history_item { nullptr };
- Fl_Menu_Item *widgetbin_item { nullptr };
- Fl_Menu_Item *codeview_item { nullptr };
- Fl_Menu_Item *overlay_item { nullptr };
- Fl_Button *overlay_button { nullptr };
- Fl_Menu_Item *guides_item { nullptr };
- Fl_Menu_Item *restricted_item { nullptr };
+ fld::widget::App_Menu_Bar *main_menubar;
+ Fl_Menu_Item *save_item;
+ Fl_Menu_Item *history_item;
+ Fl_Menu_Item *widgetbin_item;
+ Fl_Menu_Item *codeview_item;
+ Fl_Menu_Item *overlay_item;
+ Fl_Button *overlay_button;
+ Fl_Menu_Item *guides_item;
+ Fl_Menu_Item *restricted_item;
/// Offset in pixels when adding widgets from an .fl file.
- int pasteoffset { 0 };
- int ipasteoffset { 0 };
+ int pasteoffset;
+ int ipasteoffset;
/// FLUID-wide help dialog.
- Fl_Help_Dialog *help_dialog { nullptr };
+ Fl_Help_Dialog *help_dialog;
public: // Methods
// Create the Fluid application.
Application();
/// Destructor.
- ~Application() = default;
+ ~Application();
// Launch the application.
- int run(int argc,char **argv);
+ int run(int argc, char **argv);
// Quit the application and clean up.
void quit();
- /// Quick access to the current project. Make sure it stays synched to current_project_.
- Project &proj { *current_project_ };
+ /// Quick access to the current project.
+ Project &proj;
// Return the working directory path at application launch.
- const std::string &launch_path() const;
+ const char *launch_path() const;
// Return the path to a temporary directory for this instance of Fluid.
- const std::string &get_tmpdir();
+ const char *get_tmpdir();
// Return the path and filename of a temporary file for cut or duplicated data.
const char *cutfname(int which = 0);
// Clear the current project and create a new, empty one.
- bool new_project(bool user_must_confirm = true);
+ int new_project(int user_must_confirm = 1);
// Open a file chooser and load an exiting project file.
- bool open_project_file(const std::string &filename_arg);
+ int open_project_file(const char *filename_arg);
// Load a project from the give file name and path.
- bool merge_project_file(const std::string &filename_arg);
+ int merge_project_file(const char *filename_arg);
// Save the current design to the file given by \c filename.
void save_project_file(void *arg);
// Reload the file set by \c filename, replacing the current design.
void revert_project();
// Open the template browser and load a new file from templates.
- bool new_project_from_template();
+ int new_project_from_template();
// Open the dialog to allow the user to print the current window.
void print_snapshots();
// Generate the C++ source and header filenames and write those files.
- int write_code_files(bool dont_show_completion_dialog=false);
+ int write_code_files(int dont_show_completion_dialog = 0);
// User chose to cut the currently selected widgets.
void cut_selected();
@@ -182,13 +179,14 @@ public: // Methods
// Build the main app window and create a few other dialogs.
void make_main_window();
// Open a native file chooser to allow choosing a project file for reading.
- std::string open_project_filechooser(const std::string &title);
+ // Returns path in provided buffer, or empty string if cancelled.
+ void open_project_filechooser(char *result, int result_size, const char *title);
// Give the user the opportunity to save a project before clearing it.
- bool confirm_project_clear();
+ int confirm_project_clear();
// Ensure that text widgets in the widget panel propagates apply current changes.
void flush_text_widgets();
// Position the given window window based on entries in the app preferences.
- char position_window(Fl_Window *w, const char *prefsName, int Visible, int X, int Y, int W=0, int H=0);
+ char position_window(Fl_Window *w, const char *prefsName, int Visible, int X, int Y, int W = 0, int H = 0);
// Save the position and visibility state of a window to the app preferences.
void save_position(Fl_Window *w, const char *prefsName);
// Change the app's and hence preview the design's scheme.
@@ -198,7 +196,7 @@ public: // Methods
#ifdef __APPLE__
static void apple_open_cb(const char *c);
-#endif // __APPLE__
+#endif
};
} // namespace fld
@@ -207,4 +205,3 @@ extern fld::Application Fluid;
#endif // FLUID_FLUID_H
-