X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2Fforms%2Ffdfix.sh;h=6a4d143dc8fb924c9d531867b2860ae268a52541;hb=a97c4f51c3763ec213ecf84b4badec0bba8c0f60;hp=550dc6818a657eedb030a9e523072ece3a91db78;hpb=f4d7b803f354552a8f9c8aaf28086c2e3b7d7d90;p=lyx.git diff --git a/src/frontends/xforms/forms/fdfix.sh b/src/frontends/xforms/forms/fdfix.sh index 550dc6818a..6a4d143dc8 100644 --- a/src/frontends/xforms/forms/fdfix.sh +++ b/src/frontends/xforms/forms/fdfix.sh @@ -1,60 +1,122 @@ -#! /bin/sh + #! /bin/sh # -# NOTE: This is NOT the same fdfix.sh as in ${top_srcdir}/forms -# It is a modified version to suit use for gui-indep. +# \file fdfix.sh +# Copyright 2002 the LyX Team +# Read the file COPYING # +# \author Angus Leeming, leeming@lyx.org +# +# This shell script takes the dialog created with fdesign and generates the +# .C and .h files used by LyX from it. +# Note that the REAL magic is to be found in the sed scripts fdfixc.sed and +# fdfixh.sed used by this shell script. + +INTRO_MESSAGE () +{ +DATE=`date +"%Y"` + +# Note that we can't create a variable containing this and then +# echo it across because some machines require -e to recognize \n et al. +# Other machines, of course output -e, it not being an option they +# recognise ;-) + +# Set ${OUTPUT_FILE} to ${HOUT} or ${COUT} as appropriate +cat - > ${OUTPUT_FILE} <= 0.88) and gettext" > $hout -sed -f fdfixh.sed < $hin >> $hout +OUTPUT_FILE=${HOUT} +INTRO_MESSAGE + +sed -f $FDFIXH < $HIN >> ${HOUT} # Patch the .h file if a patch exists -if [ -f "$hout.patch" ] ; then - echo "Patching $hout with $hout.patch" - patch -s $hout < $hout.patch +if [ -f "${HPATCH}" ] ; then + echo "Patching ${HOUT} with ${HPATCH}" + patch -s ${HOUT} < ${HPATCH} fi -# Modify .c file for use by LyX -echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext" > $cout -echo "#include " >> $cout -echo "#include \"lyx_gui_misc.h\"" >> $cout -echo "#include \"gettext.h\"" >> $cout -echo >> $cout +# Clean up, to leave the finished .h file +rm -f ${HIN} +mv ${HOUT} ${BASENAME}.h + +#================================== +# Create the .C file for use by LyX +CIN=${DIRNAME}/${BASENAME}.c +CPATCH=${DIRNAME}/${BASENAME}.C.patch +COUT=${BASENAME}.C -sed -f fdfixc.sed < $cin | sed -e "s/CLASSNAME/$classname/" >> $cout +FDFIXC=${DIRNAME}/fdfixc.sed + +OUTPUT_FILE=${COUT} +INTRO_MESSAGE + +echo >> ${COUT} +echo "#include " >> ${COUT} +echo "#include \"forms_gettext.h\"" >> ${COUT} +echo "#include \"gettext.h\"" >> ${COUT} + +grep bmtable ${CIN} > /dev/null +if [ $? -eq 0 ]; then + echo "#include \"bmtable.h\"" >> ${COUT} +fi + +# This is (I hope) a very temporary fudge. +# FormMathsPanel should be modified in input() to not use the data parameter. +# Instead, use the FL_OBJECT * parameter. +# Angus 12 June, 2002. +grep MM_ ${CIN} > /dev/null +if [ $? -eq 0 ]; then + echo "#include \"MathsSymbols.h\"" >> ${COUT} +fi + +echo >> ${COUT} + +sed -f ${FDFIXC} < ${CIN} >> ${COUT} # Patch the .C file if a patch exists -if [ -f "$cout.patch" ] ; then - echo "Patching $cout with $cout.patch" - patch -s $cout < $cout.patch +if [ -f "$CPATCH" ] ; then + echo "Patching ${COUT} with $CPATCH" + patch -s ${COUT} < $CPATCH fi -# Clean up, to leave .C and .h files -rm -f $cin $hin -mv $hout $hin +# Clean up, to leave the finished .C file +rm -f ${CIN} + +#========================================