mirror of
https://github.com/fltk/fltk.git
synced 2026-05-29 20:45:33 +08:00
#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.
This commit is contained in:
@@ -33,9 +33,12 @@ public:
|
|||||||
Fl_Shortcut_Button(int X,int Y,int W,int H, const char* l = 0);
|
Fl_Shortcut_Button(int X,int Y,int W,int H, const char* l = 0);
|
||||||
void value(Fl_Shortcut shortcut);
|
void value(Fl_Shortcut shortcut);
|
||||||
Fl_Shortcut value();
|
Fl_Shortcut value();
|
||||||
|
#if 0
|
||||||
|
// Default shortcut settings are disabled until successful review of the UI
|
||||||
void default_value(Fl_Shortcut shortcut);
|
void default_value(Fl_Shortcut shortcut);
|
||||||
Fl_Shortcut default_value();
|
Fl_Shortcut default_value();
|
||||||
void default_clear();
|
void default_clear();
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Fl_Shortcut_Button_H
|
#endif // Fl_Shortcut_Button_H
|
||||||
|
|||||||
@@ -711,7 +711,7 @@ void shortcut_in_cb(Fl_Shortcut_Button* i, void* v) {
|
|||||||
i->parent()->hide();
|
i->parent()->hide();
|
||||||
return;
|
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->show();
|
||||||
i->parent()->show();
|
i->parent()->show();
|
||||||
i->redraw();
|
i->redraw();
|
||||||
|
|||||||
@@ -1041,7 +1041,7 @@ static void cb_Shortcut(Fl_Shortcut_Button* o, void* v) {
|
|||||||
if (v == LOAD) {
|
if (v == LOAD) {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
o->value(g_shell_config->list[selected-1]->shortcut);
|
o->value(g_shell_config->list[selected-1]->shortcut);
|
||||||
o->default_value(o->value());
|
//o->default_value(o->value());
|
||||||
} else {
|
} else {
|
||||||
o->value(0);
|
o->value(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ Function {make_settings_window()} {open
|
|||||||
xywh {10 10 320 530} selection_color 12 labelsize 11 labelcolor 255 resizable
|
xywh {10 10 320 530} selection_color 12 labelsize 11 labelcolor 255 resizable
|
||||||
} {
|
} {
|
||||||
Fl_Group {} {
|
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
|
image {icons/general_64.png} compress_image 1 xywh {10 60 320 480} labelsize 11 resizable
|
||||||
code0 {o->image()->scale(36, 24);}
|
code0 {o->image()->scale(36, 24);}
|
||||||
} {
|
} {
|
||||||
@@ -1092,7 +1092,7 @@ if (v == LOAD) {
|
|||||||
if (v == LOAD) {
|
if (v == LOAD) {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
o->value(g_shell_config->list[selected-1]->shortcut);
|
o->value(g_shell_config->list[selected-1]->shortcut);
|
||||||
o->default_value(o->value());
|
//o->default_value(o->value());
|
||||||
} else {
|
} else {
|
||||||
o->value(0);
|
o->value(0);
|
||||||
}
|
}
|
||||||
@@ -1574,7 +1574,7 @@ Function {make_shell_window()} {open
|
|||||||
label {Shell Command Output} open
|
label {Shell Command Output} open
|
||||||
xywh {769 585 555 430} type Double align 80 resizable visible
|
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
|
xywh {10 10 535 375} resizable
|
||||||
code0 {shell_run_terminal->ansi(1);}
|
code0 {shell_run_terminal->ansi(1);}
|
||||||
code1 {shell_run_terminal->history_lines(1000);}
|
code1 {shell_run_terminal->history_lines(1000);}
|
||||||
|
|||||||
@@ -75,7 +75,9 @@ Fl_Shortcut Fl_Shortcut_Button::value() {
|
|||||||
return shortcut_value;
|
return shortcut_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#if 0
|
||||||
|
// Default shortcut settings are disabled until successful review of the UI
|
||||||
|
/* *
|
||||||
Set the default shortcut.
|
Set the default shortcut.
|
||||||
If set, and additional 'reverse' button apears that the user can click to
|
If set, and additional 'reverse' button apears that the user can click to
|
||||||
reset the shortcut to some default value (including 0).
|
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;
|
default_set_ = true;
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
#if 0
|
||||||
|
// Default shortcut settings are disabled until successful review of the UI
|
||||||
|
/* *
|
||||||
Return the default shortcut.
|
Return the default shortcut.
|
||||||
\return shortcut encoded as key and modifier
|
\return shortcut encoded as key and modifier
|
||||||
*/
|
*/
|
||||||
Fl_Shortcut Fl_Shortcut_Button::default_value() {
|
Fl_Shortcut Fl_Shortcut_Button::default_value() {
|
||||||
return default_shortcut_;
|
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.
|
No longer show the button to reverse to a default shortcut.
|
||||||
*/
|
*/
|
||||||
void Fl_Shortcut_Button::default_clear() {
|
void Fl_Shortcut_Button::default_clear() {
|
||||||
default_set_ = false;
|
default_set_ = false;
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Draw the textual representation of the shortcut button.
|
Draw the textual representation of the shortcut button.
|
||||||
@@ -134,12 +143,16 @@ void Fl_Shortcut_Button::draw() {
|
|||||||
const char *text = label();
|
const char *text = label();
|
||||||
if (shortcut_value)
|
if (shortcut_value)
|
||||||
text = fl_shortcut_label(shortcut_value);
|
text = fl_shortcut_label(shortcut_value);
|
||||||
|
#if 0
|
||||||
if (default_set_) {
|
if (default_set_) {
|
||||||
fl_draw(text, X, Y, W-H, H, align() | FL_ALIGN_INSIDE);
|
fl_draw(text, X, Y, W-H, H, align() | FL_ALIGN_INSIDE);
|
||||||
fl_draw_symbol("@-29undo", X+W-H, Y, H, H, textcol);
|
fl_draw_symbol("@-29undo", X+W-H, Y, H, H, textcol);
|
||||||
} else {
|
} else {
|
||||||
fl_draw(text, X, Y, W, H, align() | FL_ALIGN_INSIDE);
|
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();
|
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.
|
Handle keystrokes to catch the user's shortcut.
|
||||||
*/
|
*/
|
||||||
int Fl_Shortcut_Button::handle(int e) {
|
int Fl_Shortcut_Button::handle(int e) {
|
||||||
|
#if 0
|
||||||
bool inside_default_button = false;
|
bool inside_default_button = false;
|
||||||
if (default_set_ && ( (e == FL_PUSH) || (e == FL_DRAG) || (e == FL_RELEASE) ) ) {
|
if (default_set_ && ( (e == FL_PUSH) || (e == FL_DRAG) || (e == FL_RELEASE) ) ) {
|
||||||
int X = x() + Fl::box_dx(box());
|
int X = x() + Fl::box_dx(box());
|
||||||
@@ -184,6 +198,7 @@ int Fl_Shortcut_Button::handle(int e) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
switch (e) {
|
switch (e) {
|
||||||
case FL_PUSH:
|
case FL_PUSH:
|
||||||
if (Fl::visible_focus() && handle(FL_FOCUS)) Fl::focus(this);
|
if (Fl::visible_focus() && handle(FL_FOCUS)) Fl::focus(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user