diff options
| author | Matthias Melcher <github@matthiasm.com> | 2022-12-10 13:11:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-10 13:11:49 +0100 |
| commit | fa41211ccae24d75e940721bae68d3abe7f2e1ee (patch) | |
| tree | 406d73ec3b15c01935982300de421393b6a68f0d /fluid/Fl_Widget_Type.cxx | |
| parent | 5673072271cdd797de3fa0f3136ca3f1d219484e (diff) | |
FLUID event handling and UI changes (#575)
* Full support o when()
* Making undo suspend nesting
* Finally correct undo handling for Label: input
* Documentation.
* Adding more undo checkpoints for the Widget Panel
* Quick selection of default user_data types
* Pulldown menu for system colors
* Make sure that partially typed text fields are propagated before saving
Diffstat (limited to 'fluid/Fl_Widget_Type.cxx')
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 361 |
1 files changed, 255 insertions, 106 deletions
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index 26e407235..58d0aa368 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -377,26 +377,59 @@ void name_public_cb(Fl_Choice* i, void* v) { } } -static char* oldlabel; -static unsigned oldlabellen; +/* Treating UNDO for text widget. + Goal: we want to continiously update the UI while the user is typing text + (changing the label, in this case). Source View does deferred uodates, and + the widget browser and widget panel update on every keystroke. At the same + time, we want to limit undo actions to few and logical units. + + Caveats: + + 1: the text widget has its own undo handling for the text field, but we may want to do a global undo + 2: every o->label() call will create an undo entry, but we want only one single event for all selected widgets + 3: we want a single undo for the entire editing phase, but still propagate changes as they happen + + The edit process has these main states: + + 1: starting to edit [first_change==1 && !unfocus]; we must create a single undo checkpoint before anything changes + 2: continue editing [first_change==0 && !unfocus] ; we must suspend any undo checkpoints + 3: done editing, unfocus [first_change==0 && unfocus]; we must make sure that undo checkpoints are enabled again + 4: losing focus without editing [first_change==1 && unfocus]; don't create and checkpoints + + We must also check: + 1: changing focus without changing text (works) + 2: copy and paste, drag and drop operations (works) + 3: save operation without unfocus event (works) + */ void label_cb(Fl_Input* i, void *v) { + static int first_change = 1; if (v == LOAD) { i->static_value(current_widget->label()); - if (strlen(i->value()) >= oldlabellen) { - oldlabellen = (int)strlen(i->value())+128; - oldlabel = (char*)realloc(oldlabel,oldlabellen); - } - strcpy(oldlabel,i->value()); + first_change = 1; } else { - int mod = 0; - for (Fl_Type *o = Fl_Type::first; o; o = o->next) { - if (o->selected && o->is_widget()) { - o->label(i->value()); - mod = 1; + if (i->changed()) { + undo_suspend(); + int mod = 0; + for (Fl_Type *o = Fl_Type::first; o; o = o->next) { + if (o->selected && o->is_widget()) { + if (!mod) { + if (first_change) { + undo_resume(); + undo_checkpoint(); + undo_suspend(); + first_change = 0; + } + mod = 1; + } + o->label(i->value()); + } } + undo_resume(); + if (mod) set_modflag(1); } - if (mod) set_modflag(1); + if ( (Fl::event() == FL_HIDE) || (Fl::event() == FL_UNFOCUS) ) + first_change = 1; } } @@ -790,6 +823,7 @@ void wc_relative_cb(Fl_Choice *i, void *v) { } } else { int mod = 0; + undo_checkpoint(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && !strcmp(current_widget->type_name(), "widget_class")) { Fl_Widget_Class_Type *t = (Fl_Widget_Class_Type *)o; @@ -992,39 +1026,54 @@ void down_box_cb(Fl_Choice* i, void *v) { //////////////////////////////////////////////////////////////// Fl_Menu_Item whenmenu[] = { - {"Never",0,0,(void*)ZERO_ENTRY}, - {"Release",0,0,(void*)FL_WHEN_RELEASE}, - {"Changed",0,0,(void*)FL_WHEN_CHANGED}, - {"Enter key",0,0,(void*)FL_WHEN_ENTER_KEY}, - //{"Release or Enter",0,0,(void*)(FL_WHEN_ENTER_KEY|FL_WHEN_RELEASE)}, + {"FL_WHEN_CHANGED",0,0,(void*)FL_WHEN_CHANGED, FL_MENU_TOGGLE}, + {"FL_WHEN_NOT_CHANGED",0,0,(void*)FL_WHEN_NOT_CHANGED, FL_MENU_TOGGLE}, + {"FL_WHEN_RELEASE",0,0,(void*)FL_WHEN_RELEASE, FL_MENU_TOGGLE}, + {"FL_WHEN_ENTER_KEY",0,0,(void*)FL_WHEN_ENTER_KEY, FL_MENU_TOGGLE}, {0}}; static Fl_Menu_Item whensymbolmenu[] = { - {"FL_WHEN_NEVER",0,0,(void*)(FL_WHEN_NEVER)}, - {"FL_WHEN_CHANGED",0,0,(void*)(FL_WHEN_CHANGED)}, - {"FL_WHEN_RELEASE",0,0,(void*)(FL_WHEN_RELEASE)}, - {"FL_WHEN_RELEASE_ALWAYS",0,0,(void*)(FL_WHEN_RELEASE_ALWAYS)}, - {"FL_WHEN_ENTER_KEY",0,0,(void*)(FL_WHEN_ENTER_KEY)}, - {"FL_WHEN_ENTER_KEY_ALWAYS",0,0,(void*)(FL_WHEN_ENTER_KEY_ALWAYS)}, - {0}}; + /* 0 */ {"FL_WHEN_NEVER",0,0,(void*)FL_WHEN_NEVER}, + /* 1 */ {"FL_WHEN_CHANGED",0,0,(void*)FL_WHEN_CHANGED}, + /* 2 */ {"FL_WHEN_NOT_CHANGED",0,0,(void*)FL_WHEN_NOT_CHANGED}, + /* 3 */ {"FL_WHEN_CHANGED | FL_WHEN_NOT_CHANGED",0,0,(void*)(FL_WHEN_CHANGED|FL_WHEN_NOT_CHANGED)}, + /* 4 */ {"FL_WHEN_RELEASE",0,0,(void*)FL_WHEN_RELEASE}, + /* 5 */ {"FL_WHEN_CHANGED | FL_WHEN_RELEASE",0,0,(void*)(FL_WHEN_CHANGED|FL_WHEN_RELEASE)}, + /* 6 */ {"FL_WHEN_RELEASE_ALWAYS",0,0,(void*)FL_WHEN_RELEASE_ALWAYS}, + /* 7 */ {"FL_WHEN_CHANGED | FL_WHEN_RELEASE_ALWAYS",0,0,(void*)(FL_WHEN_CHANGED|FL_WHEN_RELEASE_ALWAYS)}, + /* 8 */ {"FL_WHEN_ENTER_KEY",0,0,(void*)FL_WHEN_ENTER_KEY}, + /* 9 */ {"FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY",0,0,(void*)(FL_WHEN_CHANGED|FL_WHEN_ENTER_KEY)}, + /* 10 */ {"FL_WHEN_ENTER_KEY_ALWAYS",0,0,(void*)FL_WHEN_ENTER_KEY_ALWAYS}, + /* 11 */ {"FL_WHEN_ENTER_KEY_CHANGED",0,0,(void*)FL_WHEN_ENTER_KEY_CHANGED}, + /* 12 */ {"FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY",0,0,(void*)(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY)}, + /* 13 */ {"FL_WHEN_RELEASE | FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY",0,0,(void*)(FL_WHEN_RELEASE|FL_WHEN_CHANGED|FL_WHEN_ENTER_KEY)}, + /* 14 */ {"FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY_ALWAYS",0,0,(void*)(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY_ALWAYS)}, + /* 15 */ {"FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY_CHANGED",0,0,(void*)(FL_WHEN_RELEASE|FL_WHEN_ENTER_KEY_CHANGED)}, + {0} +}; -void when_cb(Fl_Choice* i, void *v) { +void when_cb(Fl_Menu_Button* i, void *v) { if (v == LOAD) { if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate(); - int n = current_widget->o->when() & (~FL_WHEN_NOT_CHANGED); - if (!n) n = ZERO_ENTRY; - for (int j = 0; j < int(sizeof(whenmenu)/sizeof(*whenmenu)); j++) - if (whenmenu[j].argument() == n) {i->value(j); break;} + int n = current_widget->o->when() & 15; + if (n&1) whenmenu[0].set(); else whenmenu[0].clear(); + if (n&2) whenmenu[1].set(); else whenmenu[1].clear(); + if (n&4) whenmenu[2].set(); else whenmenu[2].clear(); + if (n&8) whenmenu[3].set(); else whenmenu[3].clear(); + w_when_box->label(whensymbolmenu[n].label()); } else { int mod = 0; int m = i->value(); - int n = int(whenmenu[m].argument()); - if (!n) return; // should not happen - if (n == ZERO_ENTRY) n = 0; + int n = 0; + if (whenmenu[0].value()) n |= 1; + if (whenmenu[1].value()) n |= 2; + if (whenmenu[2].value()) n |= 4; + if (whenmenu[3].value()) n |= 8; + w_when_box->label(whensymbolmenu[n].label()); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_widget()) { Fl_Widget_Type* q = (Fl_Widget_Type*)o; - q->o->when(n|(q->o->when()&FL_WHEN_NOT_CHANGED)); + q->o->when(n); mod = 1; } } @@ -1032,22 +1081,22 @@ void when_cb(Fl_Choice* i, void *v) { } } -void when_button_cb(Fl_Light_Button* i, void *v) { - if (v == LOAD) { - if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate(); - i->value(current_widget->o->when()&FL_WHEN_NOT_CHANGED); - } else { - int mod = 0; - int n = i->value() ? FL_WHEN_NOT_CHANGED : 0; - for (Fl_Type *o = Fl_Type::first; o; o = o->next) { - if (o->selected && o->is_widget()) { - Fl_Widget_Type* q = (Fl_Widget_Type*)o; - q->o->when(n|(q->o->when()&~FL_WHEN_NOT_CHANGED)); - mod = 1; - } - } - if (mod) set_modflag(1); - } +void when_button_cb(Fl_Box* i, void *v) { +// if (v == LOAD) { +// if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate(); +// i->value(current_widget->o->when()&FL_WHEN_NOT_CHANGED); +// } else { +// int mod = 0; +// int n = i->value() ? FL_WHEN_NOT_CHANGED : 0; +// for (Fl_Type *o = Fl_Type::first; o; o = o->next) { +// if (o->selected && o->is_widget()) { +// Fl_Widget_Type* q = (Fl_Widget_Type*)o; +// q->o->when(n|(q->o->when()&~FL_WHEN_NOT_CHANGED)); +// mod = 1; +// } +// } +// if (mod) set_modflag(1); +// } } uchar Fl_Widget_Type::resizable() const { @@ -1083,6 +1132,7 @@ void resizable_cb(Fl_Light_Button* i,void* v) { i->activate(); i->value(current_widget->resizable()); } else { + undo_checkpoint(); current_widget->resizable(i->value()); set_modflag(1); } @@ -1096,8 +1146,12 @@ void hotspot_cb(Fl_Light_Button* i,void* v) { i->activate(); i->value(current_widget->hotspot()); } else { + undo_checkpoint(); current_widget->hotspot(i->value()); - if (current_widget->is_menu_item()) {current_widget->redraw(); return;} + if (current_widget->is_menu_item()) { + current_widget->redraw(); + return; + } if (i->value()) { Fl_Type *p = current_widget->parent; if (!p || !p->is_widget()) return; @@ -1121,10 +1175,13 @@ void visible_cb(Fl_Light_Button* i, void* v) { int n = i->value(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_widget()) { + if (!mod) { + mod = 1; + undo_checkpoint(); + } Fl_Widget_Type* q = (Fl_Widget_Type*)o; n ? q->o->show() : q->o->hide(); q->redraw(); - mod = 1; if (n && q->parent && q->parent->type_name()) { if (!strcmp(q->parent->type_name(), "Fl_Tabs")) { ((Fl_Tabs *)q->o->parent())->value(q->o); @@ -1151,10 +1208,13 @@ void active_cb(Fl_Light_Button* i, void* v) { int n = i->value(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_widget()) { + if (!mod) { + mod = 1; + undo_checkpoint(); + } Fl_Widget_Type* q = (Fl_Widget_Type*)o; n ? q->o->activate() : q->o->deactivate(); q->redraw(); - mod = 1; } } if (mod) set_modflag(1); @@ -1259,70 +1319,137 @@ void labeltype_cb(Fl_Choice* i, void *v) { //////////////////////////////////////////////////////////////// +Fl_Menu_Item colormenu[] = { + { "Foreground Color", 0, 0, (void*)FL_FOREGROUND_COLOR, 0, 0, FL_HELVETICA, 11}, + { "Background Color", 0, 0, (void*)FL_BACKGROUND_COLOR, 0, 0, FL_HELVETICA, 11}, + { "Background Color 2", 0, 0, (void*)FL_BACKGROUND2_COLOR, 0, 0, FL_HELVETICA, 11}, + { "Selection Color", 0, 0, (void*)FL_SELECTION_COLOR, 0, 0, FL_HELVETICA, 11}, + { "Inactive Color", 0, 0, (void*)FL_INACTIVE_COLOR, FL_MENU_DIVIDER, 0, FL_HELVETICA, 11}, + { "Black", 0, 0, (void*)FL_BLACK, 0, 0, FL_HELVETICA, 11}, + { "White", 0, 0, (void*)FL_WHITE, FL_MENU_DIVIDER, 0, FL_HELVETICA, 11}, + { "Gray 0", 0, 0, (void*)FL_GRAY0, 0, 0, FL_HELVETICA, 11}, + { "Dark 3", 0, 0, (void*)FL_DARK3, 0, 0, FL_HELVETICA, 11}, + { "Dark 2", 0, 0, (void*)FL_DARK2, 0, 0, FL_HELVETICA, 11}, + { "Dark 1", 0, 0, (void*)FL_DARK1, 0, 0, FL_HELVETICA, 11}, + { "Light 1", 0, 0, (void*)FL_LIGHT1, 0, 0, FL_HELVETICA, 11}, + { "Light 2", 0, 0, (void*)FL_LIGHT2, 0, 0, FL_HELVETICA, 11}, + { "Light 3", 0, 0, (void*)FL_LIGHT3, 0, 0, FL_HELVETICA, 11}, + { 0 } +}; + +void color_common(Fl_Color c) { + int mod = 0; + for (Fl_Type *o = Fl_Type::first; o; o = o->next) { + if (o->selected && o->is_widget()) { + Fl_Widget_Type* q = (Fl_Widget_Type*)o; + q->o->color(c); q->o->redraw(); + if (q->parent && q->parent->type_name() == tabs_type_name) { + if (q->o->parent()) q->o->parent()->redraw(); + } + mod = 1; + } + } + if (mod) set_modflag(1); +} + void color_cb(Fl_Button* i, void *v) { Fl_Color c = current_widget->o->color(); if (v == LOAD) { if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate(); } else { - int mod = 0; Fl_Color d = fl_show_colormap(c); if (d == c) return; c = d; - for (Fl_Type *o = Fl_Type::first; o; o = o->next) { - if (o->selected && o->is_widget()) { - Fl_Widget_Type* q = (Fl_Widget_Type*)o; - q->o->color(c); q->o->redraw(); - if (q->parent && q->parent->type_name() == tabs_type_name) { - if (q->o->parent()) q->o->parent()->redraw(); - } - mod = 1; - } - } - if (mod) set_modflag(1); + color_common(c); } i->color(c); i->labelcolor(fl_contrast(FL_BLACK,c)); i->redraw(); } +void color_menu_cb(Fl_Menu_Button* i, void *v) { + Fl_Color c = current_widget->o->color(); + if (v == LOAD) { + if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate(); + } else { + Fl_Color d = i->mvalue()->argument(); + if (d == c) return; + c = d; + color_common(c); + w_color->color(c); w_color->labelcolor(fl_contrast(FL_BLACK,c)); w_color->redraw(); + } +} + +void color2_common(Fl_Color c) { + int mod = 0; + for (Fl_Type *o = Fl_Type::first; o; o = o->next) { + if (o->selected && o->is_widget()) { + Fl_Widget_Type* q = (Fl_Widget_Type*)o; + q->o->selection_color(c); q->o->redraw(); + mod = 1; + } + } + if (mod) set_modflag(1); +} + void color2_cb(Fl_Button* i, void *v) { Fl_Color c = current_widget->o->selection_color(); if (v == LOAD) { if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate(); } else { - int mod = 0; Fl_Color d = fl_show_colormap(c); if (d == c) return; c = d; - for (Fl_Type *o = Fl_Type::first; o; o = o->next) { - if (o->selected && o->is_widget()) { - Fl_Widget_Type* q = (Fl_Widget_Type*)o; - q->o->selection_color(c); q->o->redraw(); - mod = 1; - } - } - if (mod) set_modflag(1); + color2_common(c); } i->color(c); i->labelcolor(fl_contrast(FL_BLACK,c)); i->redraw(); } +void color2_menu_cb(Fl_Menu_Button* i, void *v) { + Fl_Color c = current_widget->o->selection_color(); + if (v == LOAD) { + if (current_widget->is_menu_item()) {i->deactivate(); return;} else i->activate(); + } else { + Fl_Color d = i->mvalue()->argument(); + if (d == c) return; + c = d; + color2_common(c); + w_selectcolor->color(c); w_selectcolor->labelcolor(fl_contrast(FL_BLACK,c)); w_selectcolor->redraw(); + } +} + +void labelcolor_common(Fl_Color c) { + int mod = 0; + for (Fl_Type *o = Fl_Type::first; o; o = o->next) { + if (o->selected && o->is_widget()) { + Fl_Widget_Type* q = (Fl_Widget_Type*)o; + q->o->labelcolor(c); q->redraw(); + mod = 1; + } + } + if (mod) set_modflag(1); +} + void labelcolor_cb(Fl_Button* i, void *v) { Fl_Color c = current_widget->o->labelcolor(); if (v != LOAD) { - int mod = 0; Fl_Color d = fl_show_colormap(c); if (d == c) return; c = d; - for (Fl_Type *o = Fl_Type::first; o; o = o->next) { - if (o->selected && o->is_widget()) { - Fl_Widget_Type* q = (Fl_Widget_Type*)o; - q->o->labelcolor(c); q->redraw(); - mod = 1; - } - } - if (mod) set_modflag(1); + labelcolor_common(c); } i->color(c); i->labelcolor(fl_contrast(FL_BLACK,c)); i->redraw(); } +void labelcolor_menu_cb(Fl_Menu_Button* i, void *v) { + Fl_Color c = current_widget->o->labelcolor(); + if (v != LOAD) { + Fl_Color d = i->mvalue()->argument(); + if (d == c) return; + c = d; + labelcolor_common(c); + w_labelcolor->color(c); w_labelcolor->labelcolor(fl_contrast(FL_BLACK,c)); w_labelcolor->redraw(); + } +} + static Fl_Button* relative(Fl_Widget* o, int i) { Fl_Group* g = (Fl_Group*)(o->parent()); return (Fl_Button*)(g->child(g->find(*o)+i)); @@ -1355,6 +1482,7 @@ void align_cb(Fl_Button* i, void *v) { i->value(current_widget->o->align() & b); } else { int mod = 0; + undo_checkpoint(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_widget()) { Fl_Widget_Type* q = (Fl_Widget_Type*)o; @@ -1399,6 +1527,7 @@ void align_position_cb(Fl_Choice *i, void *v) { const Fl_Menu_Item *mi = i->menu() + i->value(); Fl_Align b = Fl_Align(fl_uintptr_t(mi->user_data())); int mod = 0; + undo_checkpoint(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_widget()) { Fl_Widget_Type* q = (Fl_Widget_Type*)o; @@ -1428,6 +1557,7 @@ void align_text_image_cb(Fl_Choice *i, void *v) { const Fl_Menu_Item *mi = i->menu() + i->value(); Fl_Align b = Fl_Align(fl_uintptr_t(mi->user_data())); int mod = 0; + undo_checkpoint(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_widget()) { Fl_Widget_Type* q = (Fl_Widget_Type*)o; @@ -1506,12 +1636,12 @@ void user_data_cb(Fl_Input *i, void *v) { } } -void user_data_type_cb(Fl_Input *i, void *v) { +void user_data_type_cb(Fl_Input_Choice *i, void *v) { static const char *dflt = "void*"; if (v == LOAD) { const char *c = current_widget->user_data_type(); if (!c) c = dflt; - i->static_value(c); + i->value(c); } else { int mod = 0; const char *c = i->value(); @@ -1624,29 +1754,49 @@ void textsize_cb(Fl_Value_Input* i, void* v) { i->value(s); } +void textcolor_common(Fl_Color c) { + Fl_Font n; int s; + int mod = 0; + for (Fl_Type *o = Fl_Type::first; o; o = o->next) { + if (o->selected && o->is_widget()) { + Fl_Widget_Type* q = (Fl_Widget_Type*)o; + q->textstuff(3,n,s,c); q->o->redraw(); + mod = 1; + } + } + if (mod) set_modflag(1); +} + void textcolor_cb(Fl_Button* i, void* v) { Fl_Font n; int s; Fl_Color c; if (v == LOAD) { if (!current_widget->textstuff(0,n,s,c)) {i->deactivate(); return;} i->activate(); } else { - int mod = 0; c = i->color(); Fl_Color d = fl_show_colormap(c); if (d == c) return; c = d; - for (Fl_Type *o = Fl_Type::first; o; o = o->next) { - if (o->selected && o->is_widget()) { - Fl_Widget_Type* q = (Fl_Widget_Type*)o; - q->textstuff(3,n,s,c); q->o->redraw(); - mod = 1; - } - } - if (mod) set_modflag(1); + textcolor_common(c); } i->color(c); i->labelcolor(fl_contrast(FL_BLACK,c)); i->redraw(); } +void textcolor_menu_cb(Fl_Menu_Button* i, void* v) { + Fl_Font n; int s; Fl_Color c; + if (v == LOAD) { + if (!current_widget->textstuff(0,n,s,c)) {i->deactivate(); return;} + i->activate(); + } else { + c = i->color(); + Fl_Color d = i->mvalue()->argument(); + if (d == c) return; + c = d; + textcolor_common(c); + w_textcolor->color(c); w_textcolor->labelcolor(fl_contrast(FL_BLACK,c)); w_textcolor->redraw(); + } +} + //////////////////////////////////////////////////////////////// // Kludges to the panel for subclasses: @@ -1656,6 +1806,7 @@ void min_w_cb(Fl_Value_Input* i, void* v) { i->value(((Fl_Window_Type*)current_widget)->sr_min_w); } else { int mod = 0; + undo_checkpoint(); int n = (int)i->value(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_window()) { @@ -1673,6 +1824,7 @@ void min_h_cb(Fl_Value_Input* i, void* v) { i->value(((Fl_Window_Type*)current_widget)->sr_min_h); } else { int mod = 0; + undo_checkpoint(); int n = (int)i->value(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_window()) { @@ -1690,6 +1842,7 @@ void max_w_cb(Fl_Value_Input* i, void* v) { i->value(((Fl_Window_Type*)current_widget)->sr_max_w); } else { int mod = 0; + undo_checkpoint(); int n = (int)i->value(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_window()) { @@ -1707,6 +1860,7 @@ void max_h_cb(Fl_Value_Input* i, void* v) { i->value(((Fl_Window_Type*)current_widget)->sr_max_h); } else { int mod = 0; + undo_checkpoint(); int n = (int)i->value(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_window()) { @@ -1722,6 +1876,7 @@ void set_min_size_cb(Fl_Button*, void* v) { if (v == LOAD) { } else { int mod = 0; + undo_checkpoint(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_window()) { Fl_Window_Type *win = (Fl_Window_Type*)current_widget; @@ -1739,6 +1894,7 @@ void set_max_size_cb(Fl_Button*, void* v) { if (v == LOAD) { } else { int mod = 0; + undo_checkpoint(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_window()) { Fl_Window_Type *win = (Fl_Window_Type*)current_widget; @@ -1759,6 +1915,7 @@ void slider_size_cb(Fl_Value_Input* i, void* v) { i->value(((Fl_Slider*)(current_widget->o))->slider_size()); } else { int mod = 0; + undo_checkpoint(); double n = i->value(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_widget()) { @@ -1788,6 +1945,7 @@ void min_cb(Fl_Value_Input* i, void* v) { } } else { int mod = 0; + undo_checkpoint(); double n = i->value(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_widget()) { @@ -1821,6 +1979,7 @@ void max_cb(Fl_Value_Input* i, void* v) { } } else { int mod = 0; + undo_checkpoint(); double n = i->value(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_widget()) { @@ -1854,6 +2013,7 @@ void step_cb(Fl_Value_Input* i, void* v) { } } else { int mod = 0; + undo_checkpoint(); double n = i->value(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_widget()) { @@ -1888,6 +2048,7 @@ void value_cb(Fl_Value_Input* i, void* v) { i->deactivate(); } else { int mod = 0; + undo_checkpoint(); double n = i->value(); for (Fl_Type *o = Fl_Type::first; o; o = o->next) { if (o->selected && o->is_widget()) { @@ -2259,18 +2420,6 @@ void ok_cb(Fl_Return_Button* o, void* v) { if (!haderror) the_panel->hide(); } -void revert_cb(Fl_Button*, void*) { - // We have to revert all dynamically changing fields: - // but for now only the first label works... - if (numselected == 1) current_widget->label(oldlabel); - propagate_load(the_panel, LOAD); -} - -void cancel_cb(Fl_Button* o, void* v) { - revert_cb(o,v); - the_panel->hide(); -} - void toggle_overlays(Fl_Widget *,void *); // in Fl_Window_Type.cxx void overlay_cb(Fl_Button*o,void *v) { toggle_overlays(o,v); |
