From 66dabdb8f53231eff304cbb944cd900ddbce00af Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Tue, 5 Nov 2002 06:45:41 +0000 Subject: Added callbacks to Fl_Text_Editor. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2824 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- fluid/Fl_Function_Type.cxx | 8 +++++--- fluid/Fl_Widget_Type.cxx | 7 ++++--- fluid/function_panel.fl | 4 ++-- fluid/widget_panel.cxx | 3 ++- fluid/widget_panel.fl | 10 +++++----- 5 files changed, 18 insertions(+), 14 deletions(-) (limited to 'fluid') diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index f24ab48df..a1cf68f51 100644 --- a/fluid/Fl_Function_Type.cxx +++ b/fluid/Fl_Function_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.9 2002/11/03 00:01:19 matthiaswm Exp $" +// "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.10 2002/11/05 06:45:40 matthiaswm Exp $" // // C function type code for the Fast Light Tool Kit (FLTK). // @@ -28,6 +28,7 @@ #include #include "../src/flstring.h" #include +#include extern int i18n_type; extern const char* i18n_include; @@ -337,9 +338,10 @@ void Fl_Code_Type::open() { else if (w == code_panel_ok) break; else if (!w) Fl::wait(); } - const char*c = code_input->buffer()->text(); + char*c = code_input->buffer()->text(); message = c_check(c); if (message) continue; name(c); + free(c); break; } BREAK2: @@ -705,5 +707,5 @@ void Fl_Class_Type::write_code2() { } // -// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.9 2002/11/03 00:01:19 matthiaswm Exp $". +// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.10 2002/11/05 06:45:40 matthiaswm Exp $". // diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index f0820ae10..88a530fa3 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.21 2002/11/03 00:01:19 matthiaswm Exp $" +// "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.22 2002/11/05 06:45:40 matthiaswm Exp $" // // Widget type code for the Fast Light Tool Kit (FLTK). // @@ -946,12 +946,13 @@ void callback_cb(Fl_Text_Editor* i, void *v) { const char *cbtext = current_widget->callback(); i->buffer()->text( cbtext ? cbtext : "" ); } else { - const char *c = i->buffer()->text(); + char *c = i->buffer()->text(); const char *d = c_check(c); if (d) {fl_message("Error in callback: %s",d); haderror = 1; return;} for (Fl_Type *o = Fl_Type::first; o; o = o->next) if (o->selected) { o->callback(c); } + free(c); } } @@ -1971,5 +1972,5 @@ int Fl_Widget_Type::read_fdesign(const char* propname, const char* value) { } // -// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.21 2002/11/03 00:01:19 matthiaswm Exp $". +// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.22 2002/11/05 06:45:40 matthiaswm Exp $". // diff --git a/fluid/function_panel.fl b/fluid/function_panel.fl index f9c790815..722c3629d 100644 --- a/fluid/function_panel.fl +++ b/fluid/function_panel.fl @@ -54,7 +54,7 @@ Function {make_code_panel()} {open Fl_Group {} {open xywh {10 10 525 120} box DOWN_FRAME resizable } { - Fl_Text_Editor code_input {selected + Fl_Text_Editor code_input { xywh {12 12 521 116} box NO_BOX resizable code0 {o->buffer(new Fl_Text_Buffer);} code1 {o->textfont(FL_COURIER);} @@ -399,7 +399,7 @@ Function {make_widgetbin()} {open } Fl_Button {} { user_data {"Fl_Output"} - callback type_make_cb + callback type_make_cb selected tooltip Output xywh {284 4 24 24} box THIN_UP_BOX code0 {o->image(pixmap[27]);} } diff --git a/fluid/widget_panel.cxx b/fluid/widget_panel.cxx index 339fb6687..26af85ea7 100644 --- a/fluid/widget_panel.cxx +++ b/fluid/widget_panel.cxx @@ -19,6 +19,7 @@ Fl_Double_Window* make_widget_panel() { { Fl_Group* o = new Fl_Group(10, 30, 395, 295, "GUI"); o->callback((Fl_Callback*)propagate_load); o->when(FL_WHEN_NEVER); + o->hide(); { Fl_Group* o = new Fl_Group(95, 40, 301, 280); o->callback((Fl_Callback*)propagate_load); { Fl_Group* o = new Fl_Group(95, 40, 300, 20); @@ -383,7 +384,6 @@ Fl_Double_Window* make_widget_panel() { { Fl_Group* o = new Fl_Group(10, 30, 395, 295, "C++"); o->callback((Fl_Callback*)propagate_load); o->when(FL_WHEN_NEVER); - o->hide(); { Fl_Group* o = new Fl_Group(100, 40, 295, 132); o->callback((Fl_Callback*)propagate_load); { Fl_Group* o = new Fl_Group(100, 40, 295, 20); @@ -449,6 +449,7 @@ Fl_Double_Window* make_widget_panel() { o->textfont(4); o->callback((Fl_Callback*)callback_cb); o->align(FL_ALIGN_LEFT); + o->when(FL_WHEN_RELEASE_ALWAYS); Fl_Group::current()->resizable(o); o->buffer(new Fl_Text_Buffer()); o->textfont(FL_COURIER); diff --git a/fluid/widget_panel.fl b/fluid/widget_panel.fl index 3b70ade59..4cd4d677c 100644 --- a/fluid/widget_panel.fl +++ b/fluid/widget_panel.fl @@ -13,8 +13,8 @@ Function {make_widget_panel()} {open } { Fl_Group {} { label GUI - callback propagate_load selected - xywh {10 30 395 295} when 0 resizable + callback propagate_load + xywh {10 30 395 295} when 0 hide resizable } { Fl_Group {} { callback propagate_load open @@ -349,7 +349,7 @@ image} Fl_Group {} { label {C++} callback propagate_load - xywh {10 30 395 295} when 0 hide + xywh {10 30 395 295} when 0 } { Fl_Group {} { callback propagate_load @@ -413,8 +413,8 @@ image} } { Fl_Text_Editor {} { label {Callback:} - callback callback_cb - tooltip {The callback function or code for the widget.} xywh {102 177 291 86} box NO_BOX align 4 textfont 4 resizable + callback callback_cb selected + tooltip {The callback function or code for the widget.} xywh {102 177 291 86} box NO_BOX align 4 when 6 textfont 4 resizable code0 {o->buffer(new Fl_Text_Buffer());} code1 {o->textfont(FL_COURIER);} } -- cgit v1.2.3