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
This commit is contained in:
Matthias Melcher 2009-10-02 19:08:55 +00:00
parent f1ef3c1047
commit 1238d1576b
6 changed files with 760 additions and 16 deletions

View File

@ -148,7 +148,7 @@ protected:
INVISIBLE = 1<<1, ///< the widget is not drawn but can receive events
OUTPUT = 1<<2, ///< for output only
NOBORDER = 1<<3, ///< don't draw a decoration (Fl_Window)
FORCE_POSITION = 1<<4, ///< don't let the window manager position thi window (Fl_Window)
FORCE_POSITION = 1<<4, ///< don't let the window manager position the window (Fl_Window)
NON_MODAL = 1<<5, ///< thisis a hovering toolbar window (Fl_Window)
SHORTCUT_LABEL = 1<<6, ///< the label contains a shortcut we need to draw
CHANGED = 1<<7, ///< the widget value changed
@ -160,6 +160,7 @@ protected:
TOOLTIP_WINDOW = 1<<13, ///< a temporary popup, transparent to events, and dismissed easily (Fl_Window)
MODAL = 1<<14, ///< a window blocking input to all other winows (Fl_Window)
NO_OVERLAY = 1<<15, ///< window not using a hardware overlay plane (Fl_Menu_Window)
GROUP_RELATIVE = 1<<16, ///< position this idget relative to the parent group, not to the window
// (space for more flags)
USERFLAG3 = 1<<29, ///< reserved for 3rd party extensions
USERFLAG2 = 1<<30, ///< reserved for 3rd party extensions

686
README.123 Normal file
View File

