|
|
commit 8e864bae21bcebb3d40c140dca44f95bb5b95e94
Author: Matthias Melcher <git@matthiasm.com>
AuthorDate: Sat Dec 11 13:15:23 2021 +0100
Commit: Matthias Melcher <git@matthiasm.com>
CommitDate: Sat Dec 11 13:19:15 2021 +0100
Fluid PR 313: update subtype menu to show "Normal" when deactivated.
Based on jdpalmer's pull request:
If the subtype menu is disabled because there are no subtypes, the deactivated menu will still display the subtype of the last widget that had a subtype value. Clearing the menu when there are no subtypes fixes this minor inconsistency.
fluid/Fl_Widget_Type.cxx | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git fluid/Fl_Widget_Type.cxx fluid/Fl_Widget_Type.cxx
index 00bc95c..37cfa5f 100644
--- fluid/Fl_Widget_Type.cxx
+++ fluid/Fl_Widget_Type.cxx
@@ -1726,21 +1726,30 @@ void value_cb(Fl_Value_Input* i, void* v) {
Fl_Menu_Item *Fl_Widget_Type::subtypes() {return 0;}
void subtype_cb(Fl_Choice* i, void* v) {
+ static Fl_Menu_Item empty_type_menu[] = {
+ {"Normal",0,0,(void*)0},
+ {0}};
+
if (v == LOAD) {
Fl_Menu_Item* m = current_widget->subtypes();
- if (!m) {i->deactivate(); return;}
- i->menu(m);
- int j;
- for (j = 0;; j++) {
- if (!m[j].text) {j = 0; break;}
- if (current_widget->is_spinner()) {
- if (m[j].argument() == ((Fl_Spinner*)current_widget->o)->type()) break;
- } else {
- if (m[j].argument() == current_widget->o->type()) break;
+ if (!m) {
+ i->menu(empty_type_menu);
+ i->value(0);
+ i->deactivate();
+ } else {
+ i->menu(m);
+ int j;
+ for (j = 0;; j++) {
+ if (!m[j].text) {j = 0; break;}
+ if (current_widget->is_spinner()) {
+ if (m[j].argument() == ((Fl_Spinner*)current_widget->o)->type()) break;
+ } else {
+ if (m[j].argument() == current_widget->o->type()) break;
+ }
}
+ i->value(j);
+ i->activate();
}
- i->value(j);
- i->activate();
i->redraw();
} else {
int mod = 0;
[ Direct Link to Message ] | |
|
| |