diff options
| author | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-05 23:48:25 +0500 |
|---|---|---|
| committer | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-05 23:48:25 +0500 |
| commit | c53067d2f6cfd6e3c6b476c51ab8c4b931e40a30 (patch) | |
| tree | 95bfab59b2d9a38a57b6aa05244cab2d0435c7d2 /fluid/app | |
| parent | 57860e277f2298ad6c0830b1492087cfa124c862 (diff) | |
wip
Diffstat (limited to 'fluid/app')
| -rw-r--r-- | fluid/app/Snap_Action.cxx | 42 | ||||
| -rw-r--r-- | fluid/app/Snap_Action.h | 4 | ||||
| -rw-r--r-- | fluid/app/shell_command.cxx | 20 | ||||
| -rw-r--r-- | fluid/app/shell_command.h | 2 | ||||
| -rw-r--r-- | fluid/app/templates.cxx | 2 |
5 files changed, 35 insertions, 35 deletions
diff --git a/fluid/app/Snap_Action.cxx b/fluid/app/Snap_Action.cxx index 08e9bf1e5..2ec7affad 100644 --- a/fluid/app/Snap_Action.cxx +++ b/fluid/app/Snap_Action.cxx @@ -105,8 +105,8 @@ static Layout_Preset grid_tool = { Layout_Preset *fld::app::default_layout_preset = &fltk_app; static Layout_Suite static_suite_list[] = { - { (char*)"FLTK", (char*)"@fd_beaker FLTK", { &fltk_app, &fltk_dlg, &fltk_tool }, fld::Tool_Store::INTERNAL }, - { (char*)"Grid", (char*)"@fd_beaker Grid", { &grid_app, &grid_dlg, &grid_tool }, fld::Tool_Store::INTERNAL } + { (char*)"FLTK", (char*)"@fd_beaker FLTK", { &fltk_app, &fltk_dlg, &fltk_tool }, FLD_TOOL_STORE_INTERNAL }, + { (char*)"Grid", (char*)"@fd_beaker Grid", { &grid_app, &grid_dlg, &grid_tool }, FLD_TOOL_STORE_INTERNAL } }; Fl_Menu_Item main_layout_submenu_[] = { @@ -403,10 +403,10 @@ void Layout_Suite::read(fld::io::Project_Reader *in) { void Layout_Suite::update_label() { std::string sym; switch (storage_) { - case fld::Tool_Store::INTERNAL: sym.assign("@fd_beaker "); break; - case fld::Tool_Store::USER: sym.assign("@fd_user "); break; - case fld::Tool_Store::PROJECT: sym.assign("@fd_project "); break; - case fld::Tool_Store::FILE: sym.assign("@fd_file "); break; + case FLD_TOOL_STORE_INTERNAL: sym.assign("@fd_beaker "); break; + case FLD_TOOL_STORE_USER: sym.assign("@fd_user "); break; + case FLD_TOOL_STORE_PROJECT: sym.assign("@fd_project "); break; + case FLD_TOOL_STORE_FILE: sym.assign("@fd_file "); break; } sym.append(name_); if (menu_label) @@ -436,14 +436,14 @@ void Layout_Suite::init() { name_ = nullptr; menu_label = nullptr; layout[0] = layout[1] = layout[2] = nullptr; - storage_ = fld::Tool_Store::INTERNAL; + storage_ = FLD_TOOL_STORE_INTERNAL; } /** Free all allocated resources. */ Layout_Suite::~Layout_Suite() { - if (storage_ == fld::Tool_Store::INTERNAL) return; + if (storage_ == FLD_TOOL_STORE_INTERNAL) return; if (name_) ::free(name_); for (int i = 0; i < 3; ++i) { delete layout[i]; @@ -619,7 +619,7 @@ Layout_List::~Layout_List() { ::free(choice_menu_); for (int i = 0; i < list_size_; i++) { Layout_Suite &suite = list_[i]; - if (suite.storage_ != fld::Tool_Store::INTERNAL) + if (suite.storage_ != FLD_TOOL_STORE_INTERNAL) suite.~Layout_Suite(); } ::free(list_); @@ -664,9 +664,9 @@ void Layout_List::update_menu_labels() { Load all user layouts from the FLUID user preferences. */ int Layout_List::load(const std::string &filename) { - remove_all(fld::Tool_Store::FILE); + remove_all(FLD_TOOL_STORE_FILE); Fl_Preferences prefs(filename.c_str(), "layout.fluid.fltk.org", nullptr, Fl_Preferences::C_LOCALE); - read(prefs, fld::Tool_Store::FILE); + read(prefs, FLD_TOOL_STORE_FILE); return 0; } @@ -677,7 +677,7 @@ int Layout_List::save(const std::string &filename) { assert(this); Fl_Preferences prefs(filename.c_str(), "layout.fluid.fltk.org", nullptr, (Fl_Preferences::Root)(Fl_Preferences::C_LOCALE|Fl_Preferences::CLEAR)); prefs.clear(); - write(prefs, fld::Tool_Store::FILE); + write(prefs, FLD_TOOL_STORE_FILE); return 0; } @@ -736,7 +736,7 @@ void Layout_List::write(fld::io::Project_Writer *out) { if ((current_suite()==0) && (current_preset()==0)) { int nSuite = 0; for (int i=0; i<list_size_; i++) { - if (list_[i].storage_ == fld::Tool_Store::PROJECT) nSuite++; + if (list_[i].storage_ == FLD_TOOL_STORE_PROJECT) nSuite++; } if (nSuite == 0) return; } @@ -745,7 +745,7 @@ void Layout_List::write(fld::io::Project_Writer *out) { out->write_string(" current_preset %d\n", current_preset()); for (int i=0; i<list_size_; i++) { Layout_Suite &suite = list_[i]; - if (suite.storage_ == fld::Tool_Store::PROJECT) + if (suite.storage_ == FLD_TOOL_STORE_PROJECT) suite.write(out); } out->write_string("}"); @@ -772,7 +772,7 @@ void Layout_List::read(fld::io::Project_Reader *in) { } else if (!strcmp(key, "suite")) { int n = add(in->filename_name()); list_[n].read(in); - list_[n].storage(fld::Tool_Store::PROJECT); + list_[n].storage(FLD_TOOL_STORE_PROJECT); } else if (!strcmp(key, "}")) { break; } else { @@ -878,8 +878,8 @@ int Layout_List::add(const char *name) { ::memcpy(new_suite.layout[i], old_suite.layout[i], sizeof(Layout_Preset)); } fld::Tool_Store new_storage = old_suite.storage_; - if (new_storage == fld::Tool_Store::INTERNAL) - new_storage = fld::Tool_Store::USER; + if (new_storage == FLD_TOOL_STORE_INTERNAL) + new_storage = FLD_TOOL_STORE_USER; new_suite.storage(new_storage); main_menu_[n].label(new_suite.menu_label); main_menu_[n].callback(main_menu_[0].callback()); @@ -920,7 +920,7 @@ void Layout_List::remove(int ix) { /** Remove all Suites that use the given storage attribute. - \param[in] storage storage attribute, see fld::Tool_Store::INTERNAL, etc. + \param[in] storage storage attribute, see FLD_TOOL_STORE_INTERNAL, etc. */ void Layout_List::remove_all(fld::Tool_Store storage) { for (int i=list_size_-1; i>=0; --i) { @@ -953,11 +953,11 @@ static bool in_window(Snap_Data &d) { } static bool in_group(Snap_Data &d) { - return (d.wgt && d.wgt->parent && d.wgt->parent->is_a(Type::Group) && d.wgt->parent != d.win); + return (d.wgt && d.wgt->parent && d.wgt->parent->is_a(FLD_NODE_TYPE_Group) && d.wgt->parent != d.win); } static bool in_tabs(Snap_Data &d) { - return (d.wgt && d.wgt->parent && d.wgt->parent->is_a(Type::Tabs)); + return (d.wgt && d.wgt->parent && d.wgt->parent->is_a(FLD_NODE_TYPE_Tabs)); } static Fl_Group *parent(Snap_Data &d) { @@ -1473,7 +1473,7 @@ public: clr(); best_match = nullptr; if (!d.wgt) return; - if (!d.wgt->parent->is_a(Type::Group)) return; + if (!d.wgt->parent->is_a(FLD_NODE_TYPE_Group)) return; int dsib_min = 1024; Group_Node *gt = (Group_Node*)d.wgt->parent; Fl_Group *g = (Fl_Group*)gt->o; diff --git a/fluid/app/Snap_Action.h b/fluid/app/Snap_Action.h index e5f4c998a..6bbe07bb8 100644 --- a/fluid/app/Snap_Action.h +++ b/fluid/app/Snap_Action.h @@ -17,6 +17,7 @@ #ifndef _FLUID_FD_SNAP_ACTION_H #define _FLUID_FD_SNAP_ACTION_H +#include "../fld_tool_store.h" #include <string> class Window_Node; @@ -27,7 +28,6 @@ class Fl_Preferences; extern Fl_Menu_Item main_layout_submenu_[]; namespace fld { -enum class Tool_Store; // fld:: namespace io { class Project_Reader; // fld::io:: class Project_Writer; // fld::io:: @@ -99,7 +99,7 @@ public: char *name_; ///< name of the suite char *menu_label; ///< label text used in pulldown menu Layout_Preset *layout[3]; ///< presets for application, dialog, and toolbox windows - fld::Tool_Store storage_; ///< storage location (see fld::Tool_Store::INTERNAL, etc.) + fld::Tool_Store storage_; ///< storage location (see FLD_TOOL_STORE_INTERNAL, etc.) void write(Fl_Preferences &prefs); void read(Fl_Preferences &prefs); void write(fld::io::Project_Writer*); diff --git a/fluid/app/shell_command.cxx b/fluid/app/shell_command.cxx index a4b664fda..05bc28ec0 100644 --- a/fluid/app/shell_command.cxx +++ b/fluid/app/shell_command.cxx @@ -426,7 +426,7 @@ void run_shell_command(const std::string &cmd, int flags) { */ Fd_Shell_Command::Fd_Shell_Command() : shortcut(0), - storage(fld::Tool_Store::USER), + storage(FLD_TOOL_STORE_USER), condition(0), flags(0), shell_menu_item_(nullptr) @@ -460,7 +460,7 @@ Fd_Shell_Command::Fd_Shell_Command(const std::string &in_name) : name(in_name), label(in_name), shortcut(0), - storage(fld::Tool_Store::USER), + storage(FLD_TOOL_STORE_USER), condition(Fd_Shell_Command::ALWAYS), command("echo \"Hello, FLUID!\""), flags(Fd_Shell_Command::SAVE_PROJECT|Fd_Shell_Command::SAVE_SOURCECODE), @@ -595,7 +595,7 @@ void Fd_Shell_Command::write(Fl_Preferences &prefs, bool save_location) { void Fd_Shell_Command::read(class fld::io::Project_Reader *in) { const char *c = in->read_word(1); if (strcmp(c, "{")!=0) return; // expecting start of group - storage = fld::Tool_Store::PROJECT; + storage = FLD_TOOL_STORE_PROJECT; for (;;) { c = in->read_word(1); if (strcmp(c, "}")==0) break; // end of command list @@ -696,7 +696,7 @@ void Fd_Shell_Command_List::read(Fl_Preferences &prefs, fld::Tool_Store storage) if (version == 0) { int save_fl, save_code, save_strings; Fd_Shell_Command *cmd = new Fd_Shell_Command(); - cmd->storage = fld::Tool_Store::USER; + cmd->storage = FLD_TOOL_STORE_USER; cmd->name = "Sample Shell Command"; cmd->label = "Sample Shell Command"; cmd->shortcut = FL_ALT+'g'; @@ -719,7 +719,7 @@ void Fd_Shell_Command_List::read(Fl_Preferences &prefs, fld::Tool_Store storage) for (int i=0; i<n; i++) { Fl_Preferences cmd_prefs(shell_commands, Fl_Preferences::Name(i)); Fd_Shell_Command *cmd = new Fd_Shell_Command(); - cmd->storage = fld::Tool_Store::USER; + cmd->storage = FLD_TOOL_STORE_USER; cmd->read(cmd_prefs); add(cmd); } @@ -733,7 +733,7 @@ void Fd_Shell_Command_List::write(Fl_Preferences &prefs, fld::Tool_Store storage shell_commands.delete_all_groups(); int index = 0; for (int i=0; i<list_size; i++) { - if (list[i]->storage == fld::Tool_Store::USER) { + if (list[i]->storage == FLD_TOOL_STORE_USER) { Fl_Preferences cmd(shell_commands, Fl_Preferences::Name(index++)); list[i]->write(cmd); } @@ -746,7 +746,7 @@ void Fd_Shell_Command_List::write(Fl_Preferences &prefs, fld::Tool_Store storage void Fd_Shell_Command_List::read(fld::io::Project_Reader *in) { const char *c = in->read_word(1); if (strcmp(c, "{")!=0) return; // expecting start of group - clear(fld::Tool_Store::PROJECT); + clear(FLD_TOOL_STORE_PROJECT); for (;;) { c = in->read_word(1); if (strcmp(c, "}")==0) break; // end of command list @@ -766,13 +766,13 @@ void Fd_Shell_Command_List::read(fld::io::Project_Reader *in) { void Fd_Shell_Command_List::write(fld::io::Project_Writer *out) { int n_in_project_file = 0; for (int i=0; i<list_size; i++) { - if (list[i]->storage == fld::Tool_Store::PROJECT) + if (list[i]->storage == FLD_TOOL_STORE_PROJECT) n_in_project_file++; } if (n_in_project_file > 0) { out->write_string("\nshell_commands {"); for (int i=0; i<list_size; i++) { - if (list[i]->storage == fld::Tool_Store::PROJECT) + if (list[i]->storage == FLD_TOOL_STORE_PROJECT) list[i]->write(out); } out->write_string("\n}"); @@ -960,7 +960,7 @@ void Fd_Shell_Command_List::import_from_file() { for (i = 0; i < n; i++) { Fl_Preferences cmd_prefs(shell_commands, Fl_Preferences::Name(i)); Fd_Shell_Command *cmd = new Fd_Shell_Command(); - cmd->storage = fld::Tool_Store::USER; + cmd->storage = FLD_TOOL_STORE_USER; cmd->read(cmd_prefs); g_shell_config->add(cmd); } diff --git a/fluid/app/shell_command.h b/fluid/app/shell_command.h index bc7a18c3e..b9e68ca15 100644 --- a/fluid/app/shell_command.h +++ b/fluid/app/shell_command.h @@ -104,7 +104,7 @@ public: std::string name { }; std::string label { }; Fl_Shortcut shortcut = 0; - fld::Tool_Store storage = fld::Tool_Store::USER; + fld::Tool_Store storage = FLD_TOOL_STORE_USER; int condition = ALWAYS; // always, hide, windows only, linux only, mac only, user, machine std::string condition_data { }; // user name, machine name std::string command { }; diff --git a/fluid/app/templates.cxx b/fluid/app/templates.cxx index cbd266b13..09fdc0220 100644 --- a/fluid/app/templates.cxx +++ b/fluid/app/templates.cxx @@ -107,7 +107,7 @@ void fld::app::save_template() { for (t = Fluid.proj.tree.first; t; t = t->next) { // Find the first window... - if (t->is_a(Type::Window)) break; + if (t->is_a(FLD_NODE_TYPE_Window)) break; } if (!t) return; |
