From 552502d44afeb7214fefe0266bd9abe3d503f47e Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 2 Apr 2015 14:08:18 +0000 Subject: Fixed the Tab order in Fluid dialogs that contain a comment field. The comment field can no longer have tabs in it anymore (hey, it's either that or the other, right?). But I believe that this is a limitation that the user can easily live with. It's just comments, not code. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10658 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- fluid/function_panel.cxx | 89 +++++++++++++++++++++++++++--------------------- fluid/function_panel.fl | 82 ++++++++++++++++++++++++-------------------- fluid/function_panel.h | 8 ++--- 3 files changed, 99 insertions(+), 80 deletions(-) (limited to 'fluid') diff --git a/fluid/function_panel.cxx b/fluid/function_panel.cxx index fcd4d599c..c72524b93 100644 --- a/fluid/function_panel.cxx +++ b/fluid/function_panel.cxx @@ -28,6 +28,13 @@ extern void select_only(Fl_Type*); extern void exit_cb(Fl_Widget*, void*); extern void toggle_widgetbin_cb(Fl_Widget*, void*); +/** + Allow Windget navigation on Text fields with Tab. +*/ +static int use_tab_navigation(int, Fl_Text_Editor*) { + return 0; +} + Fl_Double_Window *function_panel=(Fl_Double_Window *)0; Fl_Choice *f_public_member_choice=(Fl_Choice *)0; @@ -53,12 +60,12 @@ Fl_Input *f_name_input=(Fl_Input *)0; Fl_Input *f_return_type_input=(Fl_Input *)0; +Fl_Text_Editor *f_comment_input=(Fl_Text_Editor *)0; + Fl_Return_Button *f_panel_ok=(Fl_Return_Button *)0; Fl_Button *f_panel_cancel=(Fl_Button *)0; -Fl_Text_Editor *f_comment_input=(Fl_Text_Editor *)0; - Fl_Double_Window* make_function_panel() { { function_panel = new Fl_Double_Window(343, 232, "Function/Method Properties"); { Fl_Group* o = new Fl_Group(10, 10, 270, 20); @@ -105,6 +112,18 @@ Fl_Double_Window* make_function_panel() { f_return_type_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); f_return_type_input->when(FL_WHEN_NEVER); } // Fl_Input* f_return_type_input + { f_comment_input = new Fl_Text_Editor(10, 125, 320, 65, "Comment:"); + f_comment_input->tooltip("Function comment in Doxygen format"); + f_comment_input->box(FL_DOWN_BOX); + f_comment_input->labelfont(1); + f_comment_input->labelsize(11); + f_comment_input->textfont(4); + f_comment_input->textsize(11); + f_comment_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + Fl_Group::current()->resizable(f_comment_input); + f_comment_input->buffer(new Fl_Text_Buffer()); + f_comment_input->add_key_binding(FL_Tab, 0, use_tab_navigation); + } // Fl_Text_Editor* f_comment_input { Fl_Group* o = new Fl_Group(10, 200, 320, 20); { f_panel_ok = new Fl_Return_Button(220, 200, 50, 20, "OK"); f_panel_ok->tooltip("Apply the changes."); @@ -120,17 +139,6 @@ Fl_Double_Window* make_function_panel() { } // Fl_Box* o o->end(); } // Fl_Group* o - { f_comment_input = new Fl_Text_Editor(10, 125, 320, 65, "Comment:"); - f_comment_input->tooltip("Function comment in Doxygen format"); - f_comment_input->box(FL_DOWN_BOX); - f_comment_input->labelfont(1); - f_comment_input->labelsize(11); - f_comment_input->textfont(4); - f_comment_input->textsize(11); - f_comment_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - Fl_Group::current()->resizable(f_comment_input); - f_comment_input->buffer(new Fl_Text_Buffer()); - } // Fl_Text_Editor* f_comment_input function_panel->set_modal(); function_panel->end(); } // Fl_Double_Window* function_panel @@ -347,12 +355,12 @@ Fl_Menu_Item menu_decl_class_choice[] = { Fl_Input *decl_input=(Fl_Input *)0; +Fl_Text_Editor *decl_comment_input=(Fl_Text_Editor *)0; + Fl_Return_Button *decl_panel_ok=(Fl_Return_Button *)0; Fl_Button *decl_panel_cancel=(Fl_Button *)0; -Fl_Text_Editor *decl_comment_input=(Fl_Text_Editor *)0; - Fl_Double_Window* make_decl_panel() { { decl_panel = new Fl_Double_Window(343, 237, "Declaration Properties"); decl_panel->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE)); @@ -385,6 +393,18 @@ n int foo();\", a #directive like \"#include \", a comment like \"//foo\ decl_input->align(Fl_Align(134)); decl_input->when(FL_WHEN_NEVER); } // Fl_Input* decl_input + { decl_comment_input = new Fl_Text_Editor(10, 130, 320, 65, "Comment:"); + decl_comment_input->tooltip("Declaration comment in Doxygen format"); + decl_comment_input->box(FL_DOWN_BOX); + decl_comment_input->labelfont(1); + decl_comment_input->labelsize(11); + decl_comment_input->textfont(4); + decl_comment_input->textsize(11); + decl_comment_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + Fl_Group::current()->resizable(decl_comment_input); + decl_comment_input->buffer(new Fl_Text_Buffer()); + decl_comment_input->add_key_binding(FL_Tab, 0, use_tab_navigation); + } // Fl_Text_Editor* decl_comment_input { Fl_Group* o = new Fl_Group(10, 205, 320, 20); { decl_panel_ok = new Fl_Return_Button(200, 205, 60, 20, "OK"); decl_panel_ok->labelsize(11); @@ -399,17 +419,6 @@ n int foo();\", a #directive like \"#include \", a comment like \"//foo\ } // Fl_Box* o o->end(); } // Fl_Group* o - { decl_comment_input = new Fl_Text_Editor(10, 130, 320, 65, "Comment:"); - decl_comment_input->tooltip("Declaration comment in Doxygen format"); - decl_comment_input->box(FL_DOWN_BOX); - decl_comment_input->labelfont(1); - decl_comment_input->labelsize(11); - decl_comment_input->textfont(4); - decl_comment_input->textsize(11); - decl_comment_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - Fl_Group::current()->resizable(decl_comment_input); - decl_comment_input->buffer(new Fl_Text_Buffer()); - } // Fl_Text_Editor* decl_comment_input decl_panel->size_range(343, 237); decl_panel->end(); } // Fl_Double_Window* decl_panel @@ -443,12 +452,12 @@ Fl_Input *data_filename=(Fl_Input *)0; Fl_Button *data_filebrowser=(Fl_Button *)0; +Fl_Text_Editor *data_comment_input=(Fl_Text_Editor *)0; + Fl_Return_Button *data_panel_ok=(Fl_Return_Button *)0; Fl_Button *data_panel_cancel=(Fl_Button *)0; -Fl_Text_Editor *data_comment_input=(Fl_Text_Editor *)0; - Fl_Double_Window* make_data_panel() { { data_panel = new Fl_Double_Window(343, 237, "Binary Data Properties"); data_panel->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE)); @@ -491,6 +500,18 @@ Fl_Double_Window* make_data_panel() { { data_filebrowser = new Fl_Button(290, 90, 40, 20, "@fileopen"); data_filebrowser->labelcolor((Fl_Color)134); } // Fl_Button* data_filebrowser + { data_comment_input = new Fl_Text_Editor(10, 130, 320, 65, "Comment:"); + data_comment_input->tooltip("Declaration comment in Doxygen format"); + data_comment_input->box(FL_DOWN_BOX); + data_comment_input->labelfont(1); + data_comment_input->labelsize(11); + data_comment_input->textfont(4); + data_comment_input->textsize(11); + data_comment_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); + Fl_Group::current()->resizable(data_comment_input); + data_comment_input->buffer(new Fl_Text_Buffer()); + data_comment_input->add_key_binding(FL_Tab, 0, use_tab_navigation); + } // Fl_Text_Editor* data_comment_input { Fl_Group* o = new Fl_Group(10, 205, 320, 20); { data_panel_ok = new Fl_Return_Button(200, 205, 60, 20, "OK"); data_panel_ok->labelsize(11); @@ -505,17 +526,6 @@ Fl_Double_Window* make_data_panel() { } // Fl_Box* o o->end(); } // Fl_Group* o - { data_comment_input = new Fl_Text_Editor(10, 130, 320, 65, "Comment:"); - data_comment_input->tooltip("Declaration comment in Doxygen format"); - data_comment_input->box(FL_DOWN_BOX); - data_comment_input->labelfont(1); - data_comment_input->labelsize(11); - data_comment_input->textfont(4); - data_comment_input->textsize(11); - data_comment_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); - Fl_Group::current()->resizable(data_comment_input); - data_comment_input->buffer(new Fl_Text_Buffer()); - } // Fl_Text_Editor* data_comment_input data_panel->size_range(343, 237); data_panel->end(); } // Fl_Double_Window* data_panel @@ -580,6 +590,7 @@ Fl_Double_Window* make_class_panel() { c_comment_input->align(Fl_Align(FL_ALIGN_TOP_LEFT)); Fl_Group::current()->resizable(c_comment_input); c_comment_input->buffer(new Fl_Text_Buffer()); + c_comment_input->add_key_binding(FL_Tab, 0, use_tab_navigation); } // Fl_Text_Editor* c_comment_input { Fl_Group* o = new Fl_Group(10, 165, 320, 20); { c_panel_ok = new Fl_Return_Button(200, 165, 60, 20, "OK"); diff --git a/fluid/function_panel.fl b/fluid/function_panel.fl index cf4cc5d57..9526f7238 100644 --- a/fluid/function_panel.fl +++ b/fluid/function_panel.fl @@ -46,10 +46,16 @@ decl {extern void exit_cb(Fl_Widget*, void*);} {private global decl {extern void toggle_widgetbin_cb(Fl_Widget*, void*);} {private global } +Function {use_tab_navigation(int, Fl_Text_Editor*)} { + comment {Allow Windget navigation on Text fields with Tab.} private return_type int +} { + code {return 0;} {} +} + Function {make_function_panel()} {} { Fl_Window function_panel { label {Function/Method Properties} open - xywh {394 671 343 232} type Double hide resizable modal + xywh {557 523 343 232} type Double resizable modal visible } { Fl_Group {} {open xywh {10 10 270 20} @@ -103,7 +109,13 @@ Function {make_function_panel()} {} { label {Return Type: (blank to return outermost widget)} tooltip {The return type of the function or method.} xywh {10 90 320 20} labelfont 1 labelsize 11 align 5 when 0 textfont 4 textsize 11 } - Fl_Group {} { + Fl_Text_Editor f_comment_input { + label {Comment:} + tooltip {Function comment in Doxygen format} xywh {10 125 320 65} box DOWN_BOX labelfont 1 labelsize 11 align 5 textfont 4 textsize 11 resizable + code0 {f_comment_input->buffer(new Fl_Text_Buffer());} + code1 {f_comment_input->add_key_binding(FL_Tab, 0, use_tab_navigation);} + } + Fl_Group {} {open xywh {10 200 320 20} } { Fl_Return_Button f_panel_ok { @@ -118,23 +130,17 @@ Function {make_function_panel()} {} { xywh {10 200 205 20} resizable } } - Fl_Text_Editor f_comment_input { - label {Comment:} - tooltip {Function comment in Doxygen format} xywh {10 125 320 65} box DOWN_BOX labelfont 1 labelsize 11 align 5 textfont 4 textsize 11 resizable - code0 {f_comment_input->buffer(new Fl_Text_Buffer());} - } } } -Function {make_code_panel()} {open -} { +Function {make_code_panel()} {} { 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 - xywh {353 262 540 180} type Double labelsize 11 hide resizable - code0 {o->size_range(200, 150);} modal + xywh {503 450 540 180} type Double labelsize 11 resizable + code0 {o->size_range(200, 150);} modal visible } { Fl_Text_Editor code_input { xywh {10 10 520 130} box DOWN_BOX labelsize 11 textfont 4 textsize 11 resizable @@ -162,9 +168,9 @@ code_panel->hide(); // otherwise hide..} open Function {make_codeblock_panel()} {} { Fl_Window codeblock_panel { - label {Code Block Properties} - xywh {468 221 300 115} type Double labelsize 11 hide resizable - code0 {o->size_range(o->w(), o->h(), Fl::w(), o->h());} modal + label {Code Block Properties} open + xywh {468 221 300 115} type Double labelsize 11 resizable + code0 {o->size_range(o->w(), o->h(), Fl::w(), o->h());} modal visible } { Fl_Input code_before_input { label {Conditional code block} @@ -195,8 +201,8 @@ Function {make_codeblock_panel()} {} { Function {make_declblock_panel()} {} { Fl_Window declblock_panel { label {Declaration Block Properties} open - xywh {428 215 300 135} type Double labelsize 11 hide resizable - code0 {o->size_range(o->w(), o->h(), Fl::w(), o->h());} modal + xywh {428 215 300 135} type Double labelsize 11 resizable + code0 {o->size_range(o->w(), o->h(), Fl::w(), o->h());} modal visible } { Fl_Group {} {open xywh {10 10 280 20} @@ -230,7 +236,7 @@ Function {make_declblock_panel()} {} { label {"\\n...child code...\\n" is inserted here} tooltip {\#endif or similar declaration code block.} xywh {10 75 280 20} labelsize 11 align 5 when 0 textfont 4 textsize 11 } - Fl_Group {} { + Fl_Group {} {open xywh {10 105 280 20} } { Fl_Return_Button declblock_panel_ok { @@ -251,7 +257,7 @@ Function {make_declblock_panel()} {} { Function {make_decl_panel()} {} { Fl_Window decl_panel { label {Declaration Properties} open - xywh {395 411 343 237} type Double align 80 hide resizable size_range {343 237 0 0} + xywh {480 333 343 237} type Double align 80 resizable size_range {343 237 0 0} visible } { Fl_Group {} {open xywh {10 10 270 20} @@ -300,6 +306,12 @@ Function {make_decl_panel()} {} { label {This can be any declaration, like "int x;", an external symbol like "extern int foo();", a \#directive like "\#include ", a comment like "//foo" or "/*foo*/", or typedef like "typedef char byte;" or "using std::list;".} tooltip {Declaration text.} xywh {10 40 320 20} labelsize 11 align 134 when 0 textfont 4 textsize 11 } + Fl_Text_Editor decl_comment_input { + label {Comment:} + tooltip {Declaration comment in Doxygen format} xywh {10 130 320 65} box DOWN_BOX labelfont 1 labelsize 11 align 5 textfont 4 textsize 11 resizable + code0 {decl_comment_input->buffer(new Fl_Text_Buffer());} + code1 {decl_comment_input->add_key_binding(FL_Tab, 0, use_tab_navigation);} + } Fl_Group {} {open xywh {10 205 320 20} } { @@ -315,19 +327,13 @@ Function {make_decl_panel()} {} { xywh {10 205 185 20} resizable } } - Fl_Text_Editor decl_comment_input { - label {Comment:} - tooltip {Declaration comment in Doxygen format} xywh {10 130 320 65} box DOWN_BOX labelfont 1 labelsize 11 align 5 textfont 4 textsize 11 resizable - code0 {decl_comment_input->buffer(new Fl_Text_Buffer());} - } } } -Function {make_data_panel()} {open -} { +Function {make_data_panel()} {} { Fl_Window data_panel { label {Binary Data Properties} open - xywh {414 355 343 237} type Double align 80 hide resizable size_range {343 237 0 0} + xywh {595 352 343 237} type Double align 80 resizable size_range {343 237 0 0} visible } { Fl_Group {} {open xywh {10 10 270 20} @@ -384,6 +390,12 @@ Function {make_data_panel()} {open label {@fileopen} xywh {290 90 40 20} labelcolor 134 } + Fl_Text_Editor data_comment_input { + label {Comment:} + tooltip {Declaration comment in Doxygen format} xywh {10 130 320 65} box DOWN_BOX labelfont 1 labelsize 11 align 5 textfont 4 textsize 11 resizable + code0 {data_comment_input->buffer(new Fl_Text_Buffer());} + code1 {data_comment_input->add_key_binding(FL_Tab, 0, use_tab_navigation);} + } Fl_Group {} {open xywh {10 205 320 20} } { @@ -399,18 +411,14 @@ Function {make_data_panel()} {open xywh {10 205 185 20} resizable } } - Fl_Text_Editor data_comment_input { - label {Comment:} - tooltip {Declaration comment in Doxygen format} xywh {10 130 320 65} box DOWN_BOX labelfont 1 labelsize 11 align 5 textfont 4 textsize 11 resizable - code0 {data_comment_input->buffer(new Fl_Text_Buffer());} - } } } -Function {make_class_panel()} {} { +Function {make_class_panel()} {open +} { Fl_Window class_panel { label {Class Properties} open - xywh {783 191 342 196} type Double labelsize 11 hide resizable modal size_range {343 188 0 0} + xywh {497 585 342 196} type Double labelsize 11 resizable modal size_range {343 188 0 0} visible } { Fl_Group {} {open xywh {10 10 280 20} hide @@ -432,9 +440,10 @@ Function {make_class_panel()} {} { tooltip {Name of subclass.} xywh {10 55 320 20} labelfont 1 labelsize 11 align 5 when 0 textfont 4 textsize 11 } Fl_Text_Editor c_comment_input { - label {Comment:} + label {Comment:} selected tooltip {Class comment in Doxygen format} xywh {10 90 320 65} box DOWN_BOX labelfont 1 labelsize 11 align 5 textfont 4 textsize 11 resizable code0 {c_comment_input->buffer(new Fl_Text_Buffer());} + code1 {c_comment_input->add_key_binding(FL_Tab, 0, use_tab_navigation);} } Fl_Group {} {open xywh {10 165 320 20} @@ -456,7 +465,7 @@ Function {make_class_panel()} {} { Function {make_comment_panel()} {} { Fl_Window comment_panel { - label {Comment Properties} open selected + label {Comment Properties} open xywh {780 296 550 280} type Double labelsize 11 hide resizable code0 {o->size_range(320, 180);} modal } { @@ -520,8 +529,7 @@ Function {type_make_cb(Fl_Widget*,void*d)} {return_type void }} {} } -Function {make_widgetbin()} {open -} { +Function {make_widgetbin()} {} { Fl_Window widgetbin_panel { label {Widget Bin} callback {if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape) diff --git a/fluid/function_panel.h b/fluid/function_panel.h index e81411e39..86087385a 100644 --- a/fluid/function_panel.h +++ b/fluid/function_panel.h @@ -33,12 +33,12 @@ extern Fl_Light_Button *f_c_button; #include extern Fl_Input *f_name_input; extern Fl_Input *f_return_type_input; +#include +extern Fl_Text_Editor *f_comment_input; #include extern Fl_Return_Button *f_panel_ok; #include extern Fl_Button *f_panel_cancel; -#include -extern Fl_Text_Editor *f_comment_input; Fl_Double_Window* make_function_panel(); extern Fl_Menu_Item menu_f_public_member_choice[]; extern Fl_Menu_Item menu_f_public_choice[]; @@ -67,9 +67,9 @@ extern Fl_Double_Window *decl_panel; extern Fl_Choice *decl_choice; extern Fl_Choice *decl_class_choice; extern Fl_Input *decl_input; +extern Fl_Text_Editor *decl_comment_input; extern Fl_Return_Button *decl_panel_ok; extern Fl_Button *decl_panel_cancel; -extern Fl_Text_Editor *decl_comment_input; Fl_Double_Window* make_decl_panel(); extern Fl_Menu_Item menu_decl_choice[]; extern Fl_Menu_Item menu_decl_class_choice[]; @@ -79,9 +79,9 @@ extern Fl_Choice *data_class_choice; extern Fl_Input *data_input; extern Fl_Input *data_filename; extern Fl_Button *data_filebrowser; +extern Fl_Text_Editor *data_comment_input; extern Fl_Return_Button *data_panel_ok; extern Fl_Button *data_panel_cancel; -extern Fl_Text_Editor *data_comment_input; Fl_Double_Window* make_data_panel(); extern Fl_Menu_Item menu_data_choice[]; extern Fl_Menu_Item menu_data_class_choice[]; -- cgit v1.2.3