diff options
Diffstat (limited to 'fluid/app/Snap_Action.cxx')
| -rw-r--r-- | fluid/app/Snap_Action.cxx | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/fluid/app/Snap_Action.cxx b/fluid/app/Snap_Action.cxx index 2e30853d4..3e71d91c5 100644 --- a/fluid/app/Snap_Action.cxx +++ b/fluid/app/Snap_Action.cxx @@ -402,17 +402,18 @@ void Layout_Suite::read(fld::io::Project_Reader *in) { Also updates the FLUID user interface. */ void Layout_Suite::update_label() { - std::string sym; + const char *sym = ""; switch (storage_) { - case FLD_TOOL_STORE_INTERNAL: sym.assign("@fd_beaker "); break; - case FLD_TOOL_STORE_USER: sym.assign("@fd_user "); break; - case FLD_TOOL_STORE_PROJECT: sym.assign("@fd_project "); break; - case FLD_TOOL_STORE_FILE: sym.assign("@fd_file "); break; + case FLD_TOOL_STORE_INTERNAL: sym = "@fd_beaker "; break; + case FLD_TOOL_STORE_USER: sym = "@fd_user "; break; + case FLD_TOOL_STORE_PROJECT: sym = "@fd_project "; break; + case FLD_TOOL_STORE_FILE: sym = "@fd_file "; break; } - sym.append(name_); + char buf[256]; + snprintf(buf, sizeof(buf), "%s%s", sym, name_ ? name_ : ""); if (menu_label) ::free(menu_label); - menu_label = fl_strdup(sym.c_str()); + menu_label = fl_strdup(buf); Fluid.layout_list->update_menu_labels(); } @@ -1082,7 +1083,7 @@ void Snap_Action::draw_all(Snap_Data &data) { /** Return a sensible step size for resizing a widget. */ void Snap_Action::get_resize_stepsize(int &x_step, int &y_step) { - auto layout = Fluid.proj.layout; + 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,7 +1098,7 @@ 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) { - auto layout = Fluid.proj.layout; + 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,7 +1113,7 @@ 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) { - auto layout = Fluid.proj.layout; + 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; @@ -1427,13 +1428,13 @@ public: class Fd_Snap_Window_Grid : public Fd_Snap_Grid { public: void check(Snap_Data &d) override { - auto layout = Fluid.proj.layout; + 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) override { - auto layout = Fluid.proj.layout; + Layout_Preset *layout = Fluid.proj.layout; draw_grid(nearest_x, nearest_y, layout->window_grid_x, layout->window_grid_y); } }; @@ -1446,7 +1447,7 @@ class Fd_Snap_Group_Grid : public Fd_Snap_Grid { public: void check(Snap_Data &d) override { if (in_group(d)) { - auto 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, @@ -1454,7 +1455,7 @@ public: } } void draw(Snap_Data &d) override { - auto layout = Fluid.proj.layout; + Layout_Preset *layout = Fluid.proj.layout; draw_grid(nearest_x, nearest_y, layout->group_grid_x, layout->group_grid_y); } }; @@ -1615,7 +1616,7 @@ class Fd_Snap_Widget_Ideal_Width : public Snap_Action { public: Fd_Snap_Widget_Ideal_Width() { type = 1; mask = FD_LEFT|FD_RIGHT; } void check(Snap_Data &d) override { - auto layout = Fluid.proj.layout; + Layout_Preset *layout = Fluid.proj.layout; clr(); if (!d.wgt) return; int iw = 15, ih = 15; @@ -1642,7 +1643,7 @@ class Fd_Snap_Widget_Ideal_Height : public Snap_Action { public: Fd_Snap_Widget_Ideal_Height() { type = 2; mask = FD_TOP|FD_BOTTOM; } void check(Snap_Data &d) override { - auto layout = Fluid.proj.layout; + Layout_Preset *layout = Fluid.proj.layout; clr(); if (!d.wgt) return; int iw, ih; |
