summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2013-10-25 22:03:47 +0000
committerGreg Ercolano <erco@seriss.com>2013-10-25 22:03:47 +0000
commitf9470425359e8180ebe73f9585a4f27531f72839 (patch)
tree2fbcf91f316c6b0b1379913462d86039dcd4b844
parentd2f83a42c27b6689e79173201624994d23ff1123 (diff)
STR #2997: Disable ESC from closing code window.
This drives VI users crazy; a comman 'save' pattern is: (1) enter some code, (2) hit ESC, (3) type :w ENTER. In VI these actions save the code entered. in fluid it /dumps/ the code typed because ESC is a shortcut for the Cancel key. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10010 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--fluid/function_panel.cxx9
-rw-r--r--fluid/function_panel.fl12
2 files changed, 15 insertions, 6 deletions
diff --git a/fluid/function_panel.cxx b/fluid/function_panel.cxx
index 249f4e347..21e610d34 100644
--- a/fluid/function_panel.cxx
+++ b/fluid/function_panel.cxx
@@ -113,7 +113,6 @@ Fl_Double_Window* make_function_panel() {
} // Fl_Return_Button* f_panel_ok
{ f_panel_cancel = new Fl_Button(280, 200, 50, 20, "Cancel");
f_panel_cancel->tooltip("Cancel the changes.");
- f_panel_cancel->shortcut(0xff1b);
f_panel_cancel->labelsize(11);
} // Fl_Button* f_panel_cancel
{ Fl_Box* o = new Fl_Box(10, 200, 205, 20);
@@ -140,6 +139,12 @@ Fl_Double_Window* make_function_panel() {
Fl_Double_Window *code_panel=(Fl_Double_Window *)0;
+static void cb_code_panel(Fl_Double_Window*, void*) {
+ if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape)
+ return; // ignore Escape
+code_panel->hide(); // otherwise hide..;
+}
+
CodeEditor *code_input=(CodeEditor *)0;
Fl_Return_Button *code_panel_ok=(Fl_Return_Button *)0;
@@ -149,6 +154,7 @@ Fl_Button *code_panel_cancel=(Fl_Button *)0;
Fl_Double_Window* make_code_panel() {
{ Fl_Double_Window* o = code_panel = new Fl_Double_Window(540, 180, "Code Properties");
code_panel->labelsize(11);
+ code_panel->callback((Fl_Callback*)cb_code_panel);
{ CodeEditor* o = code_input = new CodeEditor(10, 10, 520, 130);
code_input->box(FL_DOWN_BOX);
code_input->color(FL_BACKGROUND2_COLOR);
@@ -171,7 +177,6 @@ Fl_Double_Window* make_code_panel() {
code_panel_ok->window()->hotspot(code_panel_ok);
} // Fl_Return_Button* code_panel_ok
{ code_panel_cancel = new Fl_Button(470, 150, 60, 20, "Cancel");
- code_panel_cancel->shortcut(0xff1b);
code_panel_cancel->labelsize(11);
} // Fl_Button* code_panel_cancel
{ Fl_Box* o = new Fl_Box(10, 150, 380, 20);
diff --git a/fluid/function_panel.fl b/fluid/function_panel.fl
index aaf34efb6..657b1f360 100644
--- a/fluid/function_panel.fl
+++ b/fluid/function_panel.fl
@@ -112,7 +112,7 @@ Function {make_function_panel()} {} {
}
Fl_Button f_panel_cancel {
label Cancel
- tooltip {Cancel the changes.} xywh {280 200 50 20} shortcut 0xff1b labelsize 11
+ tooltip {Cancel the changes.} xywh {280 200 50 20} labelsize 11
}
Fl_Box {} {
xywh {10 200 205 20} resizable
@@ -126,9 +126,13 @@ Function {make_function_panel()} {} {
}
}
-Function {make_code_panel()} {} {
+Function {make_code_panel()} {open
+} {
Fl_Window code_panel {
label {Code Properties}
+ callback {if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape)
+ return; // ignore Escape
+code_panel->hide(); // otherwise hide..} open selected
xywh {353 262 540 180} type Double labelsize 11 resizable
code0 {o->size_range(200, 150);} modal visible
} {
@@ -147,7 +151,7 @@ Function {make_code_panel()} {} {
}
Fl_Button code_panel_cancel {
label Cancel
- xywh {470 150 60 20} shortcut 0xff1b labelsize 11
+ xywh {470 150 60 20} labelsize 11
}
Fl_Box {} {
xywh {10 150 380 20} labelsize 11 resizable
@@ -825,7 +829,7 @@ else
}
Fl_Button {} {
user_data {"Fl_Tree"}
- callback type_make_cb selected
+ callback type_make_cb
tooltip Tree xywh {484 5 24 24} box THIN_UP_BOX
code0 {o->image(pixmap[50]);}
}