diff --git a/fluid/CMakeLists.txt b/fluid/CMakeLists.txt index b9065616bf..eee9f0e051 100644 --- a/fluid/CMakeLists.txt +++ b/fluid/CMakeLists.txt @@ -23,6 +23,7 @@ set(TARGETS fluid) # program fluid properly set(CPPFILES + application/application.cxx CodeEditor.cxx StyleParse.cxx Fd_Snap_Action.cxx @@ -58,6 +59,7 @@ set(CPPFILES # List header files in Apple's Xcode IDE set(HEADERFILES + application/application.h CodeEditor.h Fd_Snap_Action.h Fl_Function_Type.h @@ -140,6 +142,8 @@ else() endif() target_link_libraries(fluid PRIVATE fluid-lib) +target_include_directories(fluid-lib PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(fluid PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) # Build the console app on Windows # This is done for all Windows targets, even if cross-compiling. diff --git a/fluid/ExternalCodeEditor_UNIX.cxx b/fluid/ExternalCodeEditor_UNIX.cxx index 867778503d..bdfda4a412 100644 --- a/fluid/ExternalCodeEditor_UNIX.cxx +++ b/fluid/ExternalCodeEditor_UNIX.cxx @@ -6,6 +6,7 @@ #include "ExternalCodeEditor_UNIX.h" #include "fluid.h" +#include "application/application.h" #include /* Fl_Timeout_Handler.. */ #include /* fl_alert() */ diff --git a/fluid/ExternalCodeEditor_WIN32.cxx b/fluid/ExternalCodeEditor_WIN32.cxx index 157ebeb991..66f96e8419 100644 --- a/fluid/ExternalCodeEditor_WIN32.cxx +++ b/fluid/ExternalCodeEditor_WIN32.cxx @@ -23,6 +23,7 @@ #include "ExternalCodeEditor_WIN32.h" #include "fluid.h" +#include "application/application.h" #include // snprintf() #include diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index 0f1d6fe2c8..a78a706d3b 100644 --- a/fluid/Fl_Function_Type.cxx +++ b/fluid/Fl_Function_Type.cxx @@ -17,6 +17,7 @@ #include "Fl_Function_Type.h" #include "fluid.h" +#include "application/application.h" #include "Fl_Window_Type.h" #include "Fl_Group_Type.h" #include "widget_browser.h" diff --git a/fluid/Fl_Grid_Type.cxx b/fluid/Fl_Grid_Type.cxx index 4a7e792967..8432ea106a 100644 --- a/fluid/Fl_Grid_Type.cxx +++ b/fluid/Fl_Grid_Type.cxx @@ -17,6 +17,7 @@ #include "Fl_Grid_Type.h" #include "fluid.h" +#include "application/application.h" #include "file.h" #include "code.h" #include "widget_browser.h" diff --git a/fluid/Fl_Group_Type.cxx b/fluid/Fl_Group_Type.cxx index 0790c0936f..e3a55bd827 100644 --- a/fluid/Fl_Group_Type.cxx +++ b/fluid/Fl_Group_Type.cxx @@ -21,6 +21,7 @@ #include "Fl_Group_Type.h" #include "fluid.h" +#include "application/application.h" #include "file.h" #include "code.h" #include "widget_browser.h" diff --git a/fluid/Fl_Type.cxx b/fluid/Fl_Type.cxx index cbc7f57c4b..2ec8864bbc 100644 --- a/fluid/Fl_Type.cxx +++ b/fluid/Fl_Type.cxx @@ -382,7 +382,7 @@ static void delete_children(Fl_Type *p) { /** Delete all nodes in the Types tree and reset project settings, or delete selected nodes. Also calls the browser to refresh. - \note Please refactor this into two separate methods of FLUID::Project. + \note Please refactor this into two separate methods of fluid::Project. \param[in] selected_only if set, delete only the selected widgets and don't reset the project. */ diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx index 2a5073cfea..7541ac30a8 100644 --- a/fluid/Fl_Window_Type.cxx +++ b/fluid/Fl_Window_Type.cxx @@ -24,6 +24,7 @@ #include "Fl_Window_Type.h" +#include "application/application.h" #include "Fl_Group_Type.h" #include "Fl_Grid_Type.h" #include "fluid.h" diff --git a/fluid/Fluid_Image.cxx b/fluid/Fluid_Image.cxx index 41375dadd5..7285efe5db 100644 --- a/fluid/Fluid_Image.cxx +++ b/fluid/Fluid_Image.cxx @@ -17,6 +17,7 @@ #include "Fluid_Image.h" #include "fluid.h" +#include "application/application.h" #include "Fl_Group_Type.h" #include "Fl_Window_Type.h" #include "file.h" diff --git a/fluid/application/application.cxx b/fluid/application/application.cxx new file mode 100644 index 0000000000..2c0c511165 --- /dev/null +++ b/fluid/application/application.cxx @@ -0,0 +1,58 @@ +// +// Application Class for Fast Light User Interface Designer (FLUID). +// +// Copyright 1998-2024 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 "application/application.h" + +#include "fluid.h" +#include "widget_browser.h" + +extern bool confirm_project_clear(); + +/** + Clear the current project and create a new, empty one. + + If the current project was modified, FLUID will give the user the opportunity + to save the old project first. + + \param[in] user_must_confirm if set, a confimation dialog is presented to the + user before resetting the project. Default is `true`. + \return false if the operation was canceled + */ +bool fluid::Application::new_project(bool user_must_confirm) { + // verify user intention + if ((user_must_confirm) && (confirm_project_clear() == false)) + return false; + + // clear the current project + project().reset(); + set_filename(NULL); + set_modflag(0, 0); + widget_browser->rebuild(); + project().update_settings_dialog(); + + // all is clear to continue + return true; +} + +/** + * Return a reference to the current project. + */ +fluid::Project &fluid::Application::project() +{ + return g_project; +} + diff --git a/fluid/application/application.h b/fluid/application/application.h new file mode 100644 index 0000000000..4307c062e6 --- /dev/null +++ b/fluid/application/application.h @@ -0,0 +1,47 @@ +// +// Application Class for Fast Light User Interface Designer (FLUID). +// +// Copyright 1998-2024 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_APPLICATION_APPLICATION_H +#define FLUID_APPLICATION_APPLICATION_H + +#include "fluid.h" + +#include + +namespace fluid { + +class Application { +public: + /// Command line arguments. + App_Args args; + /// Application settings. + App_Settings settings; + /// Application history. + App_History history; + /// Set if the application is not in interactive mode. + bool batch_mode { false }; + /// current directory path at application launch + Fl_String launch_path { }; + + /// Clear the current project and create a new, empty one. + bool new_project(bool user_must_confirm = true); + /// Get the current project. + Project &project(); +}; + +}; // namespace FLUID + +#endif // FLUID_APPLICATION_APPLICATION_H diff --git a/fluid/autodoc.cxx b/fluid/autodoc.cxx index d711443a70..05cdf4d778 100644 --- a/fluid/autodoc.cxx +++ b/fluid/autodoc.cxx @@ -18,6 +18,7 @@ #include "autodoc.h" #include "fluid.h" +#include "application/application.h" #include "factory.h" #include "widget_browser.h" #include "widget_panel.h" diff --git a/fluid/code.cxx b/fluid/code.cxx index 75050eba21..bae1cf9f47 100644 --- a/fluid/code.cxx +++ b/fluid/code.cxx @@ -955,7 +955,7 @@ void Fd_Code_Writer::write_public(int state) { /** Create and initialize a new C++ source code writer. */ -Fd_Code_Writer::Fd_Code_Writer(FLUID::Project &project) +Fd_Code_Writer::Fd_Code_Writer(fluid::Project &project) : project_(project), code_file(NULL), header_file(NULL), diff --git a/fluid/code.h b/fluid/code.h index db80e4a210..ff6ab25e23 100644 --- a/fluid/code.h +++ b/fluid/code.h @@ -37,7 +37,7 @@ class Fd_Code_Writer { protected: /// Reference to the project that will be written. - FLUID::Project &project_; + fluid::Project &project_; /// file pointer for the C++ code file FILE *code_file; /// file pointer for the C++ header file @@ -81,9 +81,9 @@ class Fd_Code_Writer int varused; public: - Fd_Code_Writer(FLUID::Project &project); + Fd_Code_Writer(fluid::Project &project); ~Fd_Code_Writer(); - FLUID::Project &project() { return project_; } + fluid::Project &project() { return project_; } const char* unique_id(void* o, const char*, const char*, const char*); /// Increment source code indentation level. void indent_more() { indentation++; } diff --git a/fluid/factory.cxx b/fluid/factory.cxx index 84838b32e0..64d15b5eeb 100644 --- a/fluid/factory.cxx +++ b/fluid/factory.cxx @@ -25,6 +25,7 @@ #include "factory.h" #include "fluid.h" +#include "application/application.h" #include "Fl_Group_Type.h" #include "Fl_Grid_Type.h" #include "Fl_Menu_Type.h" diff --git a/fluid/file.cxx b/fluid/file.cxx index c3882786c3..d818370404 100644 --- a/fluid/file.cxx +++ b/fluid/file.cxx @@ -114,7 +114,7 @@ void Fd_Project_Reader::expand_buffer(int length) { } /** \brief Construct local project reader. */ -Fd_Project_Reader::Fd_Project_Reader(FLUID::Project &project) +Fd_Project_Reader::Fd_Project_Reader(fluid::Project &project) : project_(project), fin(NULL), lineno(0), @@ -785,7 +785,7 @@ void Fd_Project_Reader::read_fdesign() { // ---- Fd_Project_Writer ---------------------------------------------- MARK: - /** \brief Construct local project writer. */ -Fd_Project_Writer::Fd_Project_Writer(FLUID::Project &project) +Fd_Project_Writer::Fd_Project_Writer(fluid::Project &project) : project_(project), fout(NULL), needspace(0), diff --git a/fluid/file.h b/fluid/file.h index 0888b45ca2..34161cedf6 100644 --- a/fluid/file.h +++ b/fluid/file.h @@ -34,7 +34,7 @@ class Fd_Project_Reader { protected: /// Reference to the project that will be read. - FLUID::Project &project_; + fluid::Project &project_; /// Project input file FILE *fin; /// Number of most recently read line @@ -55,9 +55,9 @@ class Fd_Project_Reader double read_version; public: - Fd_Project_Reader(FLUID::Project &project); + Fd_Project_Reader(fluid::Project &project); ~Fd_Project_Reader(); - FLUID::Project &project() const { return project_; } + fluid::Project &project() const { return project_; } int open_read(const char *s); int close_read(); const char *filename_name(); @@ -75,7 +75,7 @@ class Fd_Project_Writer { protected: /// Reference to the project that will be written. - FLUID::Project &project_; + fluid::Project &project_; // Project output file, always opened in "wb" mode FILE *fout; /// If set, one space is written before text unless the format starts with a newline character @@ -84,9 +84,9 @@ class Fd_Project_Writer bool write_codeview_; public: - Fd_Project_Writer(FLUID::Project &project); + Fd_Project_Writer(fluid::Project &project); ~Fd_Project_Writer(); - FLUID::Project &project() const { return project_; } + fluid::Project &project() const { return project_; } int open_write(const char *s); int close_write(); int write_project(const char *filename, int selected_only, bool codeview); diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index f7f3daa20d..f8b2f987c2 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -16,6 +16,7 @@ #include "fluid.h" +#include "application/application.h" #include "Fl_Type.h" #include "Fl_Function_Type.h" #include "Fl_Group_Type.h" @@ -138,15 +139,15 @@ static int ipasteoffset = 0; // ---- project settings /// The current project, possibly a new, empty roject -FLUID::Project g_project; +fluid::Project g_project; /// Global reference to FLUID application -FLUID::App Fluid; +fluid::Application Fluid; /** Reset all project setting to create a new empty project. */ -void FLUID::Project::reset() { +void fluid::Project::reset() { ::delete_all(); i18n_type = Fd_I18n_Type::NONE; @@ -174,7 +175,7 @@ void FLUID::Project::reset() { /** Tell the project and i18n tab of the settings dialog to refresh themselves. */ -void FLUID::Project::update_settings_dialog() { +void fluid::Project::update_settings_dialog() { if (settings_window) { w_settings_project_tab->do_callback(w_settings_project_tab, LOAD); w_settings_i18n_tab->do_callback(w_settings_i18n_tab, LOAD); @@ -326,7 +327,7 @@ bool confirm_project_clear() { case 0 : /* Cancel */ return false; case 1 : /* Save */ - FLUID::Callbacks::save(NULL, NULL); + fluid::Callbacks::save(NULL, NULL); if (modflag) return false; // user canceled the "Save As" dialog } return true; @@ -514,7 +515,7 @@ static void external_editor_timer(void*) { \param[in] v v is (void *)1 for "Save As...", and (void *)2 for "Save a Copy..." */ -void FLUID::Callbacks::save(Fl_Widget *, void *v) { +void fluid::Callbacks::save(Fl_Widget *, void *v) { Fluid.project().save(v != NULL, v != (void *)2); } @@ -536,7 +537,7 @@ void FLUID::Callbacks::save(Fl_Widget *, void *v) { \param[in] ask_for_filename if true, open a filechooser and warn if file exists. \param[in] update_filename if true, update filename and modification flags */ -void FLUID::Project::save(bool ask_for_filename, bool update_filename) { +void fluid::Project::save(bool ask_for_filename, bool update_filename) { flush_text_widgets(); Fl_Native_File_Chooser fnfc; const char *c = filename; @@ -765,41 +766,6 @@ void exit_cb(Fl_Widget *,void *) { exit(0); } -/** - Clear the current project and create a new, empty one. - - If the current project was modified, FLUID will give the user the opportunity - to save the old project first. - - \param[in] user_must_confirm if set, a confimation dialog is presented to the - user before resetting the project. Default is `true`. - \return false if the operation was canceled - */ -bool FLUID::App::new_project(bool user_must_confirm) { - // verify user intention - if ((user_must_confirm) && (confirm_project_clear() == false)) - return false; - - // clear the current project - project().reset(); - set_filename(NULL); - set_modflag(0, 0); - widget_browser->rebuild(); - project().update_settings_dialog(); - - // all is clear to continue - return true; -} - -/** - * Return a reference to the current project. - */ -FLUID::Project &FLUID::App::project() -{ - return g_project; -} - - /** Open the template browser and load a new file from templates. @@ -1032,7 +998,7 @@ void apple_open_cb(const char *c) { Get the absolute path of the project file, for example `/Users/matt/dev/`. \return the path ending in '/' */ -Fl_String FLUID::Project::projectfile_path() const { +Fl_String fluid::Project::projectfile_path() const { return end_with_slash(fl_filename_absolute(fl_filename_path(filename), Fluid.launch_path)); } @@ -1040,7 +1006,7 @@ Fl_String FLUID::Project::projectfile_path() const { Get the project file name including extension, for example `test.fl`. \return the file name without path */ -Fl_String FLUID::Project::projectfile_name() const { +Fl_String fluid::Project::projectfile_name() const { return fl_filename_name(filename); } @@ -1048,7 +1014,7 @@ Fl_String FLUID::Project::projectfile_name() const { Get the absolute path of the generated C++ code file, for example `/Users/matt/dev/src/`. \return the path ending in '/' */ -Fl_String FLUID::Project::codefile_path() const { +Fl_String fluid::Project::codefile_path() const { Fl_String path = fl_filename_path(code_file_name); if (Fluid.batch_mode) return end_with_slash(fl_filename_absolute(path, Fluid.launch_path)); @@ -1060,7 +1026,7 @@ Fl_String FLUID::Project::codefile_path() const { Get the generated C++ code file name including extension, for example `test.cxx`. \return the file name without path */ -Fl_String FLUID::Project::codefile_name() const { +Fl_String fluid::Project::codefile_name() const { Fl_String name = fl_filename_name(code_file_name); if (name.empty()) { return fl_filename_setext(fl_filename_name(filename), ".cxx"); @@ -1075,7 +1041,7 @@ Fl_String FLUID::Project::codefile_name() const { Get the absolute path of the generated C++ header file, for example `/Users/matt/dev/src/`. \return the path ending in '/' */ -Fl_String FLUID::Project::headerfile_path() const { +Fl_String fluid::Project::headerfile_path() const { Fl_String path = fl_filename_path(header_file_name); if (Fluid.batch_mode) return end_with_slash(fl_filename_absolute(path, Fluid.launch_path)); @@ -1087,7 +1053,7 @@ Fl_String FLUID::Project::headerfile_path() const { Get the generated C++ header file name including extension, for example `test.cxx`. \return the file name without path */ -Fl_String FLUID::Project::headerfile_name() const { +Fl_String fluid::Project::headerfile_name() const { Fl_String name = fl_filename_name(header_file_name); if (name.empty()) { return fl_filename_setext(fl_filename_name(filename), ".h"); @@ -1106,7 +1072,7 @@ Fl_String FLUID::Project::headerfile_name() const { batch mode. \return the path ending in '/' */ -Fl_String FLUID::Project::stringsfile_path() const { +Fl_String fluid::Project::stringsfile_path() const { if (Fluid.batch_mode) return Fluid.launch_path; else @@ -1117,7 +1083,7 @@ Fl_String FLUID::Project::stringsfile_path() const { Get the generated i18n text file name including extension, for example `test.po`. \return the file name without path */ -Fl_String FLUID::Project::stringsfile_name() const { +Fl_String fluid::Project::stringsfile_name() const { switch (i18n_type) { default: return fl_filename_setext(fl_filename_name(filename), ".txt"); case Fd_I18n_Type::GNU: return fl_filename_setext(fl_filename_name(filename), ".po"); @@ -1129,7 +1095,7 @@ Fl_String FLUID::Project::stringsfile_name() const { Get the name of the project file without the filename extension. \return the file name without path or extension */ -Fl_String FLUID::Project::basename() const { +Fl_String fluid::Project::basename() const { return fl_filename_setext(fl_filename_name(filename), ""); } @@ -1153,12 +1119,12 @@ Fl_String FLUID::Project::basename() const { \param[in] dont_show_completion_dialog don't show the completion dialog \return 1 if the operation failed, 0 if it succeeded */ -int FLUID::Project::write_code_files(bool dont_show_completion_dialog) +int fluid::Project::write_code_files(bool dont_show_completion_dialog) { // -- handle user interface issues flush_text_widgets(); if (!filename) { - FLUID::Callbacks::save(0,0); + fluid::Callbacks::save(0,0); if (!filename) return 1; } @@ -1260,7 +1226,7 @@ void mergeback_cb(Fl_Widget *, void *) { void write_strings_cb(Fl_Widget *, void *) { flush_text_widgets(); if (!filename) { - FLUID::Callbacks::save(0,0); + fluid::Callbacks::save(0,0); if (!filename) return; } Fl_String filename = g_project.stringsfile_path() + g_project.stringsfile_name(); @@ -1626,9 +1592,9 @@ Fl_Menu_Item Main_Menu[] = { {"&New", FL_COMMAND+'n', menu_file_new_cb}, {"&Open...", FL_COMMAND+'o', menu_file_open_cb}, {"&Insert...", FL_COMMAND+'i', menu_file_insert_cb, 0, FL_MENU_DIVIDER}, - {"&Save", FL_COMMAND+'s', FLUID::Callbacks::save, 0}, - {"Save &As...", FL_COMMAND+FL_SHIFT+'s', FLUID::Callbacks::save, (void*)1}, - {"Sa&ve A Copy...", 0, FLUID::Callbacks::save, (void*)2}, + {"&Save", FL_COMMAND+'s', fluid::Callbacks::save, 0}, + {"Save &As...", FL_COMMAND+FL_SHIFT+'s', fluid::Callbacks::save, (void*)1}, + {"Sa&ve A Copy...", 0, fluid::Callbacks::save, (void*)2}, {"&Revert...", 0, revert_cb, 0, FL_MENU_DIVIDER}, {"New &From Template...", FL_COMMAND+'N', menu_file_new_from_template_cb, 0}, {"Save As &Template...", 0, save_template_cb, 0, FL_MENU_DIVIDER}, @@ -1851,7 +1817,7 @@ void make_main_window() { main_menubar = new Fl_Menu_Bar(0,0,BROWSERWIDTH,MENUHEIGHT); main_menubar->menu(Main_Menu); // quick access to all dynamic menu items - save_item = (Fl_Menu_Item*)main_menubar->find_item(FLUID::Callbacks::save); + save_item = (Fl_Menu_Item*)main_menubar->find_item(fluid::Callbacks::save); history_item = (Fl_Menu_Item*)main_menubar->find_item(menu_file_open_history_cb); widgetbin_item = (Fl_Menu_Item*)main_menubar->find_item(toggle_widgetbin_cb); codeview_item = (Fl_Menu_Item*)main_menubar->find_item((Fl_Callback*)toggle_codeview_cb); @@ -1872,19 +1838,19 @@ void make_main_window() { } // File history info... -char FLUID::App_History::full_path[10][FL_PATH_MAX]; -char FLUID::App_History::short_path[10][FL_PATH_MAX]; +char fluid::App_History::full_path[10][FL_PATH_MAX]; +char fluid::App_History::short_path[10][FL_PATH_MAX]; /** Load project file history from preferences. - This C++ function, FLUID::App_History::load(), loads the last 10 used + This C++ function, fluid::App_History::load(), loads the last 10 used .fl project files' absolute and relative paths from the application preferences and updates the main menu accordingly. It ensures the history list is limited to 10 files and handles empty or non-existent file paths. */ -void FLUID::App_History::load() { +void fluid::App_History::load() { int i; // Looping var int max_files; @@ -1913,7 +1879,7 @@ void FLUID::App_History::load() { /** Add a file to the project file history. - This C++ function, FLUID::App_History::add, adds a new file path to the + This C++ function, fluid::App_History::add, adds a new file path to the application's file history, which is stored in the application's preferences. The function ensures that the history is limited to a maximum of 10 files, @@ -1923,7 +1889,7 @@ void FLUID::App_History::load() { \param[in] flname path or filename of .fl file, will be converted into an absolute file path based on the current working directory. */ -void FLUID::App_History::add(const char *flname) { +void fluid::App_History::add(const char *flname) { int i; // Looping var char absolute[FL_PATH_MAX]; int max_files; @@ -2053,7 +2019,7 @@ void set_modflag(int mf, int mfc) { \param[inout] i current argument index \return number of arguments used; if 0, the argument is not supported */ -int FLUID::App_Args::arg(int argc, char** argv, int& i) { +int fluid::App_Args::arg(int argc, char** argv, int& i) { if (argv[i][0] != '-') return 0; if (argv[i][1] == 'd' && !argv[i][2]) { @@ -2103,7 +2069,7 @@ int FLUID::App_Args::arg(int argc, char** argv, int& i) { /** * Parses the command line arguments and sets the appropriate flags in the - * FLUID::App_Args object. If an unsupported argument is found, or if the + * fluid::App_Args object. If an unsupported argument is found, or if the * number of arguments is incorrect, prints an error message and returns false. * Otherwise, returns true. * @@ -2112,7 +2078,7 @@ int FLUID::App_Args::arg(int argc, char** argv, int& i) { * \return -1 if there was an error in the command line * or the index of the .fl project file */ -int FLUID::App_Args::read(int argc, char **argv) { +int fluid::App_Args::read(int argc, char **argv) { Fl::args_to_utf8(argc, argv); // for MSYS2/MinGW int i = 1; if ( (Fl::args(argc, argv, i, arg) == 0) // unsupported argument found diff --git a/fluid/fluid.h b/fluid/fluid.h index 4ecd743acc..eb736336fa 100644 --- a/fluid/fluid.h +++ b/fluid/fluid.h @@ -85,7 +85,9 @@ enum class Fd_I18n_Type { POSIX ///< Posix catgets internationalization }; -namespace FLUID { +namespace fluid { + +class Application; /** Data and settings for a FLUID project file. @@ -213,30 +215,10 @@ class Callbacks { static void save(Fl_Widget *, void *v); }; -class App { -public: - /// Command line arguments. - App_Args args; - /// Application settings. - App_Settings settings; - /// Application history. - App_History history; - /// Set if the application is running from the command line and not in interactive mode. - bool batch_mode { false }; - /// current directory path at application launch - Fl_String launch_path { }; - - /// Clear the current project and create a new, empty one. - bool new_project(bool user_must_confirm = true); - /// Get the current project. - Project &project(); -}; - - }; // namespace FLUID -extern FLUID::Project g_project; -extern FLUID::App Fluid; +extern fluid::Project g_project; +extern fluid::Application Fluid; // ---- public functions diff --git a/fluid/settings_panel.cxx b/fluid/settings_panel.cxx index 889a353406..b353c35650 100644 --- a/fluid/settings_panel.cxx +++ b/fluid/settings_panel.cxx @@ -17,6 +17,7 @@ // generated by Fast Light User Interface Designer (fluid) version 1.0400 #include "settings_panel.h" +#include "application/application.h" #include "undo.h" #include #include diff --git a/fluid/settings_panel.fl b/fluid/settings_panel.fl index 0f452a8e8d..bf63bd2fb2 100644 --- a/fluid/settings_panel.fl +++ b/fluid/settings_panel.fl @@ -52,6 +52,9 @@ comment {// decl {\#include "fluid.h"} {public global } +decl {\#include "application/application.h"} {public global +} + decl {\#include "undo.h"} {private global } diff --git a/fluid/shell_command.cxx b/fluid/shell_command.cxx index f12596ecb3..4f7b111c2e 100644 --- a/fluid/shell_command.cxx +++ b/fluid/shell_command.cxx @@ -304,7 +304,7 @@ static bool prepare_shell_command(int flags) { return false; } if (flags & Fd_Shell_Command::SAVE_PROJECT) { - FLUID::Callbacks::save(0, 0); + fluid::Callbacks::save(0, 0); } if (flags & Fd_Shell_Command::SAVE_SOURCECODE) { g_project.write_code_files(true); diff --git a/fluid/widget_browser.cxx b/fluid/widget_browser.cxx index e5311db074..b8b968f4a2 100644 --- a/fluid/widget_browser.cxx +++ b/fluid/widget_browser.cxx @@ -17,6 +17,7 @@ #include "widget_browser.h" #include "fluid.h" +#include "application/application.h" #include "Fl_Widget_Type.h" #include "pixmaps.h"