diff options
Diffstat (limited to 'fluid/app')
| -rw-r--r-- | fluid/app/Image_Asset.cxx | 16 | ||||
| -rw-r--r-- | fluid/app/Image_Asset.h | 16 | ||||
| -rw-r--r-- | fluid/app/Menu.cxx | 8 | ||||
| -rw-r--r-- | fluid/app/Snap_Action.cxx | 300 | ||||
| -rw-r--r-- | fluid/app/Snap_Action.h | 35 | ||||
| -rw-r--r-- | fluid/app/args.cxx | 8 | ||||
| -rw-r--r-- | fluid/app/args.h | 6 | ||||
| -rw-r--r-- | fluid/app/history.cxx | 6 | ||||
| -rw-r--r-- | fluid/app/history.h | 6 | ||||
| -rw-r--r-- | fluid/app/shell_command.cxx | 18 | ||||
| -rw-r--r-- | fluid/app/shell_command.h | 24 | ||||
| -rw-r--r-- | fluid/app/templates.cxx | 4 | ||||
| -rw-r--r-- | fluid/app/templates.h | 6 |
13 files changed, 210 insertions, 243 deletions
diff --git a/fluid/app/Image_Asset.cxx b/fluid/app/Image_Asset.cxx index 36fa4d443..31847a416 100644 --- a/fluid/app/Image_Asset.cxx +++ b/fluid/app/Image_Asset.cxx @@ -109,7 +109,7 @@ static struct { \param fmt short name of file contents for error message \return 0 if the file could not be opened or read */ -size_t Image_Asset::write_static_binary(fld::io::Code_Writer& f, const char* fmt) { +size_t Image_Asset::write_static_binary(Code_Writer& f, const char* fmt) { size_t nData = 0; Fluid.proj.enter_project_dir(); FILE *in = fl_fopen(filename(), "rb"); @@ -143,7 +143,7 @@ size_t Image_Asset::write_static_binary(fld::io::Code_Writer& f, const char* fmt \param fmt short name of file contents for error message \return 0 if the file could not be opened or read */ -size_t Image_Asset::write_static_text(fld::io::Code_Writer& f, const char* fmt) { +size_t Image_Asset::write_static_text(Code_Writer& f, const char* fmt) { size_t nData = 0; Fluid.proj.enter_project_dir(); FILE *in = fl_fopen(filename(), "rb"); @@ -180,7 +180,7 @@ size_t Image_Asset::write_static_text(fld::io::Code_Writer& f, const char* fmt) \param fmt short name of file contents for error message \return 0 if the file could not be opened or read */ -void Image_Asset::write_static_rgb(fld::io::Code_Writer& f, const char* idata_name) { +void Image_Asset::write_static_rgb(Code_Writer& f, const char* idata_name) { // Write image data... f.write_c("\n"); f.write_c_once("#include <FL/Fl_Image.H>\n"); @@ -206,7 +206,7 @@ void Image_Asset::write_static_rgb(fld::io::Code_Writer& f, const char* idata_na \param f Write code to this C++ source code file \param compressed write data in the original compressed file format */ -void Image_Asset::write_static(fld::io::Code_Writer& f, int compressed) { +void Image_Asset::write_static(Code_Writer& f, int compressed) { if (!image_) return; const char *idata_name = f.unique_id(this, "idata", fl_filename_name(filename()), 0); if (initializer_function_) free(initializer_function_); @@ -340,7 +340,7 @@ void Image_Asset::write_static(fld::io::Code_Writer& f, int compressed) { \param f The C++ source code file to write the warning message to. \param fmt The format string for the image file type. */ -void Image_Asset::write_file_error(fld::io::Code_Writer& f, const char *fmt) { +void Image_Asset::write_file_error(Code_Writer& f, const char *fmt) { f.write_c("#warning Cannot read %s file \"%s\": %s\n", fmt, filename(), strerror(errno)); Fluid.proj.enter_project_dir(); f.write_c("// Searching in path \"%s\"\n", fl_getcwd(0, FL_PATH_MAX)); @@ -367,7 +367,7 @@ void Image_Asset::write_file_error(fld::io::Code_Writer& f, const char *fmt) { \param image_class Name of the Fl_Image class, for example Fl_GIF_Image. \param format Format string for additional parameters for the constructor. */ -void Image_Asset::write_initializer(fld::io::Code_Writer& f, const char *image_class, const char *format, ...) { +void Image_Asset::write_initializer(Code_Writer& f, const char *image_class, const char *format, ...) { va_list ap; va_start(ap, format); f.write_c("static Fl_Image *%s() {\n", initializer_function_); @@ -395,7 +395,7 @@ void Image_Asset::write_initializer(fld::io::Code_Writer& f, const char *image_c \param var Name of the Fl_Widget or Fl_Menu_Item to attach the image to. \param inactive If true, use deimage() instead of image(). */ -void Image_Asset::write_code(fld::io::Code_Writer& f, int bind, const char *var, int inactive) { +void Image_Asset::write_code(Code_Writer& f, int bind, const char *var, int inactive) { if (image_) { f.write_c("%s%s->%s%s( %s() );\n", f.indent(), @@ -421,7 +421,7 @@ void Image_Asset::write_code(fld::io::Code_Writer& f, int bind, const char *var, \param f Write the C++ code to this file. \param inactive Unused. */ -void Image_Asset::write_inline(fld::io::Code_Writer& f, int inactive) { +void Image_Asset::write_inline(Code_Writer& f, int inactive) { (void)inactive; if (image_) { f.write_c("%s()", initializer_function_); diff --git a/fluid/app/Image_Asset.h b/fluid/app/Image_Asset.h index 1d6909a70..c393109d3 100644 --- a/fluid/app/Image_Asset.h +++ b/fluid/app/Image_Asset.h @@ -38,20 +38,20 @@ private: // member variables private: // methods Image_Asset(const char *name); // no public constructor ~Image_Asset(); // no public destructor - size_t write_static_binary(fld::io::Code_Writer& f, const char* fmt); - size_t write_static_text(fld::io::Code_Writer& f, const char* fmt); - void write_static_rgb(fld::io::Code_Writer& f, const char* idata_name); + size_t write_static_binary(Code_Writer& f, const char* fmt); + size_t write_static_text(Code_Writer& f, const char* fmt); + void write_static_rgb(Code_Writer& f, const char* idata_name); public: // methods static Image_Asset* find(const char *); void dec_ref(); // reference counting & automatic free void inc_ref(); Fl_Shared_Image *image() const { return image_; } - void write_static(fld::io::Code_Writer& f, int compressed); - void write_initializer(fld::io::Code_Writer& f, const char *type_name, const char *format, ...); - void write_code(fld::io::Code_Writer& f, int bind, const char *var, int inactive = 0); - void write_inline(fld::io::Code_Writer& f, int inactive = 0); - void write_file_error(fld::io::Code_Writer& f, const char *fmt); + void write_static(Code_Writer& f, int compressed); + void write_initializer(Code_Writer& f, const char *type_name, const char *format, ...); + void write_code(Code_Writer& f, int bind, const char *var, int inactive = 0); + void write_inline(Code_Writer& f, int inactive = 0); + void write_file_error(Code_Writer& f, const char *fmt); const char *filename() const { return filename_ ? filename_ : ""; } }; diff --git a/fluid/app/Menu.cxx b/fluid/app/Menu.cxx index 54db5801f..fc5fad4b2 100644 --- a/fluid/app/Menu.cxx +++ b/fluid/app/Menu.cxx @@ -49,7 +49,7 @@ void about_cb(Fl_Widget *, void *) { Fluid.about(); } void help_cb(Fl_Widget *, void *) { Fluid.show_help("fluid.html"); } -static void save_template_cb(Fl_Widget *, void *) { fld::app::save_template(); } +static void save_template_cb(Fl_Widget *, void *) { save_template(); } void mergeback_cb(Fl_Widget *, void *); void manual_cb(Fl_Widget *, void *) { @@ -85,7 +85,7 @@ void toggle_widgetbin_cb(Fl_Widget *, void *) { Fluid.toggle_widget_bin(); } \todo Shortcuts are all over the place (Alt, Ctrl, Command, Shift-Ctrl, function keys), and there should be a help page listing all shortcuts. */ -Fl_Menu_Item fld::Application::main_menu[] = { +Fl_Menu_Item Application::main_menu[] = { {"&File",0,0,0,FL_SUBMENU}, {"&New", FL_COMMAND+'n', menu_file_new_cb}, {"&Open...", FL_COMMAND+'o', menu_file_open_cb}, @@ -113,8 +113,8 @@ Fl_Menu_Item fld::Application::main_menu[] = { {"&Quit", FL_COMMAND+'q', exit_cb}, {0}, {"&Edit",0,0,0,FL_SUBMENU}, - {"&Undo", FL_COMMAND+'z', fld::proj::Undo::undo_cb}, - {"&Redo", FL_COMMAND+FL_SHIFT+'z', fld::proj::Undo::redo_cb, 0, FL_MENU_DIVIDER}, + {"&Undo", FL_COMMAND+'z', Undo::undo_cb}, + {"&Redo", FL_COMMAND+FL_SHIFT+'z', Undo::redo_cb, 0, FL_MENU_DIVIDER}, {"C&ut", FL_COMMAND+'x', cut_cb}, {"&Copy", FL_COMMAND+'c', copy_cb}, {"&Paste", FL_COMMAND+'v', paste_cb}, diff --git a/fluid/app/Snap_Action.cxx b/fluid/app/Snap_Action.cxx index 39a328b24..db68d6dd1 100644 --- a/fluid/app/Snap_Action.cxx +++ b/fluid/app/Snap_Action.cxx @@ -45,10 +45,10 @@ void select_layout_suite_cb(Fl_Widget *, void *user_data); -int fld::app::Snap_Action::eex = 0; -int fld::app::Snap_Action::eey = 0; +int Snap_Action::eex = 0; +int Snap_Action::eey = 0; -static fld::app::Layout_Preset fltk_app = { +static Layout_Preset fltk_app = { 15, 15, 15, 15, 0, 0, // window: l, r, t, b, gx, gy 10, 10, 10, 10, 0, 0, // group: l, r, t, b, gx, gy 25, 25, // tabs: t, b @@ -56,7 +56,7 @@ static fld::app::Layout_Preset fltk_app = { 20, 4, 8, // widget_y: min, inc, gap 0, 14, -1, 14 // labelfont/size, textfont/size }; -static fld::app::Layout_Preset fltk_dlg = { +static Layout_Preset fltk_dlg = { 10, 10, 10, 10, 0, 0, // window: l, r, t, b, gx, gy 10, 10, 10, 10, 0, 0, // group: l, r, t, b, gx, gy 20, 20, // tabs: t, b @@ -64,7 +64,7 @@ static fld::app::Layout_Preset fltk_dlg = { 20, 5, 5, // widget_y: min, inc, gap 0, 11, -1, 11 // labelfont/size, textfont/size }; -static fld::app::Layout_Preset fltk_tool = { +static Layout_Preset fltk_tool = { 10, 10, 10, 10, 0, 0, // window: l, r, t, b, gx, gy 10, 10, 10, 10, 0, 0, // group: l, r, t, b, gx, gy 18, 18, // tabs: t, b @@ -73,7 +73,7 @@ static fld::app::Layout_Preset fltk_tool = { 0, 10, -1, 10 // labelfont/size, textfont/size }; -static fld::app::Layout_Preset grid_app = { +static Layout_Preset grid_app = { 12, 12, 12, 12, 12, 12, // window: l, r, t, b, gx, gy 12, 12, 12, 12, 12, 12, // group: l, r, t, b, gx, gy 24, 24, // tabs: t, b @@ -82,7 +82,7 @@ static fld::app::Layout_Preset grid_app = { 0, 14, -1, 14 // labelfont/size, textfont/size }; -static fld::app::Layout_Preset grid_dlg = { +static Layout_Preset grid_dlg = { 10, 10, 10, 10, 10, 10, // window: l, r, t, b, gx, gy 10, 10, 10, 10, 10, 10, // group: l, r, t, b, gx, gy 20, 20, // tabs: t, b @@ -91,7 +91,7 @@ static fld::app::Layout_Preset grid_dlg = { 0, 12, -1, 12 // labelfont/size, textfont/size }; -static fld::app::Layout_Preset grid_tool = { +static Layout_Preset grid_tool = { 8, 8, 8, 8, 8, 8, // window: l, r, t, b, gx, gy 8, 8, 8, 8, 8, 8, // group: l, r, t, b, gx, gy 16, 16, // tabs: t, b @@ -100,9 +100,9 @@ static fld::app::Layout_Preset grid_tool = { 0, 10, -1, 10 // labelfont/size, textfont/size }; -fld::app::Layout_Preset *fld::app::default_layout_preset = &fltk_app; +Layout_Preset *default_layout_preset = &fltk_app; -static fld::app::Layout_Suite static_suite_list[] = { +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 } }; @@ -154,12 +154,12 @@ void edit_layout_preset_cb(Fl_Button *w, void *user_data) { } } -// ---- fld::app::Layout_Suite ------------------------------------------------ MARK: - +// ---- Layout_Suite ------------------------------------------------ MARK: - /** Write presets to a Preferences database. */ -void fld::app::Layout_Preset::write(Fl_Preferences &prefs) { +void Layout_Preset::write(Fl_Preferences &prefs) { assert(this); Fl_Preferences p_win(prefs, "Window"); p_win.set("left_margin", left_window_margin); @@ -199,7 +199,7 @@ void fld::app::Layout_Preset::write(Fl_Preferences &prefs) { /** Read presets from a Preferences database. */ -void fld::app::Layout_Preset::read(Fl_Preferences &prefs) { +void Layout_Preset::read(Fl_Preferences &prefs) { assert(this); Fl_Preferences p_win(prefs, "Window"); p_win.get("left_margin", left_window_margin, 15); @@ -239,7 +239,7 @@ void fld::app::Layout_Preset::read(Fl_Preferences &prefs) { /** Write presets to an .fl project file. */ -void fld::app::Layout_Preset::write(fld::io::Project_Writer *out) { +void Layout_Preset::write(Project_Writer *out) { out->write_string(" preset { 1\n"); // preset format version out->write_string(" %d %d %d %d %d %d\n", left_window_margin, right_window_margin, @@ -261,7 +261,7 @@ void fld::app::Layout_Preset::write(fld::io::Project_Writer *out) { /** Read presets from an .fl project file. */ -void fld::app::Layout_Preset::read(fld::io::Project_Reader *in) { +void Layout_Preset::read(Project_Reader *in) { const char *key; key = in->read_word(1); if (key && !strcmp(key, "{")) { @@ -317,7 +317,7 @@ void fld::app::Layout_Preset::read(fld::io::Project_Reader *in) { /** Return the preferred text size, but make sure it's not 0. */ -int fld::app::Layout_Preset::textsize_not_null() { +int Layout_Preset::textsize_not_null() { // try the user selected text size if (textsize > 0) return textsize; // if the user did not set one, try the label size @@ -327,12 +327,12 @@ int fld::app::Layout_Preset::textsize_not_null() { } -// ---- fld::app::Layout_Suite ------------------------------------------------ MARK: - +// ---- Layout_Suite ------------------------------------------------ MARK: - /** Write a presets suite to a Preferences database. */ -void fld::app::Layout_Suite::write(Fl_Preferences &prefs) { +void Layout_Suite::write(Fl_Preferences &prefs) { assert(this); assert(name_); prefs.set("name", name_); @@ -347,7 +347,7 @@ void fld::app::Layout_Suite::write(Fl_Preferences &prefs) { /** Read a presets suite from a Preferences database. */ -void fld::app::Layout_Suite::read(Fl_Preferences &prefs) { +void Layout_Suite::read(Fl_Preferences &prefs) { assert(this); int i; for (i = 0; i < 3; ++i) { @@ -360,7 +360,7 @@ void fld::app::Layout_Suite::read(Fl_Preferences &prefs) { /** Write a presets suite to an .fl project file. */ -void fld::app::Layout_Suite::write(fld::io::Project_Writer *out) { +void Layout_Suite::write(Project_Writer *out) { out->write_string(" suite {\n"); out->write_string(" name "); out->write_word(name_); out->write_string("\n"); int i; @@ -373,7 +373,7 @@ void fld::app::Layout_Suite::write(fld::io::Project_Writer *out) { /** Read a presets suite from an .fl project file. */ -void fld::app::Layout_Suite::read(fld::io::Project_Reader *in) { +void Layout_Suite::read(Project_Reader *in) { const char *key; key = in->read_word(1); if (key && !strcmp(key, "{")) { @@ -401,7 +401,7 @@ void fld::app::Layout_Suite::read(fld::io::Project_Reader *in) { \brief Update the menu_label to show a symbol representing the storage location. Also updates the FLUID user interface. */ -void fld::app::Layout_Suite::update_label() { +void Layout_Suite::update_label() { const char *sym = ""; switch (storage_) { case FLD_TOOL_STORE_INTERNAL: sym = "@fd_beaker "; break; @@ -421,7 +421,7 @@ void fld::app::Layout_Suite::update_label() { \brief Update the Suite name and the Suite menu_label. Also updates the FLUID user interface. */ -void fld::app::Layout_Suite::name(const char *n) { +void Layout_Suite::name(const char *n) { if (name_) ::free(name_); if (n) @@ -434,7 +434,7 @@ void fld::app::Layout_Suite::name(const char *n) { /** Initialize the class for first use. */ -void fld::app::Layout_Suite::init() { +void Layout_Suite::init() { name_ = 0; menu_label = 0; layout[0] = layout[1] = layout[2] = 0; @@ -444,7 +444,7 @@ void fld::app::Layout_Suite::init() { /** Free all allocated resources. */ -fld::app::Layout_Suite::~Layout_Suite() { +Layout_Suite::~Layout_Suite() { if (storage_ == FLD_TOOL_STORE_INTERNAL) return; if (name_) ::free(name_); int i; @@ -453,7 +453,7 @@ fld::app::Layout_Suite::~Layout_Suite() { } } -// ---- fld::app::Layout_List ------------------------------------------------- MARK: - +// ---- Layout_List ------------------------------------------------- MARK: - /** Draw a little FLUID beaker symbol. @@ -596,7 +596,7 @@ void fd_file(Fl_Color c) { /** Instantiate the class that holds a list of all layouts and manages the UI. */ -fld::app::Layout_List::Layout_List() +Layout_List::Layout_List() : main_menu_(main_layout_submenu_), choice_menu_(static_choice_menu), list_(static_suite_list), @@ -615,16 +615,16 @@ fld::app::Layout_List::Layout_List() /** Release allocated resources. */ -fld::app::Layout_List::~Layout_List() { +Layout_List::~Layout_List() { assert(this); if (!list_is_static_) { ::free(main_menu_); ::free(choice_menu_); int i; for (i = 0; i < list_size_; i++) { - fld::app::Layout_Suite &suite = list_[i]; + Layout_Suite &suite = list_[i]; if (suite.storage_ != FLD_TOOL_STORE_INTERNAL) - suite.fld::app::Layout_Suite::~Layout_Suite(); + suite.Layout_Suite::~Layout_Suite(); } ::free(list_); } @@ -633,7 +633,7 @@ fld::app::Layout_List::~Layout_List() { /** Update the Setting dialog and menus to reflect the current Layout selection state. */ -void fld::app::Layout_List::update_dialogs() { +void Layout_List::update_dialogs() { static Fl_Menu_Item *preset_menu = 0; if (!preset_menu) { preset_menu = (Fl_Menu_Item*)Fluid.main_menubar->find_item(select_layout_preset_cb); @@ -657,7 +657,7 @@ void fld::app::Layout_List::update_dialogs() { /** Refresh the label pointers for both pulldown menus. */ -void fld::app::Layout_List::update_menu_labels() { +void Layout_List::update_menu_labels() { int i; for (i =0; i<list_size_; i++) { main_menu_[i].label(list_[i].menu_label); @@ -668,7 +668,7 @@ void fld::app::Layout_List::update_menu_labels() { /** Load all user layouts from the FLUID user preferences. */ -int fld::app::Layout_List::load(const char *filename) { +int Layout_List::load(const char *filename) { remove_all(FLD_TOOL_STORE_FILE); Fl_Preferences prefs(filename, "layout.fluid.fltk.org", 0, Fl_Preferences::C_LOCALE); read(prefs, FLD_TOOL_STORE_FILE); @@ -678,7 +678,7 @@ int fld::app::Layout_List::load(const char *filename) { /** Save all user layouts to the FLUID user preferences. */ -int fld::app::Layout_List::save(const char *filename) { +int Layout_List::save(const char *filename) { assert(this); Fl_Preferences prefs(filename, "layout.fluid.fltk.org", 0, (Fl_Preferences::Root)(Fl_Preferences::C_LOCALE|Fl_Preferences::CLEAR)); prefs.clear(); @@ -689,7 +689,7 @@ int fld::app::Layout_List::save(const char *filename) { /** Write Suite and Layout selection and selected layout data to Preferences database. */ -void fld::app::Layout_List::write(Fl_Preferences &prefs, fld::Tool_Store storage) { +void Layout_List::write(Fl_Preferences &prefs, Tool_Store storage) { Fl_Preferences prefs_list(prefs, "Layouts"); prefs_list.clear(); prefs_list.set("current_suite", list_[current_suite()].name_); @@ -697,7 +697,7 @@ void fld::app::Layout_List::write(Fl_Preferences &prefs, fld::Tool_Store storage int n = 0; int i; for (i = 0; i < list_size_; ++i) { - fld::app::Layout_Suite &suite = list_[i]; + Layout_Suite &suite = list_[i]; if (suite.storage_ == storage) { Fl_Preferences prefs_suite(prefs_list, Fl_Preferences::Name(n++)); suite.write(prefs_suite); @@ -708,7 +708,7 @@ void fld::app::Layout_List::write(Fl_Preferences &prefs, fld::Tool_Store storage /** Read Suite and Layout selection and selected layout data to Preferences database. */ -void fld::app::Layout_List::read(Fl_Preferences &prefs, fld::Tool_Store storage) { +void Layout_List::read(Fl_Preferences &prefs, Tool_Store storage) { Fl_Preferences prefs_list(prefs, "Layouts"); char *cs_ptr = 0; int cp = 0; @@ -737,7 +737,7 @@ void fld::app::Layout_List::read(Fl_Preferences &prefs, fld::Tool_Store storage) /** Write Suite and Layout selection and project layout data to an .fl project file. */ -void fld::app::Layout_List::write(fld::io::Project_Writer *out) { +void Layout_List::write(Project_Writer *out) { // Don't write the Snap field if no custom layout was used int i; if ((current_suite()==0) && (current_preset()==0)) { @@ -751,7 +751,7 @@ void fld::app::Layout_List::write(fld::io::Project_Writer *out) { out->write_string(" current_suite "); out->write_word(list_[current_suite()].name_); out->write_string("\n"); out->write_string(" current_preset %d\n", current_preset()); for (i =0; i<list_size_; i++) { - fld::app::Layout_Suite &suite = list_[i]; + Layout_Suite &suite = list_[i]; if (suite.storage_ == FLD_TOOL_STORE_PROJECT) suite.write(out); } @@ -761,7 +761,7 @@ void fld::app::Layout_List::write(fld::io::Project_Writer *out) { /** Read Suite and Layout selection and project layout data from an .fl project file. */ -void fld::app::Layout_List::read(fld::io::Project_Reader *in) { +void Layout_List::read(Project_Reader *in) { const char *key; key = in->read_word(1); if (key && !strcmp(key, "{")) { @@ -798,7 +798,7 @@ void fld::app::Layout_List::read(fld::io::Project_Reader *in) { Set the current Suite. \param[in] ix index into list of suites */ -void fld::app::Layout_List::current_suite(int ix) { +void Layout_List::current_suite(int ix) { assert(ix >= 0); assert(ix < list_size_); current_suite_ = ix; @@ -810,11 +810,11 @@ void fld::app::Layout_List::current_suite(int ix) { \param[in] arg_name name of the selected suite \return if no name is given or the name is not found, keep the current suite selected */ -void fld::app::Layout_List::current_suite(const char *arg_name) { +void Layout_List::current_suite(const char *arg_name) { if (!arg_name || !arg_name[0]) return; int i; for (i = 0; i < list_size_; ++i) { - fld::app::Layout_Suite &suite = list_[i]; + Layout_Suite &suite = list_[i]; if (suite.name_ && (strcmp(suite.name_, arg_name) == 0)) { current_suite(i); break; @@ -826,7 +826,7 @@ void fld::app::Layout_List::current_suite(const char *arg_name) { Select a Preset within the current Suite. \param[in] ix 0 = application, 1 = dialog, 2 = toolbox */ -void fld::app::Layout_List::current_preset(int ix) { +void Layout_List::current_preset(int ix) { assert(ix >= 0); assert(ix < 3); current_preset_ = ix; @@ -836,7 +836,7 @@ void fld::app::Layout_List::current_preset(int ix) { /** Allocate enough space for n entries in the list. */ -void fld::app::Layout_List::capacity(int n) { +void Layout_List::capacity(int n) { static Fl_Menu_Item *suite_menu = 0; if (!suite_menu) suite_menu = (Fl_Menu_Item*)Fluid.main_menubar->find_item(layout_suite_marker); @@ -844,7 +844,7 @@ void fld::app::Layout_List::capacity(int n) { int old_n = list_size_; int i; - fld::app::Layout_Suite *new_list = (fld::app::Layout_Suite*)::calloc(n, sizeof(fld::app::Layout_Suite)); + Layout_Suite *new_list = (Layout_Suite*)::calloc(n, sizeof(Layout_Suite)); for (i = 0; i < old_n; i++) new_list[i] = list_[i]; if (!list_is_static_) ::free(list_); @@ -872,21 +872,21 @@ void fld::app::Layout_List::capacity(int n) { \brief Clone the currently selected suite and append it to the list. Selects the new layout and updates the UI. */ -int fld::app::Layout_List::add(const char *name) { +int Layout_List::add(const char *name) { if (list_size_ == list_capacity_) { capacity(list_capacity_ * 2); } int n = list_size_; - fld::app::Layout_Suite &old_suite = list_[current_suite_]; - fld::app::Layout_Suite &new_suite = list_[n]; + Layout_Suite &old_suite = list_[current_suite_]; + Layout_Suite &new_suite = list_[n]; new_suite.init(); new_suite.name(name); int i; for (i =0; i<3; ++i) { - new_suite.layout[i] = new fld::app::Layout_Preset; - ::memcpy(new_suite.layout[i], old_suite.layout[i], sizeof(fld::app::Layout_Preset)); + new_suite.layout[i] = new Layout_Preset; + ::memcpy(new_suite.layout[i], old_suite.layout[i], sizeof(Layout_Preset)); } - fld::Tool_Store new_storage = old_suite.storage_; + Tool_Store new_storage = old_suite.storage_; if (new_storage == FLD_TOOL_STORE_INTERNAL) new_storage = FLD_TOOL_STORE_USER; new_suite.storage(new_storage); @@ -903,7 +903,7 @@ int fld::app::Layout_List::add(const char *name) { /** Rename the current Suite. */ -void fld::app::Layout_List::rename(const char *name) { +void Layout_List::rename(const char *name) { int n = current_suite(); list_[n].name(name); main_menu_[n].label(list_[n].menu_label); @@ -914,7 +914,7 @@ void fld::app::Layout_List::rename(const char *name) { Remove the given suite. \param[in] ix index into list of suites */ -void fld::app::Layout_List::remove(int ix) { +void Layout_List::remove(int ix) { int tail = list_size_-ix-1; if (tail) { int i; @@ -932,7 +932,7 @@ void fld::app::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. */ -void fld::app::Layout_List::remove_all(fld::Tool_Store storage) { +void Layout_List::remove_all(Tool_Store storage) { int i; for (i =list_size_-1; i>=0; --i) { if (list_[i].storage_ == storage) @@ -959,19 +959,19 @@ static int nearest(int x, int left, int grid, int right=0x7fff) { return grid_x; } -static bool in_window(fld::app::Snap_Data &d) { +static bool in_window(Snap_Data &d) { return (d.wgt && d.wgt->parent == d.win); } -static bool in_group(fld::app::Snap_Data &d) { +static bool in_group(Snap_Data &d) { return (d.wgt && d.wgt->parent && d.wgt->parent->is_a(FLD_NODE_TYPE_Group) && d.wgt->parent != d.win); } -static bool in_tabs(fld::app::Snap_Data &d) { +static bool in_tabs(Snap_Data &d) { return (d.wgt && d.wgt->parent && d.wgt->parent->is_a(FLD_NODE_TYPE_Tabs)); } -static Fl_Group *parent(fld::app::Snap_Data &d) { +static Fl_Group *parent(Snap_Data &d) { return (d.wgt->o->parent()); } @@ -1002,7 +1002,7 @@ static Fl_Group *parent(fld::app::Snap_Data &d) { \return -1 if this point is closer than any previous check, and this is the new distance to beat. */ -int fld::app::Snap_Action::check_x_(fld::app::Snap_Data &d, int x_ref, int x_snap) { +int Snap_Action::check_x_(Snap_Data &d, int x_ref, int x_snap) { int dd = x_ref + d.dx - x_snap; int d2 = abs(dd); if (d2 > d.x_dist) return 1; @@ -1015,9 +1015,9 @@ int fld::app::Snap_Action::check_x_(fld::app::Snap_Data &d, int x_ref, int x_sna /** \brief Check if a snap action has reached a preferred y position. - \see fld::app::Snap_Action::check_x_(fld::app::Snap_Data &d, int x_ref, int x_snap) + \see Snap_Action::check_x_(Snap_Data &d, int x_ref, int x_snap) */ -int fld::app::Snap_Action::check_y_(fld::app::Snap_Data &d, int y_ref, int y_snap) { +int Snap_Action::check_y_(Snap_Data &d, int y_ref, int y_snap) { int dd = y_ref + d.dy - y_snap; int d2 = abs(dd); if (d2 > d.y_dist) return 1; @@ -1030,9 +1030,9 @@ int fld::app::Snap_Action::check_y_(fld::app::Snap_Data &d, int y_ref, int y_sna /** \brief Check if a snap action has reached a preferred x and y position. - \see fld::app::Snap_Action::check_x_(fld::app::Snap_Data &d, int x_ref, int x_snap) + \see Snap_Action::check_x_(Snap_Data &d, int x_ref, int x_snap) */ -void fld::app::Snap_Action::check_x_y_(fld::app::Snap_Data &d, int x_ref, int x_snap, int y_ref, int y_snap) { +void Snap_Action::check_x_y_(Snap_Data &d, int x_ref, int x_snap, int y_ref, int y_snap) { int ddx = x_ref + d.dx - x_snap; int d2x = abs(ddx); int ddy = y_ref + d.dy - y_snap; @@ -1053,7 +1053,7 @@ void fld::app::Snap_Action::check_x_y_(fld::app::Snap_Data &d, int x_ref, int x_ should be drawn. \param[inout] d current event data */ -bool fld::app::Snap_Action::matches(fld::app::Snap_Data &d) { +bool Snap_Action::matches(Snap_Data &d) { switch (type) { case 1: return (d.drag & mask) && (eex == ex) && (d.dx == dx); case 2: return (d.drag & mask) && (eey == ey) && (d.dy == dy); @@ -1066,7 +1066,7 @@ bool fld::app::Snap_Action::matches(fld::app::Snap_Data &d) { \brief Run through all possible snap actions and store the winning coordinates in eex and eey. \param[inout] d current event data */ -void fld::app::Snap_Action::check_all(fld::app::Snap_Data &data) { +void Snap_Action::check_all(Snap_Data &data) { int i; for (i =0; list[i]; i++) { if (list[i]->mask & data.drag) @@ -1083,7 +1083,7 @@ void fld::app::Snap_Action::check_all(fld::app::Snap_Data &data) { coordinate, all of them will be drawn. \param[inout] d current event data */ -void fld::app::Snap_Action::draw_all(fld::app::Snap_Data &data) { +void Snap_Action::draw_all(Snap_Data &data) { int i; for (i =0; list[i]; i++) { if (list[i]->matches(data)) @@ -1092,8 +1092,8 @@ void fld::app::Snap_Action::draw_all(fld::app::Snap_Data &data) { } /** Return a sensible step size for resizing a widget. */ -void fld::app::Snap_Action::get_resize_stepsize(int &x_step, int &y_step) { - fld::app::Layout_Preset *layout = Fluid.proj.layout; +void Snap_Action::get_resize_stepsize(int &x_step, int &y_step) { + Layout_Preset *layout = Fluid.proj.layout; if ((layout->widget_inc_w > 1) && (layout->widget_inc_h > 1)) { x_step = layout->widget_inc_w; y_step = layout->widget_inc_h; @@ -1107,8 +1107,8 @@ void fld::app::Snap_Action::get_resize_stepsize(int &x_step, int &y_step) { } /** Return a sensible step size for moving a widget. */ -void fld::app::Snap_Action::get_move_stepsize(int &x_step, int &y_step) { - fld::app::Layout_Preset *layout = Fluid.proj.layout; +void Snap_Action::get_move_stepsize(int &x_step, int &y_step) { + Layout_Preset *layout = Fluid.proj.layout; if ((layout->group_grid_x > 1) && (layout->group_grid_y > 1)) { x_step = layout->group_grid_x; y_step = layout->group_grid_y; @@ -1122,8 +1122,8 @@ void fld::app::Snap_Action::get_move_stepsize(int &x_step, int &y_step) { } /** Fix the given size to the same or next bigger snap position. */ -void fld::app::Snap_Action::better_size(int &w, int &h) { - fld::app::Layout_Preset *layout = Fluid.proj.layout; +void Snap_Action::better_size(int &w, int &h) { + Layout_Preset *layout = Fluid.proj.layout; int x_min = 1, y_min = 1, x_inc = 1, y_inc = 1; get_resize_stepsize(x_inc, y_inc); if (x_inc < 1) x_inc = 1; @@ -1148,7 +1148,7 @@ void fld::app::Snap_Action::better_size(int &w, int &h) { /** Base class for all actions that drag the left side or the entire widget. */ -class Fd_Snap_Left : public fld::app::Snap_Action { +class Fd_Snap_Left : public Snap_Action { public: Fd_Snap_Left() { type = 1; mask = FD_LEFT|FD_DRAG; } }; @@ -1156,7 +1156,7 @@ public: /** Base class for all actions that drag the right side or the entire widget. */ -class Fd_Snap_Right : public fld::app::Snap_Action { +class Fd_Snap_Right : public Snap_Action { public: Fd_Snap_Right() { type = 1; mask = FD_RIGHT|FD_DRAG; } }; @@ -1164,7 +1164,7 @@ public: /** Base class for all actions that drag the top side or the entire widget. */ -class Fd_Snap_Top : public fld::app::Snap_Action { +class Fd_Snap_Top : public Snap_Action { public: Fd_Snap_Top() { type = 2; mask = FD_TOP|FD_DRAG; } }; @@ -1172,7 +1172,7 @@ public: /** Base class for all actions that drag the bottom side or the entire widget. */ -class Fd_Snap_Bottom : public fld::app::Snap_Action { +class Fd_Snap_Bottom : public Snap_Action { public: Fd_Snap_Bottom() { type = 2; mask = FD_BOTTOM|FD_DRAG; } }; @@ -1184,8 +1184,8 @@ public: */ class Fd_Snap_Left_Window_Edge : public Fd_Snap_Left { public: - void check(fld::app::Snap_Data &d) { clr(); check_x_(d, d.bx, 0); } - void draw(fld::app::Snap_Data &d) { draw_left_brace(d.win->o); } + void check(Snap_Data &d) { clr(); check_x_(d, d.bx, 0); } + void draw(Snap_Data &d) { draw_left_brace(d.win->o); } }; Fd_Snap_Left_Window_Edge snap_left_window_edge; @@ -1194,8 +1194,8 @@ Fd_Snap_Left_Window_Edge snap_left_window_edge; */ class Fd_Snap_Right_Window_Edge : public Fd_Snap_Right { public: - void check(fld::app::Snap_Data &d) { clr(); check_x_(d, d.br, d.win->o->w()); } - void draw(fld::app::Snap_Data &d) { draw_right_brace(d.win->o); } + void check(Snap_Data &d) { clr(); check_x_(d, d.br, d.win->o->w()); } + void draw(Snap_Data &d) { draw_right_brace(d.win->o); } }; Fd_Snap_Right_Window_Edge snap_right_window_edge; @@ -1204,8 +1204,8 @@ Fd_Snap_Right_Window_Edge snap_right_window_edge; */ class Fd_Snap_Top_Window_Edge : public Fd_Snap_Top { public: - void check(fld::app::Snap_Data &d) { clr(); check_y_(d, d.by, 0); } - void draw(fld::app::Snap_Data &d) { draw_top_brace(d.win->o); } + void check(Snap_Data &d) { clr(); check_y_(d, d.by, 0); } + void draw(Snap_Data &d) { draw_top_brace(d.win->o); } }; Fd_Snap_Top_Window_Edge snap_top_window_edge; @@ -1214,8 +1214,8 @@ Fd_Snap_Top_Window_Edge snap_top_window_edge; */ class Fd_Snap_Bottom_Window_Edge : public Fd_Snap_Bottom { public: - void check(fld::app::Snap_Data &d) { clr(); check_y_(d, d.bt, d.win->o->h()); } - void draw(fld::app::Snap_Data &d) { draw_bottom_brace(d.win->o); } + void check(Snap_Data &d) { clr(); check_y_(d, d.bt, d.win->o->h()); } + void draw(Snap_Data &d) { draw_bottom_brace(d.win->o); } }; Fd_Snap_Bottom_Window_Edge snap_bottom_window_edge; @@ -1224,11 +1224,11 @@ Fd_Snap_Bottom_Window_Edge snap_bottom_window_edge; */ class Fd_Snap_Left_Window_Margin : public Fd_Snap_Left { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { clr(); if (in_window(d)) check_x_(d, d.bx, Fluid.proj.layout->left_window_margin); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { draw_h_arrow(d.bx, (d.by+d.bt)/2, 0); } }; @@ -1236,11 +1236,11 @@ Fd_Snap_Left_Window_Margin snap_left_window_margin; class Fd_Snap_Right_Window_Margin : public Fd_Snap_Right { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { clr(); if (in_window(d)) check_x_(d, d.br, d.win->o->w()-Fluid.proj.layout->right_window_margin); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { draw_h_arrow(d.br, (d.by+d.bt)/2, d.win->o->w()-1); } }; @@ -1248,11 +1248,11 @@ Fd_Snap_Right_Window_Margin snap_right_window_margin; class Fd_Snap_Top_Window_Margin : public Fd_Snap_Top { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { clr(); if (in_window(d)) check_y_(d, d.by, Fluid.proj.layout->top_window_margin); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { draw_v_arrow((d.bx+d.br)/2, d.by, 0); } }; @@ -1260,11 +1260,11 @@ Fd_Snap_Top_Window_Margin snap_top_window_margin; class Fd_Snap_Bottom_Window_Margin : public Fd_Snap_Bottom { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { clr(); if (in_window(d)) check_y_(d, d.bt, d.win->o->h()-Fluid.proj.layout->bottom_window_margin); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { draw_v_arrow((d.bx+d.br)/2, d.bt, d.win->o->h()-1); } }; @@ -1277,11 +1277,11 @@ Fd_Snap_Bottom_Window_Margin snap_bottom_window_margin; */ class Fd_Snap_Left_Group_Edge : public Fd_Snap_Left { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { clr(); if (in_group(d)) check_x_(d, d.bx, parent(d)->x()); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { draw_left_brace(parent(d)); } }; @@ -1289,11 +1289,11 @@ Fd_Snap_Left_Group_Edge snap_left_group_edge; class Fd_Snap_Right_Group_Edge : public Fd_Snap_Right { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { clr(); if (in_group(d)) check_x_(d, d.br, parent(d)->x() + parent(d)->w()); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { draw_right_brace(parent(d)); } }; @@ -1301,11 +1301,11 @@ Fd_Snap_Right_Group_Edge snap_right_group_edge; class Fd_Snap_Top_Group_Edge : public Fd_Snap_Top { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { clr(); if (in_group(d)) check_y_(d, d.by, parent(d)->y()); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { draw_top_brace(parent(d)); } }; @@ -1313,11 +1313,11 @@ Fd_Snap_Top_Group_Edge snap_top_group_edge; class Fd_Snap_Bottom_Group_Edge : public Fd_Snap_Bottom { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { clr(); if (in_group(d)) check_y_(d, d.bt, parent(d)->y() + parent(d)->h()); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { draw_bottom_brace(parent(d)); } }; @@ -1329,11 +1329,11 @@ Fd_Snap_Bottom_Group_Edge snap_bottom_group_edge; */ class Fd_Snap_Left_Group_Margin : public Fd_Snap_Left { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { clr(); if (in_group(d)) check_x_(d, d.bx, parent(d)->x() + Fluid.proj.layout->left_group_margin); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { draw_left_brace(parent(d)); draw_h_arrow(d.bx, (d.by+d.bt)/2, parent(d)->x()); } @@ -1342,11 +1342,11 @@ Fd_Snap_Left_Group_Margin snap_left_group_margin; class Fd_Snap_Right_Group_Margin : public Fd_Snap_Right { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { clr(); if (in_group(d)) check_x_(d, d.br, parent(d)->x()+parent(d)->w()-Fluid.proj.layout->right_group_margin); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { draw_right_brace(parent(d)); draw_h_arrow(d.br, (d.by+d.bt)/2, parent(d)->x()+parent(d)->w()-1); } @@ -1355,11 +1355,11 @@ Fd_Snap_Right_Group_Margin snap_right_group_margin; class Fd_Snap_Top_Group_Margin : public Fd_Snap_Top { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { clr(); if (in_group(d) && !in_tabs(d)) check_y_(d, d.by, parent(d)->y()+Fluid.proj.layout->top_group_margin); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { draw_top_brace(parent(d)); draw_v_arrow((d.bx+d.br)/2, d.by, parent(d)->y()); } @@ -1368,11 +1368,11 @@ Fd_Snap_Top_Group_Margin snap_top_group_margin; class Fd_Snap_Bottom_Group_Margin : public Fd_Snap_Bottom { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { clr(); if (in_group(d) && !in_tabs(d)) check_y_(d, d.bt, parent(d)->y()+parent(d)->h()-Fluid.proj.layout->bottom_group_margin); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { draw_bottom_brace(parent(d)); draw_v_arrow((d.bx+d.br)/2, d.bt, parent(d)->y()+parent(d)->h()-1); } @@ -1386,7 +1386,7 @@ Fd_Snap_Bottom_Group_Margin snap_bottom_group_margin; */ class Fd_Snap_Top_Tabs_Margin : public Fd_Snap_Top_Group_Margin { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { clr(); if (in_tabs(d)) check_y_(d, d.by, parent(d)->y()+Fluid.proj.layout->top_tabs_margin); } @@ -1395,7 +1395,7 @@ Fd_Snap_Top_Tabs_Margin snap_top_tabs_margin; class Fd_Snap_Bottom_Tabs_Margin : public Fd_Snap_Bottom_Group_Margin { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { clr(); if (in_tabs(d)) check_y_(d, d.bt, parent(d)->y()+parent(d)->h()-Fluid.proj.layout->bottom_tabs_margin); } @@ -1407,12 +1407,12 @@ Fd_Snap_Bottom_Tabs_Margin snap_bottom_tabs_margin; /** Base class for grid based snapping. */ -class Fd_Snap_Grid : public fld::app::Snap_Action { +class Fd_Snap_Grid : public Snap_Action { protected: int nearest_x, nearest_y; public: Fd_Snap_Grid() { type = 3; mask = FD_LEFT|FD_TOP|FD_DRAG; } - void check_grid(fld::app::Snap_Data &d, int left, int grid_x, int right, int top, int grid_y, int bottom) { + void check_grid(Snap_Data &d, int left, int grid_x, int right, int top, int grid_y, int bottom) { if ((grid_x <= 1) || (grid_y <= 1)) return; int suggested_x = d.bx + d.dx; nearest_x = nearest(suggested_x, left, grid_x, right); @@ -1425,7 +1425,7 @@ public: else check_x_y_(d, d.bx, nearest_x, d.by, nearest_y); } - bool matches(fld::app::Snap_Data &d) { + bool matches(Snap_Data &d) { if (d.drag == FD_LEFT) return (eex == ex); if (d.drag == FD_TOP) return (eey == ey) && (d.dx == dx); return (d.drag & mask) && (eex == ex) && (d.dx == dx) && (eey == ey) && (d.dy == dy); @@ -1437,14 +1437,14 @@ public: */ class Fd_Snap_Window_Grid : public Fd_Snap_Grid { public: - void check(fld::app::Snap_Data &d) { - fld::app::Layout_Preset *layout = Fluid.proj.layout; + void check(Snap_Data &d) { + Layout_Preset *layout = Fluid.proj.layout; clr(); if (in_window(d)) check_grid(d, layout->left_window_margin, layout->window_grid_x, d.win->o->w()-layout->right_window_margin, layout->top_window_margin, layout->window_grid_y, d.win->o->h()-layout->bottom_window_margin); } - void draw(fld::app::Snap_Data &d) { - fld::app::Layout_Preset *layout = Fluid.proj.layout; + void draw(Snap_Data &d) { + Layout_Preset *layout = Fluid.proj.layout; draw_grid(nearest_x, nearest_y, layout->window_grid_x, layout->window_grid_y); } }; @@ -1455,17 +1455,17 @@ Fd_Snap_Window_Grid snap_window_grid; */ class Fd_Snap_Group_Grid : public Fd_Snap_Grid { public: - void check(fld::app::Snap_Data &d) { + void check(Snap_Data &d) { if (in_group(d)) { - fld::app::Layout_Preset *layout = Fluid.proj.layout; + Layout_Preset *layout = Fluid.proj.layout; clr(); Fl_Widget *g = parent(d); check_grid(d, g->x()+layout->left_group_margin, layout->group_grid_x, g->x()+g->w()-layout->right_group_margin, g->y()+layout->top_group_margin, layout->group_grid_y, g->y()+g->h()-layout->bottom_group_margin); } } - void draw(fld::app::Snap_Data &d) { - fld::app::Layout_Preset *layout = Fluid.proj.layout; + void draw(Snap_Data &d) { + Layout_Preset *layout = Fluid.proj.layout; draw_grid(nearest_x, nearest_y, layout->group_grid_x, layout->group_grid_y); } }; @@ -1476,13 +1476,13 @@ Fd_Snap_Group_Grid snap_group_grid; /** Base class the check distance to other widgets in the same group. */ -class Fd_Snap_Sibling : public fld::app::Snap_Action { +class Fd_Snap_Sibling : public Snap_Action { protected: Fl_Widget *best_match; public: Fd_Snap_Sibling() : best_match(0) { } - virtual int sibling_check(fld::app::Snap_Data &d, Fl_Widget *s) = 0; - void check(fld::app::Snap_Data &d) { + virtual int sibling_check(Snap_Data &d, Fl_Widget *s) = 0; + void check(Snap_Data &d) { clr(); best_match = 0; if (!d.wgt) return; @@ -1517,10 +1517,10 @@ public: class Fd_Snap_Siblings_Left_Same : public Fd_Snap_Sibling { public: Fd_Snap_Siblings_Left_Same() { type = 1; mask = FD_LEFT|FD_DRAG; } - int sibling_check(fld::app::Snap_Data &d, Fl_Widget *s) { + int sibling_check(Snap_Data &d, Fl_Widget *s) { return check_x_(d, d.bx, s->x()); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { if (best_match) draw_left_brace(best_match); } }; @@ -1532,11 +1532,11 @@ Fd_Snap_Siblings_Left_Same snap_siblings_left_same; class Fd_Snap_Siblings_Left : public Fd_Snap_Sibling { public: Fd_Snap_Siblings_Left() { type = 1; mask = FD_LEFT|FD_DRAG; } - int sibling_check(fld::app::Snap_Data &d, Fl_Widget *s) { + int sibling_check(Snap_Data &d, Fl_Widget *s) { return MIN(check_x_(d, d.bx, s->x()+s->w()), check_x_(d, d.bx, s->x()+s->w()+Fluid.proj.layout->widget_gap_x) ); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { if (best_match) draw_right_brace(best_match); } }; @@ -1545,10 +1545,10 @@ Fd_Snap_Siblings_Left snap_siblings_left; class Fd_Snap_Siblings_Right_Same : public Fd_Snap_Sibling { public: Fd_Snap_Siblings_Right_Same() { type = 1; mask = FD_RIGHT|FD_DRAG; } - int sibling_check(fld::app::Snap_Data &d, Fl_Widget *s) { + int sibling_check(Snap_Data &d, Fl_Widget *s) { return check_x_(d, d.br, s->x()+s->w()); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { if (best_match) draw_right_brace(best_match); } }; @@ -1557,11 +1557,11 @@ Fd_Snap_Siblings_Right_Same snap_siblings_right_same; class Fd_Snap_Siblings_Right : public Fd_Snap_Sibling { public: Fd_Snap_Siblings_Right() { type = 1; mask = FD_RIGHT|FD_DRAG; } - int sibling_check(fld::app::Snap_Data &d, Fl_Widget *s) { + int sibling_check(Snap_Data &d, Fl_Widget *s) { return MIN(check_x_(d, d.br, s->x()), check_x_(d, d.br, s->x()-Fluid.proj.layout->widget_gap_x)); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { if (best_match) draw_left_brace(best_match); } }; @@ -1570,10 +1570,10 @@ Fd_Snap_Siblings_Right snap_siblings_right; class Fd_Snap_Siblings_Top_Same : public Fd_Snap_Sibling { public: Fd_Snap_Siblings_Top_Same() { type = 2; mask = FD_TOP|FD_DRAG; } - int sibling_check(fld::app::Snap_Data &d, Fl_Widget *s) { + int sibling_check(Snap_Data &d, Fl_Widget *s) { return check_y_(d, d.by, s->y()); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { if (best_match) draw_top_brace(best_match); } }; @@ -1582,11 +1582,11 @@ Fd_Snap_Siblings_Top_Same snap_siblings_top_same; class Fd_Snap_Siblings_Top : public Fd_Snap_Sibling { public: Fd_Snap_Siblings_Top() { type = 2; mask = FD_TOP|FD_DRAG; } - int sibling_check(fld::app::Snap_Data &d, Fl_Widget *s) { + int sibling_check(Snap_Data &d, Fl_Widget *s) { return MIN(check_y_(d, d.by, s->y()+s->h()), check_y_(d, d.by, s->y()+s->h()+Fluid.proj.layout->widget_gap_y)); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { if (best_match) draw_bottom_brace(best_match); } }; @@ -1595,10 +1595,10 @@ Fd_Snap_Siblings_Top snap_siblings_top; class Fd_Snap_Siblings_Bottom_Same : public Fd_Snap_Sibling { public: Fd_Snap_Siblings_Bottom_Same() { type = 2; mask = FD_BOTTOM|FD_DRAG; } - int sibling_check(fld::app::Snap_Data &d, Fl_Widget *s) { + int sibling_check(Snap_Data &d, Fl_Widget *s) { return check_y_(d, d.bt, s->y()+s->h()); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { if (best_match) draw_bottom_brace(best_match); } }; @@ -1607,11 +1607,11 @@ Fd_Snap_Siblings_Bottom_Same snap_siblings_bottom_same; class Fd_Snap_Siblings_Bottom : public Fd_Snap_Sibling { public: Fd_Snap_Siblings_Bottom() { type = 2; mask = FD_BOTTOM|FD_DRAG; } - int sibling_check(fld::app::Snap_Data &d, Fl_Widget *s) { + int sibling_check(Snap_Data &d, Fl_Widget *s) { return MIN(check_y_(d, d.bt, s->y()), check_y_(d, d.bt, s->y()-Fluid.proj.layout->widget_gap_y)); } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { if (best_match) draw_top_brace(best_match); } }; @@ -1623,11 +1623,11 @@ Fd_Snap_Siblings_Bottom snap_siblings_bottom; /** Snap horizontal resizing to min_w or min_w and a multiple of inc_w. */ -class Fd_Snap_Widget_Ideal_Width : public fld::app::Snap_Action { +class Fd_Snap_Widget_Ideal_Width : public Snap_Action { public: Fd_Snap_Widget_Ideal_Width() { type = 1; mask = FD_LEFT|FD_RIGHT; } - void check(fld::app::Snap_Data &d) { - fld::app::Layout_Preset *layout = Fluid.proj.layout; + void check(Snap_Data &d) { + Layout_Preset *layout = Fluid.proj.layout; clr(); if (!d.wgt) return; int iw = 15, ih = 15; @@ -1644,17 +1644,17 @@ public: check_x_(d, d.bx, d.br-iw); } } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { draw_width(d.bx, d.bt+7, d.br, 0); } }; Fd_Snap_Widget_Ideal_Width snap_widget_ideal_width; -class Fd_Snap_Widget_Ideal_Height : public fld::app::Snap_Action { +class Fd_Snap_Widget_Ideal_Height : public Snap_Action { public: Fd_Snap_Widget_Ideal_Height() { type = 2; mask = FD_TOP|FD_BOTTOM; } - void check(fld::app::Snap_Data &d) { - fld::app::Layout_Preset *layout = Fluid.proj.layout; + void check(Snap_Data &d) { + Layout_Preset *layout = Fluid.proj.layout; clr(); if (!d.wgt) return; int iw, ih; @@ -1671,7 +1671,7 @@ public: check_y_(d, d.by, d.bt-ih); } } - void draw(fld::app::Snap_Data &d) { + void draw(Snap_Data &d) { draw_height(d.br+7, d.by, d.bt, 0); } }; @@ -1686,7 +1686,7 @@ Fd_Snap_Widget_Ideal_Height snap_widget_ideal_height; action in the list wins. All snap actions with the same distance and same winning coordinates are drawn in the overlay plane. */ -fld::app::Snap_Action *fld::app::Snap_Action::list[] = { +Snap_Action *Snap_Action::list[] = { &snap_left_window_edge, &snap_right_window_edge, &snap_top_window_edge, diff --git a/fluid/app/Snap_Action.h b/fluid/app/Snap_Action.h index 7c1e3fabc..f48b1490a 100644 --- a/fluid/app/Snap_Action.h +++ b/fluid/app/Snap_Action.h @@ -26,15 +26,8 @@ class Fl_Preferences; extern Fl_Menu_Item main_layout_submenu_[]; -namespace fld { -namespace io { -class Project_Reader; // fld::io:: -class Project_Writer; // fld::io:: -} // namespace io -} // namespace fld - -namespace fld { -namespace app { +class Project_Reader; +class Project_Writer; /** \brief Collection of layout settings. @@ -77,8 +70,8 @@ public: void write(Fl_Preferences &prefs); void read(Fl_Preferences &prefs); - void write(fld::io::Project_Writer*); - void read(fld::io::Project_Reader*); + void write(Project_Writer*); + void read(Project_Reader*); int textsize_not_null(); }; @@ -98,13 +91,13 @@ 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.) + 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*); - void read(fld::io::Project_Reader*); + void write(Project_Writer*); + void read(Project_Reader*); void update_label(); - void storage(fld::Tool_Store s) { storage_ = s; update_label(); } + void storage(Tool_Store s) { storage_ = s; update_label(); } void name(const char *n); void init(); ~Layout_Suite(); @@ -147,13 +140,13 @@ public: int load(const char *filename); int save(const char *filename); - void write(Fl_Preferences &prefs, fld::Tool_Store storage); - void read(Fl_Preferences &prefs, fld::Tool_Store storage); - void write(fld::io::Project_Writer*); - void read(fld::io::Project_Reader*); + void write(Fl_Preferences &prefs, Tool_Store storage); + void read(Fl_Preferences &prefs, Tool_Store storage); + void write(Project_Writer*); + void read(Project_Reader*); int add(Layout_Suite*); void remove(int index); - void remove_all(fld::Tool_Store storage); + void remove_all(Tool_Store storage); Layout_Preset *at(int); int size(); }; @@ -198,8 +191,6 @@ public: static void better_size(int &w, int &h); }; -} // namespace app -} // namespace fld #endif // _FLUID_FD_SNAP_ACTION_H diff --git a/fluid/app/args.cxx b/fluid/app/args.cxx index 70faebafc..ef7652060 100644 --- a/fluid/app/args.cxx +++ b/fluid/app/args.cxx @@ -26,7 +26,7 @@ #include "../src/flstring.h" -fld::app::Args::Args() +Args::Args() : update_file(0), compile_file(0), compile_strings(0), @@ -46,7 +46,7 @@ fld::app::Args::Args() \return 0 if the args were handled successfully, -1 if there was an error and the usage message was shown. */ -int fld::app::Args::load(int argc, char **argv) { +int Args::load(int argc, char **argv) { int i = 1; Fl::args_to_utf8(argc, argv); // for MSYS2/MinGW if ( (Fl::args(argc, argv, i, arg_cb) == 0) // unsupported argument found @@ -79,7 +79,7 @@ int fld::app::Args::load(int argc, char **argv) { } -int fld::app::Args::arg_cb(int argc, char** argv, int& i) { +int Args::arg_cb(int argc, char** argv, int& i) { return Fluid.args.arg(argc, argv, i); } @@ -91,7 +91,7 @@ int fld::app::Args::arg_cb(int argc, char** argv, int& i) { \param[inout] i current argument index \return number of arguments used; if 0, the argument is not supported */ -int fld::app::Args::arg(int argc, char** argv, int& i) { +int Args::arg(int argc, char** argv, int& i) { if (argv[i][0] != '-') return 0; if (argv[i][1] == 'd' && !argv[i][2]) { diff --git a/fluid/app/args.h b/fluid/app/args.h index 1165c4f58..601cc91c9 100644 --- a/fluid/app/args.h +++ b/fluid/app/args.h @@ -19,9 +19,6 @@ #include <FL/filename.H> -namespace fld { -namespace app { - class Args { // Callback. static int arg_cb(int argc, char** argv, int& i); @@ -48,7 +45,4 @@ public: int load(int argc, char **argv); }; -} // namespace app -} // namespace fld - #endif // FLUID_APP_ARGS_H diff --git a/fluid/app/history.cxx b/fluid/app/history.cxx index 91b2f0b99..3b252598d 100644 --- a/fluid/app/history.cxx +++ b/fluid/app/history.cxx @@ -22,7 +22,7 @@ #include "../src/flstring.h" -fld::app::History::History() { +History::History() { int i, j; for (i = 0; i < 10; i++) { for (j = 0; j < FL_PATH_MAX; j++) { @@ -40,7 +40,7 @@ fld::app::History::History() { It also computes and stores the relative filepaths for display in the main menu. */ -void fld::app::History::load() { +void History::load() { int i; int max_files; @@ -71,7 +71,7 @@ void fld::app::History::load() { \param[in] project_file path and filename of .fl project file, will be converted into an absolute file path based on the current working directory. */ -void fld::app::History::update(const char *project_file) { +void History::update(const char *project_file) { int i; int max_files; diff --git a/fluid/app/history.h b/fluid/app/history.h index 99200757a..92e494226 100644 --- a/fluid/app/history.h +++ b/fluid/app/history.h @@ -19,9 +19,6 @@ #include <FL/filename.H> -namespace fld { -namespace app { - class History { public: /// Stores the absolute filename of the last 10 project files, saved in app preferences. @@ -36,7 +33,4 @@ public: void update(const char *project_file); }; -} // namespace app -} // namespace fld - #endif // FLUID_APP_HISTORY_H diff --git a/fluid/app/shell_command.cxx b/fluid/app/shell_command.cxx index 0a9a04121..fc5d0ffe9 100644 --- a/fluid/app/shell_command.cxx +++ b/fluid/app/shell_command.cxx @@ -441,7 +441,7 @@ Fd_Shell_Command::Fd_Shell_Command(const char *in_name) Fd_Shell_Command::Fd_Shell_Command(const char *in_name, const char *in_label, Fl_Shortcut in_shortcut, - fld::Tool_Store in_storage, + Tool_Store in_storage, int in_condition, const char *in_condition_data, const char *in_command, @@ -561,7 +561,7 @@ void Fd_Shell_Command::read(Fl_Preferences &prefs) { prefs.get("shortcut", tmp, 0); shortcut = (Fl_Shortcut)tmp; prefs.get("storage", tmp, -1); - if (tmp != -1) storage = (fld::Tool_Store)tmp; + if (tmp != -1) storage = (Tool_Store)tmp; prefs.get("condition", condition, ALWAYS); prefs.get("condition_data", str_ptr, ""); @@ -586,7 +586,7 @@ void Fd_Shell_Command::write(Fl_Preferences &prefs, int save_location) { if (flags != 0) prefs.set("flags", flags); } -void Fd_Shell_Command::read(class fld::io::Project_Reader *in) { +void Fd_Shell_Command::read(class Project_Reader *in) { const char *c = in->read_word(1); if (strcmp(c, "{")!=0) return; // expecting start of group storage = FLD_TOOL_STORE_PROJECT; @@ -612,7 +612,7 @@ void Fd_Shell_Command::read(class fld::io::Project_Reader *in) { } } -void Fd_Shell_Command::write(class fld::io::Project_Writer *out) { +void Fd_Shell_Command::write(class Project_Writer *out) { out->write_string("\n command {"); out->write_string("\n name "); out->write_word(name ? name : ""); out->write_string("\n label "); out->write_word(label ? label : ""); @@ -676,7 +676,7 @@ void Fd_Shell_Command_List::clear() { /** remove all shell commands of the given storage location from the list. */ -void Fd_Shell_Command_List::clear(fld::Tool_Store storage) { +void Fd_Shell_Command_List::clear(Tool_Store storage) { int i; for (i=list_size-1; i>=0; i--) { if (list[i]->storage == storage) { @@ -688,7 +688,7 @@ void Fd_Shell_Command_List::clear(fld::Tool_Store storage) { /** Read shell configuration from a preferences group. */ -void Fd_Shell_Command_List::read(Fl_Preferences &prefs, fld::Tool_Store storage) { +void Fd_Shell_Command_List::read(Fl_Preferences &prefs, Tool_Store storage) { int i, n; // import the old shell commands from previous user settings if (&Fluid.preferences == &prefs) { @@ -729,7 +729,7 @@ void Fd_Shell_Command_List::read(Fl_Preferences &prefs, fld::Tool_Store storage) /** Write shell configuration to a preferences group. */ -void Fd_Shell_Command_List::write(Fl_Preferences &prefs, fld::Tool_Store storage) { +void Fd_Shell_Command_List::write(Fl_Preferences &prefs, Tool_Store storage) { int i, index; Fl_Preferences shell_commands(prefs, "shell_commands"); shell_commands.delete_all_groups(); @@ -745,7 +745,7 @@ void Fd_Shell_Command_List::write(Fl_Preferences &prefs, fld::Tool_Store storage /** Read shell configuration from a project file. */ -void Fd_Shell_Command_List::read(fld::io::Project_Reader *in) { +void Fd_Shell_Command_List::read(Project_Reader *in) { const char *c = in->read_word(1); if (strcmp(c, "{")!=0) return; // expecting start of group clear(FLD_TOOL_STORE_PROJECT); @@ -765,7 +765,7 @@ void Fd_Shell_Command_List::read(fld::io::Project_Reader *in) { /** Write shell configuration to a project file. */ -void Fd_Shell_Command_List::write(fld::io::Project_Writer *out) { +void Fd_Shell_Command_List::write(Project_Writer *out) { int i, n_in_project_file = 0; for (i=0; i<list_size; i++) { if (list[i]->storage == FLD_TOOL_STORE_PROJECT) diff --git a/fluid/app/shell_command.h b/fluid/app/shell_command.h index 716a87349..234477151 100644 --- a/fluid/app/shell_command.h +++ b/fluid/app/shell_command.h @@ -34,15 +34,9 @@ # include <unistd.h> #endif -namespace fld { -namespace io { - class Project_Reader; class Project_Writer; -} // namespace io -} // namespace fld - struct Fl_Menu_Item; class Fl_Widget; class Fl_Preferences; @@ -93,7 +87,7 @@ public: char *name; char *label; Fl_Shortcut shortcut; - fld::Tool_Store storage; + Tool_Store storage; int condition; char *condition_data; char *command; @@ -106,7 +100,7 @@ public: Fd_Shell_Command(const char *in_name, const char *in_label, Fl_Shortcut in_shortcut, - fld::Tool_Store in_storage, + Tool_Store in_storage, int in_condition, const char *in_condition_data, const char *in_command, @@ -121,8 +115,8 @@ public: void run(); void read(Fl_Preferences &prefs); void write(Fl_Preferences &prefs, int save_location); - void read(class fld::io::Project_Reader*); - void write(class fld::io::Project_Writer*); + void read(class Project_Reader*); + void write(class Project_Writer*); void update_shell_menu(); int is_active(); }; @@ -142,11 +136,11 @@ public: void insert(int index, Fd_Shell_Command *cmd); void remove(int index); void clear(); - void clear(fld::Tool_Store store); - 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 clear(Tool_Store store); + void read(Fl_Preferences &prefs, Tool_Store storage); + void write(Fl_Preferences &prefs, Tool_Store storage); + void read(class Project_Reader*); + void write(class Project_Writer*); void rebuild_shell_menu(); void update_settings_dialog(); diff --git a/fluid/app/templates.cxx b/fluid/app/templates.cxx index 9b2253001..96534ae01 100644 --- a/fluid/app/templates.cxx +++ b/fluid/app/templates.cxx @@ -32,7 +32,7 @@ Save a design template. \todo We should document the concept of templates. */ -void fld::app::save_template() { +void save_template() { // Setup the template panel... if (!template_panel) make_template_panel(); @@ -93,7 +93,7 @@ void fld::app::save_template() { "Replace", 0, c) == 0) return; } - if (!fld::io::write_file(Fluid.proj, filename)) { + if (!write_file(Fluid.proj, filename)) { fl_alert("Error writing %s: %s", filename, strerror(errno)); return; } diff --git a/fluid/app/templates.h b/fluid/app/templates.h index cedec9f76..2f4d972d0 100644 --- a/fluid/app/templates.h +++ b/fluid/app/templates.h @@ -17,13 +17,7 @@ #ifndef FLUID_APP_TEMPLATES_H #define FLUID_APP_TEMPLATES_H -namespace fld { -namespace app { - void save_template(); -} // namespace app -} // namespace fld - #endif // FLUID_APP_TEMPLATES_H |
