-# Can't seem to input $classname!
-# CLASSNAME will be swapped for the true classname later
-
# Create the destructor.
/\(.*\) *create_form_form/{
h
# replace the string with _(string)
/fl_/ s/".[^|]*"/_(&)/
-# For all lines containing "shortcut" and a string containing |,
+# For all lines containing "bmtable", replace "fl_add_button" by
+# "fl_add_bmtable"
+/bmtable/ s/fl_add_button/fl_add_bmtable/
+
+# For all lines containing "_shortcut" and a string containing |,
# replace the string with scex(_(string))
-/shortcut/ s/".*[|].*"/scex(_(&))/
+/_shortcut/ s/".*[|].*"/scex(_(&))/
+# gettext will get confused if the string contains a "%" unless the line is
+# preceeded immediately by // xgettext:no-c-format
+/_(".*[%].*")/i\
+ // xgettext:no-c-format
-# For all lines containing "fl_add" and a string containing |, replace
-# the string with idex(_(string))
-/fl_add/ s/".*[|].*"/idex(_(&))/
+# For all lines containing "fl_add" and a string containing |
+# do several things.
+# Eg
+# fdui->counter_zoom = obj = fl_add_counter(FL_NORMAL_COUNTER,1,2,3,4,"Zoom %|#Z");
+#
+# becomes
+# fdui->counter_zoom = obj;
+# {
+# // xgettext:no-c-format
+# char const * const dummy = N_("Zoom %|#Z");
+# fdui->counter_zoom = obj = fl_add_counter(FL_NORMAL_COUNTER,1,2,3,4,idex(_(dummy)));
+# fl_set_button_shortcut(obj,scex(_(dummy)),1);
+# }
+
+/fl_add/{
+/".*[|].*"/{
+
+ s/fdui\(.*\)"\(.*\)".*/{\
+ char const * const dummy = N_("\2");\
+ fdui\1idex(_(dummy)));\
+ fl_set_button_shortcut(obj,scex(_(dummy)),1);\
+ }/
+
+ /N_(".*[%].*");/ s/\(.*\)\(char const [*]\)/\1\/\/ xgettext:no-c-format\
+ \2/
+}
+}
-# For all lines containing "fl_add" and a string containing |, add the
-# shortcut command after the end of this line
-/fl_add/ s/idex(\(.*\)").*$/&\
- fl_set_button_shortcut(obj,scex(\1")),1);/
+# /fl_add/{
+# /".*[|].*"/{
+#
+# s/ = fl_add\(.*\)"\(.*\)".*/;\
+# {\
+# char const * dummy = N_("\2");\
+# obj = fl_add\1idex(_(dummy)));\
+# fl_set_button_shortcut(obj,scex(_(dummy)),1);\
+# }/
+#
+# /N_(".*[%].*");/ s/\(.*\)\(char const [*]\)/\1\/\/ xgettext:no-c-format\
+# \2/
+# }
+# }
# We use new/delete not malloc/free so change to suit.
s/\(\(FD_[^ ]*\) \*fdui =\).*sizeof(\*fdui))/\1 new \2/