1 # Can't seem to input $classname!
2 # CLASSNAME will be swapped for the true classname later
4 # Create the destructor.
5 /\(.*\) *create_form_form/{
7 s/\(.*\) \*create_form_form[^ ]*/\1::~\1()/p
11 if( form->visible ) fl_hide_form( form );\
12 fl_free_form( form );\
20 # Rewrite "fdui->form_xxx->fdui = ..." as "fdui->form->fdui = ..."
21 s/fdui->form_\([^ ]*\)->fdui =/fdui->form->fdui =/
23 # Rewrite "fdui->form_xxx = ..." as "fdui->form = ..."
24 s/fdui->form_\([^ ]*\) =/fdui->form =/
26 # Rewrite "fdui->form_xxx->..." as "fdui->form->..."
27 s/fdui->form_\([^ ]*\)->/fdui->form->/
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
32 s/#include \"forms\.h\"/#include FORMS_H_LOCATION/
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\"
39 # For all lines containing "fl_" and a string _not_ containing |,
40 # replace the string with _(string)
41 /fl_/ s/".[^|]*"/_(&)/
43 # For all lines containing "shortcut" and a string containing |,
44 # replace the string with scex(_(string))
45 /shortcut/ s/".*[|].*"/scex(_(&))/
48 # For all lines containing "fl_add" and a string containing |, replace
49 # the string with idex(_(string))
50 /fl_add/ s/".*[|].*"/idex(_(&))/
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);/
57 # We use new/delete not malloc/free so change to suit.
58 s/\(\(FD_[^ ]*\) \*fdui =\).*sizeof(\*fdui))/\1 new \2/
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()/
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\
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.
74 # Clean up one special case where a comma appears at the end of a string
75 # while ensuring "...", "..." isn't affected.
77 s/\("[^"]+,\) \("\)/\1\2/g