From: Allan Rae Date: Mon, 14 Aug 2000 05:24:35 +0000 (+0000) Subject: major GUII cleanup + Baruchs patch + Angus's patch + removed a couple of generated... X-Git-Tag: 1.6.10~22041 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f4d7b803f354552a8f9c8aaf28086c2e3b7d7d90;p=features.git major GUII cleanup + Baruchs patch + Angus's patch + removed a couple of generated files git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@966 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/ChangeLog b/ChangeLog index 7980517952..899a8e5a48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,79 @@ +2000-08-14 Allan Rae + + * lib/Makefile.am: listerrors cleaning + + * lib/listerrors: removed -- generated file + * acinclude.m4: ditto + * sigc++/acinclude.m4: ditto + + * src/frontends/xforms/forms/form_citation.fd: + * src/frontends/xforms/FormCitation.C (setSize): Made the form a more + manageable size. + + * src/frontends/xforms/forms/makefile: I renamed the `install` target + `updatesrc` and now we have a `test` target that does what `updatesrc` + used to do. I didn't like having an install target that wasn't related + to the dist. + + * src/frontends/xforms/Form*.[hC]: Removed the free() member functions + on all except FormGraphics. This may yet happen. Followed by a major + cleanup including using FL_TRANSIENT for most of the dialogs. More + changes to come when the ButtonController below is introduced. + + * src/frontends/xforms/ButtonController.h: New file for managing up to + four buttons on a dialog according to an externally defined policy. + * src/frontends/xforms/Makefile.am: added above + + * src/frontends/ButtonPolicies.[hC]: New files full of policies for Ok, + Apply and Cancel/Close buttons and everything in between and beyond. + * src/frontends/Makefile.am: added above. + + * src/frontends/xforms/forms/form_preferences.fd: + * src/frontends/xforms/FormPreferences.[hC]: Uses the ButtonController + and removed variable 'status' as a result. Fixed the set_minsize thing. + Use the new screen-font-update after checking screen fonts were changed + Added a "Restore" button to restore the original lyxrc values while + editing. This restores everything not just the last input changed. + That's still a tricky one. As is the "LyX: this shouldn't happen..." + + * src/LyXAction.C: screen-font-update added for updating buffers after + screen font settings have been changed. + * src/commandtags.h: ditto + * src/lyxfunc.C: ditto + + * forms/lyx.fd: removed screen fonts dialog. + * src/lyx_gui.C: ditto + * src/menus.[Ch]: ditto + * src/lyx.[Ch]: ditto + * src/lyx_cb.C: ditto + code from here moved to make screen-font-update. + And people wonder why progress on GUII is slow. Look at how scattered + this stuff was! It takes forever just find it all. + + * forms/fdfix.sh: Fixup the spacing after commas. + * forms/makefile: Remove date from generated files. Fewer clashes now. + * forms/bullet_forms.C.patch: included someones handwritten changes + + * src/lyxrc.[Ch]: Added a commented out system_lyxrc. Will use it RSN + once I've discovered why LyXRC was made noncopyable. + * src/lyx_main.C: ditto + +2000-08-14 Angus Leeming + + * src/frontends/xforms/forms/fdfix.sh: + * src/frontends/xforms/forms/fdfixh.sed: + * src/frontends/xforms/forms/fdfixc.sed: New file from Angus + * src/frontends/xforms/Form*.[hC]: + * src/frontends/xforms/form_*.[hC]: Massive rewrite of the generation + scripts to rename all the "FL_OBJECT * form_xxxx" to "form" and to + provide a destructor for the struct FD_form_xxxx. Another version of + the set_[max|min]size workaround and a few other cleanups. Actually, + Angus' patch from 20000809. + +2000-08-13 Baruch Even + + * src/insets/insetgraphics.C (Clone): Added several fields that needed + copying. + 2000-08-11 Juergen Vigna * src/insets/insetgraphics.C (InsetGraphics): changing init diff --git a/acinclude.m4 b/acinclude.m4 deleted file mode 100644 index 74ffa1adce..0000000000 --- a/acinclude.m4 +++ /dev/null @@ -1,4605 +0,0 @@ -dnl Some useful functions for LyXs configure.in -*- sh -*- -dnl Author: Jean-Marc Lasgouttes (Jean-Marc.Lasgouttes@inria.fr) -dnl Lars Gullik Bjønnes (larsbj@lyx.org) -dnl Allan Rae (rae@lyx.org) - - -dnl Usage LYX_GET_VERSION Sets "lyx_version" to the version of LyX being -dnl built, displays it and sets variable "lyx_devel" to yes or no depending -dnl whether the version is a development release or not. -AC_DEFUN(LYX_GET_VERSION,[ -changequote(, ) dnl -VERSION=`grep '#define *LYX_VERSION' $1 | - sed -e 's/^.*"\(.*\)"$/\1/' 2>/dev/null` -echo "configuring LyX version $VERSION" -if echo "$VERSION" | grep 'cvs' >/dev/null ; then - lyx_devel_version=yes - echo "WARNING: This is a development version. Expect bugs." -else - lyx_devel_version=no -fi -if echo "$VERSION" | grep 'pre' > /dev/null ; then - lyx_prerelease=yes - echo "WARNING: This is a prerelease. Be careful and backup your documents." -else - lyx_prerelease=no -fi -changequote([, ]) dnl -PACKAGE=lyx${program_suffix} -AC_SUBST(lyx_devel_version) -if test $lyx_devel_version = yes ; then - AC_DEFINE(DEVEL_VERSION, 1, Define if you are building a development version of LyX) -fi]) - -dnl Usage: LYX_ERROR(message) Displays the warning "message" and sets the -dnl flag lyx_error to yes. -AC_DEFUN(LYX_ERROR,[ -lyx_error_txt="$lyx_error_txt -** $1 -" -lyx_error=yes]) - - -dnl Usage: LYX_WARNING(message) Displays the warning "message" and sets the -dnl flag lyx_warning to yes. -AC_DEFUN(LYX_WARNING,[ -lyx_warning_txt="$lyx_warning_txt -== $1 -" -lyx_warning=yes]) - - -dnl Usage: LYX_LIB_ERROR(file,library) Displays an error message indication -dnl that 'file' cannot be found because 'lib' may be uncorrectly installed. -AC_DEFUN(LYX_LIB_ERROR,[ -LYX_ERROR([Cannot find $1. Please check that the $2 library - is correctly installed on your system.])]) - - -dnl Usage: LYX_CHECK_ERRORS Displays a warning message if a LYX_ERROR -dnl has occured previously. -AC_DEFUN(LYX_CHECK_ERRORS,[ -if test x$lyx_error = xyes; then -cat <(bar); - if (bar1 == 0) - exit(1); - bar = foo2; - bar1 = dynamic_cast(bar); - if (bar1 != 0) - exit(1); - return 0; -} -],lyx_cv_rtti=yes,lyx_cv_rtti=no,lyx_cv_rtti=no) -]) -if test x$lyx_cv_rtti = xyes ; then - AC_DEFINE(HAVE_RTTI, 1, - [Define to 1 if your compiler supports runtime type information]) -fi]) - - -dnl Usage: LYX_CXX_EXPLICIT : checks whether the C++ compiler -dnl understands the "explicit" directive. -AC_DEFUN(LYX_CXX_EXPLICIT,[ -### Check whether the compiler understands the keyword `explicit' -AC_CACHE_CHECK(whether the C++ compiler understands explicit,lyx_cv_explicit, - [AC_TRY_COMPILE([ -class Expl { -public: - explicit Expl() {}; -};],,lyx_cv_explicit=yes,lyx_cv_explicit=no) -]) -if test $lyx_cv_explicit = no ; then - AC_DEFINE(explicit,[ ], - [Define to nothing if your compiler does not understand the - 'explicit' directive]) -fi]) - - -dnl Usage: LYX_CXX_STL_STACK : checks whether the C++ compiler -dnl has a working stl stack template -AC_DEFUN(LYX_CXX_STL_STACK,[ -AC_CACHE_CHECK(for broken STL stack template,lyx_cv_broken_stack, - [AC_TRY_COMPILE([ -#include -using std::stack; -],[ - stack stakk; - stakk.push(0); -],lyx_cv_broken_stack=no,lyx_cv_broken_stack=yes) -]) -if test $lyx_cv_broken_stack = yes ; then - AC_DEFINE(BROKEN_STL_STACK, 1, - [Define if you have the STL from libg++ 2.7.x, where stack<> is not defined - correctly]) -fi]) - - -dnl Usage: LYX_STD_COUNT : checks wherer the C++ library have a conforming -dnl count template, if not the old HP version is assumed. -AC_DEFUN(LYX_STD_COUNT,[ -AC_CACHE_CHECK(for conforming std::count,lyx_cv_std_count, - [AC_TRY_COMPILE([ -#include -#include -using std::string; -using std::count; -int countChar(string const & a, char const c) -{ - return count(a.begin(), a.end(), c); -} -],[ - string a("hello"); - int i = countChar(a, 'l'); -],lyx_cv_std_count=yes,lyx_cv_std_count=no) -]) -if test $lyx_cv_std_count = yes ; then - AC_DEFINE(HAVE_STD_COUNT, 1, - [Define if you have a conforming std::count template, otherwise HP version of count template is assumed.]) -fi]) - - -dnl Usage: LYX_CXX_STL_MODERN_STREAMS : checks whether the C++ compiler -dnl supports modern STL streams -AC_DEFUN(LYX_CXX_STL_MODERN_STREAMS,[ -AC_CACHE_CHECK(for modern STL streams,lyx_cv_modern_streams, - [AC_TRY_COMPILE([ -#include -],[ - std::streambuf * test = std::cerr.rdbuf(); - test->pubsync(); -],lyx_cv_modern_streams=yes,lyx_cv_modern_streams=no) -]) -if test $lyx_cv_modern_streams = yes ; then - AC_DEFINE(MODERN_STL_STREAMS, 1, - [Define if you have modern standard-compliant STL streams]) -fi]) - - -dnl Usage: LYX_CXX_STL_STRING : checks whether the C++ compiler -dnl has a std::string that is usable for LyX. LyX does not require this -dnl std::string to be standard. -AC_DEFUN(LYX_CXX_STL_STRING,[ - AC_REQUIRE([LYX_PROG_CXX]) - AC_MSG_CHECKING(whether the included std::string should be used) - AC_ARG_WITH(included-string, - [ --with-included-string use LyX string class instead of STL string], - [lyx_cv_with_included_string=$withval], - [AC_CACHE_CHECK([],lyx_cv_with_included_string, - [AC_TRY_COMPILE([ - #include - using std::string; - ],[ - // LyX has reduced its requirements on the basic_string - // implementation so that the basic_string supplied - // with gcc is usable. In particular this means that - // lyx does not use std::string::clear and not the - // strncmp version of std::string::compare. This is mainly - // done so that LyX can use precompiled C++ libraries that - // already uses the systems basic_string, e.g. gtk-- - string a("hello there"); - a.erase(); - a = "hey"; - //char s[] = "y"; - //int t = a.compare(a.length() - 1, 1, s); - a.erase(); - ],[ - lyx_cv_with_included_string=no - ],[ - lyx_cv_with_included_string=yes - ]) - ]) - ]) - if test x$lyx_cv_with_included_string = xyes ; then - AC_DEFINE(USE_INCLUDED_STRING, 1, - [Define to use the lyxstring class bundled with LyX.]) - lyx_flags="$lyx_flags included-string" - fi - AM_CONDITIONAL(USE_LYXSTRING, test x$lyx_cv_with_included_string = xyes) -dnl AC_MSG_RESULT([$with_included_string]) -]) - - -dnl Usage: LYX_CXX_GOOD_STD_STRING : checks whether the C++ compiler -dnl has a std::string that is close to the standard. So close that -dnl methods not found in "unstandard" std::strings are present here. -AC_DEFUN(LYX_CXX_GOOD_STD_STRING,[ - AC_REQUIRE([LYX_PROG_CXX]) - AC_CACHE_CHECK([whether the systems std::string is really good], - [lyx_cv_std_string_good], - [AC_TRY_COMPILE([ - #include - using std::string; - ],[ - // From a std::string that is supposed to be close to the - // standard we require at least three things: - // - clear() and erase() - // - the strncmp of compare() - // - push_back() - string a("hello there"); - a.erase(); - a = "hey"; - char s[] = "y"; - int t = a.compare(a.length() - 1, 1, s); - a.push_back('g'); - a.clear(); - ],[ - lyx_cv_std_string_good=yes - ],[ - lyx_cv_std_string_good=no - - ]) - ]) - if test x$lyx_cv_std_string_good = xyes ; then - AC_DEFINE(STD_STRING_IS_GOOD, 1, - [Define is the systems std::string is really good.]) - fi -]) - - -dnl Usage: LYX_REGEX : checks if the header regex.h is available -dnl if it is not available the automake variable USE_REGEX will be -dnl defined and the regex.h and regex.c that we provide will be used. -AC_DEFUN(LYX_REGEX,[ - AC_CHECK_HEADERS(regex.h, lyx_regex=no, lyx_regex=yes) - AM_CONDITIONAL(USE_REGEX, test x$lyx_regex = xyes) -]) - - -dnl LYX_CXX_MUTABLE -AC_DEFUN(LYX_CXX_MUTABLE, [ - AC_REQUIRE([LYX_PROG_CXX]) - AC_CACHE_CHECK([if C++ compiler supports mutable], - lyx_cv_cxx_mutable,[ - AC_TRY_COMPILE( - [ - class k { - mutable char *c; - public: - void foo() const { c=0; } - }; - ],[ - ],[ - lyx_cv_cxx_mutable=yes - ],[ - lyx_cv_cxx_mutable=no - ]) - ]) - if test $lyx_cv_cxx_mutable = yes ; then - AC_DEFINE(HAVE_MUTABLE, 1, - [Defined if your compiler suports 'mutable'.]) - fi -]) - - -dnl LYX_CXX_PARTIAL -AC_DEFUN(LYX_CXX_PARTIAL, [ - AC_REQUIRE([LYX_PROG_CXX]) - AC_CACHE_CHECK([if C++ compiler supports partial specialization], - [lyx_cv_cxx_partial_specialization], - [AC_TRY_COMPILE( - [ - template - class k { - public: - }; - template class k { }; - ],[ - k b; - k a; - ],[ - lyx_cv_cxx_partial_specialization=yes - ],[ - lyx_cv_cxx_partial_specialization=no - ]) - ]) - if test x$lyx_cv_cxx_partial_specialization = xyes ; then - AC_DEFINE(HAVE_PARTIAL_SPECIALIZATION, 1, - [Defined if your compiler supports partial specialization.]) - fi -]) - - -dnl Usage: LYX_CXX_NAMESPACES : checks whether the C++ compiler -dnl has a correct namespace handling and define CXX_WORKING_NAMESPACES -dnl if true. This macro does not do a thourough test, but it should be -dnl good enough to suit our needs. -AC_DEFUN(LYX_CXX_NAMESPACES,[ - AC_CACHE_CHECK(for correct namespaces support,lyx_cv_cxx_namespace, - [AC_TRY_COMPILE([ - namespace foo { - int bar; - } - ],[ - foo::bar = 0; - return 0; - ],lyx_cv_cxx_namespace=yes,lyx_cv_cxx_namespace=no) - ]) - if test x$lyx_cv_cxx_namespace = xyes ; then - AC_DEFINE(CXX_WORKING_NAMESPACES, 1, - [Define if your C++ compiler has correct support for namespaces]) - fi -]) - - -dnl Usage: LYX_CXX_CHEADERS : checks whether the C++ compiler -dnl provides wrappers for C headers and use our alternate version otherwise. -AC_DEFUN(LYX_CXX_CHEADERS,[ -AC_CACHE_CHECK(for C headers wrappers,lyx_cv_cxx_cheaders, - [AC_TRY_CPP([ -#include -#include -#include -#include -#include -#include -#include -#include -#include ],[lyx_cv_cxx_cheaders=yes],[lyx_cv_cxx_cheaders=no])]) -if test $lyx_cv_cxx_cheaders = no ; then - LYX_ADD_INC_DIR(lyx_cppflags,\$(top_srcdir)/src/cheaders) -fi]) - - -dnl Usage LYX_PATH_XPM: Checks for xpm library and header -AC_DEFUN(LYX_PATH_XPM,[ -### Check for Xpm library -AC_CHECK_LIB(Xpm, XpmCreateBufferFromImage,LYX_LIBS="-lXpm $LYX_LIBS", - [LYX_LIB_ERROR(libXpm,Xpm)], $LYX_LIBS) - -### Check for Xpm headers -lyx_cv_xpm_h_location="" -AC_CHECK_HEADER(X11/xpm.h,[ - ac_cv_header_xpm_h=yes - lyx_cv_xpm_h_location=""],[ -AC_CHECK_HEADER(xpm.h,[],[ -LYX_LIB_ERROR(xpm.h,Xpm)])]) -AC_DEFINE_UNQUOTED(XPM_H_LOCATION,$lyx_cv_xpm_h_location) - -### Test for the header version -if test $ac_cv_header_xpm_h = yes; then - AC_CACHE_CHECK([xpm header version],lyx_cv_xpmversion, - [ cat > conftest.$ac_ext <&5 | \ - grep '^"%%%"' 2>/dev/null | \ - sed -e 's/^"%%%"\(.*\)"%%%"/\1/' -e 's/ //g'` - case "$lyx_cv_xpmr" in -changequote(,) - [0-9]) lyxxpmr_alpha=`echo $lyx_cv_xpmr |tr 123456789 abcdefghi` - lyxxpmv_alpha=" (aka 3.$lyx_cv_xpmv$lyxxpmr_alpha)";; -changequote([,]) - *) ;; - esac - lyx_cv_xpmversion="$lyx_cv_xpmv.$lyx_cv_xpmr$lyxxpmv_alpha" - rm -f conftest*]) - case "$lyx_cv_xpmr" in -changequote(,) - [789]|[0-9][0-9]*) ;; -changequote([,]) - *) LYX_WARNING([Version $lyx_cv_xpmversion of the Xpm library is a bit old. - If you experience strange crashes with LyX, try to upgrade - to at least version 4.7 (aka 3.4g). - If you have installed a newer version of the library, check whether you - have an old xpm.h header file in your include path.]);; - esac -fi]) - - -dnl Usage LYX_PATH_XFORMS: Checks for xforms library and flags -AC_DEFUN(LYX_PATH_XFORMS,[ -### Check for xforms library -AC_CHECK_LIB(forms, fl_initialize, LYX_LIBS="-lforms $LYX_LIBS", - [AC_CHECK_LIB(xforms, fl_initialize, LYX_LIBS="-lxforms $LYX_LIBS", - [LYX_LIB_ERROR(libforms or libxforms,xforms)], $LYX_LIBS)], $LYX_LIBS) - -### Check for xforms headers -lyx_cv_forms_h_location="" -AC_CHECK_HEADER(X11/forms.h,[ - ac_cv_header_forms_h=yes - lyx_cv_forms_h_location=""],[ -AC_CHECK_HEADER(forms.h,[],[ -LYX_LIB_ERROR(forms.h,forms)])]) -AC_DEFINE_UNQUOTED(FORMS_H_LOCATION,$lyx_cv_forms_h_location) -if test $ac_cv_header_forms_h = yes; then - AC_CACHE_CHECK([xforms header version],lyx_cv_xfversion, - [ cat > conftest.$ac_ext <&5 | \ - grep '^"%%%"' 2>/dev/null | \ - sed -e 's/^"%%%"\(.*\)"%%%"/\1/' -e 's/ //g'` -rm -f conftest*]) -case "$lyx_cv_xfversion" in - "(unknown)"|0.8[1-7]) - LYX_ERROR(dnl -Version $lyx_cv_xfversion of xforms is not compatible with LyX. - This version of LyX works best with versions 0.88 (recommended) and later.) ;; - 0.88) ;; - 0.89) LYX_WARNING(dnl -LyX should work ok with version $lyx_cv_xfversion of xforms[,] but -it is an unproven version and might still have some bugs. If you -have problems[,] please use version 0.88 instead.) ;; - *) LYX_WARNING(dnl -Version $lyx_cv_xfversion of xforms might not be compatible with LyX[,] - since it is newer than 0.88. You might have slight problems with it.);; -esac -fi]) - - -dnl Usage: LYX_HPUX Checks for HP-UX and update CXXFLAGS accordingly -AC_DEFUN(LYX_HPUX, -[#It seems that HPUX requires using -fpcc-struct-return with gcc. -AC_CACHE_CHECK(for HP-UX,ac_cv_hpux,[ -os=`uname -s | tr '[A-Z]' '[a-z]'` -ac_cv_hpux=no -test "$os" = hp-ux && ac_cv_hpux=yes]) -if test "$ac_cv_hpux" = yes; then - test "x$GXX" = xyes && CXXFLAGS="$CXXFLAGS -fpcc-struct-return" -fi]) - - -dnl Usage: LYX_SUNOS4 Checks for SunOS 4.x and sets the flag lyx_broken_headers -dnl if necessary -AC_DEFUN(LYX_SUNOS4, -[#The headers are not correct under SunOS4 -AC_CACHE_CHECK(for SunOS 4.x,ac_cv_sunos4,[ -changequote(, ) dnl -os=`uname -a | sed -e 's/^\([^ ]*\) [^ ]* \([0-9]\)\..*/\1\2/'` -changequote([, ]) dnl -ac_cv_sunos4=no -test "$os" = SunOS4 && ac_cv_sunos4=yes]) -if test "$ac_cv_sunos4" = yes; then - test "x$GXX" = xyes && lyx_broken_headers=yes -fi]) - - -dnl Usage: LYX_SCO Checks for SCO and sets the flag lyx_broken_headers -dnl if necessary -AC_DEFUN(LYX_SCO, -[AC_CACHE_CHECK(for SCO 3.2v4,ac_cv_sco,[ -ac_cv_sco=no -if test `uname -s` != "SCO_SV"; then - lyx_machine_rel=`uname -m`:`uname -r` - if test $lyx_machine_rel = i386:3.2 || test $lyx_machine_rel = i486:3.2; - then - if test -f /usr/options/cb.name; then - ac_cv_sco=no - elif /bin/uname -X 2>/dev/null >/dev/null ; then - ac_cv_sco=yes - fi - fi -fi]) -if test "$ac_cv_sco" = yes; then - test "x$GXX" = xyes && lyx_broken_headers=yes -fi]) - -dnl Usage: LYX_FUNC_PUTENV_ARGTYPE -dnl Checks whether putenv() takes 'char const *' or 'char *' as -dnl argument. This is needed because Solaris 7 (wrongly?) uses 'char *', -dnl while everybody else uses the former... -AC_DEFUN(LYX_FUNC_PUTENV_ARGTYPE, -[AC_MSG_CHECKING([type of argument for putenv()]) - AC_CACHE_VAL(lyx_cv_func_putenv_arg,dnl - [AC_TRY_COMPILE(dnl -[#include ], -[char const * foo = "bar"; - putenv(foo);],dnl - [lyx_cv_func_putenv_arg='char const *'],[lyx_cv_func_putenv_arg='char *'])]) - AC_MSG_RESULT($lyx_cv_func_putenv_arg) - AC_DEFINE_UNQUOTED(PUTENV_TYPE_ARG,$lyx_cv_func_putenv_arg,dnl - [Define to the type of the argument of putenv(). Needed on Solaris 7.])]) - - -dnl Usage: LYX_WITH_DIR(dir-name,desc,dir-var-name,default-value, -dnl [default-yes-value]) -dnl Adds a --with-'dir-name' option (described by 'desc') and puts the -dnl resulting directory name in 'dir-var-name'. -AC_DEFUN(LYX_WITH_DIR,[ - AC_ARG_WITH($1,[ --with-$1 specify $2]) - AC_MSG_CHECKING([for $2]) - if test -z "$with_$3"; then - AC_CACHE_VAL(lyx_cv_$3, lyx_cv_$3=$4) - else - test "x$with_$3" = xyes && with_$3=$5 - lyx_cv_$3="$with_$3" - fi - AC_MSG_RESULT($lyx_cv_$3)]) - - -dnl Usage: LYX_LOOP_DIR(value,action) -dnl Executes action for values of variable `dir' in `values'. `values' can -dnl use ":" as a separator. -AC_DEFUN(LYX_LOOP_DIR,[ -IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" -for dir in `eval "echo $1"`; do - if test ! "$dir" = NONE; then - test ! -d "$dir" && AC_ERROR([\"$dir\" is not a directory]) - $2 - fi -done -IFS=$ac_save_ifs -]) - - -dnl Usage: LYX_ADD_LIB_DIR(var-name,dir) Adds a -L directive to variable -dnl var-name. -AC_DEFUN(LYX_ADD_LIB_DIR,[ -$1="${$1} -L$2" -if test "`(uname) 2>/dev/null`" = SunOS && - uname -r | grep '^5' >/dev/null; then - if test $ac_cv_prog_gxx = yes ; then - $1="${$1} -Wl[,]-R$2" - else - $1="${$1} -R$2" - fi -fi]) - - -dnl Usage: LYX_ADD_INC_DIR(var-name,dir) Adds a -I directive to variable -dnl var-name. -AC_DEFUN(LYX_ADD_INC_DIR,[$1="${$1} -I$2 "]) - -### Check which libsigc++ we're using and make sure any external one works -### Check for libsigc++ library -AC_DEFUN(LYX_WITH_SIGC, -[AC_MSG_CHECKING(whether the included libsigc++ should be used) -AC_ARG_WITH([included-libsigc], - [ --without-included-libsigc - Use the libsigc++ installed on the system], - [lyx_use_included_libsigc=$withval], - [lyx_use_included_libsigc=yes]) -AC_MSG_RESULT([$lyx_use_included_libsigc]) -if test x$lyx_use_included_libsigc = xno; then - ### Check for libsigc++ - ## can't use AC_SUBST right here! - AM_PATH_SIGC(0.8.7, - [ INCLUDED_SIGC= - ], - [LYX_ERROR(dnl - [Cannot find libsigc++ library or headers at least as recent as 0.8.7. - Check your installation. Have you installed the development package?]) - ]) -else - ### Use the included libsigc++ - ### sigc-config hasn't been created yet so we can't just do the same as above - ### unless of course someone gets keen and merges the sigc++ configure.in - ### with this one. We don't really gain much by doing that though except - ### a considerably smaller dist and more difficult maintenance. - ### It'd also mean we'd have the equivalent of config/gettext.m4 - lyx_flags="$lyx_flags included-libsigc" - SIGC_LIBS="\`\${top_builddir}/sigc++/sigc-config --libs-names | sed -e 's/-lsigc//'\`" - # Libsigc++ always installs into a subdirectory called sigc++. Therefore we - # have to always use #include in our code. - # Remember if you decide to do anything to the sigc++ code to do your mods on - # the makeLyXsigc.sh script in development/tools using a current cvs checkout - # of libsigc++. A tarball distribution doesn't have everything in it that we - # need. - # We need both these -I entries to build when builddir != srcdir - if test "x$src_dir" = "x." ; then - SIGC_CFLAGS="-I\${top_srcdir}" - else - SIGC_CFLAGS="-I\${top_builddir} -I\${top_srcdir}" - fi - INCLUDED_SIGC="\${top_builddir}/sigc++/libsigc.la" - ## can't substitute these here like this otherwise all remaining tests fail - ## instead we SUBST directly into the Makefiles - ##LIBS="$LIBS \$SIGC_LIBS" - ##CPPFLAGS="$CPPFLAGS \$SIGC_CFLAGS" - AC_SUBST(SIGC_LIBS) - AC_SUBST(SIGC_CFLAGS) -fi -AC_SUBST(INCLUDED_SIGC) -]) - -### Check for a headers existence and location iff it exists -## This is supposed to be a generalised version of LYX_STL_STRING_FWD -## It almost works. I've tried a few variations but they give errors -## of one sort or other: bad substitution or file not found etc. The -## actual header _is_ found though and the cache variable is set however -## the reported setting (on screen) is equal to $ac_safe for some unknown -## reason. -## Additionally, autoheader can't figure out what to use as the name in -## the config.h.in file so we need to write our own entries there -- one for -## each header in the form PATH_HEADER_NAME_H -## -AC_DEFUN(LYX_PATH_HEADER, -[ AC_CHECK_HEADER($1,[ - ac_tr_safe=PATH_`echo $ac_safe | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` -### the only remaining problem is getting the second parameter to this -### AC_CACHE_CACHE to print correctly. Currently it just results in value -### of $ac_safe being printed. - AC_CACHE_CHECK([path to $1],[lyx_cv_path2_$ac_safe], - [ cat > conftest.$ac_ext < -EOF -lyx_path_header_path=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \ - grep $1 2>/dev/null | \ - sed -e 's/.*\(".*$1"\).*/\1/' -e "1q"` -eval "lyx_cv_path2_${ac_safe}=\$lyx_path_header_path" -rm -f conftest*]) - AC_DEFINE_UNQUOTED($ac_tr_safe, $lyx_path_header_path)]) -]) -### end of LYX_PATH_HEADER - -### Check for stl_string_fwd.h existence and location if it exists -AC_DEFUN(LYX_STL_STRING_FWD, -[ AC_CHECK_HEADER(stl_string_fwd.h,[ - AC_CACHE_CHECK([path to stl_string_fwd.h],lyx_cv_path_stl_string_fwd_h, - [ cat > conftest.$ac_ext < -EOF -lyx_cv_path_stl_string_fwd_h=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | \ - grep 'stl_string_fwd.h' 2>/dev/null | \ - sed -e 's/.*\(".*stl_string_fwd.h"\).*/\1/' -e "1q"` -rm -f conftest*]) - AC_DEFINE_UNQUOTED(STL_STRING_FWD_H_LOCATION,$lyx_cv_path_stl_string_fwd_h, -[define this to the location of stl_string_fwd.h to be used with #include, - NOTE: Do not set it to as that will find the LyX - supplied version of the header. - e.g. <../include/stl_string_fwd.h> or better yet use an absolute path])]) -]) - - -dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)] -dnl if the cache file is inconsistent with the current host, -dnl target and build system types, execute CMD or print a default -dnl error message. -AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [ - AC_REQUIRE([AC_CANONICAL_SYSTEM]) - AC_MSG_CHECKING([config.cache system type]) - if { test x"${ac_cv_host_system_type+set}" = x"set" && - test x"$ac_cv_host_system_type" != x"$host"; } || - { test x"${ac_cv_build_system_type+set}" = x"set" && - test x"$ac_cv_build_system_type" != x"$build"; } || - { test x"${ac_cv_target_system_type+set}" = x"set" && - test x"$ac_cv_target_system_type" != x"$target"; }; then - AC_MSG_RESULT([different]) - ifelse($#, 1, [$1], - [AC_MSG_ERROR(["you must remove config.cache and restart configure"])]) - else - AC_MSG_RESULT([same]) - fi - ac_cv_host_system_type="$host" - ac_cv_build_system_type="$build" - ac_cv_target_system_type="$target" -]) - -dnl We use this until autoconf fixes its version. -AC_DEFUN(LYX_FUNC_SELECT_ARGTYPES, -[AC_MSG_CHECKING([types of arguments for select()]) - AC_CACHE_VAL(ac_cv_func_select_arg234,dnl - [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl - [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl - [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do - for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do - AC_TRY_COMPILE(dnl -[#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#endif -#ifdef HAVE_SYS_SELECT_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -extern int select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl - [ac_not_found=no ; break 3],ac_not_found=yes) - done - done - done - ])dnl AC_CACHE_VAL - ])dnl AC_CACHE_VAL - ])dnl AC_CACHE_VAL - if test "$ac_not_found" = yes; then - ac_cv_func_select_arg1=int - ac_cv_func_select_arg234='int *' - ac_cv_func_select_arg5='struct timeval *' - fi - AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5]) - AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1,$ac_cv_func_select_arg1) - AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234,($ac_cv_func_select_arg234)) - AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5)) -]) - -### Check which frontend we want to use. The default is XForms -### -AC_DEFUN(LYX_USE_FRONTEND, -[AC_MSG_CHECKING(what frontend should be used as main GUI) -AC_ARG_WITH(frontend, - [ --with-frontend[=value] Use THIS frontend as main GUI: - Possible values: xforms,kde,gtk], - [lyx_use_frontend="$withval"], [lyx_use_frontend="xforms"]) -AC_MSG_RESULT($lyx_use_frontend) -lyx_flags="$lyx_flags frontend-$lyx_use_frontend" -AC_SUBST(FRONTEND) -AC_SUBST(FRONTEND_GUILIB) -AC_SUBST(FRONTEND_LDFLAGS) -AC_SUBST(FRONTEND_INCLUDES) -AC_SUBST(FRONTEND_LIBS) -]) -## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- -## Copyright (C) 1996-1999 Free Software Foundation, Inc. -## Originally by Gordon Matzigkeit , 1996 -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -## -## As a special exception to the GNU General Public License, if you -## distribute this file as part of a program that contains a -## configuration script generated by Autoconf, you may include it under -## the same distribution terms that you use for the rest of that program. - -# serial 40 AC_PROG_LIBTOOL -AC_DEFUN(AC_PROG_LIBTOOL, -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl - -# Save cache, so that ltconfig can load it -AC_CACHE_SAVE - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ -DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ -|| AC_MSG_ERROR([libtool configure failed]) - -# Reload cache, that may have been modified by ltconfig -AC_CACHE_LOAD - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log -]) - -AC_DEFUN(AC_LIBTOOL_SETUP, -[AC_PREREQ(2.13)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_RANLIB])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_NM])dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -dnl - -case "$target" in -NONE) lt_target="$host" ;; -*) lt_target="$target" ;; -esac - -# Check for any special flags to pass to ltconfig. -libtool_flags="--cache-file=$cache_file" -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" -test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" -ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], -[libtool_flags="$libtool_flags --enable-dlopen"]) -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[libtool_flags="$libtool_flags --enable-win32-dll"]) -AC_ARG_ENABLE(libtool-lock, - [ --disable-libtool-lock avoid locking (might break parallel builds)]) -test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" -test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case "$lt_target" in -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -]) -esac -]) - -# AC_LIBTOOL_DLOPEN - enable checks for dlopen support -AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) - -# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's -AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) - -# AC_ENABLE_SHARED - implement the --enable-shared flag -# Usage: AC_ENABLE_SHARED[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AC_ENABLE_SHARED, [dnl -define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(shared, -changequote(<<, >>)dnl -<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl -]) - -# AC_DISABLE_SHARED - set the default shared flag to --disable-shared -AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no)]) - -# AC_ENABLE_STATIC - implement the --enable-static flag -# Usage: AC_ENABLE_STATIC[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AC_ENABLE_STATIC, [dnl -define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(static, -changequote(<<, >>)dnl -<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_static=AC_ENABLE_STATIC_DEFAULT)dnl -]) - -# AC_DISABLE_STATIC - set the default static flag to --disable-static -AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no)]) - - -# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag -# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl -define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(fast-install, -changequote(<<, >>)dnl -<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_fast_install=yes ;; -no) enable_fast_install=no ;; -*) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl -]) - -# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install -AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no)]) - -# AC_PROG_LD - find the path to the GNU or non-GNU linker -AC_DEFUN(AC_PROG_LD, -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$ac_cv_prog_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - ac_prog=`($CC -print-prog-name=ld) 2>&5` - case "$ac_prog" in - # Accept absolute paths. -changequote(,)dnl - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' -changequote([,])dnl - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(ac_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - ac_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - ac_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$ac_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_PROG_LD_GNU -]) - -AC_DEFUN(AC_PROG_LD_GNU, -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - ac_cv_prog_gnu_ld=yes -else - ac_cv_prog_gnu_ld=no -fi]) -]) - -# AC_PROG_NM - find the path to a BSD-compatible name lister -AC_DEFUN(AC_PROG_NM, -[AC_MSG_CHECKING([for BSD-compatible nm]) -AC_CACHE_VAL(ac_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - ac_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -B" - break - elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -p" - break - else - ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm -fi]) -NM="$ac_cv_path_NM" -AC_MSG_RESULT([$NM]) -]) - -# AC_CHECK_LIBM - check for math library -AC_DEFUN(AC_CHECK_LIBM, -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case "$lt_target" in -*-*-beos* | *-*-cygwin*) - # These system don't have libm - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, main, LIBM="-lm") - ;; -esac -]) - -# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl convenience library, adds --enable-ltdl-convenience to -# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor -# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed -# to be `${top_builddir}/libltdl'. Make sure you start DIR with -# '${top_builddir}/' (note the single quotes!) if your package is not -# flat, and, if you're not using automake, define top_builddir as -# appropriate in the Makefiles. -AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case "$enable_ltdl_convenience" in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la - INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) -]) - -# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library, and adds --enable-ltdl-install to -# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor -# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed -# to be `${top_builddir}/libltdl'. Make sure you start DIR with -# '${top_builddir}/' (note the single quotes!) if your package is not -# flat, and, if you're not using automake, define top_builddir as -# appropriate in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, main, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la - INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - INCLTDL= - fi -]) - -dnl old names -AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl -AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl -AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl -AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl -AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl -AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl -AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl - -dnl This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL])dnl -# Macro to add for using GNU gettext. -# Ulrich Drepper , 1995. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU Public License -# but which still want to provide support for the GNU gettext functionality. -# Please note that the actual code is *not* freely available. - -# serial 5 - -AC_DEFUN(AM_WITH_NLS, - [AC_MSG_CHECKING([whether NLS is requested]) - dnl Default is enabled NLS - AC_ARG_ENABLE(nls, - [ --disable-nls do not use Native Language Support], - USE_NLS=$enableval, USE_NLS=yes) - AC_MSG_RESULT($USE_NLS) - AC_SUBST(USE_NLS) - - USE_INCLUDED_LIBINTL=no - - dnl If we use NLS figure out what method - if test "$USE_NLS" = "yes"; then - AC_DEFINE(ENABLE_NLS) - AC_MSG_CHECKING([whether included gettext is requested]) - AC_ARG_WITH(included-gettext, - [ --with-included-gettext use the GNU gettext library included here], - nls_cv_force_use_gnu_gettext=$withval, - nls_cv_force_use_gnu_gettext=no) - AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) - - nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" - if test "$nls_cv_force_use_gnu_gettext" != "yes"; then - dnl User does not insist on using GNU NLS library. Figure out what - dnl to use. If gettext or catgets are available (in this order) we - dnl use this. Else we have to fall back to GNU NLS library. - dnl catgets is only used if permitted by option --with-catgets. - nls_cv_header_intl= - nls_cv_header_libgt= - CATOBJEXT=NONE - - AC_CHECK_HEADER(libintl.h, - [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc, - [AC_TRY_LINK([#include ], [return (int) gettext ("")], - gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) - - if test "$gt_cv_func_gettext_libc" != "yes"; then - AC_CHECK_LIB(intl, bindtextdomain, - [AC_CACHE_CHECK([for gettext in libintl], - gt_cv_func_gettext_libintl, - [AC_CHECK_LIB(intl, gettext, -dnl ============== A fix is here! ====================== -dnl -lintl was not added to the LIBS variable in this case - [gt_cv_func_gettext_libintl=yes - INTLLIBS="-lintl"], -dnl ==== end of fix - gt_cv_func_gettext_libintl=no)], - gt_cv_func_gettext_libintl=no)]) - fi - - if test "$gt_cv_func_gettext_libc" = "yes" \ - || test "$gt_cv_func_gettext_libintl" = "yes"; then - AC_DEFINE(HAVE_GETTEXT) - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl - if test "$MSGFMT" != "no"; then - AC_CHECK_FUNCS(dcgettext) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) - AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; - return _nl_msg_cat_cntr], - [CATOBJEXT=.gmo - DATADIRNAME=share], - [CATOBJEXT=.mo - DATADIRNAME=lib]) - INSTOBJEXT=.mo - fi - fi - ]) - - if test "$CATOBJEXT" = "NONE"; then - AC_MSG_CHECKING([whether catgets can be used]) - AC_ARG_WITH(catgets, - [ --with-catgets use catgets functions if available], - nls_cv_use_catgets=$withval, nls_cv_use_catgets=no) - AC_MSG_RESULT($nls_cv_use_catgets) - - if test "$nls_cv_use_catgets" = "yes"; then - dnl No gettext in C library. Try catgets next. - AC_CHECK_LIB(i, main) - AC_CHECK_FUNC(catgets, - [AC_DEFINE(HAVE_CATGETS) - INTLOBJS="\$(CATOBJS)" - AC_PATH_PROG(GENCAT, gencat, no)dnl - if test "$GENCAT" != "no"; then - AC_PATH_PROG(GMSGFMT, gmsgfmt, no) - if test "$GMSGFMT" = "no"; then - AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no) - fi - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.cat - INSTOBJEXT=.cat - DATADIRNAME=lib - INTLDEPS='$(top_builddir)/intl/libintl.a' - INTLLIBS=$INTLDEPS - LIBS=`echo $LIBS | sed -e 's/-lintl//'` - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h - fi]) - fi - fi - - if test "$CATOBJEXT" = "NONE"; then - dnl Neither gettext nor catgets in included in the C library. - dnl Fall back on GNU gettext library. - nls_cv_use_gnu_gettext=yes - fi - fi - - if test "$nls_cv_use_gnu_gettext" = "yes"; then - dnl Mark actions used to generate GNU NLS library. - INTLOBJS="\$(GETTOBJS)" - AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) - AC_SUBST(MSGFMT) - USE_INCLUDED_LIBINTL=yes - CATOBJEXT=.gmo - INSTOBJEXT=.mo - DATADIRNAME=share - INTLDEPS='$(top_builddir)/intl/libintl.a' - INTLLIBS=$INTLDEPS - LIBS=`echo $LIBS | sed -e 's/-lintl//'` - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h - fi - - dnl Test whether we really found GNU xgettext. - if test "$XGETTEXT" != ":"; then - dnl If it is no GNU xgettext we define it as : so that the - dnl Makefiles still can work. - if $XGETTEXT --omit-header /dev/null 2> /dev/null; then - : ; - else - AC_MSG_RESULT( - [found xgettext program is not GNU xgettext; ignore it]) - XGETTEXT=":" - fi - fi - - # We need to process the po/ directory. - POSUB=po - else - DATADIRNAME=share - nls_cv_header_intl=intl/libintl.h - nls_cv_header_libgt=intl/libgettext.h - fi - AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) - AC_OUTPUT_COMMANDS( - [case "$CONFIG_FILES" in *po/Makefile.in*) - sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile - esac]) - - - # If this is used in GNU gettext we have to set USE_NLS to `yes' - # because some of the sources are only built for this goal. - if test "$PACKAGE" = gettext; then - USE_NLS=yes - USE_INCLUDED_LIBINTL=yes - fi - - dnl These rules are solely for the distribution goal. While doing this - dnl we only have to keep exactly one list of the available catalogs - dnl in configure.in. - for lang in $ALL_LINGUAS; do - GMOFILES="$GMOFILES $lang.gmo" - POFILES="$POFILES $lang.po" - done - - dnl Make all variables we use known to autoconf. - AC_SUBST(USE_INCLUDED_LIBINTL) - AC_SUBST(CATALOGS) - AC_SUBST(CATOBJEXT) - AC_SUBST(DATADIRNAME) - AC_SUBST(GMOFILES) - AC_SUBST(INSTOBJEXT) - AC_SUBST(INTLDEPS) - AC_SUBST(INTLLIBS) - AC_SUBST(INTLOBJS) - AC_SUBST(POFILES) - AC_SUBST(POSUB) - ]) - -AC_DEFUN(AM_GNU_GETTEXT, - [AC_REQUIRE([AC_PROG_MAKE_SET])dnl - AC_REQUIRE([AC_PROG_CC])dnl - AC_REQUIRE([AC_PROG_RANLIB])dnl - AC_REQUIRE([AC_ISC_POSIX])dnl - AC_REQUIRE([AC_HEADER_STDC])dnl - AC_REQUIRE([AC_C_CONST])dnl - AC_REQUIRE([AC_C_INLINE])dnl - AC_REQUIRE([AC_TYPE_OFF_T])dnl - AC_REQUIRE([AC_TYPE_SIZE_T])dnl - AC_REQUIRE([AC_FUNC_ALLOCA])dnl - AC_REQUIRE([AC_FUNC_MMAP])dnl - - AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ -unistd.h sys/param.h]) - AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ -strdup __argz_count __argz_stringify __argz_next]) - - if test "${ac_cv_func_stpcpy+set}" != "set"; then - AC_CHECK_FUNCS(stpcpy) - fi - if test "${ac_cv_func_stpcpy}" = "yes"; then - AC_DEFINE(HAVE_STPCPY) - fi - - AM_LC_MESSAGES - AM_WITH_NLS - - if test "x$CATOBJEXT" != "x"; then - if test "x$ALL_LINGUAS" = "x"; then - LINGUAS= - else - AC_MSG_CHECKING(for catalogs to be installed) - NEW_LINGUAS= -dnl ============== Fix is here! ====================== -dnl Some sh do not like substitution in bounds of for loops -dnl for lang in ${LINGUAS=$ALL_LINGUAS}; do - tmplinguas=${LINGUAS=$ALL_LINGUAS} - for lang in ${tmplinguas}; do -dnl ==== end of fix - case "$ALL_LINGUAS" in - *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; - esac - done - LINGUAS=$NEW_LINGUAS - AC_MSG_RESULT($LINGUAS) - fi - - dnl Construct list of names of catalog files to be constructed. - if test -n "$LINGUAS"; then - for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done - fi - fi - - dnl The reference to in the installed file - dnl must be resolved because we cannot expect the users of this - dnl to define HAVE_LOCALE_H. - if test $ac_cv_header_locale_h = yes; then - INCLUDE_LOCALE_H="#include " - else - INCLUDE_LOCALE_H="\ -/* The system does not provide the header . Take care yourself. */" - fi - AC_SUBST(INCLUDE_LOCALE_H) - - dnl Determine which catalog format we have (if any is needed) - dnl For now we know about two different formats: - dnl Linux libc-5 and the normal X/Open format - test -d intl || mkdir intl - if test "$CATOBJEXT" = ".cat"; then - AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen) - - dnl Transform the SED scripts while copying because some dumb SEDs - dnl cannot handle comments. - sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed - fi - dnl po2tbl.sed is always needed. - sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ - $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed - - dnl In the intl/Makefile.in we have a special dependency which makes - dnl only sense for gettext. We comment this out for non-gettext - dnl packages. - if test "$PACKAGE" = "gettext"; then - GT_NO="#NO#" - GT_YES= - else - GT_NO= - GT_YES="#YES#" - fi - AC_SUBST(GT_NO) - AC_SUBST(GT_YES) - - dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly - dnl find the mkinstalldirs script in another subdir but ($top_srcdir). - dnl Try to locate is. - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - AC_SUBST(MKINSTALLDIRS) - - dnl *** For now the libtool support in intl/Makefile is not for real. - l= - AC_SUBST(l) - - dnl Generate list of files to be processed by xgettext which will - dnl be included in po/Makefile. - test -d po || mkdir po - if test "x$srcdir" != "x."; then - if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then - posrcprefix="$srcdir/" - else - posrcprefix="../$srcdir/" - fi - else - posrcprefix="../" - fi - rm -f po/POTFILES - sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ - < $srcdir/po/POTFILES.in > po/POTFILES - ]) -# Check whether LC_MESSAGES is available in . -# Ulrich Drepper , 1995. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU Public License -# but which still want to provide support for the GNU gettext functionality. -# Please note that the actual code is *not* freely available. - -# serial 1 - -AC_DEFUN(AM_LC_MESSAGES, - [if test $ac_cv_header_locale_h = yes; then - AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, - [AC_TRY_LINK([#include ], [return LC_MESSAGES], - am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) - if test $am_cv_val_LC_MESSAGES = yes; then - AC_DEFINE(HAVE_LC_MESSAGES) - fi - fi]) -# Search path for a program which passes the given test. -# Ulrich Drepper , 1996. -# -# This file can be copied and used freely without restrictions. It can -# be used in projects which are not available under the GNU Public License -# but which still want to provide support for the GNU gettext functionality. -# Please note that the actual code is *not* freely available. - -# serial 1 - -dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, -dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) -AC_DEFUN(AM_PATH_PROG_WITH_TEST, -[# Extract the first word of "$2", so it can be a program name with args. -set dummy $2; ac_word=[$]2 -AC_MSG_CHECKING([for $ac_word]) -AC_CACHE_VAL(ac_cv_path_$1, -[case "[$]$1" in - /*) - ac_cv_path_$1="[$]$1" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in ifelse([$5], , $PATH, [$5]); do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if [$3]; then - ac_cv_path_$1="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" -dnl If no 4th arg is given, leave the cache variable unset, -dnl so AC_PATH_PROGS will keep looking. -ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" -])dnl - ;; -esac])dnl -$1="$ac_cv_path_$1" -if test -n "[$]$1"; then - AC_MSG_RESULT([$]$1) -else - AC_MSG_RESULT(no) -fi -AC_SUBST($1)dnl -]) -# Configure paths for Libsigc++ -# Based on Gtk-- script by Erik Andersen and Tero Pulkkinen - -dnl Test for Libsigc++, and define SIGC_CFLAGS and SIGC_LIBS -dnl to be used as follows: -dnl AM_PATH_SIGC(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) -dnl -AC_DEFUN(AM_PATH_SIGC, -[dnl -dnl Get the cflags and libraries from the sigc-config script -dnl - -dnl -dnl Prefix options -dnl -AC_ARG_WITH(sigc-prefix, -[ --with-sigc-prefix=PREFIX - Prefix where libsigc++ is installed (optional)] -, sigc_config_prefix="$withval", sigc_config_prefix="") - -AC_ARG_WITH(sigc-exec-prefix, -[ --with-sigc-exec-prefix=PREFIX - Exec prefix where libsigc++ is installed (optional)] -, sigc_config_exec_prefix="$withval", sigc_config_exec_prefix="") - -AC_ARG_ENABLE(sigctest, -[ --disable-sigctest Do not try to compile and run a test libsigc++ - program], -, enable_sigctest=yes) - -dnl -dnl Prefix handling -dnl - if test x$sigc_config_exec_prefix != x ; then - sigc_config_args="$sigc_config_args --exec-prefix=$sigc_config_exec_prefix" - if test x${SIGC_CONFIG+set} != xset ; then - SIGC_CONFIG=$sigc_config_exec_prefix/bin/sigc-config - fi - fi - if test x$sigc_config_prefix != x ; then - sigc_config_args="$sigc_config_args --prefix=$sigc_config_prefix" - if test x${SIGC_CONFIG+set} != xset ; then - SIGC_CONFIG=$sigc_config_prefix/bin/sigc-config - fi - fi - -dnl -dnl See if sigc-config is alive -dnl - AC_PATH_PROG(SIGC_CONFIG, sigc-config, no) - sigc_version_min=$1 - -dnl -dnl Version check -dnl - AC_MSG_CHECKING(for libsigc++ - version >= $sigc_version_min) - no_sigc="" - if test "$SIGC_CONFIG" = "no" ; then - no_sigc=yes - else - sigc_version=`$SIGC_CONFIG --version` - - SIGC_CFLAGS=`$SIGC_CONFIG $sigc_config_args --cflags` - SIGC_LIBS=`$SIGC_CONFIG $sigc_config_args --libs` - SIGC_MACROS=`$SIGC_CONFIG $sigc_config_args --libs` - - sigc_major_version=`echo $sigc_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sigc_minor_version=`echo $sigc_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sigc_micro_version=`echo $sigc_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - - sigc_major_min=`echo $sigc_version_min | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sigc_minor_min=`echo $sigc_version_min | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sigc_micro_min=`echo $sigc_version_min | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - - sigc_version_proper=`expr \ - $sigc_major_version \> $sigc_major_min \| \ - $sigc_major_version \= $sigc_major_min \& \ - $sigc_minor_version \> $sigc_minor_min \| \ - $sigc_major_version \= $sigc_major_min \& \ - $sigc_minor_version \= $sigc_minor_min \& \ - $sigc_micro_version \>= $sigc_micro_min ` - - if test "$sigc_version_proper" = "1" ; then - AC_MSG_RESULT([$sigc_major_version.$sigc_minor_version.$sigc_micro_version]) - else - AC_MSG_RESULT(no) - no_sigc=yes - fi - - if test "X$no_sigc" = "Xyes" ; then - enable_sigctest=no - fi - - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - -dnl -dnl -dnl - if test "x$enable_sigctest" = "xyes" ; then - AC_MSG_CHECKING(if libsigc++ sane) - ac_save_CXXFLAGS="$CXXFLAGS" - ac_save_LIBS="$LIBS" - CXXFLAGS="$CXXFLAGS $SIGC_CFLAGS" - LIBS="$LIBS $SIGC_LIBS" - - rm -f conf.sigctest - AC_TRY_RUN([ -#include -#include - -#ifdef SIGC_CXX_NAMESPACES -using namespace SigC; -#endif - -int foo1(int i) - { - return 1; - } - -int main(int argc,char **argv) - { - if (sigc_major_version!=$sigc_major_version || - sigc_minor_version!=$sigc_minor_version || - sigc_micro_version!=$sigc_micro_version) - { printf("(%d.%d.%d) ", - sigc_major_version,sigc_minor_version,sigc_micro_version); - return 1; - } - Signal1 sig1; - sig1.connect(slot(foo1)); - sig1(1); - return 0; - } - -],[ - AC_MSG_RESULT(yes) -],[ - AC_MSG_RESULT(no) - no_sigc=yes -] -,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - - dnl - dnl - if test "x$no_sigc" = x ; then - ifelse([$2], , :, [$2]) - else - SIGC_CFLAGS="" - SIGC_LIBS="" - SIGC_MACROS="" - ifelse([$3], , :, [$3]) - fi - - AC_LANG_RESTORE - - AC_SUBST(SIGC_CFLAGS) - AC_SUBST(SIGC_LIBS) - AC_SUBST(SIGC_MACROS) -]) - -# Configure paths and libs when using KDE GUI -## -*- shell-script -*- - -## This file is part of the KDE libraries/packages -## Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu) -## (C) 1997 Stephan Kulow (coolo@kde.org) - -## This file is free software; you can redistribute it and/or -## modify it under the terms of the GNU Library General Public -## License as published by the Free Software Foundation; either -## version 2 of the License, or (at your option) any later version. - -## This library is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## Library General Public License for more details. - -## You should have received a copy of the GNU Library General Public License -## along with this library; see the file COPYING.LIB. If not, write to -## the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -## Boston, MA 02111-1307, USA. - -## IMPORTANT NOTE: -## Please do not modify this file unless you expect your modifications to be -## carried into every other module in the repository. If you decide that you -## really want to modify it, contact coolo@kde.org mentioning that you have -## and that the modified file should be committed to every module. -## -## Single-module modifications are best placed in configure.in for kdelibs -## and kdebase or configure.in.1 if present. - - -## ------------------------------------------------------------------------ -## Find a file (or one of more files in a list of dirs) -## ------------------------------------------------------------------------ -## -AC_DEFUN(AC_FIND_FILE, -[ -$3=NO -for i in $2; -do - for j in $1; - do - if test -r "$i/$j"; then - $3=$i - break 2 - fi - done -done -]) - -AC_DEFUN(KDE_FIND_PATH, -[ - AC_MSG_CHECKING([for $1]) - AC_CACHE_VAL(kde_cv_path_$1, - [ - kde_cv_path_$1="NONE" - if test -n "$$2"; then - kde_cv_path_$1="$$2"; - else - dirs="$3" - kde_save_IFS=$IFS - IFS=':' - for dir in $PATH; do - dirs="$dirs $dir" - done - IFS=$kde_save_IFS - - for dir in $dirs; do - if test -x "$dir/$1"; then - if test -n "$5" - then - evalstr="$dir/$1 $5 2>&1 " - if eval $evalstr; then - kde_cv_path_$1="$dir/$1" - break - fi - else - kde_cv_path_$1="$dir/$1" - break - fi - fi - done - - fi - - ]) - - if test -z "$kde_cv_path_$1" || test "$kde_cv_path_$1" = "NONE"; then - AC_MSG_RESULT(not found) - $4 - else - AC_MSG_RESULT($kde_cv_path_$1) - $2=$kde_cv_path_$1 - fi -]) -AC_DEFUN(KDE_MOC_ERROR_MESSAGE, -[ - AC_MSG_ERROR([No Qt meta object compiler (moc) found! -Please check whether you installed Qt correctly. -You need to have a running moc binary. -configure tried to run $ac_cv_path_moc and the test didn't -succeed. If configure shouldn't have tried this one, set -the environment variable MOC to the right one before running -configure. -]) -]) - -dnl ------------------------------------------------------------------------ -dnl Find the meta object compiler in the PATH, in $QTDIR/bin, and some -dnl more usual places -dnl ------------------------------------------------------------------------ -dnl -AC_DEFUN(AC_PATH_QT_MOC, -[ - KDE_FIND_PATH(moc, MOC, [$ac_qt_bindir $QTDIR/bin \ - /usr/bin /usr/X11R6/bin /usr/lib/qt/bin \ - /usr/local/qt/bin], [KDE_MOC_ERROR_MESSAGE]) - - if test -z "$MOC"; then - if test -n "$ac_cv_path_moc"; then - output=`eval "$ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt"` - fi - echo "configure:__oline__: tried to call $ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt" >&AC_FD_CC - echo "configure:__oline__: moc output: $output" >&AC_FD_CC - - if test -z "$output"; then - KDE_MOC_ERROR_MESSAGE - fi - fi - - AC_SUBST(MOC) -]) - -AC_DEFUN(KDE_REPLACE_ROOT, - $1=`echo "$$1" | sed -e "s#^/#\$\{install_root\}/#"` -) - -AC_DEFUN(AC_CREATE_KFSSTND, -[ -AC_REQUIRE([AC_CHECK_RPATH]) - -if test "$1" = "default"; then - - AC_MSG_CHECKING(for KDE paths) - - if test -z "$kde_htmldir"; then - kde_htmldir="\$(prefix)/share/doc/HTML" - fi - if test -z "$kde_appsdir"; then - kde_appsdir="\$(prefix)/share/applnk" - fi - if test -z "$kde_icondir"; then - kde_icondir="\$(prefix)/share/icons" - fi - if test -z "$kde_sounddir"; then - kde_sounddir="\$(prefix)/share/sounds" - fi - if test -z "$kde_datadir"; then - kde_datadir="\$(prefix)/share/apps" - fi - if test -z "$kde_locale"; then - kde_locale="\$(prefix)/share/locale" - fi - if test -z "$kde_cgidir"; then - kde_cgidir="\$(exec_prefix)/cgi-bin" - fi - if test -z "$kde_confdir"; then - kde_confdir="\$(prefix)/share/config" - fi - if test -z "$kde_mimedir"; then - kde_mimedir="\$(prefix)/share/mimelnk" - fi - if test -z "$kde_toolbardir"; then - kde_toolbardir="\$(prefix)/share/toolbar" - fi - if test -z "$kde_wallpaperdir"; then - kde_wallpaperdir="\$(prefix)/share/wallpapers" - fi - if test -z "$kde_bindir"; then - kde_bindir="\$(exec_prefix)/bin" - fi - if test -z "$kde_partsdir"; then - kde_partsdir="\$(exec_prefix)/parts" - fi - AC_MSG_RESULT(defaults) - -else - -AC_CACHE_VAL(kde_cv_all_paths, -[ -AC_MSG_CHECKING([for kde headers installed]) -AC_LANG_CPLUSPLUS -cat > conftest.$ac_ext < -#include "confdefs.h" -#include - -int main() { -printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); -printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); -printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); -printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); -printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); -printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); -printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); -printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); -printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); -printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); -printf("kde_wallpaperdir=\\"%s\\"\n", KApplication::kde_wallpaperdir().data()); -printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); -printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); -return 0; -} -EOF - -if test -n "$kde_libraries"; then - KDE_TEST_RPATH="-rpath $kde_libraries" -fi - -if test -n "$qt_libraries"; then - KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $qt_libraries" -fi - -if test -n "$x_libraries"; then - KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $x_libraries" -fi - -KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" - -ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext' -if AC_TRY_EVAL(ac_compile); then - AC_MSG_RESULT(yes) -else - AC_MSG_ERROR([your system is not able to compile a small KDE application! -Check, if you installed the KDE header files correctly.]) -fi - -AC_MSG_CHECKING([for kde libraries installed]) -ac_link='/bin/sh ./libtool --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore -lqt -lXext -lX11 $LIBSOCKET $KDE_TEST_RPATH 1>&5' - -if AC_TRY_EVAL(ac_link) && test -s conftest; then - AC_MSG_RESULT(yes) -else - AC_MSG_ERROR([your system fails at linking a small KDE application! -Check, if your compiler is installed correctly and if you have used the -same compiler to compile Qt and kdelibs as you did use now]) -fi - -AC_MSG_CHECKING([for KDE paths]) -if eval `./conftest 2>&5`; then - AC_MSG_RESULT(done) -else - AC_MSG_RESULT(problems) -fi - -./conftest 2> /dev/null >&5 # make an echo for config.log -kde_have_all_paths=yes -AC_LANG_CPLUSPLUS - -if test "$kde_have_all_paths" = "yes"; then -kde_cv_all_paths="kde_have_all_paths=\"yes\" \ - kde_htmldir=\"$kde_htmldir\" \ - kde_appsdir=\"$kde_appsdir\" \ - kde_icondir=\"$kde_icondir\" \ - kde_sounddir=\"$kde_sounddir\" \ - kde_datadir=\"$kde_datadir\" \ - kde_locale=\"$kde_locale\" \ - kde_cgidir=\"$kde_cgidir\" \ - kde_confdir=\"$kde_confdir\" \ - kde_mimedir=\"$kde_mimedir\" \ - kde_toolbardir=\"$kde_toolbardir\" \ - kde_wallpaperdir=\"$kde_wallpaperdir\" \ - kde_bindir=\"$kde_bindir\" \ - kde_partsdir=\"$kde_partsdir\"" -fi -rm -fr conftest* - -]) - -eval "$kde_cv_all_paths" - -if test -z "$kde_htmldir" || test -z "$kde_appsdir" || - test -z "$kde_icondir" || test -z "$kde_sounddir" || - test -z "$kde_datadir" || test -z "$kde_locale" || - test -z "$kde_cgidir" || test -z "$kde_confdir" || - test -z "$kde_mimedir" || test -z "$kde_toolbardir" || - test -z "$kde_wallpaperdir" || test -z "$kde_bindir" || - test -z "$kde_partsdir" || test "$kde_have_all_paths" != "yes"; then - kde_have_all_paths=no - AC_MSG_ERROR([configure could not run a little KDE program to test the environment. -Since it had compiled and linked before, it must be a strange problem on your system. -Look at config.log for details. If you are not able to fix this, please contact Stephan Kulow .]) -fi - -if test -n "$install_root"; then - KDE_REPLACE_ROOT(kde_htmldir) - KDE_REPLACE_ROOT(kde_appsdir) - KDE_REPLACE_ROOT(kde_icondir) - KDE_REPLACE_ROOT(kde_sounddir) - KDE_REPLACE_ROOT(kde_datadir) - KDE_REPLACE_ROOT(kde_locale) - KDE_REPLACE_ROOT(kde_cgidir) - KDE_REPLACE_ROOT(kde_confdir) - KDE_REPLACE_ROOT(kde_mimedir) - KDE_REPLACE_ROOT(kde_toolbardir) - KDE_REPLACE_ROOT(kde_wallpaperdir) - KDE_REPLACE_ROOT(kde_bindir) - KDE_REPLACE_ROOT(kde_partsdir) - AC_SUBST(install_root) -fi - -fi - -bindir=$kde_bindir - -]) - -AC_DEFUN(AC_SUBST_KFSSTND, -[ -AC_SUBST(kde_htmldir) -AC_SUBST(kde_appsdir) -AC_SUBST(kde_icondir) -AC_SUBST(kde_sounddir) -kde_minidir="$kde_icondir/mini" -AC_SUBST(kde_minidir) -AC_SUBST(kde_datadir) -AC_SUBST(kde_locale) -AC_SUBST(kde_cgidir) -AC_SUBST(kde_confdir) -AC_SUBST(kde_mimedir) -AC_SUBST(kde_toolbardir) -AC_SUBST(kde_wallpaperdir) -AC_SUBST(kde_bindir) -AC_SUBST(kde_partsdir) -]) - -AC_DEFUN(KDE_MISC_TESTS, -[ - AC_LANG_C - dnl Checks for libraries. - AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for FreeBSD - AC_SUBST(LIBCOMPAT) - AC_CHECK_LIB(crypt, main, [LIBCRYPT="-lcrypt"]) dnl for BSD - AC_SUBST(LIBCRYPT) - AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) - if test $ac_cv_lib_dnet_dnet_ntoa = no; then - AC_CHECK_LIB(dnet_stub, dnet_ntoa, - [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) - fi - AC_CHECK_FUNC(gethostbyname) - if test $ac_cv_func_gethostbyname = no; then - AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") - fi - AC_CHECK_FUNC(connect) - if test $ac_cv_func_connect = no; then - AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , - $X_EXTRA_LIBS) - fi - - AC_CHECK_FUNC(remove) - if test $ac_cv_func_remove = no; then - AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") - fi - - # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. - AC_CHECK_FUNC(shmat) - if test $ac_cv_func_shmat = no; then - AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc") - fi - - LIBSOCKET=$X_EXTRA_LIBS - AC_SUBST(LIBSOCKET) - AC_SUBST(X_EXTRA_LIBS) - AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4 - AC_SUBST(LIBUCB) - - case $host in dnl this *is* LynxOS specific - *-*-lynxos* ) - AC_MSG_CHECKING([LynxOS header file wrappers]) - [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"] - AC_MSG_RESULT(disabled) - AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS - ;; - esac - -]) - -## ------------------------------------------------------------------------ -## Find the header files and libraries for X-Windows. Extended the -## macro AC_PATH_X -## ------------------------------------------------------------------------ -## -AC_DEFUN(K_PATH_X, -[ -AC_MSG_CHECKING(for X) -AC_CACHE_VAL(ac_cv_have_x, -[# One or both of the vars are not set, and there is no cached value. -ac_x_includes=NO ac_x_libraries=NO -AC_PATH_X_DIRECT -AC_PATH_X_XMKMF -if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then - AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!]) -else - # Record where we found X for the cache. - ac_cv_have_x="have_x=yes \ - ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" -fi])dnl -eval "$ac_cv_have_x" - -if test "$have_x" != yes; then - AC_MSG_RESULT($have_x) - no_x=yes -else - # If each of the values was on the command line, it overrides each guess. - test "x$x_includes" = xNONE && x_includes=$ac_x_includes - test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries - # Update the cache value to reflect the command line values. - ac_cv_have_x="have_x=yes \ - ac_x_includes=$x_includes ac_x_libraries=$x_libraries" - AC_MSG_RESULT([libraries $x_libraries, headers $x_includes]) -fi - -if test -z "$x_includes" || test "x$x_includes" = xNONE; then - X_INCLUDES="" - x_includes="."; dnl better than nothing :- - else - X_INCLUDES="-I$x_includes" -fi - -if test -z "$x_libraries" || test "x$x_libraries" = xNONE; then - X_LDFLAGS="" - x_libraries="/usr/lib"; dnl better than nothing :- - else - X_LDFLAGS="-L$x_libraries" -fi -all_includes="$all_includes $X_INCLUDES" -all_libraries="$all_libraries $X_LDFLAGS" - -AC_SUBST(X_INCLUDES) -AC_SUBST(X_LDFLAGS) -AC_SUBST(x_libraries) -AC_SUBST(x_includes) -]) - -AC_DEFUN(KDE_PRINT_QT_PROGRAM, -[ -AC_LANG_CPLUSPLUS -cat > conftest.$ac_ext < -#include -int main() { - QMovie m; - m.setSpeed(20); - return 0; -} -EOF -]) - -AC_DEFUN(KDE_CHECK_QT_DIRECT, -[ -AC_MSG_CHECKING([if Qt compiles without flags]) -AC_CACHE_VAL(kde_cv_qt_direct, -[ -ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH -ac_LIBRARY_PATH="$LIBRARY_PATH" -ac_cxxflags_safe="$CXXFLAGS" -ac_ldflags_safe="$LDFLAGS" -ac_libs_safe="$LIBS" - -CXXFLAGS="$CXXFLAGS -I$qt_includes" -LDFLAGS="$X_LDFLAGS" -LIBS="-lqt -lXext -lX11 $LIBSOCKET" -LD_LIBRARY_PATH= -export LD_LIBRARY_PATH -LIBRARY_PATH= -export LIBRARY_PATH - -KDE_PRINT_QT_PROGRAM - -if AC_TRY_EVAL(ac_link) && test -s conftest; then - kde_cv_qt_direct="yes" -else - kde_cv_qt_direct="no" - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC -fi -rm -f conftest* -CXXFLAGS="$ac_cxxflags_safe" -LDFLAGS="$ac_ldflags_safe" -LIBS="$ac_libs_safe" - -LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" -export LD_LIBRARY_PATH -LIBRARY_PATH="$ac_LIBRARY_PATH" -export LIBRARY_PATH -]) - -if test "$kde_cv_qt_direct" = "yes"; then - AC_MSG_RESULT(yes) - $1 -else - AC_MSG_RESULT(no) - $2 -fi -]) - -## ------------------------------------------------------------------------ -## Try to find the Qt headers and libraries. -## $(QT_LDFLAGS) will be -Lqtliblocation (if needed) -## and $(QT_INCLUDES) will be -Iqthdrlocation (if needed) -## ------------------------------------------------------------------------ -## -AC_DEFUN(AC_PATH_QT_1_3, -[ -AC_REQUIRE([K_PATH_X]) - -AC_MSG_CHECKING([for Qt]) -ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO -qt_libraries="" -qt_includes="" -AC_ARG_WITH(qt-dir, - [ --with-qt-dir where the root of qt is installed ], - [ ac_qt_includes="$withval"/include - ac_qt_libraries="$withval"/lib - ac_qt_bindir="$withval"/bin - ]) - -AC_ARG_WITH(qt-includes, - [ --with-qt-includes where the Qt includes are. ], - [ - ac_qt_includes="$withval" - ]) - -kde_qt_libs_given=no - -AC_ARG_WITH(qt-libraries, - [ --with-qt-libraries where the Qt library is installed.], - [ ac_qt_libraries="$withval" - kde_qt_libs_given=yes - ]) - -if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then - -AC_CACHE_VAL(ac_cv_have_qt, -[#try to guess Qt locations - -qt_incdirs="$ac_qt_includes /usr/lib/qt/include /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt $x_includes $QTINC" -test -n "$QTDIR" && qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs" -AC_FIND_FILE(qmovie.h, $qt_incdirs, qt_incdir) -ac_qt_includes="$qt_incdir" - -if test ! "$ac_qt_libraries" = "NO"; then - qt_libdirs="$ac_qt_libraries" -fi - -qt_libdirs="$qt_libdirs /usr/lib/qt/lib /usr/X11R6/lib /usr/lib /usr/local/qt/lib /usr/lib/qt $x_libraries $QTLIB" -test -n "$QTDIR" && qt_libdirs="$QTDIR/lib $QTDIR $qt_libdirs" - -test=NONE -qt_libdir=NONE -for dir in $qt_libdirs; do - try="ls -1 $dir/libqt*" - if test=`eval $try 2> /dev/null`; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi -done - -dnl AC_FIND_FILE(libqt.so libqt.so.1.40 libqt.so.1.41 libqt.so.1 libqt.a libqt.sl, $qt_libdirs, qt_libdir) -ac_qt_libraries="$qt_libdir" - -ac_cxxflags_safe="$CXXFLAGS" -ac_ldflags_safe="$LDFLAGS" -ac_libs_safe="$LIBS" - -CXXFLAGS="$CXXFLAGS -I$qt_incdir" -LDFLAGS="-L$qt_libdir $X_LDFLAGS" -LIBS="$LIBS -lqt -lXext -lX11 $LIBSOCKET" - -KDE_PRINT_QT_PROGRAM - -if AC_TRY_EVAL(ac_link) && test -s conftest; then - rm -f conftest* -else - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC - ac_qt_libraries="NO" -fi -rm -f conftest* -CXXFLAGS="$ac_cxxflags_safe" -LDFLAGS="$ac_ldflags_safe" -LIBS="$ac_libs_safe" - -if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then - ac_cv_have_qt="have_qt=no" - ac_qt_notfound="" - if test "$ac_qt_includes" = NO; then - if test "$ac_qt_libraries" = NO; then - ac_qt_notfound="(headers and libraries)"; - else - ac_qt_notfound="(headers)"; - fi - else - ac_qt_notfound="(libraries)"; - fi - - AC_MSG_ERROR([Qt-1.4 $ac_qt_notfound not found. Please check your installation! ]); -else - have_qt="yes" -fi -]) -else - have_qt="yes" -fi - -eval "$ac_cv_have_qt" - -if test "$have_qt" != yes; then - AC_MSG_RESULT([$have_qt]); -else - ac_cv_have_qt="have_qt=yes \ - ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries" - AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes]) - - qt_libraries="$ac_qt_libraries" - qt_includes="$ac_qt_includes" -fi - -if test ! "$kde_qt_libs_given" = "yes"; then -KDE_CHECK_QT_DIRECT(qt_libraries= ,[]) -fi - -AC_SUBST(qt_libraries) -AC_SUBST(qt_includes) - -if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then - QT_INCLUDES=""; -else - QT_INCLUDES="-I$qt_includes" - all_includes="$QT_INCLUDES $all_includes" -fi - -if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then - QT_LDFLAGS="" -else - QT_LDFLAGS="-L$qt_libraries" - all_libraries="$QT_LDFLAGS $all_libraries" -fi - -AC_SUBST(QT_INCLUDES) -AC_SUBST(QT_LDFLAGS) -AC_PATH_QT_MOC -]) - -AC_DEFUN(AC_PATH_QT, -[ -AC_PATH_QT_1_3 -]) - -## ------------------------------------------------------------------------ -## Now, the same with KDE -## $(KDE_LDFLAGS) will be the kdeliblocation (if needed) -## and $(kde_includes) will be the kdehdrlocation (if needed) -## ------------------------------------------------------------------------ -## -AC_DEFUN(AC_BASE_PATH_KDE, -[ -AC_REQUIRE([KDE_MISC_TESTS]) -AC_REQUIRE([AC_PATH_QT])dnl -AC_MSG_CHECKING([for KDE]) - -if test "${prefix}" != NONE; then - kde_includes=${prefix}/include - ac_kde_includes=$prefix/include - - if test "${exec_prefix}" != NONE; then - kde_libraries=${exec_prefix}/lib - ac_kde_libraries=$exec_prefix/lib - else - kde_libraries=${prefix}/lib - ac_kde_libraries=$prefix/lib - fi -else - ac_kde_includes= - ac_kde_libraries= - kde_libraries="" - kde_includes="" -fi - -AC_CACHE_VAL(ac_cv_have_kde, -[#try to guess kde locations - -if test -z "$1"; then - -kde_incdirs="$ac_kde_includes /usr/lib/kde/include /usr/local/kde/include /usr/kde/include /usr/include/kde /usr/include /opt/kde/include $x_includes $qt_includes" -test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR $kde_incdirs" -AC_FIND_FILE(ksock.h, $kde_incdirs, kde_incdir) -ac_kde_includes="$kde_incdir" - -if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/ksock.h"; then - AC_MSG_ERROR([ -in the prefix, you've chosen, are no kde headers installed. This will fail. -So, check this please and use another prefix!]) -fi - -kde_libdirs="$ac_kde_libraries /usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib /usr/X11R6/lib /opt/kde/lib /usr/X11R6/kde/lib" -test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs" -AC_FIND_FILE(libkdecore.la, $kde_libdirs, kde_libdir) -ac_kde_libraries="$kde_libdir" - -if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/libkdecore.la"; then -AC_MSG_ERROR([ -in the prefix, you've chosen $ac_kde_libraries, are no kde libraries installed. This will fail. -So, check this please and use another prefix!]) -fi -ac_kde_libraries="$kde_libdir" - -if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then - ac_cv_have_kde="have_kde=no" -else - ac_cv_have_kde="have_kde=yes \ - ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" -fi - -else dnl test -z $1 - - ac_cv_have_kde="have_kde=no" - -fi -])dnl - -eval "$ac_cv_have_kde" - -if test "$have_kde" != "yes"; then - if test "${prefix}" = NONE; then - ac_kde_prefix="$ac_default_prefix" - else - ac_kde_prefix="$prefix" - fi - if test "$exec_prefix" = NONE; then - ac_kde_exec_prefix="$ac_kde_prefix" - AC_MSG_RESULT([will be installed in $ac_kde_prefix]) - else - ac_kde_exec_prefix="$exec_prefix" - AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix]) - fi - - kde_libraries="${ac_kde_exec_prefix}/lib" - kde_includes=${ac_kde_prefix}/include - -else - ac_cv_have_kde="have_kde=yes \ - ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" - AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes]) - - kde_libraries="$ac_kde_libraries" - kde_includes="$ac_kde_includes" -fi -AC_SUBST(kde_libraries) -AC_SUBST(kde_includes) - -if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" ; then - KDE_INCLUDES="" -else - KDE_INCLUDES="-I$kde_includes" - all_includes="$KDE_INCLUDES $all_includes" -fi - -if test "$kde_libraries" = "$x_libraries" || test "$kde_libraries" = "$qt_libraries" ; then - KDE_LDFLAGS="" -else - KDE_LDFLAGS="-L$kde_libraries" - all_libraries="$KDE_LDFLAGS $all_libraries" -fi - -AC_SUBST(KDE_LDFLAGS) -AC_SUBST(KDE_INCLUDES) - -KDE_CHECK_EXTRA_LIBS - -AC_SUBST(all_includes) -AC_SUBST(all_libraries) - -]) - -AC_DEFUN(KDE_CHECK_EXTRA_LIBS, -[ -AC_MSG_CHECKING(for extra includes) -AC_ARG_WITH(extra-includes, [ --with-extra-includes adds non standard include paths], - kde_use_extra_includes="$withval", - kde_use_extra_includes=NONE -) -if test -n "$kde_use_extra_includes" && \ - test "$kde_use_extra_includes" != "NONE"; then - - ac_save_ifs=$IFS - IFS=':' - for dir in $kde_use_extra_includes; do - all_includes="$all_includes -I$dir" - USER_INCLUDES="$USER_INCLUDES -I$dir" - done - IFS=$ac_save_ifs - kde_use_extra_includes="added" -else - kde_use_extra_includes="no" -fi - -AC_MSG_RESULT($kde_use_extra_includes) - -AC_MSG_CHECKING(for extra libs) -AC_ARG_WITH(extra-libs, [ --with-extra-libs adds non standard library paths], - kde_use_extra_libs=$withval, - kde_use_extra_libs=NONE -) -if test -n "$kde_use_extra_libs" && \ - test "$kde_use_extra_libs" != "NONE"; then - - ac_save_ifs=$IFS - IFS=':' - for dir in $kde_use_extra_libs; do - all_libraries="$all_libraries -L$dir" - KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -rpath $dir" - USER_LDFLAGS="$USER_LDFLAGS -L$dir" - done - IFS=$ac_save_ifs - kde_use_extra_libs="added" -else - kde_use_extra_libs="no" -fi - -AC_MSG_RESULT($kde_use_extra_libs) - -]) - -AC_DEFUN(KDE_CHECK_KIMGIO, -[ - AC_REQUIRE([AC_FIND_TIFF]) - AC_REQUIRE([AC_FIND_JPEG]) - AC_REQUIRE([AC_FIND_PNG]) - - LIB_KIMGIO='-lkimgio $(LIBJPEG) $(LIBTIFF) $(LIBPNG) -lm' - AC_SUBST(LIB_KIMGIO) - LIB_KHTMLW='-lkhtmlw $(LIB_KIMGIO) -ljscript' - AC_SUBST(LIB_KHTMLW) - LIB_KHTML='-lkhtml $(LIB_KIMGIO) -ljscript' - AC_SUBST(LIB_KHTML) -]) - -AC_DEFUN(KDE_CREATE_LIBS_ALIASES, -[ - AC_REQUIRE([KDE_MISC_TESTS]) - - KDE_LIBS='-lqt -lkdecore -lkdeui -lkfm -lkfile' - AC_SUBST(KDE_LIBS) -# LIB_X11='-lX11 $(LIBSOCKET)' -# AC_SUBST(LIB_X11) -# LIB_QT='-lqt $(LIB_X11)' -# AC_SUBST(LIB_QT) -# LIB_KDECORE='-lkdecore -lXext $(LIB_QT)' -# AC_SUBST(LIB_KDECORE) -# LIB_KDEUI='-lkdeui $(LIB_KDECORE)' -# AC_SUBST(LIB_KDEUI) -# LIB_KFM='-lkfm $(LIB_KDECORE)' -# AC_SUBST(LIB_KFM) -# LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)' -# AC_SUBST(LIB_KFILE) -]) - -AC_DEFUN(AC_PATH_KDE, -[ - AC_BASE_PATH_KDE - AC_ARG_ENABLE(path-check, [ --disable-path-check don't try to find out, where to install], - [ - if test "$enableval" = "no"; - then ac_use_path_checking="default" - else ac_use_path_checking="" - fi - ], [ac_use_path_checking=""] - ) - - AC_ARG_WITH(install-root, [ --with-install-root the root, where to install to [default=/]], - [ - if test "$withval" = "no"; - then kde_install_root=""; - else kde_install_root=$withval; - fi - ], [kde_install_root=""] - ) - - if test -n "$kde_install_root"; then - install_root="$kde_install_root" - else - install_root= - fi - - AC_CREATE_KFSSTND($ac_use_path_checking) - - AC_SUBST_KFSSTND - KDE_CREATE_LIBS_ALIASES -]) - -dnl slightly changed version of AC_CHECK_FUNC(setenv) -AC_DEFUN(AC_CHECK_SETENV, -[AC_MSG_CHECKING([for setenv]) -AC_CACHE_VAL(ac_cv_func_setenv, -[AC_LANG_C -AC_TRY_LINK( -dnl Don't include because on OSF/1 3.0 it includes -dnl which includes which contains a prototype for -dnl select. Similarly for bzero. -[#include -]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus -extern "C" -#endif -])dnl -[/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -#include -], [ -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$1) || defined (__stub___$1) -choke me -#else -setenv("TEST", "alle", 1); -#endif -], eval "ac_cv_func_setenv=yes", eval "ac_cv_func_setenv=no")]) - -if test "$ac_cv_func_setenv" = "yes"; then - AC_MSG_RESULT(yes) - AC_DEFINE_UNQUOTED(HAVE_FUNC_SETENV) -else - AC_MSG_RESULT(no) -fi -]) - -AC_DEFUN(AC_CHECK_GETDOMAINNAME, -[ -AC_LANG_CPLUSPLUS -save_CXXFLAGS="$CXXFLAGS" -if test "$GCC" = "yes"; then -CXXFLAGS="$CXXFLAGS -pedantic-errors" -fi -AC_MSG_CHECKING(for getdomainname) -AC_CACHE_VAL(ac_cv_func_getdomainname, -[ -AC_TRY_COMPILE([ -#include -#include -], -[ -char buffer[200]; -getdomainname(buffer, 200); -], -ac_cv_func_getdomainname=yes, -ac_cv_func_getdomainname=no) -]) -AC_MSG_RESULT($ac_cv_func_getdomainname) -if eval "test \"`echo `$ac_cv_func_getdomainname\" = yes"; then - AC_DEFINE(HAVE_GETDOMAINNAME) -fi -CXXFLAGS="$save_CXXFLAGS" -]) - -AC_DEFUN(AC_CHECK_GETHOSTNAME, -[ -AC_LANG_CPLUSPLUS -save_CXXFLAGS="$CXXFLAGS" -if test "$GCC" = "yes"; then -CXXFLAGS="$CXXFLAGS -pedantic-errors" -fi - -AC_MSG_CHECKING([for gethostname]) -AC_CACHE_VAL(ac_cv_func_gethostname, -[ -AC_TRY_COMPILE([ -#include -#include -], -[ -char buffer[200]; -gethostname(buffer, 200); -], -ac_cv_func_gethostname=yes, -ac_cv_func_gethostname=no) -]) -AC_MSG_RESULT($ac_cv_func_gethostname) -if eval "test \"`echo `$ac_cv_func_gethostname\" = yes"; then - AC_DEFINE(HAVE_GETHOSTNAME) -fi -CXXFLAGS="$save_CXXFLAGS" -]) - -AC_DEFUN(AC_CHECK_USLEEP, -[ -AC_LANG_CPLUSPLUS - -AC_MSG_CHECKING([for usleep]) -AC_CACHE_VAL(ac_cv_func_usleep, -[ -ac_libs_safe="$LIBS" -LIBS="$LIBS $LIBUCB" -AC_TRY_LINK([ -#include -#include -], -[ -usleep(200); -], -ac_cv_func_usleep=yes, -ac_cv_func_usleep=no) -]) -AC_MSG_RESULT($ac_cv_func_usleep) -if eval "test \"`echo `$ac_cv_func_usleep\" = yes"; then - AC_DEFINE(HAVE_USLEEP) -fi -LIBS="$ac_libs_safe" -]) - -AC_DEFUN(AC_FIND_GIF, - [AC_MSG_CHECKING([for giflib]) -AC_CACHE_VAL(ac_cv_lib_gif, -[ac_save_LIBS="$LIBS" -LIBS="$all_libraries -lgif -lX11 $LIBSOCKET" -AC_TRY_LINK(dnl -[ -#ifdef __cplusplus -extern "C" { -#endif -int GifLastError(void); -#ifdef __cplusplus -} -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -], - [return GifLastError();], - eval "ac_cv_lib_gif=yes", - eval "ac_cv_lib_gif=no") -LIBS="$ac_save_LIBS" -])dnl -if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then - AC_MSG_RESULT(yes) - AC_DEFINE_UNQUOTED(HAVE_LIBGIF) -else - AC_MSG_ERROR(You need giflib23. Please install the kdesupport package) -fi -]) - -AC_DEFUN(AC_FIND_JPEG, - [AC_MSG_CHECKING([for jpeglib]) -AC_CACHE_VAL(ac_cv_lib_jpeg, -[ac_save_LIBS="$LIBS" -LIBS="$all_libraries -ljpeg -lm" -AC_TRY_LINK( -[/* Override any gcc2 internal prototype to avoid an error. */ -struct jpeg_decompress_struct; -typedef struct jpeg_decompress_struct * j_decompress_ptr; -typedef int size_t; -#ifdef __cplusplus -extern "C" { -#endif - void jpeg_CreateDecompress(j_decompress_ptr cinfo, - int version, size_t structsize); -#ifdef __cplusplus -} -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -], - [jpeg_CreateDecompress(0L, 0, 0);], - eval "ac_cv_lib_jpeg=-ljpeg", - eval "ac_cv_lib_jpeg=no") -LIBS="$ac_save_LIBS" - -dnl what to do, if the normal way fails: -if eval "test \"`echo $ac_cv_lib_jpeg`\" = no"; then - if test -f "$kde_libraries/libjpeg.so"; then - test -f ./libjpegkde.so || $LN_S $kde_libraries/libjpeg.so ./libjpegkde.so - ac_cv_lib_jpeg="-L\${topdir} -ljpegkde" - else if test -f "$kde_libraries/libjpeg.sl"; then - test -f ./libjpegkde.sl ||$LN_S $kde_libraries/libjpeg.sl ./libjpegkde.sl - ac_cv_lib_jpeg="-L\${topdir} -ljpegkde" - else if test -f "$kde_libraries/libjpeg.a"; then - test -f ./libjpegkde.a || $LN_S $kde_libraries/libjpeg.a ./libjpegkde.a - ac_cv_lib_jpeg="-L\${topdir} -ljpegkde" - else - AC_MSG_ERROR([ -You need jpeglib6a. Please install the kdesupport package. -If you have already installed kdesupport, you may have an -old libjpeg somewhere. -In this case copy $KDEDIR/lib/libjpeg* to /usr/lib. -]) - fi - fi - fi -fi -])dnl -if eval "test ! \"`echo $ac_cv_lib_jpeg`\" = no"; then - LIBJPEG="$ac_cv_lib_jpeg" - AC_SUBST(LIBJPEG) - AC_MSG_RESULT($ac_cv_lib_jpeg) - AC_DEFINE_UNQUOTED(HAVE_LIBJPEG) -fi -]) - -AC_DEFUN(AC_FIND_ZLIB, -[ -AC_MSG_CHECKING([for libz]) -AC_CACHE_VAL(ac_cv_lib_z, -[ac_save_LIBS="$LIBS" -LIBS="$all_libraries -lz $LIBSOCKET" -AC_TRY_LINK(dnl -[ -#include -], - [return (zlibVersion() == ZLIB_VERSION); ], - eval "ac_cv_lib_z='-lz'", - eval "ac_cv_lib_z=no") -LIBS="$ac_save_LIBS" -])dnl -if eval "test ! \"`echo $ac_cv_lib_z`\" = no"; then -dnl AC_DEFINE_UNQUOTED(HAVE_LIBZ) - LIBZ="$ac_cv_lib_z" - AC_SUBST(LIBZ) - AC_MSG_RESULT($ac_cv_lib_z) -else - AC_MSG_RESULT(no) - LIBZ="" - AC_SUBST(LIBZ) -fi -]) - -AC_DEFUN(AC_FIND_TIFF, -[ -AC_REQUIRE([AC_FIND_ZLIB]) -AC_REQUIRE([AC_FIND_JPEG]) -AC_MSG_CHECKING([for libtiff]) -AC_CACHE_VAL(ac_cv_lib_tiff, -[ac_save_LIBS="$LIBS" -LIBS="$all_libraries -ltiff $LIBJPEG $LIBZ -lX11 $LIBSOCKET" -AC_TRY_LINK(dnl -[ -#include -], - [return (TIFFOpen( "", "r") == 0); ], - eval "ac_cv_lib_tiff='-ltiff $LIBJPEG $LIBZ'", - eval "ac_cv_lib_tiff=no") -LIBS="$ac_save_LIBS" -])dnl -if eval "test ! \"`echo $ac_cv_lib_tiff`\" = no"; then - AC_DEFINE_UNQUOTED(HAVE_LIBTIFF) - LIBTIFF="$ac_cv_lib_tiff" - AC_SUBST(LIBTIFF) - AC_MSG_RESULT($ac_cv_lib_tiff) -else - AC_MSG_RESULT(no) - LIBTIFF="" - AC_SUBST(LIBTIFF) -fi -]) - - -AC_DEFUN(AC_FIND_PNG, -[ -AC_REQUIRE([AC_FIND_ZLIB]) -AC_MSG_CHECKING([for libpng]) -AC_CACHE_VAL(ac_cv_lib_png, -[ac_save_LIBS="$LIBS" -LIBS="$all_libraries -lpng $LIBZ -lm -lX11 $LIBSOCKET" -AC_LANG_C -AC_TRY_LINK(dnl - [ - #include - ], - [ - png_structp png_ptr = png_create_read_struct( // image ptr - PNG_LIBPNG_VER_STRING, 0, 0, 0 ); - return( png_ptr != 0 ); - ], - eval "ac_cv_lib_png='-lpng $LIBZ -lm'", - eval "ac_cv_lib_png=no") - LIBS="$ac_save_LIBS" -])dnl -if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then - AC_DEFINE_UNQUOTED(HAVE_LIBPNG) - LIBPNG="$ac_cv_lib_png" - AC_SUBST(LIBPNG) - AC_MSG_RESULT($ac_cv_lib_png) -else - AC_MSG_RESULT(no) - LIBPNG="" - AC_SUBST(LIBPNG) -fi -]) - -AC_DEFUN(AC_CHECK_GNU_EXTENSIONS, -[ -AC_MSG_CHECKING(if you need GNU extensions) -AC_CACHE_VAL(ac_cv_gnu_extensions, -[ -cat > conftest.c << EOF -#include - -#ifdef __GNU_LIBRARY__ -yes -#endif -EOF - -if (eval "$ac_cpp conftest.c") 2>&5 | - egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_gnu_extensions=yes -else - ac_cv_gnu_extensions=no -fi -]) - -AC_MSG_RESULT($ac_cv_gnu_extensions) -if test "$ac_cv_gnu_extensions" = "yes"; then - AC_DEFINE_UNQUOTED(_GNU_SOURCE) -fi -]) - -AC_DEFUN(AC_CHECK_COMPILERS, -[ - dnl this is somehow a fat lie, but prevents other macros from double checking - AC_PROVIDE([AC_PROG_CC]) - AC_PROVIDE([AC_PROG_CPP]) - AC_ARG_ENABLE(debug,[ --enable-debug creates debugging code [default=no]], - [ - if test $enableval = "no"; dnl - then ac_use_debug_code="no" - else ac_use_debug_code="yes" - fi - ], [ac_use_debug_code="no"]) - - AC_ARG_ENABLE(strict,[ --enable-strict compiles with strict compiler options (may not work!)], - [ - if test $enableval = "no"; then - ac_use_strict_options="no" - else - ac_use_strict_options="yes" - fi - ], [ac_use_strict_options="no"]) - -dnl this was AC_PROG_CC. I had to include it manualy, since I had to patch it - AC_MSG_CHECKING(for a C-Compiler) - dnl if there is one, print out. if not, don't matter - AC_MSG_RESULT($CC) - - if test -z "$CC"; then AC_CHECK_PROG(CC, gcc, gcc) fi - if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi - if test -z "$CC"; then AC_CHECK_PROG(CC, xlc, xlc) fi - test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) - - AC_PROG_CC_WORKS - AC_PROG_CC_GNU - - if test $ac_cv_prog_gcc = yes; then - GCC=yes - else - GCC= - fi - - if test -z "$CFLAGS"; then - if test "$ac_use_debug_code" = "yes"; then - AC_PROG_CC_G - if test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g" - fi - else - if test "$GCC" = "yes"; then - CFLAGS="-O2" - else - CFLAGS="" - fi - fi - - if test "$GCC" = "yes"; then - CFLAGS="$CFLAGS -Wall" - - if test "$ac_use_strict_options" = "yes"; then - CFLAGS="$CFLAGS -W -ansi -pedantic" - fi - fi - - fi - - case "$host" in - *-*-sysv4.2uw*) CFLAGS="$CFLAGS -D_UNIXWARE";; - esac - - if test -z "$LDFLAGS" && test "$ac_use_debug_code" = "no" && test "$GCC" = "yes"; then - LDFLAGS="-s" - fi - - -dnl this is AC_PROG_CPP. I had to include it here, since autoconf checks -dnl dependecies between AC_PROG_CPP and AC_PROG_CC (or is it automake?) - - AC_MSG_CHECKING(how to run the C preprocessor) - # On Suns, sometimes $CPP names a directory. - if test -n "$CPP" && test -d "$CPP"; then - CPP= - fi - if test -z "$CPP"; then - AC_CACHE_VAL(ac_cv_prog_CPP, - [ # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - dnl Use a header file that comes with gcc, so configuring glibc - dnl with a fresh cross-compiler works. - AC_TRY_CPP([#include - Syntax Error], , - CPP="${CC-cc} -E -traditional-cpp" - AC_TRY_CPP([#include - Syntax Error], , CPP=/lib/cpp)) - ac_cv_prog_CPP="$CPP"])dnl - CPP="$ac_cv_prog_CPP" - else - ac_cv_prog_CPP="$CPP" - fi - AC_MSG_RESULT($CPP) - AC_SUBST(CPP)dnl - - - AC_MSG_CHECKING(for a C++-Compiler) - dnl if there is one, print out. if not, don't matter - AC_MSG_RESULT($CXX) - - if test -z "$CXX"; then AC_CHECK_PROG(CXX, g++, g++) fi - if test -z "$CXX"; then AC_CHECK_PROG(CXX, CC, CC) fi - if test -z "$CXX"; then AC_CHECK_PROG(CXX, xlC, xlC) fi - if test -z "$CXX"; then AC_CHECK_PROG(CXX, DCC, DCC) fi - test -z "$CXX" && AC_MSG_ERROR([no acceptable C++-compiler found in \$PATH]) - - AC_PROG_CXX_WORKS - AC_PROG_CXX_GNU - - if test $ac_cv_prog_gxx = yes; then - GXX=yes - else - AC_MSG_CHECKING(whether we are using SPARC CC) - GXX= - cat > conftest.C << EOF -#ifdef __SUNPRO_CC - yes; -#endif -EOF - - ac_try="$CXX -E conftest.C" - if { (eval echo configure:__online__: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_CC=yes - else - ac_cv_prog_CC=no - fi - AC_MSG_RESULT($ac_cv_prog_CC) - fi - - if test -z "$CXXFLAGS"; then - if test "$ac_use_debug_code" = "yes"; then - AC_PROG_CXX_G - if test $ac_cv_prog_cxx_g = yes; then - CXXFLAGS="-g" - fi - if test "$ac_cv_prog_CC" = "yes"; then - CXXFLAGS="$CXXFLAGS -pto" - fi - else - if test "$GXX" = "yes"; then - CXXFLAGS="-O2" - else - if test "$ac_cv_prog_CC" = "yes"; then - CXXFLAGS="-pto -O2" - else - CXXFLAGS="" - fi - fi - fi - - if test "$GXX" = "yes"; then - CXXFLAGS="$CXXFLAGS -Wall" - - if test "$ac_use_strict_options" = "yes"; then - CXXFLAGS="$CXXFLAGS -W -ansi -Wtraditional -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Woverloaded-virtual -Wbad-function-cast -Wsynth" - fi - - if test "$kde_very_strict" = "yes"; then - CXXFLAGS="$CXXFLAGS -Wold-style-cast -Wshadow -Wredundant-decls -Wconversion" - fi - fi - fi - - case "$host" in - *-*-sysv4.2uw*) CXXFLAGS="$CXXFLAGS -D_UNIXWARE";; - esac - -]) - -dnl just a wrapper to clean up configure.in -AC_DEFUN(KDE_PROG_LIBTOOL, -[ -AC_REQUIRE([AM_ENABLE_SHARED]) -AC_REQUIRE([AM_ENABLE_STATIC]) -dnl libtool is only for C, so I must force him -dnl to find the correct flags for C++ -ac_save_cc=$CC -ac_save_cflags="$CFLAGS" -CC=$CXX -CFLAGS="$CXXFLAGS" -AM_PROG_LIBTOOL dnl for libraries -CC=$ac_save_cc -CFLAGS="$ac_save_cflags" -]) - -AC_DEFUN(KDE_DO_IT_ALL, -[ -AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) -KDE_PROG_LIBTOOL -AM_KDE_WITH_NLS -AC_PATH_KDE -]) - -AC_DEFUN(AC_CHECK_RPATH, -[ -AC_MSG_CHECKING(for rpath) -AC_ARG_ENABLE(rpath, - [ --disable-rpath do not use the rpath feature of ld], - USE_RPATH=$enableval, USE_RPATH=yes) -if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then - - KDE_RPATH="-rpath \$(kde_libraries)" - - if test -n "$qt_libraries"; then - KDE_RPATH="$KDE_RPATH -rpath \$(qt_libraries)" - fi - dnl $x_libraries is set to /usr/lib in case - if test -n "$X_LDFLAGS"; then - KDE_RPATH="$KDE_RPATH -rpath \$(x_libraries)" - fi - if test -n "$KDE_EXTRA_RPATH"; then - KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)" - fi -fi -AC_SUBST(KDE_EXTRA_RPATH) -AC_SUBST(KDE_RPATH) -AC_MSG_RESULT($USE_RPATH) -]) - -dnl This is a merge of some macros out of the gettext aclocal.m4 -dnl since we don't need anything, I took the things we need -AC_DEFUN(AM_KDE_WITH_NLS, - [AC_MSG_CHECKING([whether NLS is requested]) - AC_LANG_CPLUSPLUS - dnl Default is enabled NLS - AC_ARG_ENABLE(nls, - [ --disable-nls do not use Native Language Support], - USE_NLS=$enableval, USE_NLS=yes) - AC_MSG_RESULT($USE_NLS) - AC_SUBST(USE_NLS) - - dnl If we use NLS figure out what method - if test "$USE_NLS" = "yes"; then - AC_DEFINE(ENABLE_NLS) - - AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, - [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt) - AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) - - if test -z "`$MSGFMT --version 2>&1 | grep 'GNU gettext'`"; then - AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it]) - msgfmt=":" - fi - AC_SUBST(MSGFMT) - - AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext, - [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) - - dnl Test whether we really found GNU xgettext. - if test "$XGETTEXT" != ":"; then - dnl If it is no GNU xgettext we define it as : so that the - dnl Makefiles still can work. - if $XGETTEXT --omit-header /dev/null 2> /dev/null; then - : ; - else - AC_MSG_RESULT( - [found xgettext programs is not GNU xgettext; ignore it]) - XGETTEXT=":" - fi - fi - AC_SUBST(XGETTEXT) - fi - - ]) - -# Search path for a program which passes the given test. -# Ulrich Drepper , 1996. - -# serial 1 -# Stephan Kulow: I appended a _KDE against name conflicts - -dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, -dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) -AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE, -[# Extract the first word of "$2", so it can be a program name with args. -set dummy $2; ac_word=[$]2 -AC_MSG_CHECKING([for $ac_word]) -AC_CACHE_VAL(ac_cv_path_$1, -[case "[$]$1" in - /*) - ac_cv_path_$1="[$]$1" # Let the user override the test with a path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in ifelse([$5], , $PATH, [$5]); do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if [$3]; then - ac_cv_path_$1="$ac_dir/$ac_word" - break - fi - fi - done - IFS="$ac_save_ifs" -dnl If no 4th arg is given, leave the cache variable unset, -dnl so AC_PATH_PROGS will keep looking. -ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" -])dnl - ;; -esac])dnl -$1="$ac_cv_path_$1" -if test -n "[$]$1"; then - AC_MSG_RESULT([$]$1) -else - AC_MSG_RESULT(no) -fi -AC_SUBST($1)dnl -]) - - -dnl From Jim Meyering. -dnl FIXME: migrate into libit. - -AC_DEFUN(AM_FUNC_OBSTACK, -[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, - [AC_TRY_LINK([#include "obstack.h"], - [struct obstack *mem;obstack_free(mem,(char *) 0)], - am_cv_func_obstack=yes, - am_cv_func_obstack=no)]) - if test $am_cv_func_obstack = yes; then - AC_DEFINE(HAVE_OBSTACK) - else - LIBOBJS="$LIBOBJS obstack.o" - fi -]) - -dnl From Jim Meyering. Use this if you use the GNU error.[ch]. -dnl FIXME: Migrate into libit - -AC_DEFUN(AM_FUNC_ERROR_AT_LINE, -[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, - [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], - am_cv_lib_error_at_line=yes, - am_cv_lib_error_at_line=no)]) - if test $am_cv_lib_error_at_line = no; then - LIBOBJS="$LIBOBJS error.o" - fi - AC_SUBST(LIBOBJS)dnl -]) - -# Macro to add for using GNU gettext. -# Ulrich Drepper , 1995. - -# serial 1 -# Stephan Kulow: I put a KDE in it to avoid name conflicts - -AC_DEFUN(AM_KDE_GNU_GETTEXT, - [AC_REQUIRE([AC_PROG_MAKE_SET])dnl - AC_REQUIRE([AC_PROG_RANLIB])dnl - AC_REQUIRE([AC_HEADER_STDC])dnl - AC_REQUIRE([AC_C_INLINE])dnl - AC_REQUIRE([AC_TYPE_OFF_T])dnl - AC_REQUIRE([AC_TYPE_SIZE_T])dnl - AC_REQUIRE([AC_FUNC_ALLOCA])dnl - AC_REQUIRE([AC_FUNC_MMAP])dnl - AC_REQUIRE([AM_KDE_WITH_NLS])dnl - AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ -unistd.h values.h alloca.h]) - AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ -__argz_count __argz_stringify __argz_next stpcpy]) - - AM_LC_MESSAGES - - if test "x$CATOBJEXT" != "x"; then - if test "x$ALL_LINGUAS" = "x"; then - LINGUAS= - else - AC_MSG_CHECKING(for catalogs to be installed) - NEW_LINGUAS= - for lang in ${LINGUAS=$ALL_LINGUAS}; do - case "$ALL_LINGUAS" in - *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; - esac - done - LINGUAS=$NEW_LINGUAS - AC_MSG_RESULT($LINGUAS) - fi - - dnl Construct list of names of catalog files to be constructed. - if test -n "$LINGUAS"; then - for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done - fi - fi - - ]) - -AC_DEFUN(AC_HAVE_XPM, - [AC_REQUIRE_CPP()dnl - - test -z "$XPM_LDFLAGS" && XPM_LDFLAGS= - test -z "$XPM_INCLUDE" && XPM_INCLUDE= - - AC_ARG_WITH(xpm, [ --without-xpm disable color pixmap XPM tests], - xpm_test=$withval, xpm_test="yes") - if test "x$xpm_test" = xno; then - ac_cv_have_xpm=no - else - AC_MSG_CHECKING(for XPM) - AC_CACHE_VAL(ac_cv_have_xpm, - [ - AC_LANG_C - ac_save_ldflags="$LDFLAGS" - ac_save_cflags="$CFLAGS" - LDFLAGS="$LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBSOCKET" - CFLAGS="$CFLAGS $X_INCLUDES" - test ! -z "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS" - AC_TRY_LINK([#include ],[], - ac_cv_have_xpm="yes",ac_cv_have_xpm="no") - LDFLAGS="$ac_save_ldflags" - CFLAGS="$ac_save_cflags" - ])dnl - - if test "$ac_cv_have_xpm" = no; then - AC_MSG_RESULT(no) - XPM_LDFLAGS="" - XPMINC="" - $2 - else - AC_DEFINE(HAVE_XPM) - if test "$XPM_LDFLAGS" = ""; then - XPMLIB="-lXpm" - else - XPMLIB="-L$XPM_LDFLAGS -lXpm" - fi - if test "$XPM_INCLUDE" = ""; then - XPMINC="" - else - XPMINC="-I$XPM_INCLUDE" - fi - AC_MSG_RESULT(yes) - $1 - fi - fi - AC_SUBST(XPMINC) - AC_SUBST(XPMLIB) -]) - -AC_DEFUN(AC_HAVE_GL, - [AC_REQUIRE_CPP()dnl - - test -z "$GL_LDFLAGS" && GL_LDFLAGS= - test -z "$GL_INCLUDE" && GL_INCLUDE= - - AC_ARG_WITH(gl, [ --without-gl disable 3D GL modes], - gl_test=$withval, gl_test="yes") - if test "x$gl_test" = xno; then - ac_cv_have_gl=no - else - AC_MSG_CHECKING(for GL) - AC_CACHE_VAL(ac_cv_have_gl, - [ - AC_LANG_C - ac_save_ldflags="$LDFLAGS" - ac_save_cflags="$CFLAGS" - LDFLAGS="$LDFLAGS $GL_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET" - CFLAGS="$CFLAGS $X_INCLUDES" - test ! -z "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" - AC_TRY_LINK([],[], - ac_cv_have_gl="yes",ac_cv_have_gl="no") - LDFLAGS="$ac_save_ldflags" - CFLAGS="$ac_save_cflags" - ])dnl - - if test "$ac_cv_have_gl" = no; then - AC_MSG_RESULT(no) - GL_LDFLAGS="" - GLINC="" - $2 - else - AC_DEFINE(HAVE_GL) - if test "$GL_LDFLAGS" = ""; then - GLLIB="-lMesaGL -lMesaGLU" - else - GLLIB="-L$GL_LDFLAGS -lMesaGL -lMesaGLU" - fi - if test "$GL_INCLUDE" = ""; then - GLINC="" - else - GLINC="-I$GL_INCLUDE" - fi - AC_MSG_RESULT(yes) - $1 - fi - fi - AC_SUBST(GLINC) - AC_SUBST(GLLIB) -]) - - dnl PAM pam - - dnl Should test for PAM (Pluggable Authentication Modules) - AC_DEFUN(AC_PATH_PAM_DIRECT, - [ - test -z "$pam_direct_test_library" && pam_direct_test_library=pam - test -z "$pam_direct_test_include" && pam_direct_test_include=security/pam_appl.h - - for ac_dir in \ - \ - /usr/local/include \ - /usr/include \ - /usr/unsupported/include \ - /opt/include \ - /usr/pam/include \ - /usr/local/pam/include \ - /usr/lib/pam/include \ - \ - $extra_include \ - ; \ - do - if test -r "$ac_dir/$pam_direct_test_include"; then - no_pam= ac_pam_includes=$ac_dir - break - fi - done - - # First see if replacing the include by lib works. - for ac_dir in `echo "$ac_pam_includes" | sed s/include/lib/` \ - \ - /lib \ - /usr/lib \ - /usr/local/lib \ - /usr/unsupported/lib \ - /lib/security \ - /usr/security/lib \ - $extra_lib \ - ; \ - do - for ac_extension in a so sl; do - if test -r $ac_dir/lib${pam_direct_test_library}.$ac_extension; then - no_pam= ac_pam_libraries=$ac_dir - break 2 - fi - done - done -]) - -AC_DEFUN(AC_PATH_PAM, - [AC_REQUIRE_CPP()dnl - - AC_CHECK_LIB(pam_misc, main, [PAM_MISC_LIB="-lpam_misc"], [], [-lpam -ldl]) - - AC_MSG_CHECKING(for PAM) - AC_ARG_WITH(pam, -[ --with-pam[=ARG] enable support for PAM: ARG=[yes|no|service name]], - [ - if test "x$withval" = "xyes"; then - no_pam= - default_pam=yes - elif test "x$withval" = "xno"; then - no_pam=yes - else - no_pam= - pam_service="$withval" - if test -z "$pam_service"; then - default_pam=yes - else - default_pam= - fi - fi - ], no_pam=yes - ) - - if test ! "$no_pam" = yes; then - - AC_CACHE_VAL(ac_cv_path_pam, - [ - ac_pam_includes=NONE - ac_pam_libraries=NONE - if test -z "$pam_libraries"; then - pam_libraries=NONE - fi - if test -z "$pam_includes"; then - pam_includes=NONE - fi - - AC_PATH_PAM_DIRECT - - test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes - test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries - - if test ! "x$pam_includes" = xNONE && test ! "x$pam_libraries" = xNONE; then - ac_pam_libs="-lpam $PAM_MISC_LIB -ldl" - ac_cv_path_pam="no_pam= ac_pam_includes=$ac_pam_includes ac_pam_libraries=$ac_pam_libraries ac_pam_libs=\"$ac_pam_libs\"" - else - ac_cv_path_pam="no_pam=yes" - fi - ]) - - eval "$ac_cv_path_pam" - - fi - - if test "$no_pam" = yes; then - AC_MSG_RESULT(no) - else - AC_DEFINE(HAVE_PAM) - PAMLIBS="$ac_pam_libs" - test "x$pam_includes" = xNONE && pam_includes=$ac_pam_includes - test "x$pam_libraries" = xNONE && pam_libraries=$ac_pam_libraries - AC_MSG_RESULT([libraries $pam_libraries, headers $pam_includes]) - if test "$default_pam" = yes; then - AC_MSG_RESULT(["default pam service name will be used"]) - else - AC_DEFINE_UNQUOTED(KDE_PAM_SERVICE,"$pam_service") - AC_MSG_RESULT(["pam service name will be: " $pam_service]) - fi -dnl test whether struct pam_message is const (Linux) or not (Sun) - pam_appl_h="$ac_pam_includes/security/pam_appl.h" - AC_MSG_CHECKING(for const pam_message) - AC_EGREP_HEADER([struct pam_message], - $pam_appl_h, - [ AC_EGREP_HEADER([const struct pam_message], - $pam_appl_h, - [AC_MSG_RESULT(["const: Linux-type PAM"]) ], - [AC_MSG_RESULT(["nonconst: Sun-type PAM"]) - AC_DEFINE(PAM_MESSAGE_NONCONST)] - )], - [AC_MSG_RESULT(["not found - assume const, Linux-type PAM"])] - ) - fi - - if test "x$pam_libraries" != x && test "x$pam_libraries" != xNONE ; then - PAMLIBPATHS="-L$pam_libraries" - fi - if test "x$pam_includes" != x && test "x$pam_includes" != xNONE ; then - PAMINC="-I$pam_includes" - fi - - AC_SUBST(PAMINC) - AC_SUBST(PAMLIBS) - AC_SUBST(PAMLIBPATHS) - -]) - -AC_DEFUN(KDE_CHECK_LIBDL, -[ -AC_CHECK_LIB(dl, dlopen, [ -LIBDL="-ldl" -ac_cv_have_dlfcn=yes -]) - -AC_CHECK_LIB(dld, shl_unload, [ -LIBDL="-ldld" -ac_cv_have_shload=yes -]) - -AC_SUBST(LIBDL) -]) - -AC_DEFUN(KDE_CHECK_DLOPEN, -[ -KDE_CHECK_LIBDL -AC_CHECK_HEADERS(dlfcn.h dl.h) -if test "$ac_cv_header_dlfcn_h" = "no"; then - ac_cv_have_dlfcn=no -fi - -if test "$ac_cv_header_dl_h" = "no"; then - ac_cv_have_shload=no -fi - -enable_dlopen=no -AC_ARG_ENABLE(dlopen, -[ --disable-dlopen link staticly [default=no]] , -[if test "$enableval" = yes; then - enable_dlopen=yes -fi], -enable_dlopen=yes) - -# override the user's opinion, if we know it better ;) -if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then - enable_dlopen=no -fi - -if test "$ac_cv_have_dlfcn" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_DLFCN) -fi - -if test "$ac_cv_have_shload" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_SHLOAD) -fi - -if test "$enable_dlopen" = no ; then - test -n "$1" && eval $1 -else - test -n "$2" && eval $2 -fi - -]) - -AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING, -[ -KDE_CHECK_DLOPEN(libtool_enable_shared=no, libtool_enable_static=no) -KDE_PROG_LIBTOOL -AC_MSG_CHECKING([dynamic loading]) -eval "`egrep '^build_libtool_libs=' libtool`" -if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then - dynamic_loading=yes - AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING) -else - dynamic_loading=no -fi -AC_MSG_RESULT($dynamic_loading) -if test "$dynamic_loading" = "yes"; then - $1 -else - $2 -fi -]) - -AC_DEFUN(KDE_ADD_INCLUDES, -[ -if test -z "$1"; then - test_include="Pix.h" -else - test_include="$1" -fi - -AC_MSG_CHECKING([for libg++ ($test_include)]) - -AC_CACHE_VAL(kde_cv_libgpp_includes, -[ -kde_cv_libgpp_includes=no - - for ac_dir in \ - \ - /usr/include/g++ \ - /usr/include \ - /usr/unsupported/include \ - /opt/include \ - $extra_include \ - ; \ - do - if test -r "$ac_dir/$test_include"; then - kde_cv_libgpp_includes=$ac_dir - break - fi - done -]) - -AC_MSG_RESULT($kde_cv_libgpp_includes) -if test "$kde_cv_libgpp_includes" != "no"; then - all_includes="-I$kde_cv_libgpp_includes $all_includes" -fi -]) -]) - - -AC_DEFUN(KDE_CHECK_MICO, -[ -AC_REQUIRE([KDE_CHECK_LIBDL]) -AC_MSG_CHECKING(for MICO) -AC_ARG_WITH(micodir, - [ --with-micodir=micodir where mico is installed ], - kde_micodir=$withval, - kde_micodir=/usr/local -) -AC_MSG_RESULT($kde_micodir) -if test ! -r $kde_micodir/include/CORBA.h; then - AC_MSG_ERROR([No CORBA.h found, specify another micodir]) -fi - -MICO_INCLUDES=-I$kde_micodir/include -AC_SUBST(MICO_INCLUDES) -MICO_LDFLAGS=-L$kde_micodir/lib -AC_SUBST(MICO_LDFLAGS) - -AC_MSG_CHECKING([for MICO version]) -AC_CACHE_VAL(kde_cv_mico_version, -[ -AC_LANG_C -cat >conftest.$ac_ext < -#include -int main() { - - printf("MICO_VERSION=%s\n",MICO_VERSION); - return (0); -} -EOF -ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest' -if AC_TRY_EVAL(ac_compile); then - if eval `./conftest 2>&5`; then - kde_cv_mico_version=$MICO_VERSION - else - AC_MSG_ERROR([your system is not able to execute a small application to - find MICO version! Check $kde_micodir/include/mico/version.h]) - fi -else - AC_MSG_ERROR([your system is not able to compile a small application to - find MICO version! Check $kde_micodir/include/mico/version.h]) -fi -]) - -dnl installed MICO version -mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` -mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` -mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` - -dnl required MICO version -req_v_maj=`echo $1 | sed -e 's/^\(.*\)\..*\..*$/\1/'` -req_v_mid=`echo $1 | sed -e 's/^.*\.\(.*\)\..*$/\1/'` -req_v_min=`echo $1 | sed -e 's/^.*\..*\.\(.*\)$/\1/'` - -if test "$mico_v_maj" -lt "$req_v_maj" || \ - ( test "$mico_v_maj" -eq "$req_v_maj" && \ - test "$mico_v_mid" -lt "$req_v_mid" ) || \ - ( test "$mico_v_mid" -eq "$req_v_mid" && \ - test "$mico_v_min" -lt "$req_v_min" ) - -then - AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $1 \ -at least is required. You should upgrade MICO.]) -else - AC_MSG_RESULT([$kde_cv_mico_version (minimum version $1, ok)]) -fi - -LIBMICO="-lmico$kde_cv_mico_version $LIBDL" -AC_SUBST(LIBMICO) -IDL=$kde_micodir/bin/idl -AC_SUBST(IDL) -]) - - -AC_DEFUN(KDE_CHECK_MINI_STL, -[ -AC_REQUIRE([KDE_CHECK_MICO]) - -AC_MSG_CHECKING(if we use mico's mini-STL) -AC_CACHE_VAL(kde_cv_have_mini_stl, -[ -AC_LANG_CPLUSPLUS -kde_save_cxxflags="$CXXFLAGS" -CXXFLAGS="$CXXFLAGS $MICO_INCLUDES" -AC_TRY_COMPILE( -[ -#include -], -[ -#ifdef HAVE_MINI_STL -#error "nothing" -#endif -], -kde_cv_have_mini_stl=no, -kde_cv_have_mini_stl=yes) -CXXFLAGS="$kde_save_cxxflags" -]) - - -AC_MSG_RESULT($kde_cv_have_mini_stl) -if test "$kde_cv_have_mini_stl" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_MINI_STL) -fi -]) - -]) - - -AC_DEFUN(KDE_CHECK_LIBPTHREAD, -[ -AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"], LIBPTHREAD= ) -AC_SUBST(LIBPTHREAD) -]) - -AC_DEFUN(KDE_TRY_LINK_PYTHON, -[ -AC_CACHE_VAL(kde_cv_try_link_python_$1, -[ -kde_save_cxxflags="$CXXFLAGS" -CXXFLAGS="$CXXFLAGS $PYTHONINC" -kde_save_libs="$LIBS" -LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET" -kde_save_ldflags="$LDFLAGS" -LDFLAGS="$LDFLAGS $PYTHONLIB" - -AC_TRY_LINK( -[ -#include -],[ - PySys_SetArgv(1, 0); -], - [kde_cv_try_link_python_$1=yes], - [kde_cv_try_link_python_$1=no] -) -CXXFLAGS="$kde_save_cxxflags" -LIBS="$kde_save_libs" -LDFLAGS="$kde_save_ldflags" -]) - -if test "$kde_cv_try_link_python_$1" = "yes"; then - $3 -else - $4 -fi - -]) - -AC_DEFUN(KDE_CHECK_PYTHON, -[ -AC_REQUIRE([KDE_CHECK_LIBDL]) -AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) -if test -z "$1"; then - version="1.5" -else - version="$1" -fi - -AC_MSG_CHECKING([for Python$version]) - -AC_ARG_WITH(pythondir, -[ --with-pythondir=pythondir use python installed in pythondir ], -[ - ac_python_dir=$withval -], ac_python_dir=/usr/local -) - -python_incdirs="$ac_python_dir/include/python$version /usr/include/python$version /usr/local/include/python$version /usr/local/include" -AC_FIND_FILE(Python.h, $python_incdirs, python_incdir) -if test ! -r $python_incdir/Python.h; then - AC_MSG_ERROR(Python.h not found.) -fi - -PYTHONINC=-I$python_incdir - -python_libdirs="$ac_python_dir/lib/python$version/config /usr/lib/python$version/config /usr/local/python$version/config" -AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir) -if test ! -r $python_libdir/libpython$version.a; then - AC_MSG_ERROR(libpython$version.a not found.) -fi - -PYTHONLIB=-L$python_libdir -LIBPYTHON=-lpython$version - -AC_MSG_RESULT(header $python_incdir library $python_libdir) - -dnl Note: this test is very weak -AC_MSG_CHECKING(if an Python application links) -KDE_TRY_LINK_PYTHON(normal, "", AC_MSG_RESULT(yes), - [ - AC_MSG_RESULT(no) - AC_MSG_CHECKING(if Python depends on -lpthread) - KDE_TRY_LINK_PYTHON(pthread, "$LIBPTHREAD", - [ - AC_MSG_RESULT(yes) - LIBPYTHON="$LIBPYTHON $LIBPTHREAD $LIBDL" - ], - [ - AC_MSG_RESULT(no) - AC_MSG_CHECKING(if Python depeds on -ltcl) - KDE_TRY_LINK_PYTHON(tcl, "-ltcl", - [ - AC_MSG_RESULT(yes) - LIBPYTHON="$LIBPYTHON -ltcl" - ], - [ - AC_MSG_RESULT(no) - AC_MSG_WARN([it seems, Python depends on another library. - Pleae use \"make LIBPTYHON='-lpython$version -lotherlib'\" to fix this - and contact the authors to let them know about this problem]) - ]) - ]) - ]) - -AC_SUBST(PYTHONINC) -AC_SUBST(PYTHONLIB) -AC_SUBST(LIBPYTHON) - -]) - - -AC_DEFUN(KDE_CHECK_STL_SGI, -[ - AC_MSG_CHECKING([if STL implementation is SGI like]) - AC_CACHE_VAL(kde_cv_stl_type_sgi, - [ - AC_TRY_COMPILE([ -#include -],[ - string astring="Hallo Welt."; - astring.erase(0, 6); // now astring is "Welt" - return 0; -], kde_cv_stl_type_sgi=yes, - kde_cv_stl_type_sgi=no) -]) - - AC_MSG_RESULT($kde_cv_stl_type_sgi) - - if test "$kde_cv_stl_type_sgi" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_SGI_STL) - fi -]) - -AC_DEFUN(KDE_CHECK_STL_HP, -[ - AC_MSG_CHECKING([if STL implementation is HP like]) - AC_CACHE_VAL(kde_cv_stl_type_hp, - [ - AC_TRY_COMPILE([ -#include -],[ - string astring="Hello World"; - astring.remove(0, 6); // now astring is "World" - return 0; -], kde_cv_stl_type_hp=yes, - kde_cv_stl_type_hp=no) -]) - AC_MSG_RESULT($kde_cv_stl_type_hp) - - if test "$kde_cv_stl_type_hp" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_HP_STL) - fi -]) - -AC_DEFUN(KDE_CHECK_STL, -[ - KDE_CHECK_STL_SGI - - if test "$kde_cv_stl_type_sgi" = "no"; then - KDE_CHECK_STL_HP - - if test "$kde_cv_stl_type_hp" = "no"; then - AC_MSG_ERROR("no known STL type found") - fi - fi - -]) - -AC_DEFUN(AC_FIND_QIMGIO, - [AC_REQUIRE([AC_FIND_JPEG]) -AC_MSG_CHECKING([for qimgio]) -AC_CACHE_VAL(ac_cv_lib_qimgio, -[ac_save_LIBS="$LIBS" -LIBS="$all_libraries -lqimgio -lpng -lz -lqt $LIBJPEG -lX11 $LIBSOCKET" -AC_TRY_LINK(dnl -[ -void qInitImageIO (); -], - [qInitImageIO();], - eval "ac_cv_lib_qimgio=yes", - eval "ac_cv_lib_qimgio=no") -LIBS="$ac_save_LIBS" -])dnl -if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then - LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG" - AC_MSG_RESULT(yes) - AC_DEFINE_UNQUOTED(HAVE_QIMGIO) - AC_SUBST(LIBQIMGIO) -else - AC_MSG_RESULT(not found) -fi -]) - -AC_DEFUN(KDE_CHECK_ANSI, -[ -AC_MSG_CHECKING([for strdup]) - - AC_CACHE_VAL(kde_cv_stl_type_sgi, - [ -AC_LANG_CPLUSPLUS -save_CXXFLAGS="$CXXFLAGS" -if test "$GCC" = "yes"; then - CXXFLAGS="$CXXFLAGS -pedantic-errors" -fi - -AC_TRY_COMPILE([ -#include -],[ - char buffer[] = "Hallo"; - strdup(buffer) -], kde_cv_has_strdup=yes, - kde_cv_has_strdup=no) -CXXFLAGS="$save_CXXFLAGS" -]) -AC_MSG_RESULT($kde_cv_has_strdup) - -if test "$kde_cv_has_strdup" = "yes"; then - AC_DEFINE_UNQUOTED(HAVE_STRDUP) -fi - -]) - -AC_DEFUN(KDE_CHECK_INSURE, -[ - AC_ARG_ENABLE(insure, [ --enable-insure use insure++ for debugging [default=no]], - [ - if test $enableval = "no"; dnl - then ac_use_insure="no" - else ac_use_insure="yes" - fi - ], [ac_use_insure="no"]) - - AC_MSG_CHECKING(if we will use Insure++ to debug) - AC_MSG_RESULT($ac_use_insure) - if test "$ac_use_insure" = "yes"; dnl - then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "???? - fi -]) - -dnl this is for kdm: - -AC_DEFUN(AC_CHECK_KDM, -[ -AC_CHECK_FUNCS(getsecretkey) -dnl checks for X server - -AC_PATH_PROG(X_SERVER, X) -if test ! -z "$X_SERVER"; then -X_SERVER=`echo $X_SERVER | sed -e 's+/X$++'` -AC_DEFINE_UNQUOTED(XBINDIR,$X_SERVER) -XBINDIR=$X_SERVER -AC_SUBST(XBINDIR) -fi - -dnl This one tries to find XDMDIR for config files -AC_ARG_WITH(xdmdir, - [ --with-xdmdir If the xdm config dir can't be found automaticly], - [ ac_xdmdir=$withval], - [ ac_xdmdir="no"]) - -AC_MSG_CHECKING([for xdm configuration dir]) -if test "$ac_xdmdir" = "no"; then - rm -fr conftestdir - if mkdir conftestdir; then - cd conftestdir - cat > Imakefile <<'EOF' -acfindxdm: - @echo 'ac_xdmdir="$(XDMDIR)";' -EOF - if (xmkmf) > /dev/null 2> /dev/null && test -f Makefile; then - eval `${MAKE-make} acfindxdm 2>/dev/null 2>/dev/null | grep -v make` - fi - cd .. - rm -fr conftestdir - dnl Check if Imake was right - if test -f $ac_xdmdir/xdm-config; then - AC_MSG_RESULT($ac_xdmdir) - else - dnl Here we must do something else - dnl Maybe look for xdm-config in standard places, and - dnl if that fails use a fresh copy in $KDEDIR/config/kdm/ - AC_FIND_FILE(xdm-config,/etc/X11/xdm /var/X11/xdm /usr/openwin/xdm /usr/X11R6/lib/X11/xdm,ac_xdmdir) - if test -f $ac_xdmdir/xdm-config; then - AC_MSG_RESULT($ac_xdmdir) - else - if test "${prefix}" = NONE; then - ac_xdmdir=$ac_default_prefix/config/kdm - else - ac_xdmdir=$prefix/config/kdm - fi - AC_MSG_RESULT([xdm config dir not found, installing defaults in $ac_xdmdir]) - xdmconfigsubdir=xdmconfig - AC_SUBST(xdmconfigsubdir) - fi - fi - fi -else - if test -f $ac_xdmdir/xdm-config; then - AC_MSG_RESULT($ac_xdmdir) - else - - AC_MSG_RESULT([xdm config dir not found, installing defaults in $ac_xdmdir]) - xdmconfigsubdir=xdmconfig - AC_SUBST(xdmconfigsubdir) - fi -fi -AC_DEFINE_UNQUOTED(XDMDIR,"$ac_xdmdir") -AC_SUBST(ac_xdmdir) - -AC_PATH_PAM -if test "x$no_pam" = "xyes"; then - pam_support="no" -else - pam_support="yes" - shadow_support="no" # if pam is installed, use it. We can't savely - # test, if it works *sigh* -fi - -AC_ARG_WITH(shadow, - [ --with-shadow If you want shadow password support ], - [ if test "$withval" = "yes"; then - shadow_support="yes" - else - shadow_support="no" - fi - if test "$pam_support" = "yes" && test "$shadow_support=yes"; then - AC_MSG_WARN("You can not define both pam AND shadow") - fi - ], - [ if test -z "$shadow_support"; then shadow_support="no"; fi ] ) - -if test "$pam_support" = "yes"; then - AC_CHECK_LIB(pam, main, [PASSWDLIB="-lpam -ldl" - AC_DEFINE_UNQUOTED(HAVE_PAM_LIB)], - [],-ldl) -fi - -if test -z "$PASSWDLIB" && test "$shadow_support" = "yes"; then - AC_CHECK_LIB(shadow, main, - [ PASSWDLIB="-lshadow" - AC_DEFINE_UNQUOTED(HAVE_SHADOW_LIB) - ]) -fi -AC_SUBST(PASSWDLIB) -AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for FreeBSD -AC_SUBST(LIBUTIL) -AC_CHECK_LIB(s, main, [LIB_LIBS="-ls"]) dnl for AIX -AC_SUBST(LIB_LIBS) -AC_CHECK_LIB(Xdmcp, main, [LIBXDMCP="-lXdmcp"], , $X_LDFLAGS -lX11) dnl for Unixware -AC_SUBST(LIBXDMCP) - -if test -n "$LIBXDMCP"; then - ac_cpp_safe=$ac_cpp - ac_cpp='$CXXCPP $CPPFLAGS $X_INCLUDES' - AC_CHECK_HEADERS(X11/Xdmcp.h) - ac_cpp=$ac_cpp_safe -fi - -]) -# Configure paths for GTK-- -# Erik Andersen 30 May 1998 -# Modified by Tero Pulkkinen (added the compiler checks... I hope they work..) -# Modified by Thomas Langen 16 Jan 2000 (corrected CXXFLAGS) - -dnl Test for GTKMM, and define GTKMM_CFLAGS and GTKMM_LIBS -dnl to be used as follows: -dnl AM_PATH_GTKMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl -AC_DEFUN(AM_PATH_GTKMM, -[dnl -dnl Get the cflags and libraries from the gtkmm-config script -dnl -AC_ARG_WITH(gtkmm-prefix,[ --with-gtkmm-prefix=PREFIX - Prefix where GTK-- is installed (optional)], - gtkmm_config_prefix="$withval", gtkmm_config_prefix="") -AC_ARG_WITH(gtkmm-exec-prefix,[ --with-gtkmm-exec-prefix=PREFIX - Exec prefix where GTK-- is installed (optional)], - gtkmm_config_exec_prefix="$withval", gtkmm_config_exec_prefix="") -AC_ARG_ENABLE(gtkmmtest, [ --disable-gtkmmtest Do not try to compile and run a test GTK-- program], - , enable_gtkmmtest=yes) - - if test x$gtkmm_config_exec_prefix != x ; then - gtkmm_config_args="$gtkmm_config_args --exec-prefix=$gtkmm_config_exec_prefix" - if test x${GTKMM_CONFIG+set} != xset ; then - GTKMM_CONFIG=$gtkmm_config_exec_prefix/bin/gtkmm-config - fi - fi - if test x$gtkmm_config_prefix != x ; then - gtkmm_config_args="$gtkmm_config_args --prefix=$gtkmm_config_prefix" - if test x${GTKMM_CONFIG+set} != xset ; then - GTKMM_CONFIG=$gtkmm_config_prefix/bin/gtkmm-config - fi - fi - - AC_PATH_PROG(GTKMM_CONFIG, gtkmm-config, no) - min_gtkmm_version=ifelse([$1], ,0.10.0,$1) - - AC_MSG_CHECKING(for GTK-- - version >= $min_gtkmm_version) - no_gtkmm="" - if test "$GTKMM_CONFIG" = "no" ; then - no_gtkmm=yes - else - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - - GTKMM_CFLAGS=`$GTKMM_CONFIG $gtkmm_config_args --cflags` - GTKMM_LIBS=`$GTKMM_CONFIG $gtkmm_config_args --libs` - gtkmm_config_major_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - gtkmm_config_minor_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - gtkmm_config_micro_version=`$GTKMM_CONFIG $gtkmm_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_gtkmmtest" = "xyes" ; then - ac_save_CXXFLAGS="$CXXFLAGS" - ac_save_LIBS="$LIBS" - CXXFLAGS="$CXXFLAGS $GTKMM_CFLAGS" - LIBS="$LIBS $GTKMM_LIBS" -dnl -dnl Now check if the installed GTK-- is sufficiently new. (Also sanity -dnl checks the results of gtkmm-config to some extent -dnl - rm -f conf.gtkmmtest - AC_TRY_RUN([ -#include -#include -#include - -int -main () -{ - int major, minor, micro; - char *tmp_version; - - system ("touch conf.gtkmmtest"); - - /* HP/UX 0 (%@#!) writes to sscanf strings */ - tmp_version = g_strdup("$min_gtkmm_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_gtkmm_version"); - exit(1); - } - - if ((gtkmm_major_version != $gtkmm_config_major_version) || - (gtkmm_minor_version != $gtkmm_config_minor_version) || - (gtkmm_micro_version != $gtkmm_config_micro_version)) - { - printf("\n*** 'gtkmm-config --version' returned %d.%d.%d, but GTK-- (%d.%d.%d)\n", - $gtkmm_config_major_version, $gtkmm_config_minor_version, $gtkmm_config_micro_version, - gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version); - printf ("*** was found! If gtkmm-config was correct, then it is best\n"); - printf ("*** to remove the old version of GTK--. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); - printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); - printf("*** required on your system.\n"); - printf("*** If gtkmm-config was wrong, set the environment variable GTKMM_CONFIG\n"); - printf("*** to point to the correct copy of gtkmm-config, and remove the file config.cache\n"); - printf("*** before re-running configure\n"); - } -/* GTK-- does not have the GTKMM_*_VERSION constants */ -/* - else if ((gtkmm_major_version != GTKMM_MAJOR_VERSION) || - (gtkmm_minor_version != GTKMM_MINOR_VERSION) || - (gtkmm_micro_version != GTKMM_MICRO_VERSION)) - { - printf("*** GTK-- header files (version %d.%d.%d) do not match\n", - GTKMM_MAJOR_VERSION, GTKMM_MINOR_VERSION, GTKMM_MICRO_VERSION); - printf("*** library (version %d.%d.%d)\n", - gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version); - } -*/ - else - { - if ((gtkmm_major_version > major) || - ((gtkmm_major_version == major) && (gtkmm_minor_version > minor)) || - ((gtkmm_major_version == major) && (gtkmm_minor_version == minor) && (gtkmm_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** An old version of GTK-- (%d.%d.%d) was found.\n", - gtkmm_major_version, gtkmm_minor_version, gtkmm_micro_version); - printf("*** You need a version of GTK-- newer than %d.%d.%d. The latest version of\n", - major, minor, micro); - printf("*** GTK-- is always available from ftp://ftp.gtk.org.\n"); - printf("***\n"); - printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the gtkmm-config shell script is\n"); - printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of GTK--, but you can also set the GTKMM_CONFIG environment to point to the\n"); - printf("*** correct copy of gtkmm-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); - printf("*** so that the correct libraries are found at run-time))\n"); - } - } - return 1; -} -],, no_gtkmm=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_gtkmm" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$GTKMM_CONFIG" = "no" ; then - echo "*** The gtkmm-config script installed by GTK-- could not be found" - echo "*** If GTK-- was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the GTKMM_CONFIG environment variable to the" - echo "*** full path to gtkmm-config." - echo "*** The gtkmm-config script was not available in GTK-- versions" - echo "*** prior to 0.9.12. Perhaps you need to update your installed" - echo "*** version to 0.9.12 or later" - else - if test -f conf.gtkmmtest ; then - : - else - echo "*** Could not run GTK-- test program, checking why..." - CXXFLAGS="$CXXFLAGS $GTKMM_CFLAGS" - LIBS="$LIBS $GTKMM_LIBS" - AC_TRY_LINK([ -#include -#include -], [ return ((gtkmm_major_version) || (gtkmm_minor_version) || (gtkmm_micro_version)); ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding GTK-- or finding the wrong" - echo "*** version of GTK--. If it is not finding GTK--, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GTK-- was incorrectly installed" - echo "*** or that you have moved GTK-- since it was installed. In the latter case, you" - echo "*** may want to edit the gtkmm-config script: $GTKMM_CONFIG" ]) - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - GTKMM_CFLAGS="" - GTKMM_LIBS="" - ifelse([$3], , :, [$3]) - AC_LANG_RESTORE - fi - AC_SUBST(GTKMM_CFLAGS) - AC_SUBST(GTKMM_LIBS) - rm -f conf.gtkmmtest -]) - -# Configure paths for GNOME-- -# Modified from GTK--.m4 - -dnl Test for GNOMEMM, and define GNOMEMM_INCLUDEDIR, GNOMEMM_LIBDIR, GNOMEMM_LIBS -dnl to be used as follows: -dnl AM_PATH_GNOMEMM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl -AC_DEFUN(AM_PATH_GNOMEMM, -[ -dnl -dnl Get the cflags and libraries from the gtkmm-config script -dnl -AC_ARG_WITH(gnomemm-config-path,[ --with-gnomemm-config-path=PREFIX - Path to GNOME-- configuration file gnomemmConf.sh (optional)], - gnomemm_config_prefix="$withval", gnome_config_prefix="") - - AC_MSG_CHECKING(for GNOME-- gnomemmConf.sh) - - if test x$gnomemm_config_prefix != x; then - if test -r $gnomemm_config_prefix; then - source $gnomemm_config_prefix - else - no_gnomemm=yes - fi - else - if test -r /usr/lib/gnomemmConf.sh ; then - source /usr/lib/gnomemmConf.sh - elif test -r /opt/gnome/lib/gnomemmConf.sh ; then - source /opt/gnome/lib/gnomemmConf.sh - elif test -r /usr/local/lib/gnomemmConf.sh ; then - source /usr/local/lib/gnomemmConf.sh - else - no_gnomemm=yes - fi - fi - - if test "x$no_gnomemm" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - AC_MSG_ERROR(Cannot find GNOME-- configuration file gnomemmConf.sh) - fi - - AC_SUBST(GNOMEMM_INCLUDEDIR) - AC_SUBST(GNOMEMM_LIBDIR) - AC_SUBST(GNOMEMM_LIBS) -]) - diff --git a/forms/bullet_forms.C.patch b/forms/bullet_forms.C.patch index 647230cfbc..2d43561c0b 100644 --- a/forms/bullet_forms.C.patch +++ b/forms/bullet_forms.C.patch @@ -1,5 +1,5 @@ ---- bullet_forms.c.orig Fri Jun 9 17:38:18 2000 -+++ bullet_forms.c Fri Jun 9 17:39:31 2000 +--- bullet_forms.c.orig Thu Aug 10 00:38:18 2000 ++++ bullet_forms.c Thu Aug 10 00:38:18 2000 @@ -3,6 +3,8 @@ #include "forms.h" #include @@ -28,7 +28,7 @@ + fl_set_object_boxtype(obj, FL_UP_BOX); + fl_set_bmtable_pixmap_file(obj, 6, 6, + LibFileSearch("images", -+ "standard.xpm").c_str()); ++ "standard", "xpm").c_str()); + + fl_set_border_width(-1); obj = fl_add_frame(FL_ENGRAVED_FRAME,95,20,255,70,""); diff --git a/forms/fdfix.sh b/forms/fdfix.sh index 467432d23d..0e47641fd0 100755 --- a/forms/fdfix.sh +++ b/forms/fdfix.sh @@ -74,12 +74,12 @@ echo >> $2 # reported to its authors). # # -e 's/,\([^ ]\)/, \1/g' \ -# -e 's/\("[^"]*,\) \("\)/\1\2/g' +# -e 's/\("[^"][^"]*,\) \("\)/\1\2/g' # # Someone got busy and put spaces in after commas but didn't allow for the # autogeneration of the files so their pretty formatting got lost. Not anymore. # The second rule cleans up one special case where a comma appears at the end -# of a string. +# of a string while ensuring "...", "..." isn't affected. # # -e 's/stdlib.h/cstdlib/' # @@ -109,7 +109,7 @@ cat $1 | sed \ -e 's/fdui->.*->fdui = fdui/\/\/&/' \ -e 's/\(\(FD_[^ ]*\) \*fdui.*\)sizeof(\*fdui)/\1sizeof(\2)/' \ -e 's/,\([^ ]\)/, \1/g' \ --e 's/\("[^"]*,\) \("\)/\1\2/g' \ +-e 's/\("[^"][^"]*,\) \("\)/\1\2/g' \ -e '/fl_.*"[^"]*%.*"/i\ // xgettext:no-c-format' \ -e 's/NULL/0/' \ diff --git a/forms/lyx.fd b/forms/lyx.fd index 0c144c2807..6914a1d961 100644 --- a/forms/lyx.fd +++ b/forms/lyx.fd @@ -3,7 +3,7 @@ Magic: 13000 Internal Form Definition File (do not change) -Number of forms: 4 +Number of forms: 3 Unit of measure: FL_COORD_PIXEL =============== FORM =============== @@ -93,7 +93,7 @@ argument: -------------------- class: FL_BEGIN_GROUP type: 0 -box: 0 10 10 0 +box: 0 0 0 0 boxtype: FL_NO_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_CENTER @@ -234,174 +234,6 @@ name: callback: argument: -=============== FORM =============== -Name: form_screen -Width: 390 -Height: 220 -Number of Objects: 9 - --------------------- -class: FL_BOX -type: UP_BOX -box: 0 0 390 220 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_DEFAULT_SIZE -lcol: FL_BLACK -label: -shortcut: -resize: FL_RESIZE_ALL -gravity: FL_NoGravity FL_NoGravity -name: -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 140 10 240 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Roman font|#R -shortcut: -resize: FL_RESIZE_X -gravity: FL_NorthWest FL_NoGravity -name: input_roman -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 140 40 240 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Sans serif font|#S -shortcut: -resize: FL_RESIZE_X -gravity: FL_NorthWest FL_NoGravity -name: input_sans -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 140 70 240 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Typewriter font|#T -shortcut: -resize: FL_RESIZE_X -gravity: FL_NorthWest FL_NoGravity -name: input_typewriter -callback: -argument: - --------------------- -class: FL_INPUT -type: NORMAL_INPUT -box: 140 100 240 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Font norm|#N -shortcut: -resize: FL_RESIZE_X -gravity: FL_NorthWest FL_NoGravity -name: input_font_norm -callback: -argument: - --------------------- -class: FL_INPUT -type: INT_INPUT -box: 140 140 50 30 -boxtype: FL_DOWN_BOX -colors: FL_COL1 FL_MCOL -alignment: FL_ALIGN_LEFT -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Font zoom|#Z -shortcut: -resize: FL_RESIZE_X -gravity: FL_NorthWest FL_NoGravity -name: intinput_size -callback: -argument: - --------------------- -class: FL_BUTTON -type: RETURN_BUTTON -box: 60 180 100 30 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: OK -shortcut: ^M -resize: FL_RESIZE_NONE -gravity: FL_SouthEast FL_SouthEast -name: -callback: ScreenOKCB -argument: 0 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 170 180 100 30 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Apply|#A -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_SouthEast FL_SouthEast -name: -callback: ScreenApplyCB -argument: 0 - --------------------- -class: FL_BUTTON -type: NORMAL_BUTTON -box: 280 180 100 30 -boxtype: FL_UP_BOX -colors: FL_COL1 FL_COL1 -alignment: FL_ALIGN_CENTER -style: FL_NORMAL_STYLE -size: FL_NORMAL_SIZE -lcol: FL_BLACK -label: Cancel|^[ -shortcut: -resize: FL_RESIZE_NONE -gravity: FL_SouthEast FL_SouthEast -name: -callback: ScreenCancelCB -argument: 0 - =============== FORM =============== Name: form_external Width: 560 diff --git a/forms/makefile b/forms/makefile index 03616975ef..d8f6feba80 100644 --- a/forms/makefile +++ b/forms/makefile @@ -43,6 +43,11 @@ d: c $(COBJS) # # We need the callbacks to all be declared as: extern "C" void # +# -e 's,\(generated with fdesign\)\(.*\)\(\*\*/\),\1 \3,';\ +# +# Clean up the line with the date in it. This means we'll have fewer false +# updates (where the only thing that changed was the date). +# e: c for hfil in *.h ; do \ if [ -f "$$hfil.patch" ] ; then \ @@ -50,7 +55,8 @@ e: c patch -s $$hfil < $$hfil.patch) \ fi; \ sed < $$hfil > $$hfil.tmp \ - -e 's/\(extern\) \(void.*FL_OBJECT\)/\1 "C" \2/' ; \ + -e 's/\(extern\) \(void.*FL_OBJECT\)/\1 "C" \2/' \ + -e 's,\(generated with fdesign\)\(.*\)\(\*\*/\),\1 \3,';\ mv $$hfil.tmp $$hfil; \ done diff --git a/lib/Makefile.am b/lib/Makefile.am index ec2a676405..ea27b22fac 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -2,8 +2,8 @@ AUTOMAKE_OPTIONS = foreign DISTCLEANFILES = *.orig *.rej *~ *.bak core textclass.lst packages.lst \ lyxrc.defaults doc/LyXConfig.lyx pkgdata_SCRIPTS = configure configure.cmd -MAINTAINERCLEANFILES = $(srcdir)/Makefile.in -SUBDIRS = reLyX +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in listerrors +SUBDIRS = reLyX bin_SCRIPTS = listerrors BIND = bind/*.bind diff --git a/lib/listerrors b/lib/listerrors deleted file mode 100755 index ce262102a5..0000000000 --- a/lib/listerrors +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -echo "This is NOT the listerrors program." -echo "" -echo "Here was the problem when we tried to build listerrors:" -echo The NOWEB notangle was not found. diff --git a/po/POTFILES.in b/po/POTFILES.in index 5235a5d625..e7eec6829f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -30,6 +30,8 @@ src/frontends/xforms/FormCitation.C src/frontends/xforms/form_citation.C src/frontends/xforms/FormCopyright.C src/frontends/xforms/form_copyright.C +src/frontends/xforms/FormDocument.C +src/frontends/xforms/form_document.C src/frontends/xforms/FormGraphics.C src/frontends/xforms/form_graphics.C src/frontends/xforms/FormIndex.C @@ -40,13 +42,6 @@ src/frontends/xforms/FormPrint.C src/frontends/xforms/form_print.C src/frontends/xforms/FormRef.C src/frontends/xforms/form_ref.C -src/frontends/xforms/forms/form_citation.C -src/frontends/xforms/forms/form_copyright.C -src/frontends/xforms/forms/form_graphics.C -src/frontends/xforms/forms/form_preferences.C -src/frontends/xforms/forms/form_print.C -src/frontends/xforms/forms/form_tabular.C -src/frontends/xforms/forms/form_url.C src/frontends/xforms/FormTabular.C src/frontends/xforms/form_tabular.C src/frontends/xforms/FormToc.C diff --git a/sigc++/acinclude.m4 b/sigc++/acinclude.m4 deleted file mode 100644 index 47abe43064..0000000000 --- a/sigc++/acinclude.m4 +++ /dev/null @@ -1,430 +0,0 @@ -## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- -## Copyright (C) 1996-1999 Free Software Foundation, Inc. -## Originally by Gordon Matzigkeit , 1996 -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -## -## As a special exception to the GNU General Public License, if you -## distribute this file as part of a program that contains a -## configuration script generated by Autoconf, you may include it under -## the same distribution terms that you use for the rest of that program. - -# serial 40 AC_PROG_LIBTOOL -AC_DEFUN(AC_PROG_LIBTOOL, -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl - -# Save cache, so that ltconfig can load it -AC_CACHE_SAVE - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ -DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ -|| AC_MSG_ERROR([libtool configure failed]) - -# Reload cache, that may have been modified by ltconfig -AC_CACHE_LOAD - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log -]) - -AC_DEFUN(AC_LIBTOOL_SETUP, -[AC_PREREQ(2.13)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_RANLIB])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_NM])dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -dnl - -case "$target" in -NONE) lt_target="$host" ;; -*) lt_target="$target" ;; -esac - -# Check for any special flags to pass to ltconfig. -libtool_flags="--cache-file=$cache_file" -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" -test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" -ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], -[libtool_flags="$libtool_flags --enable-dlopen"]) -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[libtool_flags="$libtool_flags --enable-win32-dll"]) -AC_ARG_ENABLE(libtool-lock, - [ --disable-libtool-lock avoid locking (might break parallel builds)]) -test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" -test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case "$lt_target" in -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -]) -esac -]) - -# AC_LIBTOOL_DLOPEN - enable checks for dlopen support -AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) - -# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's -AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) - -# AC_ENABLE_SHARED - implement the --enable-shared flag -# Usage: AC_ENABLE_SHARED[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AC_ENABLE_SHARED, [dnl -define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(shared, -changequote(<<, >>)dnl -<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl -]) - -# AC_DISABLE_SHARED - set the default shared flag to --disable-shared -AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no)]) - -# AC_ENABLE_STATIC - implement the --enable-static flag -# Usage: AC_ENABLE_STATIC[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AC_ENABLE_STATIC, [dnl -define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(static, -changequote(<<, >>)dnl -<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_static=AC_ENABLE_STATIC_DEFAULT)dnl -]) - -# AC_DISABLE_STATIC - set the default static flag to --disable-static -AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no)]) - - -# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag -# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl -define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(fast-install, -changequote(<<, >>)dnl -<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_fast_install=yes ;; -no) enable_fast_install=no ;; -*) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl -]) - -# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install -AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no)]) - -# AC_PROG_LD - find the path to the GNU or non-GNU linker -AC_DEFUN(AC_PROG_LD, -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$ac_cv_prog_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - ac_prog=`($CC -print-prog-name=ld) 2>&5` - case "$ac_prog" in - # Accept absolute paths. -changequote(,)dnl - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' -changequote([,])dnl - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(ac_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - ac_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - ac_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$ac_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_PROG_LD_GNU -]) - -AC_DEFUN(AC_PROG_LD_GNU, -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - ac_cv_prog_gnu_ld=yes -else - ac_cv_prog_gnu_ld=no -fi]) -]) - -# AC_PROG_NM - find the path to a BSD-compatible name lister -AC_DEFUN(AC_PROG_NM, -[AC_MSG_CHECKING([for BSD-compatible nm]) -AC_CACHE_VAL(ac_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - ac_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -B" - break - elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -p" - break - else - ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm -fi]) -NM="$ac_cv_path_NM" -AC_MSG_RESULT([$NM]) -]) - -# AC_CHECK_LIBM - check for math library -AC_DEFUN(AC_CHECK_LIBM, -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case "$lt_target" in -*-*-beos* | *-*-cygwin*) - # These system don't have libm - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, main, LIBM="-lm") - ;; -esac -]) - -# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl convenience library, adds --enable-ltdl-convenience to -# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor -# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed -# to be `${top_builddir}/libltdl'. Make sure you start DIR with -# '${top_builddir}/' (note the single quotes!) if your package is not -# flat, and, if you're not using automake, define top_builddir as -# appropriate in the Makefiles. -AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case "$enable_ltdl_convenience" in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la - INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) -]) - -# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library, and adds --enable-ltdl-install to -# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor -# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed -# to be `${top_builddir}/libltdl'. Make sure you start DIR with -# '${top_builddir}/' (note the single quotes!) if your package is not -# flat, and, if you're not using automake, define top_builddir as -# appropriate in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, main, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la - INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - INCLTDL= - fi -]) - -dnl old names -AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl -AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl -AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl -AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl -AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl -AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl -AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl - -dnl This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL])dnl diff --git a/src/LyXAction.C b/src/LyXAction.C index 935261b823..99edc8368a 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -432,6 +432,7 @@ void LyXAction::init() { LFUN_INSET_LIST, "list-insert", "", Noop }, { LFUN_INSET_THEOREM, "theorem-insert", "", Noop }, { LFUN_INSET_CAPTION, "caption-insert", "", Noop }, + { LFUN_SCREEN_FONT_UPDATE, "screen-font-update", "", NoBuffer }, { LFUN_NOACTION, "", "", Noop } }; diff --git a/src/bullet_forms.h b/src/bullet_forms.h index 0f21f8d23c..7012ab5ec7 100644 --- a/src/bullet_forms.h +++ b/src/bullet_forms.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/ +/** Header file generated with fdesign **/ #ifndef FD_form_bullet_h_ #define FD_form_bullet_h_ diff --git a/src/commandtags.h b/src/commandtags.h index e5a91ced7f..933a441648 100644 --- a/src/commandtags.h +++ b/src/commandtags.h @@ -275,6 +275,7 @@ enum kb_action { LFUN_SCROLL_INSET, // Jug 20000801 LFUN_INDEX_INSERT, // Angus 20000803 LFUN_REF_CREATE, // Angus 20000807 + LFUN_SCREEN_FONT_UPDATE, // ARRae 20000813 LFUN_LASTACTION /* this marks the end of the table */ }; diff --git a/src/credits_form.h b/src/credits_form.h index 2fdf4c273c..98693120e7 100644 --- a/src/credits_form.h +++ b/src/credits_form.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/ +/** Header file generated with fdesign **/ #ifndef FD_form_credits_h_ #define FD_form_credits_h_ diff --git a/src/ext_l10n.h b/src/ext_l10n.h index d4c5eae411..cc8a06ef60 100644 --- a/src/ext_l10n.h +++ b/src/ext_l10n.h @@ -165,18 +165,17 @@ _("Credits...|e"); _("Version...|V"); _(""); _("A&A"); -_("ACT"); -_("AT_RISE:"); _("Abstract"); _("Accepted"); _("Acknowledgement"); -_("Acknowledgement(s)"); _("Acknowledgement*"); _("Acknowledgement-numbered"); -_("Acknowledgement-unnumbered"); +_("Acknowledgement(s)"); _("Acknowledgements"); +_("Acknowledgement-unnumbered"); _("Acknowledgments"); _("Acnowledgement"); +_("ACT"); _("Addchap"); _("Addchap*"); _("Addition"); @@ -194,15 +193,15 @@ _("Anlagen"); _("Anrede"); _("Appendices"); _("Appendix"); +_("AT_RISE:"); _("Author"); -_("AuthorRunning"); _("Author_Email"); _("Author_Running"); +_("AuthorRunning"); _("Author_URL"); _("Axiom"); _("Axiom-numbered"); _("Axiom-plain"); -_("BLZ"); _("Backaddress"); _("Bank"); _("BankAccount"); @@ -210,12 +209,13 @@ _("BankCode"); _("Betreff"); _("Bibliography"); _("Biography"); +_("BLZ"); _("Brieftext"); -_("CC"); -_("CURTAIN"); _("Caption"); _("Case"); _("Case-numbered"); +_("CC"); +_("cc"); _("CenteredCaption"); _("Chapter"); _("Chapter*"); @@ -255,6 +255,7 @@ _("Criterion-plain"); _("CrossList"); _("Current"); _("Current_Address"); +_("CURTAIN"); _("Customer"); _("Data"); _("Date"); @@ -269,10 +270,10 @@ _("Definition-unnumbered"); _("Description"); _("Dialogue"); _("EMail"); -_("EXT."); _("Email"); _("Encl"); _("Encl."); +_("encl"); _("End_All_Slides"); _("Enumerate"); _("Example"); @@ -283,43 +284,48 @@ _("Example-unnumbered"); _("Exercise"); _("Exercise-numbered"); _("Exercise-plain"); +_("EXT."); _("Extratitle"); -_("FADE_IN:"); -_("FADE_OUT:"); _("Fact"); _("Fact*"); _("Fact-numbered"); _("Fact-plain"); _("Fact-unnumbered"); +_("FADE_IN:"); +_("FADE_OUT:"); _("FigCaption"); +_("first"); _("FirstAuthor"); _("FirstName"); _("FitBitmap"); _("FitFigure"); _("Foilhead"); +_("foilhead"); _("Footernote"); _("FourAffiliations"); _("FourAuthors"); _("Gruss"); -_("HTTP"); _("Headnote"); -_("INT."); +_("HTTP"); _("Idea"); _("IhrSchreiben"); _("IhrZeichen"); _("Institute"); _("Institution"); +_("INT."); _("InvisibleText"); _("Invoice"); _("Itemize"); _("Journal"); +_("journal"); _("Keywords"); _("Konto"); -_("LaTeX"); -_("LaTeX_Title"); _("Labeling"); _("Land"); +_("landscape"); _("LandscapeSlide"); +_("LaTeX"); +_("LaTeX_Title"); _("Lemma"); _("Lemma*"); _("Lemma-numbered"); @@ -338,8 +344,10 @@ _("MarkBoth"); _("MathLetters"); _("MeinZeichen"); _("Minisec"); -_("MyRef"); +_("modying"); +_("msnumber"); _("My_Address"); +_("MyRef"); _("Myref"); _("Name"); _("Narrative"); @@ -349,18 +357,18 @@ _("Note"); _("Note*"); _("Note-numbered"); _("Note-plain"); -_("Note-unnumbered"); _("NoteToEditor"); _("Notetoeditor"); +_("Note-unnumbered"); _("Offprint"); _("Offprints"); _("Offsets"); +_("offsets"); _("Oggetto"); _("Opening"); _("Ort"); _("Overlay"); _("PACS"); -_("PS"); _("Paragraph"); _("Paragraph*"); _("Paragraph-numbered"); @@ -371,8 +379,8 @@ _("Petit"); _("Phone"); _("Place"); _("PlaceFigure"); -_("PlaceTable"); _("Placefigure"); +_("PlaceTable"); _("Placetable"); _("PortraitSlide"); _("PostalCommend"); @@ -389,11 +397,12 @@ _("Proposition*"); _("Proposition-numbered"); _("Proposition-plain"); _("Proposition-unnumbered"); +_("PS"); +_("ps"); _("Publishers"); _("Question"); _("Quotation"); _("Quote"); -_("REVTEX_Title"); _("Received"); _("Recieved"); _("Recieved/Accepted"); @@ -403,17 +412,17 @@ _("Remark"); _("Remark*"); _("Remark-numbered"); _("Remark-plain"); -_("Remark-unnumbered"); _("Remarks"); +_("Remark-unnumbered"); _("RetourAdresse"); _("ReturnAddress"); -_("RightHeader"); +_("REVTEX_Title"); _("Right_Address"); +_("RightHeader"); _("Rotatefoilhead"); _("Running_LaTeX_Title"); _("SCENE"); _("SCENE*"); -_("SGML"); _("Scrap"); _("Section"); _("Section*"); @@ -421,10 +430,11 @@ _("Section-numbered"); _("Send"); _("Send_To_Address"); _("Seriate"); +_("SGML"); _("ShortFoilhead"); +_("Shortfoilhead"); _("ShortRotatefoilhead"); _("ShortTitle"); -_("Shortfoilhead"); _("Signature"); _("Slide"); _("Slide*"); @@ -440,26 +450,26 @@ _("State"); _("Strasse"); _("Street"); _("Style"); -_("SubSection"); -_("SubTitle"); +_("style"); _("Subitle"); _("Subject"); _("Subjectclass"); _("Subparagraph"); _("Subparagraph*"); +_("SubSection"); _("Subsection"); _("Subsection*"); _("Subsection-numbered"); _("Subsubsection"); _("Subsubsection*"); _("Subsubsection-numbered"); +_("SubTitle"); _("Subtitle"); _("Suggested"); _("Summary"); _("Summary-numbered"); _("Surname"); -_("TOC_Author"); -_("TOC_Title"); +_("surname"); _("TableComments"); _("TableRefs"); _("Telefax"); @@ -471,8 +481,8 @@ _("Theorem"); _("Theorem*"); _("Theorem-numbered"); _("Theorem-plain"); -_("Theorem-unnumbered"); _("TheoremTemplate"); +_("Theorem-unnumbered"); _("Thesaurus"); _("ThickLine"); _("This"); @@ -480,39 +490,29 @@ _("ThreeAffiliations"); _("ThreeAuthors"); _("TickList"); _("Title"); -_("Title_Running"); _("Titlehead"); +_("Title_Running"); +_("TOC_Author"); +_("TOC_Title"); _("Town"); -_("Trans_Keywords"); _("Transition"); +_("Trans_Keywords"); _("Translated"); _("TranslatedAbstract"); _("Translated_Title"); _("Translator"); _("TwoAffiliations"); _("TwoAuthors"); -_("URL"); _("Unterschrift"); _("Uppertitleback"); +_("URL"); _("Use"); _("Verbatim"); _("Verse"); _("Verteiler"); _("VisibleText"); _("YourMail"); -_("YourRef"); _("Yourmail"); +_("YourRef"); _("Yourref"); _("Zusatz"); -_("cc"); -_("encl"); -_("first"); -_("foilhead"); -_("journal"); -_("landscape"); -_("modying"); -_("msnumber"); -_("offsets"); -_("ps"); -_("style"); -_("surname"); diff --git a/src/form1.h b/src/form1.h index c62f4fce7e..d9b64a4b88 100644 --- a/src/form1.h +++ b/src/form1.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/ +/** Header file generated with fdesign **/ #ifndef FD_KeyMap_h_ #define FD_KeyMap_h_ diff --git a/src/frontends/ButtonPolicies.C b/src/frontends/ButtonPolicies.C new file mode 100644 index 0000000000..418df35b56 --- /dev/null +++ b/src/frontends/ButtonPolicies.C @@ -0,0 +1,503 @@ +// -*- C++ -*- +/* ButtonPolicies.C + * Provides a state machine implementation of the various button policies + * used by the dialogs. + * Author: Allan Rae + * This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. + * + * This file Copyright 2000 + * Allan Rae + * ====================================================== + */ + +#include +#include "ButtonPolicies.h" +#include "debug.h" + + +// Helper function +inline void nextState(ButtonPolicy::State & state, + ButtonPolicy::SMInput in, + ButtonPolicy::StateMachine s_m, + char const * function_name = "nextState") +{ + ButtonPolicy::State tmp = s_m[state][in]; + if (ButtonPolicy::BOGUS != tmp) { + state = tmp; + } else { + lyxerr << function_name + << ": No transition for input " + << in + << " from state " + << state + << std::endl; + } +} + + +/*-----------------------------PreferencesPolicy-----------------------------*/ + + +PreferencesPolicy::PreferencesPolicy() + : state_(INITIAL), + outputs_(APPLIED+1, OKAY | APPLY | CANCEL | UNDO_ALL), + state_machine_(APPLIED+1, StateArray(SMI_TOTAL, BOGUS)) +{ + // Build the state output map + outputs_[INITIAL] = CLOSE; + outputs_[VALID] = UNDO_ALL | OKAY | APPLY | CANCEL; + outputs_[INVALID] = UNDO_ALL | CANCEL; + outputs_[APPLIED] = OKAY | CLOSE; + + // Build the state machine one state at a time + // NOTE: Since CANCEL and HIDE always go to INITIAL they are + // left out of the state machine and handled explicitly + // in input(). This won't necessarily be true for all + // policies though so I'll leave those two as distinct + // inputs rather than merge them. For example, a dialog + // that doesn't update it's input fields when reshown + // after being hidden needs a policy where CANCEL and + // HIDE are treated differently. + // + // State::INITIAL + state_machine_[INITIAL][SMI_READ_ONLY] = INITIAL; + state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL; + state_machine_[INITIAL][SMI_VALID] = VALID; + state_machine_[INITIAL][SMI_INVALID] = INVALID; + // State::VALID + state_machine_[VALID][SMI_VALID] = VALID; + state_machine_[VALID][SMI_READ_ONLY] = VALID; + state_machine_[VALID][SMI_READ_WRITE] = VALID; + state_machine_[VALID][SMI_INVALID] = INVALID; + state_machine_[VALID][SMI_APPLY] = APPLIED; + state_machine_[VALID][SMI_OKAY] = INITIAL; + state_machine_[VALID][SMI_UNDO_ALL] = INITIAL; + // State::INVALID + state_machine_[INVALID][SMI_VALID] = VALID; + state_machine_[INVALID][SMI_INVALID] = INVALID; + state_machine_[INVALID][SMI_READ_ONLY] = INVALID; + state_machine_[INVALID][SMI_READ_WRITE] = INVALID; + state_machine_[INVALID][SMI_UNDO_ALL] = INITIAL; + // State::APPLIED + state_machine_[APPLIED][SMI_VALID] = VALID; + state_machine_[APPLIED][SMI_INVALID] = INVALID; + state_machine_[APPLIED][SMI_OKAY] = INITIAL; + state_machine_[APPLIED][SMI_READ_ONLY] = APPLIED; + state_machine_[APPLIED][SMI_READ_WRITE] = APPLIED; +} + + +void PreferencesPolicy::input(SMInput input) +{ + // CANCEL and HIDE always take us to INITIAL for all cases. + // Note that I didn't put that special case in the helper function + // because it doesn't belong there. Some other + // This is probably optimising for the wrong case since it occurs as the + // dialog will be hidden. It would have saved a little memory in the + // state machine if I could have gotten map working. ARRae 20000813 + if (SMI_CANCEL == input + || SMI_HIDE == input) { + state_ = INITIAL; + } else { + nextState(state_, + input, + state_machine_, + "PreferencesPolicy"); + } +} + + +/*-------------------------------OkCancelPolicy------------------------------*/ + + +OkCancelPolicy::OkCancelPolicy() + : state_(INITIAL), + outputs_(INVALID+1, OKAY | APPLY | CANCEL | UNDO_ALL), + state_machine_(INVALID+1, StateArray(SMI_TOTAL, BOGUS)) +{ + // Build the state output map + outputs_[INITIAL] = CLOSE; + outputs_[VALID] = OKAY | CANCEL; + outputs_[INVALID] = CANCEL; + + // Build the state machine one state at a time + // NOTE: Since CANCEL and HIDE always go to INITIAL they are + // left out of the state machine and handled explicitly + // in input() + // + // State::INITIAL + state_machine_[INITIAL][SMI_READ_ONLY] = INITIAL; + state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL; + state_machine_[INITIAL][SMI_VALID] = VALID; + state_machine_[INITIAL][SMI_INVALID] = INVALID; + // State::VALID + state_machine_[VALID][SMI_VALID] = VALID; + state_machine_[VALID][SMI_READ_ONLY] = VALID; + state_machine_[VALID][SMI_READ_WRITE] = VALID; + state_machine_[VALID][SMI_INVALID] = INVALID; + state_machine_[VALID][SMI_OKAY] = INITIAL; + // State::INVALID + state_machine_[INVALID][SMI_VALID] = VALID; + state_machine_[INVALID][SMI_INVALID] = INVALID; + state_machine_[INVALID][SMI_READ_ONLY] = INVALID; + state_machine_[INVALID][SMI_READ_WRITE] = INVALID; +} + + + +void OkCancelPolicy::input(SMInput input) +{ + // CANCEL and HIDE always take us to INITIAL for all cases + if (SMI_CANCEL == input + || SMI_HIDE == input) { + state_ = INITIAL; + } else { + nextState(state_, input, state_machine_, "OkCancelPolicy"); + } +} + + +/*---------------------------OkCancelReadOnlyPolicy-------------------------*/ + + +OkCancelReadOnlyPolicy::OkCancelReadOnlyPolicy() + : state_(INITIAL), + outputs_(RO_INVALID+1, OKAY | APPLY | CANCEL | UNDO_ALL), + state_machine_(RO_INVALID+1, StateArray(SMI_TOTAL, BOGUS)) +{ + // Build the state output map + outputs_[INITIAL] = CLOSE; + outputs_[VALID] = OKAY | CANCEL; + outputs_[INVALID] = CANCEL; + outputs_[RO_INITIAL] = CLOSE; + outputs_[RO_VALID] = CANCEL; + outputs_[RO_INVALID] = CANCEL; + + // Build the state machine one state at a time + // NOTE: Since CANCEL and HIDE always go to INITIAL they are + // left out of the state machine and handled explicitly + // in input() + // + // State::INITIAL + state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL; + state_machine_[INITIAL][SMI_VALID] = VALID; + state_machine_[INITIAL][SMI_INVALID] = INVALID; + state_machine_[INITIAL][SMI_READ_ONLY] = RO_INITIAL; + // State::VALID + state_machine_[VALID][SMI_VALID] = VALID; + state_machine_[VALID][SMI_READ_WRITE] = VALID; + state_machine_[VALID][SMI_INVALID] = INVALID; + state_machine_[VALID][SMI_OKAY] = INITIAL; + state_machine_[VALID][SMI_READ_ONLY] = RO_VALID; + // State::INVALID + state_machine_[INVALID][SMI_INVALID] = INVALID; + state_machine_[INVALID][SMI_READ_WRITE] = INVALID; + state_machine_[INVALID][SMI_VALID] = VALID; + state_machine_[INVALID][SMI_READ_ONLY] = RO_INVALID; + // State::RO_INITIAL + state_machine_[RO_INITIAL][SMI_READ_ONLY] = RO_INITIAL; + state_machine_[RO_INITIAL][SMI_VALID] = RO_VALID; + state_machine_[RO_INITIAL][SMI_INVALID] = RO_INVALID; + state_machine_[RO_INITIAL][SMI_READ_WRITE] = INITIAL; + // State::RO_VALID + state_machine_[RO_VALID][SMI_VALID] = RO_VALID; + state_machine_[RO_VALID][SMI_READ_ONLY] = RO_VALID; + state_machine_[RO_VALID][SMI_INVALID] = RO_INVALID; + state_machine_[RO_VALID][SMI_READ_WRITE] = VALID; + // State::RO_INVALID + state_machine_[RO_INVALID][SMI_READ_ONLY] = RO_INVALID; + state_machine_[RO_INVALID][SMI_INVALID] = RO_INVALID; + state_machine_[RO_INVALID][SMI_VALID] = RO_VALID; + state_machine_[RO_INVALID][SMI_READ_WRITE] = INVALID; +} + + +void OkCancelReadOnlyPolicy::input(SMInput input) +{ + // CANCEL and HIDE always take us to INITIAL for all cases + if (SMI_CANCEL == input + || SMI_HIDE == input) { + state_ = INITIAL; + } else { + nextState(state_, + input, + state_machine_, + "OkCancelReadOnlyPolicy"); + } +} + + +/*--------------------------NoRepeatedApplyReadOnlyPolicy----------------------*/ + + +NoRepeatedApplyReadOnlyPolicy::NoRepeatedApplyReadOnlyPolicy() + : state_(INITIAL), + outputs_(RO_INVALID+1, OKAY | APPLY | CANCEL | UNDO_ALL), + state_machine_(RO_INVALID+1, StateArray(SMI_TOTAL, BOGUS)) +{ + // Build the state output map + outputs_[INITIAL] = CLOSE; + outputs_[VALID] = OKAY | APPLY | CANCEL; + outputs_[INVALID] = CANCEL; + outputs_[RO_INITIAL] = CLOSE; + outputs_[RO_VALID] = CANCEL; + outputs_[RO_INVALID] = CANCEL; + + // Build the state machine one state at a time + // NOTE: Since CANCEL and HIDE always go to INITIAL they are + // left out of the state machine and handled explicitly + // in input() + // + // State::INITIAL + state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL; + state_machine_[INITIAL][SMI_VALID] = VALID; + state_machine_[INITIAL][SMI_INVALID] = INVALID; + state_machine_[INITIAL][SMI_READ_ONLY] = RO_INITIAL; + // State::VALID + state_machine_[VALID][SMI_VALID] = VALID; + state_machine_[VALID][SMI_READ_WRITE] = VALID; + state_machine_[VALID][SMI_INVALID] = INVALID; + state_machine_[VALID][SMI_OKAY] = INITIAL; + state_machine_[VALID][SMI_APPLY] = INITIAL; + state_machine_[VALID][SMI_READ_ONLY] = RO_VALID; + // State::INVALID + state_machine_[INVALID][SMI_INVALID] = INVALID; + state_machine_[INVALID][SMI_READ_WRITE] = INVALID; + state_machine_[INVALID][SMI_VALID] = VALID; + state_machine_[INVALID][SMI_READ_ONLY] = RO_INVALID; + // State::RO_INITIAL + state_machine_[RO_INITIAL][SMI_READ_ONLY] = RO_INITIAL; + state_machine_[RO_INITIAL][SMI_VALID] = RO_VALID; + state_machine_[RO_INITIAL][SMI_INVALID] = RO_INVALID; + state_machine_[RO_INITIAL][SMI_READ_WRITE] = INITIAL; + // State::RO_VALID + state_machine_[RO_VALID][SMI_VALID] = RO_VALID; + state_machine_[RO_VALID][SMI_READ_ONLY] = RO_VALID; + state_machine_[RO_VALID][SMI_INVALID] = RO_INVALID; + state_machine_[RO_VALID][SMI_READ_WRITE] = VALID; + // State::RO_INVALID + state_machine_[RO_INVALID][SMI_INVALID] = RO_INVALID; + state_machine_[RO_INVALID][SMI_READ_ONLY] = RO_INVALID; + state_machine_[RO_INVALID][SMI_VALID] = RO_VALID; + state_machine_[RO_INVALID][SMI_READ_WRITE] = INVALID; +} + + +void NoRepeatedApplyReadOnlyPolicy::input(SMInput input) +{ + // CANCEL and HIDE always take us to INITIAL for all cases + if (SMI_CANCEL == input + || SMI_HIDE == input) { + state_ = INITIAL; + } else { + nextState(state_, + input, + state_machine_, + "NoRepeatedApplyReadOnlyPolicy"); + } +} + + +/*--------------------------OkApplyCancelReadOnlyPolicy----------------------*/ + + +OkApplyCancelReadOnlyPolicy::OkApplyCancelReadOnlyPolicy() + : state_(INITIAL), + outputs_(RO_APPLIED+1, OKAY | APPLY | CANCEL | UNDO_ALL), + state_machine_(RO_APPLIED+1, StateArray(SMI_TOTAL, BOGUS)) +{ + // Build the state output map + outputs_[INITIAL] = CLOSE; + outputs_[VALID] = OKAY | APPLY | CANCEL; + outputs_[INVALID] = CANCEL; + outputs_[APPLIED] = OKAY | APPLY | CLOSE; + outputs_[RO_INITIAL] = CLOSE; + outputs_[RO_VALID] = CANCEL; + outputs_[RO_INVALID] = CANCEL; + outputs_[RO_APPLIED] = CANCEL; + + // Build the state machine one state at a time + // NOTE: Since CANCEL and HIDE always go to INITIAL they are + // left out of the state machine and handled explicitly + // in input() + // + // State::INITIAL + state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL; + state_machine_[INITIAL][SMI_VALID] = VALID; + state_machine_[INITIAL][SMI_INVALID] = INVALID; + state_machine_[INITIAL][SMI_READ_ONLY] = RO_INITIAL; + // State::VALID + state_machine_[VALID][SMI_VALID] = VALID; + state_machine_[VALID][SMI_READ_WRITE] = VALID; + state_machine_[VALID][SMI_INVALID] = INVALID; + state_machine_[VALID][SMI_OKAY] = INITIAL; + state_machine_[VALID][SMI_APPLY] = APPLIED; + state_machine_[VALID][SMI_READ_ONLY] = RO_VALID; + // State::INVALID + state_machine_[INVALID][SMI_INVALID] = INVALID; + state_machine_[INVALID][SMI_READ_WRITE] = INVALID; + state_machine_[INVALID][SMI_VALID] = VALID; + state_machine_[INVALID][SMI_READ_ONLY] = RO_INVALID; + // State::APPLIED + state_machine_[APPLIED][SMI_APPLY] = APPLIED; + state_machine_[APPLIED][SMI_READ_WRITE] = APPLIED; + state_machine_[APPLIED][SMI_VALID] = VALID; + state_machine_[APPLIED][SMI_INVALID] = INVALID; + state_machine_[APPLIED][SMI_OKAY] = INITIAL; + state_machine_[APPLIED][SMI_READ_ONLY] = RO_APPLIED; + // State::RO_INITIAL + state_machine_[RO_INITIAL][SMI_READ_ONLY] = RO_INITIAL; + state_machine_[RO_INITIAL][SMI_VALID] = RO_VALID; + state_machine_[RO_INITIAL][SMI_INVALID] = RO_INVALID; + state_machine_[RO_INITIAL][SMI_READ_WRITE] = INITIAL; + // State::RO_VALID + state_machine_[RO_VALID][SMI_VALID] = RO_VALID; + state_machine_[RO_VALID][SMI_READ_ONLY] = RO_VALID; + state_machine_[RO_VALID][SMI_INVALID] = RO_INVALID; + state_machine_[RO_VALID][SMI_READ_WRITE] = VALID; + // State::RO_INVALID + state_machine_[RO_INVALID][SMI_INVALID] = RO_INVALID; + state_machine_[RO_INVALID][SMI_READ_ONLY] = RO_INVALID; + state_machine_[RO_INVALID][SMI_VALID] = RO_VALID; + state_machine_[RO_INVALID][SMI_READ_WRITE] = INVALID; + // State::RO_APPLIED + state_machine_[RO_APPLIED][SMI_READ_ONLY] = RO_APPLIED; + state_machine_[RO_APPLIED][SMI_INVALID] = RO_INVALID; + state_machine_[RO_APPLIED][SMI_VALID] = RO_VALID; + state_machine_[RO_APPLIED][SMI_READ_WRITE] = APPLIED; +} + + +void OkApplyCancelReadOnlyPolicy::input(SMInput input) +{ + // CANCEL and HIDE always take us to INITIAL for all cases + if (SMI_CANCEL == input + || SMI_HIDE == input) { + state_ = INITIAL; + } else { + nextState(state_, + input, + state_machine_, + "OkApplyCancelReadOnlyPolicy"); + } +} + + +/*--------------------------OkApplyCancelPolicy----------------------*/ + + +OkApplyCancelPolicy::OkApplyCancelPolicy() + : state_(INITIAL), + outputs_(APPLIED+1, OKAY | APPLY | CANCEL | UNDO_ALL), + state_machine_(APPLIED+1, StateArray(SMI_TOTAL, BOGUS)) +{ + // Build the state output map + outputs_[INITIAL] = CLOSE; + outputs_[VALID] = OKAY | APPLY | CANCEL; + outputs_[INVALID] = CANCEL; + outputs_[APPLIED] = OKAY | APPLY | CLOSE; + + // Build the state machine one state at a time + // NOTE: Since CANCEL and HIDE always go to INITIAL they are + // left out of the state machine and handled explicitly + // in input() + // + // State::INITIAL + state_machine_[INITIAL][SMI_READ_ONLY] = INITIAL; + state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL; + state_machine_[INITIAL][SMI_VALID] = VALID; + state_machine_[INITIAL][SMI_INVALID] = INVALID; + // State::VALID + state_machine_[VALID][SMI_VALID] = VALID; + state_machine_[VALID][SMI_READ_ONLY] = VALID; + state_machine_[VALID][SMI_READ_WRITE] = VALID; + state_machine_[VALID][SMI_INVALID] = INVALID; + state_machine_[VALID][SMI_OKAY] = INITIAL; + state_machine_[VALID][SMI_APPLY] = APPLIED; + // State::INVALID + state_machine_[INVALID][SMI_INVALID] = INVALID; + state_machine_[INVALID][SMI_READ_ONLY] = INVALID; + state_machine_[INVALID][SMI_READ_WRITE] = INVALID; + state_machine_[INVALID][SMI_VALID] = VALID; + // State::APPLIED + state_machine_[APPLIED][SMI_APPLY] = APPLIED; + state_machine_[APPLIED][SMI_READ_ONLY] = APPLIED; + state_machine_[APPLIED][SMI_READ_WRITE] = APPLIED; + state_machine_[APPLIED][SMI_VALID] = VALID; + state_machine_[APPLIED][SMI_INVALID] = INVALID; + state_machine_[APPLIED][SMI_OKAY] = INITIAL; +} + + +void OkApplyCancelPolicy::input(SMInput input) +{ + // CANCEL and HIDE always take us to INITIAL for all cases + if (SMI_CANCEL == input + || SMI_HIDE == input) { + state_ = INITIAL; + } else { + nextState(state_, + input, + state_machine_, + "OkApplyCancelPolicy"); + } +} + + +/*--------------------------NoRepeatedApplyPolicy----------------------*/ + + +NoRepeatedApplyPolicy::NoRepeatedApplyPolicy() + : state_(INITIAL), + outputs_(INVALID+1, OKAY | APPLY | CANCEL | UNDO_ALL), + state_machine_(INVALID+1, StateArray(SMI_TOTAL, BOGUS)) +{ + // Build the state output map + outputs_[INITIAL] = CLOSE; + outputs_[VALID] = OKAY | APPLY | CANCEL; + outputs_[INVALID] = CANCEL; + + // Build the state machine one state at a time + // NOTE: Since CANCEL and HIDE always go to INITIAL they are + // left out of the state machine and handled explicitly + // in input() + // + // State::INITIAL + state_machine_[INITIAL][SMI_READ_ONLY] = INITIAL; + state_machine_[INITIAL][SMI_READ_WRITE] = INITIAL; + state_machine_[INITIAL][SMI_VALID] = VALID; + state_machine_[INITIAL][SMI_INVALID] = INVALID; + // State::VALID + state_machine_[VALID][SMI_VALID] = VALID; + state_machine_[VALID][SMI_READ_ONLY] = VALID; + state_machine_[VALID][SMI_READ_WRITE] = VALID; + state_machine_[VALID][SMI_INVALID] = INVALID; + state_machine_[VALID][SMI_OKAY] = INITIAL; + state_machine_[VALID][SMI_APPLY] = INITIAL; + // State::INVALID + state_machine_[INVALID][SMI_INVALID] = INVALID; + state_machine_[INVALID][SMI_READ_ONLY] = INVALID; + state_machine_[INVALID][SMI_READ_WRITE] = INVALID; + state_machine_[INVALID][SMI_VALID] = VALID; +} + + +void NoRepeatedApplyPolicy::input(SMInput input) +{ + // CANCEL and HIDE always take us to INITIAL for all cases + if (SMI_CANCEL == input + || SMI_HIDE == input) { + state_ = INITIAL; + } else { + nextState(state_, + input, + state_machine_, + "NoRepeatedApplyPolicy"); + } +} diff --git a/src/frontends/ButtonPolicies.h b/src/frontends/ButtonPolicies.h new file mode 100644 index 0000000000..d817ad233c --- /dev/null +++ b/src/frontends/ButtonPolicies.h @@ -0,0 +1,370 @@ +// -*- C++ -*- +/* ButtonPolicies.h + * Provides a state machine implementation of the various button policies + * used by the dialogs. + * Author: Allan Rae + * This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. + * + * This file Copyright 2000 + * Allan Rae + * ====================================================== + */ + +#ifndef BUTTONPOLICIES_H +#define BUTTONPOLICIES_H + + +#include +#include "support/utility.hpp" + + +/** An abstract base class for button policies. + A state machine implementation of the various button policies used by the + dialogs. Only the policy is implemented here. Separate ButtonController + classes are needed for each GUI implementation. + */ +class ButtonPolicy : public noncopyable +{ +public: + /**@name Constructors and Deconstructors */ + //@{ + /// + virtual ~ButtonPolicy() {} + //@} + + /**@name Enums */ + //@{ + /** The various possible state names. + Not all state-machines have this many states. However, we need + to define them all here so we can share the code. + */ + enum State { + INITIAL = 0, + VALID, + INVALID, + APPLIED, + RO_INITIAL, + RO_VALID, + RO_INVALID, + RO_APPLIED, + BOGUS = 55 + }; + /// The various button types. + enum Button { + CLOSE = 0, // Not a real button, but effectively !CANCEL + OKAY = 1, + APPLY = 2, + CANCEL = 4, + UNDO_ALL = 8 + }; + /** State machine inputs. + All the policies so far have both CANCEL and HIDE always going to + INITIAL. This won't necessarily be true for all [future] policies + though so I'll leave those two as distinct inputs rather than merge + them. For example, a dialog that doesn't update it's input fields + when reshown after being hidden needs a policy where CANCEL and + HIDE are treated differently. + */ + enum SMInput { + SMI_VALID = 0, + SMI_INVALID, + SMI_OKAY, + SMI_APPLY, + SMI_CANCEL, + SMI_UNDO_ALL, + SMI_HIDE, + SMI_READ_ONLY, + SMI_READ_WRITE, + SMI_TOTAL // not a real input + }; + //@} + + /**@name Access Functions */ + //@{ + /// Trigger a transition with this input. + virtual void input(SMInput) = 0; + /// Activation status of OK + virtual bool buttonStatus(Button) = 0; + //@} + + /**@name Typedefs */ + //@{ + /// Transition map of the state machine. + typedef std::vector StateArray; + typedef std::vector StateMachine; + /// The state outputs are the status of the buttons. + typedef std::vector StateOutputs; + //@} +}; + + +/** Defines the policy used by the Preferences dialog. + Four buttons: Ok (Save), Apply, Cancel/Close, Restore. + Note: This scheme supports the relabelling of Cancel to Close and vice versa. + This is based on the value of the bool state of the Button::CANCEL. + true == Cancel, false == Close + */ +class PreferencesPolicy : public ButtonPolicy +{ +public: + /// + PreferencesPolicy(); + /// + virtual ~PreferencesPolicy() {} + + /**@name Access Functions */ + //@{ + /// Trigger a transition with this input. + virtual void input(SMInput); + /** Activation status of a button. + We assume that we haven't gotten into an undefined state. + This is reasonable since we can only reach states defined + in the state machine and they should all have been defined in + the outputs_ variable. Perhaps we can do something at compile + time to check that all the states have corresponding outputs. + */ + virtual bool buttonStatus(Button button) + { return button & outputs_[state_]; } + //@} +private: + /**@name Private Data Members */ + //@{ + /// Current state. + State state_; + /// Which buttons are active for a given state. + StateOutputs outputs_; + /// + StateMachine state_machine_; + //@} +}; + + + +/** Ok and Cancel buttons for dialogs with read-only operation. + Note: This scheme supports the relabelling of Cancel to Close and vice versa. + This is based on the value of the bool state of the Button::CANCEL. + true == Cancel, false == Close + */ +class OkCancelPolicy : public ButtonPolicy +{ +public: + /// + OkCancelPolicy(); + /// + virtual ~OkCancelPolicy() {} + + /**@name Access Functions */ + //@{ + /// Trigger a transition with this input. + virtual void input(SMInput); + /// Activation status of a button. + virtual bool buttonStatus(Button button) + { return button & outputs_[state_]; } + //@} +private: + /**@name Private Data Members */ + //@{ + /// Current state. + State state_; + /// Which buttons are active for a given state. + StateOutputs outputs_; + /// + StateMachine state_machine_; + //@} +}; + + +/** Ok and Cancel buttons for dialogs where read-only operation is blocked. + The state machine design for this policy allows changes to occur within + the dialog while a file is read-only -- the okay button is disabled until + a read-write input is given. When the file is made read-write the dialog + will then be in the correct state (as if the file had always been read-write). + Note: This scheme supports the relabelling of Cancel to Close and vice versa. + This is based on the value of the bool state of the Button::CANCEL. + true == Cancel, false == Close + */ +class OkCancelReadOnlyPolicy : public ButtonPolicy +{ +public: + /// + OkCancelReadOnlyPolicy(); + /// + virtual ~OkCancelReadOnlyPolicy() {} + + /**@name Access Functions */ + //@{ + /// Trigger a transition with this input. + virtual void input(SMInput); + /// Activation status of a button. + virtual bool buttonStatus(Button button) + { return button & outputs_[state_]; } + //@} +private: + /**@name Private Data Members */ + //@{ + /// Current state. + State state_; + /// Which buttons are active for a given state. + StateOutputs outputs_; + /// + StateMachine state_machine_; + //@} +}; + + +/** Ok, Apply and Cancel buttons for dialogs where read-only operation is blocked. + Repeated Apply are not allowed. Likewise, Ok cannot follow Apply without + some valid input. That is, the dialog contents must change between each Apply + or Apply and Ok. + The state machine design for this policy allows changes to occur within + the dialog while a file is read-only -- the Ok+Apply buttons are disabled + until a read-write input is given. When the file is made read-write the + dialog will then be in the correct state (as if the file had always been + read-write). + Note: This scheme supports the relabelling of Cancel to Close and vice versa. + This is based on the value of the bool state of the Button::CANCEL. + true == Cancel, false == Close + */ +class NoRepeatedApplyReadOnlyPolicy : public ButtonPolicy +{ +public: + /// + NoRepeatedApplyReadOnlyPolicy(); + /// + virtual ~NoRepeatedApplyReadOnlyPolicy() {} + + /**@name Access Functions */ + //@{ + /// Trigger a transition with this input. + virtual void input(SMInput); + /// Activation status of a button. + virtual bool buttonStatus(Button button) + { return button & outputs_[state_]; } + //@} +private: + /**@name Private Data Members */ + //@{ + /// Current state. + State state_; + /// Which buttons are active for a given state. + StateOutputs outputs_; + /// + StateMachine state_machine_; + //@} +}; + + +/** Ok, Apply and Cancel buttons for dialogs where read-only operation is blocked. + Repeated Apply is allowed. Likewise, Ok can follow Apply. + The state machine design for this policy allows changes to occur within + the dialog while a file is read-only -- the Ok+Apply buttons are disabled + until a read-write input is given. When the file is made read-write the + dialog will then be in the correct state (as if the file had always been + read-write). + Note: This scheme supports the relabelling of Cancel to Close and vice versa. + This is based on the value of the bool state of the Button::CANCEL. + true == Cancel, false == Close + */ +class OkApplyCancelReadOnlyPolicy : public ButtonPolicy +{ +public: + /// + OkApplyCancelReadOnlyPolicy(); + /// + virtual ~OkApplyCancelReadOnlyPolicy() {} + + /**@name Access Functions */ + //@{ + /// Trigger a transition with this input. + virtual void input(SMInput); + /// Activation status of a button. + virtual bool buttonStatus(Button button) + { return button & outputs_[state_]; } + //@} +private: + /**@name Private Data Members */ + //@{ + /// Current state. + State state_; + /// Which buttons are active for a given state. + StateOutputs outputs_; + /// + StateMachine state_machine_; + //@} +}; + + +/** Ok, Apply and Cancel buttons for dialogs where repeated Apply is allowed. + Note: This scheme supports the relabelling of Cancel to Close and vice versa. + This is based on the value of the bool state of the Button::CANCEL. + true == Cancel, false == Close + */ +class OkApplyCancelPolicy : public ButtonPolicy +{ +public: + /// + OkApplyCancelPolicy(); + /// + virtual ~OkApplyCancelPolicy() {} + + /**@name Access Functions */ + //@{ + /// Trigger a transition with this input. + virtual void input(SMInput); + /// Activation status of a button. + virtual bool buttonStatus(Button button) + { return button & outputs_[state_]; } + //@} +private: + /**@name Private Data Members */ + //@{ + /// Current state. + State state_; + /// Which buttons are active for a given state. + StateOutputs outputs_; + /// + StateMachine state_machine_; + //@} +}; + + +/** Ok, Apply and Cancel buttons for dialogs with no repeated Apply. + Note: This scheme supports the relabelling of Cancel to Close and vice versa. + This is based on the value of the bool state of the Button::CANCEL. + true == Cancel, false == Close + */ +class NoRepeatedApplyPolicy : public ButtonPolicy +{ +public: + /// + NoRepeatedApplyPolicy(); + /// + virtual ~NoRepeatedApplyPolicy() {} + + /**@name Access Functions */ + //@{ + /// Trigger a transition with this input. + virtual void input(SMInput); + /// Activation status of a button. + virtual bool buttonStatus(Button button) + { return button & outputs_[state_]; } + //@} +private: + /**@name Private Data Members */ + //@{ + /// Current state. + State state_; + /// Which buttons are active for a given state. + StateOutputs outputs_; + /// + StateMachine state_machine_; + //@} +}; + +#endif diff --git a/src/frontends/Liason.h b/src/frontends/Liason.h index 6007c66368..77aceddb2d 100644 --- a/src/frontends/Liason.h +++ b/src/frontends/Liason.h @@ -48,15 +48,15 @@ class BufferParams; namespace Liason { #endif -/**@name Global support functions */ -//@{ -/// get global printer parameters -PrinterParams getPrinterParams(Buffer *); -/// print the current buffer -bool printBuffer(Buffer *, PrinterParams const &); -/// set the minibuffer -void setMinibuffer(LyXView *, char const * msg); -//@} + /**@name Global support functions */ + //@{ + /// get global printer parameters + PrinterParams getPrinterParams(Buffer *); + /// print the current buffer + bool printBuffer(Buffer *, PrinterParams const &); + /// set the minibuffer + void setMinibuffer(LyXView *, char const * msg); + //@} #ifdef CXX_WORKING_NAMESPACES } diff --git a/src/frontends/Makefile.am b/src/frontends/Makefile.am index 120f69a54f..fc2bf32051 100644 --- a/src/frontends/Makefile.am +++ b/src/frontends/Makefile.am @@ -7,6 +7,8 @@ INCLUDES = ${FRONTEND_INCLUDES} -I${srcdir}/.. -I${srcdir}/@FRONTEND@ ${SIGC_CFL LIBS = noinst_LTLIBRARIES = libfrontends.la libfrontends_la_SOURCES=\ + ButtonPolicies.C \ + ButtonPolicies.h \ Dialogs.h \ DialogBase.h \ Liason.C \ diff --git a/src/frontends/xforms/ButtonController.h b/src/frontends/xforms/ButtonController.h new file mode 100644 index 0000000000..1dd02eacca --- /dev/null +++ b/src/frontends/xforms/ButtonController.h @@ -0,0 +1,189 @@ +// -*- C++ -*- +/* ButtonController.h + * Controls the activation of the OK, Apply and Cancel buttons. + * Actually supports 4 buttons in all and it's up to the user to decide on + * the activation policy and which buttons correspond to which output of the + * state machine. + * Author: Allan Rae + * This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2000 The LyX Team. + * + * This file Copyright 2000 + * Allan Rae + * ====================================================== + */ + +#ifndef BUTTONCONTROLLER_H +#define BUTTONCONTROLLER_H + +#include "ButtonPolicies.h" + +/** General purpose button controller for up to four buttons. + Controls the activation of the OK, Apply and Cancel buttons. + Actually supports 4 buttons in all and it's up to the user to decide on + the activation policy and which buttons correspond to which output of the + state machine. +*/ +template +class ButtonController : public noncopyable +{ +public: + /**@name Constructors and Deconstructors */ + //@{ + /** Constructor. + The cancel/close label entries are _not_ managed within the class + thereby allowing you to reassign at will and to use static labels. + It also means if you really don't want to have the Cancel button + label be different when there is nothing changed in the dialog then + you can just assign "Cancel" to both labels. Or even reuse this + class for something completely different. + */ + ButtonController(char const * cancel, char const * close) + : bp_(), okay_(0), apply_(0), cancel_(0), undo_all_(0), + cancel_label(cancel), close_label(close) {} + /// Somebody else owns the FL_OBJECTs we just manipulate them. + ~ButtonController() {} + //@} + + /**@name Initialise Button Functions */ + //@{ + /// Call refresh() when finished setting the buttons. + void setOkay(FL_OBJECT * obj) + { okay_ = obj; } + /// + void setApply(FL_OBJECT * obj) + { apply_ = obj; } + /// + void setCancel(FL_OBJECT * obj) + { cancel_ = obj; } + /// + void setUndoAll(FL_OBJECT * obj) + { undo_all_ = obj; } + /// + void setCancelTrueLabel(char const * c) + { cancel_label = c; } + /// + void setCancelFalseLabel(char const * c) + { close_label = c; } + //@} + + /**@name Action Functions */ + //@{ + /// + void input(ButtonPolicy::SMInput in) + { + bp_.input(in); + refresh(); + } + /// + void okay() + { input(ButtonPolicy::SMI_OKAY); } + /// + void apply() + { input(ButtonPolicy::SMI_APPLY); } + /// + void cancel() + { input(ButtonPolicy::SMI_CANCEL); } + /// + void undoAll() + { input(ButtonPolicy::SMI_UNDO_ALL); } + /// + void hide() + { input(ButtonPolicy::SMI_HIDE); } + /// Passthrough function -- returns its input value + bool read_only(bool ro = true) + { + if (ro) { + input(ButtonPolicy::SMI_READ_ONLY); + } else { + input(ButtonPolicy::SMI_READ_WRITE); + } + return ro; + } + /// + void read_write() + { read_only(false); } + /// Passthrough function -- returns its input value + bool valid(bool v = true) + { + if (v) { + input(ButtonPolicy::SMI_VALID); + } else { + input(ButtonPolicy::SMI_INVALID); + } + return v; + } + /// + void invalid() + { valid(false); } + /// force a refresh of the buttons + void refresh() + { + if (okay_) { + if (bp_.buttonStatus(ButtonPolicy::OKAY)) { + fl_activate_object(okay_); + fl_set_object_lcol(okay_, FL_BLACK); + } else { + fl_deactivate_object(okay_); + fl_set_object_lcol(okay_, FL_INACTIVE); + } + } + if (apply_) { + if (bp_.buttonStatus(ButtonPolicy::APPLY)) { + fl_activate_object(apply_); + fl_set_object_lcol(apply_, FL_BLACK); + } else { + fl_deactivate_object(apply_); + fl_set_object_lcol(apply_, FL_INACTIVE); + } + } + if (undo_all_) { + if (bp_.buttonStatus(ButtonPolicy::UNDO_ALL)) { + fl_activate_object(undo_all_); + fl_set_object_lcol(undo_all_, FL_BLACK); + } else { + fl_deactivate_object(undo_all_); + fl_set_object_lcol(undo_all_, + FL_INACTIVE); + } + } + if (cancel_) { + if (bp_.buttonStatus(ButtonPolicy::CANCEL)) { + fl_set_object_label(cancel_, + cancel_label); + } else { + fl_set_object_label(cancel_, + close_label); + } + } + } + //@} +private: + /// + Policy bp_; + /**@name Button Widgets */ + //@{ + /// + FL_OBJECT * okay_; + /// + FL_OBJECT * apply_; + /// + FL_OBJECT * cancel_; + /// + FL_OBJECT * undo_all_; + //@} + /**@name Cancel/Close Button Labels */ + //@{ + /// + char const * cancel_label; + /// + char const * close_label; + //@} +}; + +#endif diff --git a/src/frontends/xforms/FormCitation.C b/src/frontends/xforms/FormCitation.C index 5fb44e53c5..4b891c445e 100644 --- a/src/frontends/xforms/FormCitation.C +++ b/src/frontends/xforms/FormCitation.C @@ -49,7 +49,6 @@ FormCitation::FormCitation(LyXView * lv, Dialogs * d) FormCitation::~FormCitation() { - free(); delete dialog_; } @@ -70,8 +69,8 @@ void FormCitation::build() FL_FORM * const FormCitation::form() const { - if( dialog_ ) // no need to test for dialog_->citation - return dialog_->form_citation; + if( dialog_ ) // no need to test for dialog_->form + return dialog_->form; else return 0; } @@ -109,8 +108,8 @@ void FormCitation::update() int noKeys = max( bibkeys.size(), citekeys.size() ); - // Place bounds, so that 4 <= noKeys <= 15 - noKeys = max( 4, min(15, noKeys) ); + // Place bounds, so that 4 <= noKeys <= 10 + noKeys = max( 4, min(10, noKeys) ); // Re-size the form to accommodate the new browser size int size = 20 * noKeys; @@ -200,15 +199,15 @@ void FormCitation::setSize( int hbrsr, bool bibPresent ) const int const hinfo = dialog_->infoBrsr->h; int const hother = 140; hbrsr = max( hbrsr, 175 ); - int wform = dialog_->form_citation->w; + int wform = dialog_->form->w; int hform = hbrsr + hother; if( bibPresent ) hform += hinfo + 30; - fl_set_form_size( dialog_->form_citation, wform, hform ); + fl_set_form_size( dialog_->form, wform, hform ); - // No resizing is alowed in the y-direction - fl_set_form_minsize( dialog_->form_citation, wform, hform ); - fl_set_form_maxsize( dialog_->form_citation, 3*wform, hform ); + // No resizing is allowed in the y-direction + fl_set_form_minsize( dialog_->form, wform, hform ); + fl_set_form_maxsize( dialog_->form, 3*wform, hform ); int y = 0; fl_set_object_geometry( dialog_->box, 0, y, wform, hform ); diff --git a/src/frontends/xforms/FormCommand.C b/src/frontends/xforms/FormCommand.C index 6ec5658db5..cdf64c0840 100644 --- a/src/frontends/xforms/FormCommand.C +++ b/src/frontends/xforms/FormCommand.C @@ -83,18 +83,6 @@ void FormCommand::show() } -void FormCommand::free() -{ - // we don't need to delete u and h here because - // hide() does that after disconnecting. - if( form() ) { - if( form()->visible ) - hide(); - fl_free_form(form()); - } -} - - void FormCommand::hide() { if (form() && form()->visible) { diff --git a/src/frontends/xforms/FormCommand.h b/src/frontends/xforms/FormCommand.h index dff523bd56..ab3899113b 100644 --- a/src/frontends/xforms/FormCommand.h +++ b/src/frontends/xforms/FormCommand.h @@ -57,8 +57,6 @@ protected: virtual void update() = 0; /// Apply from dialog (modify or create inset) virtual void apply() = 0; - /// Explicitly free the dialog. - void free(); /// delete derived class variables from hide() virtual void clearStore() {} /// Pointer to the actual instantiation of the xform's form diff --git a/src/frontends/xforms/FormCopyright.C b/src/frontends/xforms/FormCopyright.C index 5a8ecdc14d..75488fdbf9 100644 --- a/src/frontends/xforms/FormCopyright.C +++ b/src/frontends/xforms/FormCopyright.C @@ -33,13 +33,15 @@ FormCopyright::FormCopyright(LyXView * lv, Dialogs * d) FormCopyright::~FormCopyright() { - free(); + delete dialog_; } void FormCopyright::build() { - dialog_ = build_copyright(); + dialog_ = build_copyright(); + fl_set_form_atclose(dialog_->form, + C_FormCopyrightWMHideCB, 0); } @@ -47,14 +49,12 @@ void FormCopyright::show() { if (!dialog_) { build(); - fl_set_form_atclose(dialog_->form_copyright, - C_FormCopyrightWMHideCB, 0); } - if (dialog_->form_copyright->visible) { - fl_raise_form(dialog_->form_copyright); + if (dialog_->form->visible) { + fl_raise_form(dialog_->form); } else { - fl_show_form(dialog_->form_copyright, + fl_show_form(dialog_->form, FL_PLACE_MOUSE, FL_FULLBORDER, _("Copyright and Warranty")); @@ -66,28 +66,11 @@ void FormCopyright::show() void FormCopyright::hide() { if (dialog_ - && dialog_->form_copyright - && dialog_->form_copyright->visible) { - fl_hide_form(dialog_->form_copyright); + && dialog_->form + && dialog_->form->visible) { + fl_hide_form(dialog_->form); h_.disconnect(); } - free(); -} - - -void FormCopyright::free() -{ - // we don't need to delete h here because - // hide() does that after disconnecting. - if (dialog_) { - if (dialog_->form_copyright - && dialog_->form_copyright->visible) { - hide(); - } - fl_free_form(dialog_->form_copyright); - delete dialog_; - dialog_ = 0; - } } diff --git a/src/frontends/xforms/FormCopyright.h b/src/frontends/xforms/FormCopyright.h index c2181599e6..587dcbf40e 100644 --- a/src/frontends/xforms/FormCopyright.h +++ b/src/frontends/xforms/FormCopyright.h @@ -55,8 +55,6 @@ private: void build(); /// FD_form_copyright * build_copyright(); - /// Explicitly free the dialog. - void free(); /// Real GUI implementation. FD_form_copyright * dialog_; diff --git a/src/frontends/xforms/FormDocument.C b/src/frontends/xforms/FormDocument.C index ba93d35421..db5a697181 100644 --- a/src/frontends/xforms/FormDocument.C +++ b/src/frontends/xforms/FormDocument.C @@ -119,7 +119,7 @@ void FormDocument::build() // The language is a combo-box and has to be inserted manually FL_OBJECT * obj = language_->choice_language; - fl_addto_form(language_->form_doc_language); + fl_addto_form(language_->form); combo_language = new Combox(FL_COMBOX_DROPLIST); combo_language->add(obj->x, obj->y, obj->w, obj->h, 200); combo_language->shortcut("#L",1); @@ -156,18 +156,18 @@ void FormDocument::build() fl_set_input_return(bullets_->input_bullet_latex, FL_RETURN_CHANGED); fl_set_input_maxchars(bullets_->input_bullet_latex, 80); - fl_set_form_atclose(dialog_->form_tabbed_document, + fl_set_form_atclose(dialog_->form, FormDocument::WMHideCB, 0); fl_addto_tabfolder(dialog_->tabbed_folder,_("Document"), - class_->form_doc_class); + class_->form); fl_addto_tabfolder(dialog_->tabbed_folder,_("Paper"), - paper_->form_doc_paper); + paper_->form); fl_addto_tabfolder(dialog_->tabbed_folder,_("Language"), - language_->form_doc_language); + language_->form); fl_addto_tabfolder(dialog_->tabbed_folder,_("Extra"), - options_->form_doc_options); + options_->form); fbullet = fl_addto_tabfolder(dialog_->tabbed_folder,_("Bullets"), - bullets_->form_doc_bullet); + bullets_->form); if ((XpmVersion < 4) || (XpmVersion == 4 && XpmRevision < 7)) { lyxerr << _("Your version of libXpm is older than 4.7.\n" "The `bullet' tab of the document popup " @@ -183,10 +183,10 @@ void FormDocument::show() build(); update(); // make sure its up-to-date - if (dialog_->form_tabbed_document->visible) { - fl_raise_form(dialog_->form_tabbed_document); + if (dialog_->form->visible) { + fl_raise_form(dialog_->form); } else { - fl_show_form(dialog_->form_tabbed_document, + fl_show_form(dialog_->form, FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT, _("Document Layout")); u_ = d_->updateBufferDependent.connect( @@ -198,8 +198,8 @@ void FormDocument::show() void FormDocument::hide() { - if (dialog_->form_tabbed_document->visible) { - fl_hide_form(dialog_->form_tabbed_document); + if (dialog_->form->visible) { + fl_hide_form(dialog_->form); u_.disconnect(); h_.disconnect(); } @@ -645,7 +645,7 @@ void FormDocument::paper_update() fl_set_input(paper_->input_head_height, params.headheight.c_str()); fl_set_input(paper_->input_head_sep, params.headsep.c_str()); fl_set_input(paper_->input_foot_skip, params.footskip.c_str()); - fl_set_focus_object(paper_->form_doc_paper, paper_->choice_papersize2); + fl_set_focus_object(paper_->form, paper_->choice_papersize2); } void FormDocument::bullets_update() @@ -686,32 +686,32 @@ void FormDocument::free() if (dialog_) { hide(); if (class_) { - fl_free_form(class_->form_doc_class); + fl_free_form(class_->form); delete class_; class_ = 0; } if (paper_) { - fl_free_form(paper_->form_doc_paper); + fl_free_form(paper_->form); delete paper_; paper_ = 0; } if (language_) { delete combo_language; - fl_free_form(language_->form_doc_language); + fl_free_form(language_->form); delete language_; language_ = 0; } if (options_) { - fl_free_form(options_->form_doc_options); + fl_free_form(options_->form); delete options_; options_ = 0; } if (bullets_) { - fl_free_form(bullets_->form_doc_bullet); + fl_free_form(bullets_->form); delete bullets_; bullets_ = 0; } - fl_free_form(dialog_->form_tabbed_document); + fl_free_form(dialog_->form); delete dialog_; dialog_ = 0; } @@ -933,7 +933,7 @@ void FormDocument::BulletPanel(FL_OBJECT * /*ob*/, long data) /* by the user. (eg. standard.xpm, psnfss1.xpm etc...) */ if (data != current_bullet_panel) { - fl_freeze_form(bullets_->form_doc_bullet); + fl_freeze_form(bullets_->form); current_bullet_panel = data; /* free the current pixmap */ @@ -970,7 +970,7 @@ void FormDocument::BulletPanel(FL_OBJECT * /*ob*/, long data) fl_set_bmtable_pixmap_file(bullets_->bmtable_bullet_panel, 6, 6, LibFileSearch("images", new_panel.c_str()).c_str()); fl_redraw_object(bullets_->bmtable_bullet_panel); - fl_unfreeze_form(bullets_->form_doc_bullet); + fl_unfreeze_form(bullets_->form); } } diff --git a/src/frontends/xforms/FormGraphics.C b/src/frontends/xforms/FormGraphics.C index 65582dbadf..53c8f0dc68 100644 --- a/src/frontends/xforms/FormGraphics.C +++ b/src/frontends/xforms/FormGraphics.C @@ -147,7 +147,7 @@ void FormGraphics::build() InsetGraphicsParams::NONE); // Connect a signal to hide the window when the window manager orders it. - fl_set_form_atclose(dialog_->form_graphics, + fl_set_form_atclose(dialog_->form, C_FormGraphicsWMHideCB, 0); } @@ -162,12 +162,12 @@ void FormGraphics::show() update(); // If the form is visible - if (dialog_->form_graphics->visible) { + if (dialog_->form->visible) { // Raise it. - fl_raise_form(dialog_->form_graphics); + fl_raise_form(dialog_->form); } else { // Otherwise (invisible), show it. - fl_show_form(dialog_->form_graphics, + fl_show_form(dialog_->form, FL_PLACE_MOUSE, FL_FULLBORDER, _("Graphics")); @@ -204,10 +204,10 @@ void FormGraphics::hide() { // If the dialog exists, and the form is allocated and visible. if (dialog_ - && dialog_->form_graphics - && dialog_->form_graphics->visible) { + && dialog_->form + && dialog_->form->visible) { // Hide the form - fl_hide_form(dialog_->form_graphics); + fl_hide_form(dialog_->form); // And disconnect the signals. u_.disconnect(); @@ -225,26 +225,14 @@ void FormGraphics::hide() void FormGraphics::free() { - // hide() will disconnect the signals so we need not worry about them. - if (dialog_) { - if (dialog_->form_graphics) { - // If the dialog is visible, hide it. - if (dialog_->form_graphics->visible) { - hide(); - } - - // Remove all associations for the radio buttons - widthButtons.reset(); - heightButtons.reset(); - displayButtons.reset(); + // Remove all associations for the radio buttons + widthButtons.reset(); + heightButtons.reset(); + displayButtons.reset(); - // Free the form. - fl_free_form(dialog_->form_graphics); - } - - delete dialog_; - dialog_ = 0; - } + // Free the form. + delete dialog_; + dialog_ = 0; } void FormGraphics::apply() diff --git a/src/frontends/xforms/FormIndex.C b/src/frontends/xforms/FormIndex.C index 2d64ae01a4..23fe29a0c3 100644 --- a/src/frontends/xforms/FormIndex.C +++ b/src/frontends/xforms/FormIndex.C @@ -27,7 +27,7 @@ #include "lyxfunc.h" FormIndex::FormIndex(LyXView * lv, Dialogs * d) - : FormCommand(lv, d, _("Index")), dialog_(0), minh(0), minw(0) + : FormCommand(lv, d, _("Index")), minh(0), minw(0), dialog_(0) { // let the dialog be shown // These are permanent connections so we won't bother @@ -39,7 +39,6 @@ FormIndex::FormIndex(LyXView * lv, Dialogs * d) FormIndex::~FormIndex() { - free(); delete dialog_; } @@ -56,8 +55,8 @@ void FormIndex::build() FL_FORM * const FormIndex::form() const { - if( dialog_ ) // no need to test for dialog_->form_index - return dialog_->form_index; + if( dialog_ ) // no need to test for dialog_->form + return dialog_->form; else return 0; } diff --git a/src/frontends/xforms/FormPreferences.C b/src/frontends/xforms/FormPreferences.C index 5c678d436d..b9f948760e 100644 --- a/src/frontends/xforms/FormPreferences.C +++ b/src/frontends/xforms/FormPreferences.C @@ -23,6 +23,7 @@ #include "support/filetools.h" #include "lyx_gui_misc.h" #include "gettext.h" +#include "ButtonController.h" #ifdef SIGC_CXX_NAMESPACES using SigC::slot; @@ -33,29 +34,44 @@ C_GENERICCB(FormPreferences, OKCB) C_GENERICCB(FormPreferences, ApplyCB) C_GENERICCB(FormPreferences, CancelCB) C_GENERICCB(FormPreferences, InputCB) +C_GENERICCB(FormPreferences, RestoreCB) FormPreferences::FormPreferences(LyXView * lv, Dialogs * d) - : dialog_(0), bind_(0), misc_(0), screen_fonts_(0), - interface_fonts_(0), printer_(0), paths_(0), - lv_(lv), d_(d), u_(0), h_(0), status(DIALOG_UNMODIFIED) + : dialog_(0), bind_(0), misc_(0), screen_fonts_(0), interface_fonts_(0), + printer_(0), paths_(0), lv_(lv), d_(d), u_(0), h_(0), + minw_(0), minh_(0), + bc_(new ButtonController(_("Cancel"), _("Close"))) { // let the dialog be shown // This is a permanent connection so we won't bother // storing a copy because we won't be disconnecting. - d->showPreferences.connect(slot(this,&FormPreferences::show)); + d->showPreferences.connect(slot(this, &FormPreferences::show)); } FormPreferences::~FormPreferences() { - free(); + delete dialog_; + delete bc_; } void FormPreferences::build() { dialog_ = build_preferences(); + + // manage the restore, save, apply and cancel/close buttons + bc_->setOkay(dialog_->button_ok); + bc_->setApply(dialog_->button_apply); + bc_->setCancel(dialog_->button_cancel); + bc_->setUndoAll(dialog_->button_restore); + bc_->refresh(); + + // Workaround dumb xforms sizing bug + minw_ = dialog_->form->w; + minh_ = dialog_->form->h; + bind_ = build_bind(); screen_fonts_ = build_screen_fonts(); interface_fonts_ = build_interface_fonts(); @@ -74,7 +90,8 @@ void FormPreferences::build() fl_set_input_return(screen_fonts_->input_sans, FL_RETURN_CHANGED); fl_set_input_return(screen_fonts_->input_typewriter, FL_RETURN_CHANGED); - fl_set_input_return(screen_fonts_->input_encoding, FL_RETURN_CHANGED); + fl_set_input_return(screen_fonts_->input_screen_encoding, + FL_RETURN_CHANGED); fl_set_counter_return(screen_fonts_->counter_zoom, FL_RETURN_CHANGED); fl_set_input_return(screen_fonts_->input_tiny, FL_RETURN_CHANGED); fl_set_input_return(screen_fonts_->input_script, FL_RETURN_CHANGED); @@ -91,7 +108,7 @@ void FormPreferences::build() FL_RETURN_CHANGED); fl_set_input_return(interface_fonts_->input_menu_font, FL_RETURN_CHANGED); - fl_set_input_return(interface_fonts_->input_encoding, + fl_set_input_return(interface_fonts_->input_popup_encoding, FL_RETURN_CHANGED); // printer fl_set_input_return(printer_->input_command, FL_RETURN_CHANGED); @@ -122,24 +139,24 @@ void FormPreferences::build() // Now add them to the tabfolder fl_addto_tabfolder(dialog_->tabfolder_prefs, _("Bindings"), - bind_->form_bind); + bind_->form); fl_addto_tabfolder(dialog_->tabfolder_prefs, _("Screen Fonts"), - screen_fonts_->form_screen_fonts); + screen_fonts_->form); fl_addto_tabfolder(dialog_->tabfolder_prefs, _("Interface Fonts"), - interface_fonts_->form_interface_fonts); + interface_fonts_->form); fl_addto_tabfolder(dialog_->tabfolder_prefs, _("Miscellaneous"), - misc_->form_misc); + misc_->form); fl_addto_tabfolder(dialog_->tabfolder_prefs, _("Printer"), - printer_->form_printer); + printer_->form); fl_addto_tabfolder(dialog_->tabfolder_prefs, _("Paths"), - paths_->form_paths); + paths_->form); - fl_set_form_atclose(dialog_->form_preferences, + fl_set_form_atclose(dialog_->form, C_FormPreferencesWMHideCB, 0); // deactivate the various browse buttons because they @@ -166,18 +183,15 @@ void FormPreferences::show() } update(); // make sure its up-to-date - if (dialog_->form_preferences->visible) { - fl_raise_form(dialog_->form_preferences); + if (dialog_->form->visible) { + fl_raise_form(dialog_->form); } else { - status = DIALOG_UNMODIFIED; - fl_deactivate_object(dialog_->button_ok); - fl_deactivate_object(dialog_->button_apply); - fl_set_object_lcol(dialog_->button_ok, FL_INACTIVE); - fl_set_object_lcol(dialog_->button_apply, FL_INACTIVE); - - fl_show_form(dialog_->form_preferences, + fl_set_form_minsize(dialog_->form, + minw_, + minh_); + fl_show_form(dialog_->form, FL_PLACE_MOUSE | FL_FREE_SIZE, - FL_FULLBORDER, + FL_TRANSIENT, _("Preferences")); } } @@ -186,9 +200,10 @@ void FormPreferences::show() void FormPreferences::hide() { if (dialog_ - && dialog_->form_preferences - && dialog_->form_preferences->visible) { - fl_hide_form(dialog_->form_preferences); + && dialog_->form + && dialog_->form->visible) { + bc_->hide(); + fl_hide_form(dialog_->form); } } @@ -200,7 +215,11 @@ void FormPreferences::apply() // is made. For example, screen zoom and font types. These could be // handled either by signals/slots in lyxrc or just directly call the // associated functions here. - + // There are other problems with this scheme. We really should check + // what we copy to make sure that it really is necessary to do things + // like update the screen fonts because that flushes the textcache + // and other stuff which may cost us a lot on slower/high-load machines. + // Bind tab lyxrc.bind_file = fl_get_input(bind_->input_bind); // Misc tab @@ -214,41 +233,81 @@ void FormPreferences::apply() (fl_get_counter_value(misc_->counter_autosave)); lyxrc.ascii_linelen = static_cast (fl_get_counter_value(misc_->counter_line_len)); - // Screen fonts - lyxrc.roman_font_name = fl_get_input(screen_fonts_->input_roman); - lyxrc.sans_font_name = fl_get_input(screen_fonts_->input_sans); - lyxrc.typewriter_font_name = fl_get_input(screen_fonts_-> - input_typewriter); - lyxrc.font_norm = fl_get_input(screen_fonts_->input_encoding); - lyxrc.use_scalable_fonts = - fl_get_button(screen_fonts_->check_scalable); - lyxrc.zoom = static_cast - (fl_get_counter_value(screen_fonts_->counter_zoom)); - lyxrc.font_sizes[LyXFont::SIZE_TINY] = - strToDbl(fl_get_input(screen_fonts_->input_tiny)); - lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] = - strToDbl(fl_get_input(screen_fonts_->input_script)); - lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] = - strToDbl(fl_get_input(screen_fonts_->input_footnote)); - lyxrc.font_sizes[LyXFont::SIZE_SMALL] = - strToDbl(fl_get_input(screen_fonts_->input_small)); - lyxrc.font_sizes[LyXFont::SIZE_NORMAL] = - strToDbl(fl_get_input(screen_fonts_->input_normal)); - lyxrc.font_sizes[LyXFont::SIZE_LARGE] = - strToDbl(fl_get_input(screen_fonts_->input_large)); - lyxrc.font_sizes[LyXFont::SIZE_LARGER] = - strToDbl(fl_get_input(screen_fonts_->input_larger)); - lyxrc.font_sizes[LyXFont::SIZE_LARGEST] = - strToDbl(fl_get_input(screen_fonts_->input_largest)); - lyxrc.font_sizes[LyXFont::SIZE_HUGE] = - strToDbl(fl_get_input(screen_fonts_->input_huge)); - lyxrc.font_sizes[LyXFont::SIZE_HUGER] = - strToDbl(fl_get_input(screen_fonts_->input_huger)); - // interface fonts + // Interface fonts lyxrc.popup_font_name = fl_get_input(interface_fonts_->input_popup_font); lyxrc.menu_font_name = fl_get_input(interface_fonts_->input_menu_font); - lyxrc.font_norm_menu = fl_get_input(interface_fonts_->input_encoding); + lyxrc.font_norm_menu = + fl_get_input(interface_fonts_->input_popup_encoding); + // Screen fonts + if (lyxrc.roman_font_name != + fl_get_input(screen_fonts_->input_roman) || + lyxrc.sans_font_name != + fl_get_input(screen_fonts_->input_sans) || + lyxrc.typewriter_font_name != + fl_get_input(screen_fonts_->input_typewriter) || + lyxrc.font_norm != + fl_get_input(screen_fonts_->input_screen_encoding) || + lyxrc.use_scalable_fonts != + fl_get_button(screen_fonts_->check_scalable) || + lyxrc.zoom != static_cast + (fl_get_counter_value(screen_fonts_->counter_zoom)) || + lyxrc.font_sizes[LyXFont::SIZE_TINY] != + strToDbl(fl_get_input(screen_fonts_->input_tiny)) || + lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] != + strToDbl(fl_get_input(screen_fonts_->input_script)) || + lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] != + strToDbl(fl_get_input(screen_fonts_->input_footnote)) || + lyxrc.font_sizes[LyXFont::SIZE_SMALL] != + strToDbl(fl_get_input(screen_fonts_->input_small)) || + lyxrc.font_sizes[LyXFont::SIZE_NORMAL] != + strToDbl(fl_get_input(screen_fonts_->input_normal)) || + lyxrc.font_sizes[LyXFont::SIZE_LARGE] != + strToDbl(fl_get_input(screen_fonts_->input_large)) || + lyxrc.font_sizes[LyXFont::SIZE_LARGER] != + strToDbl(fl_get_input(screen_fonts_->input_larger)) || + lyxrc.font_sizes[LyXFont::SIZE_LARGEST] != + strToDbl(fl_get_input(screen_fonts_->input_largest)) || + lyxrc.font_sizes[LyXFont::SIZE_HUGE] != + strToDbl(fl_get_input(screen_fonts_->input_huge)) || + lyxrc.font_sizes[LyXFont::SIZE_HUGER] != + strToDbl(fl_get_input(screen_fonts_->input_huger))) { + // Something has changed so copy all of them and then force + // an update of the screen fonts (ie. redraw every buffer) + lyxrc.roman_font_name = fl_get_input(screen_fonts_->input_roman); + lyxrc.sans_font_name = fl_get_input(screen_fonts_->input_sans); + lyxrc.typewriter_font_name = fl_get_input(screen_fonts_-> + input_typewriter); + lyxrc.font_norm = fl_get_input(screen_fonts_-> + input_screen_encoding); + lyxrc.use_scalable_fonts = + fl_get_button(screen_fonts_->check_scalable); + lyxrc.zoom = static_cast + (fl_get_counter_value(screen_fonts_->counter_zoom)); + lyxrc.font_sizes[LyXFont::SIZE_TINY] = + strToDbl(fl_get_input(screen_fonts_->input_tiny)); + lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] = + strToDbl(fl_get_input(screen_fonts_->input_script)); + lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] = + strToDbl(fl_get_input(screen_fonts_->input_footnote)); + lyxrc.font_sizes[LyXFont::SIZE_SMALL] = + strToDbl(fl_get_input(screen_fonts_->input_small)); + lyxrc.font_sizes[LyXFont::SIZE_NORMAL] = + strToDbl(fl_get_input(screen_fonts_->input_normal)); + lyxrc.font_sizes[LyXFont::SIZE_LARGE] = + strToDbl(fl_get_input(screen_fonts_->input_large)); + lyxrc.font_sizes[LyXFont::SIZE_LARGER] = + strToDbl(fl_get_input(screen_fonts_->input_larger)); + lyxrc.font_sizes[LyXFont::SIZE_LARGEST] = + strToDbl(fl_get_input(screen_fonts_->input_largest)); + lyxrc.font_sizes[LyXFont::SIZE_HUGE] = + strToDbl(fl_get_input(screen_fonts_->input_huge)); + lyxrc.font_sizes[LyXFont::SIZE_HUGER] = + strToDbl(fl_get_input(screen_fonts_->input_huger)); + // Now update the buffers + // Can anything below here affect the redraw process? + lv_->getLyXFunc()->Dispatch(LFUN_SCREEN_FONT_UPDATE); + } // printer lyxrc.print_adapt_output = fl_get_button(printer_->check_adapt_output); lyxrc.print_command = fl_get_input(printer_->input_command); @@ -284,6 +343,8 @@ void FormPreferences::apply() lyxrc.make_backup = fl_get_button(paths_->check_make_backups); lyxrc.num_lastfiles = static_cast (fl_get_counter_value(paths_->counter_lastfiles)); + + bc_->apply(); } @@ -313,7 +374,7 @@ void FormPreferences::update() lyxrc.sans_font_name.c_str()); fl_set_input(screen_fonts_->input_typewriter, lyxrc.typewriter_font_name.c_str()); - fl_set_input(screen_fonts_->input_encoding, + fl_set_input(screen_fonts_->input_screen_encoding, lyxrc.font_norm.c_str()); fl_set_button(screen_fonts_->check_scalable, lyxrc.use_scalable_fonts); @@ -344,7 +405,7 @@ void FormPreferences::update() lyxrc.popup_font_name.c_str()); fl_set_input(interface_fonts_->input_menu_font, lyxrc.menu_font_name.c_str()); - fl_set_input(interface_fonts_->input_encoding, + fl_set_input(interface_fonts_->input_popup_encoding, lyxrc.font_norm_menu.c_str()); // printer fl_set_button(printer_->check_adapt_output, @@ -406,7 +467,7 @@ void FormPreferences::update() } -void FormPreferences::input() +bool FormPreferences::input() { bool activate = true; // @@ -440,6 +501,7 @@ void FormPreferences::input() || !AbsolutePath(fl_get_input(paths_-> input_backup_path)))))) { activate = false; + lyxerr[Debug::GUI] << "Preferences: Path is wrong\n"; } // fontsizes -- tiny < script < footnote etc. @@ -456,6 +518,7 @@ void FormPreferences::input() // make sure they all have positive entries // Also note that an empty entry is returned as 0.0 by strToDbl activate = false; + lyxerr[Debug::GUI] << "Preferences: Sizes are wrong\n"; } else if (strToDbl(fl_get_input(screen_fonts_->input_tiny)) > strToDbl(fl_get_input(screen_fonts_->input_script)) || strToDbl(fl_get_input(screen_fonts_->input_script)) > @@ -475,40 +538,10 @@ void FormPreferences::input() strToDbl(fl_get_input(screen_fonts_->input_huge)) > strToDbl(fl_get_input(screen_fonts_->input_huger))) { activate = false; + lyxerr[Debug::GUI] << "Preferences: Sizes are wrong\n"; } - // - // You can modify the dialog and still have the buttons disabled - status = DIALOG_MODIFIED; - - if (status == DIALOG_MODIFIED - && activate) { - fl_activate_object(dialog_->button_ok); - fl_activate_object(dialog_->button_apply); - fl_set_object_lcol(dialog_->button_ok, FL_BLACK); - fl_set_object_lcol(dialog_->button_apply, FL_BLACK); - } else { - fl_deactivate_object(dialog_->button_ok); - fl_deactivate_object(dialog_->button_apply); - fl_set_object_lcol(dialog_->button_ok, FL_INACTIVE); - fl_set_object_lcol(dialog_->button_apply, FL_INACTIVE); - } -} - - -void FormPreferences::free() -{ - // we don't need to delete u and h here because - // hide() does that after disconnecting. - if (dialog_) { - if (dialog_->form_preferences - && dialog_->form_preferences->visible) { - hide(); - } - fl_free_form(dialog_->form_preferences); - delete dialog_; - dialog_ = 0; - } + return activate; } @@ -527,7 +560,7 @@ void FormPreferences::OKCB(FL_OBJECT * ob, long) FormPreferences * pre = static_cast(ob->form->u_vdata); pre->apply(); pre->hide(); - + pre->lv_->getLyXFunc()->Dispatch(LFUN_SAVEPREFERENCES); } @@ -549,5 +582,14 @@ void FormPreferences::CancelCB(FL_OBJECT * ob, long) void FormPreferences::InputCB(FL_OBJECT * ob, long) { FormPreferences * pre = static_cast(ob->form->u_vdata); + pre->bc_->valid(pre->input()); +} + + +void FormPreferences::RestoreCB(FL_OBJECT * ob, long) +{ + FormPreferences * pre = static_cast(ob->form->u_vdata); + pre->update(); pre->input(); + pre->bc_->undoAll(); } diff --git a/src/frontends/xforms/FormPreferences.h b/src/frontends/xforms/FormPreferences.h index 231053397f..b3c328849d 100644 --- a/src/frontends/xforms/FormPreferences.h +++ b/src/frontends/xforms/FormPreferences.h @@ -26,6 +26,9 @@ class LyXView; class Dialogs; +class PreferencesPolicy; +template class ButtonController; + struct FD_form_preferences; struct FD_form_bind; struct FD_form_misc; @@ -58,6 +61,7 @@ public: static void ApplyCB(FL_OBJECT *, long); static void CancelCB(FL_OBJECT *, long); static void InputCB(FL_OBJECT *, long); + static void RestoreCB(FL_OBJECT *, long); //@} private: @@ -75,8 +79,8 @@ private: //@{ /// Apply from dialog void apply(); - /// Filter the inputs - void input(); + /// Filter the inputs -- return true if entries are valid + bool input(); /// Build the dialog void build(); /// @@ -93,8 +97,6 @@ private: FD_form_printer * build_printer(); /// FD_form_paths * build_paths(); - /// Explicitly free the dialog. - void free(); //@} /**@name Private Data */ @@ -115,13 +117,16 @@ private: FD_form_paths * paths_; /// Which LyXView do we belong to? LyXView * lv_; + /// Dialogs * d_; /// Update connection. Connection u_; /// Hide connection. Connection h_; + /// Overcome a dumb xforms sizing bug + int minw_, minh_; /// - EnumDialogStatus status; + ButtonController * bc_; //@} }; diff --git a/src/frontends/xforms/FormPrint.C b/src/frontends/xforms/FormPrint.C index 617e31d150..500963f067 100644 --- a/src/frontends/xforms/FormPrint.C +++ b/src/frontends/xforms/FormPrint.C @@ -48,19 +48,49 @@ FormPrint::FormPrint(LyXView * lv, Dialogs * d) // let the dialog be shown // This is a permanent connection so we won't bother // storing a copy because we won't be disconnecting. - d->showPrint.connect(slot(this,&FormPrint::show)); + d->showPrint.connect(slot(this, &FormPrint::show)); } FormPrint::~FormPrint() { - free(); + delete dialog_; } void FormPrint::build() { dialog_ = build_print(); + + // allow controlling of input and ok/apply (de)activation + fl_set_input_return(dialog_->input_printer, + FL_RETURN_CHANGED); + fl_set_input_return(dialog_->input_file, + FL_RETURN_CHANGED); + fl_set_input_return(dialog_->input_from_page, + FL_RETURN_CHANGED); + fl_set_input_return(dialog_->input_to_page, + FL_RETURN_CHANGED); + fl_set_input_return(dialog_->input_count, + FL_RETURN_CHANGED); + + // limit these inputs to unsigned integers + fl_set_input_filter(dialog_->input_from_page, + fl_unsigned_int_filter); + fl_set_input_filter(dialog_->input_to_page, + fl_unsigned_int_filter); + fl_set_input_filter(dialog_->input_count, + fl_unsigned_int_filter); + + // what limits (if any) make sense for these? + fl_set_input_maxchars(dialog_->input_printer, 255); + fl_set_input_maxchars(dialog_->input_file, 255); + fl_set_input_maxchars(dialog_->input_from_page, 4); // 9999 + fl_set_input_maxchars(dialog_->input_to_page, 4); // 9999 + fl_set_input_maxchars(dialog_->input_count, 4); // 9999 + + fl_set_form_atclose(dialog_->form, + C_FormPrintWMHideCB, 0); } @@ -68,46 +98,20 @@ void FormPrint::show() { if (!dialog_) { build(); - // allow controlling of input and ok/apply (de)activation - fl_set_input_return(dialog_->input_printer, - FL_RETURN_CHANGED); - fl_set_input_return(dialog_->input_file, - FL_RETURN_CHANGED); - fl_set_input_return(dialog_->input_from_page, - FL_RETURN_CHANGED); - fl_set_input_return(dialog_->input_to_page, - FL_RETURN_CHANGED); - fl_set_input_return(dialog_->input_count, - FL_RETURN_CHANGED); - - // limit these inputs to unsigned integers - fl_set_input_filter(dialog_->input_from_page, - fl_unsigned_int_filter); - fl_set_input_filter(dialog_->input_to_page, - fl_unsigned_int_filter); - fl_set_input_filter(dialog_->input_count, - fl_unsigned_int_filter); - - // what limits (if any) make sense for these? - fl_set_input_maxchars(dialog_->input_printer, 255); - fl_set_input_maxchars(dialog_->input_file, 255); - fl_set_input_maxchars(dialog_->input_from_page, 4); // 9999 - fl_set_input_maxchars(dialog_->input_to_page, 4); // 9999 - fl_set_input_maxchars(dialog_->input_count, 4); // 9999 - - fl_set_form_atclose(dialog_->form_print, - C_FormPrintWMHideCB, 0); } update(); // make sure its up-to-date - if (dialog_->form_print->visible) { - fl_raise_form(dialog_->form_print); + if (dialog_->form->visible) { + fl_raise_form(dialog_->form); } else { - fl_show_form(dialog_->form_print, + fl_show_form(dialog_->form, FL_PLACE_MOUSE | FL_FREE_SIZE, - FL_FULLBORDER, + FL_TRANSIENT, _("Print")); + fl_set_form_minsize(dialog_->form, + dialog_->form->w, + dialog_->form->h); u_ = d_->updateBufferDependent.connect(slot(this, &FormPrint::update)); h_ = d_->hideBufferDependent.connect(slot(this, @@ -119,9 +123,9 @@ void FormPrint::show() void FormPrint::hide() { if (dialog_ - && dialog_->form_print - && dialog_->form_print->visible) { - fl_hide_form(dialog_->form_print); + && dialog_->form + && dialog_->form->visible) { + fl_hide_form(dialog_->form); u_.disconnect(); h_.disconnect(); } @@ -327,22 +331,6 @@ void FormPrint::input() } -void FormPrint::free() -{ - // we don't need to delete u and h here because - // hide() does that after disconnecting. - if (dialog_) { - if (dialog_->form_print - && dialog_->form_print->visible) { - hide(); - } - fl_free_form(dialog_->form_print); - delete dialog_; - dialog_ = 0; - } -} - - int FormPrint::WMHideCB(FL_FORM * form, void *) { // Ensure that the signals (u and h) are disconnected even if the diff --git a/src/frontends/xforms/FormPrint.h b/src/frontends/xforms/FormPrint.h index 5d96a93304..d9fb26cb00 100644 --- a/src/frontends/xforms/FormPrint.h +++ b/src/frontends/xforms/FormPrint.h @@ -75,8 +75,6 @@ private: void build(); /// FD_form_print * build_print(); - /// Explicitly free the dialog. - void free(); //@} /**@name Private Data */ @@ -85,6 +83,7 @@ private: FD_form_print * dialog_; /// Which LyXView do we belong to? LyXView * lv_; + /// Dialogs * d_; /// Update connection. Connection u_; diff --git a/src/frontends/xforms/FormRef.C b/src/frontends/xforms/FormRef.C index 704698530c..3c8bec6f53 100644 --- a/src/frontends/xforms/FormRef.C +++ b/src/frontends/xforms/FormRef.C @@ -35,8 +35,7 @@ static int formw; static int formh; FormRef::FormRef(LyXView * lv, Dialogs * d) - : FormCommand(lv, d, _("Reference")), dialog_(0), - toggle(GOBACK) + : FormCommand(lv, d, _("Reference")), toggle(GOBACK), dialog_(0) { // let the dialog be shown // These are permanent connections so we won't bother @@ -48,7 +47,6 @@ FormRef::FormRef(LyXView * lv, Dialogs * d) FormRef::~FormRef() { - free(); delete dialog_; } @@ -93,8 +91,8 @@ void FormRef::build() FL_FORM * const FormRef::form() const { - if( dialog_ ) // no need to test for dialog_->form_ref - return dialog_->form_ref; + if ( dialog_ ) // no need to test for dialog_->form_ref + return dialog_->form; else return 0; } diff --git a/src/frontends/xforms/FormRef.h b/src/frontends/xforms/FormRef.h index 261f5e4da8..e74c9259a3 100644 --- a/src/frontends/xforms/FormRef.h +++ b/src/frontends/xforms/FormRef.h @@ -65,13 +65,13 @@ private: /// string getName( Type type ) const; - /// Real GUI implementation. - FD_form_ref * dialog_; - /// Goto toggle; /// std::vector refs; + + /// Real GUI implementation. + FD_form_ref * dialog_; }; #endif diff --git a/src/frontends/xforms/FormTabular.C b/src/frontends/xforms/FormTabular.C index a7f15164c3..a77761beb8 100644 --- a/src/frontends/xforms/FormTabular.C +++ b/src/frontends/xforms/FormTabular.C @@ -49,7 +49,14 @@ FormTabular::FormTabular(LyXView * lv, Dialogs * d) FormTabular::~FormTabular() { - free(); + // we don't need to disconnect u and h here because + // their destructors do that. + delete dialog_; + delete tabular_options_; + delete column_options_; + delete cell_options_; + delete longtable_options_; + delete create_tabular_; } @@ -72,15 +79,15 @@ void FormTabular::build() FL_RETURN_CHANGED); fl_addto_tabfolder(dialog_->tabFolder, _("Tabular"), - tabular_options_->form_tabular_options); + tabular_options_->form); fl_addto_tabfolder(dialog_->tabFolder, _("Column/Row"), - column_options_->form_column_options); + column_options_->form); fl_addto_tabfolder(dialog_->tabFolder, _("Cell"), - cell_options_->form_cell_options); + cell_options_->form); fl_addto_tabfolder(dialog_->tabFolder, _("LongTable"), - longtable_options_->form_longtable_options); + longtable_options_->form); - fl_set_form_atclose(dialog_->form_tabular, + fl_set_form_atclose(dialog_->form, C_FormTabularWMHideCB, 0); fl_set_slider_bounds(create_tabular_->slider_rows, 1, 50); @@ -89,7 +96,7 @@ void FormTabular::build() fl_set_slider_value(create_tabular_->slider_columns, 5); fl_set_slider_precision(create_tabular_->slider_rows, 0); fl_set_slider_precision(create_tabular_->slider_columns, 0); - fl_set_form_atclose(create_tabular_->form_create_tabular, + fl_set_form_atclose(create_tabular_->form, C_FormTabularWMHideCB, 0); } @@ -101,10 +108,10 @@ void FormTabular::show() } update(); // make sure its up-to-date - if (dialog_->form_tabular->visible) { - fl_raise_form(dialog_->form_tabular); + if (dialog_->form->visible) { + fl_raise_form(dialog_->form); } else { - fl_show_form(dialog_->form_tabular, + fl_show_form(dialog_->form, FL_PLACE_MOUSE | FL_FREE_SIZE, FL_TRANSIENT, _("Tabular Layout")); @@ -125,8 +132,8 @@ void FormTabular::showInset(InsetTabular * ti) void FormTabular::hide() { - if (dialog_ && dialog_->form_tabular && dialog_->form_tabular->visible) { - fl_hide_form(dialog_->form_tabular); + if (dialog_ && dialog_->form && dialog_->form->visible) { + fl_hide_form(dialog_->form); u_.disconnect(); h_.disconnect(); inset_ = 0; @@ -153,49 +160,12 @@ void FormTabular::update() void FormTabular::updateInset(InsetTabular * ti) { inset_ = ti; - if (ti && dialog_ && dialog_->form_tabular->visible) { + if (ti && dialog_ && dialog_->form->visible) { update(); } } -void FormTabular::free() -{ - // we don't need to delete u and h here because - // hide() does that after disconnecting. - if (dialog_) { - if (dialog_->form_tabular - && dialog_->form_tabular->visible) { - hide(); - } - fl_free_form(dialog_->form_tabular); - delete dialog_; - dialog_ = 0; - - fl_free_form(tabular_options_->form_tabular_options); - delete tabular_options_; - tabular_options_ = 0; - - fl_free_form(column_options_->form_column_options); - delete column_options_; - column_options_ = 0; - - fl_free_form(cell_options_->form_cell_options); - delete cell_options_; - cell_options_ = 0; - - fl_free_form(longtable_options_->form_longtable_options); - delete longtable_options_; - longtable_options_ = 0; - - hide_create(); - fl_free_form(create_tabular_->form_create_tabular); - delete create_tabular_; - create_tabular_ = 0; - } -} - - int FormTabular::WMHideCB(FL_FORM * form, void *) { // Ensure that the signals (u and h) are disconnected even if the @@ -718,24 +688,16 @@ void FormTabular::show_create() if (!dialog_) { build(); } - if (create_tabular_->form_create_tabular->visible) { - fl_raise_form(create_tabular_->form_create_tabular); + if (create_tabular_->form->visible) { + fl_raise_form(create_tabular_->form); } else { - fl_show_form(create_tabular_->form_create_tabular, + fl_show_form(create_tabular_->form, FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER, _("Insert Tabular")); } } -void FormTabular::hide_create() -{ - if (create_tabular_->form_create_tabular && - create_tabular_->form_create_tabular->visible) - fl_hide_form(create_tabular_->form_create_tabular); -} - - void FormTabular::apply_create() { int @@ -752,6 +714,14 @@ void FormTabular::apply_create() } +void FormTabular::hide_create() +{ + if (create_tabular_->form && + create_tabular_->form->visible) + fl_hide_form(create_tabular_->form); +} + + void FormTabular::OKCB(FL_OBJECT * ob, long) { FormTabular * pre = (FormTabular*)ob->form->u_vdata; diff --git a/src/frontends/xforms/FormTabular.h b/src/frontends/xforms/FormTabular.h index b8fb925dca..3fe374e200 100644 --- a/src/frontends/xforms/FormTabular.h +++ b/src/frontends/xforms/FormTabular.h @@ -18,6 +18,8 @@ #define FORMTABULAR_H #include "DialogBase.h" +#include "support/utility.hpp" + #ifdef SIGC_CXX_NAMESPACES using SigC::Connection; #endif @@ -35,7 +37,7 @@ struct FD_form_create_tabular; /** This class provides an XForms implementation of the FormTabular Dialog. The tabular dialog allows users to set/save their tabular. */ -class FormTabular : public DialogBase { +class FormTabular : public DialogBase, public noncopyable { public: /**@name Constructors and Destructors */ //@{ @@ -56,9 +58,6 @@ public: //@} private: - FormTabular() {} - FormTabular(FormTabular &) : DialogBase() {} - /**@name Slot Methods */ //@{ /// Create the dialog if necessary, update it and display it. @@ -95,9 +94,6 @@ private: FD_form_longtable_options * build_longtable_options(); /// FD_form_create_tabular * build_create_tabular(); - /// - /// Explicitly free the dialog. - void free(); //@} /**@name Private Data */ @@ -114,17 +110,20 @@ private: FD_form_longtable_options * longtable_options_; /// FD_form_create_tabular * create_tabular_; - /// + // /// Which LyXView do we belong to? LyXView * lv_; + /// Dialogs * d_; /// Update connection. Connection u_; /// Hide connection. Connection h_; - //@} + /// InsetTabular * inset_; + /// int actCell_; + //@} }; #endif diff --git a/src/frontends/xforms/FormToc.C b/src/frontends/xforms/FormToc.C index 07befefa14..fc237bedf7 100644 --- a/src/frontends/xforms/FormToc.C +++ b/src/frontends/xforms/FormToc.C @@ -39,7 +39,6 @@ FormToc::FormToc(LyXView * lv, Dialogs * d) FormToc::~FormToc() { - free(); delete dialog_; } @@ -62,8 +61,8 @@ void FormToc::build() FL_FORM * const FormToc::form() const { - if( dialog_ ) // no need to test for dialog_->form_toc - return dialog_->form_toc; + if ( dialog_ ) // no need to test for dialog_->form + return dialog_->form; else return 0; } diff --git a/src/frontends/xforms/FormUrl.C b/src/frontends/xforms/FormUrl.C index 83c5ed8cec..1584dff789 100644 --- a/src/frontends/xforms/FormUrl.C +++ b/src/frontends/xforms/FormUrl.C @@ -27,9 +27,8 @@ #include "lyxfunc.h" FormUrl::FormUrl(LyXView * lv, Dialogs * d) - : FormCommand(lv, d, _("Url")), dialog_(0), minh(0), minw(0) + : FormCommand(lv, d, _("Url")), minh(0), minw(0), dialog_(0) { - dialog_ = 0; // let the dialog be shown // These are permanent connections so we won't bother // storing a copy because we won't be disconnecting. @@ -40,7 +39,6 @@ FormUrl::FormUrl(LyXView * lv, Dialogs * d) FormUrl::~FormUrl() { - free(); delete dialog_; } @@ -57,8 +55,8 @@ void FormUrl::build() FL_FORM * const FormUrl::form() const { - if( dialog_ ) // no need to test for dialog_->form_url - return dialog_->form_url; + if( dialog_ ) // no need to test for dialog_->form + return dialog_->form; else return 0; } diff --git a/src/frontends/xforms/Makefile.am b/src/frontends/xforms/Makefile.am index 1d2b03fce2..313343d67f 100644 --- a/src/frontends/xforms/Makefile.am +++ b/src/frontends/xforms/Makefile.am @@ -11,6 +11,7 @@ LYXDATADIRS = forms ETAGS_ARGS = --lang=c++ # Alphabetical order please. It makes it easier to figure out what's missing. libxforms_la_SOURCES = \ + ButtonController.h \ Dialogs.C \ FormCitation.C \ FormCitation.h \ diff --git a/src/frontends/xforms/form_citation.C b/src/frontends/xforms/form_citation.C index 488c8a517f..f0d88e8028 100644 --- a/src/frontends/xforms/form_citation.C +++ b/src/frontends/xforms/form_citation.C @@ -8,22 +8,29 @@ #include FORMS_H_LOCATION #include #include "form_citation.h" -#include "FormCitation.h" +#include "FormCitation.h" + +FD_form_citation::~FD_form_citation() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + FD_form_citation * FormCitation::build_citation() { FL_OBJECT *obj; FD_form_citation *fdui = new FD_form_citation; - fdui->form_citation = fl_bgn_form(FL_NO_BOX, 430, 770); - fdui->form_citation->u_vdata = this; - fdui->box = obj = fl_add_box(FL_UP_BOX, 0, 0, 430, 770, ""); + fdui->form = fl_bgn_form(FL_NO_BOX, 435, 665); + fdui->form->u_vdata = this; + fdui->box = obj = fl_add_box(FL_UP_BOX, 0, 0, 435, 665, ""); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->citeBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 30, 180, 370, _("Inset keys")); + fdui->citeBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 30, 180, 300, _("Inset keys")); fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); fl_set_object_resize(obj, FL_RESIZE_X); fl_set_object_callback(obj, C_FormCommandInputCB, CITEBRSR); - fdui->bibBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 240, 30, 180, 370, _("Bibliography keys")); + fdui->bibBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 240, 30, 180, 300, _("Bibliography keys")); fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); fl_set_object_resize(obj, FL_RESIZE_X); fl_set_object_callback(obj, C_FormCommandInputCB, BIBBRSR); @@ -39,26 +46,26 @@ FD_form_citation * FormCitation::build_citation() fdui->downBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 135, 30, 30, _("@2->")); fl_set_object_resize(obj, FL_RESIZE_NONE); fl_set_object_callback(obj, C_FormCommandInputCB, DOWN); - fdui->infoBrsr = obj = fl_add_browser(FL_NORMAL_BROWSER, 10, 440, 410, 110, _("Info")); + fdui->infoBrsr = obj = fl_add_browser(FL_NORMAL_BROWSER, 10, 360, 410, 80, _("Info")); fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->style = obj = fl_add_choice(FL_NORMAL_CHOICE, 160, 570, 130, 30, _("Citation style")); + fdui->style = obj = fl_add_choice(FL_NORMAL_CHOICE, 160, 470, 130, 30, _("Citation style")); fl_set_object_boxtype(obj, FL_DOWN_BOX); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->textBefore = obj = fl_add_input(FL_NORMAL_INPUT, 100, 620, 250, 30, _("Text before")); + fdui->textBefore = obj = fl_add_input(FL_NORMAL_INPUT, 100, 520, 250, 30, _("Text before")); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->textAftr = obj = fl_add_input(FL_NORMAL_INPUT, 100, 660, 250, 30, _("Text after")); + fdui->textAftr = obj = fl_add_input(FL_NORMAL_INPUT, 100, 570, 250, 30, _("Text after")); fl_set_object_resize(obj, FL_RESIZE_X); - fdui->ok = obj = fl_add_button(FL_RETURN_BUTTON, 230, 730, 90, 30, _("OK")); + fdui->ok = obj = fl_add_button(FL_RETURN_BUTTON, 230, 630, 90, 30, _("OK")); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); fl_set_object_callback(obj, C_FormCommandOKCB, 0); - fdui->cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 730, 90, 30, _("Cancel")); + fdui->cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 630, 90, 30, _("Cancel")); fl_set_button_shortcut(obj, _("^["), 1); fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); fl_set_object_callback(obj, C_FormCommandCancelCB, 0); fl_end_form(); - fdui->form_citation->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } diff --git a/src/frontends/xforms/form_citation.h b/src/frontends/xforms/form_citation.h index a2ef2f2063..433f10c9c9 100644 --- a/src/frontends/xforms/form_citation.h +++ b/src/frontends/xforms/form_citation.h @@ -1,4 +1,5 @@ -/** Header file generated with fdesign on Wed Aug 2 13:56:56 2000.**/ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +/** Header file generated with fdesign **/ #ifndef FD_form_citation_h_ #define FD_form_citation_h_ @@ -11,8 +12,9 @@ extern "C" void C_FormCommandCancelCB(FL_OBJECT *, long); /**** Forms and Objects ****/ struct FD_form_citation { + ~FD_form_citation(); - FL_FORM *form_citation; + FL_FORM *form; FL_OBJECT *box; FL_OBJECT *citeBrsr; FL_OBJECT *bibBrsr; diff --git a/src/frontends/xforms/form_copyright.C b/src/frontends/xforms/form_copyright.C index be07dafc77..2909b4ff20 100644 --- a/src/frontends/xforms/form_copyright.C +++ b/src/frontends/xforms/form_copyright.C @@ -8,15 +8,22 @@ #include FORMS_H_LOCATION #include #include "form_copyright.h" -#include "FormCopyright.h" +#include "FormCopyright.h" + +FD_form_copyright::~FD_form_copyright() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + FD_form_copyright * FormCopyright::build_copyright() { FL_OBJECT *obj; FD_form_copyright *fdui = new FD_form_copyright; - fdui->form_copyright = fl_bgn_form(FL_NO_BOX, 450, 430); - fdui->form_copyright->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 450, 430); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 450, 430, ""); obj = fl_add_text(FL_NORMAL_TEXT, 10, 10, 430, 50, _("LyX is Copyright (C) 1995 by Matthias Ettrich, \n1995-2000 LyX Team")); fl_set_object_boxtype(obj, FL_FRAME_BOX); @@ -38,7 +45,7 @@ FD_form_copyright * FormCopyright::build_copyright() fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); fl_end_form(); - fdui->form_copyright->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } diff --git a/src/frontends/xforms/form_copyright.h b/src/frontends/xforms/form_copyright.h index 3a415f4ad2..11a09e3fc1 100644 --- a/src/frontends/xforms/form_copyright.h +++ b/src/frontends/xforms/form_copyright.h @@ -1,4 +1,5 @@ -/** Header file generated with fdesign on Wed Aug 2 13:56:56 2000.**/ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +/** Header file generated with fdesign **/ #ifndef FD_form_copyright_h_ #define FD_form_copyright_h_ @@ -9,8 +10,9 @@ extern "C" void C_FormCopyrightOKCB(FL_OBJECT *, long); /**** Forms and Objects ****/ struct FD_form_copyright { + ~FD_form_copyright(); - FL_FORM *form_copyright; + FL_FORM *form; FL_OBJECT *button_ok; }; diff --git a/src/frontends/xforms/form_document.C b/src/frontends/xforms/form_document.C index 5fe043aaf3..133e9a7243 100644 --- a/src/frontends/xforms/form_document.C +++ b/src/frontends/xforms/form_document.C @@ -8,17 +8,24 @@ #include FORMS_H_LOCATION #include #include "form_document.h" -#include "FormDocument.h" +#include "FormDocument.h" #include "bmtable.h" #include "support/filetools.h" +FD_form_tabbed_document::~FD_form_tabbed_document() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_tabbed_document * FormDocument::build_tabbed_document() { FL_OBJECT *obj; FD_form_tabbed_document *fdui = new FD_form_tabbed_document; - fdui->form_tabbed_document = fl_bgn_form(FL_NO_BOX, 465, 450); - fdui->form_tabbed_document->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 465, 450); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 465, 450, ""); fdui->tabbed_folder = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 20, 15, 435, 365, _("Tabbed folder")); fl_set_object_resize(obj, FL_RESIZE_ALL); @@ -37,19 +44,26 @@ FD_form_tabbed_document * FormDocument::build_tabbed_document() fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE); fl_end_form(); - fdui->form_tabbed_document->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_doc_paper::~FD_form_doc_paper() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_doc_paper * FormDocument::build_doc_paper() { FL_OBJECT *obj; FD_form_doc_paper *fdui = new FD_form_doc_paper; - fdui->form_doc_paper = fl_bgn_form(FL_NO_BOX, 440, 345); - fdui->form_doc_paper->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 440, 345); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 440, 345, ""); obj = fl_add_frame(FL_ENGRAVED_FRAME, 230, 85, 200, 100, ""); fl_set_object_color(obj, FL_COL1, FL_COL1); @@ -148,19 +162,26 @@ FD_form_doc_paper * FormDocument::build_doc_paper() fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_end_form(); - fdui->form_doc_paper->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_doc_class::~FD_form_doc_class() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_doc_class * FormDocument::build_doc_class() { FL_OBJECT *obj; FD_form_doc_class *fdui = new FD_form_doc_class; - fdui->form_doc_class = fl_bgn_form(FL_NO_BOX, 440, 345); - fdui->form_doc_class->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 440, 345); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 440, 345, ""); obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 300, 200, 120, 80, _("Separation")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -240,19 +261,26 @@ FD_form_doc_class * FormDocument::build_doc_class() fl_set_object_callback(obj, InputCB, 0); fl_end_form(); - fdui->form_doc_class->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_doc_language::~FD_form_doc_language() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_doc_language * FormDocument::build_doc_language() { FL_OBJECT *obj; FD_form_doc_language *fdui = new FD_form_doc_language; - fdui->form_doc_language = fl_bgn_form(FL_NO_BOX, 440, 345); - fdui->form_doc_language->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 440, 345); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 440, 345, ""); obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 40, 120, 290, 110, _("Quote Style ")); fdui->choice_inputenc = obj = fl_add_choice(FL_NORMAL_CHOICE, 120, 70, 190, 30, idex(_("Encoding:|#D"))); @@ -278,19 +306,26 @@ FD_form_doc_language * FormDocument::build_doc_language() fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_form(); - fdui->form_doc_language->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_doc_options::~FD_form_doc_options() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_doc_options * FormDocument::build_doc_options() { FL_OBJECT *obj; FD_form_doc_options *fdui = new FD_form_doc_options; - fdui->form_doc_options = fl_bgn_form(FL_NO_BOX, 440, 345); - fdui->form_doc_options->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 440, 345); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 440, 345, ""); fdui->input_float_placement = obj = fl_add_input(FL_NORMAL_INPUT, 155, 60, 120, 30, idex(_("Float Placement:|#L"))); fl_set_button_shortcut(obj, scex(_("Float Placement:|#L")), 1); @@ -310,19 +345,26 @@ FD_form_doc_options * FormDocument::build_doc_options() fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_form(); - fdui->form_doc_options->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_doc_bullet::~FD_form_doc_bullet() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_doc_bullet * FormDocument::build_doc_bullet() { FL_OBJECT *obj; FD_form_doc_bullet *fdui = new FD_form_doc_bullet; - fdui->form_doc_bullet = fl_bgn_form(FL_NO_BOX, 440, 345); - fdui->form_doc_bullet->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 440, 345); + fdui->form->u_vdata = this; fl_set_border_width(-1); obj = fl_add_box(FL_UP_BOX, 0, 0, 440, 345, ""); fl_set_border_width(-3); @@ -331,7 +373,9 @@ FD_form_doc_bullet * FormDocument::build_doc_bullet() fl_set_object_lcol(obj, FL_BLUE); fl_set_object_boxtype(obj, FL_UP_BOX); fl_set_bmtable_pixmap_file(obj, 6, 6, - LibFileSearch("images", "standard.xpm").c_str()); + LibFileSearch("images", + "standard", + "xpm").c_str()); fl_set_border_width(-1); obj = fl_add_frame(FL_ENGRAVED_FRAME, 95, 20, 255, 70, ""); fdui->choice_bullet_size = obj = fl_add_choice(FL_NORMAL_CHOICE, 15, 45, 65, 30, idex(_("Size|#z"))); @@ -344,8 +388,6 @@ FD_form_doc_bullet * FormDocument::build_doc_bullet() fl_set_button_shortcut(obj, scex(_("LaTeX|#L")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lstyle(obj, FL_FIXED_STYLE); - fl_set_input_return(obj, FL_RETURN_CHANGED); - fl_set_input_maxchars(obj, 80); fl_set_object_callback(obj, InputBulletLaTeXCB, 0); fdui->radio_bullet_depth = fl_bgn_group(); @@ -408,7 +450,7 @@ FD_form_doc_bullet * FormDocument::build_doc_bullet() fl_end_form(); - fdui->form_doc_bullet->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } diff --git a/src/frontends/xforms/form_document.h b/src/frontends/xforms/form_document.h index 9d7f7c56a2..7b2004886c 100644 --- a/src/frontends/xforms/form_document.h +++ b/src/frontends/xforms/form_document.h @@ -1,4 +1,5 @@ -/** Header file generated with fdesign on Fri Aug 11 15:45:35 2000.**/ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +/** Header file generated with fdesign **/ #ifndef FD_form_tabbed_document_h_ #define FD_form_tabbed_document_h_ @@ -22,16 +23,18 @@ extern "C" void BulletPanelCB(FL_OBJECT *, long); /**** Forms and Objects ****/ struct FD_form_tabbed_document { + ~FD_form_tabbed_document(); - FL_FORM *form_tabbed_document; + FL_FORM *form; FL_OBJECT *tabbed_folder; FL_OBJECT *button_apply; FL_OBJECT *button_ok; FL_OBJECT *text_warning; }; struct FD_form_doc_paper { + ~FD_form_doc_paper(); - FL_FORM *form_doc_paper; + FL_FORM *form; FL_OBJECT *choice_paperpackage; FL_OBJECT *greoup_radio_orientation; FL_OBJECT *radio_portrait; @@ -50,8 +53,9 @@ struct FD_form_doc_paper { FL_OBJECT *text_warning; }; struct FD_form_doc_class { + ~FD_form_doc_class(); - FL_FORM *form_doc_class; + FL_FORM *form; FL_OBJECT *choice_doc_fonts; FL_OBJECT *choice_doc_fontsize; FL_OBJECT *choice_doc_class; @@ -72,8 +76,9 @@ struct FD_form_doc_class { FL_OBJECT *input_doc_spacing; }; struct FD_form_doc_language { + ~FD_form_doc_language(); - FL_FORM *form_doc_language; + FL_FORM *form; FL_OBJECT *choice_inputenc; FL_OBJECT *choice_quotes_language; FL_OBJECT *radio_single; @@ -81,8 +86,9 @@ struct FD_form_doc_language { FL_OBJECT *choice_language; }; struct FD_form_doc_options { + ~FD_form_doc_options(); - FL_FORM *form_doc_options; + FL_FORM *form; FL_OBJECT *input_float_placement; FL_OBJECT *slider_secnumdepth; FL_OBJECT *slider_tocdepth; @@ -90,8 +96,9 @@ struct FD_form_doc_options { FL_OBJECT *check_use_amsmath; }; struct FD_form_doc_bullet { + ~FD_form_doc_bullet(); - FL_FORM *form_doc_bullet; + FL_FORM *form; FL_OBJECT *bmtable_bullet_panel; FL_OBJECT *choice_bullet_size; FL_OBJECT *input_bullet_latex; diff --git a/src/frontends/xforms/form_graphics.C b/src/frontends/xforms/form_graphics.C index 96289ef7be..14dc5a5e4a 100644 --- a/src/frontends/xforms/form_graphics.C +++ b/src/frontends/xforms/form_graphics.C @@ -1,6 +1,5 @@ // File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext #include - #include "lyx_gui_misc.h" #include "gettext.h" @@ -9,15 +8,22 @@ #include FORMS_H_LOCATION #include #include "form_graphics.h" -#include "FormGraphics.h" +#include "FormGraphics.h" + +FD_form_graphics::~FD_form_graphics() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + FD_form_graphics * FormGraphics::build_graphics() { FL_OBJECT *obj; FD_form_graphics *fdui = new FD_form_graphics; - fdui->form_graphics = fl_bgn_form(FL_NO_BOX, 410, 390); - fdui->form_graphics->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 410, 390); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 410, 390, ""); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_resize(obj, FL_RESIZE_NONE); @@ -98,8 +104,9 @@ FD_form_graphics * FormGraphics::build_graphics() fl_set_object_callback(obj, C_FormGraphicsInputCB, 0); fl_end_form(); - fdui->form_graphics->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ + diff --git a/src/frontends/xforms/form_graphics.h b/src/frontends/xforms/form_graphics.h index 203f37d198..492394db21 100644 --- a/src/frontends/xforms/form_graphics.h +++ b/src/frontends/xforms/form_graphics.h @@ -1,4 +1,5 @@ -/** Header file generated with fdesign on Wed Aug 2 13:56:57 2000.**/ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +/** Header file generated with fdesign **/ #ifndef FD_form_graphics_h_ #define FD_form_graphics_h_ @@ -13,8 +14,9 @@ extern "C" void C_FormGraphicsCancelCB(FL_OBJECT *, long); /**** Forms and Objects ****/ struct FD_form_graphics { + ~FD_form_graphics(); - FL_FORM *form_graphics; + FL_FORM *form; FL_OBJECT *input_filename; FL_OBJECT *button_browse; FL_OBJECT *input_width; diff --git a/src/frontends/xforms/form_index.C b/src/frontends/xforms/form_index.C index a644864fdd..b814732bfd 100644 --- a/src/frontends/xforms/form_index.C +++ b/src/frontends/xforms/form_index.C @@ -8,15 +8,22 @@ #include FORMS_H_LOCATION #include #include "form_index.h" -#include "FormIndex.h" +#include "FormIndex.h" + +FD_form_index::~FD_form_index() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + FD_form_index * FormIndex::build_index() { FL_OBJECT *obj; FD_form_index *fdui = new FD_form_index; - fdui->form_index = fl_bgn_form(FL_NO_BOX, 520, 100); - fdui->form_index->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 520, 100); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 520, 100, ""); fdui->key = obj = fl_add_input(FL_NORMAL_INPUT, 90, 10, 420, 30, _("Keyword")); fl_set_input_shortcut(obj, scex(_("Keyword|#K#k")), 1); @@ -32,7 +39,7 @@ FD_form_index * FormIndex::build_index() fl_set_object_callback(obj, C_FormCommandOKCB, 0); fl_end_form(); - fdui->form_index->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } diff --git a/src/frontends/xforms/form_index.h b/src/frontends/xforms/form_index.h index 7cec02b7f5..ff0d71e407 100644 --- a/src/frontends/xforms/form_index.h +++ b/src/frontends/xforms/form_index.h @@ -1,4 +1,5 @@ -/** Header file generated with fdesign on Thu Aug 3 11:33:50 2000.**/ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +/** Header file generated with fdesign **/ #ifndef FD_form_index_h_ #define FD_form_index_h_ @@ -10,8 +11,9 @@ extern "C" void C_FormCommandOKCB(FL_OBJECT *, long); /**** Forms and Objects ****/ struct FD_form_index { + ~FD_form_index(); - FL_FORM *form_index; + FL_FORM *form; FL_OBJECT *key; FL_OBJECT *cancel; FL_OBJECT *ok; diff --git a/src/frontends/xforms/form_preferences.C b/src/frontends/xforms/form_preferences.C index c25420881d..4863eba76d 100644 --- a/src/frontends/xforms/form_preferences.C +++ b/src/frontends/xforms/form_preferences.C @@ -8,15 +8,22 @@ #include FORMS_H_LOCATION #include #include "form_preferences.h" -#include "FormPreferences.h" +#include "FormPreferences.h" + +FD_form_bind::~FD_form_bind() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + FD_form_bind * FormPreferences::build_bind() { FL_OBJECT *obj; FD_form_bind *fdui = new FD_form_bind; - fdui->form_bind = fl_bgn_form(FL_NO_BOX, 450, 320); - fdui->form_bind->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 450, 320); + fdui->form->u_vdata = this; obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 320, ""); fdui->input_bind = obj = fl_add_input(FL_NORMAL_INPUT, 145, 80, 190, 30, _("Bind file")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -25,19 +32,26 @@ FD_form_bind * FormPreferences::build_bind() fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_form(); - fdui->form_bind->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_misc::~FD_form_misc() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_misc * FormPreferences::build_misc() { FL_OBJECT *obj; FD_form_misc *fdui = new FD_form_misc; - fdui->form_misc = fl_bgn_form(FL_NO_BOX, 450, 320); - fdui->form_misc->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 450, 320); + fdui->form->u_vdata = this; obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 320, ""); fdui->check_banner = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 20, 30, 240, 30, _("Show banner")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -73,19 +87,26 @@ FD_form_misc * FormPreferences::build_misc() fl_set_counter_step(obj, 1, 1); fl_end_form(); - fdui->form_misc->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_screen_fonts::~FD_form_screen_fonts() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_screen_fonts * FormPreferences::build_screen_fonts() { FL_OBJECT *obj; FD_form_screen_fonts *fdui = new FD_form_screen_fonts; - fdui->form_screen_fonts = fl_bgn_form(FL_NO_BOX, 450, 320); - fdui->form_screen_fonts->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 450, 320); + fdui->form->u_vdata = this; obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 320, ""); fdui->input_roman = obj = fl_add_input(FL_NORMAL_INPUT, 210, 5, 200, 30, _("Roman")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -108,7 +129,7 @@ FD_form_screen_fonts * FormPreferences::build_screen_fonts() fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormPreferencesInputCB, 0); fl_set_button(obj, 1); - fdui->input_encoding = obj = fl_add_input(FL_NORMAL_INPUT, 210, 95, 200, 30, _("Encoding")); + fdui->input_screen_encoding = obj = fl_add_input(FL_NORMAL_INPUT, 210, 95, 200, 30, _("Encoding")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormPreferencesInputCB, 0); fdui->input_tiny = obj = fl_add_input(FL_FLOAT_INPUT, 140, 165, 70, 30, _("tiny")); @@ -143,19 +164,26 @@ FD_form_screen_fonts * FormPreferences::build_screen_fonts() fl_set_object_callback(obj, C_FormPreferencesInputCB, 0); fl_end_form(); - fdui->form_screen_fonts->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_interface_fonts::~FD_form_interface_fonts() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_interface_fonts * FormPreferences::build_interface_fonts() { FL_OBJECT *obj; FD_form_interface_fonts *fdui = new FD_form_interface_fonts; - fdui->form_interface_fonts = fl_bgn_form(FL_NO_BOX, 450, 320); - fdui->form_interface_fonts->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 450, 320); + fdui->form->u_vdata = this; obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 320, ""); fdui->input_popup_font = obj = fl_add_input(FL_NORMAL_INPUT, 215, 50, 200, 30, _("Popup")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -163,24 +191,31 @@ FD_form_interface_fonts * FormPreferences::build_interface_fonts() fdui->input_menu_font = obj = fl_add_input(FL_NORMAL_INPUT, 215, 80, 200, 30, _("Menu")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormPreferencesInputCB, 0); - fdui->input_encoding = obj = fl_add_input(FL_NORMAL_INPUT, 215, 110, 200, 30, _("Encoding")); + fdui->input_popup_encoding = obj = fl_add_input(FL_NORMAL_INPUT, 215, 110, 200, 30, _("Encoding")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormPreferencesInputCB, 0); fl_end_form(); - fdui->form_interface_fonts->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_printer::~FD_form_printer() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_printer * FormPreferences::build_printer() { FL_OBJECT *obj; FD_form_printer *fdui = new FD_form_printer; - fdui->form_printer = fl_bgn_form(FL_NO_BOX, 450, 320); - fdui->form_printer->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 450, 320); + fdui->form->u_vdata = this; obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 320, ""); fdui->input_command = obj = fl_add_input(FL_NORMAL_INPUT, 130, 60, 80, 30, _("command")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -238,19 +273,26 @@ FD_form_printer * FormPreferences::build_printer() fl_set_object_callback(obj, C_FormPreferencesInputCB, 0); fl_end_form(); - fdui->form_printer->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_paths::~FD_form_paths() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_paths * FormPreferences::build_paths() { FL_OBJECT *obj; FD_form_paths *fdui = new FD_form_paths; - fdui->form_paths = fl_bgn_form(FL_NO_BOX, 450, 320); - fdui->form_paths->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 450, 320); + fdui->form->u_vdata = this; obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 320, ""); fdui->input_default_path = obj = fl_add_input(FL_NORMAL_INPUT, 170, 10, 170, 30, _("Default path")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -300,36 +342,47 @@ FD_form_paths * FormPreferences::build_paths() fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_end_form(); - fdui->form_paths->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_preferences::~FD_form_preferences() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_preferences * FormPreferences::build_preferences() { FL_OBJECT *obj; FD_form_preferences *fdui = new FD_form_preferences; - fdui->form_preferences = fl_bgn_form(FL_NO_BOX, 460, 435); - fdui->form_preferences->u_vdata = this; - obj = fl_add_box(FL_UP_BOX, 0, 0, 460, 435, ""); - fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 250, 395, 90, 30, idex(_("Apply|#A"))); + fdui->form = fl_bgn_form(FL_NO_BOX, 475, 435); + fdui->form->u_vdata = this; + obj = fl_add_box(FL_UP_BOX, 0, 0, 475, 435, ""); + fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 275, 395, 90, 30, idex(_("Apply|#A"))); fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormPreferencesApplyCB, 0); - fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 350, 395, 90, 30, idex(_("Cancel|^["))); + fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 375, 395, 90, 30, idex(_("Cancel|^["))); fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormPreferencesCancelCB, 0); - fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 150, 395, 90, 30, _("Ok")); + fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 175, 395, 90, 30, _("Ok")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormPreferencesOKCB, 0); fdui->tabfolder_prefs = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 5, 5, 450, 385, ""); fl_set_object_boxtype(obj, FL_FLAT_BOX); + fdui->button_restore = obj = fl_add_button(FL_NORMAL_BUTTON, 10, 395, 90, 30, idex(_("Restore|#R"))); + fl_set_button_shortcut(obj, scex(_("Restore|#R")), 1); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormPreferencesRestoreCB, 0); fl_end_form(); - fdui->form_preferences->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } diff --git a/src/frontends/xforms/form_preferences.h b/src/frontends/xforms/form_preferences.h index 07a0f74472..c9b321b16e 100644 --- a/src/frontends/xforms/form_preferences.h +++ b/src/frontends/xforms/form_preferences.h @@ -1,4 +1,5 @@ -/** Header file generated with fdesign on Wed Aug 2 13:56:57 2000.**/ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +/** Header file generated with fdesign **/ #ifndef FD_form_bind_h_ #define FD_form_bind_h_ @@ -19,18 +20,21 @@ extern "C" void C_FormPreferencesInputCB(FL_OBJECT *, long); extern "C" void C_FormPreferencesApplyCB(FL_OBJECT *, long); extern "C" void C_FormPreferencesCancelCB(FL_OBJECT *, long); extern "C" void C_FormPreferencesOKCB(FL_OBJECT *, long); +extern "C" void C_FormPreferencesRestoreCB(FL_OBJECT *, long); /**** Forms and Objects ****/ struct FD_form_bind { + ~FD_form_bind(); - FL_FORM *form_bind; + FL_FORM *form; FL_OBJECT *input_bind; FL_OBJECT *button_bind_file_browse; }; struct FD_form_misc { + ~FD_form_misc(); - FL_FORM *form_misc; + FL_FORM *form; FL_OBJECT *check_banner; FL_OBJECT *check_auto_region_delete; FL_OBJECT *check_exit_confirm; @@ -39,14 +43,15 @@ struct FD_form_misc { FL_OBJECT *counter_line_len; }; struct FD_form_screen_fonts { + ~FD_form_screen_fonts(); - FL_FORM *form_screen_fonts; + FL_FORM *form; FL_OBJECT *input_roman; FL_OBJECT *input_sans; FL_OBJECT *input_typewriter; FL_OBJECT *counter_zoom; FL_OBJECT *check_scalable; - FL_OBJECT *input_encoding; + FL_OBJECT *input_screen_encoding; FL_OBJECT *input_tiny; FL_OBJECT *input_script; FL_OBJECT *input_footnote; @@ -59,15 +64,17 @@ struct FD_form_screen_fonts { FL_OBJECT *input_huger; }; struct FD_form_interface_fonts { + ~FD_form_interface_fonts(); - FL_FORM *form_interface_fonts; + FL_FORM *form; FL_OBJECT *input_popup_font; FL_OBJECT *input_menu_font; - FL_OBJECT *input_encoding; + FL_OBJECT *input_popup_encoding; }; struct FD_form_printer { + ~FD_form_printer(); - FL_FORM *form_printer; + FL_FORM *form; FL_OBJECT *input_command; FL_OBJECT *input_page_range; FL_OBJECT *input_copies; @@ -88,8 +95,9 @@ struct FD_form_printer { FL_OBJECT *check_adapt_output; }; struct FD_form_paths { + ~FD_form_paths(); - FL_FORM *form_paths; + FL_FORM *form; FL_OBJECT *input_default_path; FL_OBJECT *button_document_browse; FL_OBJECT *counter_lastfiles; @@ -106,12 +114,14 @@ struct FD_form_paths { FL_OBJECT *button_backup_path_browse; }; struct FD_form_preferences { + ~FD_form_preferences(); - FL_FORM *form_preferences; + FL_FORM *form; FL_OBJECT *button_apply; FL_OBJECT *button_cancel; FL_OBJECT *button_ok; FL_OBJECT *tabfolder_prefs; + FL_OBJECT *button_restore; }; #endif /* FD_form_bind_h_ */ diff --git a/src/frontends/xforms/form_print.C b/src/frontends/xforms/form_print.C index 7115f67329..ba85d74779 100644 --- a/src/frontends/xforms/form_print.C +++ b/src/frontends/xforms/form_print.C @@ -8,15 +8,22 @@ #include FORMS_H_LOCATION #include #include "form_print.h" -#include "FormPrint.h" +#include "FormPrint.h" + +FD_form_print::~FD_form_print() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + FD_form_print * FormPrint::build_print() { FL_OBJECT *obj; FD_form_print *fdui = new FD_form_print; - fdui->form_print = fl_bgn_form(FL_NO_BOX, 340, 360); - fdui->form_print->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 340, 360); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 340, 360, ""); obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 215, 320, 90, ""); fl_set_object_color(obj, FL_COL1, FL_COL1); @@ -115,7 +122,7 @@ FD_form_print * FormPrint::build_print() fl_set_object_callback(obj, C_FormPrintInputCB, 0); fl_end_form(); - fdui->form_print->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } diff --git a/src/frontends/xforms/form_print.h b/src/frontends/xforms/form_print.h index be79d86f03..458d171806 100644 --- a/src/frontends/xforms/form_print.h +++ b/src/frontends/xforms/form_print.h @@ -1,4 +1,5 @@ -/** Header file generated with fdesign on Wed Aug 2 13:56:57 2000.**/ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +/** Header file generated with fdesign **/ #ifndef FD_form_print_h_ #define FD_form_print_h_ @@ -12,8 +13,9 @@ extern "C" void C_FormPrintCancelCB(FL_OBJECT *, long); /**** Forms and Objects ****/ struct FD_form_print { + ~FD_form_print(); - FL_FORM *form_print; + FL_FORM *form; FL_OBJECT *input_printer; FL_OBJECT *input_file; FL_OBJECT *group_radio_printto; diff --git a/src/frontends/xforms/form_ref.C b/src/frontends/xforms/form_ref.C index 432b72f405..67fa3b0ebb 100644 --- a/src/frontends/xforms/form_ref.C +++ b/src/frontends/xforms/form_ref.C @@ -8,15 +8,22 @@ #include FORMS_H_LOCATION #include #include "form_ref.h" -#include "FormRef.h" +#include "FormRef.h" + +FD_form_ref::~FD_form_ref() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + FD_form_ref * FormRef::build_ref() { FL_OBJECT *obj; FD_form_ref *fdui = new FD_form_ref; - fdui->form_ref = fl_bgn_form(FL_NO_BOX, 530, 340); - fdui->form_ref->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 530, 340); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 530, 340, ""); fdui->browser = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 10, 270, 280, ""); fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); @@ -52,7 +59,7 @@ FD_form_ref * FormRef::build_ref() fl_set_object_callback(obj, C_FormCommandCancelCB, 0); fl_end_form(); - fdui->form_ref->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } diff --git a/src/frontends/xforms/form_ref.h b/src/frontends/xforms/form_ref.h index 356732ef99..3a3ccbf7b4 100644 --- a/src/frontends/xforms/form_ref.h +++ b/src/frontends/xforms/form_ref.h @@ -1,4 +1,5 @@ -/** Header file generated with fdesign on Mon Aug 7 17:11:47 2000.**/ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +/** Header file generated with fdesign **/ #ifndef FD_form_ref_h_ #define FD_form_ref_h_ @@ -11,8 +12,9 @@ extern "C" void C_FormCommandCancelCB(FL_OBJECT *, long); /**** Forms and Objects ****/ struct FD_form_ref { + ~FD_form_ref(); - FL_FORM *form_ref; + FL_FORM *form; FL_OBJECT *browser; FL_OBJECT *update; FL_OBJECT *sort; diff --git a/src/frontends/xforms/form_tabular.C b/src/frontends/xforms/form_tabular.C index 16045705aa..b25f7d5fd3 100644 --- a/src/frontends/xforms/form_tabular.C +++ b/src/frontends/xforms/form_tabular.C @@ -8,15 +8,22 @@ #include FORMS_H_LOCATION #include #include "form_tabular.h" -#include "FormTabular.h" +#include "FormTabular.h" + +FD_form_tabular::~FD_form_tabular() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + FD_form_tabular * FormTabular::build_tabular() { FL_OBJECT *obj; FD_form_tabular *fdui = new FD_form_tabular; - fdui->form_tabular = fl_bgn_form(FL_NO_BOX, 510, 295); - fdui->form_tabular->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 510, 295); + fdui->form->u_vdata = this; obj = fl_add_box(FL_FLAT_BOX, 0, 0, 510, 295, ""); fdui->tabFolder = obj = fl_add_tabfolder(FL_TOP_TABFOLDER, 0, 0, 505, 250, _("Tabbed folder")); fl_set_object_resize(obj, FL_RESIZE_ALL); @@ -36,19 +43,26 @@ FD_form_tabular * FormTabular::build_tabular() fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_end_form(); - fdui->form_tabular->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_tabular_options::~FD_form_tabular_options() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_tabular_options * FormTabular::build_tabular_options() { FL_OBJECT *obj; FD_form_tabular_options *fdui = new FD_form_tabular_options; - fdui->form_tabular_options = fl_bgn_form(FL_NO_BOX, 505, 227); - fdui->form_tabular_options->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 505, 227); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 505, 227, ""); obj = fl_add_frame(FL_ENGRAVED_FRAME, 280, 20, 120, 75, ""); fl_set_object_color(obj, FL_COL1, FL_COL1); @@ -87,19 +101,26 @@ FD_form_tabular_options * FormTabular::build_tabular_options() fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_end_form(); - fdui->form_tabular_options->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_column_options::~FD_form_column_options() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_column_options * FormTabular::build_column_options() { FL_OBJECT *obj; FD_form_column_options *fdui = new FD_form_column_options; - fdui->form_column_options = fl_bgn_form(FL_NO_BOX, 505, 227); - fdui->form_column_options->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 505, 227); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 505, 227, ""); obj = fl_add_frame(FL_ENGRAVED_FRAME, 20, 20, 170, 105, ""); fl_set_object_color(obj, FL_COL1, FL_COL1); @@ -179,19 +200,26 @@ FD_form_column_options * FormTabular::build_column_options() fl_set_object_callback(obj, C_FormTabularInputCB, 0); fl_end_form(); - fdui->form_column_options->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_cell_options::~FD_form_cell_options() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_cell_options * FormTabular::build_cell_options() { FL_OBJECT *obj; FD_form_cell_options *fdui = new FD_form_cell_options; - fdui->form_cell_options = fl_bgn_form(FL_NO_BOX, 505, 227); - fdui->form_cell_options->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 505, 227); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 505, 227, ""); obj = fl_add_frame(FL_ENGRAVED_FRAME, 335, 115, 155, 100, ""); obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 115, 180, 100, ""); @@ -283,19 +311,26 @@ FD_form_cell_options * FormTabular::build_cell_options() fl_set_object_callback(obj, C_FormTabularInputCB, 0); fl_end_form(); - fdui->form_cell_options->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_longtable_options::~FD_form_longtable_options() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_longtable_options * FormTabular::build_longtable_options() { FL_OBJECT *obj; FD_form_longtable_options *fdui = new FD_form_longtable_options; - fdui->form_longtable_options = fl_bgn_form(FL_NO_BOX, 505, 227); - fdui->form_longtable_options->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 505, 227); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 505, 227, ""); obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 100, 75, ""); obj = fl_add_text(FL_NORMAL_TEXT, 15, 10, 85, 20, _("Header")); @@ -324,19 +359,26 @@ FD_form_longtable_options * FormTabular::build_longtable_options() fl_set_object_callback(obj, C_FormTabularInputCB, 0); fl_end_form(); - fdui->form_longtable_options->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } /*---------------------------------------*/ +FD_form_create_tabular::~FD_form_create_tabular() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + + FD_form_create_tabular * FormTabular::build_create_tabular() { FL_OBJECT *obj; FD_form_create_tabular *fdui = new FD_form_create_tabular; - fdui->form_create_tabular = fl_bgn_form(FL_NO_BOX, 310, 130); - fdui->form_create_tabular->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 310, 130); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 310, 130, ""); fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 10, 90, 90, 30, _("OK")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -359,7 +401,7 @@ FD_form_create_tabular * FormTabular::build_create_tabular() fl_set_object_resize(obj, FL_RESIZE_X); fl_end_form(); - fdui->form_create_tabular->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } diff --git a/src/frontends/xforms/form_tabular.h b/src/frontends/xforms/form_tabular.h index e97f7c079d..ab59e23360 100644 --- a/src/frontends/xforms/form_tabular.h +++ b/src/frontends/xforms/form_tabular.h @@ -1,4 +1,5 @@ -/** Header file generated with fdesign on Tue Aug 1 15:15:57 2000.**/ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +/** Header file generated with fdesign **/ #ifndef FD_form_tabular_h_ #define FD_form_tabular_h_ @@ -21,8 +22,9 @@ extern "C" void C_FormTabularCancelCB(FL_OBJECT *, long); /**** Forms and Objects ****/ struct FD_form_tabular { + ~FD_form_tabular(); - FL_FORM *form_tabular; + FL_FORM *form; FL_OBJECT *tabFolder; FL_OBJECT *button_close; FL_OBJECT *input_tabular_column; @@ -30,8 +32,9 @@ struct FD_form_tabular { FL_OBJECT *text_warning; }; struct FD_form_tabular_options { + ~FD_form_tabular_options(); - FL_FORM *form_tabular_options; + FL_FORM *form; FL_OBJECT *button_append_column; FL_OBJECT *button_delete_column; FL_OBJECT *button_append_row; @@ -42,8 +45,9 @@ struct FD_form_tabular_options { FL_OBJECT *radio_rotate_tabular; }; struct FD_form_column_options { + ~FD_form_column_options(); - FL_FORM *form_column_options; + FL_FORM *form; FL_OBJECT *radio_border_top; FL_OBJECT *radio_border_bottom; FL_OBJECT *radio_border_left; @@ -58,8 +62,9 @@ struct FD_form_column_options { FL_OBJECT *radio_valign_bottom; }; struct FD_form_cell_options { + ~FD_form_cell_options(); - FL_FORM *form_cell_options; + FL_FORM *form; FL_OBJECT *radio_multicolumn; FL_OBJECT *radio_rotate_cell; FL_OBJECT *input_special_multialign; @@ -77,8 +82,9 @@ struct FD_form_cell_options { FL_OBJECT *radio_useminipage; }; struct FD_form_longtable_options { + ~FD_form_longtable_options(); - FL_FORM *form_longtable_options; + FL_FORM *form; FL_OBJECT *radio_lt_firsthead; FL_OBJECT *radio_lt_head; FL_OBJECT *radio_lt_foot; @@ -86,8 +92,9 @@ struct FD_form_longtable_options { FL_OBJECT *radio_lt_newpage; }; struct FD_form_create_tabular { + ~FD_form_create_tabular(); - FL_FORM *form_create_tabular; + FL_FORM *form; FL_OBJECT *button_ok; FL_OBJECT *button_apply; FL_OBJECT *button_cancel; diff --git a/src/frontends/xforms/form_toc.C b/src/frontends/xforms/form_toc.C index cade37f8c6..7c0ed2be3d 100644 --- a/src/frontends/xforms/form_toc.C +++ b/src/frontends/xforms/form_toc.C @@ -8,15 +8,22 @@ #include FORMS_H_LOCATION #include #include "form_toc.h" -#include "FormToc.h" +#include "FormToc.h" + +FD_form_toc::~FD_form_toc() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + FD_form_toc * FormToc::build_toc() { FL_OBJECT *obj; FD_form_toc *fdui = new FD_form_toc; - fdui->form_toc = fl_bgn_form(FL_NO_BOX, 420, 340); - fdui->form_toc->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 420, 340); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 420, 340, ""); fdui->browser = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 10, 400, 280, ""); fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast); @@ -37,7 +44,7 @@ FD_form_toc * FormToc::build_toc() fl_set_object_callback(obj, C_FormCommandApplyCB, 0); fl_end_form(); - fdui->form_toc->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } diff --git a/src/frontends/xforms/form_toc.h b/src/frontends/xforms/form_toc.h index f61f232fbb..9dc1db79b3 100644 --- a/src/frontends/xforms/form_toc.h +++ b/src/frontends/xforms/form_toc.h @@ -1,4 +1,5 @@ -/** Header file generated with fdesign on Wed Aug 2 13:56:57 2000.**/ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +/** Header file generated with fdesign **/ #ifndef FD_form_toc_h_ #define FD_form_toc_h_ @@ -10,8 +11,9 @@ extern "C" void C_FormCommandCancelCB(FL_OBJECT *, long); /**** Forms and Objects ****/ struct FD_form_toc { + ~FD_form_toc(); - FL_FORM *form_toc; + FL_FORM *form; FL_OBJECT *browser; FL_OBJECT *type; }; diff --git a/src/frontends/xforms/form_url.C b/src/frontends/xforms/form_url.C index 2572de7846..7347b05559 100644 --- a/src/frontends/xforms/form_url.C +++ b/src/frontends/xforms/form_url.C @@ -8,15 +8,22 @@ #include FORMS_H_LOCATION #include #include "form_url.h" -#include "FormUrl.h" +#include "FormUrl.h" + +FD_form_url::~FD_form_url() +{ + if( form->visible ) fl_hide_form( form ); + fl_free_form( form ); +} + FD_form_url * FormUrl::build_url() { FL_OBJECT *obj; FD_form_url *fdui = new FD_form_url; - fdui->form_url = fl_bgn_form(FL_NO_BOX, 520, 140); - fdui->form_url->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 520, 140); + fdui->form->u_vdata = this; obj = fl_add_box(FL_UP_BOX, 0, 0, 520, 140, ""); fdui->url = obj = fl_add_input(FL_NORMAL_INPUT, 70, 20, 440, 30, _("URL")); fl_set_input_shortcut(obj, scex(_("Url|#U")), 1); @@ -43,7 +50,7 @@ FD_form_url * FormUrl::build_url() fl_set_object_callback(obj, C_FormCommandOKCB, 0); fl_end_form(); - fdui->form_url->fdui = fdui; + fdui->form->fdui = fdui; return fdui; } diff --git a/src/frontends/xforms/form_url.h b/src/frontends/xforms/form_url.h index e15d756abd..848f745721 100644 --- a/src/frontends/xforms/form_url.h +++ b/src/frontends/xforms/form_url.h @@ -1,4 +1,5 @@ -/** Header file generated with fdesign on Wed Aug 2 13:56:57 2000.**/ +// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext +/** Header file generated with fdesign **/ #ifndef FD_form_url_h_ #define FD_form_url_h_ @@ -10,8 +11,9 @@ extern "C" void C_FormCommandOKCB(FL_OBJECT *, long); /**** Forms and Objects ****/ struct FD_form_url { + ~FD_form_url(); - FL_FORM *form_url; + FL_FORM *form; FL_OBJECT *url; FL_OBJECT *name; FL_OBJECT *radio_html; diff --git a/src/frontends/xforms/forms/fdfix.sh b/src/frontends/xforms/forms/fdfix.sh index 4b86724cf2..550dc6818a 100644 --- a/src/frontends/xforms/forms/fdfix.sh +++ b/src/frontends/xforms/forms/fdfix.sh @@ -3,109 +3,58 @@ # NOTE: This is NOT the same fdfix.sh as in ${top_srcdir}/forms # It is a modified version to suit use for gui-indep. # -if [ "$1" = "$2" ]; then - echo "Input and Output file can not be the same." - exit 1 -fi - -if [ -f $2 ]; then - echo "Output file already exists, overwrite?" - read - if [ "$REPLY" != "y" ]; then - exit 0 - fi -fi if [ ! -f $1 ]; then - echo "Input file does not exist, can not continue" + echo "Input file does not exist. Cannot continue" exit 1 fi -# If there is a patch for the inputfile patch the input file with it. -if [ -f "$1.patch" ]; then - echo "Patching $1 with $1.patch" - patch -s $1 < "$1.patch" +FDESIGN=fdesign +base=`basename $1 .fd` + +if [ $1 = $base ]; then + echo "Input file is not a .fd file. Cannot continue" + exit 1 fi -echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext" > $2 -echo "#include " >> $2 -echo "#include \"lyx_gui_misc.h\"" >> $2 -echo "#include \"gettext.h\"" >> $2 -echo >> $2 +cin=$base.c +cout=$base.C +hin=$base.h +hout=$base.H -# The commands to sed does this: -# -# -e 's/#include \"forms\.h\"/#include FORMS_H_LOCATION/' -# -# Replace "forms.h" by FORMS_H_LOCATION in #include directives. This -# macro is defined in config.h and is either or -# . -# -# -e "/#include \"form_.*\"/a\\ -# #include \"$classname.h\" " -# -# For all lines containing "#include "form_*"", append a line -# containing the header file of the parent class -# -# -e '/fl_/ s/".[^|]*"/_(&)/' -# -# For all lines containing "fl_" and a string _not_ containing |, -# replace the string with _(string) -# -# -e '/shortcut/ s/".*[|].*"/scex(_(&))/' -# -# For all lines containing "shortcut" and a string containing |, replace -# the string with scex(_(string)) -# -# -e '/fl_add/ s/".*[|].*"/idex(_(&))/' -# -# For all lines containing "fl_add" and a string containing |, replace -# the string with idex(_(string)) -# -# -e '/fl_add/ s/idex("\(.*\)").*$/&\ -# fl_set_button_shortcut(obj,"\1",1);/' -# -# For all lines containing "fl_add" and a string containing |, add the -# shortcut command after the end of this line -# -# -e 's/\(\(FD_[^ ]*\) \*fdui =\).*sizeof(\*fdui))/\1 new \2/' -# -# We use new/delete not malloc/free so change to suit. -# -# -e "s/\(FD_f\([^ _]*\)_\([^ ]*\)\) \*create_form_form[^ ]*/\1 * $classname::build_\3()/" -# -# Fixup the name of the create_form... function to have a signature matching -# that of the method it will become. -# -# -e 's/\(fdui->form[^ ]*\)\(.*bgn_form.*\)/\1\2\ -# \1->u_vdata = this;/' \ -# -# We need to store a pointer to the dialog in u_vdata so that the callbacks -# will work. -# -# -e 's/,\([^ ]\)/, \1/g' -# -# Someone got busy and put spaces in after commas but didn't allow for the -# autogeneration of the files so their pretty formatting got lost. Not anymore. -# - -classname=`basename $1 .c | cut -c6-` +classname=`echo $base | cut -c6-` firstchar=`echo $classname | cut -c1 | tr a-z A-Z` rest=`echo $classname | cut -c2-` classname=Form$firstchar$rest -export classname -cat $1 | sed \ --e 's/#include \"forms\.h\"/#include FORMS_H_LOCATION/' \ --e "/#include \"form_.*\"/a\\ -#include \"$classname.h\" " \ --e '/fl_/ s/".[^|]*"/_(&)/' \ --e '/shortcut/ s/".*[|].*"/scex(_(&))/' \ --e '/fl_add/ s/".*[|].*"/idex(_(&))/' \ --e '/fl_add/ s/idex(\(.*\)").*$/&\ - fl_set_button_shortcut(obj,scex(\1")),1);/' \ --e 's/\(\(FD_[^ ]*\) \*fdui =\).*sizeof(\*fdui))/\1 new \2/' \ --e "s/\(FD_f\([^ _]*\)_\([^ ]*\)\) \*create_form_form[^ ]*/\1 * $classname::build_\3()/" \ --e 's/\(fdui->form[^ ]*\)\(.*bgn_form.*\)/\1\2\ - \1->u_vdata = this;/' \ --e 's/,\([^ ]\)/, \1/g' >> $2 +# Create .c and .h files +$FDESIGN -convert $1 + +# Modify .h file for use by LyX +echo "// File modified by fdfix.sh for use by lyx (with xforms >= 0.88) and gettext" > $hout +sed -f fdfixh.sed < $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 +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 + +sed -f fdfixc.sed < $cin | sed -e "s/CLASSNAME/$classname/" >> $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 +fi + +# Clean up, to leave .C and .h files +rm -f $cin $hin +mv $hout $hin diff --git a/src/frontends/xforms/forms/fdfixc.sed b/src/frontends/xforms/forms/fdfixc.sed new file mode 100644 index 0000000000..b5ba28f3e4 --- /dev/null +++ b/src/frontends/xforms/forms/fdfixc.sed @@ -0,0 +1,78 @@ +# Can't seem to input $classname! +# CLASSNAME will be swapped for the true classname later + +# Create the destructor. +/\(.*\) *create_form_form/{ +h +s/\(.*\) \*create_form_form[^ ]*/\1::~\1()/p +/\(.*\)::~\(.*\)()/{ +i\ +{\ + if( form->visible ) fl_hide_form( form );\ + fl_free_form( form );\ +}\ +\ + +} +x +} + +# Rewrite "fdui->form_xxx->fdui = ..." as "fdui->form->fdui = ..." +s/fdui->form_\([^ ]*\)->fdui =/fdui->form->fdui =/ + +# Rewrite "fdui->form_xxx = ..." as "fdui->form = ..." +s/fdui->form_\([^ ]*\) =/fdui->form =/ + +# Rewrite "fdui->form_xxx->..." as "fdui->form->..." +s/fdui->form_\([^ ]*\)->/fdui->form->/ + +# Replace "forms.h" by FORMS_H_LOCATION in #include directives. This +# macro is defined in config.h and is either or +# . +s/#include \"forms\.h\"/#include FORMS_H_LOCATION/ + +# For all lines containing "#include "form_*"", append a line +# containing the header file of the parent class +/#include \"form_.*\"/a\ +#include \"CLASSNAME.h\" + +# For all lines containing "fl_" and a string _not_ containing |, +# replace the string with _(string) +/fl_/ s/".[^|]*"/_(&)/ + +# For all lines containing "shortcut" and a string containing |, +# replace the string with scex(_(string)) +/shortcut/ s/".*[|].*"/scex(_(&))/ + + +# 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 |, add the +# shortcut command after the end of this line +/fl_add/ s/idex(\(.*\)").*$/&\ + fl_set_button_shortcut(obj,scex(\1")),1);/ + +# We use new/delete not malloc/free so change to suit. +s/\(\(FD_[^ ]*\) \*fdui =\).*sizeof(\*fdui))/\1 new \2/ + +# Fixup the name of the create_form... function to have a signature +# matching that of the method it will become. +s/\(FD_f\([^ _]*\)_\([^ ]*\)\) \*create_form_form[^ ]*/\1 * CLASSNAME::build_\3()/ + +# We need to store a pointer to the dialog in u_vdata so that the +# callbacks will work. +s/\(fdui->form\)\(.*bgn_form.*\)/\1\2\ + \1->u_vdata = this;/ + +# Someone got busy and put spaces in after commas but didn't allow for the +# autogeneration of the files so their pretty formatting got lost. Not anymore. +# +s/,\([^ ]\)/, \1/g + +# Clean up one special case where a comma appears at the end of a string +# while ensuring "...", "..." isn't affected. +# +s/\("[^"]+,\) \("\)/\1\2/g + diff --git a/src/frontends/xforms/forms/fdfixh.sed b/src/frontends/xforms/forms/fdfixh.sed index 354d07aaf7..024385300f 100644 --- a/src/frontends/xforms/forms/fdfixh.sed +++ b/src/frontends/xforms/forms/fdfixh.sed @@ -1,52 +1,61 @@ -# cat someFile.h | sed -f fdfixh.sed - +# sed -f fdfixh.sed < somefile.h > fixedfile.h +# # It contains the instructions that sed requires to manipulate # the header files produced by fdesign into a form usable by LyX -# In summary it... - -# s/\(extern \)\(.*\)/\1 "C" \2/ +s/\(extern \)\(.*\)/\1 "C" \2/ # # Replaces lines such as "extern void func(args);" # with "extern "C" void func(args);" -# /create_form_/d +/create_form_/d +# +# Deletes lines containing "create_form_" + +s,\(generated with fdesign\)\(.*\)\(\*\*/\),\1 \3, # -# Deletes lines containing "/create_form_/d" - -# Rewrites as -# typedef struct { struct someStruct { -# ... ... -# void *vdata; ... -# char *cdata; }; -# long ldata; -# ... -# } someStruct; +# Deletes the dated signature so we can rebuild everything as often +# as we want without silly clashes due to the date. + +# Rewrites as +# typedef struct { struct FD_form_xxx { +# FL_FORM *form_xxx; ~FD_form_xxx(); +# void *vdata; +# char *cdata; FL_FORM *form; +# long ldata; ... +# ... } +# } FD_form_xxx; # # This is detailed more closely below -s/\(extern \)\(.*\)/\1 "C" \2/ -/create_form_/d +#Manipulate the struct +#===================== +/typedef struct {/,/} .*;/{ -/typedef struct {/,/} .*;/{ # delete lines containing ... -/typedef struct {/d -/vdata/d -/cdata/d -/ldata/d + /typedef struct {/d + /vdata/d + /cdata/d + /ldata/d + +# rewrite "FL_FORM *form_xxx;" as "FL_FORM *form;" + s/FL_FORM \(.*\);/FL_FORM *form;/ # copy remaining lines into the hold space -H + H -# rewrite "} someStruct;" as "struct someStruct {" and print -s/} \(.*\);/struct \1 {/p +# rewrite "} someStruct;" as "struct someStruct {" and print +# " ~someStruct();" + /} \(.*\);/{ + s/} \(.*\);/struct \1 {/p + s/struct \(.*\) {/ ~\1();/p + } # delete line from pattern space -d + d } # swap the hold space back into the pattern space and... /^$/x -{ + # rewrite "} someStruct;" as "};" s/} \(.*\);/};/ -} diff --git a/src/frontends/xforms/forms/form_citation.fd b/src/frontends/xforms/forms/form_citation.fd index 84a1e8d954..c9cfd956d8 100644 --- a/src/frontends/xforms/forms/form_citation.fd +++ b/src/frontends/xforms/forms/form_citation.fd @@ -8,14 +8,14 @@ Unit of measure: FL_COORD_PIXEL =============== FORM =============== Name: form_citation -Width: 430 -Height: 770 +Width: 435 +Height: 665 Number of Objects: 13 -------------------- class: FL_BOX type: UP_BOX -box: 0 0 430 770 +box: 0 0 435 665 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -33,7 +33,7 @@ argument: -------------------- class: FL_BROWSER type: HOLD_BROWSER -box: 10 30 180 370 +box: 10 30 180 300 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_TOP_LEFT @@ -51,7 +51,7 @@ argument: CITEBRSR -------------------- class: FL_BROWSER type: HOLD_BROWSER -box: 240 30 180 370 +box: 240 30 180 300 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_TOP_LEFT @@ -141,7 +141,7 @@ argument: DOWN -------------------- class: FL_BROWSER type: NORMAL_BROWSER -box: 10 440 410 110 +box: 10 360 410 80 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_YELLOW alignment: FL_ALIGN_TOP_LEFT @@ -159,7 +159,7 @@ argument: -------------------- class: FL_CHOICE type: NORMAL_CHOICE -box: 160 570 130 30 +box: 160 470 130 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_BLACK alignment: FL_ALIGN_LEFT @@ -177,7 +177,7 @@ argument: -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 100 620 250 30 +box: 100 520 250 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -195,7 +195,7 @@ argument: -------------------- class: FL_INPUT type: NORMAL_INPUT -box: 100 660 250 30 +box: 100 570 250 30 boxtype: FL_DOWN_BOX colors: FL_COL1 FL_MCOL alignment: FL_ALIGN_LEFT @@ -213,7 +213,7 @@ argument: -------------------- class: FL_BUTTON type: RETURN_BUTTON -box: 230 730 90 30 +box: 230 630 90 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -231,7 +231,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 330 730 90 30 +box: 330 630 90 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER diff --git a/src/frontends/xforms/forms/form_document.C.patch b/src/frontends/xforms/forms/form_document.C.patch index c18dbfc6ce..2368bc167f 100644 --- a/src/frontends/xforms/forms/form_document.C.patch +++ b/src/frontends/xforms/forms/form_document.C.patch @@ -1,18 +1,18 @@ ---- form_document.C.old Fri Aug 11 15:30:33 2000 -+++ form_document.C Fri Aug 11 15:32:41 2000 +--- form_document.C.orig Mon Aug 14 13:17:32 2000 ++++ form_document.C Mon Aug 14 13:22:59 2000 @@ -9,6 +9,8 @@ #include #include "form_document.h" - #include "FormDocument.h" + #include "FormDocument.h" +#include "bmtable.h" +#include "support/filetools.h" - FD_form_tabbed_document * FormDocument::build_tabbed_document() + FD_form_tabbed_document::~FD_form_tabbed_document() { -@@ -321,10 +323,16 @@ +@@ -363,10 +365,18 @@ - fdui->form_doc_bullet = fl_bgn_form(FL_NO_BOX, 440, 345); - fdui->form_doc_bullet->u_vdata = this; + fdui->form = fl_bgn_form(FL_NO_BOX, 440, 345); + fdui->form->u_vdata = this; + fl_set_border_width(-1); obj = fl_add_box(FL_UP_BOX, 0, 0, 440, 345, ""); - fdui->bmtable_bullet_panel = obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 90, 105, 260, 180, ""); @@ -24,17 +24,10 @@ + fl_set_object_lcol(obj, FL_BLUE); + fl_set_object_boxtype(obj, FL_UP_BOX); + fl_set_bmtable_pixmap_file(obj, 6, 6, -+ LibFileSearch("images", "standard.xpm").c_str()); ++ LibFileSearch("images", ++ "standard", ++ "xpm").c_str()); + fl_set_border_width(-1); obj = fl_add_frame(FL_ENGRAVED_FRAME, 95, 20, 255, 70, ""); fdui->choice_bullet_size = obj = fl_add_choice(FL_NORMAL_CHOICE, 15, 45, 65, 30, idex(_("Size|#z"))); fl_set_button_shortcut(obj, scex(_("Size|#z")), 1); -@@ -336,6 +344,8 @@ - fl_set_button_shortcut(obj, scex(_("LaTeX|#L")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_lstyle(obj, FL_FIXED_STYLE); -+ fl_set_input_return(obj, FL_RETURN_CHANGED); -+ fl_set_input_maxchars(obj, 80); - fl_set_object_callback(obj, InputBulletLaTeXCB, 0); - - fdui->radio_bullet_depth = fl_bgn_group(); diff --git a/src/frontends/xforms/forms/form_preferences.fd b/src/frontends/xforms/forms/form_preferences.fd index a28eb5009e..0a29b65626 100644 --- a/src/frontends/xforms/forms/form_preferences.fd +++ b/src/frontends/xforms/forms/form_preferences.fd @@ -344,7 +344,7 @@ label: Encoding shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity -name: input_encoding +name: input_screen_encoding callback: C_FormPreferencesInputCB argument: 0 @@ -602,7 +602,7 @@ label: Encoding shortcut: resize: FL_RESIZE_ALL gravity: FL_NoGravity FL_NoGravity -name: input_encoding +name: input_popup_encoding callback: C_FormPreferencesInputCB argument: 0 @@ -1239,14 +1239,14 @@ argument: =============== FORM =============== Name: form_preferences -Width: 460 +Width: 475 Height: 435 -Number of Objects: 5 +Number of Objects: 6 -------------------- class: FL_BOX type: UP_BOX -box: 0 0 460 435 +box: 0 0 475 435 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -1264,7 +1264,7 @@ argument: -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 250 395 90 30 +box: 275 395 90 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -1282,7 +1282,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 350 395 90 30 +box: 375 395 90 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -1300,7 +1300,7 @@ argument: 0 -------------------- class: FL_BUTTON type: RETURN_BUTTON -box: 150 395 90 30 +box: 175 395 90 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -1333,5 +1333,23 @@ name: tabfolder_prefs callback: argument: +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 10 395 90 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Restore|#R +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_restore +callback: C_FormPreferencesRestoreCB +argument: 0 + ============================== create_the_forms diff --git a/src/frontends/xforms/forms/makefile b/src/frontends/xforms/forms/makefile index 55f76c5166..147c049e1d 100644 --- a/src/frontends/xforms/forms/makefile +++ b/src/frontends/xforms/forms/makefile @@ -11,7 +11,7 @@ ### ### Makefile by Lars Gullik Bjønnes (larsbj@ifi.uio.no) ### Modified by Allan Rae -### +### Rewritten by Angus Leeming. SHELL = /bin/sh .SUFFIXES: .fd .c @@ -31,51 +31,23 @@ SRCS := form_citation.fd \ form_toc.fd \ form_url.fd - -OBJS := $(SRCS:.fd=.c) - -COBJS := $(SRCS:.fd=.C) +OBJS := $(SRCS:.fd=.C) all: @echo "This is a makefile intended for the maintainer only." @echo "Only run it if you are absolutely sure about what you" @echo "are doing." -c: $(OBJS) - -d: c $(COBJS) +test: clean $(OBJS) +updatesrc: test + mv *.C *.h .. -# Modify the header files using the instructions in fdfixh.sed -e: c - @echo "Modifying header files using the instructions in fdfixh.sed";\ - for hfil in *.h ; do \ - if [ -f "$$hfil.patch" ] ; then \ - (echo "Patching $$hfil with $$hfil.patch" ; \ - patch -s $$hfil < $$hfil.patch) \ - fi; \ - sed -f fdfixh.sed < $$hfil > $$hfil.tmp; \ - mv $$hfil.tmp $$hfil; \ - done - -updatesrc: d e - -.fd.c: - $(FDESIGN) -convert $< - -.c.C: - ${SHELL} ./fdfix.sh $< $@ - rm $< - @if [ -f "$@.patch" ] ; then \ - (echo "Patching $@ with $@.patch" ; \ - patch -s $@ < $@.patch) \ - fi; +.fd.C: + ${SHELL} ./fdfix.sh $< clean: rm -f *.[hcC] *.bak distclean: clean rm -f *.orig *.rej *~ - -install: clean updatesrc - cp *.C *.h .. diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 2b6eab7f0a..3a392cd681 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -670,8 +670,13 @@ InsetGraphicsParams InsetGraphics::getParams() const Inset * InsetGraphics::Clone() const { - InsetGraphics * newInset = new InsetGraphics; - newInset->setParams(getParams()); - + InsetGraphics * newInset = new InsetGraphics; + + newInset->cacheHandle = cacheHandle; + newInset->pixmap = pixmap; + newInset->pixmapInitialized = pixmapInitialized; + + newInset->setParams(getParams()); + return newInset; } diff --git a/src/layout_forms.h b/src/layout_forms.h index deae816739..e27a000b2d 100644 --- a/src/layout_forms.h +++ b/src/layout_forms.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/ +/** Header file generated with fdesign **/ #ifndef FD_form_document_h_ #define FD_form_document_h_ diff --git a/src/log_form.h b/src/log_form.h index e16dd59fe1..5fb5c3ae4f 100644 --- a/src/log_form.h +++ b/src/log_form.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Mon Jul 17 21:08:23 2000.**/ +/** Header file generated with fdesign **/ #ifndef FD_LaTeXLog_h_ #define FD_LaTeXLog_h_ diff --git a/src/lyx.C b/src/lyx.C index 68a3bf3543..6e0542eb3e 100644 --- a/src/lyx.C +++ b/src/lyx.C @@ -65,53 +65,6 @@ FD_form_figure *create_form_form_figure(void) } /*---------------------------------------*/ -FD_form_screen *create_form_form_screen(void) -{ - FL_OBJECT *obj; - FD_form_screen *fdui = (FD_form_screen *) fl_calloc(1, sizeof(FD_form_screen)); - - fdui->form_screen = fl_bgn_form(FL_NO_BOX, 390, 220); - obj = fl_add_box(FL_UP_BOX, 0, 0, 390, 220, ""); - fdui->input_roman = obj = fl_add_input(FL_NORMAL_INPUT, 140, 10, 240, 30, idex(_("Roman font|#R")));fl_set_button_shortcut(obj, scex(_("Roman font|#R")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); - fl_set_object_resize(obj, FL_RESIZE_X); - fdui->input_sans = obj = fl_add_input(FL_NORMAL_INPUT, 140, 40, 240, 30, idex(_("Sans serif font|#S")));fl_set_button_shortcut(obj, scex(_("Sans serif font|#S")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); - fl_set_object_resize(obj, FL_RESIZE_X); - fdui->input_typewriter = obj = fl_add_input(FL_NORMAL_INPUT, 140, 70, 240, 30, idex(_("Typewriter font|#T")));fl_set_button_shortcut(obj, scex(_("Typewriter font|#T")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); - fl_set_object_resize(obj, FL_RESIZE_X); - fdui->input_font_norm = obj = fl_add_input(FL_NORMAL_INPUT, 140, 100, 240, 30, idex(_("Font norm|#N")));fl_set_button_shortcut(obj, scex(_("Font norm|#N")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); - fl_set_object_resize(obj, FL_RESIZE_X); - fdui->intinput_size = obj = fl_add_input(FL_INT_INPUT, 140, 140, 50, 30, idex(_("Font zoom|#Z")));fl_set_button_shortcut(obj, scex(_("Font zoom|#Z")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity); - fl_set_object_resize(obj, FL_RESIZE_X); - obj = fl_add_button(FL_RETURN_BUTTON, 60, 180, 100, 30, _("OK")); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, ScreenOKCB, 0); - obj = fl_add_button(FL_NORMAL_BUTTON, 170, 180, 100, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, ScreenApplyCB, 0); - obj = fl_add_button(FL_NORMAL_BUTTON, 280, 180, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1); - fl_set_object_lsize(obj, FL_NORMAL_SIZE); - fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast); - fl_set_object_callback(obj, ScreenCancelCB, 0); - fl_end_form(); - - //fdui->form_screen->fdui = fdui; - - return fdui; -} -/*---------------------------------------*/ - FD_form_external *create_form_form_external(void) { FL_OBJECT *obj; diff --git a/src/lyx.h b/src/lyx.h index 7d21e7e001..6847ebfd40 100644 --- a/src/lyx.h +++ b/src/lyx.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Mon Jul 31 11:17:12 2000.**/ +/** Header file generated with fdesign **/ #ifndef FD_form_title_h_ #define FD_form_title_h_ @@ -10,10 +10,6 @@ extern "C" void FigureOKCB(FL_OBJECT *, long); extern "C" void FigureApplyCB(FL_OBJECT *, long); extern "C" void FigureCancelCB(FL_OBJECT *, long); -extern "C" void ScreenOKCB(FL_OBJECT *, long); -extern "C" void ScreenApplyCB(FL_OBJECT *, long); -extern "C" void ScreenCancelCB(FL_OBJECT *, long); - extern "C" void ExternalTemplateCB(FL_OBJECT *, long); extern "C" void ExternalBrowseCB(FL_OBJECT *, long); extern "C" void ExternalEditCB(FL_OBJECT *, long); @@ -44,19 +40,6 @@ typedef struct { } FD_form_figure; extern FD_form_figure * create_form_form_figure(void); -typedef struct { - FL_FORM *form_screen; - void *vdata; - char *cdata; - long ldata; - FL_OBJECT *input_roman; - FL_OBJECT *input_sans; - FL_OBJECT *input_typewriter; - FL_OBJECT *input_font_norm; - FL_OBJECT *intinput_size; -} FD_form_screen; - -extern FD_form_screen * create_form_form_screen(void); typedef struct { FL_FORM *form_external; void *vdata; diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 4d4e556d6a..a6f8f60d18 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -40,11 +40,9 @@ #include "support/filetools.h" #include "support/path.h" #include "lyxserver.h" -#include "FontLoader.h" #include "lyxrc.h" #include "lyxtext.h" #include "CutAndPaste.h" -#include "TextCache.h" using std::ifstream; using std::copy; @@ -70,7 +68,6 @@ extern FD_form_quotes * fd_form_quotes; extern FD_form_preamble * fd_form_preamble; extern FD_form_table * fd_form_table; extern FD_form_figure * fd_form_figure; -extern FD_form_screen * fd_form_screen; extern FD_form_bullet * fd_form_bullet; extern BufferView * current_view; // called too many times in this file... @@ -2832,43 +2829,6 @@ extern "C" void FigureOKCB(FL_OBJECT * ob, long data) } -extern "C" void ScreenApplyCB(FL_OBJECT *, long) -{ - lyxrc.roman_font_name = fl_get_input(fd_form_screen->input_roman); - lyxrc.sans_font_name = fl_get_input(fd_form_screen->input_sans); - lyxrc.typewriter_font_name = fl_get_input(fd_form_screen->input_typewriter); - lyxrc.font_norm = fl_get_input(fd_form_screen->input_font_norm); - lyxrc.set_font_norm_type(); - lyxrc.zoom = atoi(fl_get_input(fd_form_screen->intinput_size)); - fontloader.update(); - - // Of course we should only to the resize and the textcahce.clear - // if values really changed...but not very important right now. (Lgb) - - // All buffers will need resize - bufferlist.resize(); - // We also need to empty the textcache so that - // the buffer will be formatted correctly after - // a zoom change. - textcache.clear(); - - current_view->owner()->getMiniBuffer()->Set(_("Screen options set")); -} - - -extern "C" void ScreenCancelCB(FL_OBJECT *, long) -{ - fl_hide_form(fd_form_screen->form_screen); -} - - -extern "C" void ScreenOKCB(FL_OBJECT * ob, long data) -{ - ScreenCancelCB(ob, data); - ScreenApplyCB(ob, data); -} - - // This function runs "configure" and then rereads lyx.defaults to // reconfigure the automatic settings. void Reconfigure(BufferView * bv) diff --git a/src/lyx_gui.C b/src/lyx_gui.C index 1a731b82c8..72399342ce 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -63,7 +63,6 @@ FD_form_preamble * fd_form_preamble; FD_form_table * fd_form_table; FD_form_sendto * fd_form_sendto; FD_form_figure * fd_form_figure; -FD_form_screen * fd_form_screen; FD_LaTeXLog * fd_latex_log; // from log_form.h Combox * combo_language; Combox * combo_language2; @@ -525,11 +524,6 @@ void LyXGUI::create_forms() CancelCloseBoxCB, 0); fl_set_button(fd_form_figure->radio_postscript, 1); - // the screen form - fd_form_screen = create_form_form_screen(); - fl_set_form_atclose(fd_form_screen->form_screen, - CancelCloseBoxCB, 0); - // the latex log form fd_latex_log = create_form_LaTeXLog(); fl_set_form_atclose(fd_latex_log->LaTeXLog, diff --git a/src/lyx_main.C b/src/lyx_main.C index d17f1946d3..1b6149b65b 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -403,6 +403,7 @@ void LyX::init(int */*argc*/, char **argv, bool gui) // ReadRcFile("lyxrc.defaults"); +// system_lyxrc = lyxrc; // If there is a preferences file we read that instead // of the old lyxrc file. if (!ReadRcFile("preferences")) diff --git a/src/lyx_sendfax.h b/src/lyx_sendfax.h index 3fe5d40359..882cbbd196 100644 --- a/src/lyx_sendfax.h +++ b/src/lyx_sendfax.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/ +/** Header file generated with fdesign **/ #ifndef FD_xsendfax_h_ #define FD_xsendfax_h_ diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 13bfe8ab4b..034865018c 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -92,6 +92,8 @@ using std::istringstream; #include "menus.h" #endif #include "FloatList.h" +#include "FontLoader.h" +#include "TextCache.h" using std::pair; using std::endl; @@ -2844,6 +2846,22 @@ string LyXFunc::Dispatch(int ac, } break; + case LFUN_SCREEN_FONT_UPDATE: + { + // handle the screen font changes. + // + lyxrc.set_font_norm_type(); + fontloader.update(); + // Of course we should only do the resize and the textcache.clear + // if values really changed...but not very important right now. (Lgb) + // All buffers will need resize + bufferlist.resize(); + // We also need to empty the textcache so that + // the buffer will be formatted correctly after + // a zoom change. + textcache.clear(); + } + case LFUN_SET_COLOR: { string lyx_name, x11_name; diff --git a/src/lyxrc.C b/src/lyxrc.C index 13b5820e33..c9ab9d5f3c 100644 --- a/src/lyxrc.C +++ b/src/lyxrc.C @@ -1553,3 +1553,6 @@ void LyXRC::set_font_norm_type() // The global instance LyXRC lyxrc; + +// The global copy of the system lyxrc entries (everything except preferences) +//LyXRC system_lyxrc; diff --git a/src/lyxrc.h b/src/lyxrc.h index b6694c5aaf..77a292e953 100644 --- a/src/lyxrc.h +++ b/src/lyxrc.h @@ -265,5 +265,6 @@ public: /// extern LyXRC lyxrc; - +/// +//extern LyXRC system_lyxrc; #endif diff --git a/src/mathed/math_forms.h b/src/mathed/math_forms.h index e58703bbcf..69265c82c4 100644 --- a/src/mathed/math_forms.h +++ b/src/mathed/math_forms.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/ +/** Header file generated with fdesign **/ #ifndef FD_panel_h_ #define FD_panel_h_ diff --git a/src/menus.C b/src/menus.C index 296671b14a..4bee5438e7 100644 --- a/src/menus.C +++ b/src/menus.C @@ -60,7 +60,6 @@ using std::max; using std::min; using std::sort; -extern FD_form_screen * fd_form_screen; extern BufferList bufferlist; // I would really prefere to see most or all of these 'extern's disappear. @@ -455,37 +454,6 @@ void Menus::create_menus(int air) } -void Menus::ScreenOptions() -{ - static int ow = -1, oh; - - // this is not very nice.... - fl_set_input(fd_form_screen->input_roman, - lyxrc.roman_font_name.c_str()); - fl_set_input(fd_form_screen->input_sans, - lyxrc.sans_font_name.c_str()); - fl_set_input(fd_form_screen->input_typewriter, - lyxrc.typewriter_font_name.c_str()); - fl_set_input(fd_form_screen->input_font_norm, - lyxrc.font_norm.c_str()); - char tmpstring[10]; - sprintf(tmpstring, "%d", lyxrc.zoom); - fl_set_input(fd_form_screen->intinput_size, tmpstring); - if (fd_form_screen->form_screen->visible) { - fl_raise_form(fd_form_screen->form_screen); - } else { - fl_show_form(fd_form_screen->form_screen, - FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER, - _("Screen Options")); - if (ow < 0) { - ow = fd_form_screen->form_screen->w; - oh = fd_form_screen->form_screen->h; - } - fl_set_form_minsize(fd_form_screen->form_screen, ow, oh); - } -} - - // // Here comes all the menu callbacks. // @@ -2012,17 +1980,15 @@ void Menus::ShowOptionsMenu(FL_OBJECT * ob, long) LyXFunc * tmpfunc = men->_view->getLyXFunc(); int OptionsMenu = fl_defpup(FL_ObjWin(ob), - _("Screen Fonts..." - "|Spellchecker Options..." + _("|Spellchecker Options..." "|Keyboard...%l" "|Reconfigure" "|Preferences")); - fl_setpup_shortcut(OptionsMenu, 1, scex(_("OM|Ff#f#F"))); - fl_setpup_shortcut(OptionsMenu, 2, scex(_("OM|Ss#s#S"))); - fl_setpup_shortcut(OptionsMenu, 3, scex(_("OM|Kk#k#K"))); - fl_setpup_shortcut(OptionsMenu, 4, scex(_("OM|Rr#r#R"))); - fl_setpup_shortcut(OptionsMenu, 5, scex(_("OM|Pp#p#P"))); + fl_setpup_shortcut(OptionsMenu, 1, scex(_("OM|Ss#s#S"))); + fl_setpup_shortcut(OptionsMenu, 2, scex(_("OM|Kk#k#K"))); + fl_setpup_shortcut(OptionsMenu, 3, scex(_("OM|Rr#r#R"))); + fl_setpup_shortcut(OptionsMenu, 4, scex(_("OM|Pp#p#P"))); if(lyxrc.isp_command == "none") fl_setpup_mode(OptionsMenu, 2, FL_PUP_GREY); @@ -2037,11 +2003,10 @@ void Menus::ShowOptionsMenu(FL_OBJECT * ob, long) fl_set_object_boxtype(ob, FL_FLAT_BOX); fl_redraw_object(ob); switch (choice){ - case 1: men->ScreenOptions(); break; - case 2: SpellCheckerOptions(); break; - case 3: men->_view->getIntl()->MenuKeymap(); break; - case 4: tmpfunc->Dispatch(LFUN_RECONFIGURE); break; - case 5: men->_view->getDialogs()->showPreferences(); break; + case 1: SpellCheckerOptions(); break; + case 2: men->_view->getIntl()->MenuKeymap(); break; + case 3: tmpfunc->Dispatch(LFUN_RECONFIGURE); break; + case 4: men->_view->getDialogs()->showPreferences(); break; default: break; } fl_freepup(OptionsMenu); diff --git a/src/menus.h b/src/menus.h index 46223efe93..b3ffff4a34 100644 --- a/src/menus.h +++ b/src/menus.h @@ -61,8 +61,6 @@ private: /// void create_menus(int air); /// - void ScreenOptions(); - /// void showCopyright(); /// void showLicense(); diff --git a/src/print_form.h b/src/print_form.h index 41526b447f..ca6a5beed2 100644 --- a/src/print_form.h +++ b/src/print_form.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/ +/** Header file generated with fdesign **/ #ifndef FD_form_sendto_h_ #define FD_form_sendto_h_ diff --git a/src/sp_form.h b/src/sp_form.h index c02f58f8ec..f249ae5679 100644 --- a/src/sp_form.h +++ b/src/sp_form.h @@ -1,4 +1,4 @@ -/** Header file generated with fdesign on Mon Jun 19 12:55:08 2000.**/ +/** Header file generated with fdesign **/ #ifndef FD_form_spell_options_h_ #define FD_form_spell_options_h_