@ -0,0 +1,686 @@
R E A D M E . 1 2 3
=====================
This file listst the differences between FLTK 1 and FLTK 2 with annotations
for a possible implementation of FLTK 3. The all new and improved FLTK 3
needs to be compatible with 1 and 2. It must have a moder API, plenty of
widgets, lots of options, customization at run-time, but still be easily
portable, fast, and of course light.
FLTK 1 has become a nice starting point for the first steps in GUI
programming. It runs on al major platform (and on many minor ones
as well), is small, compact, and easy to use. FLTK 2 was the
attempt to continue the success of FLTK 1 with a much cleaber API
and many important details improved. Unfortunately many users never
made the jump to FLTK 2 and so it not only ended in a crawling slow
branch, it also became instable and at last unmaintainable.
FLTK 3 sets out to surprise FLTK 1 users and satisfy FLTK 2 junkies.
It will basically be the improved FLTK 2 API combined with the quite
stable innards of FLTK 1. As an extra bonus, FLTK 3 will be compatible
to 1 and 2. Just prepend your code with the "coding_style" instruction
and FLTK 3 will do the rest. It is even possible to intermix F1 and
F2 coding styles at any place.
Nice challange, eh? So let's get going:
The Big Differences
---------------------
FLTK 2 is based on FLTK 1 in many ways, and while the FLTK 1 API was based
on the Forms Library, FLTK 2 is Bill's take on how FLTK 1 should have been.
This chapter outlines the biggest differences between version.
(1) Coordinate System: FLTK 1 child coordinates are always relative to the
window, not as most would expect to the parent. FLTK 2 does the logical
thing and uses group-relative origins. This is somewhat difficult to port
if we want to stay downward compatible. Fl_Widget will need an additional
flag indicating absolute or relative coordinates.
(2) Pulldown Menus: The developers of the Forms Library did not implement
the idea of hierarchies all the way through. Pulldown menus, which are
hierarchical by nature, were instead implemented as a list with lots of
tricks and cludges to make them usable. FLTK 2 went half way by using the
existing Windget/Group relation to create menus, however, menu items are
still specialized widgets. For FLTK 3, I would like to allow any widget
inside a pulldown menu.
(3) Browsers and Tree Views: Browsers in FLTK1 are implemented even worse
than Pulldown Menus. FLTK 2 solved the issues in a similar way, and here
again, I prefer the FLTK 2 way very mch, but also would like to extend
functionality to allow arbitrary widgets as list items. A Tree-like
widget comes free with the FLTK 2 concept. FLTK 1 has no such thing and
even Fluid had to hack the library badly to generate a tree view.
(4) Namespaces: this is a minr issue that I include for completeness. FLTK 2
introduces the ftk namespace, renaming all widgets. FLTK 3 will use the
FLTK 2 naming scheme and map FLTK 1 class names using typedefs. This is, as
most things in programming are, a compromise. The "coding_style" function
must be used to switch between FLTK 1 and FLTK 2 code. No worries though,
it's easy and straight forward.
(5) Layout: FLTK 1 uses a top-down approach for widget layout in which the
parent widget decides about the childs size "resize(x, y, w, h)". In FLTK 2
any widget can call "layout()" which will query children for their preffered
size and propagate the information up. This is a great concept that FLTK 3
should adapt, plus it is compatible.
(6) Ractangle: FLTK 2's base class is fltk::Rectangle. This is nice and
easy to implement. The API is pretty much the same in both versions.
(7) Styles: FLTK 2 uses a minimal number of styles to define the basic
(and often repeated) parameters of every widget. API's are similar though,
so this is luckily another pretty straight-forward upgrade.
Comparison Chart by Class
---------------------------
This chart contains a list of all classes in FLTK 1 and 2, how they
correspond, and how they could be implemented in FLTK 3.
1: class Fl
2: namespace fltk
*: this is a pretty straight-forward mapping of functions. The actual work
lies in finding and listing all global functions and adapting those.
1: class Fl_Adjuster
2: class Adjuster
*: should map easily
1:
2: class AlignGroup
*: undocumented in FLTK 2. Minimal code. Can be transfered easily.
1:
2: class AnsiWidget
*: There is no equvalet in FLTK 1, but the widget may be easily ported.
1:
2: class AssociationFunctor
*: Associations are a new and rarly used concept in FLTK 2. We need to
decide if these should be moved into FLTK 3
1:
2: class AssociationType
*: Associations are a new and rarly used concept in FLTK 2. We need to
decide if these should be moved into FLTK 3
1:
2: class BarGroup
*: undocumented in FLTK 2. Minimal code. Can be transfered easily.
1: class Fl_BMP_Image
2: class bmpImage
*: should map easily
1: class Fl_Bitmap
2:
1: class Fl_Box
2: class Widget
*: This actually maps pretty much exactly to fltk::Widget. FLTK 2 provides
a bunch of other box-like classes which have some predefined properties,
however this is the best match for FLTK 1. fltk::InvisibleBox can be used
as well.
1: class Fl_Browser
2: class Browser
1: class Fl_Browser_
2:
1: class Fl_Button
2: class Button
*: should map easily
1: class Fl_Cairo_State
2:
1: class Fl_Cairo_Window
2:
1: class Fl_Chart
2:
1: class Fl_Check_Browser
2:
1: class Fl_Check_Button
2: class CheckButton
*: should map easily
1: class Fl_Choice
2: class Choice
*: should map easily
1: class Fl_Clock
2: class Clock
*: should map easily
1: class Fl_Clock_Output
2: class ClockOutput
*: should map easily
1: class Fl_Color_Chooser
2: class ColorChooser
*: should map easily
1:
2: class ComboBrowser
1:
2: class ComboWindow
1:
2: class CycleButton
1: class Fl_Counter
2:
1: class Fl_Dial
2: class Dial
*: should map easily
1:
2: class Divider
1: class Fl_Double_Window
2: class DoubleBufferWindow
*: should map easily
1: class Fl_End
2:
1:
2: class EngravedLabel
1: class Fl_File_Browser
2: class FileBrowser
*: should map easily
1: class Fl_File_Chooser
2: class FileChooser
*: should map easily
1: class Fl_File_Icon
2: class FileIcon
*: should map easily
1: class Fl_File_Input
2: class FileInput
*: should map easily
1: class Fl_Fill_Dial
2: class FillDial
*: should map easily
1: class Fl_Fill_Slider
2: class FillSlider
*: should map easily
1:
2: class FlatBox
1: class Fl_Float_Input
2: class FloatInput
*: should map easily
1: class Fl_FormsBitmap
2:
1: class Fl_FormsPixmap
2:
1: class Fl_FormsText
2: class Fl_FormsText
*: should map easily
1:
2: class FrameBox
1: class Fl_Free
2:
1: class Fl_GIF_Image
2: class gifImage
*: should map easily
1: class Fl_Gl_Choice
2: class GlChoice
*: should map easily
1: class Fl_Gl_Window
2: class GlWindow
*: should map easily
1:
2: class GlOverlay
1: class Fl_Glut_Window
2: class GlutWindow
1: class Fl_Group
2: class Group
*: should map easily, must manage coordinate systems
1:
2: class GSave
1:
2: class Guard
1: class Fl_Help_Dialog
2: class HelpDialog
*: should map easily
1: class Fl_Help_View
2: class HelpView
*: should map easily
1:
2: class HighlightBox
1:
2: class HighlightButton
1: class Fl_Hold_Browser
2:
1: class Fl_Hor_Fill_Slider
2:
1: class Fl_Hor_Nice_Slider
2:
1: class Fl_Hor_Slider
2:
1: class Fl_Hor_Value_Slider
2:
1: class Fl_Image
2: class Image
*: should map easily
1: class Fl_Input
2: class Input
*: should map easily
1: class Fl_Input_
2:
1:
2: class InputBrowser
1: class Fl_Input_Choice
2: class ComboBox
*: should map easily
1: class Fl_Int_Input
2: class IntInput
*: should map easily
1:
2: class InvisibleBox
1:
2: class Item
1:
2: class ItemGroup
1: class Fl_JPEG_Image
2: class jpegImage
*: should map easily
1:
2: class LabelType
1: class Fl_Light_Button
2: class LightButton
*: should map easily
1: class Fl_Line_Dial
2: class LineDial
*: should map easily
1:
2: class List
1: class Fl_Menu_
2: class Menu
1: class Fl_Menu_Bar
2: class MenuBar
1: class Fl_Menu_Button
2: class PopupMenu
1:
2: class MenuSection
1: class Fl_Menu_Window
2: class MenuWindow
1:
2: class Monitor
1: class Fl_Multi_Browser
2: class MultiBrowser
1:
2: class MultiImage
1: class Fl_Multiline_Input
2: class MultiLineInput
*: should map easily
1: class Fl_Multiline_Output
2: class MultiLineOutput
*: should map easily
1:
2: class Mutex
1: class Fl_Nice_Slider
2:
1:
2: class NumericInput
1: class Fl_Output
2: class Output
*: should map easily
1: class Fl_Overlay_Window
2:
1: class Fl_PNG_Image
2: class pngImage
*: should map easily
1: class Fl_PNM_Image
2: class pnmImage
*: should map easily
1: class Fl_Pack
2: class PackedGroup
*: should map easily, FLTK 2 has soem additional functionaity
1: class Fl_Pixmap
2:
1: class Fl_Positioner
2:
1: class Fl_Preferences
2: class Preferences
*: should map easily
1: class Fl_Progress
2: class ProgressBar
*: should map easily
1: class Fl_RGB_Image
2: class rgbImage
*: should map easily
1: class Fl_Radio_Button
2: class RadioButton
*: should map easily
1:
2: class RadioItem
1: class Fl_Radio_Light_Button
2: class RadioLightButton
*: should map easily
1: class Fl_Radio_Round_Button
2:
1:
2: class Rectangle
1:
2: class RecursiveMutex
1: class Fl_Repeat_Button
2: class RepeatButton
*: should map easily
1: class Fl_Return_Button
2: class ReturnButton
*: should map easily
1: class Fl_Roller
2: class ThumbWheel
*: should map easily
1: class Fl_Round_Button
2:
1: class Fl_Round_Clock
2:
1: class Fl_Scroll
2: class ScrollGroup
*: should map easily
1: class Fl_Scrollbar
2: class Scrollbar
*: should map easily
1: class Fl_Secret_Input
2: class SecretInput
*: should map easily
1: class Fl_Select_Browser
2:
1:
2: class ShapedWindow
1: class Fl_Shared_Image
2: class SharedImage
*: should map easily
1:
2: class ShortcutFunctor
1: class Fl_Simple_Counter
2:
1: class Fl_Single_Window
2:
1:
2: class SignalMutex
1: class Fl_Slider
2: class Slider
*: should map easily
1: class Fl_Spinner
2:
1:
2: class StatusBarGroup
1:
2: class StringArray
1:
2: class StringHierarchy
1:
2: class StringList
1:
2: class Style
1:
2: class StyleSet
1:
2: class Symbol
1: class Fl_Sys_Menu_Bar
2: class SystemMenuBar
*: should map easily
1: class Fl_Tabs
2: class TabGroup
*: should map easily
1:
2: class TabGroupPager
1: class Fl_Text_Buffer
2: class TextBuffer
*: should map easily
1: class Fl_Text_Display
2: class TextDisplay
*: should map easily
1: class Fl_Text_Editor
2: class TextEditor
*: should map easily
1: class Fl_Text_Selection
2: class TextSelection
*: should map easily
1: class Fl_Tile
2: class TiledGroup
*: should map easily
1: class Fl_Tiled_Image
2: class TiledImage
*: should map easily
1: class Fl_Timer
2:
1: class Fl_Toggle_Button
2: class ToggleButton
*: should map easily
1:
2: class ToggleItem
1: class Fl_Tooltip
2: class Tooltip
*: should map easily
1:
2: class WordwrapInput
1:
2: class WordwrapOutput
1: class Fl_Valuator
2: class Valuator
*: should map easily
1: class Fl_Value_Input
2: class ValueInput
*: should map easily
1: class Fl_Value_Output
2: class ValueOutput
*: should map easily
1: class Fl_Value_Slider
2: class ValueSlider
*: should map easily
1: class Fl_Widget
2: class Widget
*: should map easily for the most part
1: class Fl_Widget_Tracker
2:
1: class Fl_Window
2: class Window
*: should map easily
1: class Fl_Wizard
2: class WizardGroup
*: should map easily
1: class Fl_X
2: class CreatedWindow
*: should map easily
1: class Fl_XBM_Image
2: class xbmImage
*: should map easily
1: class Fl_XPM_Image
2: class xpmImage
*: should map easily
1:
2: class xpmFileImage
1:
2: struct Cursor
1:
2: struct Font
1: struct Fl_Glut_Bitmap_Font
2:
1: struct Fl_Glut_StrokeChar
2:
1: struct Fl_Glut_StrokeFont
2:
1: struct Fl_Glut_StrokeStrip
2:
1: struct Fl_Glut_StrokeVertex
2:
1: struct Fl_Help_Block
2: struct HelpBlock
*: should map easily
1: struct Fl_Help_Font_Stack
2:
1: struct Fl_Help_Font_Style
2:
1: struct Fl_Help_Link
2: struct HelpLink
*: should map easily
1: struct Fl_Help_Target
2: struct HelpTarget
*: should map easily
1:
2: struct ImageType
1: struct Fl_Label
2:
1: struct Fl_Menu_Item
2:
1: struct Fl_Multi_Label
2:
1:
2: struct NamedStyle

