From 41dd84016d5383f2648c25e4c6dd1d6e39418b20 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Wed, 13 Dec 2023 16:55:10 +0100 Subject: [PATCH] #862: Removes default shortcut from Fl_Shortcut_Button - the current UI for fallback/default/original shortcut was confusing, so I remove it until we find something better. I kept the values so we can reinstate a better interface without changing the API. --- FL/Fl_Shortcut_Button.H | 3 +++ fluid/Fl_Menu_Type.cxx | 2 +- fluid/alignment_panel.cxx | 2 +- fluid/alignment_panel.fl | 6 +++--- src/Fl_Shortcut_Button.cxx | 21 ++++++++++++++++++--- 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/FL/Fl_Shortcut_Button.H b/FL/Fl_Shortcut_Button.H index f07c05283..8e9511246 100644 --- a/FL/Fl_Shortcut_Button.H +++ b/FL/Fl_Shortcut_Button.H @@ -33,9 +33,12 @@ public: Fl_Shortcut_Button(int X,int Y,int W,int H, const char* l = 0); void value(Fl_Shortcut shortcut); Fl_Shortcut value(); +#if 0 + // Default shortcut settings are disabled until successful review of the UI void default_value(Fl_Shortcut shortcut); Fl_Shortcut default_value(); void default_clear(); +#endif }; #endif // Fl_Shortcut_Button_H diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx index 0a21ed296..c1d99257e 100644 --- a/fluid/Fl_Menu_Type.cxx +++ b/fluid/Fl_Menu_Type.cxx @@ -711,7 +711,7 @@ void shortcut_in_cb(Fl_Shortcut_Button* i, void* v) { i->parent()->hide(); return; } - i->default_value( i->value() ); // enable the "undo" capability of the shortcut button + //i->default_value( i->value() ); // enable the "undo" capability of the shortcut button i->show(); i->parent()->show(); i->redraw(); diff --git a/fluid/alignment_panel.cxx b/fluid/alignment_panel.cxx index 1d92d0233..ce2a6a884 100644 --- a/fluid/alignment_panel.cxx +++ b/fluid/alignment_panel.cxx @@ -1041,7 +1041,7 @@ static void cb_Shortcut(Fl_Shortcut_Button* o, void* v) { if (v == LOAD) { if (selected) { o->value(g_shell_config->list[selected-1]->shortcut); - o->default_value(o->value()); + //o->default_value(o->value()); } else { o->value(0); } diff --git a/fluid/alignment_panel.fl b/fluid/alignment_panel.fl index 4f6a388e2..71f8f18dc 100644 --- a/fluid/alignment_panel.fl +++ b/fluid/alignment_panel.fl @@ -156,7 +156,7 @@ Function {make_settings_window()} {open xywh {10 10 320 530} selection_color 12 labelsize 11 labelcolor 255 resizable } { Fl_Group {} { - label General open + label General open selected image {icons/general_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 resizable code0 {o->image()->scale(36, 24);} } { @@ -1092,7 +1092,7 @@ if (v == LOAD) { if (v == LOAD) { if (selected) { o->value(g_shell_config->list[selected-1]->shortcut); - o->default_value(o->value()); + //o->default_value(o->value()); } else { o->value(0); } @@ -1574,7 +1574,7 @@ Function {make_shell_window()} {open label {Shell Command Output} open xywh {769 585 555 430} type Double align 80 resizable visible } { - Fl_Terminal shell_run_terminal {selected + Fl_Terminal shell_run_terminal { xywh {10 10 535 375} resizable code0 {shell_run_terminal->ansi(1);} code1 {shell_run_terminal->history_lines(1000);} diff --git a/src/Fl_Shortcut_Button.cxx b/src/Fl_Shortcut_Button.cxx index 555371e0b..a9002d30f 100644 --- a/src/Fl_Shortcut_Button.cxx +++ b/src/Fl_Shortcut_Button.cxx @@ -75,7 +75,9 @@ Fl_Shortcut Fl_Shortcut_Button::value() { return shortcut_value; } -/** +#if 0 +// Default shortcut settings are disabled until successful review of the UI +/* * Set the default shortcut. If set, and additional 'reverse' button apears that the user can click to reset the shortcut to some default value (including 0). @@ -86,22 +88,29 @@ void Fl_Shortcut_Button::default_value(Fl_Shortcut shortcut) { default_set_ = true; redraw(); } +#endif -/** +#if 0 +// Default shortcut settings are disabled until successful review of the UI +/* * Return the default shortcut. \return shortcut encoded as key and modifier */ Fl_Shortcut Fl_Shortcut_Button::default_value() { return default_shortcut_; } +#endif -/** +#if 0 +// Default shortcut settings are disabled until successful review of the UI +/* * No longer show the button to reverse to a default shortcut. */ void Fl_Shortcut_Button::default_clear() { default_set_ = false; redraw(); } +#endif /** Draw the textual representation of the shortcut button. @@ -134,12 +143,16 @@ void Fl_Shortcut_Button::draw() { const char *text = label(); if (shortcut_value) text = fl_shortcut_label(shortcut_value); +#if 0 if (default_set_) { fl_draw(text, X, Y, W-H, H, align() | FL_ALIGN_INSIDE); fl_draw_symbol("@-29undo", X+W-H, Y, H, H, textcol); } else { fl_draw(text, X, Y, W, H, align() | FL_ALIGN_INSIDE); } +#else + fl_draw(text, X, Y, W, H, align() | FL_ALIGN_INSIDE); +#endif if (Fl::focus() == this) draw_focus(); } @@ -156,6 +169,7 @@ void Fl_Shortcut_Button::do_end_hot_callback() { Handle keystrokes to catch the user's shortcut. */ int Fl_Shortcut_Button::handle(int e) { +#if 0 bool inside_default_button = false; if (default_set_ && ( (e == FL_PUSH) || (e == FL_DRAG) || (e == FL_RELEASE) ) ) { int X = x() + Fl::box_dx(box()); @@ -184,6 +198,7 @@ int Fl_Shortcut_Button::handle(int e) { return 1; } } +#endif switch (e) { case FL_PUSH: if (Fl::visible_focus() && handle(FL_FOCUS)) Fl::focus(this);