summaryrefslogtreecommitdiff
path: root/fluid/app
diff options
context:
space:
mode:
Diffstat (limited to 'fluid/app')
-rw-r--r--fluid/app/Snap_Action.cxx351
-rw-r--r--fluid/app/templates.cxx3
2 files changed, 182 insertions, 172 deletions
diff --git a/fluid/app/Snap_Action.cxx b/fluid/app/Snap_Action.cxx
index f045d325f..39a328b24 100644
--- a/fluid/app/Snap_Action.cxx
+++ b/fluid/app/Snap_Action.cxx
@@ -39,19 +39,16 @@
#endif
-using namespace fld;
-using namespace fld::app;
-
// TODO: warning if the user wants to change builtin layouts
// TODO: move panel to global settings panel (move load & save to main pulldown, or to toolbox?)
// INFO: how about a small tool box for quick preset selection and disabling of individual snaps?
void select_layout_suite_cb(Fl_Widget *, void *user_data);
-int Snap_Action::eex = 0;
-int Snap_Action::eey = 0;
+int fld::app::Snap_Action::eex = 0;
+int fld::app::Snap_Action::eey = 0;
-static Layout_Preset fltk_app = {
+static fld::app::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
@@ -59,7 +56,7 @@ static Layout_Preset fltk_app = {
20, 4, 8, // widget_y: min, inc, gap
0, 14, -1, 14 // labelfont/size, textfont/size
};
-static Layout_Preset fltk_dlg = {
+static fld::app::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
@@ -67,7 +64,7 @@ static Layout_Preset fltk_dlg = {
20, 5, 5, // widget_y: min, inc, gap
0, 11, -1, 11 // labelfont/size, textfont/size
};
-static Layout_Preset fltk_tool = {
+static fld::app::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
@@ -76,7 +73,7 @@ static Layout_Preset fltk_tool = {
0, 10, -1, 10 // labelfont/size, textfont/size
};
-static Layout_Preset grid_app = {
+static fld::app::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
@@ -85,7 +82,7 @@ static Layout_Preset grid_app = {
0, 14, -1, 14 // labelfont/size, textfont/size
};
-static Layout_Preset grid_dlg = {
+static fld::app::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
@@ -94,7 +91,7 @@ static Layout_Preset grid_dlg = {
0, 12, -1, 12 // labelfont/size, textfont/size
};
-static Layout_Preset grid_tool = {
+static fld::app::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
@@ -103,9 +100,9 @@ static Layout_Preset grid_tool = {
0, 10, -1, 10 // labelfont/size, textfont/size
};
-Layout_Preset *fld::app::default_layout_preset = &fltk_app;
+fld::app::Layout_Preset *fld::app::default_layout_preset = &fltk_app;
-static Layout_Suite static_suite_list[] = {
+static fld::app::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 }
};
@@ -157,12 +154,12 @@ void edit_layout_preset_cb(Fl_Button *w, void *user_data) {
}
}
-// ---- Layout_Suite ------------------------------------------------ MARK: -
+// ---- fld::app::Layout_Suite ------------------------------------------------ MARK: -
/**
Write presets to a Preferences database.
*/
-void Layout_Preset::write(Fl_Preferences &prefs) {
+void fld::app::Layout_Preset::write(Fl_Preferences &prefs) {
assert(this);
Fl_Preferences p_win(prefs, "Window");
p_win.set("left_margin", left_window_margin);
@@ -202,7 +199,7 @@ void Layout_Preset::write(Fl_Preferences &prefs) {
/**
Read presets from a Preferences database.
*/
-void Layout_Preset::read(Fl_Preferences &prefs) {
+void fld::app::Layout_Preset::read(Fl_Preferences &prefs) {
assert(this);
Fl_Preferences p_win(prefs, "Window");
p_win.get("left_margin", left_window_margin, 15);
@@ -242,7 +239,7 @@ void Layout_Preset::read(Fl_Preferences &prefs) {
/**
Write presets to an .fl project file.
*/
-void Layout_Preset::write(fld::io::Project_Writer *out) {
+void fld::app::Layout_Preset::write(fld::io::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,
@@ -264,7 +261,7 @@ void Layout_Preset::write(fld::io::Project_Writer *out) {
/**
Read presets from an .fl project file.
*/
-void Layout_Preset::read(fld::io::Project_Reader *in) {
+void fld::app::Layout_Preset::read(fld::io::Project_Reader *in) {
const char *key;
key = in->read_word(1);
if (key && !strcmp(key, "{")) {
@@ -320,7 +317,7 @@ void Layout_Preset::read(fld::io::Project_Reader *in) {
/**
Return the preferred text size, but make sure it's not 0.
*/
-int Layout_Preset::textsize_not_null() {
+int fld::app::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
@@ -330,16 +327,17 @@ int Layout_Preset::textsize_not_null() {
}
-// ---- Layout_Suite ------------------------------------------------ MARK: -
+// ---- fld::app::Layout_Suite ------------------------------------------------ MARK: -
/**
Write a presets suite to a Preferences database.
*/
-void Layout_Suite::write(Fl_Preferences &prefs) {
+void fld::app::Layout_Suite::write(Fl_Preferences &prefs) {
assert(this);
assert(name_);
prefs.set("name", name_);
- for (int i = 0; i < 3; ++i) {
+ int i;
+ for (i = 0; i < 3; ++i) {
Fl_Preferences prefs_preset(prefs, Fl_Preferences::Name(i));
assert(layout[i]);
layout[i]->write(prefs_preset);
@@ -349,9 +347,10 @@ void Layout_Suite::write(Fl_Preferences &prefs) {
/**
Read a presets suite from a Preferences database.
*/
-void Layout_Suite::read(Fl_Preferences &prefs) {
+void fld::app::Layout_Suite::read(Fl_Preferences &prefs) {
assert(this);
- for (int i = 0; i < 3; ++i) {
+ int i;
+ for (i = 0; i < 3; ++i) {
Fl_Preferences prefs_preset(prefs, Fl_Preferences::Name(i));
assert(layout[i]);
layout[i]->read(prefs_preset);
@@ -361,10 +360,11 @@ void Layout_Suite::read(Fl_Preferences &prefs) {
/**
Write a presets suite to an .fl project file.
*/
-void Layout_Suite::write(fld::io::Project_Writer *out) {
+void fld::app::Layout_Suite::write(fld::io::Project_Writer *out) {
out->write_string(" suite {\n");
out->write_string(" name "); out->write_word(name_); out->write_string("\n");
- for (int i = 0; i < 3; ++i) {
+ int i;
+ for (i = 0; i < 3; ++i) {
layout[i]->write(out);
}
out->write_string(" }\n");
@@ -373,7 +373,7 @@ void Layout_Suite::write(fld::io::Project_Writer *out) {
/**
Read a presets suite from an .fl project file.
*/
-void Layout_Suite::read(fld::io::Project_Reader *in) {
+void fld::app::Layout_Suite::read(fld::io::Project_Reader *in) {
const char *key;
key = in->read_word(1);
if (key && !strcmp(key, "{")) {
@@ -401,7 +401,7 @@ void 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 Layout_Suite::update_label() {
+void fld::app::Layout_Suite::update_label() {
const char *sym = "";
switch (storage_) {
case FLD_TOOL_STORE_INTERNAL: sym = "@fd_beaker "; break;
@@ -421,7 +421,7 @@ void Layout_Suite::update_label() {
\brief Update the Suite name and the Suite menu_label.
Also updates the FLUID user interface.
*/
-void Layout_Suite::name(const char *n) {
+void fld::app::Layout_Suite::name(const char *n) {
if (name_)
::free(name_);
if (n)
@@ -434,7 +434,7 @@ void Layout_Suite::name(const char *n) {
/**
Initialize the class for first use.
*/
-void Layout_Suite::init() {
+void fld::app::Layout_Suite::init() {
name_ = 0;
menu_label = 0;
layout[0] = layout[1] = layout[2] = 0;
@@ -444,15 +444,16 @@ void Layout_Suite::init() {
/**
Free all allocated resources.
*/
-Layout_Suite::~Layout_Suite() {
+fld::app::Layout_Suite::~Layout_Suite() {
if (storage_ == FLD_TOOL_STORE_INTERNAL) return;
if (name_) ::free(name_);
- for (int i = 0; i < 3; ++i) {
+ int i;
+ for (i = 0; i < 3; ++i) {
delete layout[i];
}
}
-// ---- Layout_List ------------------------------------------------- MARK: -
+// ---- fld::app::Layout_List ------------------------------------------------- MARK: -
/**
Draw a little FLUID beaker symbol.
@@ -595,7 +596,7 @@ void fd_file(Fl_Color c) {
/**
Instantiate the class that holds a list of all layouts and manages the UI.
*/
-Layout_List::Layout_List()
+fld::app::Layout_List::Layout_List()
: main_menu_(main_layout_submenu_),
choice_menu_(static_choice_menu),
list_(static_suite_list),
@@ -614,15 +615,16 @@ Layout_List::Layout_List()
/**
Release allocated resources.
*/
-Layout_List::~Layout_List() {
+fld::app::Layout_List::~Layout_List() {
assert(this);
if (!list_is_static_) {
::free(main_menu_);
::free(choice_menu_);
- for (int i = 0; i < list_size_; i++) {
- Layout_Suite &suite = list_[i];
+ int i;
+ for (i = 0; i < list_size_; i++) {
+ fld::app::Layout_Suite &suite = list_[i];
if (suite.storage_ != FLD_TOOL_STORE_INTERNAL)
- suite.~Layout_Suite();
+ suite.fld::app::Layout_Suite::~Layout_Suite();
}
::free(list_);
}
@@ -631,7 +633,7 @@ Layout_List::~Layout_List() {
/**
Update the Setting dialog and menus to reflect the current Layout selection state.
*/
-void Layout_List::update_dialogs() {
+void fld::app::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);
@@ -655,8 +657,9 @@ void Layout_List::update_dialogs() {
/**
Refresh the label pointers for both pulldown menus.
*/
-void Layout_List::update_menu_labels() {
- for (int i=0; i<list_size_; i++) {
+void fld::app::Layout_List::update_menu_labels() {
+ int i;
+ for (i =0; i<list_size_; i++) {
main_menu_[i].label(list_[i].menu_label);
choice_menu_[i].label(list_[i].menu_label);
}
@@ -665,7 +668,7 @@ void Layout_List::update_menu_labels() {
/**
Load all user layouts from the FLUID user preferences.
*/
-int Layout_List::load(const char *filename) {
+int fld::app::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);
@@ -675,7 +678,7 @@ int Layout_List::load(const char *filename) {
/**
Save all user layouts to the FLUID user preferences.
*/
-int Layout_List::save(const char *filename) {
+int fld::app::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();
@@ -686,14 +689,15 @@ int Layout_List::save(const char *filename) {
/**
Write Suite and Layout selection and selected layout data to Preferences database.
*/
-void Layout_List::write(Fl_Preferences &prefs, fld::Tool_Store storage) {
+void fld::app::Layout_List::write(Fl_Preferences &prefs, fld::Tool_Store storage) {
Fl_Preferences prefs_list(prefs, "Layouts");
prefs_list.clear();
prefs_list.set("current_suite", list_[current_suite()].name_);
prefs_list.set("current_preset", current_preset());
int n = 0;
- for (int i = 0; i < list_size_; ++i) {
- Layout_Suite &suite = list_[i];
+ int i;
+ for (i = 0; i < list_size_; ++i) {
+ fld::app::Layout_Suite &suite = list_[i];
if (suite.storage_ == storage) {
Fl_Preferences prefs_suite(prefs_list, Fl_Preferences::Name(n++));
suite.write(prefs_suite);
@@ -704,7 +708,7 @@ void Layout_List::write(Fl_Preferences &prefs, fld::Tool_Store storage) {
/**
Read Suite and Layout selection and selected layout data to Preferences database.
*/
-void Layout_List::read(Fl_Preferences &prefs, fld::Tool_Store storage) {
+void fld::app::Layout_List::read(Fl_Preferences &prefs, fld::Tool_Store storage) {
Fl_Preferences prefs_list(prefs, "Layouts");
char *cs_ptr = 0;
int cp = 0;
@@ -733,11 +737,12 @@ void 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 Layout_List::write(fld::io::Project_Writer *out) {
+void fld::app::Layout_List::write(fld::io::Project_Writer *out) {
// Don't write the Snap field if no custom layout was used
+ int i;
if ((current_suite()==0) && (current_preset()==0)) {
int nSuite = 0;
- for (int i=0; i<list_size_; i++) {
+ for (i =0; i<list_size_; i++) {
if (list_[i].storage_ == FLD_TOOL_STORE_PROJECT) nSuite++;
}
if (nSuite == 0) return;
@@ -745,8 +750,8 @@ void Layout_List::write(fld::io::Project_Writer *out) {
out->write_string("\nsnap {\n ver 1\n");
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 (int i=0; i<list_size_; i++) {
- Layout_Suite &suite = list_[i];
+ for (i =0; i<list_size_; i++) {
+ fld::app::Layout_Suite &suite = list_[i];
if (suite.storage_ == FLD_TOOL_STORE_PROJECT)
suite.write(out);
}
@@ -756,7 +761,7 @@ void Layout_List::write(fld::io::Project_Writer *out) {
/**
Read Suite and Layout selection and project layout data from an .fl project file.
*/
-void Layout_List::read(fld::io::Project_Reader *in) {
+void fld::app::Layout_List::read(fld::io::Project_Reader *in) {
const char *key;
key = in->read_word(1);
if (key && !strcmp(key, "{")) {
@@ -793,7 +798,7 @@ void Layout_List::read(fld::io::Project_Reader *in) {
Set the current Suite.
\param[in] ix index into list of suites
*/
-void Layout_List::current_suite(int ix) {
+void fld::app::Layout_List::current_suite(int ix) {
assert(ix >= 0);
assert(ix < list_size_);
current_suite_ = ix;
@@ -805,11 +810,11 @@ void 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 Layout_List::current_suite(const char *arg_name) {
+void fld::app::Layout_List::current_suite(const char *arg_name) {
if (!arg_name || !arg_name[0]) return;
int i;
for (i = 0; i < list_size_; ++i) {
- Layout_Suite &suite = list_[i];
+ fld::app::Layout_Suite &suite = list_[i];
if (suite.name_ && (strcmp(suite.name_, arg_name) == 0)) {
current_suite(i);
break;
@@ -821,7 +826,7 @@ void 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 Layout_List::current_preset(int ix) {
+void fld::app::Layout_List::current_preset(int ix) {
assert(ix >= 0);
assert(ix < 3);
current_preset_ = ix;
@@ -831,7 +836,7 @@ void Layout_List::current_preset(int ix) {
/**
Allocate enough space for n entries in the list.
*/
-void Layout_List::capacity(int n) {
+void fld::app::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);
@@ -839,7 +844,7 @@ void Layout_List::capacity(int n) {
int old_n = list_size_;
int i;
- Layout_Suite *new_list = (Layout_Suite*)::calloc(n, sizeof(Layout_Suite));
+ fld::app::Layout_Suite *new_list = (fld::app::Layout_Suite*)::calloc(n, sizeof(fld::app::Layout_Suite));
for (i = 0; i < old_n; i++)
new_list[i] = list_[i];
if (!list_is_static_) ::free(list_);
@@ -867,18 +872,19 @@ void 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 Layout_List::add(const char *name) {
+int fld::app::Layout_List::add(const char *name) {
if (list_size_ == list_capacity_) {
capacity(list_capacity_ * 2);
}
int n = list_size_;
- Layout_Suite &old_suite = list_[current_suite_];
- Layout_Suite &new_suite = list_[n];
+ fld::app::Layout_Suite &old_suite = list_[current_suite_];
+ fld::app::Layout_Suite &new_suite = list_[n];
new_suite.init();
new_suite.name(name);
- for (int i=0; i<3; ++i) {
- new_suite.layout[i] = new Layout_Preset;
- ::memcpy(new_suite.layout[i], old_suite.layout[i], sizeof(Layout_Preset));
+ 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));
}
fld::Tool_Store new_storage = old_suite.storage_;
if (new_storage == FLD_TOOL_STORE_INTERNAL)
@@ -897,7 +903,7 @@ int Layout_List::add(const char *name) {
/**
Rename the current Suite.
*/
-void Layout_List::rename(const char *name) {
+void fld::app::Layout_List::rename(const char *name) {
int n = current_suite();
list_[n].name(name);
main_menu_[n].label(list_[n].menu_label);
@@ -908,10 +914,11 @@ void Layout_List::rename(const char *name) {
Remove the given suite.
\param[in] ix index into list of suites
*/
-void Layout_List::remove(int ix) {
+void fld::app::Layout_List::remove(int ix) {
int tail = list_size_-ix-1;
if (tail) {
- for (int i = ix; i < list_size_-1; i++)
+ int i;
+ for (i = ix; i < list_size_-1; i++)
list_[i] = list_[i+1];
}
::memmove(main_menu_+ix, main_menu_+ix+1, (tail+1) * sizeof(Fl_Menu_Item));
@@ -925,8 +932,9 @@ void Layout_List::remove(int ix) {
Remove all Suites that use the given storage attribute.
\param[in] storage storage attribute, see FLD_TOOL_STORE_INTERNAL, etc.
*/
-void Layout_List::remove_all(fld::Tool_Store storage) {
- for (int i=list_size_-1; i>=0; --i) {
+void fld::app::Layout_List::remove_all(fld::Tool_Store storage) {
+ int i;
+ for (i =list_size_-1; i>=0; --i) {
if (list_[i].storage_ == storage)
remove(i);
}
@@ -951,19 +959,19 @@ static int nearest(int x, int left, int grid, int right=0x7fff) {
return grid_x;
}
-static bool in_window(Snap_Data &d) {
+static bool in_window(fld::app::Snap_Data &d) {
return (d.wgt && d.wgt->parent == d.win);
}
-static bool in_group(Snap_Data &d) {
+static bool in_group(fld::app::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(Snap_Data &d) {
+static bool in_tabs(fld::app::Snap_Data &d) {
return (d.wgt && d.wgt->parent && d.wgt->parent->is_a(FLD_NODE_TYPE_Tabs));
}
-static Fl_Group *parent(Snap_Data &d) {
+static Fl_Group *parent(fld::app::Snap_Data &d) {
return (d.wgt->o->parent());
}
@@ -994,7 +1002,7 @@ static Fl_Group *parent(Snap_Data &d) {
\return -1 if this point is closer than any previous check, and this is the
new distance to beat.
*/
-int Snap_Action::check_x_(Snap_Data &d, int x_ref, int x_snap) {
+int fld::app::Snap_Action::check_x_(fld::app::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;
@@ -1007,9 +1015,9 @@ int Snap_Action::check_x_(Snap_Data &d, int x_ref, int x_snap) {
/**
\brief Check if a snap action has reached a preferred y position.
- \see Snap_Action::check_x_(Snap_Data &d, int x_ref, int x_snap)
+ \see fld::app::Snap_Action::check_x_(fld::app::Snap_Data &d, int x_ref, int x_snap)
*/
-int Snap_Action::check_y_(Snap_Data &d, int y_ref, int y_snap) {
+int fld::app::Snap_Action::check_y_(fld::app::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;
@@ -1022,9 +1030,9 @@ int Snap_Action::check_y_(Snap_Data &d, int y_ref, int y_snap) {
/**
\brief Check if a snap action has reached a preferred x and y position.
- \see Snap_Action::check_x_(Snap_Data &d, int x_ref, int x_snap)
+ \see fld::app::Snap_Action::check_x_(fld::app::Snap_Data &d, int x_ref, int x_snap)
*/
-void Snap_Action::check_x_y_(Snap_Data &d, int x_ref, int x_snap, int y_ref, int y_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) {
int ddx = x_ref + d.dx - x_snap;
int d2x = abs(ddx);
int ddy = y_ref + d.dy - y_snap;
@@ -1045,7 +1053,7 @@ void Snap_Action::check_x_y_(Snap_Data &d, int x_ref, int x_snap, int y_ref, int
should be drawn.
\param[inout] d current event data
*/
-bool Snap_Action::matches(Snap_Data &d) {
+bool fld::app::Snap_Action::matches(fld::app::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);
@@ -1058,8 +1066,9 @@ bool Snap_Action::matches(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 Snap_Action::check_all(Snap_Data &data) {
- for (int i=0; list[i]; i++) {
+void fld::app::Snap_Action::check_all(fld::app::Snap_Data &data) {
+ int i;
+ for (i =0; list[i]; i++) {
if (list[i]->mask & data.drag)
list[i]->check(data);
}
@@ -1074,16 +1083,17 @@ void Snap_Action::check_all(Snap_Data &data) {
coordinate, all of them will be drawn.
\param[inout] d current event data
*/
-void Snap_Action::draw_all(Snap_Data &data) {
- for (int i=0; list[i]; i++) {
+void fld::app::Snap_Action::draw_all(fld::app::Snap_Data &data) {
+ int i;
+ for (i =0; list[i]; i++) {
if (list[i]->matches(data))
list[i]->draw(data);
}
}
/** Return a sensible step size for resizing a widget. */
-void Snap_Action::get_resize_stepsize(int &x_step, int &y_step) {
- Layout_Preset *layout = Fluid.proj.layout;
+void fld::app::Snap_Action::get_resize_stepsize(int &x_step, int &y_step) {
+ fld::app::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;
@@ -1097,8 +1107,8 @@ void Snap_Action::get_resize_stepsize(int &x_step, int &y_step) {
}
/** Return a sensible step size for moving a widget. */
-void Snap_Action::get_move_stepsize(int &x_step, int &y_step) {
- Layout_Preset *layout = Fluid.proj.layout;
+void fld::app::Snap_Action::get_move_stepsize(int &x_step, int &y_step) {
+ fld::app::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;
@@ -1112,8 +1122,8 @@ void Snap_Action::get_move_stepsize(int &x_step, int &y_step) {
}
/** Fix the given size to the same or next bigger snap position. */
-void Snap_Action::better_size(int &w, int &h) {
- Layout_Preset *layout = Fluid.proj.layout;
+void fld::app::Snap_Action::better_size(int &w, int &h) {
+ fld::app::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;
@@ -1138,7 +1148,7 @@ void 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 Snap_Action {
+class Fd_Snap_Left : public fld::app::Snap_Action {
public:
Fd_Snap_Left() { type = 1; mask = FD_LEFT|FD_DRAG; }
};
@@ -1146,7 +1156,7 @@ public:
/**
Base class for all actions that drag the right side or the entire widget.
*/
-class Fd_Snap_Right : public Snap_Action {
+class Fd_Snap_Right : public fld::app::Snap_Action {
public:
Fd_Snap_Right() { type = 1; mask = FD_RIGHT|FD_DRAG; }
};
@@ -1154,7 +1164,7 @@ public:
/**
Base class for all actions that drag the top side or the entire widget.
*/
-class Fd_Snap_Top : public Snap_Action {
+class Fd_Snap_Top : public fld::app::Snap_Action {
public:
Fd_Snap_Top() { type = 2; mask = FD_TOP|FD_DRAG; }
};
@@ -1162,7 +1172,7 @@ public:
/**
Base class for all actions that drag the bottom side or the entire widget.
*/
-class Fd_Snap_Bottom : public Snap_Action {
+class Fd_Snap_Bottom : public fld::app::Snap_Action {
public:
Fd_Snap_Bottom() { type = 2; mask = FD_BOTTOM|FD_DRAG; }
};
@@ -1174,8 +1184,8 @@ public:
*/
class Fd_Snap_Left_Window_Edge : public Fd_Snap_Left {
public:
- void check(Snap_Data &d) { clr(); check_x_(d, d.bx, 0); }
- void draw(Snap_Data &d) { draw_left_brace(d.win->o); }
+ 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); }
};
Fd_Snap_Left_Window_Edge snap_left_window_edge;
@@ -1184,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(Snap_Data &d) { clr(); check_x_(d, d.br, d.win->o->w()); }
- void draw(Snap_Data &d) { draw_right_brace(d.win->o); }
+ 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); }
};
Fd_Snap_Right_Window_Edge snap_right_window_edge;
@@ -1194,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(Snap_Data &d) { clr(); check_y_(d, d.by, 0); }
- void draw(Snap_Data &d) { draw_top_brace(d.win->o); }
+ 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); }
};
Fd_Snap_Top_Window_Edge snap_top_window_edge;
@@ -1204,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(Snap_Data &d) { clr(); check_y_(d, d.bt, d.win->o->h()); }
- void draw(Snap_Data &d) { draw_bottom_brace(d.win->o); }
+ 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); }
};
Fd_Snap_Bottom_Window_Edge snap_bottom_window_edge;
@@ -1214,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(Snap_Data &d) {
+ void check(fld::app::Snap_Data &d) {
clr();
if (in_window(d)) check_x_(d, d.bx, Fluid.proj.layout->left_window_margin);
}
- void draw(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
draw_h_arrow(d.bx, (d.by+d.bt)/2, 0);
}
};
@@ -1226,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(Snap_Data &d) {
+ void check(fld::app::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(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
draw_h_arrow(d.br, (d.by+d.bt)/2, d.win->o->w()-1);
}
};
@@ -1238,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(Snap_Data &d) {
+ void check(fld::app::Snap_Data &d) {
clr();
if (in_window(d)) check_y_(d, d.by, Fluid.proj.layout->top_window_margin);
}
- void draw(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
draw_v_arrow((d.bx+d.br)/2, d.by, 0);
}
};
@@ -1250,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(Snap_Data &d) {
+ void check(fld::app::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(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
draw_v_arrow((d.bx+d.br)/2, d.bt, d.win->o->h()-1);
}
};
@@ -1267,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(Snap_Data &d) {
+ void check(fld::app::Snap_Data &d) {
clr();
if (in_group(d)) check_x_(d, d.bx, parent(d)->x());
}
- void draw(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
draw_left_brace(parent(d));
}
};
@@ -1279,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(Snap_Data &d) {
+ void check(fld::app::Snap_Data &d) {
clr();
if (in_group(d)) check_x_(d, d.br, parent(d)->x() + parent(d)->w());
}
- void draw(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
draw_right_brace(parent(d));
}
};
@@ -1291,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(Snap_Data &d) {
+ void check(fld::app::Snap_Data &d) {
clr();
if (in_group(d)) check_y_(d, d.by, parent(d)->y());
}
- void draw(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
draw_top_brace(parent(d));
}
};
@@ -1303,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(Snap_Data &d) {
+ void check(fld::app::Snap_Data &d) {
clr();
if (in_group(d)) check_y_(d, d.bt, parent(d)->y() + parent(d)->h());
}
- void draw(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
draw_bottom_brace(parent(d));
}
};
@@ -1319,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(Snap_Data &d) {
+ void check(fld::app::Snap_Data &d) {
clr();
if (in_group(d)) check_x_(d, d.bx, parent(d)->x() + Fluid.proj.layout->left_group_margin);
}
- void draw(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
draw_left_brace(parent(d));
draw_h_arrow(d.bx, (d.by+d.bt)/2, parent(d)->x());
}
@@ -1332,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(Snap_Data &d) {
+ void check(fld::app::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(Snap_Data &d) {
+ void draw(fld::app::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);
}
@@ -1345,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(Snap_Data &d) {
+ void check(fld::app::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(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
draw_top_brace(parent(d));
draw_v_arrow((d.bx+d.br)/2, d.by, parent(d)->y());
}
@@ -1358,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(Snap_Data &d) {
+ void check(fld::app::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(Snap_Data &d) {
+ void draw(fld::app::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);
}
@@ -1376,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(Snap_Data &d) {
+ void check(fld::app::Snap_Data &d) {
clr();
if (in_tabs(d)) check_y_(d, d.by, parent(d)->y()+Fluid.proj.layout->top_tabs_margin);
}
@@ -1385,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(Snap_Data &d) {
+ void check(fld::app::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);
}
@@ -1397,12 +1407,12 @@ Fd_Snap_Bottom_Tabs_Margin snap_bottom_tabs_margin;
/**
Base class for grid based snapping.
*/
-class Fd_Snap_Grid : public Snap_Action {
+class Fd_Snap_Grid : public fld::app::Snap_Action {
protected:
int nearest_x, nearest_y;
public:
Fd_Snap_Grid() { type = 3; mask = FD_LEFT|FD_TOP|FD_DRAG; }
- void check_grid(Snap_Data &d, int left, int grid_x, int right, int top, int grid_y, int bottom) {
+ void check_grid(fld::app::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);
@@ -1415,7 +1425,7 @@ public:
else
check_x_y_(d, d.bx, nearest_x, d.by, nearest_y);
}
- bool matches(Snap_Data &d) {
+ bool matches(fld::app::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);
@@ -1427,14 +1437,14 @@ public:
*/
class Fd_Snap_Window_Grid : public Fd_Snap_Grid {
public:
- void check(Snap_Data &d) {
- Layout_Preset *layout = Fluid.proj.layout;
+ void check(fld::app::Snap_Data &d) {
+ fld::app::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(Snap_Data &d) {
- Layout_Preset *layout = Fluid.proj.layout;
+ void draw(fld::app::Snap_Data &d) {
+ fld::app::Layout_Preset *layout = Fluid.proj.layout;
draw_grid(nearest_x, nearest_y, layout->window_grid_x, layout->window_grid_y);
}
};
@@ -1445,17 +1455,17 @@ Fd_Snap_Window_Grid snap_window_grid;
*/
class Fd_Snap_Group_Grid : public Fd_Snap_Grid {
public:
- void check(Snap_Data &d) {
+ void check(fld::app::Snap_Data &d) {
if (in_group(d)) {
- Layout_Preset *layout = Fluid.proj.layout;
+ fld::app::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(Snap_Data &d) {
- Layout_Preset *layout = Fluid.proj.layout;
+ void draw(fld::app::Snap_Data &d) {
+ fld::app::Layout_Preset *layout = Fluid.proj.layout;
draw_grid(nearest_x, nearest_y, layout->group_grid_x, layout->group_grid_y);
}
};
@@ -1466,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 Snap_Action {
+class Fd_Snap_Sibling : public fld::app::Snap_Action {
protected:
Fl_Widget *best_match;
public:
Fd_Snap_Sibling() : best_match(0) { }
- virtual int sibling_check(Snap_Data &d, Fl_Widget *s) = 0;
- void check(Snap_Data &d) {
+ virtual int sibling_check(fld::app::Snap_Data &d, Fl_Widget *s) = 0;
+ void check(fld::app::Snap_Data &d) {
clr();
best_match = 0;
if (!d.wgt) return;
@@ -1481,7 +1491,8 @@ public:
Group_Node *gt = (Group_Node*)d.wgt->parent;
Fl_Group *g = (Fl_Group*)gt->o;
Fl_Widget *w = d.wgt->o;
- for (int i=0; i<g->children(); i++) {
+ int i;
+ for (i =0; i<g->children(); i++) {
Fl_Widget *c = g->child(i);
if (c == w) continue;
int sret = sibling_check(d, c);
@@ -1506,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(Snap_Data &d, Fl_Widget *s) {
+ int sibling_check(fld::app::Snap_Data &d, Fl_Widget *s) {
return check_x_(d, d.bx, s->x());
}
- void draw(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
if (best_match) draw_left_brace(best_match);
}
};
@@ -1521,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(Snap_Data &d, Fl_Widget *s) {
+ int sibling_check(fld::app::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(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
if (best_match) draw_right_brace(best_match);
}
};
@@ -1534,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(Snap_Data &d, Fl_Widget *s) {
+ int sibling_check(fld::app::Snap_Data &d, Fl_Widget *s) {
return check_x_(d, d.br, s->x()+s->w());
}
- void draw(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
if (best_match) draw_right_brace(best_match);
}
};
@@ -1546,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(Snap_Data &d, Fl_Widget *s) {
+ int sibling_check(fld::app::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(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
if (best_match) draw_left_brace(best_match);
}
};
@@ -1559,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(Snap_Data &d, Fl_Widget *s) {
+ int sibling_check(fld::app::Snap_Data &d, Fl_Widget *s) {
return check_y_(d, d.by, s->y());
}
- void draw(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
if (best_match) draw_top_brace(best_match);
}
};
@@ -1571,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(Snap_Data &d, Fl_Widget *s) {
+ int sibling_check(fld::app::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(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
if (best_match) draw_bottom_brace(best_match);
}
};
@@ -1584,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(Snap_Data &d, Fl_Widget *s) {
+ int sibling_check(fld::app::Snap_Data &d, Fl_Widget *s) {
return check_y_(d, d.bt, s->y()+s->h());
}
- void draw(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
if (best_match) draw_bottom_brace(best_match);
}
};
@@ -1596,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(Snap_Data &d, Fl_Widget *s) {
+ int sibling_check(fld::app::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(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
if (best_match) draw_top_brace(best_match);
}
};
@@ -1612,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 Snap_Action {
+class Fd_Snap_Widget_Ideal_Width : public fld::app::Snap_Action {
public:
Fd_Snap_Widget_Ideal_Width() { type = 1; mask = FD_LEFT|FD_RIGHT; }
- void check(Snap_Data &d) {
- Layout_Preset *layout = Fluid.proj.layout;
+ void check(fld::app::Snap_Data &d) {
+ fld::app::Layout_Preset *layout = Fluid.proj.layout;
clr();
if (!d.wgt) return;
int iw = 15, ih = 15;
@@ -1633,17 +1644,17 @@ public:
check_x_(d, d.bx, d.br-iw);
}
}
- void draw(Snap_Data &d) {
+ void draw(fld::app::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 Snap_Action {
+class Fd_Snap_Widget_Ideal_Height : public fld::app::Snap_Action {
public:
Fd_Snap_Widget_Ideal_Height() { type = 2; mask = FD_TOP|FD_BOTTOM; }
- void check(Snap_Data &d) {
- Layout_Preset *layout = Fluid.proj.layout;
+ void check(fld::app::Snap_Data &d) {
+ fld::app::Layout_Preset *layout = Fluid.proj.layout;
clr();
if (!d.wgt) return;
int iw, ih;
@@ -1660,7 +1671,7 @@ public:
check_y_(d, d.by, d.bt-ih);
}
}
- void draw(Snap_Data &d) {
+ void draw(fld::app::Snap_Data &d) {
draw_height(d.br+7, d.by, d.bt, 0);
}
};
@@ -1675,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.
*/
-Snap_Action *Snap_Action::list[] = {
+fld::app::Snap_Action *fld::app::Snap_Action::list[] = {
&snap_left_window_edge,
&snap_right_window_edge,
&snap_top_window_edge,
@@ -1834,8 +1845,10 @@ void draw_width(int x, int y, int r, Fl_Align a) {
static void draw_grid(int x, int y, int dx, int dy) {
int dx2 = 1, dy2 = 1;
const int n = 2;
- for (int i=-n; i<=n; i++) {
- for (int j=-n; j<=n; j++) {
+ int i;
+ for (i =-n; i<=n; i++) {
+ int j;
+ for (j =-n; j<=n; j++) {
if (abs(i)+abs(j) < 4) {
int xx = x + i*dx , yy = y + j*dy;
fl_xyline(xx-dx2, yy, xx+dx2);
diff --git a/fluid/app/templates.cxx b/fluid/app/templates.cxx
index 8b9b69f2a..9b2253001 100644
--- a/fluid/app/templates.cxx
+++ b/fluid/app/templates.cxx
@@ -28,9 +28,6 @@
#include <FL/Fl_PNG_Image.H>
#include "../src/flstring.h"
-using namespace fld;
-using namespace fld::app;
-
/**
Save a design template.
\todo We should document the concept of templates.