]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/forms/fdfixc.sed
More pref work from Angus
[lyx.git] / src / frontends / xforms / forms / fdfixc.sed
1 # Can't seem to input $classname!
2 # CLASSNAME will be swapped for the true classname later
3
4 # Create the destructor.
5 /\(.*\) *create_form_form/{
6 h
7 s/\(.*\) \*create_form_form[^ ]*/\1::~\1()/p
8 /\(.*\)::~\(.*\)()/{
9 i\
10 {\
11   if( form->visible ) fl_hide_form( form );\
12   fl_free_form( form );\
13 }\
14 \
15
16 }
17 x
18 }
19
20 # Rewrite "fdui->form_xxx->fdui = ..." as "fdui->form->fdui = ..."
21 s/fdui->form_\([^ ]*\)->fdui =/fdui->form->fdui =/
22
23 # Rewrite "fdui->form_xxx = ..." as "fdui->form = ..."
24 s/fdui->form_\([^ ]*\) =/fdui->form =/
25
26 # Rewrite "fdui->form_xxx->..." as "fdui->form->..."
27 s/fdui->form_\([^ ]*\)->/fdui->form->/
28
29 #  Replace "forms.h" by FORMS_H_LOCATION in #include directives. This
30 #  macro is defined in config.h and is either <forms.h> or
31 #  <X11/forms.h>. 
32 s/#include \"forms\.h\"/#include FORMS_H_LOCATION/
33
34 #   For all lines containing "#include "form_*"", append a line
35 #   containing the header file of the parent class
36 /#include \"form_.*\"/a\
37 #include \"CLASSNAME.h\"
38
39 #  For all lines containing "fl_" and a string _not_ containing |,
40 #  replace the string with _(string)
41 /fl_/ s/".[^|]*"/_(&)/
42
43 #  For all lines containing "shortcut" and a string containing |, 
44 #  replace the string with scex(_(string))
45 /shortcut/ s/".*[|].*"/scex(_(&))/
46
47
48 #  For all lines containing "fl_add" and a string containing |, replace
49 #  the string with idex(_(string))
50 /fl_add/ s/".*[|].*"/idex(_(&))/
51
52 # For all lines containing "fl_add" and a string containing |, add the
53 # shortcut command after the end of this line
54 /fl_add/ s/idex(\(.*\)").*$/&\
55     fl_set_button_shortcut(obj,scex(\1")),1);/
56
57 # We use new/delete not malloc/free so change to suit.
58 s/\(\(FD_[^ ]*\) \*fdui =\).*sizeof(\*fdui))/\1 new \2/
59
60 # Fixup the name of the create_form... function to have a signature
61 # matching that of the method it will become.
62 s/\(FD_f\([^ _]*\)_\([^ ]*\)\) \*create_form_form[^ ]*/\1 * CLASSNAME::build_\3()/
63
64 # We need to store a pointer to the dialog in u_vdata so that the
65 # callbacks will work.
66 s/\(fdui->form\)\(.*bgn_form.*\)/\1\2\
67   \1->u_vdata = this;/
68
69 # Someone got busy and put spaces in after commas but didn't allow for the
70 # autogeneration of the files so their pretty formatting got lost. Not anymore.
71 #
72 s/,\([^ ]\)/, \1/g
73
74 # Clean up one special case where a comma appears at the end of a string
75 # while ensuring "...", "..." isn't affected.
76 #
77 s/\("[^"]+,\) \("\)/\1\2/g
78