3 # NOTE: This is NOT the same fdfix.sh as in ${top_srcdir}/forms
4 # It is a modified version to suit use for gui-indep.
8 echo "Input file does not exist. Cannot continue"
14 # names of the files generated by fdesign and by running the sed scripts
15 BASE=`basename $1 .fd`
17 if [ $1 = $BASE ]; then
18 echo "Input file is not a .fd file. Cannot continue"
27 # Ascertain the class name from the name of the file
28 # eg form_my_new_dialog -> FormMyNewDialog
34 SECTION=`echo $BASE | cut -d_ -f$i`
39 FIRST=`echo $SECTION | cut -c1 | tr a-z A-Z`
40 SECOND=`echo $SECTION | cut -c2-`
41 CLASSNAME=$CLASSNAME$FIRST$SECOND
47 # Create .c and .h files
52 # Modify .h file for use by LyX
53 echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext" > $HOUT
54 sed -f $FDFIXH < $HIN >> $HOUT
56 # Patch the .h file if a patch exists
57 if [ -f "$HOUT.patch" ] ; then
58 echo "Patching $HOUT with $HOUT.patch"
59 patch -s $HOUT < $HOUT.patch
62 # Modify .c file for use by LyX
63 echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext" > $COUT
64 echo "#include <config.h>" >> $COUT
65 echo "#include \"lyx_gui_misc.h\"" >> $COUT
66 echo "#include \"gettext.h\"" >> $COUT
69 sed -f $FDFIXC < $CIN | sed -e "s/CLASSNAME/$CLASSNAME/" >> $COUT
71 # Patch the .C file if a patch exists
72 if [ -f "$COUT.patch" ] ; then
73 echo "Patching $COUT with $COUT.patch"
74 patch -s $COUT < $COUT.patch
77 # Clean up, to leave .C and .h files