]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/forms/fdfixc.sed
try this for distinguishing inner and outer tabs
[lyx.git] / src / frontends / xforms / forms / fdfixc.sed
1 # Create the destructor.
2 /\(.*\) *create_form_form/{
3 h
4 s/\(.*\) \*create_form_form[^ ]*/\1::~\1()/p
5 /\(.*\)::~\(.*\)()/{
6 i\
7 {\
8   if ( form->visible ) fl_hide_form( form );\
9   fl_free_form( form );\
10 }\
11 \
12
13 }
14 x
15 }
16
17 # Rewrite "fdui->form_xxx->fdui = ..." as "fdui->form->fdui = ..."
18 s/fdui->form_\([^ ]*\)->fdui =/fdui->form->fdui =/
19
20 # Rewrite "fdui->form_xxx = ..." as "fdui->form = ..."
21 s/fdui->form_\([^ ]*\) =/fdui->form =/
22
23 # Rewrite "fdui->form_xxx->..." as "fdui->form->..."
24 s/fdui->form_\([^ ]*\)->/fdui->form->/
25
26 #  Replace "forms.h" by FORMS_H_LOCATION in #include directives. This
27 #  macro is defined in config.h and is either <forms.h> or
28 #  <X11/forms.h>. 
29 s/#include \"forms\.h\"/#include FORMS_H_LOCATION/
30
31 #   For all lines containing "#include "form_*"", append a line
32 #   containing the header file of the parent class
33 /#include \"form_.*\"/a\
34 #include \"CLASSNAME.h\"
35
36 #  For all lines containing "fl_" and a string _not_ containing |,
37 #  replace the string with _(string)
38 /fl_/ s/".[^|]*"/_(&)/
39
40 #  For all lines containing "shortcut" and a string containing |, 
41 #  replace the string with scex(_(string))
42 /shortcut/ s/".*[|].*"/scex(_(&))/
43
44 #  gettext will get confused if the string contains a "%" unless the line is
45 #  preceeded immediately by // xgettext:no-c-format
46 /_(".*[%].*")/i\
47   // xgettext:no-c-format
48
49 # For all lines containing "fl_add" and a string containing |
50 # do several things.
51 # Eg
52 #   fdui->counter_zoom = obj = fl_add_counter(FL_NORMAL_COUNTER,1,2,3,4,"Zoom %|#Z");
53 #
54 # becomes
55 #   fdui->counter_zoom = obj;
56 #   {
57 #     // xgettext:no-c-format
58 #     char const * const dummy = N_("Zoom %|#Z");
59 #     fdui->counter_zoom = obj = fl_add_counter(FL_NORMAL_COUNTER,1,2,3,4,idex(_(dummy)));
60 #     fl_set_button_shortcut(obj,scex(_(dummy)),1);
61 #   }
62
63 /fl_add/{
64 /".*[|].*"/{
65
66   s/fdui\(.*\)"\(.*\)".*/{\
67     char const * const dummy = N_("\2");\
68     fdui\1idex(_(dummy)));\
69     fl_set_button_shortcut(obj,scex(_(dummy)),1);\
70   }/
71
72   /N_(".*[%].*");/ s/\(.*\)\(char const [*]\)/\1\/\/ xgettext:no-c-format\
73     \2/
74 }
75 }
76
77 # /fl_add/{
78 # /".*[|].*"/{
79
80 #   s/ = fl_add\(.*\)"\(.*\)".*/;\
81 #   {\
82 #     char const * dummy = N_("\2");\
83 #     obj = fl_add\1idex(_(dummy)));\
84 #     fl_set_button_shortcut(obj,scex(_(dummy)),1);\
85 #   }/
86
87 #   /N_(".*[%].*");/ s/\(.*\)\(char const [*]\)/\1\/\/ xgettext:no-c-format\
88 #     \2/
89 # }
90 # }
91
92 # We use new/delete not malloc/free so change to suit.
93 s/\(\(FD_[^ ]*\) \*fdui =\).*sizeof(\*fdui))/\1 new \2/
94
95 # Fixup the name of the create_form... function to have a signature
96 # matching that of the method it will become.
97 s/\(FD_f\([^ _]*\)_\([^ ]*\)\) \*create_form_form[^ ]*/\1 * CLASSNAME::build_\3()/
98
99 # We need to store a pointer to the dialog in u_vdata so that the
100 # callbacks will work.
101 s/\(fdui->form\)\(.*bgn_form.*\)/\1\2\
102   \1->u_vdata = this;/
103
104 # Someone got busy and put spaces in after commas but didn't allow for the
105 # autogeneration of the files so their pretty formatting got lost. Not anymore.
106 #
107 s/,\([^ ]\)/, \1/g
108
109 # Clean up one special case where a comma appears at the end of a string
110 # while ensuring "...", "..." isn't affected.
111 #
112 s/\("[^"]+,\) \("\)/\1\2/g
113