]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/forms/README
The redesigned graphics dialog, some tweeks to the preferences and ref
[lyx.git] / src / frontends / xforms / forms / README
1 All .fd files go in this directory.
2 Each .fd file should have just one form in them
3
4 NOTE: An exception to the above is any tabbed form which 
5       xforms requires multiple forms to create.  In that case
6       the group of forms constitutes one gui form.
7
8 All forms should be named form_xxx and saved into a file by the same name.
9 For example, the copyright notice is called form_copyright and is stored in
10 form_copyright.fd.  Its used by class FormCopyright.  If you match this pattern
11 the fdfix.sh script will do all the conversions for you.  That'll make
12 updating the source incredibly easy.
13
14 Name all buttons and other form components that are likely to cause a callback.
15 The names should be of the form:  button_ok, radio_group_item and so on.
16
17 Enter the full name of the callback eg.:
18         C_FormCopyrightOkCB
19
20 That is, they all have the same format: C_##FormName##CallbackName.
21 Your code will then need to use the appropriate macro to setup this C callback
22 function which will in turn call the corresponding static class member function
23 of the form FormName::CallbackName.  You should be able to copy the macro
24 entries from a similar dialog for reuse without having to change anything.
25
26 The name of the wrapped dialog will be dialog_ eg.
27         typedef struct {
28         ...
29         } FD_form_copyright;
30
31         FD_form_copyright * dialog_;
32
33 Angus Leeming has modified the scripts to forward declare FD_form_xxxx thereby
34 removing one inter-file dependency and removing the struct declaration from the
35 FormXxxx.h file which was the previous practice.
36
37 If you follow these simple rules then the generated code for create_form_form_xxxx
38 can will be converted as the FormXxxx::build_xxxx method without any extra 
39 editting to make it work.  Every forms implementation will thereby follow a very
40 simple pattern and make it easier to maintain.
41
42 All the forms are rebuild by running `make test`.  This will generate all
43 the form_xxxx.[Ch] files. You should run `make updatesrc` to install them in the
44 parent directory.  `make updatesrc` will also regenerate all the files for you
45 so you don't have to do the `make test` step unless, for example, you are
46 testing the conversion scripts. The files fdfix.sh, fdfixc.sed, fdfixh.sed and
47 makefile contain the necessary smarts to convert the generated code into
48 something that can be used directly in the LyX codebase.
49
50 The easiest way to fit into the pattern is to copy an existing dialogs
51 implementation and adjust it to suit, keeping the variable names the same.
52 Take a look at the existing .fd files as well to see what is needed in there
53 in the way of callback names and widget names.
54
55 In addition a lot of work can be saved by using the code that has already been
56 written in the "lyx" module of the LyX CVS repository. This is where the old
57 development branch is kept.  The code there will need to be modified slightly
58 to meet these new guidelines.  In addition, an earlier generation signalling
59 system was used in that code. A conversion script called gtkmmconvert2 is 
60 available from the gtk-- distribution.  It updates all the signals to use
61 libsigc++.
62
63 Don't reinvent the wheel.  There's 18 months worth of code in the "lyx" cvs
64 module that you should at least use as a guide even if you don't actually make
65 direct use of it.
66
67 Allan. (ARRae)