summaryrefslogtreecommitdiff
path: root/fluid/Fl_Widget_Type.cxx
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 /fluid/Fl_Widget_Type.cxx
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
Diffstat (limited to 'fluid/Fl_Widget_Type.cxx')
-rw-r--r--fluid/Fl_Widget_Type.cxx27
1 files changed, 26 insertions, 1 deletions
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()) {