diff options
| author | Matthias Melcher <github@matthiasm.com> | 2025-03-16 17:16:12 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-16 17:16:12 -0400 |
| commit | 51a55bc73660f64e8f4b32b8b4d3858f2a786f7b (patch) | |
| tree | 122ad9f838fcf8f61ed7cf5fa031e8ed69817e10 /fluid/app/shell_command.h | |
| parent | 13a7073a1e007ce5b71ef70bced1a9b15158820d (diff) | |
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`.
Diffstat (limited to 'fluid/app/shell_command.h')
| -rw-r--r-- | fluid/app/shell_command.h | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/fluid/app/shell_command.h b/fluid/app/shell_command.h index 3f5508493..bc7a18c3e 100644 --- a/fluid/app/shell_command.h +++ b/fluid/app/shell_command.h @@ -1,7 +1,7 @@ // -// FLUID main entry for the Fast Light Tool Kit (FLTK). +// Shell Command database header for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2023 by Bill Spitzak and others. +// 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 @@ -17,7 +17,7 @@ #ifndef _FLUID_SHELL_COMMAND_H #define _FLUID_SHELL_COMMAND_H -#include "app/fluid.h" +#include "Fluid.h" #include <FL/Enumerations.H> @@ -48,13 +48,11 @@ struct Fl_Menu_Item; class Fl_Widget; class Fl_Preferences; -char preferences_get(Fl_Preferences &prefs, const char *key, std::string &value, const std::string &defaultValue); -char preferences_set(Fl_Preferences &prefs, const char *key, const std::string &value); - void show_terminal_window(); void run_shell_command(const std::string &cmd, int flags); bool shell_command_running(void); + class Fl_Process { public: Fl_Process(); @@ -83,9 +81,10 @@ private: #endif protected: - FILE * _fpt; + FILE * _fpt = nullptr; }; + class Fd_Shell_Command { public: enum { ALWAYS, NEVER, MAC_ONLY, UX_ONLY, WIN_ONLY, MAC_AND_UX_ONLY, USER_ONLY, HOST_ONLY, ENV_ONLY }; // conditions @@ -97,19 +96,19 @@ public: Fd_Shell_Command(const std::string &in_name, const std::string &in_label, Fl_Shortcut in_shortcut, - Fd_Tool_Store in_storage, + fld::Tool_Store in_storage, int in_condition, const std::string &in_condition_data, const std::string &in_command, int in_flags); - std::string name; - std::string label; - Fl_Shortcut shortcut; - Fd_Tool_Store storage; - int condition; // always, hide, windows only, linux only, mac only, user, machine - std::string condition_data; // user name, machine name - std::string command; - int flags; // save_project, save_code, save_string, ... + std::string name { }; + std::string label { }; + Fl_Shortcut shortcut = 0; + 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 { }; + int flags = 0; // save_project, save_code, save_string, ... Fl_Menu_Item *shell_menu_item_; void run(); void read(Fl_Preferences &prefs); @@ -120,12 +119,13 @@ public: bool is_active(); }; + class Fd_Shell_Command_List { public: - Fd_Shell_Command **list; - int list_size; - int list_capacity; - Fl_Menu_Item *shell_menu_; + Fd_Shell_Command **list = nullptr; + int list_size = 0; + int list_capacity = 0; + Fl_Menu_Item *shell_menu_ = nullptr; public: Fd_Shell_Command_List(); ~Fd_Shell_Command_List(); @@ -134,13 +134,13 @@ public: void insert(int index, Fd_Shell_Command *cmd); void remove(int index); void clear(); - void clear(Fd_Tool_Store store); + void clear(fld::Tool_Store store); // void move_up(); // void move_down(); // int load(const std::string &filename); // int save(const std::string &filename); - void read(Fl_Preferences &prefs, Fd_Tool_Store storage); - void write(Fl_Preferences &prefs, Fd_Tool_Store storage); + void read(Fl_Preferences &prefs, fld::Tool_Store storage); + void write(Fl_Preferences &prefs, fld::Tool_Store storage); void read(class fld::io::Project_Reader*); void write(class fld::io::Project_Writer*); void rebuild_shell_menu(); |
