mirror of
https://github.com/fltk/fltk.git
synced 2026-05-22 23:26:43 +08:00
FLUID: adds greatly enhanced Shell Commands (#774)
The user can add an arbitrary number of highly configurable shell commands through the setting panel. The commands can be saved as user preferences, inside the .fl file, or exported to an external file. Shell scripts can be limited to individual platforms, can have shortcut keys, etc. . * documentation will follow * support to call `fltk-config` will follow
This commit is contained in:
+7
-2
@@ -22,6 +22,7 @@
|
||||
|
||||
# include <stdio.h>
|
||||
# include "Fl_Export.H"
|
||||
# include "fl_attr.h"
|
||||
|
||||
class Fl_String;
|
||||
|
||||
@@ -131,6 +132,7 @@ public:
|
||||
ROOT_MASK = 0x00FF, ///< Mask for the values above
|
||||
CORE = 0x0100, ///< OR'd by FLTK to read and write core library preferences and options
|
||||
C_LOCALE = 0x1000, ///< This flag should always be set, it makes sure that floating point
|
||||
CLEAR = 0x2000, ///< Don't read a possibly existing database. Instead, start with an empty set of preferences.
|
||||
///< values are written correctly independently of the current locale
|
||||
SYSTEM_L = SYSTEM | C_LOCALE, ///< Preferences are used system-wide, locale independent
|
||||
USER_L = USER | C_LOCALE, ///< Preferences apply only to the current user, locale independent
|
||||
@@ -188,7 +190,7 @@ public:
|
||||
static Root filename( char *buffer, size_t buffer_size, Root root, const char *vendor, const char *application );
|
||||
|
||||
Fl_Preferences( Root root, const char *vendor, const char *application );
|
||||
Fl_Preferences( const char *path, const char *vendor, const char *application );
|
||||
Fl_Preferences( const char *path, const char *vendor, const char *application, Root flags );
|
||||
Fl_Preferences( Fl_Preferences &parent, const char *group );
|
||||
Fl_Preferences( Fl_Preferences *parent, const char *group );
|
||||
Fl_Preferences( Fl_Preferences &parent, int groupIndex );
|
||||
@@ -197,6 +199,9 @@ public:
|
||||
Fl_Preferences( ID id );
|
||||
virtual ~Fl_Preferences();
|
||||
|
||||
FL_DEPRECATED("in 1.4.0 - use Fl_Preferences(path, vendor, application, flags) instead",
|
||||
Fl_Preferences( const char *path, const char *vendor, const char *application ) );
|
||||
|
||||
Root filename( char *buffer, size_t buffer_size);
|
||||
|
||||
/** Return an ID that can later be reused to open more references to this dataset.
|
||||
@@ -374,7 +379,7 @@ public: // older Sun compilers need this (public definition of the following cl
|
||||
Root root_type_;
|
||||
public:
|
||||
RootNode( Fl_Preferences *, Root root, const char *vendor, const char *application );
|
||||
RootNode( Fl_Preferences *, const char *path, const char *vendor, const char *application );
|
||||
RootNode( Fl_Preferences *, const char *path, const char *vendor, const char *application, Root flags );
|
||||
RootNode( Fl_Preferences * );
|
||||
~RootNode();
|
||||
int read();
|
||||
|
||||
@@ -422,7 +422,7 @@ void Fd_Layout_Suite::init() {
|
||||
name_ = NULL;
|
||||
menu_label = NULL;
|
||||
layout[0] = layout[1] = layout[2] = NULL;
|
||||
storage_ = 0;
|
||||
storage_ = FD_STORE_INTERNAL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -651,7 +651,7 @@ void Fd_Layout_List::update_menu_labels() {
|
||||
*/
|
||||
int Fd_Layout_List::load(const Fl_String &filename) {
|
||||
remove_all(FD_STORE_FILE);
|
||||
Fl_Preferences prefs(filename.c_str(), "layout.fluid.fltk.org", NULL);
|
||||
Fl_Preferences prefs(filename.c_str(), "layout.fluid.fltk.org", NULL, Fl_Preferences::C_LOCALE);
|
||||
read(prefs, FD_STORE_FILE);
|
||||
return 0;
|
||||
}
|
||||
@@ -661,7 +661,7 @@ int Fd_Layout_List::load(const Fl_String &filename) {
|
||||
*/
|
||||
int Fd_Layout_List::save(const Fl_String &filename) {
|
||||
assert(this);
|
||||
Fl_Preferences prefs(filename.c_str(), "layout.fluid.fltk.org", NULL);
|
||||
Fl_Preferences prefs(filename.c_str(), "layout.fluid.fltk.org", NULL, (Fl_Preferences::Root)(Fl_Preferences::C_LOCALE|Fl_Preferences::CLEAR));
|
||||
prefs.clear();
|
||||
write(prefs, FD_STORE_FILE);
|
||||
return 0;
|
||||
@@ -670,7 +670,7 @@ int Fd_Layout_List::save(const Fl_String &filename) {
|
||||
/**
|
||||
Write Suite and Layout selection and selected layout data to Preferences database.
|
||||
*/
|
||||
void Fd_Layout_List::write(Fl_Preferences &prefs, int storage) {
|
||||
void Fd_Layout_List::write(Fl_Preferences &prefs, Fd_Tool_Store storage) {
|
||||
Fl_Preferences prefs_list(prefs, "Layouts");
|
||||
prefs_list.clear();
|
||||
prefs_list.set("current_suite", list_[current_suite()].name_);
|
||||
@@ -688,7 +688,7 @@ void Fd_Layout_List::write(Fl_Preferences &prefs, int storage) {
|
||||
/**
|
||||
Read Suite and Layout selection and selected layout data to Preferences database.
|
||||
*/
|
||||
void Fd_Layout_List::read(Fl_Preferences &prefs, int storage) {
|
||||
void Fd_Layout_List::read(Fl_Preferences &prefs, Fd_Tool_Store storage) {
|
||||
Fl_Preferences prefs_list(prefs, "Layouts");
|
||||
Fl_String cs;
|
||||
int cp = 0;
|
||||
@@ -859,7 +859,7 @@ int Fd_Layout_List::add(const char *name) {
|
||||
new_suite.layout[i] = new Fd_Layout_Preset;
|
||||
::memcpy(new_suite.layout[i], old_suite.layout[i], sizeof(Fd_Layout_Preset));
|
||||
}
|
||||
int new_storage = old_suite.storage_;
|
||||
Fd_Tool_Store new_storage = old_suite.storage_;
|
||||
if (new_storage == FD_STORE_INTERNAL)
|
||||
new_storage = FD_STORE_USER;
|
||||
new_suite.storage(new_storage);
|
||||
@@ -904,7 +904,7 @@ void Fd_Layout_List::remove(int ix) {
|
||||
Remove all Suites that use the given storage attribute.
|
||||
\param[in] storage storage attribute, see FD_STORE_INTERNAL, etc.
|
||||
*/
|
||||
void Fd_Layout_List::remove_all(int storage) {
|
||||
void Fd_Layout_List::remove_all(Fd_Tool_Store storage) {
|
||||
for (int i=list_size_-1; i>=0; --i) {
|
||||
if (list_[i].storage_ == storage)
|
||||
remove(i);
|
||||
|
||||
+6
-15
@@ -17,6 +17,7 @@
|
||||
#ifndef _FLUID_FD_SNAP_ACTION_H
|
||||
#define _FLUID_FD_SNAP_ACTION_H
|
||||
|
||||
#include "fluid.h"
|
||||
#include "Fl_Window_Type.h"
|
||||
|
||||
#include <FL/Fl_String.H>
|
||||
@@ -25,16 +26,6 @@ struct Fl_Menu_Item;
|
||||
|
||||
extern Fl_Menu_Item main_layout_submenu_[];
|
||||
|
||||
/**
|
||||
Indicate the storage location for a layout suite.
|
||||
*/
|
||||
enum {
|
||||
FD_STORE_INTERNAL, ///< stored inside FLUID app
|
||||
FD_STORE_USER, ///< suite is stored in the user wide FLUID settings
|
||||
FD_STORE_PROJECT, ///< suite is stored within the current .fl project file
|
||||
FD_STORE_FILE ///< store suite in external file
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Collection of layout settings.
|
||||
|
||||
@@ -97,13 +88,13 @@ public:
|
||||
char *name_; ///< name of the suite
|
||||
char *menu_label; ///< label text used in pulldown menu
|
||||
Fd_Layout_Preset *layout[3]; ///< presets for application, dialog, and toolbox windows
|
||||
int storage_; ///< storage location (see FD_STORE_INTERNAL, etc.)
|
||||
Fd_Tool_Store storage_; ///< storage location (see FD_STORE_INTERNAL, etc.)
|
||||
void write(Fl_Preferences &prefs);
|
||||
void read(Fl_Preferences &prefs);
|
||||
void write(Fd_Project_Writer*);
|
||||
void read(Fd_Project_Reader*);
|
||||
void update_label();
|
||||
void storage(int s) { storage_ = s; update_label(); }
|
||||
void storage(Fd_Tool_Store s) { storage_ = s; update_label(); }
|
||||
void name(const char *n);
|
||||
void init();
|
||||
~Fd_Layout_Suite();
|
||||
@@ -146,13 +137,13 @@ public:
|
||||
|
||||
int load(const Fl_String &filename);
|
||||
int save(const Fl_String &filename);
|
||||
void write(Fl_Preferences &prefs, int storage);
|
||||
void read(Fl_Preferences &prefs, int storage);
|
||||
void write(Fl_Preferences &prefs, Fd_Tool_Store storage);
|
||||
void read(Fl_Preferences &prefs, Fd_Tool_Store storage);
|
||||
void write(Fd_Project_Writer*);
|
||||
void read(Fd_Project_Reader*);
|
||||
int add(Fd_Layout_Suite*);
|
||||
void remove(int index);
|
||||
void remove_all(int storage);
|
||||
void remove_all(Fd_Tool_Store storage);
|
||||
Fd_Layout_Preset *at(int);
|
||||
int size();
|
||||
};
|
||||
|
||||
+7
-2
@@ -252,11 +252,16 @@ void delete_all(int selected_only) {
|
||||
}
|
||||
if(!selected_only) {
|
||||
// reset the setting for the external shell command
|
||||
shell_prefs_get();
|
||||
shell_settings_write();
|
||||
if (g_shell_config) {
|
||||
g_shell_config->clear(FD_STORE_PROJECT);
|
||||
g_shell_config->rebuild_shell_menu();
|
||||
g_shell_config->update_settings_dialog();
|
||||
}
|
||||
widget_browser->hposition(0);
|
||||
widget_browser->vposition(0);
|
||||
g_layout_list.remove_all(FD_STORE_PROJECT);
|
||||
g_layout_list.current_suite(0);
|
||||
g_layout_list.current_preset(0);
|
||||
g_layout_list.update_dialogs();
|
||||
}
|
||||
selection_changed(0);
|
||||
|
||||
@@ -444,6 +444,10 @@ Type "Fl_Widget" <word> : C++ variable name
|
||||
"extra_code" <word> : C++ extra code lines
|
||||
... : inherits more from Fl_Type
|
||||
|
||||
Type "Fl_Button" <word> : C++ variable name
|
||||
|
||||
"compact" <word> : integer, set the flag for compact buttons, defaults to 0
|
||||
|
||||
Type "Fl_Flex" <word> : C++ variable name
|
||||
|
||||
"margins" <word> : this Word is written with printf as "{%d %d %d %d}",
|
||||
|
||||
+1263
-78
File diff suppressed because it is too large
Load Diff
+561
-62
File diff suppressed because it is too large
Load Diff
+28
-5
@@ -35,14 +35,23 @@ void init_scheme(void);
|
||||
extern struct Fl_Menu_Item *dbmanager_item;
|
||||
extern void i18n_cb(Fl_Choice *,void *);
|
||||
extern void scheme_cb(Fl_Scheme_Choice *, void *);
|
||||
extern int w_settings_shell_list_selected;
|
||||
#include <FL/Fl_Double_Window.H>
|
||||
extern Fl_Double_Window *script_panel;
|
||||
#include <FL/Fl_Text_Editor.H>
|
||||
extern Fl_Text_Editor *script_input;
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Return_Button.H>
|
||||
extern Fl_Return_Button *script_panel_ok;
|
||||
#include <FL/Fl_Button.H>
|
||||
extern Fl_Button *script_panel_cancel;
|
||||
#include <FL/Fl_Box.H>
|
||||
Fl_Double_Window* make_script_panel();
|
||||
extern Fl_Double_Window *settings_window;
|
||||
#include <FL/Fl_Tabs.H>
|
||||
extern Fl_Tabs *w_settings_tabs;
|
||||
#include <FL/Fl_Group.H>
|
||||
extern void scheme_cb(Fl_Scheme_Choice*, void*);
|
||||
extern Fl_Scheme_Choice *scheme_choice;
|
||||
#include <FL/Fl_Box.H>
|
||||
#include <FL/Fl_Check_Button.H>
|
||||
extern Fl_Check_Button *tooltips_button;
|
||||
extern Fl_Check_Button *completion_button;
|
||||
@@ -68,7 +77,6 @@ extern Fl_Check_Button *avoid_early_includes_button;
|
||||
extern Fl_Group *w_settings_layout_tab;
|
||||
#include <FL/Fl_Choice.H>
|
||||
extern Fl_Choice *layout_choice;
|
||||
#include <FL/Fl_Button.H>
|
||||
#include <FL/Fl_Menu_Button.H>
|
||||
extern Fl_Menu_Button *w_layout_menu;
|
||||
#include <FL/Fl_Native_File_Chooser.H>
|
||||
@@ -78,8 +86,19 @@ extern Fl_Button *preset_choice[3];
|
||||
#include <FL/Fl_Value_Input.H>
|
||||
extern Fl_Menu_Item fontmenu_w_default[];
|
||||
extern Fl_Group *w_settings_shell_tab;
|
||||
extern Fl_Check_Button *shell_use_fl_button;
|
||||
#include <FL/Fl_Return_Button.H>
|
||||
#include <FL/Fl_Browser.H>
|
||||
extern Fl_Browser *w_settings_shell_list;
|
||||
extern Fl_Group *w_settings_shell_toolbox;
|
||||
extern Fl_Button *w_settings_shell_dup;
|
||||
extern Fl_Button *w_settings_shell_remove;
|
||||
extern Fl_Menu_Button *w_settings_shell_menu;
|
||||
extern Fl_Button *w_settings_shell_play;
|
||||
extern Fl_Group *w_settings_shell_cmd;
|
||||
#include <FL/Fl_Shortcut_Button.H>
|
||||
extern Fl_Text_Editor *w_settings_shell_command;
|
||||
extern Fl_Menu_Button *w_settings_shell_text_macros;
|
||||
extern Fl_Box *w_settings_shell_fd_project;
|
||||
extern Fl_Box *w_settings_shell_fd_user;
|
||||
extern Fl_Group *w_settings_i18n_tab;
|
||||
extern void i18n_type_cb(Fl_Choice*, void*);
|
||||
extern Fl_Choice *i18n_type_chooser;
|
||||
@@ -102,6 +121,10 @@ extern Fl_Menu_Item *w_layout_menu_storage[4];
|
||||
#define w_layout_menu_load (menu_w_layout_menu+5)
|
||||
#define w_layout_menu_save (menu_w_layout_menu+6)
|
||||
#define w_layout_menu_delete (menu_w_layout_menu+7)
|
||||
extern Fl_Menu_Item menu_w_settings_shell_menu[];
|
||||
extern Fl_Menu_Item menu_Store[];
|
||||
extern Fl_Menu_Item menu_Condition[];
|
||||
extern Fl_Menu_Item menu_w_settings_shell_text_macros[];
|
||||
extern Fl_Menu_Item menu_i18n_type_chooser[];
|
||||
extern Fl_Double_Window *shell_run_window;
|
||||
#include <FL/Fl_Simple_Terminal.H>
|
||||
|
||||
+13
-42
@@ -137,7 +137,7 @@ int Fd_Project_Reader::open_read(const char *s) {
|
||||
fin = stdin;
|
||||
fname = "stdin";
|
||||
} else {
|
||||
FILE *f = fl_fopen(s,"r");
|
||||
FILE *f = fl_fopen(s, "r");
|
||||
if (!f)
|
||||
return 0;
|
||||
fin = f;
|
||||
@@ -325,29 +325,12 @@ void Fd_Project_Reader::read_children(Fl_Type *p, int paste, Strategy strategy,
|
||||
goto CONTINUE;
|
||||
}
|
||||
|
||||
if (strcmp(c, "win_shell_cmd")==0) {
|
||||
if (shell_settings_windows.command)
|
||||
free((void*)shell_settings_windows.command);
|
||||
shell_settings_windows.command = fl_strdup(read_word());
|
||||
goto CONTINUE;
|
||||
} else if (strcmp(c, "win_shell_flags")==0) {
|
||||
shell_settings_windows.flags = atoi(read_word());
|
||||
goto CONTINUE;
|
||||
} else if (strcmp(c, "linux_shell_cmd")==0) {
|
||||
if (shell_settings_linux.command)
|
||||
free((void*)shell_settings_linux.command);
|
||||
shell_settings_linux.command = fl_strdup(read_word());
|
||||
goto CONTINUE;
|
||||
} else if (strcmp(c, "linux_shell_flags")==0) {
|
||||
shell_settings_linux.flags = atoi(read_word());
|
||||
goto CONTINUE;
|
||||
} else if (strcmp(c, "mac_shell_cmd")==0) {
|
||||
if (shell_settings_macos.command)
|
||||
free((void*)shell_settings_macos.command);
|
||||
shell_settings_macos.command = fl_strdup(read_word());
|
||||
goto CONTINUE;
|
||||
} else if (strcmp(c, "mac_shell_flags")==0) {
|
||||
shell_settings_macos.flags = atoi(read_word());
|
||||
if (strcmp(c, "shell_commands")==0) {
|
||||
if (g_shell_config) {
|
||||
g_shell_config->read(this);
|
||||
} else {
|
||||
read_word();
|
||||
}
|
||||
goto CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -431,7 +414,10 @@ int Fd_Project_Reader::read_project(const char *filename, int merge, Strategy st
|
||||
}
|
||||
}
|
||||
selection_changed(Fl_Type::current);
|
||||
shell_settings_read();
|
||||
if (g_shell_config) {
|
||||
g_shell_config->rebuild_shell_menu();
|
||||
g_shell_config->update_settings_dialog();
|
||||
}
|
||||
int ret = close_read();
|
||||
undo_resume();
|
||||
return ret;
|
||||
@@ -816,23 +802,8 @@ int Fd_Project_Writer::write_project(const char *filename, int selected_only) {
|
||||
write_string("\nheader_name"); write_word(g_project.header_file_name.c_str());
|
||||
write_string("\ncode_name"); write_word(g_project.code_file_name.c_str());
|
||||
g_layout_list.write(this);
|
||||
#if 0
|
||||
// https://github.com/fltk/fltk/issues/328
|
||||
// Project wide settings require a redesign.
|
||||
shell_settings_write();
|
||||
if (shell_settings_windows.command) {
|
||||
write_string("\nwin_shell_cmd"); write_word(shell_settings_windows.command);
|
||||
write_string("\nwin_shell_flags"); write_string("%d", shell_settings_windows.flags);
|
||||
}
|
||||
if (shell_settings_linux.command) {
|
||||
write_string("\nlinux_shell_cmd"); write_word(shell_settings_linux.command);
|
||||
write_string("\nlinux_shell_flags"); write_string("%d", shell_settings_linux.flags);
|
||||
}
|
||||
if (shell_settings_macos.command) {
|
||||
write_string("\nmac_shell_cmd"); write_word(shell_settings_macos.command);
|
||||
write_string("\nmac_shell_flags"); write_string("%d", shell_settings_macos.flags);
|
||||
}
|
||||
#endif
|
||||
if (g_shell_config)
|
||||
g_shell_config->write(this);
|
||||
}
|
||||
|
||||
for (Fl_Type *p = Fl_Type::first; p;) {
|
||||
|
||||
+121
-19
@@ -172,6 +172,9 @@ Fl_String g_code_filename_arg;
|
||||
Fl_String g_header_filename_arg;
|
||||
Fl_String g_launch_path;
|
||||
|
||||
Fl_String tmpdir_path;
|
||||
bool tmpdir_create_called = false;
|
||||
|
||||
/** \var int Fluid_Project::header_file_set
|
||||
If set, command line overrides header file name in .fl file.
|
||||
*/
|
||||
@@ -311,10 +314,6 @@ void Fluid_Project::reset() {
|
||||
code_file_set = 0;
|
||||
header_file_name = ".h";
|
||||
code_file_name = ".cxx";
|
||||
|
||||
g_layout_list.remove_all(FD_STORE_PROJECT);
|
||||
g_layout_list.current_suite(0);
|
||||
g_layout_list.current_preset(0);
|
||||
}
|
||||
|
||||
void Fluid_Project::update_settings_dialog() {
|
||||
@@ -324,6 +323,113 @@ void Fluid_Project::update_settings_dialog() {
|
||||
}
|
||||
}
|
||||
|
||||
// make sure that a path name ends with a forward slash
|
||||
static Fl_String end_with_slash(const Fl_String &str) {
|
||||
char last = str[str.size()-1];
|
||||
if (last !='/' && last != '\\')
|
||||
return str + "/";
|
||||
else
|
||||
return str;
|
||||
}
|
||||
|
||||
/** Generate a path to a directory for temporary data storage.
|
||||
The path is stored in g_tmpdir.
|
||||
*/
|
||||
static void create_tmpdir() {
|
||||
if (tmpdir_create_called)
|
||||
return;
|
||||
tmpdir_create_called = true;
|
||||
|
||||
char buf[128];
|
||||
#if _WIN32
|
||||
// The usual temp file locations on Windows are
|
||||
// %system%\Windows\Temp
|
||||
// %userprofiles%\AppData\Local
|
||||
// usually resolving into
|
||||
// C:/Windows/Temp/
|
||||
// C:\Users\<username>\AppData\Local\Temp
|
||||
fl_snprintf(buf, sizeof(buf)-1, "fluid-%d/", (long)GetCurrentProcessId());
|
||||
Fl_String name = buf;
|
||||
wchar_t tempdirW[FL_PATH_MAX+1];
|
||||
char tempdir[FL_PATH_MAX+1];
|
||||
unsigned len = GetTempPathW(FL_PATH_MAX, tempdirW);
|
||||
if (len == 0) {
|
||||
strcpy(tempdir, "c:/windows/temp/");
|
||||
} else {
|
||||
unsigned wn = fl_utf8fromwc(tempdir, FL_PATH_MAX, tempdirW, len);
|
||||
tempdir[wn] = 0;
|
||||
}
|
||||
Fl_String path = tempdir;
|
||||
end_with_slash(path);
|
||||
path += name;
|
||||
fl_make_path(path.c_str());
|
||||
if (fl_access(path.c_str(), 6) == 0) tmpdir_path = path;
|
||||
#else
|
||||
fl_snprintf(buf, sizeof(buf)-1, "fluid-%d/", getpid());
|
||||
Fl_String name = buf;
|
||||
Fl_String path = fl_getenv("TMPDIR");
|
||||
if (!path.empty()) {
|
||||
end_with_slash(path);
|
||||
path += name;
|
||||
fl_make_path(path.c_str());
|
||||
if (fl_access(path.c_str(), 6) == 0) tmpdir_path = path;
|
||||
}
|
||||
if (tmpdir_path.empty()) {
|
||||
path = Fl_String("/tmp/") + name;
|
||||
fl_make_path(path.c_str());
|
||||
if (fl_access(path.c_str(), 6) == 0) tmpdir_path = path;
|
||||
}
|
||||
#endif
|
||||
if (tmpdir_path.empty()) {
|
||||
char pbuf[FL_PATH_MAX+1];
|
||||
fluid_prefs.get_userdata_path(pbuf, FL_PATH_MAX);
|
||||
path = Fl_String(pbuf);
|
||||
end_with_slash(path);
|
||||
path += name;
|
||||
fl_make_path(path.c_str());
|
||||
if (fl_access(path.c_str(), 6) == 0) tmpdir_path = path;
|
||||
}
|
||||
if (tmpdir_path.empty())
|
||||
fl_alert("Can't create directory for temporary data storage.");
|
||||
}
|
||||
|
||||
/** Delete the temporary directory that was created in set_tmpdir. */
|
||||
static void delete_tmpdir() {
|
||||
// was a temporary directory created
|
||||
if (!tmpdir_create_called)
|
||||
return;
|
||||
if (tmpdir_path.empty())
|
||||
return;
|
||||
|
||||
// first delete all files that may still be left in the temp directory
|
||||
struct dirent **de;
|
||||
int n_de = fl_filename_list(tmpdir_path.c_str(), &de);
|
||||
if (n_de >= 0) {
|
||||
for (int i=0; i<n_de; i++) {
|
||||
Fl_String path = tmpdir_path + de[i]->d_name;
|
||||
fl_unlink(path.c_str());
|
||||
}
|
||||
fl_filename_free_list(&de, n_de);
|
||||
}
|
||||
|
||||
// then delete the directory itself
|
||||
if (fl_rmdir(tmpdir_path.c_str()) < 0) {
|
||||
fl_alert("WARNING: Can't delete tmpdir '%s': %s", tmpdir_path.c_str(), strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Return the path to a temporary directory for this instance of FLUID.
|
||||
Fluid will do its best to clear and delete this directory when exiting.
|
||||
\return the path to the temporary directory, ending in a '/', or and empty
|
||||
string is no directory could be created.
|
||||
*/
|
||||
const Fl_String &get_tmpdir() {
|
||||
if (!tmpdir_create_called)
|
||||
create_tmpdir();
|
||||
return tmpdir_path;
|
||||
}
|
||||
|
||||
/**
|
||||
Give the user the opportunity to save a project before clearing it.
|
||||
|
||||
@@ -397,7 +503,7 @@ void enter_project_dir() {
|
||||
// store the current working directory for later
|
||||
app_work_dir = fl_getcwd();
|
||||
// set the current directory to the path of our .fl file
|
||||
Fl_String project_path = fl_filename_path(fl_filename_absolute(Fl_String(filename)));
|
||||
Fl_String project_path = fl_filename_path(fl_filename_absolute(filename));
|
||||
if (fl_chdir(project_path.c_str()) == -1) {
|
||||
fprintf(stderr, "** Fluid internal error: enter_project_dir() can't chdir to %s: %s\n",
|
||||
project_path.c_str(), strerror(errno));
|
||||
@@ -733,6 +839,8 @@ void exit_cb(Fl_Widget *,void *) {
|
||||
if (help_dialog)
|
||||
delete help_dialog;
|
||||
|
||||
if (g_shell_config)
|
||||
g_shell_config->write(fluid_prefs, FD_STORE_USER);
|
||||
g_layout_list.write(fluid_prefs, FD_STORE_USER);
|
||||
|
||||
undo_clear();
|
||||
@@ -742,6 +850,7 @@ void exit_cb(Fl_Widget *,void *) {
|
||||
// and cleans up editor tmp files. Then remove fluid tmpdir /last/.
|
||||
g_project.reset();
|
||||
ExternalCodeEditor::tmpdir_clear();
|
||||
delete_tmpdir();
|
||||
|
||||
exit(0);
|
||||
}
|
||||
@@ -989,15 +1098,6 @@ void apple_open_cb(const char *c) {
|
||||
}
|
||||
#endif // __APPLE__
|
||||
|
||||
// make sure that a path nae ends with a forward slash
|
||||
static Fl_String end_with_slash(const Fl_String &str) {
|
||||
char last = str[str.size()-1];
|
||||
if (last !='/' && last != '\\')
|
||||
return str + "/";
|
||||
else
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
Get the absolute path of the project file, for example `/Users/matt/dev/`.
|
||||
*/
|
||||
@@ -1585,10 +1685,7 @@ Fl_Menu_Item Main_Menu[] = {
|
||||
{"Dialog", 0, select_layout_preset_cb, (void*)1, FL_MENU_RADIO },
|
||||
{"Toolbox", 0, select_layout_preset_cb, (void*)2, FL_MENU_RADIO },
|
||||
{0},
|
||||
{"&Shell",0,0,0,FL_SUBMENU},
|
||||
{"Execute &Command...",FL_ALT+'x',(Fl_Callback *)show_shell_window},
|
||||
{"Execute &Again...",FL_ALT+'g',(Fl_Callback *)do_shell_command},
|
||||
{0},
|
||||
{"&Shell", 0, Fd_Shell_Command_List::menu_marker, (void*)Fd_Shell_Command_List::default_menu, FL_SUBMENU_POINTER},
|
||||
{"&Help",0,0,0,FL_SUBMENU},
|
||||
{"&Rapid development with FLUID...",0,help_cb},
|
||||
{"&FLTK Programmers Manual...",0,manual_cb, 0, FL_MENU_DIVIDER},
|
||||
@@ -1710,7 +1807,6 @@ void make_main_window() {
|
||||
fluid_prefs.get("show_guides", show_guides, 1);
|
||||
fluid_prefs.get("show_restricted", show_restricted, 1);
|
||||
fluid_prefs.get("show_comments", show_comments, 1);
|
||||
shell_prefs_get();
|
||||
make_shell_window();
|
||||
}
|
||||
|
||||
@@ -1740,6 +1836,9 @@ void make_main_window() {
|
||||
|
||||
if (!batch_mode) {
|
||||
load_history();
|
||||
g_shell_config = new Fd_Shell_Command_List;
|
||||
// TODO: load example commands if this is the very first time we use this
|
||||
// g_shell_config->restore_defaults();
|
||||
make_settings_window();
|
||||
}
|
||||
}
|
||||
@@ -1851,6 +1950,7 @@ void set_filename(const char *c) {
|
||||
set_modflag(modflag);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set the "modified" flag and update the title of the main window.
|
||||
|
||||
@@ -2044,6 +2144,8 @@ int main(int argc,char **argv) {
|
||||
main_window->show(argc,argv);
|
||||
toggle_widgetbin_cb(0,0);
|
||||
toggle_sourceview_cb(0,0);
|
||||
if (g_shell_config)
|
||||
g_shell_config->read(fluid_prefs, FD_STORE_USER);
|
||||
g_layout_list.read(fluid_prefs, FD_STORE_USER);
|
||||
if (!c && openlast_button->value() && absolute_history[0][0]) {
|
||||
// Open previous file when no file specified...
|
||||
|
||||
+24
-9
@@ -28,6 +28,8 @@
|
||||
#define MENUHEIGHT 25
|
||||
#define WINHEIGHT (BROWSERHEIGHT+MENUHEIGHT)
|
||||
|
||||
// ---- types
|
||||
|
||||
class Fl_Double_Window;
|
||||
class Fl_Window;
|
||||
class Fl_Menu_Bar;
|
||||
@@ -36,6 +38,19 @@ class Fl_Choice;
|
||||
class Fl_Button;
|
||||
class Fl_Check_Button;
|
||||
|
||||
/**
|
||||
Indicate the storage location for tools like layout suites and shell macros.
|
||||
\see class Fd_Shell_Command, class Fd_Layout_Suite
|
||||
*/
|
||||
typedef enum {
|
||||
FD_STORE_INTERNAL, ///< stored inside FLUID app
|
||||
FD_STORE_USER, ///< suite is stored in the user wide FLUID settings
|
||||
FD_STORE_PROJECT, ///< suite is stored within the current .fl project file
|
||||
FD_STORE_FILE ///< store suite in external file
|
||||
} Fd_Tool_Store;
|
||||
|
||||
// ---- global variables
|
||||
|
||||
extern int force_parent;
|
||||
|
||||
extern Fl_Preferences fluid_prefs;
|
||||
@@ -71,9 +86,6 @@ extern Fl_Check_Button *guides_button;
|
||||
|
||||
extern int modflag;
|
||||
|
||||
extern void enter_project_dir();
|
||||
extern void leave_project_dir();
|
||||
|
||||
extern int update_file; // fluid -u
|
||||
extern int compile_file; // fluid -c
|
||||
extern int compile_strings; // fluic -cs
|
||||
@@ -81,7 +93,11 @@ extern int batch_mode;
|
||||
|
||||
extern int pasteoffset;
|
||||
|
||||
// ---- project settings
|
||||
extern Fl_String g_code_filename_arg;
|
||||
extern Fl_String g_header_filename_arg;
|
||||
extern Fl_String g_launch_path;
|
||||
|
||||
// ---- project class declaration
|
||||
|
||||
class Fluid_Project {
|
||||
public:
|
||||
@@ -123,16 +139,15 @@ public:
|
||||
|
||||
extern Fluid_Project g_project;
|
||||
|
||||
extern Fl_String g_code_filename_arg;
|
||||
extern Fl_String g_header_filename_arg;
|
||||
extern Fl_String g_launch_path;
|
||||
|
||||
|
||||
// ---- public functions
|
||||
|
||||
extern void enter_project_dir();
|
||||
extern void leave_project_dir();
|
||||
extern void set_filename(const char *c);
|
||||
extern void set_modflag(int mf, int mfc=-1);
|
||||
|
||||
extern const Fl_String &get_tmpdir();
|
||||
|
||||
// ---- public callback functions
|
||||
|
||||
extern void save_cb(Fl_Widget *, void *v);
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
+717
-131
File diff suppressed because it is too large
Load Diff
+75
-25
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// FLUID main entry for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2021 by Bill Spitzak and others.
|
||||
// Copyright 1998-2023 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,11 +17,13 @@
|
||||
#ifndef _FLUID_SHELL_COMMAND_H
|
||||
#define _FLUID_SHELL_COMMAND_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "fluid.h"
|
||||
|
||||
#include <FL/Fl_String.H>
|
||||
#include <FL/Enumerations.H>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
# include <direct.h>
|
||||
# include <windows.h>
|
||||
@@ -33,29 +35,10 @@
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
void show_shell_window();
|
||||
void do_shell_command(class Fl_Return_Button*, void*);
|
||||
|
||||
typedef struct {
|
||||
char *command;
|
||||
int flags;
|
||||
} Shell_Settings;
|
||||
|
||||
extern Shell_Settings shell_settings_windows;
|
||||
extern Shell_Settings shell_settings_linux;
|
||||
extern Shell_Settings shell_settings_macos;
|
||||
|
||||
extern Fl_String g_shell_command;
|
||||
extern int g_shell_save_fl;
|
||||
extern int g_shell_save_code;
|
||||
extern int g_shell_save_strings;
|
||||
extern int g_shell_use_fl_settings;
|
||||
|
||||
void shell_prefs_get();
|
||||
void shell_prefs_set();
|
||||
void shell_settings_read();
|
||||
void shell_settings_write();
|
||||
struct Fl_Menu_Item;
|
||||
class Fl_Widget;
|
||||
|
||||
void run_shell_command(const Fl_String &cmd, int flags);
|
||||
|
||||
class Fl_Process {
|
||||
public:
|
||||
@@ -88,4 +71,71 @@ protected:
|
||||
FILE * _fpt;
|
||||
};
|
||||
|
||||
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
|
||||
enum { SAVE_PROJECT = 1, SAVE_SOURCECODE = 2, SAVE_STRINGS = 4, SAVE_ALL = 7 }; // flags
|
||||
Fd_Shell_Command();
|
||||
Fd_Shell_Command(const Fd_Shell_Command *rhs);
|
||||
Fd_Shell_Command(const Fl_String &in_name);
|
||||
Fd_Shell_Command(const Fl_String &in_name,
|
||||
const Fl_String &in_label,
|
||||
Fl_Shortcut in_shortcut,
|
||||
Fd_Tool_Store in_storage,
|
||||
int in_condition,
|
||||
const Fl_String &in_condition_data,
|
||||
const Fl_String &in_command,
|
||||
int in_flags);
|
||||
Fl_String name;
|
||||
Fl_String label;
|
||||
Fl_Shortcut shortcut;
|
||||
Fd_Tool_Store storage;
|
||||
int condition; // always, hide, windows only, linux only, mac only, user, machine
|
||||
Fl_String condition_data; // user name, machine name
|
||||
Fl_String command;
|
||||
int flags; // save_project, save_code, save_string, ...
|
||||
Fl_Menu_Item *shell_menu_item_;
|
||||
void run();
|
||||
void read(Fl_Preferences &prefs);
|
||||
void write(Fl_Preferences &prefs, bool save_location = false);
|
||||
void read(class Fd_Project_Reader*);
|
||||
void write(class Fd_Project_Writer*);
|
||||
void update_shell_menu();
|
||||
bool is_active();
|
||||
};
|
||||
|
||||
class Fd_Shell_Command_List {
|
||||
public:
|
||||
Fd_Shell_Command **list;
|
||||
int list_size;
|
||||
int list_capacity;
|
||||
Fl_Menu_Item *shell_menu_;
|
||||
public:
|
||||
Fd_Shell_Command_List();
|
||||
~Fd_Shell_Command_List();
|
||||
Fd_Shell_Command *at(int index) const;
|
||||
void add(Fd_Shell_Command *cmd);
|
||||
void insert(int index, Fd_Shell_Command *cmd);
|
||||
void remove(int index);
|
||||
void clear();
|
||||
void clear(Fd_Tool_Store store);
|
||||
// void move_up();
|
||||
// void move_down();
|
||||
// int load(const Fl_String &filename);
|
||||
// int save(const Fl_String &filename);
|
||||
void read(Fl_Preferences &prefs, Fd_Tool_Store storage);
|
||||
void write(Fl_Preferences &prefs, Fd_Tool_Store storage);
|
||||
void read(class Fd_Project_Reader*);
|
||||
void write(class Fd_Project_Writer*);
|
||||
void rebuild_shell_menu();
|
||||
void update_settings_dialog();
|
||||
|
||||
static Fl_Menu_Item default_menu[];
|
||||
static void menu_marker(Fl_Widget*, void*);
|
||||
static void export_selected();
|
||||
static void import_from_file();
|
||||
};
|
||||
|
||||
extern Fd_Shell_Command_List *g_shell_config;
|
||||
|
||||
#endif // _FLUID_SHELL_COMMAND_H
|
||||
|
||||
@@ -87,17 +87,17 @@ void update_sourceview_cb(class Fl_Button*, void*) {
|
||||
|
||||
if (!sv_source_filename) {
|
||||
sv_source_filename = (char*)malloc(FL_PATH_MAX);
|
||||
fluid_prefs.getUserdataPath(sv_source_filename, FL_PATH_MAX);
|
||||
fl_strlcpy(sv_source_filename, get_tmpdir().c_str(), FL_PATH_MAX);
|
||||
fl_strlcat(sv_source_filename, "source_view_tmp.cxx", FL_PATH_MAX);
|
||||
}
|
||||
if (!sv_header_filename) {
|
||||
sv_header_filename = (char*)malloc(FL_PATH_MAX);
|
||||
fluid_prefs.getUserdataPath(sv_header_filename, FL_PATH_MAX);
|
||||
fl_strlcpy(sv_header_filename, get_tmpdir().c_str(), FL_PATH_MAX);
|
||||
fl_strlcat(sv_header_filename, "source_view_tmp.h", FL_PATH_MAX);
|
||||
}
|
||||
if (!sv_design_filename) {
|
||||
sv_design_filename = (char*)malloc(FL_PATH_MAX);
|
||||
fluid_prefs.getUserdataPath(sv_design_filename, FL_PATH_MAX);
|
||||
fl_strlcpy(sv_design_filename, get_tmpdir().c_str(), FL_PATH_MAX);
|
||||
fl_strlcat(sv_design_filename, "source_view_tmp.fl", FL_PATH_MAX);
|
||||
}
|
||||
|
||||
@@ -108,8 +108,9 @@ void update_sourceview_cb(class Fl_Button*, void*) {
|
||||
sv_project->scroll(top, 0);
|
||||
} else if (sv_strings->visible_r()) {
|
||||
static const char *exts[] = { ".txt", ".po", ".msg" };
|
||||
char fn[FL_PATH_MAX];
|
||||
fluid_prefs.getUserdataPath(fn, FL_PATH_MAX);
|
||||
char fn[FL_PATH_MAX+1];
|
||||
fl_strlcpy(fn, get_tmpdir().c_str(), FL_PATH_MAX);
|
||||
fl_strlcat(fn, "strings", FL_PATH_MAX);
|
||||
fl_filename_setext(fn, FL_PATH_MAX, exts[g_project.i18n_type]);
|
||||
write_strings(fn);
|
||||
int top = sv_strings->top_line();
|
||||
|
||||
@@ -102,17 +102,17 @@ and load those into the Code Viewer widgets.} open return_type void
|
||||
|
||||
if (!sv_source_filename) {
|
||||
sv_source_filename = (char*)malloc(FL_PATH_MAX);
|
||||
fluid_prefs.getUserdataPath(sv_source_filename, FL_PATH_MAX);
|
||||
fl_strlcpy(sv_source_filename, get_tmpdir().c_str(), FL_PATH_MAX);
|
||||
fl_strlcat(sv_source_filename, "source_view_tmp.cxx", FL_PATH_MAX);
|
||||
}
|
||||
if (!sv_header_filename) {
|
||||
sv_header_filename = (char*)malloc(FL_PATH_MAX);
|
||||
fluid_prefs.getUserdataPath(sv_header_filename, FL_PATH_MAX);
|
||||
fl_strlcpy(sv_header_filename, get_tmpdir().c_str(), FL_PATH_MAX);
|
||||
fl_strlcat(sv_header_filename, "source_view_tmp.h", FL_PATH_MAX);
|
||||
}
|
||||
if (!sv_design_filename) {
|
||||
sv_design_filename = (char*)malloc(FL_PATH_MAX);
|
||||
fluid_prefs.getUserdataPath(sv_design_filename, FL_PATH_MAX);
|
||||
fl_strlcpy(sv_design_filename, get_tmpdir().c_str(), FL_PATH_MAX);
|
||||
fl_strlcat(sv_design_filename, "source_view_tmp.fl", FL_PATH_MAX);
|
||||
}
|
||||
|
||||
@@ -123,8 +123,9 @@ and load those into the Code Viewer widgets.} open return_type void
|
||||
sv_project->scroll(top, 0);
|
||||
} else if (sv_strings->visible_r()) {
|
||||
static const char *exts[] = { ".txt", ".po", ".msg" };
|
||||
char fn[FL_PATH_MAX];
|
||||
fluid_prefs.getUserdataPath(fn, FL_PATH_MAX);
|
||||
char fn[FL_PATH_MAX+1];
|
||||
fl_strlcpy(fn, get_tmpdir().c_str(), FL_PATH_MAX);
|
||||
fl_strlcat(fn, "strings", FL_PATH_MAX);
|
||||
fl_filename_setext(fn, FL_PATH_MAX, exts[g_project.i18n_type]);
|
||||
write_strings(fn);
|
||||
int top = sv_strings->top_line();
|
||||
|
||||
+40
-14
@@ -233,7 +233,9 @@ Fl_Preferences::Root Fl_Preferences::filename( char *buffer, size_t buffer_size,
|
||||
<tt>\<null\>/Library/Preferences/\$(vendor)/\$(application).prefs</tt>,
|
||||
which would silently fail to create a preference file.
|
||||
|
||||
\param[in] root can be \c USER_L or \c SYSTEM_L for user specific or system wide preferences
|
||||
\param[in] root can be \c USER_L or \c SYSTEM_L for user specific or system
|
||||
wide preferences, add the CLEAR flag to start with a clean set of
|
||||
preferences instead of reading them from the database
|
||||
\param[in] vendor unique text describing the company or author of this file, must be a valid filepath segment
|
||||
\param[in] application unique text describing the application, must be a valid filepath segment
|
||||
|
||||
@@ -246,19 +248,41 @@ Fl_Preferences::Fl_Preferences( Root root, const char *vendor, const char *appli
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Use this constructor to create or read a preference file at an
|
||||
arbitrary position in the file system.
|
||||
\brief Deprecated: Use this constructor to create or read a preference file at an
|
||||
arbitrary position in the file system.
|
||||
|
||||
The file name is generated in the form <tt>\$(path)/\$(application).prefs</tt>.
|
||||
If \p application is \c NULL, \p path is taken literally as the file path and name.
|
||||
This constructor should no longer be used because the generated database uses
|
||||
the current locale, making it impossible to exchange floating point settings
|
||||
between machines with different language settings.
|
||||
|
||||
\param[in] path path to the directory that contains the preference file
|
||||
\param[in] vendor unique text describing the company or author of this file, must be a valid filepath segment
|
||||
\param[in] application unique text describing the application, must be a valid filepath segment
|
||||
Use `Fl_Preferences(path, vendor, application, C_LOCALE)` in new projects and
|
||||
`Fl_Preferences(path, vendor, application, 0)` if you must keep backward
|
||||
compatibility.
|
||||
|
||||
\see Fl_Preferences( const char *path, const char *vendor, const char *application, Root flags )
|
||||
*/
|
||||
Fl_Preferences::Fl_Preferences( const char *path, const char *vendor, const char *application ) {
|
||||
node = new Node( "." );
|
||||
rootNode = new RootNode( this, path, vendor, application );
|
||||
rootNode = new RootNode( this, path, vendor, application, (Root)0 );
|
||||
node->setRoot(rootNode);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Use this constructor to create or read a preference file at an
|
||||
arbitrary position in the file system.
|
||||
|
||||
The file name is generated in the form <tt>\$(path)/\$(application).prefs</tt>.
|
||||
If \p application is \c NULL, \p path is taken literally as the file path and name.
|
||||
|
||||
\param[in] path path to the directory that contains the preference file
|
||||
\param[in] vendor unique text describing the company or author of this file, must be a valid filepath segment
|
||||
\param[in] application unique text describing the application, must be a valid filename or NULL
|
||||
\param[in] set C_LOCALE to make the preferences file independent of the current locale,
|
||||
add the CLEAR flag to start with a clean set of preferences instead of reading from the database
|
||||
*/
|
||||
Fl_Preferences::Fl_Preferences( const char *path, const char *vendor, const char *application, Root flags ) {
|
||||
node = new Node( "." );
|
||||
rootNode = new RootNode( this, path, vendor, application, flags );
|
||||
node->setRoot(rootNode);
|
||||
}
|
||||
|
||||
@@ -1168,23 +1192,24 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
|
||||
filename_(0L),
|
||||
vendor_(0L),
|
||||
application_(0L),
|
||||
root_type_(root)
|
||||
root_type_((Root)(root & ~CLEAR))
|
||||
{
|
||||
char *filename = Fl::system_driver()->preference_rootnode(prefs, root, vendor, application);
|
||||
filename_ = filename ? fl_strdup(filename) : 0L;
|
||||
vendor_ = fl_strdup(vendor);
|
||||
application_ = fl_strdup(application);
|
||||
read();
|
||||
if ( (root & CLEAR) == 0 )
|
||||
read();
|
||||
}
|
||||
|
||||
// create the root node
|
||||
// - construct the name of the file that will hold our preferences
|
||||
Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, const char *path, const char *vendor, const char *application )
|
||||
Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, const char *path, const char *vendor, const char *application, Root flags )
|
||||
: prefs_(prefs),
|
||||
filename_(0L),
|
||||
vendor_(0L),
|
||||
application_(0L),
|
||||
root_type_(Fl_Preferences::USER)
|
||||
root_type_( (Root)(USER | (flags & C_LOCALE) ))
|
||||
{
|
||||
|
||||
if (!vendor)
|
||||
@@ -1199,7 +1224,8 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, const char *path, con
|
||||
}
|
||||
vendor_ = fl_strdup(vendor);
|
||||
application_ = fl_strdup(application);
|
||||
read();
|
||||
if ( (flags & CLEAR) == 0 )
|
||||
read();
|
||||
}
|
||||
|
||||
// create a root node that exists only on RAM and can not be read or written to
|
||||
|
||||
@@ -367,3 +367,4 @@ Fl_String fl_getcwd() {
|
||||
fl_getcwd(buffer, FL_PATH_MAX);
|
||||
return Fl_String(buffer);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -392,7 +392,7 @@ tree->clear_changed();} open
|
||||
tooltip {Test tree} xywh {15 22 320 539} box DOWN_BOX color 55 selection_color 15
|
||||
class Fl_Tree
|
||||
} {}
|
||||
Fl_Group {} {open selected
|
||||
Fl_Group {} {open
|
||||
xywh {350 5 681 556}
|
||||
code0 {o->resizable(0);}
|
||||
} {
|
||||
@@ -780,7 +780,7 @@ Fl::visible_focus(onoff);}
|
||||
}
|
||||
}
|
||||
Fl_Group {} {
|
||||
label {Test Operations}
|
||||
label {Test Operations} open selected
|
||||
tooltip {These controls only affect the defaults for new items that are created. These test the Fl_Tree_Prefs methods.} xywh {350 435 330 125} box GTK_DOWN_BOX color 47 labelsize 12
|
||||
} {
|
||||
Fl_Group showitem_box {
|
||||
@@ -847,7 +847,7 @@ tree->redraw();}
|
||||
callback {const char *filename = fl_file_chooser("Select a Preferences style Database", "Preferences(*.prefs)", 0L);
|
||||
if (filename) {
|
||||
tree->clear();
|
||||
Fl_Preferences prefs(filename, 0L, 0L);
|
||||
Fl_Preferences prefs(filename, 0L, 0L, Fl_Preferences::C_LOCALE);
|
||||
tree->load(prefs);
|
||||
tree->redraw();
|
||||
}}
|
||||
|
||||
@@ -278,7 +278,7 @@ TEST(fl_filename, relative) {
|
||||
r = fl_filename_relative("../foo.txt", base);
|
||||
EXPECT_STREQ(r.c_str(), "../foo.txt");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
TEST(fl_filename, absolute) {
|
||||
Fl_String base = "/var/tmp/somedir";
|
||||
@@ -293,6 +293,7 @@ TEST(fl_filename, absolute) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool cb1a_ok = false, cb1b_ok = false, cb1c_ok = false;
|
||||
int cb1_alloc = 0;
|
||||
class MyString : public Fl_String {
|
||||
|
||||
Reference in New Issue
Block a user