diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2003-01-28 20:51:17 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2003-01-28 20:51:17 +0000 |
| commit | fc22bc93a0b3724c759b9e28fb680d4f0b44376b (patch) | |
| tree | 273ec97e80dad2f3860fe454a0b24f10b9012f63 | |
| parent | 226715d978654145c1a011fe8ebf35431774c33d (diff) | |
Support type qualifiers before a class name; this allows for things like
"FL_EXPORT Fl_File_Chooser"...
Update Fl_File_Chooser and Fl_Help_Dialog to use the new interface so
that we don't have to add FL_EXPORT every time we make a change...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2934 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | CHANGES | 3 | ||||
| -rw-r--r-- | FL/Fl_File_Chooser.H | 2 | ||||
| -rw-r--r-- | FL/Fl_Help_Dialog.H | 2 | ||||
| -rw-r--r-- | fluid/Fl_Function_Type.cxx | 55 | ||||
| -rw-r--r-- | fluid/Fl_Type.cxx | 11 | ||||
| -rw-r--r-- | fluid/Fl_Type.h | 10 | ||||
| -rw-r--r-- | fluid/file.cxx | 10 | ||||
| -rw-r--r-- | src/Fl_File_Chooser.cxx | 2 | ||||
| -rw-r--r-- | src/Fl_File_Chooser.fl | 6 | ||||
| -rw-r--r-- | src/Fl_Help_Dialog.cxx | 10 | ||||
| -rw-r--r-- | src/Fl_Help_Dialog.fl | 6 |
11 files changed, 90 insertions, 27 deletions
@@ -1,6 +1,9 @@ CHANGES IN FLTK 1.1.3 - Documentation updates. + - FLUID now supports up to two additional qualifiers + before a class name (FL_EXPORT, etc.) to aide in + developing DLL interfaces for WIN32. - Additional NULL checks in Fl_Button, fl_draw_boxtype(), Fl_File_Chooser, and Fl_Window::hotspot(). diff --git a/FL/Fl_File_Chooser.H b/FL/Fl_File_Chooser.H index b07efe85a..c1b3b7bd0 100644 --- a/FL/Fl_File_Chooser.H +++ b/FL/Fl_File_Chooser.H @@ -1,4 +1,4 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0102 +// generated by Fast Light User Interface Designer (fluid) version 1.0103 #ifndef Fl_File_Chooser_H #define Fl_File_Chooser_H diff --git a/FL/Fl_Help_Dialog.H b/FL/Fl_Help_Dialog.H index 6ea4e58d7..d95c8668a 100644 --- a/FL/Fl_Help_Dialog.H +++ b/FL/Fl_Help_Dialog.H @@ -1,4 +1,4 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0101 +// generated by Fast Light User Interface Designer (fluid) version 1.0103 #ifndef Fl_Help_Dialog_H #define Fl_Help_Dialog_H diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index ad0c2f387..af4797cc0 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.11 2002/11/07 03:34:49 easysw Exp $" +// "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.12 2003/01/28 20:51:09 easysw Exp $" // // C function type code for the Fast Light Tool Kit (FLTK). // @@ -618,11 +618,17 @@ const char* Fl_Type::class_name(const int need_nest) const { int Fl_Class_Type::is_public() const {return public_;} +void Fl_Class_Type::prefix(const char*p) { + free((void*) class_prefix); + class_prefix=strdup(p ? p : "" ); +} + Fl_Type *Fl_Class_Type::make() { Fl_Type *p = Fl_Type::current; while (p && !p->is_decl_block()) p = p->parent; Fl_Class_Type *o = new Fl_Class_Type(); o->name("UserInterface"); + o->class_prefix=0; o->subclass_of = 0; o->public_ = 1; o->add(p); @@ -651,11 +657,19 @@ void Fl_Class_Type::read_property(const char *c) { void Fl_Class_Type::open() { if (!class_panel) make_class_panel(); - c_name_input->static_value(name()); + char fullname[1024]=""; + if (prefix() && strlen(prefix())) + sprintf(fullname,"%s %s",prefix(),name()); + else + strcpy(fullname, name()); + c_name_input->static_value(fullname); c_subclass_input->static_value(subclass_of); c_public_button->value(public_); class_panel->show(); const char* message = 0; + + char *na=0,*pr=0,*p=0; // name and prefix substrings + for (;;) { // repeat as long as there are errors if (message) fl_alert(message); for (;;) { @@ -665,14 +679,30 @@ void Fl_Class_Type::open() { else if (!w) Fl::wait(); } const char*c = c_name_input->value(); - while (isspace(*c)) c++; - if (!*c) goto OOPS; - while (is_id(*c)) c++; - while (isspace(*c)) c++; - if (*c) {OOPS: message = "class name must be C++ identifier"; continue;} + char *s = strdup(c); + size_t len = strlen(s); + if (!*s) goto OOPS; + p = (char*) (s+len-1); + while (p>=s && isspace(*p)) *(p--)='\0'; + if (p<s) goto OOPS; + while (p>=s && is_id(*p)) p--; + if ( (p<s && !is_id(*(p+1))) || !*(p+1) ) { + OOPS: message = "class name must be C++ identifier"; + free((void*)s); + continue; + } + na=p+1; // now we have the name + if(p>s) *p--='\0'; + while (p>=s && isspace(*p)) *(p--)='\0'; + while (p>=s && is_id(*p)) p--; + if (p<s) p++; + if (is_id(*p) && p<na) pr=p; // prefix detected c = c_subclass_input->value(); - message = c_check(c); if (message) continue; - name(c_name_input->value()); + message = c_check(c); + if (message) { free((void*)s);continue;} + name(na); + prefix(pr); + free((void*)s); storestring(c, subclass_of); public_ = c_public_button->value(); break; @@ -696,7 +726,10 @@ void Fl_Class_Type::write_code1() { parent_class = current_class; current_class = this; write_public_state = 0; - write_h("\nclass %s ", name()); + if (prefix() && strlen(prefix())) + write_h("\nclass %s %s ", prefix(), name()); + else + write_h("\nclass %s ", name()); if (subclass_of) write_h(": %s ", subclass_of); write_h("{\n"); } @@ -707,5 +740,5 @@ void Fl_Class_Type::write_code2() { } // -// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.11 2002/11/07 03:34:49 easysw Exp $". +// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.12 2003/01/28 20:51:09 easysw Exp $". // diff --git a/fluid/Fl_Type.cxx b/fluid/Fl_Type.cxx index e6be7c8de..eb29400fc 100644 --- a/fluid/Fl_Type.cxx +++ b/fluid/Fl_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Type.cxx,v 1.6.2.6.2.13 2002/11/19 18:41:15 easysw Exp $" +// "$Id: Fl_Type.cxx,v 1.6.2.6.2.14 2003/01/28 20:51:10 easysw Exp $" // // Widget type code for the Fast Light Tool Kit (FLTK). // @@ -726,6 +726,13 @@ void later_cb(Fl_Widget*,void*) { void Fl_Type::write() { write_indent(level); write_word(type_name()); + + if (is_class()) { + const char * p = ((Fl_Class_Type*)this)->prefix(); + if (p && strlen(p)) + write_word(p); + } + write_word(name()); write_open(level); write_properties(); @@ -784,5 +791,5 @@ void Fl_Type::read_property(const char *c) { int Fl_Type::read_fdesign(const char*, const char*) {return 0;} // -// End of "$Id: Fl_Type.cxx,v 1.6.2.6.2.13 2002/11/19 18:41:15 easysw Exp $". +// End of "$Id: Fl_Type.cxx,v 1.6.2.6.2.14 2003/01/28 20:51:10 easysw Exp $". // diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h index 2c4fa0540..3dcf27497 100644 --- a/fluid/Fl_Type.h +++ b/fluid/Fl_Type.h @@ -1,5 +1,5 @@ // -// "$Id: Fl_Type.h,v 1.5.2.11.2.7 2002/10/30 21:06:14 matthiaswm Exp $" +// "$Id: Fl_Type.h,v 1.5.2.11.2.8 2003/01/28 20:51:11 easysw Exp $" // // Widget type header file for the Fast Light Tool Kit (FLTK). // @@ -230,6 +230,12 @@ public: int pixmapID() { return 12; } void write_properties(); void read_property(const char *); + + // class prefix attribute access + void prefix(const char* p); + const char* prefix() const {return class_prefix;} +private: + const char* class_prefix; }; #define NUM_EXTRA_CODE 4 @@ -587,5 +593,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.11.2.7 2002/10/30 21:06:14 matthiaswm Exp $". +// End of "$Id: Fl_Type.h,v 1.5.2.11.2.8 2003/01/28 20:51:11 easysw Exp $". // diff --git a/fluid/file.cxx b/fluid/file.cxx index 7cc2daac8..0e72e4315 100644 --- a/fluid/file.cxx +++ b/fluid/file.cxx @@ -1,5 +1,5 @@ // -// "$Id: file.cxx,v 1.7.2.6.2.7 2002/08/09 22:57:00 easysw Exp $" +// "$Id: file.cxx,v 1.7.2.6.2.8 2003/01/28 20:51:13 easysw Exp $" // // Fluid file routines for the Fast Light Tool Kit (FLTK). // @@ -458,6 +458,12 @@ static void read_children(Fl_Type *p, int paste) { t->name(read_word()); c = read_word(1); + if (strcmp(c,"{") && t->is_class()) { // <prefix> <name> + ((Fl_Class_Type*)t)->prefix(t->name()); + t->name(c); + c = read_word(1); + } + if (strcmp(c,"{")) { read_error("Missing property list for %s\n",t->title()); goto REUSE_C; @@ -631,5 +637,5 @@ void read_fdesign() { } // -// End of "$Id: file.cxx,v 1.7.2.6.2.7 2002/08/09 22:57:00 easysw Exp $". +// End of "$Id: file.cxx,v 1.7.2.6.2.8 2003/01/28 20:51:13 easysw Exp $". // diff --git a/src/Fl_File_Chooser.cxx b/src/Fl_File_Chooser.cxx index 438c36f2d..009717495 100644 --- a/src/Fl_File_Chooser.cxx +++ b/src/Fl_File_Chooser.cxx @@ -1,4 +1,4 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0102 +// generated by Fast Light User Interface Designer (fluid) version 1.0103 #include "../FL/Fl_File_Chooser.H" diff --git a/src/Fl_File_Chooser.fl b/src/Fl_File_Chooser.fl index 8a35d8e6c..05e715f5a 100644 --- a/src/Fl_File_Chooser.fl +++ b/src/Fl_File_Chooser.fl @@ -1,8 +1,8 @@ # data file for the Fltk User Interface Designer (fluid) -version 1.0102 +version 1.0103 header_name {../FL/Fl_File_Chooser.H} code_name {.cxx} -class Fl_File_Chooser {open +class FL_EXPORT Fl_File_Chooser {open selected } { decl {enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 };} {public } @@ -116,7 +116,7 @@ window->hide();} callback {fileName->value(""); fileList->deselect(); Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this); -window->hide();} selected +window->hide();} private xywh {405 345 75 25} code0 {o->label(fl_cancel);} } diff --git a/src/Fl_Help_Dialog.cxx b/src/Fl_Help_Dialog.cxx index 2e58f5b72..773ee67c7 100644 --- a/src/Fl_Help_Dialog.cxx +++ b/src/Fl_Help_Dialog.cxx @@ -1,4 +1,4 @@ -// generated by Fast Light User Interface Designer (fluid) version 1.0101 +// generated by Fast Light User Interface Designer (fluid) version 1.0103 #include "../FL/Fl_Help_Dialog.H" #include "flstring.h" @@ -113,7 +113,15 @@ Fl_Help_Dialog::Fl_Help_Dialog() { o->user_data((void*)(this)); { Fl_Help_View* o = view_ = new Fl_Help_View(10, 10, 510, 330); o->box(FL_DOWN_BOX); + o->color(49); + o->selection_color(49); + o->labeltype(FL_NORMAL_LABEL); + o->labelfont(0); + o->labelsize(14); + o->labelcolor(56); o->callback((Fl_Callback*)cb_view_); + o->align(FL_ALIGN_TOP); + o->when(FL_WHEN_RELEASE); o->end(); Fl_Group::current()->resizable(o); } diff --git a/src/Fl_Help_Dialog.fl b/src/Fl_Help_Dialog.fl index 7308d9e41..b0d0f5551 100644 --- a/src/Fl_Help_Dialog.fl +++ b/src/Fl_Help_Dialog.fl @@ -1,12 +1,12 @@ # data file for the Fltk User Interface Designer (fluid) -version 1.0100 +version 1.0103 header_name {../FL/Fl_Help_Dialog.H} code_name {.cxx} decl {\#include "flstring.h"} {} decl {\#include <FL/fl_ask.H>} {} -class Fl_Help_Dialog {open +class FL_EXPORT Fl_Help_Dialog {open selected } { decl {int index_;} {} decl {int max_;} {} @@ -54,7 +54,7 @@ else if (view_->filename()) } {} Fl_Button {} { label Close - callback {window_->hide();} selected + callback {window_->hide();} private xywh {425 350 95 25} code0 {o->label(fl_close);} } |
