diff options
| author | Matthias Melcher <github@matthiasm.com> | 2022-11-17 00:43:16 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-17 00:43:16 +0100 |
| commit | 2dae18da096e52ea0e9a274b73781d8de80ec619 (patch) | |
| tree | 24cd3eb72aa008c4f896a766c69c67e6bc19230e /fluid | |
| parent | 624eda17bcee5db3dec008ff86c18ba432ee64f1 (diff) | |
Fluid: Add Undo to formula input fields. (#547)
Diffstat (limited to 'fluid')
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 5 | ||||
| -rw-r--r-- | fluid/widget_panel.cxx | 12 | ||||
| -rw-r--r-- | fluid/widget_panel.fl | 20 |
3 files changed, 27 insertions, 10 deletions
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index 14bba4fd5..12772eabe 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -26,6 +26,7 @@ #include "Fluid_Image.h" #include "alignment_panel.h" #include "widget_panel.h" +#include "undo.h" #include <FL/Fl.H> #include <FL/Fl_Group.H> @@ -666,6 +667,7 @@ void x_cb(Fluid_Coord_Input *i, void *v) { x_input->activate(); } else x_input->deactivate(); } else { + undo_checkpoint(); widget_i = 0; int mod = 0; for (Fl_Type *o = Fl_Type::first; o; o = o->next) { @@ -690,6 +692,7 @@ void y_cb(Fluid_Coord_Input *i, void *v) { y_input->activate(); } else y_input->deactivate(); } else { + undo_checkpoint(); widget_i = 0; int mod = 0; for (Fl_Type *o = Fl_Type::first; o; o = o->next) { @@ -714,6 +717,7 @@ void w_cb(Fluid_Coord_Input *i, void *v) { w_input->activate(); } else w_input->deactivate(); } else { + undo_checkpoint(); widget_i = 0; int mod = 0; for (Fl_Type *o = Fl_Type::first; o; o = o->next) { @@ -738,6 +742,7 @@ void h_cb(Fluid_Coord_Input *i, void *v) { h_input->activate(); } else h_input->deactivate(); } else { + undo_checkpoint(); widget_i = 0; int mod = 0; for (Fl_Type *o = Fl_Type::first; o; o = o->next) { diff --git a/fluid/widget_panel.cxx b/fluid/widget_panel.cxx index 1fd59d4e0..df21f7d67 100644 --- a/fluid/widget_panel.cxx +++ b/fluid/widget_panel.cxx @@ -274,7 +274,8 @@ Fl_Double_Window* make_widget_panel() { o->callback((Fl_Callback*)position_group_cb); o->align(Fl_Align(FL_ALIGN_LEFT)); { widget_x_input = new Fluid_Coord_Input(95, 150, 55, 20, "X:"); - widget_x_input->tooltip("The X position of the widget."); + widget_x_input->tooltip("The X position of the widget as a number or formula.\nFormulas can be simple \ +math, including the variables\nx, px, sx, cx, and i"); widget_x_input->box(FL_DOWN_BOX); widget_x_input->color(FL_BACKGROUND2_COLOR); widget_x_input->selection_color(FL_SELECTION_COLOR); @@ -288,7 +289,8 @@ Fl_Double_Window* make_widget_panel() { widget_x_input->when(FL_WHEN_RELEASE); } // Fluid_Coord_Input* widget_x_input { widget_y_input = new Fluid_Coord_Input(155, 150, 55, 20, "Y:"); - widget_y_input->tooltip("The Y position of the widget."); + widget_y_input->tooltip("The Y position of the widget as a number or formula.\nFormulas can be simple \ +math, including the variables\ny, py, sy, cy, and i"); widget_y_input->box(FL_DOWN_BOX); widget_y_input->color(FL_BACKGROUND2_COLOR); widget_y_input->selection_color(FL_SELECTION_COLOR); @@ -302,7 +304,8 @@ Fl_Double_Window* make_widget_panel() { widget_y_input->when(FL_WHEN_RELEASE); } // Fluid_Coord_Input* widget_y_input { widget_w_input = new Fluid_Coord_Input(215, 150, 55, 20, "Width:"); - widget_w_input->tooltip("The width of the widget."); + widget_w_input->tooltip("The width of the widget as a number or formula.\nFormulas can be simple math,\ + including the variables\nw, pw, sw, cw, and i"); widget_w_input->box(FL_DOWN_BOX); widget_w_input->color(FL_BACKGROUND2_COLOR); widget_w_input->selection_color(FL_SELECTION_COLOR); @@ -316,7 +319,8 @@ Fl_Double_Window* make_widget_panel() { widget_w_input->when(FL_WHEN_RELEASE); } // Fluid_Coord_Input* widget_w_input { widget_h_input = new Fluid_Coord_Input(275, 150, 55, 20, "Height:"); - widget_h_input->tooltip("The height of the widget."); + widget_h_input->tooltip("The height of the widget as a number or formula.\nFormulas can be simple math\ +, including the variables\nh, ph, sh, ch, and i"); widget_h_input->box(FL_DOWN_BOX); widget_h_input->color(FL_BACKGROUND2_COLOR); widget_h_input->selection_color(FL_SELECTION_COLOR); diff --git a/fluid/widget_panel.fl b/fluid/widget_panel.fl index 149902ccb..798a386ac 100644 --- a/fluid/widget_panel.fl +++ b/fluid/widget_panel.fl @@ -264,30 +264,38 @@ Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 1 te Fl_Input widget_x_input { label {X:} callback x_cb - tooltip {The X position of the widget.} xywh {95 150 55 20} labelsize 11 align 5 textsize 11 + tooltip {The X position of the widget as a number or formula. +Formulas can be simple math, including the variables +x, px, sx, cx, and i} xywh {95 150 55 20} labelsize 11 align 5 textsize 11 class Fluid_Coord_Input } Fl_Input widget_y_input { label {Y:} callback y_cb - tooltip {The Y position of the widget.} xywh {155 150 55 20} labelsize 11 align 5 textsize 11 + tooltip {The Y position of the widget as a number or formula. +Formulas can be simple math, including the variables +y, py, sy, cy, and i} xywh {155 150 55 20} labelsize 11 align 5 textsize 11 class Fluid_Coord_Input } Fl_Input widget_w_input { label {Width:} callback w_cb - tooltip {The width of the widget.} xywh {215 150 55 20} labelsize 11 align 5 textsize 11 + tooltip {The width of the widget as a number or formula. +Formulas can be simple math, including the variables +w, pw, sw, cw, and i} xywh {215 150 55 20} labelsize 11 align 5 textsize 11 class Fluid_Coord_Input } Fl_Input widget_h_input { label {Height:} - callback h_cb - tooltip {The height of the widget.} xywh {275 150 55 20} labelsize 11 align 5 textsize 11 + callback h_cb selected + tooltip {The height of the widget as a number or formula. +Formulas can be simple math, including the variables +h, ph, sh, ch, and i} xywh {275 150 55 20} labelsize 11 align 5 textsize 11 class Fluid_Coord_Input } Fl_Choice {} { label {Children:} - callback wc_relative_cb open selected + callback wc_relative_cb open tooltip {When instantiating a widget class, the children can either be fixed in their original position, automatically be repositioned, or both repsositioned and resized to fit the container.} xywh {335 150 65 20} down_box BORDER_BOX labelsize 11 align 5 textsize 11 } { MenuItem {} { |