View File

@ -92,6 +92,7 @@ public:
virtual const char *title(); // string for browser
virtual const char *type_name() = 0; // type for code output
virtual const char *alt_type_name() { return type_name(); } // alternate type for FLTK2 code output
const char *name() const {return name_;}
void name(const char *);
@ -393,6 +394,7 @@ public:
class Fl_Group_Type : public Fl_Widget_Type {
public:
virtual const char *type_name() {return "Fl_Group";}
virtual const char *alt_type_name() {return "fltk::Group";}
Fl_Widget *widget(int X,int Y,int W,int H) {
igroup *g = new igroup(X,Y,W,H); Fl_Group::current(0); return g;}
Fl_Widget_Type *_make() {return new Fl_Group_Type();}
@ -418,6 +420,7 @@ class Fl_Pack_Type : public Fl_Group_Type {
Fl_Menu_Item *subtypes() {return pack_type_menu;}
public:
virtual const char *type_name() {return pack_type_name;}
virtual const char *alt_type_name() {return "fltk::PackedGroup";}
Fl_Widget_Type *_make() {return new Fl_Pack_Type();}
int pixmapID() { return 22; }
void copy_properties();
@ -433,6 +436,7 @@ public:
y = fl_height() + o->labelsize() - 6;
}
virtual const char *type_name() {return tabs_type_name;}
virtual const char *alt_type_name() {return "fltk::TabGroup";}
Fl_Widget *widget(int X,int Y,int W,int H) {
itabs *g = new itabs(X,Y,W,H); Fl_Group::current(0); return g;}
Fl_Widget_Type *_make() {return new Fl_Tabs_Type();}
@ -450,6 +454,7 @@ class Fl_Scroll_Type : public Fl_Group_Type {
Fl_Menu_Item *subtypes() {return scroll_type_menu;}
public:
virtual const char *type_name() {return scroll_type_name;}
virtual const char *alt_type_name() {return "fltk::ScrollGroup";}
Fl_Widget_Type *_make() {return new Fl_Scroll_Type();}
int pixmapID() { return 19; }
Fl_Widget *enter_live_mode(int top=0);
@ -461,6 +466,7 @@ extern const char tile_type_name[];
class Fl_Tile_Type : public Fl_Group_Type {
public:
virtual const char *type_name() {return tile_type_name;}
virtual const char *alt_type_name() {return "fltk::TileGroup";}
Fl_Widget_Type *_make() {return new Fl_Tile_Type();}
int pixmapID() { return 20; }
void copy_properties();
@ -471,6 +477,7 @@ extern const char wizard_type_name[];
class Fl_Wizard_Type : public Fl_Group_Type {
public:
virtual const char *type_name() {return wizard_type_name;}
virtual const char *alt_type_name() {return "fltk::WizardGroup";}
Fl_Widget *widget(int X,int Y,int W,int H) {
iwizard *g = new iwizard(X,Y,W,H); Fl_Group::current(0); return g;}
Fl_Widget_Type *_make() {return new Fl_Wizard_Type();}
@ -513,6 +520,7 @@ public:
Fl_Type *make();
virtual const char *type_name() {return "Fl_Window";}
virtual const char *alt_type_name() {return "fltk::Window";}
void open();
@ -569,6 +577,7 @@ class Fl_Menu_Item_Type : public Fl_Widget_Type {
public:
Fl_Menu_Item* subtypes() {return menu_item_type_menu;}
const char* type_name() {return "MenuItem";}
const char* alt_type_name() {return "fltk::Item";}
Fl_Type* make();
int is_menu_item() const {return 1;}
int is_button() const {return 1;} // this gets shortcut to work
@ -587,6 +596,7 @@ class Fl_Submenu_Type : public Fl_Menu_Item_Type {
public:
Fl_Menu_Item* subtypes() {return 0;}
const char* type_name() {return "Submenu";}
const char* alt_type_name() {return "fltk::ItemGroup";}
int is_parent() const {return 1;}
int is_button() const {return 0;} // disable shortcut
Fl_Type* make();
@ -643,6 +653,7 @@ public:
if (w < (15 + h)) w = 15 + h;
}
virtual const char *type_name() {return "Fl_Menu_Button";}
virtual const char *alt_type_name() {return "fltk::MenuButton";}
Fl_Widget *widget(int X,int Y,int W,int H) {
return new Fl_Menu_Button(X,Y,W,H,"menu");}
Fl_Widget_Type *_make() {return new Fl_Menu_Button_Type();}
@ -666,6 +677,7 @@ public:
if (w < (15 + h)) w = 15 + h;
}
virtual const char *type_name() {return "Fl_Choice";}
virtual const char *alt_type_name() {return "fltk::Choice";}
Fl_Widget *widget(int X,int Y,int W,int H) {
Fl_Choice *myo = new Fl_Choice(X,Y,W,H,"choice:");
myo->menu(dummymenu);
@ -700,6 +712,7 @@ public:
if (w < (15 + h)) w = 15 + h;
}
virtual const char *type_name() {return "Fl_Input_Choice";}
virtual const char *alt_type_name() {return "fltk::ComboBox";}
virtual Fl_Type* click_test(int,int);
Fl_Widget *widget(int X,int Y,int W,int H) {
Fl_Input_Choice *myo = new Fl_Input_Choice(X,Y,W,H,"input choice:");
@ -723,6 +736,7 @@ public:
if (h < 15) h = 15;
}
virtual const char *type_name() {return "Fl_Menu_Bar";}
virtual const char *alt_type_name() {return "fltk::MenuBar";}
Fl_Widget *widget(int X,int Y,int W,int H) {return new Fl_Menu_Bar(X,Y,W,H);}
Fl_Widget_Type *_make() {return new Fl_Menu_Bar_Type();}
int pixmapID() { return 17; }

View File

@ -2431,7 +2431,7 @@ void Fl_Widget_Type::write_properties() {
}
int pasteoffset;
extern double read_version;
void Fl_Widget_Type::read_property(const char *c) {
int x,y,w,h; Fl_Font f; int s; Fl_Color cc;
if (!strcmp(c,"private")) {
@ -2442,6 +2442,11 @@ void Fl_Widget_Type::read_property(const char *c) {
if (sscanf(read_word(),"%d %d %d %d",&x,&y,&w,&h) == 4) {
x += pasteoffset;
y += pasteoffset;
// FIXME temporary change!
if (read_version>=2.0 && o->parent() && o->parent()!=o->window()) {
x += o->parent()->x();
y += o->parent()->y();
}
o->resize(x,y,w,h);
}
} else if (!strcmp(c,"tooltip")) {
@ -2483,12 +2488,18 @@ void Fl_Widget_Type::read_property(const char *c) {
const char* value = read_word();
((Fl_Button*)o)->value(atoi(value));
} else if (!strcmp(c,"color")) {
int n = sscanf(read_word(),"%d %d",&x,&y);
if (n == 2) { // back compatibility...
if (x != 47) o->color(x);
o->selection_color(y);
} else {
const char *cw = read_word();
if (cw[0]=='0' && cw[1]=='x') {
sscanf(cw,"0x%x",&x);
o->color(x);
} else {
int n = sscanf(cw,"%d %d",&x,&y);
if (n == 2) { // back compatibility...
if (x != 47) o->color(x);
o->selection_color(y);
} else {
o->color(x);
}
}
} else if (!strcmp(c,"selection_color")) {
if (sscanf(read_word(),"%d",&x)) o->selection_color(x);
@ -2553,9 +2564,12 @@ void Fl_Widget_Type::read_property(const char *c) {
if (!strncmp(c,"code",4)) {
int n = atoi(c+4);
if (n >= 0 && n <= NUM_EXTRA_CODE) {
extra_code(n,read_word());
return;
extra_code(n,read_word());
return;
}
} else if (!strcmp(c,"extra_code")) {
extra_code(0,read_word());
return;
}
Fl_Type::read_property(c);
}

View File

@ -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;

View File

@ -389,7 +389,7 @@ static void read_children(Fl_Type *p, int paste) {
c = read_word();
read_version = strtod(c,0);
if (read_version<=0 || read_version>FL_VERSION)
read_error("unknown version '%s'",c);
read_error("unknown version '%s'",c);
continue;
}