From 16a999efd0f14f0a99fb01c4e8484ace744fd416 Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Thu, 5 Aug 1999 08:01:40 +0000 Subject: [PATCH] Fixed so that a public declaration like #include "Foo" is written to the header file in the correct order, before anything written by an later object in the fl file. It used to write the extern callback definitions first, this would fail if they used a type that was in the header file. This also simplified the (still messy) code by getting rid of the write_declare() virtual function. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@637 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- fluid/Fl_Function_Type.cxx | 20 ++------- fluid/Fl_Menu_Type.cxx | 21 ++++----- fluid/Fl_Type.h | 13 +----- fluid/Fl_Widget_Type.cxx | 18 +++----- fluid/about_panel.cxx | 12 ++--- fluid/about_panel.h | 8 ++-- fluid/alignment_panel.cxx | 10 ++--- fluid/alignment_panel.h | 16 +++---- fluid/code.cxx | 21 +++++---- fluid/function_panel.cxx | 56 +++++++++++------------ fluid/function_panel.h | 10 ++--- fluid/widget_panel.cxx | 50 ++++++++++----------- fluid/widget_panel.h | 92 +++++++++++++++++++------------------- 13 files changed, 158 insertions(+), 189 deletions(-) diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index 4c21831bc..f2689d840 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.6 1999/07/22 07:27:09 bill Exp $" +// "$Id: Fl_Function_Type.cxx,v 1.15.2.7 1999/08/05 08:01:35 bill Exp $" // // C function type code for the Fast Light Tool Kit (FLTK). // @@ -173,10 +173,6 @@ void Fl_Function_Type::open() { Fl_Function_Type Fl_Function_type; -void Fl_Function_Type::write_declare() { - ::write_declare("#include "); -} - extern const char* subclassname(Fl_Type*); void Fl_Function_Type::write_code1() { @@ -305,8 +301,6 @@ void Fl_Code_Type::open() { Fl_Code_Type Fl_Code_type; -void Fl_Code_Type::write_declare() {} - void Fl_Code_Type::write_code1() { const char* c = name(); if (!c) return; @@ -376,8 +370,6 @@ void Fl_CodeBlock_Type::open() { Fl_CodeBlock_Type Fl_CodeBlock_type; -void Fl_CodeBlock_Type::write_declare() {} - void Fl_CodeBlock_Type::write_code1() { const char* c = name(); write_c("%s%s {\n", indent(), c ? c : ""); @@ -444,8 +436,6 @@ void Fl_Decl_Type::open() { Fl_Decl_Type Fl_Decl_type; -void Fl_Decl_Type::write_declare() {} - void Fl_Decl_Type::write_code1() { const char* c = name(); if (!c) return; @@ -466,7 +456,7 @@ void Fl_Decl_Type::write_code1() { while (e>c && e[-1]==';') e--; if (class_name()) { write_public(public_); - write_h(" %.*s;\n", e-c, c); + write_h(" %.*s;", e-c, c); } else { if (public_) { write_h("extern %.*s;\n", e-c, c); @@ -538,8 +528,6 @@ void Fl_DeclBlock_Type::open() { Fl_DeclBlock_Type Fl_DeclBlock_type; -void Fl_DeclBlock_Type::write_declare() {} - void Fl_DeclBlock_Type::write_code1() { const char* c = name(); if (c) write_c("%s\n", c); @@ -638,8 +626,6 @@ void Fl_Class_Type::open() { Fl_Class_Type Fl_Class_type; -void Fl_Class_Type::write_declare() {} - static Fl_Class_Type *current_class; extern int varused_test; void write_public(int state) { @@ -664,5 +650,5 @@ void Fl_Class_Type::write_code2() { } // -// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.6 1999/07/22 07:27:09 bill Exp $". +// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.7 1999/08/05 08:01:35 bill Exp $". // diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx index bec72e999..df2ce84e0 100644 --- a/fluid/Fl_Menu_Type.cxx +++ b/fluid/Fl_Menu_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Menu_Type.cxx,v 1.16.2.2 1999/04/17 01:33:27 bill Exp $" +// "$Id: Fl_Menu_Type.cxx,v 1.16.2.3 1999/08/05 08:01:36 bill Exp $" // // Menu item code for the Fast Light Tool Kit (FLTK). // @@ -93,16 +93,6 @@ int is_name(const char *c); const char *array_name(Fl_Widget_Type *o); int isdeclare(const char *c); -void Fl_Menu_Item_Type::write_declare() { - if (callback() && is_name(callback())) - ::write_declare("extern void %s(Fl_Menu_*, %s);", callback(), - user_data_type() ? user_data_type() : "void*"); - for (int n=0; n < NUM_EXTRA_CODE; n++) { - if (extra_code(n) && isdeclare(extra_code(n))) - ::write_declare("%s", extra_code(n)); - } -} - // Search backwards to find the parent menu button and return it's name. // Also put in i the index into the button's menu item array belonging // to this menu item. @@ -123,6 +113,13 @@ const char* Fl_Menu_Item_Type::menu_name(int& i) { #include "Fluid_Image.h" void Fl_Menu_Item_Type::write_static() { + if (callback() && is_name(callback())) + ::write_declare("extern void %s(Fl_Menu_*, %s);", callback(), + user_data_type() ? user_data_type() : "void*"); + for (int n=0; n < NUM_EXTRA_CODE; n++) { + if (extra_code(n) && isdeclare(extra_code(n))) + ::write_declare("%s", extra_code(n)); + } if (callback() && !is_name(callback())) { // see if 'o' or 'v' used, to prevent unused argument warnings: int use_o = 0; @@ -442,5 +439,5 @@ void shortcut_in_cb(Shortcut_Button* i, void* v) { } // -// End of "$Id: Fl_Menu_Type.cxx,v 1.16.2.2 1999/04/17 01:33:27 bill Exp $". +// End of "$Id: Fl_Menu_Type.cxx,v 1.16.2.3 1999/08/05 08:01:36 bill Exp $". // diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h index 6ce76155e..167540c49 100644 --- a/fluid/Fl_Type.h +++ b/fluid/Fl_Type.h @@ -1,5 +1,5 @@ // -// "$Id: Fl_Type.h,v 1.5.2.2 1999/04/18 14:10:53 gustavo Exp $" +// "$Id: Fl_Type.h,v 1.5.2.3 1999/08/05 08:01:36 bill Exp $" // // Widget type header file for the Fast Light Tool Kit (FLTK). // @@ -106,7 +106,6 @@ public: virtual int read_fdesign(const char*, const char*); // write code, these are called in order: - virtual void write_declare(); // write #include and #define to .h file virtual void write_static(); // write static stuff to .c file virtual void write_code1(); // code and .h before children virtual void write_code2(); // code and .h after children @@ -132,7 +131,6 @@ class Fl_Function_Type : public Fl_Type { char public_, constructor, havewidgets; public: Fl_Type *make(); - void write_declare(); void write_code1(); void write_code2(); void open(); @@ -150,7 +148,6 @@ public: class Fl_Code_Type : public Fl_Type { public: Fl_Type *make(); - void write_declare(); void write_code1(); void write_code2(); void open(); @@ -162,7 +159,6 @@ class Fl_CodeBlock_Type : public Fl_Type { const char* after; public: Fl_Type *make(); - void write_declare(); void write_code1(); void write_code2(); void open(); @@ -177,7 +173,6 @@ class Fl_Decl_Type : public Fl_Type { char public_; public: Fl_Type *make(); - void write_declare(); void write_code1(); void write_code2(); void open(); @@ -190,7 +185,6 @@ class Fl_DeclBlock_Type : public Fl_Type { const char* after; public: Fl_Type *make(); - void write_declare(); void write_code1(); void write_code2(); void open(); @@ -210,7 +204,6 @@ public: Fl_Class_Type* parent_class; // save class if nested // Fl_Type *make(); - void write_declare(); void write_code1(); void write_code2(); void open(); @@ -235,7 +228,6 @@ class Fl_Widget_Type : public Fl_Type { protected: - void write_declare(); void write_static(); void write_code1(); void write_widget_code(); @@ -398,7 +390,6 @@ public: int is_button() const {return 1;} // this gets shortcut to work Fl_Widget* widget(int,int,int,int) {return 0;} Fl_Widget_Type* _make() {return 0;} - void write_declare(); const char* menu_name(int& i); int flags(); void write_static(); @@ -525,5 +516,5 @@ int storestring(const char *n, const char * & p, int nostrip=0); extern int include_H_from_C; // -// End of "$Id: Fl_Type.h,v 1.5.2.2 1999/04/18 14:10:53 gustavo Exp $". +// End of "$Id: Fl_Type.h,v 1.5.2.3 1999/08/05 08:01:36 bill Exp $". // diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index 90ae6f91a..0f4dffef9 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.4 1999/04/26 06:45:25 bill Exp $" +// "$Id: Fl_Widget_Type.cxx,v 1.15.2.5 1999/08/05 08:01:36 bill Exp $" // // Widget type code for the Fast Light Tool Kit (FLTK). // @@ -1222,20 +1222,16 @@ int isdeclare(const char *c) { return 0; } -void Fl_Widget_Type::write_declare() { - const char *t = subclassname(this); +void Fl_Widget_Type::write_static() { + const char* t = subclassname(this); if (!subclass()) ::write_declare("#include ", t); - if (callback() && is_name(callback())) - ::write_declare("extern void %s(%s*, %s);", callback(), t, - user_data_type() ? user_data_type() : "void*"); for (int n=0; n < NUM_EXTRA_CODE; n++) { if (extra_code(n) && isdeclare(extra_code(n))) ::write_declare("%s", extra_code(n)); } -} - -void Fl_Widget_Type::write_static() { - const char* t = subclassname(this); + if (callback() && is_name(callback())) + ::write_declare("extern void %s(%s*, %s);", callback(), t, + user_data_type() ? user_data_type() : "void*"); const char* c = array_name(this); const char* k = class_name(); if (c && !k) { @@ -1750,5 +1746,5 @@ int Fl_Widget_Type::read_fdesign(const char* name, const char* value) { } // -// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.4 1999/04/26 06:45:25 bill Exp $". +// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.5 1999/08/05 08:01:36 bill Exp $". // diff --git a/fluid/about_panel.cxx b/fluid/about_panel.cxx index b92ec74fc..53757f388 100644 --- a/fluid/about_panel.cxx +++ b/fluid/about_panel.cxx @@ -47,7 +47,7 @@ Fl_Window* make_about_panel(const char *copyright) { o->color(6); o->selection_color(47); o->labelcolor(6); - o->align(16); + o->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE); } { Fl_Box* o = new Fl_Box(10, 150, 150, 90, "fluid"); o->box(FL_ROUND_UP_BOX); @@ -69,7 +69,7 @@ Fl_Window* make_about_panel(const char *copyright) { o->selection_color(47); o->labelsize(20); o->labelcolor(7); - o->align(17); + o->align(FL_ALIGN_TOP|FL_ALIGN_INSIDE); } { Fl_Box* o = new Fl_Box(70, 145, 15, 15, "` "); o->box(FL_OVAL_BOX); @@ -77,7 +77,7 @@ Fl_Window* make_about_panel(const char *copyright) { o->selection_color(47); o->labelsize(20); o->labelcolor(7); - o->align(17); + o->align(FL_ALIGN_TOP|FL_ALIGN_INSIDE); } { Fl_Box* o = new Fl_Box(84, 125, 15, 15, "` "); o->box(FL_OVAL_BOX); @@ -85,7 +85,7 @@ Fl_Window* make_about_panel(const char *copyright) { o->selection_color(47); o->labelsize(20); o->labelcolor(7); - o->align(17); + o->align(FL_ALIGN_TOP|FL_ALIGN_INSIDE); } { Fl_Box* o = new Fl_Box(150, 27, 140, 113, "FLTK User\nInterface\nDesigner\nVersion 1.0"); o->box(FL_OVAL_BOX); @@ -96,7 +96,7 @@ Fl_Window* make_about_panel(const char *copyright) { o->labelsize(18); o->labelcolor(7); } - { Fl_Button* o = new Fl_Button(181, 176, 115, 30, "\251\061\071\071\070-1999 by\nBill Spitzak and others"); + { Fl_Button* o = new Fl_Button(181, 176, 115, 30, "\251""1998-1999 by\nBill Spitzak and others"); o->box(FL_THIN_UP_BOX); o->labelsize(10); o->labelcolor(136); @@ -107,7 +107,7 @@ Fl_Window* make_about_panel(const char *copyright) { { Fl_Box* o = copyright_box = new Fl_Box(5, 5, 300, 210); o->labelsize(8); o->labelcolor(6); - o->align(148); + o->align(132|FL_ALIGN_INSIDE); o->hide(); o->label(copyright); } diff --git a/fluid/about_panel.h b/fluid/about_panel.h index bd05e658c..5f82833b6 100644 --- a/fluid/about_panel.h +++ b/fluid/about_panel.h @@ -3,14 +3,14 @@ #ifndef about_panel_h #define about_panel_h #include -#include -#include -#include -#include #include extern Fl_Window *about_panel; +#include extern Fl_Group *display_group; +#include +#include extern Fl_Box *copyright_box; +#include Fl_Window* make_about_panel(const char *copyright); extern Fl_Window *about_panel; extern Fl_Group *display_group; diff --git a/fluid/alignment_panel.cxx b/fluid/alignment_panel.cxx index 0726959e4..efe89cc09 100644 --- a/fluid/alignment_panel.cxx +++ b/fluid/alignment_panel.cxx @@ -27,7 +27,7 @@ Fl_Window* make_alignment_window() { { Fl_Box* o = new Fl_Box(10, 20, 190, 100, "Alignment:"); o->box(FL_ENGRAVED_FRAME); o->labelsize(12); - o->align(5); + o->align(FL_ALIGN_TOP_LEFT); } { Fl_Input* o = horizontal_input = new Fl_Input(90, 30, 100, 20, "Horizontal:"); o->type(2); @@ -53,21 +53,21 @@ Fl_Window* make_alignment_window() { { Fl_Box* o = new Fl_Box(10, 140, 190, 130, "Output File Names:"); o->box(FL_ENGRAVED_FRAME); o->labelsize(12); - o->align(5); + o->align(FL_ALIGN_TOP_LEFT); } { Fl_Box* o = new Fl_Box(20, 150, 170, 30, "Use \"name.ext\" to set name or just \".ext\" to set only extension."); o->labelsize(10); - o->align(148); + o->align(132|FL_ALIGN_INSIDE); } { Fl_Input* o = header_file_input = new Fl_Input(100, 180, 90, 20, "Header File:"); o->box(FL_THIN_DOWN_BOX); o->callback((Fl_Callback*)header_input_cb, (void*)(1)); - o->when(1); + o->when(FL_WHEN_CHANGED); } { Fl_Input* o = code_file_input = new Fl_Input(100, 210, 90, 20, "Code File:"); o->box(FL_THIN_DOWN_BOX); o->callback((Fl_Callback*)code_input_cb, (void*)(1)); - o->when(1); + o->when(FL_WHEN_CHANGED); } { Fl_Light_Button* o = include_H_from_C_button = new Fl_Light_Button(20, 240, 170, 20, "Include Header from Code"); o->value(1); diff --git a/fluid/alignment_panel.h b/fluid/alignment_panel.h index 81cfd2df3..2c1acd542 100644 --- a/fluid/alignment_panel.h +++ b/fluid/alignment_panel.h @@ -3,21 +3,21 @@ #ifndef alignment_panel_h #define alignment_panel_h #include -#include -#include -#include -#include #include -extern void alignment_cb(Fl_Input*, long); -extern void code_input_cb(Fl_Input*, void*); -extern void header_input_cb(Fl_Input*, void*); -extern void include_H_from_C_button_cb(Fl_Light_Button*, void*); extern Fl_Window *alignment_window; +#include +#include +extern void alignment_cb(Fl_Input*, long); extern Fl_Input *horizontal_input; extern Fl_Input *vertical_input; extern Fl_Input *snap_input; +#include +extern void header_input_cb(Fl_Input*, void*); extern Fl_Input *header_file_input; +extern void code_input_cb(Fl_Input*, void*); extern Fl_Input *code_file_input; +#include +extern void include_H_from_C_button_cb(Fl_Light_Button*, void*); extern Fl_Light_Button *include_H_from_C_button; Fl_Window* make_alignment_window(); extern Fl_Window *alignment_window; diff --git a/fluid/code.cxx b/fluid/code.cxx index f21dc7459..5d2270951 100644 --- a/fluid/code.cxx +++ b/fluid/code.cxx @@ -1,5 +1,5 @@ // -// "$Id: code.cxx,v 1.9.2.1 1999/07/31 08:00:09 bill Exp $" +// "$Id: code.cxx,v 1.9.2.2 1999/08/05 08:01:39 bill Exp $" // // Code output routines for the Fast Light Tool Kit (FLTK). // @@ -104,9 +104,9 @@ const char* indent() { //////////////////////////////////////////////////////////////// // declarations/include files: -// These are sorted in alphabetical order and only included once each: -// Relies on '#' being less than any letter to put #include first. -// I use a binary tree to sort these out. +// Each string generated by write_declare is written only once to +// the header file. This is done by keeping a binary tree of all +// the calls so far and not printing it if it is in the tree. struct included { char *text; @@ -120,7 +120,6 @@ struct included { included::~included() { delete left; - fprintf(header_file,"%s\n",text); free((void *)text); delete right; } @@ -139,6 +138,7 @@ int write_declare(const char *format, ...) { else if (i < 0) p = &((*p)->left); else p = &((*p)->right); } + fprintf(header_file,"%s\n",buf); *p = new included(buf); return 1; } @@ -278,13 +278,11 @@ int write_code(const char *s, const char *t) { fprintf(header_file, "#define %s\n", define_name); } - Fl_Type *p; - for (p = Fl_Type::first; p; p = p->next) p->write_declare(); - delete included_root; included_root = 0; + write_declare("#include "); if (t && include_H_from_C) write_c("#include \"%s\"\n", filename_name(t)); - for (p = Fl_Type::first; p;) { + for (Fl_Type* p = Fl_Type::first; p;) { // write all static data for this & all children first p->write_static(); for (Fl_Type* q = p->next; q && q->level > p->level; q = q->next) @@ -293,6 +291,8 @@ int write_code(const char *s, const char *t) { p = write_code(p); } + delete included_root; included_root = 0; + if (!s) return 1; int x = fclose(code_file); code_file = 0; @@ -304,7 +304,6 @@ int write_code(const char *s, const char *t) { //////////////////////////////////////////////////////////////// -void Fl_Type::write_declare() {} void Fl_Type::write_static() {} void Fl_Type::write_code1() { write_h("// Header for %s\n", title()); @@ -313,5 +312,5 @@ void Fl_Type::write_code1() { void Fl_Type::write_code2() {} // -// End of "$Id: code.cxx,v 1.9.2.1 1999/07/31 08:00:09 bill Exp $". +// End of "$Id: code.cxx,v 1.9.2.2 1999/08/05 08:01:39 bill Exp $". // diff --git a/fluid/function_panel.cxx b/fluid/function_panel.cxx index 0c5818621..77a50fcdb 100644 --- a/fluid/function_panel.cxx +++ b/fluid/function_panel.cxx @@ -20,18 +20,18 @@ Fl_Window* make_function_panel() { w = o; { Fl_Light_Button* o = f_public_button = new Fl_Light_Button(10, 15, 65, 25, "public"); o->labelsize(10); - o->when(0); + o->when(FL_WHEN_NEVER); } { Fl_Input* o = f_name_input = new Fl_Input(10, 60, 270, 25, "Name(args): (blank for main())"); o->labelsize(12); - o->align(5); - o->when(0); + o->align(FL_ALIGN_TOP_LEFT); + o->when(FL_WHEN_NEVER); Fl_Group::current()->resizable(o); } { Fl_Input* o = f_return_type_input = new Fl_Input(10, 105, 270, 25, "Return Type: (blank to return outermost widget)"); o->labelsize(12); - o->align(5); - o->when(0); + o->align(FL_ALIGN_TOP_LEFT); + o->when(FL_WHEN_NEVER); } { Fl_Return_Button* o = f_panel_ok = new Fl_Return_Button(110, 140, 80, 25, "OK"); w->hotspot(o); @@ -60,8 +60,8 @@ Fl_Window* make_code_panel() { { Fl_Input* o = code_input = new Fl_Input(6, 5, 280, 135); o->type(4); o->labelsize(12); - o->align(0); - o->when(0); + o->align(FL_ALIGN_CENTER); + o->when(FL_WHEN_NEVER); Fl_Group::current()->resizable(o); } { Fl_Return_Button* o = code_panel_ok = new Fl_Return_Button(115, 145, 80, 25, "OK"); @@ -92,17 +92,17 @@ Fl_Window* make_codeblock_panel() { w = o; { Fl_Input* o = code_before_input = new Fl_Input(10, 5, 275, 25); o->labelsize(12); - o->align(5); - o->when(0); + o->align(FL_ALIGN_TOP_LEFT); + o->when(FL_WHEN_NEVER); Fl_Group::current()->resizable(o); } { Fl_Box* o = new Fl_Box(10, 35, 270, 25, "\"{...child code...}\" is inserted here"); - o->align(20); + o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); } { Fl_Input* o = code_after_input = new Fl_Input(10, 65, 275, 25); o->labelsize(12); - o->align(5); - o->when(0); + o->align(FL_ALIGN_TOP_LEFT); + o->when(FL_WHEN_NEVER); } { Fl_Return_Button* o = codeblock_panel_ok = new Fl_Return_Button(115, 100, 80, 25, "OK"); w->hotspot(o); @@ -132,17 +132,17 @@ Fl_Window* make_declblock_panel() { w = o; { Fl_Input* o = decl_before_input = new Fl_Input(15, 10, 275, 25); o->labelsize(12); - o->align(5); - o->when(0); + o->align(FL_ALIGN_TOP_LEFT); + o->when(FL_WHEN_NEVER); Fl_Group::current()->resizable(o); } { Fl_Box* o = new Fl_Box(15, 40, 270, 25, "\"\\n...child code...\\n\" is inserted here"); - o->align(20); + o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); } { Fl_Input* o = decl_after_input = new Fl_Input(15, 70, 275, 25); o->labelsize(12); - o->align(5); - o->when(0); + o->align(FL_ALIGN_TOP_LEFT); + o->when(FL_WHEN_NEVER); } { Fl_Return_Button* o = declblock_panel_ok = new Fl_Return_Button(120, 105, 80, 25, "OK"); w->hotspot(o); @@ -172,14 +172,14 @@ Fl_Window* make_decl_panel() { w = o; { Fl_Light_Button* o = decl_public_button = new Fl_Light_Button(10, 15, 65, 25, "public"); o->labelsize(10); - o->when(0); + o->when(FL_WHEN_NEVER); } - { Fl_Input* o = decl_input = new Fl_Input(10, 50, 270, 25, "can be any declartion, like \"int x;\",\nan external symbol like \"extern \ -int foo();\",\na #directive like \"#include \",\nor a comment like \"\ -//foo\" or \"/*foo*/\""); + { Fl_Input* o = decl_input = new Fl_Input(10, 50, 270, 25, "can be any declartion, like \"int x;\",\nan external symbol like \"extern int\ + foo();\",\na #directive like \"#include \",\nor a comment like \"//foo\ +\" or \"/*foo*/\""); o->labelsize(12); - o->align(6); - o->when(0); + o->align(FL_ALIGN_BOTTOM_LEFT); + o->when(FL_WHEN_NEVER); Fl_Group::current()->resizable(o); } { Fl_Return_Button* o = decl_panel_ok = new Fl_Return_Button(115, 145, 80, 25, "OK"); @@ -211,18 +211,18 @@ Fl_Window* make_class_panel() { w = o; { Fl_Light_Button* o = c_public_button = new Fl_Light_Button(10, 10, 65, 25, "public"); o->labelsize(10); - o->when(0); + o->when(FL_WHEN_NEVER); } { Fl_Input* o = c_name_input = new Fl_Input(10, 55, 270, 25, "name:"); o->labelsize(12); - o->align(5); - o->when(0); + o->align(FL_ALIGN_TOP_LEFT); + o->when(FL_WHEN_NEVER); Fl_Group::current()->resizable(o); } { Fl_Input* o = c_subclass_input = new Fl_Input(10, 100, 270, 25, "subclass of (text between : and {)"); o->labelsize(12); - o->align(5); - o->when(0); + o->align(FL_ALIGN_TOP_LEFT); + o->when(FL_WHEN_NEVER); } { Fl_Return_Button* o = c_panel_ok = new Fl_Return_Button(110, 135, 80, 25, "OK"); w->hotspot(o); diff --git a/fluid/function_panel.h b/fluid/function_panel.h index 9e152077b..ce0962583 100644 --- a/fluid/function_panel.h +++ b/fluid/function_panel.h @@ -3,17 +3,16 @@ #ifndef function_panel_h #define function_panel_h #include -#include -#include -#include -#include -#include #include extern Fl_Window *function_panel; +#include extern Fl_Light_Button *f_public_button; +#include extern Fl_Input *f_name_input; extern Fl_Input *f_return_type_input; +#include extern Fl_Return_Button *f_panel_ok; +#include extern Fl_Button *f_panel_cancel; Fl_Window* make_function_panel(); extern Fl_Window *function_panel; @@ -33,6 +32,7 @@ extern Fl_Return_Button *code_panel_ok; extern Fl_Button *code_panel_cancel; extern Fl_Window *codeblock_panel; extern Fl_Input *code_before_input; +#include extern Fl_Input *code_after_input; extern Fl_Return_Button *codeblock_panel_ok; extern Fl_Button *codeblock_panel_cancel; diff --git a/fluid/widget_panel.cxx b/fluid/widget_panel.cxx index 847ea1006..bcdbe1d1e 100644 --- a/fluid/widget_panel.cxx +++ b/fluid/widget_panel.cxx @@ -12,19 +12,19 @@ Fl_Window* make_widget_panel() { { Fl_Input* o = new Fl_Input(90, 10, 210, 20, "Name:"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)name_cb); - o->when(0); + o->when(FL_WHEN_NEVER); } { Fl_Light_Button* o = new Fl_Light_Button(300, 10, 60, 20, "public"); o->box(FL_THIN_UP_BOX); o->selection_color(1); o->labelsize(10); o->callback((Fl_Callback*)name_public_cb); - o->when(1); + o->when(FL_WHEN_CHANGED); } { Fl_Input* o = new Fl_Input(90, 35, 170, 20, "Class:"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)subclass_cb, (void*)(4)); - o->when(0); + o->when(FL_WHEN_NEVER); } { Fl_Choice* o = new Fl_Choice(260, 35, 100, 20); o->box(FL_THIN_UP_BOX); @@ -33,7 +33,7 @@ Fl_Window* make_widget_panel() { { Fl_Input* o = new Fl_Input(90, 60, 270, 20, "Label:"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)label_cb); - o->when(1); + o->when(FL_WHEN_CHANGED); } { Fl_Choice* o = new Fl_Choice(90, 80, 150, 20, "Label Type:"); o->box(FL_THIN_UP_BOX); @@ -133,14 +133,14 @@ Fl_Window* make_widget_panel() { { Fl_Input* o = new Fl_Input(90, 170, 170, 20, "xclass:"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)xclass_cb); - o->when(0); + o->when(FL_WHEN_NEVER); } { Shortcut_Button* o = new Shortcut_Button(90, 170, 270, 20, "Shortcut:"); o->box(FL_THIN_UP_BOX); o->color(7); o->selection_color(7); o->callback((Fl_Callback*)shortcut_in_cb); - o->align(4); + o->align(FL_ALIGN_LEFT); } { Fl_Value_Input* o = new Fl_Value_Input(260, 170, 50, 20); o->box(FL_THIN_UP_BOX); @@ -161,42 +161,42 @@ Fl_Window* make_widget_panel() { o->labelsize(10); o->step(0.010101); o->callback((Fl_Callback*)slider_size_cb); - o->align(5); + o->align(FL_ALIGN_TOP_LEFT); } { Fl_Value_Input* o = new Fl_Value_Input(90, 205, 60, 20, "Minimum:"); o->box(FL_THIN_UP_BOX); o->labelsize(10); o->callback((Fl_Callback*)min_cb); - o->align(5); + o->align(FL_ALIGN_TOP_LEFT); } { Fl_Value_Input* o = new Fl_Value_Input(160, 205, 60, 20, "Maximum:"); o->box(FL_THIN_UP_BOX); o->labelsize(10); o->value(1); o->callback((Fl_Callback*)max_cb); - o->align(5); + o->align(FL_ALIGN_TOP_LEFT); } { Fl_Value_Input* o = new Fl_Value_Input(230, 205, 60, 20, "Step:"); o->box(FL_THIN_UP_BOX); o->labelsize(10); o->callback((Fl_Callback*)step_cb); - o->align(5); + o->align(FL_ALIGN_TOP_LEFT); } { Fl_Value_Input* o = new Fl_Value_Input(300, 205, 60, 20, "Value:"); o->box(FL_THIN_UP_BOX); o->labelsize(10); o->callback((Fl_Callback*)value_cb); - o->align(5); + o->align(FL_ALIGN_TOP_LEFT); } { Fl_Group* o = new Fl_Group(20, 230, 340, 20); o->callback((Fl_Callback*)propagate_load); - o->align(5); + o->align(FL_ALIGN_TOP_LEFT); { Fl_Light_Button* o = new Fl_Light_Button(20, 230, 70, 20, "non_modal"); o->box(FL_THIN_UP_BOX); o->selection_color(1); o->labelsize(9); o->callback((Fl_Callback*)non_modal_cb); - o->align(148); + o->align(132|FL_ALIGN_INSIDE); } { Fl_Light_Button* o = new Fl_Light_Button(90, 230, 60, 20, "visible"); o->box(FL_THIN_UP_BOX); @@ -227,45 +227,45 @@ Fl_Window* make_widget_panel() { o->selection_color(1); o->labelsize(10); o->callback((Fl_Callback*)resizable_cb); - o->when(1); + o->when(FL_WHEN_CHANGED); } { Fl_Light_Button* o = new Fl_Light_Button(300, 230, 60, 20, "hotspot"); o->box(FL_THIN_UP_BOX); o->selection_color(1); o->labelsize(10); o->callback((Fl_Callback*)hotspot_cb); - o->when(1); + o->when(FL_WHEN_CHANGED); } o->end(); } { Fl_Input* o = v_input[0] = new Fl_Input(90, 260, 270, 20, "Extra Code:"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)v_input_cb, (void*)(0)); - o->when(0); + o->when(FL_WHEN_NEVER); } { Fl_Input* o = v_input[1] = new Fl_Input(90, 280, 270, 20); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)v_input_cb, (void*)(1)); - o->when(0); + o->when(FL_WHEN_NEVER); } { Fl_Input* o = v_input[2] = new Fl_Input(90, 300, 270, 20); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)v_input_cb, (void*)(2)); - o->when(0); + o->when(FL_WHEN_NEVER); } { Fl_Input* o = v_input[3] = new Fl_Input(90, 320, 270, 20); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)v_input_cb, (void*)(3)); - o->when(0); + o->when(FL_WHEN_NEVER); } { Fl_Box* o = new Fl_Box(0, 350, 90, 20, "Callback:"); - o->align(24); + o->align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); } { Fl_Input* o = new Fl_Input(90, 350, 270, 50); o->type(4); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)callback_cb); - o->when(0); + o->when(FL_WHEN_NEVER); } { Fl_Box* o = new Fl_Box(90, 370, 100, 30, "label"); o->hide(); @@ -275,17 +275,17 @@ Fl_Window* make_widget_panel() { { Fl_Input* o = new Fl_Input(90, 400, 170, 20, "user_data:"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)user_data_cb); - o->when(0); + o->when(FL_WHEN_NEVER); } { Fl_Input* o = new Fl_Input(300, 400, 60, 20, "Type:"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)user_data_type_cb); - o->when(0); + o->when(FL_WHEN_NEVER); } { Fl_Choice* o = new Fl_Choice(90, 420, 100, 20, "When:"); o->box(FL_THIN_UP_BOX); o->callback((Fl_Callback*)when_cb); - o->when(0); + o->when(FL_WHEN_NEVER); o->menu(whenmenu); } { Fl_Light_Button* o = new Fl_Light_Button(190, 420, 70, 20, "no change"); @@ -293,7 +293,7 @@ Fl_Window* make_widget_panel() { o->selection_color(1); o->labelsize(10); o->callback((Fl_Callback*)when_button_cb); - o->when(0); + o->when(FL_WHEN_NEVER); } { Fl_Group* o = new Fl_Group(10, 450, 350, 20); { Fl_Button* o = new Fl_Button(10, 450, 80, 20, "no &overlay"); diff --git a/fluid/widget_panel.h b/fluid/widget_panel.h index 56e11ab5c..d5e3a9e46 100644 --- a/fluid/widget_panel.h +++ b/fluid/widget_panel.h @@ -2,64 +2,64 @@ #ifndef widget_panel_h #define widget_panel_h -#include "Shortcut_Button.h" #include -#include -#include -#include -#include -#include -#include -#include -#include #include -extern Fl_Menu_Item boxmenu[]; -extern Fl_Menu_Item fontmenu[]; +#include +extern void name_cb(Fl_Input*, void*); +#include +extern void name_public_cb(Fl_Light_Button*, void*); +extern void subclass_cb(Fl_Input*, void*); +#include +extern void subtype_cb(Fl_Choice*, void*); +extern void label_cb(Fl_Input*, void*); extern Fl_Menu_Item labeltypemenu[]; -extern Fl_Menu_Item whenmenu[]; -extern void active_cb(Fl_Light_Button*, void*); +extern void labeltype_cb(Fl_Choice*, void*); +#include extern void align_cb(Fl_Button*, void*); -extern void border_cb(Fl_Light_Button*, void*); +extern Fl_Menu_Item fontmenu[]; +extern void labelfont_cb(Fl_Choice*, void*); +#include +extern void labelsize_cb(Fl_Value_Input*, void*); +extern void labelcolor_cb(Fl_Button*, void*); +extern Fl_Menu_Item boxmenu[]; extern void box_cb(Fl_Choice*, void*); -extern void callback_cb(Fl_Input*, void*); -extern void cancel_cb(Fl_Button*, void*); -extern void color2_cb(Fl_Button*, void*); extern void color_cb(Fl_Button*, void*); extern void down_box_cb(Fl_Choice*, void*); -extern void hotspot_cb(Fl_Light_Button*, void*); -extern void label_cb(Fl_Input*, void*); -extern void labelcolor_cb(Fl_Button*, void*); -extern void labelfont_cb(Fl_Choice*, void*); -extern void labelsize_cb(Fl_Value_Input*, void*); -extern void labeltype_cb(Fl_Choice*, void*); -extern void max_cb(Fl_Value_Input*, void*); -extern void min_cb(Fl_Value_Input*, void*); -extern void modal_cb(Fl_Light_Button*, void*); -extern void name_cb(Fl_Input*, void*); -extern void name_public_cb(Fl_Light_Button*, void*); -extern void non_modal_cb(Fl_Light_Button*, void*); -extern void ok_cb(Fl_Return_Button*, void*); -extern void overlay_cb(Fl_Button*, void*); -extern void propagate_load(Fl_Group*, void*); -extern void resizable_cb(Fl_Light_Button*, void*); -extern void revert_cb(Fl_Button*, void*); -extern void shortcut_in_cb(Shortcut_Button*, void*); -extern void slider_size_cb(Fl_Value_Input*, void*); -extern void step_cb(Fl_Value_Input*, void*); -extern void subclass_cb(Fl_Input*, void*); -extern void subtype_cb(Fl_Choice*, void*); -extern void textcolor_cb(Fl_Button*, void*); +extern void color2_cb(Fl_Button*, void*); extern void textfont_cb(Fl_Choice*, void*); +extern void xclass_cb(Fl_Input*, void*); +#include "Shortcut_Button.h" +extern void shortcut_in_cb(Shortcut_Button*, void*); extern void textsize_cb(Fl_Value_Input*, void*); +extern void textcolor_cb(Fl_Button*, void*); +extern void slider_size_cb(Fl_Value_Input*, void*); +extern void min_cb(Fl_Value_Input*, void*); +extern void max_cb(Fl_Value_Input*, void*); +extern void step_cb(Fl_Value_Input*, void*); +extern void value_cb(Fl_Value_Input*, void*); +#include +extern void propagate_load(Fl_Group*, void*); +extern void non_modal_cb(Fl_Light_Button*, void*); +extern void visible_cb(Fl_Light_Button*, void*); +extern void modal_cb(Fl_Light_Button*, void*); +extern void active_cb(Fl_Light_Button*, void*); +extern void border_cb(Fl_Light_Button*, void*); +extern void resizable_cb(Fl_Light_Button*, void*); +extern void hotspot_cb(Fl_Light_Button*, void*); +extern void v_input_cb(Fl_Input*, void*); +extern Fl_Input *v_input[4]; +#include +extern void callback_cb(Fl_Input*, void*); extern void user_data_cb(Fl_Input*, void*); extern void user_data_type_cb(Fl_Input*, void*); -extern void v_input_cb(Fl_Input*, void*); -extern void value_cb(Fl_Value_Input*, void*); -extern void visible_cb(Fl_Light_Button*, void*); -extern void when_button_cb(Fl_Light_Button*, void*); +extern Fl_Menu_Item whenmenu[]; extern void when_cb(Fl_Choice*, void*); -extern void xclass_cb(Fl_Input*, void*); -extern Fl_Input *v_input[4]; +extern void when_button_cb(Fl_Light_Button*, void*); +extern void overlay_cb(Fl_Button*, void*); +extern void revert_cb(Fl_Button*, void*); +extern void cancel_cb(Fl_Button*, void*); +#include +extern void ok_cb(Fl_Return_Button*, void*); Fl_Window* make_widget_panel(); extern Fl_Input *v_input[4]; #endif