summaryrefslogtreecommitdiff
path: root/fluid/factory.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2009-10-02 19:08:55 +0000
committerMatthias Melcher <fltk@matthiasm.com>2009-10-02 19:08:55 +0000
commit1238d1576b8e2bc15c097b23ebe0fdc4d3cdb527 (patch)
tree47ee6159eb30ae6bb15722ecc91b6ee8b85bb460 /fluid/factory.cxx
parentf1ef3c10477609be6bea13f7e49d137631fa9297 (diff)
Very crude extension of Fluid 1 to read Fluid 2 files (and possibly write them back as Fluid 1 files, but not Fluid 2!). Also, I started a README that points out the differences between FLTK 1 and FLTK 2 and tries to give some help in designing a downward compatible FLTK 3.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6912 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid/factory.cxx')
-rw-r--r--fluid/factory.cxx41
1 files changed, 35 insertions, 6 deletions
diff --git a/fluid/factory.cxx b/fluid/factory.cxx
index 176067a5d..fae67a929 100644
--- a/fluid/factory.cxx
+++ b/fluid/factory.cxx
@@ -77,6 +77,7 @@ strcasecmp(const char *s, const char *t) {
class Fl_Box_Type : public Fl_Widget_Type {
public:
virtual const char *type_name() {return "Fl_Box";}
+ virtual const char *alt_type_name() {return "fltk::Widget";}
Fl_Widget *widget(int x,int y,int w, int h) {
return new Fl_Box(x,y,w,h,"label");}
Fl_Widget_Type *_make() {return new Fl_Box_Type();}
@@ -101,6 +102,7 @@ public:
h = (h / 5) * 5;
}
virtual const char *type_name() {return "Fl_Button";}
+ virtual const char *alt_type_name() {return "fltk::Button";}
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Button(x,y,w,h,"button");}
Fl_Widget_Type *_make() {return new Fl_Button_Type();}
@@ -121,6 +123,7 @@ public:
w += W + 8 - o->labelsize();
}
virtual const char *type_name() {return "Fl_Return_Button";}
+ virtual const char *alt_type_name() {return "fltk::ReturnButton";}
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Return_Button(x,y,w,h,"button");}
Fl_Widget_Type *_make() {return new Fl_Return_Button_Type();}
@@ -134,6 +137,7 @@ static Fl_Return_Button_Type Fl_Return_Button_type;
class Fl_Repeat_Button_Type : public Fl_Widget_Type {
public:
virtual const char *type_name() {return "Fl_Repeat_Button";}
+ virtual const char *alt_type_name() {return "fltk::RepeatButton";}
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Repeat_Button(x,y,w,h,"button");}
Fl_Widget_Type *_make() {return new Fl_Repeat_Button_Type();}
@@ -151,6 +155,7 @@ public:
w += 4;
}
virtual const char *type_name() {return "Fl_Light_Button";}
+ virtual const char *alt_type_name() {return "fltk::LightButton";}
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Light_Button(x,y,w,h,"button");}
Fl_Widget_Type *_make() {return new Fl_Light_Button_Type();}
@@ -168,6 +173,7 @@ public:
w += 4;
}
virtual const char *type_name() {return "Fl_Check_Button";}
+ virtual const char *alt_type_name() {return "fltk::CheckButton";}
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Check_Button(x,y,w,h,"button");}
Fl_Widget_Type *_make() {return new Fl_Check_Button_Type();}
@@ -185,6 +191,7 @@ public:
w += 4;
}
virtual const char *type_name() {return "Fl_Round_Button";}
+ virtual const char *alt_type_name() {return "fltk::RadioButton";}
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Round_Button(x,y,w,h,"button");}
Fl_Widget_Type *_make() {return new Fl_Round_Button_Type();}
@@ -223,6 +230,7 @@ public:
if (w < 50) w = 50;
}
virtual const char *type_name() {return "Fl_Browser";}
+ virtual const char *alt_type_name() {return "fltk::Browser";}
Fl_Widget *widget(int x,int y,int w,int h) {
Fl_Browser* b = new Fl_Browser(x,y,w,h);
// Fl_Browser::add calls fl_height(), which requires the X display open.
@@ -270,6 +278,7 @@ public:
if (w < 50) w = 50;
}
virtual const char *type_name() {return "Fl_Check_Browser";}
+ virtual const char *alt_type_name() {return "fltk::CheckBrowser";}
Fl_Widget *widget(int x,int y,int w,int h) {
Fl_Check_Browser* b = new Fl_Check_Browser(x,y,w,h);
// Fl_Check_Browser::add calls fl_height(), which requires the X display open.
@@ -317,6 +326,7 @@ public:
if (w < 50) w = 50;
}
virtual const char *type_name() {return "Fl_File_Browser";}
+ virtual const char *alt_type_name() {return "fltk::FileBrowser";}
Fl_Widget *widget(int x,int y,int w,int h) {
Fl_File_Browser* b = new Fl_File_Browser(x,y,w,h);
// Fl_File_Browser::add calls fl_height(), which requires the X display open.
@@ -357,6 +367,7 @@ class Fl_Counter_Type : public Fl_Widget_Type {
int pixmapID() { return 41; }
public:
virtual const char *type_name() {return "Fl_Counter";}
+ virtual const char *alt_type_name() {return "fltk::Counter";}
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Counter(x,y,w,h,"counter:");}
Fl_Widget_Type *_make() {return new Fl_Counter_Type();}
@@ -398,6 +409,7 @@ public:
if (w < 40) w = 40 ;
}
virtual const char *type_name() {return "Fl_Spinner";}
+ virtual const char *alt_type_name() {return "fltk::Spinner";}
int is_spinner() const { return 1; }
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Spinner(x,y,w,h,"spinner:");}
@@ -442,6 +454,7 @@ public:
if (w < 15) w = 15;
}
virtual const char *type_name() {return "Fl_Input";}
+ virtual const char *alt_type_name() {return "fltk::Input";}
int is_input() const {return 1;}
Fl_Widget *widget(int x,int y,int w,int h) {
Fl_Input *myo = new Fl_Input(x,y,w,h,"input:");
@@ -491,6 +504,7 @@ public:
if (w < 50) w = 50;
}
virtual const char *type_name() {return "Fl_File_Input";}
+ virtual const char *alt_type_name() {return "fltk::FileInput";}
int is_input() const {return 1;}
Fl_Widget *widget(int x,int y,int w,int h) {
Fl_File_Input *myo = new Fl_File_Input(x,y,w,h,"file:");
@@ -533,6 +547,7 @@ public:
if (w < 50) w = 50;
}
virtual const char *type_name() {return "Fl_Text_Display";}
+ virtual const char *alt_type_name() {return "fltk::TextDisplay";}
int is_text_display() const {return 1;}
Fl_Widget *widget(int x,int y,int w,int h) {
Fl_Text_Display *myo = new Fl_Text_Display(x,y,w,h);
@@ -574,6 +589,7 @@ public:
if (w < 50) w = 50;
}
virtual const char *type_name() {return "Fl_Text_Editor";}
+ virtual const char *alt_type_name() {return "fltk::TextEditor";}
int is_text_display() const {return 1;}
Fl_Widget *widget(int x,int y,int w,int h) {
Fl_Text_Editor *myo = new Fl_Text_Editor(x,y,w,h);
@@ -602,6 +618,7 @@ int Fl_Text_Editor_Type::textstuff(int w, Fl_Font& f, int& s, Fl_Color& c) {
class Fl_Clock_Type : public Fl_Widget_Type {
public:
virtual const char *type_name() {return "Fl_Clock";}
+ virtual const char *alt_type_name() {return "fltk::Clock";}
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Clock(x,y,w,h);}
Fl_Widget_Type *_make() {return new Fl_Clock_Type();}
@@ -627,6 +644,7 @@ public:
if (w < 50) w = 50;
}
virtual const char *type_name() {return "Fl_Help_View";}
+ virtual const char *alt_type_name() {return "fltk::HelpView";}
Fl_Widget *widget(int x,int y,int w,int h) {
Fl_Help_View *myo = new Fl_Help_View(x,y,w,h);
if (!compile_only) {
@@ -645,6 +663,7 @@ static Fl_Help_View_Type Fl_Help_View_type;
class Fl_Progress_Type : public Fl_Widget_Type {
public:
virtual const char *type_name() {return "Fl_Progress";}
+ virtual const char *alt_type_name() {return "fltk::ProgressBar";}
Fl_Widget *widget(int x,int y,int w,int h) {
Fl_Progress *myo = new Fl_Progress(x,y,w,h,"label");
myo->value(50);
@@ -661,6 +680,7 @@ class Fl_Adjuster_Type : public Fl_Widget_Type {
int is_valuator() const {return 1;}
public:
virtual const char *type_name() {return "Fl_Adjuster";}
+ virtual const char *alt_type_name() {return "fltk::Adjuster";}
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Adjuster(x,y,w,h);}
Fl_Widget_Type *_make() {return new Fl_Adjuster_Type();}
@@ -681,6 +701,7 @@ class Fl_Dial_Type : public Fl_Widget_Type {
int is_valuator() const {return 1;}
public:
virtual const char *type_name() {return "Fl_Dial";}
+ virtual const char *alt_type_name() {return "fltk::Dial";}
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Dial(x,y,w,h);}
Fl_Widget_Type *_make() {return new Fl_Dial_Type();}
@@ -700,6 +721,7 @@ class Fl_Roller_Type : public Fl_Widget_Type {
int is_valuator() const {return 1;}
public:
virtual const char *type_name() {return "Fl_Roller";}
+ virtual const char *alt_type_name() {return "fltk::Roller";}
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Roller(x,y,w,h);}
Fl_Widget_Type *_make() {return new Fl_Roller_Type();}
@@ -723,6 +745,7 @@ class Fl_Slider_Type : public Fl_Widget_Type {
int is_valuator() const {return 2;}
public:
virtual const char *type_name() {return "Fl_Slider";}
+ virtual const char *alt_type_name() {return "fltk::Slider";}
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Slider(x,y,w,h,"slider:");}
Fl_Widget_Type *_make() {return new Fl_Slider_Type();}
@@ -739,6 +762,7 @@ class Fl_Scrollbar_Type : public Fl_Slider_Type {
int is_valuator() const {return 3;}
public:
virtual const char *type_name() {return "Fl_Scrollbar";}
+ virtual const char *alt_type_name() {return "fltk::Scrollbar";}
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Scrollbar(x,y,w,h);}
Fl_Widget_Type *_make() {return new Fl_Scrollbar_Type();}
@@ -767,6 +791,7 @@ public:
if (w < 15) w = 15;
}
virtual const char *type_name() {return "Fl_Output";}
+ virtual const char *alt_type_name() {return "fltk::Output";}
Fl_Widget *widget(int x,int y,int w,int h) {
Fl_Output *myo = new Fl_Output(x,y,w,h,"output:");
myo->value("Text Output");
@@ -793,6 +818,7 @@ public:
if (w < 15) w = 15;
}
virtual const char *type_name() {return "Fl_Value_Input";}
+ virtual const char *alt_type_name() {return "fltk::ValueInput";}
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
int is_valuator() const {return 1;}
int is_value_input() const {return 1;}
@@ -833,6 +859,7 @@ public:
if (w < 15) w = 15;
}
virtual const char *type_name() {return "Fl_Value_Output";}
+ virtual const char *alt_type_name() {return "fltk::ValueOutput";}
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
int is_valuator() const {return 1;}
Fl_Widget *widget(int x,int y,int w,int h) {
@@ -863,6 +890,7 @@ class Fl_Value_Slider_Type : public Fl_Slider_Type {
int textstuff(int w, Fl_Font& f, int& s, Fl_Color& c);
public:
virtual const char *type_name() {return "Fl_Value_Slider";}
+ virtual const char *alt_type_name() {return "fltk::ValueSlider";}
Fl_Widget *widget(int x,int y,int w,int h) {
return new Fl_Value_Slider(x,y,w,h,"slider:");}
Fl_Widget_Type *_make() {return new Fl_Value_Slider_Type();}
@@ -1046,12 +1074,12 @@ void fill_in_New_Menu() {
if (m->user_data()) {
Fl_Type *t = (Fl_Type*)m->user_data();
if (m->text) {
- make_iconlabel( m, pixmap[t->pixmapID()], m->label() );
- }
- else {
- const char *n = t->type_name();
- if (!strncmp(n,"Fl_",3)) n += 3;
- make_iconlabel( m, pixmap[t->pixmapID()], n );
+ make_iconlabel( m, pixmap[t->pixmapID()], m->label() );
+ } else {
+ const char *n = t->type_name();
+ if (!strncmp(n,"Fl_",3)) n += 3;
+ if (!strncmp(n,"fltk::",6)) n += 6;
+ make_iconlabel( m, pixmap[t->pixmapID()], n );
}
}
}
@@ -1067,6 +1095,7 @@ Fl_Type *Fl_Type_make(const char *tn) {
if (!m->user_data()) continue;
Fl_Type *t = (Fl_Type*)(m->user_data());
if (!strcasecmp(tn,t->type_name())) {r = t->make(); break;}
+ if (!strcasecmp(tn,t->alt_type_name())) {r = t->make(); break;}
}
reading_file = 0;
return r;