From b983b285cc4f0627a1f72c9d6c510047af0ad116 Mon Sep 17 00:00:00 2001
From: Michael R Sweet FLUID edits and saves its state in ".fl" files. These files are
+ FLUID edits and saves its state in .fl files. These files are
text, and you can (with care) edit them in a text editor, perhaps to
get some special effects. FLUID can "compile" the .fl file into a .cxx and a .h file. The
-.cxx file defines all the objects from the .fl file and the .h file
+ FLUID can "compile" the .fl file into a .cxx and a .h file. The
+.cxx file defines all the objects from the .fl file and the .h file
declares all the global ones. A simple program can be made by putting all your code (including a
-main() function) into the .fl file and thus making the .cxx file a
+main() function) into the .fl file and thus making the .cxx file a
single source file to compile. Most programs are more complex than
-this, so you write other .cxx files that call the FLUID functions.
- These .cxx files must #include the .h file or they can
-#include the .cxx file so it still appears to be a single source
+this, so you write other .cxx files that call the FLUID functions.
+ These .cxx files must #include the .h file or they can
+#include the .cxx file so it still appears to be a single source
file.
What is FLUID?
- The Fast Light User Interface Designer, or "FLUID", is a graphical
+ The Fast Light User Interface Designer, or FLUID, is a graphical
editor that is used to produce FLTK source code.
-
Normally the FLUID file defines one or more "functions", which -output C++ functions. Each function defines a one or more FLTK +
Normally the FLUID file defines one or more functions or classes which +output C++ code. Each function defines a one or more FLTK windows, and all the widgets that go inside those windows.
Widgets created by FLUID are either "named", "complex named" or "unnamed". A named widget has a legal C++ variable identifier as its name (i.e. only alphanumeric and underscore). In this case FLUID defines a global variable or class member that will point at the widget -after the function defining it is called. A "complex named" object has +after the function defining it is called. A complex named object has punctuation such as '.' or '->' or any other symbols in its name. In this case FLUID assigns a pointer to the widget to the name, but does not attempt to declare it. This can be used to get the widgets into -structures. An "unnamed" widget has a blank name and no pointer to -them is stored.
+structures. An unnamed widget has a blank name and no pointer is stored.Widgets may either call a named callback function that you write in another source file, or you can supply a small piece of C++ source and -FLUID will write a private callback function into the .cxx file.
+FLUID will write a private callback function into the .cxx file. ++fluid filename.fl &+ +to edit the .fl file filename.fl. If the file does not exist +you will get an error pop-up, but if you dismiss it you will be editing +a blank file of that name. You can run FLUID without any name, in +which case you will be editing an unnamed blank setup (but you can use +save-as to write it to a file). +
You can provide any of the standard FLTK switches before the filename:
++-display host:n.n +-geometry WxH+X+Y +-title windowtitle +-name classname +-iconic +-fg color +-bg color +-bg2 color ++ + Changing the colors may be useful to see what your interface will look +at if the user calls it with the same switches. +
In the current version, if you don't go into the background (with +'&' then you will be able to abort FLUID by typing ^C on the terminal. It +will exit immediately, losing any changes.
+-fluid filename.fl- - to edit the .fl file filename.fl. If the file does not exist -you will get an error pop-up, but if you dismiss it you will be editing -a blank file of that name. You can run FLUID without any name, in -which case you will be editing an unnamed blank setup (but you can use -save-as to write it to a file). -
You can provide any of the standard FLTK switches before the name:
---display host:n.n --geometry WxH+X+Y --title windowtitle --name classname --iconic --fg color --bg color --bg2 color -- - Changing the colors may be useful to see what your interface will look -at if the user calls it with the same switches. -
In the current version, if you don't go into the background (with -'then you will be able to abort FLUID by typing ^C on the terminal. It -will exit immediately, losing any changes.
-- FLUID -c filename.fl -- - This will read the .fl file and write filename.cxx and +.cxx and .h file from a .fl file. To do this type: +
+FLUID -c filename.fl ++This will read the filename.fl file and write filename.cxx and filename.h. The directory will be stripped, so they are written to the current directory always. If there are any errors reading or writing the files it will print the error and exit with a non-zero -code. In a makefile you can use a line like this: work: +code. In a makefile you can use a line like this:
my_panels.h my_panels.cxx: my_panels.fl fluid -c my_panels.fl- Some versions of make will accept rules like this to allow all .fl + Some versions of make will accept rules like this to allow all .fl files found to be compiled:
@@ -149,84 +146,86 @@ files found to be compiled:The Widget Browser
| The main window shows a menu bar and a scrolling browser of all
-the defined widgets. The name of the .fl file being edited is shown in
+the defined widgets. The name of the .fl file being edited is shown in
the window title.
The widgets are stored in a hierarchy. You can open and close a -level by clicking the "triangle" at the left of a widget. This widget -is the parent, and all the widgets listed below it are its -children. There can be zero children. -The top level of the hierarchy is functions. Each of these -will produce a single C++ public function in the output .cxx file. -Calling the function will create all of its child windows. -The second level of the hierarchy is windows. Each of these -produces an instance of class Fl_Window. -Below that are either widgets (subclasses of Fl_Widget) or +level by clicking the "triangle" at the left of a widget. +The leftmost widgets are the parents, and all the widgets +listed below them are their children. Parents don't have to have +any children. +The top level of the hierarchy is composed of functions and +classes. Each of these will produce a single C++ public +function or class in the output .cxx file. Calling the function or +instantiating the class will create all of the child widgets. +The second level of the hierarchy contains the windows. Each of these +produces an instance of class Fl_Window. +Below that are either widgets (subclasses of Fl_Widget) or groups of widgets (including other groups). Plain groups are for layout, navigation, and resize purposes. Tab groups provide the well-known file-card tab interface. -Widgets are shown in the browser as either their name (such -as "main_panel" in the example), or if unnamed as their type - and label (such as "Button "the green""). +Widgets are shown in the browser by either their name (such +as "main_panel" in the example), or by their type +and label (such as "Button "the green""). | ![]() |
You open widgets by double clicking them, or (to open several -widgets you have picked) by typing the F1 key. This will bring up a -control panel or window from which you can change the widget.
+Shift+Click to toggle them on and off. To select no widgets, click in +the blank area under the last widget. Note that hidden children may +be selected even when there is no visual indication of this. +You open widgets by double-clicking on them, or (to open several +widgets you have picked) by typing the F1 key. A control panel will appear +so you can change the widget(s).
The menu bar at the top is duplicated as a pop-up menu on any displayed window. The shortcuts for all the menu items work in any window. The menu items are:
-FLUID can also read .fd files produced by the Forms and XForms -"fdesign" programs. It is best to read them with Merge. FLUID does -not understand everything in a .fd file, and will print a warning -message on the controlling terminal for all data it does not -understand. You will probably need to edit the resulting setup to fix -these errors. Be careful not to save the file without changing the -name, as FLUID will write over the .fd file with its own format, which -fdesign cannot read!
+FLUID can also read .fd files produced by the Forms and +XForms "fdesign" programs. It is best to File/Merge them +instead of opening them. FLUID does not understand everything in a +.fd file, and will print a warning message on the controlling +terminal for all data it does not understand. You will probably need +to edit the resulting setup to fix these errors. Be careful not to +save the file without changing the name, as FLUID will write over the +.fd file with its own format, which fdesign cannot read!
The output file names are the same as the .fl file, with the leading -directory and trailing ".fl" stripped, and ".h" or ".cxx" appended. - Currently there is no way to override this.
+The output file names are the same as the .fl file, with +the leading directory and trailing ".fl" stripped, and +".h" or ".cxx" appended.
If the widget is a window, it is added to whatever function is -selected, or contains the current selection.
+selected, or contained in the current selection.If the widget is a normal widget, it is added to whatever window or group is selected. If none is, it is added to the window or group that is the parent of the current selection.
@@ -234,107 +233,114 @@ is the parent of the current selection. doing a paste.Cut/paste is the only way to change the parent of a widget.
If they are all selected already then this selects all widgets in that group's parent. Repeatedly typing Alt+a will select larger and larger groups of widgets until everything is selected.
|
+Displays the preferences panel. The alignment preferences control the
+grid that all widgets snap to when you move and resize them, and for the
+"snap" which is how far a widget has to be dragged from its original position
+to actually change.
+
+ The output filenames control the extensions or names of the files the are +generated by FLUID. If you check the "Include .h from .cxx" button the code +file will include the header file automatically. + |
+![]() |
+
If the function contains any unnamed windows, it will be declared as -returning an Fl_Window*. The unnamed window will be returned from it -(more than one unnamed window is useless). If the function contains -only named windows it will be declared as returning void.
-It is possible to make the .cxx output be a self-contained program -that can be compiled and executed. This is done by deleting the -function name, in which case "main(argc,argv)" is used. The function -will call show() on all the windows it creates and then call Fl::run(). - This can be used to test resize behavior or other parts of the user -interface. I'm not sure if it is possible to create really useful -programs using just FLUID.
-You can change the function name by double clicking the function.
+If the function contains any unnamed windows, it will be declared +as returning a Fl_Window pointer. The unnamed window will be returned +from it (more than one unnamed window is useless). If the function +contains only named windows, it will be declared as returning nothing +(void).
+It is possible to make the .cxx output be a self-contained +program that can be compiled and executed. This is done by deleting +the function name so main(argc,argv) is used. The function +will call show() on all the windows it creates and then call +Fl::run(). This can also be used to test resize behavior or +other parts of the user interface.
+You can change the function name by double-clicking on the function.
You also get the window's control panel, which is almost exactly the -same as any other Fl_Widget, and is described in the next chapter.
+Creates a new Fl_Window widget. The window is added to the +currently selected function, or to the function containing the +currently selected item. The window will appear, sized to 100x100. +You can resize it to whatever size you require. +The widget panel will also appear and is described later in this +chapter.
When you create the widget you will get the widget's control panel, -described in the next chapter.
+which is described later in this chapter.| When you double-click a widget or a set of widgets you will get + | |
| When you double-click on a widget or a set of widgets you will get
the "widget attribute panel".
When you change attributes using this panel, the changes are reflected immediately in the window. It is useful to hit the "no -overlay" button (or type Alt+o) to hide the red overlay so you can see +overlay" button (or type Alt+Shift+O) to hide the red overlay so you can see the widgets more accurately, especially when setting the box type. If you have several widgets selected, they may have different values for the fields. In this case the value for one of the widgets -is shown. But if you change this value, all the selected +is shown. But if you change this value, all of the selected widgets are changed to the new value. Hitting "OK" makes the changes permanent. Selecting a different widget also makes the changes permanent. FLUID checks for simple -syntax errors in any code (such as mismatched parenthesis) before +syntax errors such as mismatched parenthesis in any code before saving any text. | ![]() |
You can name several widgets with "name[0]", "name[1]", "name[2]", @@ -349,12 +355,12 @@ You pick the subtype off of this menu.
Many widgets will work, and draw faster, with a "frame" instead of a "box". A frame does not draw the colored interior, leaving whatever was already there visible. Be careful, as FLUID may draw this ok but -the real program leave unwanted stuff inside the widget.
+the real program may leave unwanted stuff inside the widget.If a window is filled with child widgets, you can speed up redrawing by changing the window's box type to "NO_BOX". FLUID will display a -checkerboard for any areas that are not colored in by boxes (notice -that this checkerboard is not drawn by the resulting program, instead -random garbage is left there).
+checkerboard for any areas that are not colored in by boxes. Note +that this checkerboard is not drawn by the resulting program. Instead +random garbage will be displayed.The color to draw the box with.
You can put newlines into the string to make multiple lines, the -easiest way is by typing ctrl+j.
+You can put newlines into the string to make multiple lines. The +easiest way is by typing Ctrl+j.
From this menu you can also pick -"Image...". This lets you use the contents of an image file -(currently an xpm pixmap or xbm bitmap) to label the widget.
-Only one child can be resizable. Turning this on turns it off for -other children.
+the other children.You can get more complex behavior by making invisible boxes the -resizable widget, or by using hierarchies of groups. Unfortunatley the +resizable widget, or by using hierarchies of groups. Unfortunately the only way to test it is to compile the program. Resizing the FLUID window is not the same as what will happen in the user program.
In addition, no #include header file is put in the .h file. You -must provide a #include line as the first of the "extrawhich declares -your subclass.
-The class had better be similar to the class you are spoofing. It +
In addition, no #include header file is put in the .h file. You +must provide a #include line as the first line of the "Extra +Code" which declares your subclass.
+The class must be similar to the class you are spoofing. It does not have to be a subclass. It is sometimes useful to change this -to another FLTK class: currently the only way to get a double-buffered +to another FLTK class. Currently the only way to get a double-buffered window is to change this field for the window to "Fl_Double_Window" and to add "#include <FL/Fl_Double_Window.h>" to the extra code.
-If the text starts with a '#' or the word "extern" then FLUID thinks -this is an "include" line, and it is written to the .h file. If the +
If the text starts with a # or the word extern then FLUID thinks +this is an "include" line, and it is written to the .h file. If the same include line occurs several times then only one copy is written.
-All other lines are "code" lines. The widget being constructed is -pointed to by the local variable 'o'. The window being constructed is -pointed to by the local variable 'w'. You can also access any +
All other lines are "code" lines. The current widget is +pointed to by the local variable o. The window being constructed is +pointed to by the local variable w. You can also access any arguments passed to the function here, and any named widgets that are before this one.
FLUID will check for matching parenthesis, braces, and quotes, but does not do much other error checking. Be careful here, as it may be hard to figure out what widget is producing an error in the compiler. -If you need more than 4 lines you probably should call a function in -your own .cxx code.
+If you need more than four lines you probably should call a function in +your own .cxx code.A name names a function in your own code. It must be declared as -"voidname>(<class>*,void*)".
-A code snippet is inserted into a static function in the .cxx output -file. The function prototype is "voidclass>*so you can refer to the -widget as 'o' and the user_data as 'v'. FLUID will check for matching -parenthesis, braces, and quotes, but does not do much other error -checking. Be careful here, as it may be hard to figure out what widget -is producing an error in the compiler.
+void name(<class>*,void*). +A code snippet is inserted into a static function in the +.cxx output file. The function prototype is void +name(class *o, void *v) so that you can refer to the widget as +o and the user_data() as v. FLUID will +check for matching parenthesis, braces, and quotes, but does not do +much other error checking. Be careful here, as it may be hard to +figure out what widget is producing an error in the compiler.
If the callback is blank then no callback is set.
This is a value for the user_data() of the widget. If blank the +
This is a value for the user_data() of the widget. If blank the default value of zero is used. This can be any piece of C code that -can be put "(void*)(<here>)".
-There are rare but useful other values for the when() field that are +
There are other rare but useful values for the when() field that are not in the menu. You should use the extra code fields to put these -values in.
+values in.Double-clicking a window name in the browser will display it, if not displayed yet. From this display you can select widgets, sets of @@ -530,15 +537,15 @@ up a file chooser from which you pick the image file. If an image has already been chosen, you can change the image used by picking "Image..." again. The name of the image will appear in the "label" field, but you can't edit it.
-The contents of the image file are written to the .cxx file, -so if you wish to distribute the C code, you only need to copy the .cxx +
The contents of the image file are written to the .cxx file, +so if you wish to distribute the C code, you only need to copy the .cxx file, not the images. If many widgets share the same image then only one copy is written.
-However the file name is stored in the .fl file, so to read -the .fl file you need the image files as well. Filenames are relative -to the location the .fl file is (not necessarily the current +
However the file name is stored in the .fl file, so to read +the .fl file you need the image files as well. Filenames are relative +to the location the .fl file is (not necessarily the current directory). I recommend you either put the images in the same -directory as the .fl file, or use absolute path names.
+directory as the .fl file, or use absolute path names.FLUID runs using the default visual of your X server. This may be 8 bits, which will give you dithered images. You may get better results @@ -598,4 +605,4 @@ as for xpm files. Notice that the conversion removes the compression, so the code may be much bigger than the .gif file. Only the first image of an animated gif file is used.
Behavior and performance with large .gif files is not guaranteed!
-