summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2015-04-02 17:19:33 +0000
committerMatthias Melcher <fltk@matthiasm.com>2015-04-02 17:19:33 +0000
commitd5a8755eadbed7667858866e968dead47e5bf8fb (patch)
treeed47c718386760fdd8e93a9ba701adaf3802e915
parent552502d44afeb7214fefe0266bd9abe3d503f47e (diff)
Added comments to Fluid Widgets. The comment field is between the Additional Code and Callback field on the C++ Tab of the Widget Editor. Care was taken to correctly resize.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10659 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--fluid/Fl_Menu_Type.cxx2
-rw-r--r--fluid/Fl_Type.cxx58
-rw-r--r--fluid/Fl_Type.h2
-rw-r--r--fluid/Fl_Widget_Type.cxx27
-rw-r--r--fluid/Fl_Window_Type.cxx1
-rw-r--r--fluid/widget_panel.cxx112
-rw-r--r--fluid/widget_panel.fl86
-rw-r--r--fluid/widget_panel.h4
8 files changed, 219 insertions, 73 deletions
diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx
index fbf9856e8..ad6d9c6c7 100644
--- a/fluid/Fl_Menu_Type.cxx
+++ b/fluid/Fl_Menu_Type.cxx
@@ -291,6 +291,7 @@ void Fl_Menu_Item_Type::write_item() {
"FL_IMAGE_LABEL"
};
+ write_comment_inline_c(" ");
write_c(" {");
if (image) write_c("0");
else if (label()) write_cstring(label()); // we will call i18n when the widget is instantiated for the first time
@@ -324,6 +325,7 @@ void Fl_Menu_Item_Type::write_item() {
void Fl_Menu_Item_Type::write_code1() {
int i; const char* mname = menu_name(i);
+
if (!prev->is_menu_item()) {
// for first menu item, declare the array
if (class_name(1)) {
diff --git a/fluid/Fl_Type.cxx b/fluid/Fl_Type.cxx
index cc55a1a65..c3844fc0d 100644
--- a/fluid/Fl_Type.cxx
+++ b/fluid/Fl_Type.cxx
@@ -192,6 +192,14 @@ Fl_Widget *make_widget_browser(int x,int y,int w,int h) {
return (widget_browser = new Widget_Browser(x,y,w,h));
}
+void redraw_widget_browser(Fl_Type *caller)
+{
+ if (caller) {
+ widget_browser->display(caller);
+ }
+ widget_browser->redraw();
+}
+
void select(Fl_Type *o, int v) {
widget_browser->select(o,v,1);
// Fl_Type::current = o;
@@ -699,7 +707,9 @@ void Fl_Type::user_data_type(const char *n) {
}
void Fl_Type::comment(const char *n) {
- storestring(n, comment_, 1);
+ if (storestring(n,comment_,1)) {
+ if (visible) widget_browser->redraw();
+ }
}
void Fl_Type::open() {
@@ -845,6 +855,7 @@ void Fl_Type::move_before(Fl_Type* g) {
widget_browser->redraw();
}
+
// move selected widgets in their parent's list:
void earlier_cb(Fl_Widget*,void*) {
Fl_Type *f;
@@ -979,14 +990,14 @@ int has_toplevel_function(const char *rtype, const char *sig) {
*/
void Fl_Type::write_comment_h(const char *pre)
{
- if (comment()) {
+ if (comment() && *comment()) {
write_h("%s/**\n", pre);
const char *s = comment();
- write_h("%s ", pre);
+ write_h("%s ", pre);
while(*s) {
if (*s=='\n') {
if (s[1]) {
- write_h("\n%s ", pre);
+ write_h("\n%s ", pre);
}
} else {
write_h("%c", *s); // FIXME this is much too slow!
@@ -998,18 +1009,18 @@ void Fl_Type::write_comment_h(const char *pre)
}
/**
- * Write a comment inot the header file.
+ * Write a comment into the source file.
*/
void Fl_Type::write_comment_c(const char *pre)
{
- if (comment()) {
+ if (comment() && *comment()) {
write_c("%s/**\n", pre);
const char *s = comment();
- write_c("%s ", pre);
+ write_c("%s ", pre);
while(*s) {
if (*s=='\n') {
if (s[1]) {
- write_c("\n%s ", pre);
+ write_c("\n%s ", pre);
}
} else {
write_c("%c", *s); // FIXME this is much too slow!
@@ -1021,6 +1032,37 @@ void Fl_Type::write_comment_c(const char *pre)
}
/**
+ * Write a comment into the source file.
+ */
+void Fl_Type::write_comment_inline_c(const char *pre)
+{
+ if (comment() && *comment()) {
+ const char *s = comment();
+ if (strchr(s, '\n')==0L) {
+ // single line comment
+ if (pre) write_c("%s", pre);
+ write_c("// %s\n", s);
+ if (!pre) write_c("%s ", indent());
+ } else {
+ write_c("%s/*\n", pre?pre:"");
+ if (pre) write_c("%s ", pre); else write_c("%s ", indent());
+ while(*s) {
+ if (*s=='\n') {
+ if (s[1]) {
+ if (pre) write_c("\n%s ", pre); else write_c("\n%s ", indent());
+ }
+ } else {
+ write_c("%c", *s); // FIXME this is much too slow!
+ }
+ s++;
+ }
+ if (pre) write_c("\n%s */\n", pre); else write_c("\n%s */\n", indent());
+ if (!pre) write_c("%s ", indent());
+ }
+ }
+}
+
+/**
* Make sure that the given item is visible in the browser by opening
* all parent groups and moving the item into the visible space.
*/
diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h
index 43feeb225..0b90cb63b 100644
--- a/fluid/Fl_Type.h
+++ b/fluid/Fl_Type.h
@@ -119,6 +119,7 @@ public:
virtual void write_code2(); // code and .h after children
void write_comment_h(const char *ind=""); // write the commentary text into the header file
void write_comment_c(const char *ind=""); // write the commentary text into the source file
+ void write_comment_inline_c(const char *ind=0L); // write the commentary text
// live mode
virtual Fl_Widget *enter_live_mode(int top=0); // build wdgets needed for live mode
@@ -788,6 +789,7 @@ public:
};
// object list operations:
Fl_Widget *make_widget_browser(int X,int Y,int W,int H);
+void redraw_widget_browser(Fl_Type*);
extern int modflag;
void delete_all(int selected_only=0);
void selection_changed(Fl_Type* new_current);
diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx
index 4bcad63f9..4a85f14c4 100644
--- a/fluid/Fl_Widget_Type.cxx
+++ b/fluid/Fl_Widget_Type.cxx
@@ -1259,7 +1259,31 @@ void callback_cb(CodeEditor* i, void *v) {
for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
if (o->selected) {
o->callback(c);
- mod = 1;
+ mod = 1;
+ }
+ }
+ if (mod) set_modflag(1);
+ free(c);
+ }
+}
+
+void comment_cb(Fl_Text_Editor* i, void *v) {
+ if (v == LOAD) {
+ const char *cmttext = current_widget->comment();
+ i->buffer()->text( cmttext ? cmttext : "" );
+ } else {
+ int mod = 0;
+ char *c = i->buffer()->text();
+ const char *d = c_check(c);
+ if (d) {
+ fl_message("Error in comment: %s",d);
+ if (i->window()) i->window()->make_current();
+ haderror = 1;
+ }
+ for (Fl_Type *o = Fl_Type::first; o; o = o->next) {
+ if (o->selected) {
+ o->comment(c);
+ mod = 1;
}
}
if (mod) set_modflag(1);
@@ -2127,6 +2151,7 @@ void Fl_Widget_Type::write_code1() {
}
write_c("%s{ ", indent());
+ write_comment_inline_c();
if (varused) write_c("%s* o = ", t);
if (name()) write_c("%s = ", name());
if (is_window()) {
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx
index 930fc0c41..e6b8b644e 100644
--- a/fluid/Fl_Window_Type.cxx
+++ b/fluid/Fl_Window_Type.cxx
@@ -1498,6 +1498,7 @@ void Fl_Widget_Class_Type::write_code1() {
const char *c = subclass();
if (!c) c = "Fl_Group";
+ write_comment_h();
write_h("\nclass %s : public %s {\n", name(), c);
if (strstr(c, "Window")) {
write_h(" void _%s();\n", trimclassname(name()));
diff --git a/fluid/widget_panel.cxx b/fluid/widget_panel.cxx
index d64051ce2..b670b8d08 100644
--- a/fluid/widget_panel.cxx
+++ b/fluid/widget_panel.cxx
@@ -19,6 +19,7 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0304
#include "widget_panel.h"
+extern void comment_cb(Fl_Text_Editor*, void*);
static void cb_(Fl_Tabs* o, void* v) {
propagate_load((Fl_Group *)o,v);
@@ -76,22 +77,35 @@ Fl_Menu_Item menu_3[] = {
Fl_Input *v_input[4]={(Fl_Input *)0};
+static void cb_1(Fl_Tile*, void* v) {
+ wComment->do_callback(wComment, (long)v);
+wCallback->do_callback(wCallback, (long)v);
+}
+
+Fl_Text_Editor *wComment=(Fl_Text_Editor *)0;
+
+CodeEditor *wCallback=(CodeEditor *)0;
+
Fl_Button *wLiveMode=(Fl_Button *)0;
+/**
+ Create a panel that can be used with all known widgets
+*/
Fl_Double_Window* make_widget_panel() {
Fl_Double_Window* w;
- { Fl_Double_Window* o = new Fl_Double_Window(420, 360);
+ { // Use a Double Window to avoid flickering.
+ Fl_Double_Window* o = new Fl_Double_Window(420, 400);
w = o;
o->labelsize(11);
o->align(Fl_Align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE));
o->hotspot(o);
- { Fl_Tabs* o = new Fl_Tabs(10, 10, 400, 310);
+ { Fl_Tabs* o = new Fl_Tabs(10, 10, 400, 350);
o->selection_color((Fl_Color)12);
o->labelsize(11);
o->labelcolor(FL_BACKGROUND2_COLOR);
o->callback((Fl_Callback*)cb_);
o->when(FL_WHEN_NEVER);
- { Fl_Group* o = new Fl_Group(10, 30, 400, 290, "GUI");
+ { Fl_Group* o = new Fl_Group(10, 30, 400, 330, "GUI");
o->labelsize(11);
o->callback((Fl_Callback*)propagate_load);
o->when(FL_WHEN_NEVER);
@@ -399,7 +413,8 @@ ive to the origin at construction time");
} // Fl_Box* o
o->end();
} // Fl_Group* o
- { Shortcut_Button* o = new Shortcut_Button(95, 210, 310, 20, "Shortcut:");
+ { // This is a special button that grabs keystrokes directly
+ Shortcut_Button* o = new Shortcut_Button(95, 210, 310, 20, "Shortcut:");
o->tooltip("The shortcut key for the widget.");
o->box(FL_DOWN_BOX);
o->color(FL_BACKGROUND2_COLOR);
@@ -497,7 +512,7 @@ ive to the origin at construction time");
o->end();
Fl_Group::current()->resizable(o);
} // Fl_Group* o
- { Fl_Group* o = new Fl_Group(10, 30, 400, 290, "Style");
+ { Fl_Group* o = new Fl_Group(10, 30, 400, 330, "Style");
o->labelsize(11);
o->callback((Fl_Callback*)propagate_load);
o->when(FL_WHEN_NEVER);
@@ -618,7 +633,7 @@ ive to the origin at construction time");
} // Fl_Box* o
o->end();
} // Fl_Group* o
- { Fl_Group* o = new Fl_Group(10, 30, 400, 290, "C++");
+ { Fl_Group* o = new Fl_Group(10, 30, 400, 330, "C++");
o->labelsize(11);
o->callback((Fl_Callback*)propagate_load);
o->when(FL_WHEN_NEVER);
@@ -709,29 +724,57 @@ ive to the origin at construction time");
v_input[3]->textsize(11);
v_input[3]->callback((Fl_Callback*)v_input_cb, (void*)(3));
} // Fl_Input* v_input[3]
- { CodeEditor* o = new CodeEditor(95, 175, 310, 90, "Callback:");
- o->tooltip("The callback function or code for the widget. Use the variable name \'o\' to \
+ { Fl_Tile* o = new Fl_Tile(95, 175, 310, 130);
+ o->callback((Fl_Callback*)cb_1);
+ { Fl_Group* o = new Fl_Group(95, 175, 310, 48);
+ o->box(FL_FLAT_BOX);
+ { wComment = new Fl_Text_Editor(95, 175, 310, 45, "Comment:");
+ wComment->tooltip("Write a comment that will appear in the source code and in the widget tree ov\
+erview.");
+ wComment->box(FL_DOWN_BOX);
+ wComment->labelfont(1);
+ wComment->labelsize(11);
+ wComment->textfont(6);
+ wComment->textsize(11);
+ wComment->textcolor((Fl_Color)59);
+ wComment->align(Fl_Align(FL_ALIGN_LEFT));
+ wComment->when(FL_WHEN_CHANGED);
+ Fl_Group::current()->resizable(wComment);
+ wComment->buffer(new Fl_Text_Buffer());
+ wComment->callback((Fl_Callback*)comment_cb);
+ } // Fl_Text_Editor* wComment
+ o->end();
+ } // Fl_Group* o
+ { Fl_Group* o = new Fl_Group(95, 223, 310, 82);
+ o->box(FL_FLAT_BOX);
+ { wCallback = new CodeEditor(95, 225, 310, 80, "Callback:");
+ wCallback->tooltip("The callback function or code for the widget. Use the variable name \'o\' to \
access the Widget pointer and \'v\' to access the user value.");
- o->box(FL_DOWN_BOX);
- o->color(FL_BACKGROUND2_COLOR);
- o->selection_color(FL_SELECTION_COLOR);
- o->labeltype(FL_NORMAL_LABEL);
- o->labelfont(1);
- o->labelsize(11);
- o->labelcolor(FL_FOREGROUND_COLOR);
- o->textfont(4);
- o->textsize(11);
- o->callback((Fl_Callback*)callback_cb);
- o->align(Fl_Align(FL_ALIGN_LEFT));
- o->when(FL_WHEN_RELEASE);
+ wCallback->box(FL_DOWN_BOX);
+ wCallback->color(FL_BACKGROUND2_COLOR);
+ wCallback->selection_color(FL_SELECTION_COLOR);
+ wCallback->labeltype(FL_NORMAL_LABEL);
+ wCallback->labelfont(1);
+ wCallback->labelsize(11);
+ wCallback->labelcolor(FL_FOREGROUND_COLOR);
+ wCallback->textfont(4);
+ wCallback->textsize(11);
+ wCallback->callback((Fl_Callback*)callback_cb);
+ wCallback->align(Fl_Align(FL_ALIGN_LEFT));
+ wCallback->when(FL_WHEN_RELEASE);
+ Fl_Group::current()->resizable(wCallback);
+ } // CodeEditor* wCallback
+ o->end();
+ } // Fl_Group* o
+ o->end();
Fl_Group::current()->resizable(o);
- } // CodeEditor* o
- { Fl_Group* o = new Fl_Group(95, 270, 310, 20, "User Data:");
+ } // Fl_Tile* o
+ { Fl_Group* o = new Fl_Group(95, 310, 310, 20, "User Data:");
o->labelfont(1);
o->labelsize(11);
o->callback((Fl_Callback*)propagate_load);
o->align(Fl_Align(FL_ALIGN_LEFT));
- { Fl_Input* o = new Fl_Input(95, 270, 158, 20);
+ { Fl_Input* o = new Fl_Input(95, 310, 158, 20);
o->tooltip("The user data to pass into the callback code.");
o->labelfont(1);
o->labelsize(11);
@@ -740,7 +783,7 @@ access the Widget pointer and \'v\' to access the user value.");
o->callback((Fl_Callback*)user_data_cb);
Fl_Group::current()->resizable(o);
} // Fl_Input* o
- { Fl_Choice* o = new Fl_Choice(300, 270, 105, 20, "When:");
+ { Fl_Choice* o = new Fl_Choice(300, 310, 105, 20, "When:");
o->tooltip("When to call the callback function.");
o->box(FL_THIN_UP_BOX);
o->down_box(FL_BORDER_BOX);
@@ -753,12 +796,12 @@ access the Widget pointer and \'v\' to access the user value.");
} // Fl_Choice* o
o->end();
} // Fl_Group* o
- { Fl_Group* o = new Fl_Group(95, 295, 310, 20, "Type:");
+ { Fl_Group* o = new Fl_Group(95, 335, 310, 20, "Type:");
o->labelfont(1);
o->labelsize(11);
o->callback((Fl_Callback*)propagate_load);
o->align(Fl_Align(FL_ALIGN_LEFT));
- { Fl_Input* o = new Fl_Input(95, 295, 158, 20);
+ { Fl_Input* o = new Fl_Input(95, 335, 158, 20);
o->tooltip("The type of the user data.");
o->labelfont(1);
o->labelsize(11);
@@ -767,7 +810,7 @@ access the Widget pointer and \'v\' to access the user value.");
o->callback((Fl_Callback*)user_data_type_cb);
Fl_Group::current()->resizable(o);
} // Fl_Input* o
- { Fl_Light_Button* o = new Fl_Light_Button(300, 295, 105, 20, "No Change");
+ { Fl_Light_Button* o = new Fl_Light_Button(300, 335, 105, 20, "No Change");
o->tooltip("Call the callback even if the value has not changed.");
o->selection_color((Fl_Color)1);
o->labelsize(11);
@@ -780,33 +823,33 @@ access the Widget pointer and \'v\' to access the user value.");
o->end();
Fl_Group::current()->resizable(o);
} // Fl_Tabs* o
- { Fl_Group* o = new Fl_Group(9, 330, 400, 20);
+ { Fl_Group* o = new Fl_Group(9, 370, 400, 20);
o->labelsize(11);
- { Fl_Box* o = new Fl_Box(9, 330, 20, 20);
+ { Fl_Box* o = new Fl_Box(9, 370, 20, 20);
o->labelsize(11);
Fl_Group::current()->resizable(o);
} // Fl_Box* o
- { Fl_Button* o = new Fl_Button(240, 330, 99, 20, "Hide &Overlays");
+ { Fl_Button* o = new Fl_Button(240, 370, 99, 20, "Hide &Overlays");
o->tooltip("Hide the widget overlay box.");
o->labelsize(11);
o->labelcolor((Fl_Color)1);
o->callback((Fl_Callback*)overlay_cb);
} // Fl_Button* o
- { Fl_Button* o = new Fl_Button(66, 330, 80, 20, "Revert");
+ { Fl_Button* o = new Fl_Button(66, 370, 80, 20, "Revert");
o->labelsize(11);
o->callback((Fl_Callback*)revert_cb);
o->hide();
} // Fl_Button* o
- { Fl_Return_Button* o = new Fl_Return_Button(344, 330, 64, 20, "Close");
+ { Fl_Return_Button* o = new Fl_Return_Button(344, 370, 64, 20, "Close");
o->labelsize(11);
o->callback((Fl_Callback*)ok_cb);
} // Fl_Return_Button* o
- { Fl_Button* o = new Fl_Button(339, 330, 70, 20, "Cancel");
+ { Fl_Button* o = new Fl_Button(339, 370, 70, 20, "Cancel");
o->labelsize(11);
o->callback((Fl_Callback*)cancel_cb);
o->hide();
} // Fl_Button* o
- { wLiveMode = new Fl_Button(151, 330, 84, 20, "Live &Mode");
+ { wLiveMode = new Fl_Button(151, 370, 84, 20, "Live &Mode");
wLiveMode->tooltip("Create a live duplicate of the selected widgets to test resizing and menu beh\
avior.");
wLiveMode->type(1);
@@ -816,6 +859,7 @@ avior.");
o->end();
} // Fl_Group* o
o->size_range(o->w(), o->h());
+ o->size_range(420, 400);
o->end();
} // Fl_Double_Window* o
return w;
diff --git a/fluid/widget_panel.fl b/fluid/widget_panel.fl
index fbf63ea8b..376e5474e 100644
--- a/fluid/widget_panel.fl
+++ b/fluid/widget_panel.fl
@@ -22,20 +22,25 @@ comment {//
} {in_source in_header
}
-Function {make_widget_panel()} {open
+decl {extern void comment_cb(Fl_Text_Editor*, void*);} {private global
+}
+
+Function {make_widget_panel()} {
+ comment {Create a panel that can be used with all known widgets} open
} {
- Fl_Window {} {open
- xywh {383 206 420 360} type Double labelsize 11 align 80 hide resizable hotspot
- code0 {o->size_range(o->w(), o->h());}
+ Fl_Window {} {
+ comment {Use a Double Window to avoid flickering.} open
+ xywh {468 187 420 400} type Double labelsize 11 align 80 resizable hotspot
+ code0 {o->size_range(o->w(), o->h());} size_range {420 400 0 0} visible
} {
Fl_Tabs {} {
callback {propagate_load((Fl_Group *)o,v);} open
- xywh {10 10 400 310} selection_color 12 labelsize 11 labelcolor 7 when 0 resizable
+ xywh {10 10 400 350} selection_color 12 labelsize 11 labelcolor 7 when 0 resizable
} {
Fl_Group {} {
label GUI
callback propagate_load open
- xywh {10 30 400 290} labelsize 11 when 0 resizable
+ xywh {10 30 400 330} labelsize 11 when 0 resizable
} {
Fl_Group {} {
label {Label:}
@@ -43,7 +48,7 @@ Function {make_widget_panel()} {open
xywh {95 40 309 20} labelfont 1 labelsize 11 align 4
} {
Fl_Input {} {
- callback label_cb selected
+ callback label_cb
tooltip {The label text for the widget.
Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 1 textsize 11 resizable
}
@@ -358,6 +363,7 @@ Use Ctrl-J for newlines.} xywh {95 40 190 20} labelfont 1 labelsize 11 when 1 te
Fl_Button {} {
label {Shortcut:}
callback shortcut_in_cb
+ comment {This is a special button that grabs keystrokes directly} selected
tooltip {The shortcut key for the widget.} xywh {95 210 310 20} box DOWN_BOX color 7 selection_color 7 labelfont 1 labelsize 11 align 4
code0 {\#include "Shortcut_Button.h"}
class Shortcut_Button
@@ -430,7 +436,7 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize
Fl_Group {} {
label Style
callback propagate_load
- xywh {10 30 400 290} labelsize 11 when 0 hide
+ xywh {10 30 400 330} labelsize 11 when 0 hide
} {
Fl_Group {} {
label {Label Font:}
@@ -515,7 +521,7 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize
Fl_Group {} {
label {C++}
callback propagate_load open
- xywh {10 30 400 290} labelsize 11 when 0 hide
+ xywh {10 30 400 330} labelsize 11 when 0 hide
} {
Fl_Group {} {
label {Class:}
@@ -598,77 +604,97 @@ Use Ctrl-J for newlines.} xywh {95 285 310 20} labelfont 1 labelsize 11 textsize
callback v_input_cb
tooltip {Extra initialization code for the widget.} xywh {95 150 310 20} labelsize 11 textfont 4 textsize 11
}
- Fl_Text_Editor {} {
- label {Callback:}
- callback callback_cb
- tooltip {The callback function or code for the widget. Use the variable name 'o' to access the Widget pointer and 'v' to access the user value.} xywh {95 175 310 90} box DOWN_BOX labelfont 1 labelsize 11 align 4 textfont 4 textsize 11 resizable
- code0 {\#include "CodeEditor.h"}
- class CodeEditor
+ Fl_Tile {} {
+ callback {wComment->do_callback(wComment, (long)v);
+wCallback->do_callback(wCallback, (long)v);} open
+ xywh {95 175 310 130} resizable
+ } {
+ Fl_Group {} {open
+ xywh {95 175 310 48} box FLAT_BOX
+ } {
+ Fl_Text_Editor wComment {
+ label {Comment:}
+ tooltip {Write a comment that will appear in the source code and in the widget tree overview.} xywh {95 175 310 45} box DOWN_BOX labelfont 1 labelsize 11 align 4 when 1 textfont 6 textsize 11 textcolor 59 resizable
+ code0 {wComment->buffer(new Fl_Text_Buffer());}
+ code1 {wComment->callback((Fl_Callback*)comment_cb);}
+ }
+ }
+ Fl_Group {} {open
+ xywh {95 223 310 82} box FLAT_BOX
+ } {
+ Fl_Text_Editor wCallback {
+ label {Callback:}
+ callback callback_cb
+ tooltip {The callback function or code for the widget. Use the variable name 'o' to access the Widget pointer and 'v' to access the user value.} xywh {95 225 310 80} box DOWN_BOX labelfont 1 labelsize 11 align 4 textfont 4 textsize 11 resizable
+ code0 {\#include "CodeEditor.h"}
+ class CodeEditor
+ }
+ }
}
Fl_Group {} {
label {User Data:}
- callback propagate_load
- xywh {95 270 310 20} labelfont 1 labelsize 11 align 4
+ callback propagate_load open
+ xywh {95 310 310 20} labelfont 1 labelsize 11 align 4
} {
Fl_Input {} {
callback user_data_cb
- tooltip {The user data to pass into the callback code.} xywh {95 270 158 20} labelfont 1 labelsize 11 textfont 4 textsize 11 resizable
+ tooltip {The user data to pass into the callback code.} xywh {95 310 158 20} labelfont 1 labelsize 11 textfont 4 textsize 11 resizable
}
Fl_Choice {} {
label {When:}
callback when_cb open
- tooltip {When to call the callback function.} xywh {300 270 105 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 when 1 textsize 11
+ tooltip {When to call the callback function.} xywh {300 310 105 20} box THIN_UP_BOX down_box BORDER_BOX labelfont 1 labelsize 11 when 1 textsize 11
code0 {extern Fl_Menu_Item whenmenu[];}
code1 {o->menu(whenmenu);}
} {}
}
Fl_Group {} {
label {Type:}
- callback propagate_load
- xywh {95 295 310 20} labelfont 1 labelsize 11 align 4
+ callback propagate_load open
+ xywh {95 335 310 20} labelfont 1 labelsize 11 align 4
} {
Fl_Input {} {
callback user_data_type_cb
- tooltip {The type of the user data.} xywh {95 295 158 20} labelfont 1 labelsize 11 textfont 4 textsize 11 resizable
+ tooltip {The type of the user data.} xywh {95 335 158 20} labelfont 1 labelsize 11 textfont 4 textsize 11 resizable
}
Fl_Light_Button {} {
label {No Change}
callback when_button_cb
- tooltip {Call the callback even if the value has not changed.} xywh {300 295 105 20} selection_color 1 labelsize 11
+ tooltip {Call the callback even if the value has not changed.} xywh {300 335 105 20} selection_color 1 labelsize 11
}
}
}
}
Fl_Group {} {open
- xywh {9 330 400 20} labelsize 11
+ xywh {9 370 400 20} labelsize 11
} {
Fl_Box {} {
- xywh {9 330 20 20} labelsize 11 resizable
+ xywh {9 370 20 20} labelsize 11 resizable
}
Fl_Button {} {
label {Hide &Overlays}
callback overlay_cb
- tooltip {Hide the widget overlay box.} xywh {240 330 99 20} labelsize 11 labelcolor 1
+ tooltip {Hide the widget overlay box.} xywh {240 370 99 20} labelsize 11 labelcolor 1
}
Fl_Button {} {
label Revert
callback revert_cb
- xywh {66 330 80 20} labelsize 11 hide
+ xywh {66 370 80 20} labelsize 11 hide
}
Fl_Return_Button {} {
label Close
callback ok_cb
- xywh {344 330 64 20} labelsize 11
+ xywh {344 370 64 20} labelsize 11
}
Fl_Button {} {
label Cancel
callback cancel_cb
- xywh {339 330 70 20} labelsize 11 hide
+ xywh {339 370 70 20} labelsize 11 hide
}
Fl_Button wLiveMode {
label {Live &Mode}
callback live_mode_cb
- tooltip {Create a live duplicate of the selected widgets to test resizing and menu behavior.} xywh {151 330 84 20} type Toggle labelsize 11
+ tooltip {Create a live duplicate of the selected widgets to test resizing and menu behavior.} xywh {151 370 84 20} type Toggle labelsize 11
}
}
}
diff --git a/fluid/widget_panel.h b/fluid/widget_panel.h
index 11fece48d..49cd49192 100644
--- a/fluid/widget_panel.h
+++ b/fluid/widget_panel.h
@@ -91,8 +91,12 @@ extern void name_public_member_cb(Fl_Choice*, void*);
extern void name_public_cb(Fl_Choice*, void*);
extern void v_input_cb(Fl_Input*, void*);
extern Fl_Input *v_input[4];
+#include <FL/Fl_Tile.H>
+#include <FL/Fl_Text_Editor.H>
+extern Fl_Text_Editor *wComment;
#include "CodeEditor.h"
extern void callback_cb(CodeEditor*, void*);
+extern CodeEditor *wCallback;
extern void user_data_cb(Fl_Input*, void*);
extern Fl_Menu_Item whenmenu[];
extern void when_cb(Fl_Choice*, void*);