diff options
| author | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-06 02:33:41 +0500 |
|---|---|---|
| committer | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-06 02:33:41 +0500 |
| commit | 43e0a37906afabb0b3b091b8d3eac9a910cae50c (patch) | |
| tree | d2a037c2bf0dc395fddb08e32ebfcf2795503b7c /fluid/app/shell_command.h | |
| parent | 4ce4967c33d56e4b56d85d11fe0e0be91e159f5d (diff) | |
wip
Diffstat (limited to 'fluid/app/shell_command.h')
| -rw-r--r-- | fluid/app/shell_command.h | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/fluid/app/shell_command.h b/fluid/app/shell_command.h index b9e68ca15..716a87349 100644 --- a/fluid/app/shell_command.h +++ b/fluid/app/shell_command.h @@ -23,7 +23,6 @@ #include <stdio.h> #include <stdlib.h> -#include <string> #if defined(_WIN32) && !defined(__CYGWIN__) # include <direct.h> # include <windows.h> @@ -49,8 +48,8 @@ class Fl_Widget; class Fl_Preferences; void show_terminal_window(); -void run_shell_command(const std::string &cmd, int flags); -bool shell_command_running(void); +void run_shell_command(const char *cmd, int flags); +int shell_command_running(void); class Fl_Process { @@ -58,7 +57,7 @@ public: Fl_Process(); ~Fl_Process(); - FILE *popen(const char *cmd, const char *mode="r"); + FILE *popen(const char *cmd, const char *mode); int close(); FILE * desc() const; @@ -73,7 +72,7 @@ protected: PROCESS_INFORMATION pi; STARTUPINFO si; - static bool createPipe(HANDLE * h, BOOL bInheritHnd=TRUE); + static int createPipe(HANDLE * h, BOOL bInheritHnd); private: FILE * freeHandles(); @@ -81,7 +80,7 @@ private: #endif protected: - FILE * _fpt = nullptr; + FILE * _fpt; }; @@ -90,42 +89,51 @@ public: enum { ALWAYS, NEVER, MAC_ONLY, UX_ONLY, WIN_ONLY, MAC_AND_UX_ONLY, USER_ONLY, HOST_ONLY, ENV_ONLY }; // conditions enum { SAVE_PROJECT = 1, SAVE_SOURCECODE = 2, SAVE_STRINGS = 4, SAVE_ALL = 7, DONT_SHOW_TERMINAL = 8, CLEAR_TERMINAL = 16, CLEAR_HISTORY = 32 }; // flags + + char *name; + char *label; + Fl_Shortcut shortcut; + fld::Tool_Store storage; + int condition; + char *condition_data; + char *command; + int flags; + Fl_Menu_Item *shell_menu_item_; + Fd_Shell_Command(); Fd_Shell_Command(const Fd_Shell_Command *rhs); - Fd_Shell_Command(const std::string &in_name); - Fd_Shell_Command(const std::string &in_name, - const std::string &in_label, + Fd_Shell_Command(const char *in_name); + Fd_Shell_Command(const char *in_name, + const char *in_label, Fl_Shortcut in_shortcut, fld::Tool_Store in_storage, int in_condition, - const std::string &in_condition_data, - const std::string &in_command, + const char *in_condition_data, + const char *in_command, int in_flags); - 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_; + ~Fd_Shell_Command(); + + void set_name(const char *s); + void set_label(const char *s); + void set_condition_data(const char *s); + void set_command(const char *s); + void run(); void read(Fl_Preferences &prefs); - void write(Fl_Preferences &prefs, bool save_location = false); + void write(Fl_Preferences &prefs, int save_location); void read(class fld::io::Project_Reader*); void write(class fld::io::Project_Writer*); void update_shell_menu(); - bool is_active(); + int is_active(); }; class Fd_Shell_Command_List { public: - Fd_Shell_Command **list = nullptr; - int list_size = 0; - int list_capacity = 0; - Fl_Menu_Item *shell_menu_ = nullptr; + Fd_Shell_Command **list; + int list_size; + int list_capacity; + Fl_Menu_Item *shell_menu_; public: Fd_Shell_Command_List(); ~Fd_Shell_Command_List(); @@ -135,10 +143,6 @@ public: void remove(int index); void clear(); 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, fld::Tool_Store storage); void write(Fl_Preferences &prefs, fld::Tool_Store storage); void read(class fld::io::Project_Reader*); |
