+2000-06-12 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * LyX Developers Meeting: All files changed, due to random C++ (by
+ coincidence) code generator script.
+
+ - external inset (cool!)
+ - initial online editing of preferences
+ - insettabular breaks insettext(s contents)
+ - cleanup
+ - some DocBook fixes
+ - example files update
+ - other cool stuff, create a diff and look for yourself.
+
+2000-06-09 The Great LyX Application <lyx@localhost.localdomain>
+
+ * src/insets/insettext.C (computeTextRows): if the maxWidth is
+ -1 this is a non-line-breaking textinset.
+
+ * src/insets/insettabular.C (GetMaxWidthOfCell): returns now -1
+ if there is no width set.
+
+2000-06-10 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * Lots of files: Merged the dialogbase branch.
+
+2000-06-09 Allan Rae <rae@lyx.org>
+
+ * src/xtl/, src/lyxfunc.[Ch], src/buffer.[Ch]: Removed XTL and
+ and the Dispatch methods that used it.
+
+ * src/frontends/Liason.[Ch]: replaced with a Liason namespace for
+ access to functions formerly kept in Dispatch.
+
+2000-05-19 Allan Rae <rae@lyx.org>
+
+ * src/PrinterParams.h, src/buffer.C, src/frontends/xforms/FormPrint.C:
+ made to_page and count_copies integers again. from_page remains a
+ string however because I want to allow entry of a print range like
+ "1,4,22-25" using this field.
+
+ * src/LyXAction.C: added action info and commands for buffer-print-xtl
+ and printer-params-get. These aren't useful from the minibuffer but
+ could be used by a script/LyXServer app provided it passes a suitable
+ auto_mem_buffer. I guess I should take a look at how the LyXServer
+ works and make it support xtl buffers.
+
+ * sigc++/: updated to libsigc++-1.0.1
+
+ * src/xtl/: updated to xtl-1.3.pl.11
+
+ * forms/makefile, forms/fdfix.sh, forms/layout_forms.fd: Made sure
+ those changes done to the files in src/ are actually recreated when
+ they get regenerated. Please don't ever accept a patch that changes a
+ dialog unless that patch includes the changes to the corresponding *.fd
+ file.
+
+ * src/lyx_cb.C, src/support/lstrings.[hC]: Moved Stephen Witt's
+ stringOnlyContains, renamed it and generalised it.
+
+ * lots-of-files: Rolled the "rae" branch over into the "dialogbase"
+ branch. Removed the remaining old form_print code.
+
+2000-04-26 Allan Rae <rae@lyx.org>
+
+ * ChangeLog, development/tools/lxtl.sh: D'oh! Got caught in the same
+ trap I was trying to fix with the ID: fields in src/xtl/ :-)
+
+2000-04-25 Allan Rae <rae@lyx.org>
+
+ * src/xtl/: Updated to incorporate Angus's two patches as well as mine
+ against a base of xtl-1.3.pl.4
+
+ * development/tools/lxtl.sh: fixed a couple of silly typos and now
+ filter the Id: entries so they still show the xtl version number
+ they are based on.
+
+ * src/support/lxtl.h: removed auto_mem_buffer which is now incorporated
+ into the src/xtl code. Patch still pending with José (XTL)
+
+2000-04-24 Allan Rae <rae@lyx.org>
+
+ * src/lyxfunc.[Ch] (Dispatch): Use a mem buffer as a parameter. This is
+ both more generic and much safer. Use the new template functions.
+ * src/buffer.[Ch] (Dispatch): ditto.
+
+ * src/frontends/xforms/FormPrint.C (update): Use new template functions
+ and mem buffer more intelligently. Also a little general cleanup.
+ (apply): ditto.
+
+ * configure.in (AC_OUTPUT): Extra stuff for xtl that I forgot.
+ * development/tools/lxtl.sh: Ditto. Makefile.am + .cvsignore
+ * src/xtl/Makefile.am: ditto.
+ * src/xtl/.cvsignore: ditto.
+ * src/Makefile.am: ditto.
+
+ * src/PrinterParams.h: Removed the macros member functions. Added a
+ testInvariant member function. A bit of tidying up and commenting.
+ Included Angus's idea for fixing operation with egcs-1.1.2.
+
+ * src/support/lxtl.h: Many changes. Added auto_mem_buffer -- a really
+ cool expansion of XTL's mem_buffer to support automatic memory
+ management within the buffer itself. Removed the various macros and
+ replaced them with template functions that use either auto_mem_buffer
+ or mem_buffer depending on a #define. The mem_buffer support will
+ disappear as soon as the auto_mem_buffer is confirmed to be good on
+ other platforms/compilers. That is, it's there so you've got something
+ to compare against.
+
+ * src/xtl/objio.h: Changes to support auto_mem_buffer. This has
+ effectively forked XTL. However I expect José will include my code
+ into the next major release. Also fixed a memory leak.
+ * src/xtl/text.h: ditto.
+ * src/xtl/xdr.h: ditto.
+ * src/xtl/giop.h: ditto.
+
+2000-04-16 Allan Rae <rae@lyx.org>
+
+ * acinclude.m4, sigc++/acinclude.m4: Removed -- they're generated
+ by autogen.sh and removed by maintainer-clean anyway.
+ * .cvsignore, sigc++/.cvsignore: Support the above.
+
+ * sigc++/.cvsignore: Forgot that retbind.h was generated.
+
+ * src/buffer.C (Dispatch): Couldn't print a single page. Fixed.
+
+ * src/frontends/xforms/FormPrint.[Ch]: Switched to C callbacks using
+ macros, renamed static callback-target member functions to suit new
+ scheme and made them public.
+ * src/frontends/xforms/forms/form_print.fd: ditto.
+ * src/frontends/xforms/forms/form_copyright.fd: ditto.
+
+ * src/support/lxtl.h: small cleanup to use typedef instead of #define
+ for gui_format.
+
+ * src/xtl/: New directory containing a minimal distribution of XTL.
+ This is XTL-1.3.pl.4.
+
+ * development/tools/lxtl.sh: A script to generate the above mini-dist.
+
+2000-04-15 Allan Rae <rae@lyx.org>
+
+ * development/tools/makeLyXsigc.sh: Remove the library version numbers
+
+ * sigc++/: Updated to libsigc++-1.0.0
+
+2000-04-14 Allan Rae <rae@lyx.org>
+
+ * src/frontends/xforms/xform_macros.h: Remove specific macros and just
+ use the generic ones in future. I'll modify my conversion script.
+
+ * src/frontends/xforms/FormCopyright.C: Reverse the earlier change.
+
+ * src/lyx_gui_misc.[Ch]: Removed references to form_print.
+ (CloseAllBufferRelatedDialogs): Renamed.
+ (updateAllVisibleBufferRelatedDialogs): ditto. Added LaTeXLog
+
+ * src/frontends/xforms/FormCopyright.C: Use the specific macros instead
+ of the generic ones. These are the same ones my conversion script
+ generates.
+
+ * src/PrinterParams.h: Allow you to print a range of odd or even pages.
+ * src/frontends/xforms/FormPrint.C (apply, update): ditto+small cleanup
+ * src/buffer.C (Dispatch): ditto
+
+ * src/LyXView.C (LyXView): Use new signals instead of old hard coded
+ functions for updating and hiding buffer dependent dialogs.
+ * src/BufferView.C (buffer): ditto
+ * src/buffer.C (setReadonly): ditto
+ * src/lyxfunc.C (CloseBuffer): ditto
+
+ * src/buffer.h: Take setReadonly() out of line so I don't have to include
+ Dialogs.h, and hence all the SigC stuff, into every file that includes
+ buffer.h. We also don't need to include lyx_gui_misc.h in everything.
+
+ * src/BufferView2.C: reduce the number of headers included by buffer.h
+
+2000-04-11 Allan Rae <rae@lyx.org>
+
+ * src/frontends/xforms/xform_macros.h: A small collection of macros
+ for building C callbacks.
+
+ * src/frontends/xforms/Makefile.am: Added above file.
+
+ * src/frontends/xforms/FormCopyright.[Ch]: Revised the C callback
+ scheme again. This time it should work for JMarc. If this is
+ successful I'll revise my conversion script to automate some of this.
+ The static member functions in the class also have to be public for
+ this scheme will work. If the scheme works (it's almost identical to
+ the way BufferView::cursorToggleCB is handled so it should work) then
+ FormCopyright and FormPrint will be ready for inclusion into the main
+ trunk immediately after 1.1.5 is released -- provided we're prepared
+ for complaints about lame compilers not handling XTL.
+
+ * src/support/lxtl.h: Switched to XDR_format instead of raw_format.
+
+2000-04-07 Allan Rae <rae@lyx.org>
+
+ * config/lyxinclude.m4: A bit more tidying up (Angus)
+
+ * src/LString.h: JMarc's <string> header fix
+
+ * src/PrinterParams.h: Used string for most data to remove some
+ ugly code in the Print dialog and avoid even uglier code when
+ appending the ints to a string for output.
+
+ * src/buffer.C (Dispatch): Added a couple of braces to fix an error
+ and moved "default:" back to the end of switch statement. Cleaned
+ up the printing so it uses the right function calls and so the
+ "print to file" option actually puts the file in the right directory.
+
+ * src/frontends/xforms/Dialogs.C: Added FormPrint (Angus).
+
+ * src/frontends/xforms/FormPrint.C (PrintInputCB): moved input checking
+ and Ok+Apply button control into a separate method: input (Angus).
+ (input) Cleaned it up and improved it to be very thorough now.
+ (All CB) static_cast used instead of C style cast (Angus). This will
+ probably change again once we've worked out how to keep gcc-2.8.1 happy
+ with real C callbacks.
+ (update) add a few "default:" labels to switches. Egcs-1.1.2 seems to
+ ignore some of the bool settings and has random numbers instead. Needs
+ some more investigation. Added other input length checks and checking
+ of file and printer names.
+
+ * src/frontends/xforms/FormPrint.h: Removed pragma statement so it
+ would link (Angus). Seems the old code doesn't compile with the pragma
+ statement either. Separated callback entries from internal methods.
+
+ * src/lyxfunc.C (Dispatch): LFUN_MENUPRINT calls new dialog (Angus).
+
+2000-03-17 Allan Rae <rae@lyx.org>
+
+ * src/lyxfunc.[Ch] (isAvailable): This is only temporary. Do we really
+ need it? Maybe it could go in Dialogs instead? I could make it a
+ LFUN but you'd have to call Dispatch(int, int, char*) with dummy
+ values to get the bool return value.
+ (Dispatch): New overloaded method for xtl support.
+
+ * src/frontends/xforms/FormCopyright.[Ch]: Modified to use a friendly
+ extern "C" callback instead of static member functions. Hopefully,
+ JMarc will be able to compile this. I haven't changed
+ forms/form_copyright.fd yet. Breaking one of my own rules already.
+
+ * src/commandtags.h: New xtl-based LFUN's no description in LyXAction
+ because they aren't useful from the minibuffer. Maybe a LyXServer
+ might want a help message though?
+
+ * src/buffer.[Ch] (Dispatch): New overloaded method for xtl support.
+
+ * config/lyxinclude.m4: Changes to g++ flags to suit compiling with
+ xtl which needs both rtti and exceptions.
+
+ * src/support/Makefile.am:
+ * src/support/lxtl.h: New file. Some helper macros for using XTL.
+
+ * src/frontends/xforms/input_validators.[ch]: input filters and
+ validators. These conrol what keys are valid in input boxes.
+ Use them and write some more. Much better idea than waiting till
+ after the user has pressed Ok to say that the input fields don't make
+ sense.
+
+ * src/frontends/xforms/Makefile.am:
+ * src/frontends/xforms/forms/form_print.fd:
+ * src/frontends/xforms/forms/makefile:
+ * src/frontends/xforms/FormPrint.[Ch]: Ported previous print form to
+ new scheme. Still have to make sure I haven't missed anything from
+ the current implementation.
+
+ * src/Makefile.am, src/PrinterParams.h: New data store.
+
+ * other files: Added a couple of copyright notices.
+
+2000-03-06 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
+
+ * src/insets/insetbib.h: move Holder struct in public space.
+
+ * src/frontends/include/DialogBase.h: use SigC:: only when
+ SIGC_CXX_NAMESPACES is defined.
+ * src/frontends/include/Dialogs.h: ditto.
+
+ * sigc++/Makefile.am (%.h): use the autodected GNU m4.
+
+ * src/frontends/xforms/FormCopyright.[Ch]: do not
+ mention SigC:: explicitely.
+
+2000-03-03 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
+
+ * config/lyxinclude.m4 (LYX_USE_FRONTEND): move the code which
+ deals with testing KDE in main configure.in
+ * configure.in: ditto.
+
+2000-02-22 Allan Rae <rae@lyx.org>
+
+ * Lots of files: Merged from HEAD
+
+ * All Makefile.am (ETAGS_ARGS): use parameter that is also compatible
+ with the etags shipped with SuSE-6.3 (fancier than gnu-etags).
+
+ * autogen.sh: Fix JMarcs complaints by building a sigc++/acinclude.m4
+
+ * sigc++/: new minidist.
+
+2000-02-14 Allan Rae <rae@lyx.org>
+
+ * development/tools/makeLyXsigc.sh: Small fix for Makefile.am
+
+2000-02-08 Juergen Vigna <jug@sad.it>
+
+ * src/frontends/kde/dlg/formcopyrightdialog.kdevdlg: the dialog data
+ file for the buildin GUI builder of KDevelop of the copyright-dialog.
+
+ * src/frontends/kde/lyxgui.kdevprj: I added this as I use KDevelop
+ for this port and so it is much easier for other people to port
+ dialogs in a common development environment.
+
+ * src/frontends/kde/formcopyrightdialog_moc.C: needed MOC file for
+ the QT/KDE implementation.
+
+ * src/frontends/kde/Dialogs.C:
+ * src/frontends/kde/FormCopyright.C:
+ * src/frontends/kde/FormCopyright.h:
+ * src/frontends/kde/Makefile.am:
+ * src/frontends/kde/formcopyrightdialog.C:
+ * src/frontends/kde/formcopyrightdialog.h:
+ * src/frontends/kde/formcopyrightdialogdata.C: added this source-files
+ for the kde support of the Copyright-Dialog.
+
+ * src/frontends/Makefile.am (AUTOMAKE_OPTIONS): now uses @FRONTEND@
+ subdir-substitution instead of hardcoded 'xforms' as we now have also
+ the kde subdir.
+
+ * src/frontends/include/DialogBase.h (Object): just commented the
+ label after #endif (nasty warning and I don't like warnings ;)
+
+ * src/main.C (main): added KApplication initialization if using
+ KDE frontend-GUI.
+
+ * src/lyx_gui.C (runTime): added support for multiple toolkit support.
+ For now only the KDE event-loop is added if frontend==kde.
+
+ * src/Makefile.am (lyx_DEPENDENCIES): added @FRONTEND_xxx@ support
+
+ * configure.in: added support for the --with-frontend[=value] option
+
+ * autogen.sh: added kde.m4 file to list of config-files
+
+ * acconfig.h: added define for KDEGUI-support
+
+ * config/kde.m4: added configuration functions for KDE-port
+
+ * config/lyxinclude.m4: added --with-frontend[=value] option with
+ support for xforms and KDE.
+
+2000-02-08 Allan Rae <rae@lyx.org>
+
+ * all Makefile.am: Fixed up so the make targets dist, distclean,
+ install and uninstall all work even if builddir != srcdir. Still
+ have a new sigc++ minidist update to come.
+
+ * config/lyxinclude.m4: Some more builddir!=srcdir fixes.
+
+2000-02-01 Allan Rae <rae@lyx.org>
+
+ * config/lyxinclude.m4, development/tools/makeLyXsigc.sh:
+ Many mods to get builddir != srcdir working.
+
+ * sigc++/: Upgraded to 0.8.7. This includes many needed fixes both
+ for building on NT and so we can do the builddir != srcdir stuff.
+
+2000-01-30 Allan Rae <rae@lyx.org>
+
+ * sigc++/doc/*: Selected documentation for the libsigc++ mini dist.
+ This will stay in "rae" branch. We probably don't really need it in
+ the main trunk as anyone who wants to help programming it should get
+ a full library installed also. So they can check both included and
+ system supplied library compilation.
+
+ * sigc++/*, sigc++/macros/*, config/sigc++.m4, config/lyxinclude.m4:
+ Added a 'mini' distribution of libsigc++. If you feel the urge to
+ change something in these directories - Resist it. If you can't
+ resist the urge then you should modify the following script and rebuild
+ the dist. LYX_WITH_SIGC in lyxinclude.m4 is the wrapper to make it
+ all happen. Still uses a hacked version of libsigc++'s configure.in.
+ I'm quite happy with the results. I'm not sure the extra work to turn
+ the sigc++/configure.in into a few extra AC_DEFUNs in sigc++.m4 is
+ worth the trouble and would probably lead to extra maintenance
+ headaches.
+ I haven't tested the following important make targets: install, dist.
+ Not ready for prime time but very close. Maybe 1.1.5.
+
+ * development/tools/makeLyXsigc.sh: A shell script to automatically
+ generate our mini-dist of libsigc++. It can only be used with a CVS
+ checkout of libsigc++ not a tarball distribution. It's well commented.
+ This will end up as part of the libsigc++ distribution so other apps
+ can easily have an included mini-dist. If someone makes mods to the
+ sigc++ subpackage without modifying this script to generate those
+ changes I'll be very upset!
+
+ * src/frontends/: Started the gui/system indep structure.
+
+ * src/frontends/include/Dialogs.h: Dialog container. All the Signal<>s
+ to access the gui-indep dialogs are in this class. Much improved
+ design compared to previous revision. Lars, please refrain from
+ moving this header into src/ like you did with Popups.h last time.
+
+ * src/frontends/include/DialogBase.h: Abstract base class for dialogs.
+
+ * src/frontends/xforms/: Started the gui-indep system with a single
+ dialog: FormCopyright. Initial testing of use of libsigc++ was very
+ successful.
+
+ * src/frontends/xforms/forms: Repository for the xforms .fd files.
+ Here you'll find a very useful makefile and automated fdfix.sh that
+ makes updating dailogs a no-brainer -- provided you follow the rules
+ set out in the README. I'm thinking about adding another script to
+ automatically generate skeleton code for a new dialog given just the
+ name of the dialog.
+
+ * src/commandtags.h, src/lyxfunc.C, src/menus.C:
+ * src/credits.{Ch}, src/credits_form.{Ch}, forms/credits_form.fd:
+ Made FormCopyright gui-indep and added a lyxfunc to get to it.
+
2000-06-09 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/LSubstring.C (operator): simplify
AUTOMAKE_OPTIONS = foreign
DISTCLEANFILES= *.orig *.rej *~ *.bak lyx.1 core
-MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure \
- development/lyx.spec
-SUBDIRS = intl po src lib
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in $(srcdir)/aclocal.m4 \
+ $(srcdir)/configure $(srcdir)/development/lyx.spec \
+ $(srcdir)/acinclude.m4
+SUBDIRS = intl po sigc++ src lib
EXTRA_DIST = ANNOUNCE OLD-CHANGES INSTALL.OS2 INSTALL.autoconf README.OS2 \
UPGRADING lyx.man acconfig.h \
config development forms images
-ETAGS_ARGS = --c++
+ETAGS_ARGS = --lang=c++
man_MANS = lyx.1
lyx.1:
cp -p $(srcdir)/lyx.man lyx.1
e.g. <xpm.h> */
#undef XPM_H_LOCATION
+/* here are the defines for what Toolkit to use (default is XForms) */
+#undef KDEGUI
+
@BOTTOM@
/************************************************************
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 <sigc++/signal_system.h> 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
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],
+ [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 <gord@gnu.ai.mit.edu>, 1996
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 <stdio.h>
+#include <sigc++/signal_system.h>
+
+#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<int,int> 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 <<EOF
+#include <stdio.h>
+#include "confdefs.h"
+#include <kapp.h>
+
+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 <coolo@kde.org>.])
+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 <<EOF
+#include "confdefs.h"
+#include <qmovie.h>
+#include <qapplication.h>
+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 <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
+dnl which includes <sys/select.h> which contains a prototype for
+dnl select. Similarly for bzero.
+[#include <assert.h>
+]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 <stdlib.h>
+], [
+/* 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 <stdlib.h>
+#include <unistd.h>
+],
+[
+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 <stdlib.h>
+#include <unistd.h>
+],
+[
+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 <stdlib.h>
+#include <unistd.h>
+],
+[
+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<zlib.h>
+],
+ [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<tiffio.h>
+],
+ [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.h>
+ ],
+ [
+ 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 <features.h>
+
+#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 <assert.h>
+ Syntax Error], ,
+ CPP="${CC-cc} -E -traditional-cpp"
+ AC_TRY_CPP([#include <assert.h>
+ 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 <drepper@cygnus.com>, 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 <drepper@cygnus.com>, 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 <X11/xpm.h>],[],
+ 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 <<EOF
+#include <stdio.h>
+#include <mico/version.h>
+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 <mico/config.h>
+],
+[
+#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 <Python.h>
+],[
+ 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>
+],[
+ 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>
+],[
+ 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 <string.h>
+],[
+ 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
+
+])
# Generate acinclude.m4
echo -n "Generate acinclude.m4... "
-rm -rf acinclude.m4
+rm -f acinclude.m4 sigc++/acinclude.m4
touch acinclude.m4
-for fil in config/lyxinclude.m4 config/libtool.m4 config/gettext.m4 config/lcmessage.m4 config/progtest.m4 ; do
+for fil in config/lyxinclude.m4 config/libtool.m4 config/gettext.m4 config/lcmessage.m4 config/progtest.m4 config/sigc++.m4 config/kde.m4; do
cat $fil >> acinclude.m4
done
+touch sigc++/acinclude.m4
+for fil in config/libtool.m4 ; do
+ cat $fil >> sigc++/acinclude.m4
+done
echo "done."
# Generate the Makefiles and configure files
if ( aclocal --version ) </dev/null > /dev/null 2>&1; then
echo -n "Building macros... "
- $ACLOCAL ; (cd lib/reLyX; $ACLOCAL )
+ $ACLOCAL ; ( cd lib/reLyX; $ACLOCAL ) ; ( cd sigc++; $ACLOCAL )
echo "done."
else
echo "aclocal not found -- aborting"
if ( autoheader --version ) </dev/null > /dev/null 2>&1; then
echo -n "Building config header template... "
- $AUTOHEADER
+ $AUTOHEADER ; ( cd sigc++; $AUTOHEADER )
echo "done."
else
echo "autoheader not found -- aborting"
if ( $AUTOMAKE --version ) </dev/null > /dev/null 2>&1; then
echo -n "Building Makefile templates... "
- $AUTOMAKE ; (cd lib/reLyX ; $AUTOMAKE )
+ $AUTOMAKE ; ( cd lib/reLyX ; $AUTOMAKE ) ; ( cd sigc++; $AUTOMAKE )
echo "done."
else
echo "automake not found -- aborting"
if ( $AUTOCONF --version ) </dev/null > /dev/null 2>&1; then
echo -n "Building configure... "
- $AUTOCONF ; ( cd lib/reLyX ; $AUTOCONF )
+ $AUTOCONF ; ( cd lib/reLyX ; $AUTOCONF ) ; ( cd sigc++; $AUTOCONF )
echo "done."
else
echo "autoconf not found -- aborting"
--- /dev/null
+# 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 <<EOF
+#include <stdio.h>
+#include "confdefs.h"
+#include <kapp.h>
+
+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 <coolo@kde.org>.])
+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 <<EOF
+#include "confdefs.h"
+#include <qmovie.h>
+#include <qapplication.h>
+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 <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
+dnl which includes <sys/select.h> which contains a prototype for
+dnl select. Similarly for bzero.
+[#include <assert.h>
+]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 <stdlib.h>
+], [
+/* 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 <stdlib.h>
+#include <unistd.h>
+],
+[
+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 <stdlib.h>
+#include <unistd.h>
+],
+[
+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 <stdlib.h>
+#include <unistd.h>
+],
+[
+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<zlib.h>
+],
+ [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<tiffio.h>
+],
+ [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.h>
+ ],
+ [
+ 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 <features.h>
+
+#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 <assert.h>
+ Syntax Error], ,
+ CPP="${CC-cc} -E -traditional-cpp"
+ AC_TRY_CPP([#include <assert.h>
+ 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 <drepper@cygnus.com>, 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 <drepper@cygnus.com>, 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 <X11/xpm.h>],[],
+ 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 <<EOF
+#include <stdio.h>
+#include <mico/version.h>
+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 <mico/config.h>
+],
+[
+#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 <Python.h>
+],[
+ 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>
+],[
+ 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>
+],[
+ 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 <string.h>
+],[
+ 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
+
+])
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 <sigc++/signal_system.h> 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
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],
+ [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)
+])
--- /dev/null
+# 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 <stdio.h>
+#include <sigc++/signal_system.h>
+
+#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<int,int> 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)
+])
+
AC_CHECK_LIB(iberty,main)
fi
+### Check which libsigc++ we're using
+LYX_WITH_SIGC
+
+### check which frontend we want to use
+LYX_USE_FRONTEND
+dnl The code below is not in a macro, because this would cause big
+dnl problems with the AC_REQUIRE contained in KDE_DO_IT_ALL.
+case "$lyx_use_frontend" in
+ kde)
+ KDE_DO_IT_ALL
+ FRONTEND="kde"
+ FRONTEND_GUILIB="\${top_builddir}/src/frontends/kde/libkde.la"
+ FRONTEND_LDFLAGS="\$(QT_LDFLAGS) \$(KDE_LDFLAGS)"
+ FRONTEND_INCLUDES="\$(QT_INCLUDES) \$(KDE_INCLUDES)"
+ FRONTEND_LIBS="\$(KDE_LIBS)"
+ AC_DEFINE(KDEGUI);;
+ xforms)
+ FRONTEND="xforms"
+ FRONTEND_GUILIB="\${top_builddir}/src/frontends/xforms/libxforms.la";;
+ *)
+ LYX_ERROR(Unknown frontend $lyx_use_frontend);;
+esac
+
### Check for X libraries
# Check for the pt library (for SCO, needed for X)
AC_CHECK_LIB(pt,ptsname,X_EXTRA_LIBS="-lpt $X_EXTRA_LIBS")
fi
### Finish the work.
-AC_CONFIG_SUBDIRS(lib lib/reLyX)
+AC_CONFIG_SUBDIRS(lib lib/reLyX sigc++)
AC_OUTPUT([Makefile \
development/lyx.spec \
lib/Makefile \
src/mathed/Makefile \
src/insets/Makefile \
src/support/Makefile \
+ src/frontends/Makefile \
+ src/frontends/xforms/Makefile \
+ src/frontends/kde/Makefile \
], [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
# Display a final warning if there has been a LYX_ERROR
LYX_CHECK_ERRORS
-
--- /dev/null
+#!/bin/sh
+## Author: Allan Rae <rae@lyx.org>
+## With bug fixes and improvements by Karl Nelson.
+##
+## Severely hacked version of the libsigc++/win32/makevc.sh script
+## Builds the 'mini' libsigc++ distribution for use with LyX.
+## Hopefully the generated distribution is generic enough for use by
+## other apps also.
+##
+if test ! -f .cvsignore ; then
+ ## could also test for acconfig.h since we need that too.
+ echo "Must be run in a CVS controlled source directory"
+ echo "You can't build the lyx-sigc distribution from a tarball"
+ ## This just makes my life considerably easier.
+ exit 1
+fi
+
+if test ! -f config.status ; then
+ echo "Must be run in configured source directory"
+ exit 1
+fi
+
+version=`grep SIGC_VERSION config.status | awk -F% '{print $3}'`
+package="libsigc++-$version"
+tarfile="$package.tar.gz"
+configure="$package/configure.in"
+
+if test ! -f $tarfile ; then
+ echo "Must have dist file $tarfile"
+ echo "Try: make dist"
+ exit 1
+fi
+
+echo "Unpack distribution."
+if test -d $package; then
+rm -R $package
+fi
+tar xzf $tarfile --exclude CVS
+
+
+
+echo "Removing irrelevent or regeneratable files."
+find $package -name "Makefile.in" | xargs rm
+find $package -name "*.Makefile" | xargs rm
+( cd $package;
+ cp ../acconfig.h sigc++;
+ mv [ACFT]* doc;
+ rm -f doc/riscos doc/ChangeLog;
+ mv ltdll.c sigc-config.in doc sigc++;
+ rm -Rf lyx win32 scripts tests riscos djgpp borland examples;
+ rm -Rf aclocal.m4 libsigc++.spec*;
+ cd sigc++/ ;
+ find macros -name "*.h.m4" | sed -e 's,macros/\(.*\)\.m4,\1,' | xargs rm;
+ rm -rf README scripts/README generator.h config )
+
+
+echo "Make autogen.sh for testing"
+( cd $package/sigc++;
+ cat > autogen.sh << EOF
+#!/bin/sh
+#
+# You shouldn't need to use this script in your application unless it doesn't
+# have its own equivalent.
+#
+libtoolize --automake
+aclocal $ACLOCAL_FLAG
+autoheader
+automake --add-missing --foreign
+autoconf
+EOF
+ chmod a+x autogen.sh
+)
+
+
+echo "Limiting to Signal2"
+# we only need up to Signal2
+# NOTE: sigc++ needs 2 slots higher than the number of signals (see bind.h)
+# Anyone feeling keen?
+# How would you like to make this a parameter-controlled stripping of
+# the headers instead?
+#
+for i in `ls $package/sigc++/macros/*.h.m4`; do
+ case $i in
+ $package/sigc++/macros/slot.h.m4)
+ sed < $i > $i.tmp \
+ -e '/.*ARGS(P,[56789]).*/d'
+ ;;
+ *)
+ sed < $i > $i.tmp \
+ -e '/.*ARGS(P,[3456789]).*/d'
+ ;;
+ esac
+ rm -f $i
+ mv $i.tmp $i
+done
+
+
+echo "Changing <sigc++config.h> to <sigc++/sigc++config.h>"
+#
+# This change means that if the compiler can find <sigc++/slot.h> it can also
+# find the sigc++config.h header which is internal to the library.
+#
+for i in `ls $package/sigc++/macros/*.h.m4 $package/sigc++/*.h`; do
+ sed < $i > $i.tmp \
+ -e 's%\(\(sigc++\)config.h\)%\2/\1%'
+ rm -f $i
+ mv $i.tmp $i
+done
+
+
+echo "Building application level config/"
+mkdir $package/config
+mv $package/sigc++.m4 $package/config
+
+
+echo "Creating custom sigc++/configure.in"
+## My sed doesn't seem to want to match newlines in scripts. As a result
+## the first two scripts haven't been merged into one.
+## These separate scripts are ordered approximately in the order in which
+## they match in the unmodified configure.in.
+##
+## Note that you have to be very careful about quoting. Look at the second
+## script for example: '\'', \\\ and \$
+##
+## Now for some explanation of what each script is supposed to change:
+##
+# -e 's/\(Nelson\)/\1\
+### Modified by makeLyXsigc.sh (Allan Rae)/'
+#
+# Credit where credit is due.
+#
+# -e 's%\(AC_INIT\)(sigc++)%\1(slot.cc)\
+#\
+#AC_DEFUN(LYX_FIX_MAKEFILE_IN,[\
+### modify Makefile.in if need be -- since we still use automake\
+#for dir in \$srcdir \$srcdir/macros ; do\
+#( cd \$dir ;\
+# sed < Makefile.in > Makefile_tmp \\\
+# -e '\''s/all\: all-redirect/all: all-@USE_INCLUDED_SIGC@\\\
+#all-yes: all-redirect\\\
+#all-no:/'\'' ;\
+# mv Makefile_tmp Makefile.in )\
+#done\
+#])\
+#\
+#LYX_FIX_MAKEFILE_IN%'
+#
+# Change which file autoconf demands to be in the current directory.
+# Add a way to not make anything in the sigc++ package when using an
+# externally supplied library.
+#
+# -e 's%\(AUX_DIR(\)scripts%\1../config%'
+#
+# Use the applications auxilliary directory. Assumed to be ../config.
+#
+# -e 's%config/\(sigc++config\.h\)%\1%'
+#
+# Move sigc++config.h out of the now removed config/.
+#
+# -e '/.*\.spec.*/d' \
+# -e '\%.*sigc++/Makefile.*%d' \
+# -e '\%.*config/Makefile.*%d'
+#
+# Remove unnecessary files from the AC_OUTPUT list.
+#
+# -e 's,sigc++/,,g'
+#
+# No subdir sigc++. This also results in sigc++/macros -> macros.
+#
+# -e '\%.*tests/.*%d' \
+# -e '\%.*examples/.*%d' \
+# -e '\%.*scripts/.*%d'
+#
+# These directories have been completely removed and aren't relevent.
+#
+# -e 's/.*\(AM_DISABLE_\)STATIC/\1SHARED/' \
+#
+# We want to default to static libs. Although we still need to ensure that
+# configure is forced to only produce static libs.
+#
+# -e 's/AM_MAINTAINER_MODE/AC_ARG_WITH([included-libsigc],\
+# [ --without-included-libsigc\
+# Use the libsigc++ installed on the system\
+# Used when libsigc++ is bundled with applications],\
+# [sigc_use_included_libsigc=$withval],\
+# [sigc_use_included_libsigc=yes])\
+#if test x$sigc_use_included_libsigc = xno; then\
+# ## just change the setting for the Makefile\
+# USE_INCLUDED_SIGC=no\
+# AC_SUBST(USE_INCLUDED_SIGC)\
+#else\
+####\
+#### This else..fi goes till the end of the file!\
+####\
+# USE_INCLUDED_SIGC=yes\
+# AC_SUBST(USE_INCLUDED_SIGC)/'
+#
+# Kill two birds with the one stone. We want maintainer access as standard
+# and we want to be able to choose between using this package or the full
+# library installed on the local system. If using the latter option we don't
+# have to run most of the configure script so we hide it in a conditional.
+#
+# -e 's/\(AC_OUTPUT.*\)/\
+####\
+#### This is the end of the massive if..then..else..fi\
+####\
+#fi\
+#\
+#\1/'
+#
+# Close the conditional introduced in the previous script.
+#
+( cd $package;
+ sed < configure.in > sigc++/configure.in \
+ -e 's/\(Nelson\)/\1\
+## Modified by makeLyXsigc.sh (Allan Rae)/' \
+ -e 's%\(AC_INIT\)(sigc++)%\1(slot.cc)\
+\
+AC_DEFUN(LYX_FIX_MAKEFILE_IN,[\
+## modify Makefile.in if need be -- since we still use automake\
+for dir in \$srcdir \$srcdir/macros ; do\
+( cd \$dir ;\
+ sed < Makefile.in > Makefile_tmp \\\
+ -e '\''s/all\: all-redirect/all: all-@USE_INCLUDED_SIGC@\\\
+all-yes: all-redirect\\\
+all-no:/'\'' ;\
+ mv Makefile_tmp Makefile.in )\
+done\
+])\
+\
+LYX_FIX_MAKEFILE_IN%' \
+ -e 's%\(AUX_DIR(\)scripts%\1../config%' \
+ -e 's%config/\(sigc++config\.h\)%\1%' \
+ -e '/.*\.spec.*/d' \
+ -e '\%.*sigc++/Makefile.*%d' \
+ -e '\%.*config/Makefile.*%d' \
+ -e 's,sigc++/,,g' \
+ -e '\%.*tests/.*%d' \
+ -e '\%.*examples/.*%d' \
+ -e '\%.*scripts/.*%d' \
+ -e 's/.*\(AM_DISABLE_\)STATIC/\1SHARED/' \
+ -e 's/AM_MAINTAINER_MODE/AC_ARG_WITH([included-libsigc],\
+ [ --without-included-libsigc\
+ Use the libsigc++ installed on the system\
+ Used when libsigc++ is bundled with applications],\
+ [sigc_use_included_libsigc=$withval],\
+ [sigc_use_included_libsigc=yes])\
+if test x$sigc_use_included_libsigc = xno; then\
+ ## just change the setting for the Makefile\
+ USE_INCLUDED_SIGC=no\
+ AC_SUBST(USE_INCLUDED_SIGC)\
+else\
+###\
+### This else..fi goes till the end of the file!\
+###\
+ USE_INCLUDED_SIGC=yes\
+ AC_SUBST(USE_INCLUDED_SIGC)/' \
+ -e 's/\(AC_OUTPUT.*\)/\
+###\
+### This is the end of the massive if..then..else..fi\
+###\
+fi\
+\
+\1/' )
+
+echo "Modifying sigc++/Makefile.am"
+#
+# -e 's%\(SUBDIRS =\)\(.*\)config\(.*\)%\1\2\3\
+#DISTCLEANFILES= *.orig *.rej *~ *.bak core \
+#MAINTAINERCLEANFILES= \$(srcdir)/Makefile.in \$(srcdir)/configure \$(srcdir)/sigc++config* \$(srcdir)/stamp* \$(srcdir)/aclocal.m4 \$(srcdir)/acinclude.m4 \
+#ETAGS_ARGS = --lang=c++%'
+#
+# We've removed the sigc++/config/ above now we just make sure automake knows.
+# We also want maintainer-clean to actually remove stuff. Same for distclean.
+#
+# -e '/^INCLUDES/{s%\(dir)\)%\1/..%;}'
+#
+# All the headers are included with <sigc++/xxx.h> so we need an adjustment.
+#
+# -e '/^M4_DIR/{s/sigc++\///;}'
+#
+# In the mini-dist the macros are directly under the top_srcdir which in this
+# case is sigc++/.
+#
+# -e '/^libsigc.*dir/d'
+#
+# Not installing the headers or the library.
+#
+# -e 's/^libsigcinclude/noinst/'
+#
+# Don't install the headers.
+#
+# -e 's/generator.h//'
+#
+# We don't need generator.h.
+#
+# -e 's/lib_//' \
+# -e 's/\(LTLIB\)/noinst_\1/'
+#
+# These two lines make sure we don't install the library.
+#
+# -e '/EXTRA_DIST.*/d';
+#
+# We don't want the extra bits that libsigc++ does.
+#
+( cd $package/sigc++;
+ sed < Makefile.am > Makefile.tmp \
+ -e 's%\(SUBDIRS =\)\(.*\)config\(.*\)%\1\2\3\
+DISTCLEANFILES= *.orig *.rej *~ *.bak core \
+MAINTAINERCLEANFILES= \$(srcdir)/Makefile.in \$(srcdir)/configure \$(srcdir)/sigc++config* \$(srcdir)/stamp* \$(srcdir)/aclocal.m4 \$(srcdir)/acinclude.m4 \
+ETAGS_ARGS = --lang=c++%' \
+ -e '/^INCLUDES/{s%\(dir)\)%\1/..%g;}' \
+ -e '/^M4_DIR/{s/sigc++\///;}' \
+ -e '/^libsigc.*dir/d' \
+ -e 's/^libsigcinclude/noinst/' \
+ -e 's/generator.h//' \
+ -e 's/lib_//' \
+ -e 's/\(LTLIB\)/noinst_\1/' \
+ -e '/EXTRA_DIST.*/d' \
+ -e 's/-version-info.*ION)//' \
+ -e 's/-release.*EASE)//';
+ rm -f Makefile.am ;
+ mv Makefile.tmp Makefile.am )
+
+
+echo "Modifying sigc++/macros/Makefile.am"
+#
+# -e '/^m4includedir/d' \
+# -e 's/^m4include/noinst/'
+#
+# We're not installing any of this.
+#
+# -e '$a\
+#MAINTAINERCLEANFILES=\$(srcdir)/Makefile.in'
+#
+# Clean up.
+#
+( cd $package/sigc++/macros;
+ sed < Makefile.am > Makefile.tmp \
+ -e '/^m4includedir/d' \
+ -e 's/^m4include/noinst/' \
+ -e '$a\
+MAINTAINERCLEANFILES=\$(srcdir)/Makefile.in' ;
+ rm -f Makefile.am ;
+ mv Makefile.tmp Makefile.am )
+
+
+echo "Adding various .cvsignore"
+( cd $package/sigc++;
+ cp ../../sigc++/.cvsignore . ;
+ cp ../../sigc++/macros/.cvsignore macros;
+ cp ../../doc/.cvsignore doc;
+ cat >> .cvsignore <<EOF
+aclocal.m4
+config.log
+config.status
+configure
+libtool
+sigc-config
+stamp*
+sigc++config.h
+sigc++config.h.in
+EOF
+)
+
+
+echo "Adding sigc++/DO_NOT_MODIFY_THESE_FILES"
+( cd $package/sigc++;
+ cat > DO_NOT_MODIFY_THESE_FILES <<EOF
+These files are all collected together from a checked out copy of the
+libsigc++ CVS repository by the ../development/tools/makeLyXsigc.sh file.
+Some of these files are modified by that script. If you need to fix a bug in
+the code then you should try to get the latest CVS libsigc++ and regenerate
+this entire subpackage. If the problem still persists it may be necessary to
+modify the generation script.
+
+If an error is found while porting to a new platform read the doc/requirements
+file.
+
+Remember to contact the LyX developers list if you are having problems.
+Allan. (ARRae)
+EOF
+)
+
+
+echo "Packing files."
+( cd $package ;
+ chmod -R a+r sigc++ config ;
+ GZIP=--best tar chozf lyx-sigc++-$version.tar.gz sigc++ config )
+mv $package/lyx*gz .
+#rm -Rf $package
+
+chmod a+r lyx-sigc++-$version.tar.gz
---- bullet_forms.c Wed Sep 24 22:03:42 1997
-+++ bullet_forms.c.patched Wed Sep 24 22:05:31 1997
-@@ -3,6 +3,10 @@
+--- bullet_forms.c.orig Fri Jun 9 17:38:18 2000
++++ bullet_forms.c Fri Jun 9 17:39:31 2000
+@@ -3,6 +3,8 @@
#include "forms.h"
#include <stdlib.h>
#include "bullet_forms.h"
+#include "bmtable.h"
-+#include "filetools.h"
-+
-+extern int mono_video;
++#include "support/filetools.h"
FD_form_bullet *create_form_form_bullet(void)
{
-@@ -10,10 +14,28 @@
+@@ -10,10 +12,21 @@
FD_form_bullet *fdui = (FD_form_bullet *) fl_calloc(1, sizeof(*fdui));
fdui->form_bullet = fl_bgn_form(FL_NO_BOX, 370, 390);
+ fl_set_object_callback(obj, BulletBMTableCB, 0);
+ fl_set_object_lcol(obj, FL_BLUE);
+ fl_set_object_boxtype(obj, FL_UP_BOX);
-+ if (mono_video) {
-+ fl_set_bmtable_file(obj, 6, 6,
-+ LibFileSearch("images",
-+ "standard.xbm").c_str());
-+ }
-+ else {
-+ fl_set_bmtable_pixmap_file(obj, 6, 6,
-+ LibFileSearch("images",
-+ "standard.xpm").c_str());
-+ }
++ fl_set_bmtable_pixmap_file(obj, 6, 6,
++ LibFileSearch("images",
++ "standard.xpm").c_str());
+
+ fl_set_border_width(-1);
obj = fl_add_frame(FL_ENGRAVED_FRAME,95,20,255,70,"");
obj = fl_add_frame(FL_ENGRAVED_FRAME,0,340,370,50,"");
fdui->choice_bullet_size = obj = fl_add_choice(FL_NORMAL_CHOICE,15,45,65,30,"Size|#z");
-@@ -38,5 +60,7 @@
+@@ -33,6 +46,8 @@
+ fdui->input_bullet_latex = obj = fl_add_input(FL_NORMAL_INPUT,80,300,275,30,"LaTeX|#L");
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_input_maxchars(obj, 80);
fl_set_object_callback(obj,InputBulletLaTeXCB,0);
fdui->radio_bullet_depth = fl_bgn_group();
Internal Form Definition File
(do not change)
-Number of forms: 2
+Number of forms: 1
Unit of measure: FL_COORD_PIXEL
=============== FORM ===============
callback:
argument:
-=============== FORM ===============
-Name: copyright
-Width: 450
-Height: 430
-Number of Objects: 5
-
---------------------
-class: FL_BOX
-type: UP_BOX
-box: 0 0 450 430
-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_TEXT
-type: NORMAL_TEXT
-box: 10 10 430 50
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-1999 LyX Team
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NorthWest FL_NorthEast
-name:
-callback:
-argument:
-
---------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 10 70 430 110
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: This program is free software; you can redistribute it\nand/or modify it under the terms of the GNU General\nPublic License as published by the Free Software\nFoundation; either version 2 of the License, or\n(at your option) any later version.
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_BUTTON
-type: RETURN_BUTTON
-box: 160 390 140 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_South FL_South
-name:
-callback: CopyrightOKCB
-argument: 0
-
---------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 10 190 430 190
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_CENTER|FL_ALIGN_INSIDE
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: LyX is distributed in the hope that it will\nbe useful, but WITHOUT ANY WARRANTY;\nwithout even the implied warranty of MERCHANTABILITY\nor FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\nYou should have received a copy of\nthe GNU General Public License\nalong with this program; if not, write to\nthe Free Software Foundation, Inc.,\n675 Mass Ave, Cambridge, MA 02139, USA.
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
==============================
create_the_forms
# sizeof(*fdui) before fdui has been given a value and output a warning.
# This will not be needed anymore as soon as fdesign is fixed (already
# reported to its authors).
-
-
+#
+# -e 's/,\([^ ]\)/, \1/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.
+#
+# -e 's/stdlib.h/cstdlib/'
+#
+# Include the right C header. Another one of those changes made by someone
+# who forgot that these files are regenerated.
+#
+# -e '/fl_.*"[^"]*%.*"/i\
+# //xgettext:no-c-format'
+#
+# Something else someone got busy adding only to have them removed by the
+# autogeneration. Maybe someday I won't have to clean up after everyone else
+# and will be able to spend my time working on what I want to work on.
+#
+# -e 's/NULL/0/'
+#
+# Hopefully the last thing that I'll ever have to merge in because in future
+# everyone will do their own merging when they decide they want to modify a
+# generated file.
+#
cat $1 | sed \
-e 's/#include "forms\.h"/#include FORMS_H_LOCATION/' \
-e '/fl_/ s/".[^|]*"/_(&)/' \
-e '/fl_add/ s/idex(\(.*\)").*$/&fl_set_button_shortcut(obj,scex(\1")),1);/' \
-e 's/fl_set_object_lcolor/fl_set_object_lcol/' \
-e 's/fdui->.*->fdui = fdui/\/\/&/' \
--e 's/\(\(FD_[^ ]*\) \*fdui.*\)sizeof(\*fdui)/\1sizeof(\2)/' >> $2
+-e 's/\(\(FD_[^ ]*\) \*fdui.*\)sizeof(\*fdui)/\1sizeof(\2)/' \
+-e 's/,\([^ ]\)/, \1/g' \
+-e 's/\("[^"]*,\) \("\)/\1\2/g' \
+-e '/fl_.*"[^"]*%.*"/i\
+ // xgettext:no-c-format' \
+-e 's/NULL/0/' \
+-e 's/stdlib.h/cstdlib/' >> $2
--------------------
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
--------------------
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
--------------------
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
--------------------
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
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: >|#F
+label: @>|#F^s
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: <|#B
+label: @<|#B^r
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
=============== FORM ===============
Name: form_url
-Width: 530
-Height: 150
+Width: 520
+Height: 140
Number of Objects: 5
--------------------
class: FL_BOX
type: UP_BOX
-box: 0 0 530 150
+box: 0 0 520 140
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 50 20 460 30
+box: 70 20 440 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
+size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Url
+label: URL
shortcut: Url|#U
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NorthEast
--------------------
class: FL_INPUT
type: NORMAL_INPUT
-box: 50 60 460 30
+box: 70 60 440 30
boxtype: FL_DOWN_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT
style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
+size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Name
shortcut: Name|#N
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 50 110 250 30
+box: 70 100 230 30
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
+size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: HTML type
shortcut: HTML type|#H
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
-box: 410 110 100 30
+box: 410 100 100 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
+size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Close
+label: Close|#C^[
shortcut: ^M
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
--------------------
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
--------------------
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
--------------------
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
argument:
--------------------
-class: FL_BOX
-type: FRAME_BOX
+class: FL_CHOICE
+type: NORMAL_CHOICE
box: 120 190 190 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_COL1
=============== FORM ===============
Name: form_character
-Width: 300
-Height: 375
-Number of Objects: 15
+Width: 295
+Height: 385
+Number of Objects: 16
--------------------
class: FL_BOX
type: UP_BOX
-box: 0 0 300 375
+box: 0 0 295 385
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
callback:
argument:
+--------------------
+class: FL_CHOICE
+type: NORMAL_CHOICE
+box: 95 155 190 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Language|#L
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_NorthEast
+name: choice_language
+callback:
+argument:
+
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
-box: 10 280 280 45
+box: 10 295 280 45
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
-box: 10 220 280 45
+box: 10 235 280 45
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_FRAME
type: ENGRAVED_FRAME
-box: 10 10 280 195
+box: 10 10 280 210
boxtype: FL_NO_BOX
colors: FL_BLACK FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 94 55 191 30
+box: 94 50 191 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 94 95 191 30
+box: 94 85 191 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 95 230 191 30
+box: 95 245 191 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 95 290 190 30
+box: 95 305 190 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
--------------------
class: FL_BUTTON
type: NORMAL_BUTTON
-box: 60 330 80 30
+box: 60 345 80 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_BUTTON
type: RETURN_BUTTON
-box: 175 330 80 30
+box: 175 345 80 30
boxtype: FL_UP_BOX
colors: FL_COL1 FL_COL1
alignment: FL_ALIGN_CENTER
--------------------
class: FL_CHOICE
type: NORMAL_CHOICE
-box: 95 135 191 30
+box: 95 120 191 30
boxtype: FL_FRAME_BOX
colors: FL_COL1 FL_BLACK
alignment: FL_ALIGN_LEFT
--------------------
class: FL_CHECKBUTTON
type: PUSH_BUTTON
-box: 30 175 260 25
+box: 30 190 260 25
boxtype: FL_NO_BOX
colors: FL_COL1 FL_YELLOW
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
+size: FL_NORMAL_SIZE
lcol: FL_BLACK
label: Toggle on all these|#T
shortcut:
--------------------
class: FL_TEXT
type: NORMAL_TEXT
-box: 20 210 210 20
+box: 20 225 210 20
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
--------------------
class: FL_TEXT
type: NORMAL_TEXT
-box: 20 270 215 20
+box: 20 285 215 20
boxtype: FL_FLAT_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
--------------------
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
--------------------
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
--------------------
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
--------------------
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
--------------------
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
---- layout_forms.h Tue Dec 2 02:50:13 1997
-+++ layout_forms.h.patched Tue Dec 2 03:05:24 1997
-@@ -43,4 +43,23 @@
+--- layout_forms.h.orig Sat Jun 10 01:48:56 2000
++++ layout_forms.h Sat Jun 10 02:10:12 2000
+@@ -3,6 +3,8 @@
+ #ifndef FD_form_document_h_
+ #define FD_form_document_h_
+
++extern "C" {
++
+ /** Callbacks, globals and object handlers **/
+ extern void ChoiceClassCB(FL_OBJECT *, long);
+ extern void DocumentCancelCB(FL_OBJECT *, long);
+@@ -46,6 +48,29 @@
extern void TableOptionsCB(FL_OBJECT *, long);
extern void TableSpeCloseCB(FL_OBJECT *, long);
++}
++
+/* Additional Functions/Methods */
+
+#include "bufferparams.h"
+extern void MenuLayoutQuotes();
+extern void MenuLayoutParagraph();
+extern void MenuLayoutTable(int);
++
++extern "C" {
+
+ /**** Forms and Objects ****/
+ typedef struct {
+@@ -255,5 +280,7 @@
+ } FD_form_table_extra;
+
+ extern FD_form_table_extra * create_form_form_table_extra(void);
++
++}
+ #endif /* FD_form_document_h_ */
Internal Form Definition File
(do not change)
-Number of forms: 5
+Number of forms: 6
Unit of measure: FL_COORD_PIXEL
=============== FORM ===============
--------------------
class: FL_BEGIN_GROUP
type: 0
-box: 0 0 0 0
+box: 0 10 10 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Roman Font|#R
+label: Roman font|#R
shortcut:
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NoGravity
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Sans Serif Font|#S
+label: Sans serif font|#S
shortcut:
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NoGravity
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Typewriter Font|#T
+label: Typewriter font|#T
shortcut:
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NoGravity
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Font Norm|#N
+label: Font norm|#N
shortcut:
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NoGravity
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Font Zoom|#Z
+label: Font zoom|#Z
shortcut:
resize: FL_RESIZE_X
gravity: FL_NorthWest FL_NoGravity
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Insert Reference|#I^M
+label: Insert reference|#I^M
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Insert Page Number|#P
+label: Insert page number|#P
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Go to Reference|#G
+label: Go to reference|#G
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Insert vReference|#V
+label: Insert text reference|#V
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Insert vPage Number|#N
+label: Insert text page number|#N
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Insert Pretty Ref|#T
+label: Insert pretty reference|#T
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast
style: FL_NORMAL_STYLE
size: FL_NORMAL_SIZE
lcol: FL_BLACK
-label: Go Back|#B
+label: Go back|#B
shortcut:
resize: FL_RESIZE_NONE
gravity: FL_NorthEast FL_NorthEast
callback: RefSelectCB
argument: 6
+=============== FORM ===============
+Name: form_external
+Width: 560
+Height: 310
+Number of Objects: 11
+
+--------------------
+class: FL_BOX
+type: UP_BOX
+box: 0 0 560 310
+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_CHOICE
+type: NORMAL_CHOICE
+box: 130 10 300 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Template|#t
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_NorthEast
+name: templatechoice
+callback: ExternalTemplateCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 130 190 190 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: File|#F
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_SouthWest FL_SouthEast
+name: filename
+callback:
+argument:
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 330 190 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: Browse...|#B
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_SouthEast FL_SouthEast
+name: filenamebrowse
+callback: ExternalBrowseCB
+argument: 0
+
+--------------------
+class: FL_INPUT
+type: NORMAL_INPUT
+box: 130 230 300 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: Parameters|#P
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_SouthWest FL_SouthEast
+name: parameters
+callback:
+argument:
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 435 50 110 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Edit file|#E
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NorthEast FL_NorthEast
+name: edit
+callback: ExternalEditCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 435 90 110 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: View result|#V
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NorthEast FL_NorthEast
+name: view
+callback: ExternalViewCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 435 130 110 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: Update result|#U
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NorthEast FL_NorthEast
+name: update
+callback: ExternalUpdateCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: RETURN_BUTTON
+box: 315 270 110 30
+boxtype: FL_UP_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_CENTER
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
+lcol: FL_BLACK
+label: OK
+shortcut: ^M
+resize: FL_RESIZE_ALL
+gravity: FL_SouthEast FL_SouthEast
+name: ok
+callback: ExternalOKCB
+argument: 0
+
+--------------------
+class: FL_BUTTON
+type: NORMAL_BUTTON
+box: 435 270 110 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|#C^[
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_SouthEast FL_SouthEast
+name: cancel
+callback: ExternalCancelCB
+argument: 0
+
+--------------------
+class: FL_BROWSER
+type: NORMAL_BROWSER
+box: 130 50 300 130
+boxtype: FL_DOWN_BOX
+colors: FL_COL1 FL_YELLOW
+alignment: FL_ALIGN_TOP
+style: FL_NORMAL_STYLE
+size: FL_DEFAULT_SIZE
+lcol: FL_BLACK
+label:
+shortcut:
+resize: FL_RESIZE_ALL
+gravity: FL_NorthWest FL_SouthEast
+name: helptext
+callback:
+argument:
+
==============================
create_the_forms
d: c $(COBJS)
+#
+# -e 's/\(extern\) \(void.*FL_OBJECT\)/\1 "C" \2/'
+#
+# We need the callbacks to all be declared as: extern "C" void
+#
e: c
for hfil in *.h ; do \
if [ -f "$$hfil.patch" ] ; then \
(echo "Patching $$hfil with $$hfil.patch" ; \
patch -s $$hfil < $$hfil.patch) \
fi; \
+ sed < $$hfil > $$hfil.tmp \
+ -e 's/\(extern\) \(void.*FL_OBJECT\)/\1 "C" \2/' ; \
+ mv $$hfil.tmp $$hfil; \
done
updatesrc: d e
- for fil in *.C *.h ; do cp $$fil ../src ; done
+ @echo
+ @echo "Beware some files may be installed in the wrong directory!" >&2
+ @echo "In particular be careful with gui-indep forms. Make sure">&2
+ @echo "they have been removed from the files here otherwise we'll">&2
+ @echo "get junk code and errors at compile time.">&2
+ for fil in *.C *.h ; do \
+ if [ $$fil = "math_forms.C" -o $$fil = "math_forms.h" ]; then \
+ cp $$fil ../src/mathed ; \
+ else \
+ cp $$fil ../src ; \
+ fi \
+ done
.fd.c:
$(FDESIGN) -convert $<
FD_panel *create_form_panel(void)
{
-@@ -17,7 +17,9 @@
- fdui->func_browse = obj = fl_add_browser(FL_SELECT_BROWSER,180,40,94,110,"Functions");
- fl_set_object_lalign(obj,FL_ALIGN_TOP);
- fl_set_object_callback(obj,button_cb,MM_FUNC);
-+#if FL_REVISION > 85
- fl_set_browser_hscrollbar(obj, FL_OFF);
-+#endif
- fdui->greek = obj = fl_add_button(FL_NORMAL_BUTTON,10,90,50,30,"Greek");
- fl_set_object_lsize(obj,FL_NORMAL_SIZE);
- fl_set_object_lstyle(obj,15);
@@ -79,7 +81,7 @@
fdui->delim = fl_bgn_form(FL_NO_BOX, 250, 260);
Internal Form Definition File
(do not change)
-Number of forms: 2
+Number of forms: 1
Unit of measure: FL_COORD_PIXEL
-=============== FORM ===============
-Name: form_print
-Width: 340
-Height: 360
-Number of Objects: 30
-
---------------------
-class: FL_BOX
-type: UP_BOX
-box: 0 0 340 360
-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_FRAME
-type: ENGRAVED_FRAME
-box: 10 215 320 90
-boxtype: FL_NO_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_TEXT
-type: NORMAL_TEXT
-box: 20 205 70 20
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
-style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Print to
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 90 225 230 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:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: input_printer
-callback:
-argument:
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 90 265 230 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:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: input_file
-callback:
-argument:
-
---------------------
-class: FL_BEGIN_GROUP
-type: 0
-box: 0 0 0 0
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-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: group_radio_printto
-callback:
-argument:
-
---------------------
-class: FL_CHECKBUTTON
-type: RADIO_BUTTON
-box: 10 225 80 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Printer|#P
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_printer
-callback:
-argument:
-
---------------------
-class: FL_CHECKBUTTON
-type: RADIO_BUTTON
-box: 10 265 80 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: File|#F
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_file
-callback:
-argument:
-
---------------------
-class: FL_END_GROUP
-type: 0
-box: 0 0 0 0
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-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_FRAME
-type: ENGRAVED_FRAME
-box: 180 20 150 70
-boxtype: FL_NO_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_FRAME
-type: ENGRAVED_FRAME
-box: 10 20 160 180
-boxtype: FL_NO_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_BUTTON
-type: RETURN_BUTTON
-box: 10 315 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_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback: PrintOKCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 120 315 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_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback: PrintApplyCB
-argument: 0
-
---------------------
-class: FL_BUTTON
-type: NORMAL_BUTTON
-box: 230 315 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_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback: PrintCancelCB
-argument: 0
-
---------------------
-class: FL_BEGIN_GROUP
-type: 0
-box: 0 0 0 0
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-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: group_radio_pages
-callback:
-argument:
-
---------------------
-class: FL_CHECKBUTTON
-type: RADIO_BUTTON
-box: 10 30 160 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: All Pages|#G
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_all_pages
-callback:
-argument:
-
---------------------
-class: FL_CHECKBUTTON
-type: RADIO_BUTTON
-box: 10 60 160 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Only Odd Pages|#O
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_odd_pages
-callback:
-argument:
-
---------------------
-class: FL_CHECKBUTTON
-type: RADIO_BUTTON
-box: 10 90 160 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Only Even Pages|#E
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_even_pages
-callback:
-argument:
-
---------------------
-class: FL_END_GROUP
-type: 0
-box: 0 0 0 0
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-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_BEGIN_GROUP
-type: 0
-box: 0 0 0 0
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-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: group_radio_order
-callback:
-argument:
-
---------------------
-class: FL_CHECKBUTTON
-type: RADIO_BUTTON
-box: 180 30 150 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Normal Order|#N
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_order_normal
-callback:
-argument:
-
---------------------
-class: FL_CHECKBUTTON
-type: RADIO_BUTTON
-box: 180 60 150 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Reverse Order|#R
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: radio_order_reverse
-callback:
-argument:
-
---------------------
-class: FL_END_GROUP
-type: 0
-box: 0 0 0 0
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_MCOL
-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_TEXT
-type: NORMAL_TEXT
-box: 200 10 60 20
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
-style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Order
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 20 10 50 20
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
-style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Print
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 20 160 140 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Pages:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: input_pages
-callback:
-argument:
-
---------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 180 110 150 90
-boxtype: FL_NO_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_TEXT
-type: NORMAL_TEXT
-box: 200 95 50 20
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
-style: FL_BOLD_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Copies
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name:
-callback:
-argument:
-
---------------------
-class: FL_INPUT
-type: NORMAL_INPUT
-box: 190 160 130 30
-boxtype: FL_DOWN_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_TOP_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Count:
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: input_copies
-callback:
-argument:
-
---------------------
-class: FL_CHECKBUTTON
-type: PUSH_BUTTON
-box: 180 115 140 30
-boxtype: FL_NO_BOX
-colors: FL_COL1 FL_YELLOW
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
-lcol: FL_BLACK
-label: Unsorted|#U
-shortcut:
-resize: FL_RESIZE_ALL
-gravity: FL_NoGravity FL_NoGravity
-name: do_unsorted
-callback:
-argument:
-
=============== FORM ===============
Name: form_sendto
Width: 340
AUTOMAKE_OPTIONS = foreign
-DISTCLEANFILES = *.orig *.rej *~ *.bak textclass.lst packages.lst \
- lyxrc.defaults doc/LaTeXConfig.lyx
+DISTCLEANFILES = *.orig *.rej *~ *.bak core textclass.lst packages.lst \
+ lyxrc.defaults doc/LyXConfig.lyx
pkgdata_SCRIPTS = configure configure.cmd
-MAINTAINERCLEANFILES = Makefile.in
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
SUBDIRS = reLyX
BIND = bind/*.bind
CLIPART = clipart/*.eps
-DOCDIST = doc/LaTeXConfig.lyx*
+DOCDIST = doc/LyXConfig.lyx*
DOCINST = doc/*
EXAMPLES = examples/*.lyx
IMAGES = images/*.xpm images/*.xbm
KBD = kbd/*.kmap kbd/*.cdef
LAYOUT = layouts/*.layout layouts/*.inc
+LYXSCRIPTS = scripts/*
TEMPL = templates/*.lyx
TEXSUPPORT = tex/*.cls
LIBINSTFILES = $(BIND) $(CLIPART) $(DOCINST) $(EXAMPLES) $(IMAGES) $(KBD) \
- $(LAYOUT) $(TEMPL) $(TEXSUPPORT)
+ $(LAYOUT) $(TEMPL) $(TEXSUPPORT) $(LYXSCRIPTS)
LIBDISTFILES = $(BIND) $(CLIPART) $(DOCDIST) $(EXAMPLES) $(IMAGES) $(KBD) \
- $(LAYOUT) $(TEMPL) $(TEXSUPPORT)
+ $(LAYOUT) $(TEMPL) $(TEXSUPPORT) $(LYXSCRIPTS)
pkgdata_DATA = lyxrc.example CREDITS chkconfig.ltx lyxrc.defaults \
- textclass.lst packages.lst
+ textclass.lst packages.lst external_templates
-LYXLIBDIRS = bind clipart doc examples images kbd layouts templates tex
+LYXLIBDIRS = bind clipart doc examples images kbd layouts scripts templates tex
EXTRA_DIST = CREDITS chkconfig.ltx configure.cmd lyxrc.example \
- $(LYXLIBDIRS)
+ external_templates $(LYXLIBDIRS)
libinstalldirs:
for dir in $(LYXLIBDIRS) ; do \
$(INSTALL_DATA) ${srcdir}/$$i $(DESTDIR)$(pkgdatadir)/$$i ; \
done
+uninstall-local:
+ @$(NORMAL_UNINSTALL)
+ files=`cd ${srcdir} ; echo $(LIBINSTFILES)` ; \
+ for i in $${files} ; do \
+ rm -f $(pkgdatadir)/$$i ; \
+ done
+
dist-hook:
cd ${distdir} ; rm -rf `find . -name \*CVS\*` ; \
rm -rf doc/BUGS.lyx ; \
{ cvs -Q export -r HEAD -d doc lyxdoc || \
echo "WARNING: Unable to get LyX Documentation from CVS!" ; true ; }
+
% with minimal changes by Asger Alstrup (alstrup@diku.dk).
%
% This script should only be run from the configure script to update
-% the files textclass.lst and doc/LaTeXConfig.lyx
+% the files textclass.lst and doc/LyXConfig.lyx
%
% This script is in fact a complete rewrite of the original chkconfig
% script. Expect bugs.
%%% 1- Add the command \TestPackage{<name>}. The syntax is:
%%% \TestPackage[<file>]{<name>}, which tests whether <name>.sty
%%% (or <file>, if this optional parameter is provided) exists.
-%%% 2- Add a description for <name> in doc/LaTeXConfig.lyx.in,
+%%% 2- Add a description for <name> in doc/LyXConfig.lyx.in,
%%% containing in particular a line like
%%% Found @chk_<name>@
%%% This line will be replaced at configure time by the proper text.
%%% For document classes, things are even simpler, since you do not
%%% need to edit this file. Just put your layout file in some place
%%% where LyX can find it and add if you wish a description in
-%%% LaTeXConfig.lyx.in, as described above.
+%%% LyXConfig.lyx.in, as described above.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%% Initialization part (skip) %%%%%%%%%%%%%%%%%%%%%
\immediate\closeout\vars
\immediate\closeout\packages
\typeout{\prefix Inspection done.}
-\typeout{\prefix Read the file doc/LaTeXConfig.lyx for more information.}
+\typeout{\prefix Read the file doc/LyXConfig.lyx for more information.}
% Get the real \end command, that has been hidden by LaTeX
\@@end
--- /dev/null
+#LyX 1.1 created this file. For more info see http://www.lyx.org/
+\lyxformat 2.16
+\textclass article
+\language default
+\inputencoding latin1
+\fontscheme default
+\graphics default
+\paperfontsize default
+\spacing single
+\papersize Default
+\paperpackage a4
+\use_geometry 0
+\use_amsmath 0
+\paperorientation portrait
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\defskip medskip
+\quotes_language english
+\quotes_times 2
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+
+\layout Section
+
+The external material inset
+\layout Subsection
+
+Background
+\layout Standard
+
+One often requested feature from LyX users is to be able to interface LyX
+ with XFig, Dia, or other similar applications that specialize in producing
+ a certain kind of diagram, figure, schematic or whatever material might
+ be relevant to include in your document.
+ Previously, it was only possible to include boring, static, fixed images
+ in LyX documents with the figure inset, but there are several limitations
+ attached to this approach:
+\layout Itemize
+
+If you want to change the figure, you have to invoke an external program
+ by hand
+\layout Itemize
+
+LyX does not notice that the referenced files change, so the on-screen display
+ can fast become obsolete, and this is aggravated by the lack of a means
+ of updating the display
+\layout Itemize
+
+The figure inset only supports PostScript material
+\layout Itemize
+
+The figure inset does not provide any mechanisms for coping with different
+ exported formats such as DocBook, HTML or rawAscii
+\layout Standard
+
+The external material inset attempts to solve all of these problems
+\begin_float footnote
+\layout Standard
+
+Even if the figure inset can't solve all problems, it is still valuable
+ because it does provide in-line preview of the figure, and supports advanced
+ geometric transformations with a comfortable user interface.
+\end_float
+.
+ It does this by offering a general method to interface LyX to external
+ applications.
+ Instead of introducing a long list of different insets taylored for each
+ specific application, we chose to sacrify the in-line displaying of the
+ included material in order to provide a general construct to cover a wide
+ range of applications.
+ The result is the external inset.
+ An external inset presents itself in the document simply as a button, but
+ don't let this fool you.
+ When you click on it, a dialog will appear that allows you to chose exactly
+ what material to include, and in the following you will learn that this
+ is indeed a powerful mechanism that can solve all of the above problems,
+ and more.
+\layout Subsection
+
+How does it work?
+\layout Standard
+
+The external inset is based on the concept of a
+\emph on
+ template
+\emph default
+.
+ A template is a specification of how LyX should interface with a certain
+ kind of material.
+ As bundled, LyX comes with predefined templates for XFig figures, Dia diagrams,
+ various raster format images, gnuplot, and more.
+ You can check the actual list by using the
+\family sans
+Insert\SpecialChar \menuseparator
+Insert external material
+\family default
+command.
+ Furthermore, it is possible to roll your own template to support a specific
+ kind of material.
+ Later we'll describe in more detail what is involved, and hopefully you
+ will submit all the templates you create so we can include them in a later
+ LyX version.
+\layout Standard
+
+Another basic idea of the external inset is to distinguish between the original
+ file that serves as a base for final material and the produced file that
+ is included in your exported or printed document.
+ For example, consider the case of a figure produced with XFig.
+ The XFig application itself works on an original file with the
+\family typewriter
+.fig
+\family default
+ extension.
+ Within XFig, you create and change your figure, and when you are done,
+ you save the
+\family typewriter
+fig
+\family default
+-file.
+ When you want to include the figure in your document, you invoke
+\family typewriter
+transfig
+\family default
+ in order to create a PostScript file that can readily be included in your
+ LaTeX file.
+ In this case, the
+\family typewriter
+.fig
+\family default
+ file is the original file, and the PostScript file is the produced file.
+\layout Standard
+
+This distinction is important in order to allow updating of the material
+ while you are in the process of writing the document.
+ Furthermore, it provides us with the flexibility that is needed to support
+ multiple export formats.
+ For instance, in the case of an Ascii resulting file, it is not exactly
+ an award-winning idea to include the figure as raw PostScript.
+ Instead, you'd either prefer to just include a reference to the figure,
+ or try to invoke some graphics to Ascii converter to make the final result
+ look similar to the real graphics.
+ The external material inset allows you to do this, because it is parameterized
+ on the different export formats that LyX supports.
+\layout Standard
+
+Besides supporting the production of different products according to the
+ exported format, the external inset supports tight integration with editing
+ and viewing applications.
+ In the case of an XFig figure, you are able to invoke xfig on the original
+ file with a single click from within the external inset in LyX, and also
+ preview the produced PostScript file with ghostview with another click.
+ No more fiddling around with the command line and/or file browsers to locate
+ and manipulate the original or produced files.
+ In this way, you are finally able to take full advantage of the many different
+ applications that are relevant to use when you write your documents, and
+ ultimately be more productive.
+\layout Standard
+
+So, all in all, LyX has information about a number of different programs
+ to use behind the scenes in order to realize all of this machinery.
+ This information, in fact, is exactly what is contained in the templates.
+ To each template, there is associated a list of command lines that are
+ used to invoke applications, convert the original file to the produced
+ file, and more.
+ This mechanism allows the advanced user to extend the capabilities of LyX
+ without fiddling with the source code.
+ It requires some footwork to define all the different commands and flags,
+ but luckily, the LyX team did all the hard work and specified these for
+ you.
+\layout Standard
+
+But before the trees grow into the skies, we have to admit that we did take
+ one tiny short-cut.
+ Since the external inset can produce many different kinds of produced files
+ to go with each exported format, one could also expect that it would be
+ possible to preview each product.
+ But, the LyX team decides against this in order to keep the user interface
+ simple.
+ Instead of providing a button for each exported file format, we decided
+ to introduce the concept of the primary file format and just have one button.
+ When you press
+\family sans
+View result
+\family default
+ in the external inset dialog, you will get a view of the produced file
+ in the primary file format.
+ And the primary file format is specified by your document class.
+ For most document classes, the primary file format is LaTeX, but for the
+ DocBook document classes, the primary file format is DocBook.
+ So, when you view the produced file, keep in mind that it will only be
+ a preview of what the main result will be.
+ If you want to see how other exported formats turn out, you have to export
+ them and preview them by hand.
+\layout Subsection
+
+The external material inset dialog
+\layout Standard
+
+You insert an external inset from the
+\family sans
+Insert
+\family default
+ menu.
+ When you do this, a button is inserted into your document, and the external
+ material inset dialog is shown.
+ This dialog allows you to describe exactly what material should be included,
+ and also how it should be included.
+ Furthermore, it provides access to the external applications to either
+ view, edit or produce the material that is used in the resulting file.
+\layout Standard
+
+At the top of this dialog, there is a drop-down list where you can chose
+ which template the inset should use.
+ Just below the template drop-down, there's an text area with a short blurp
+ about the chosen template that should help you use it.
+ Most often, it will provide a short description of the template, and a
+ few hints on how to parameterize the use of it.
+ Further down, you'll find a filename input field along with a browse-button
+ that allows you to chose which file should be included, with the standard
+ file browser.
+ Thus this field specifies the original file.
+ Since the produced file is automatically generated when needed, there is
+ no need to give access to it in the user interface.
+\layout Standard
+
+At the bottom of the dialog, you'll find a general input box called
+\family sans
+Parameters
+\family default
+.
+ This box is generally used to parameterize the specific template.
+ The specific use should be covered in the help blurp associated with the
+ template, but in general it typically allows you to define variations on
+ how the produced file should be generated.
+\layout Standard
+
+At the right side of the dialog, you'll find three buttons:
+\family sans
+Edit file
+\family default
+,
+\family sans
+View result
+\family default
+, and
+\family sans
+Update result
+\family default
+.
+ These in turn allows you to edit your original file with the appropriate
+ editing application, view the produced file as included in the primary
+ format document, and finally force an update of the resulting material
+ in the primary format.
+ Normally, the
+\family sans
+Update result
+\family default
+ button will be disabled, because most templates are configured to automatically
+ update the produced file when needed.
+ In those cases, there is no need to force the production of a new produced
+ file.
+ However, some templates are configured to not be automatically producing
+ the residual product, because the cost of producing the produced file might
+ be so large that it would be a pain to do it all the time.
+ Those insets are known as
+\emph on
+manual
+\emph default
+ external insets.
+ In those cases, you can use the button to force the production of the produced
+ file exactly when you need it, and thus control the amount of work that
+ is done.
+ In fact, it is
+\emph on
+your
+\emph default
+ responsibility to do this to keep the produced files current at all times:
+ before printing, before exporting, before viewing, etc.
+ To help you with this task, you can use the
+\family sans
+Edit\SpecialChar \menuseparator
+Update all external inset
+\family default
+ command that will update all external insets that use a manual template.
+ But be prepared that it might take some time for the updating to finish.
+\layout Standard
+
+At the bottom of the dialog, you find the normal
+\family sans
+OK
+\family default
+ and
+\family sans
+Cancel
+\family default
+ buttons.
+ The only thing worth mentioning about these is that any changes in the
+ template, filename or parameters are actually applied whenever you press
+
+\family sans
+Edit file
+\family default
+,
+\family sans
+View result
+\family default
+ or
+\family sans
+Update result
+\family default
+ buttons.
+ This implies that after using one of those, you will only be able to undo
+ changes that occured after the use of those buttons, by pressing
+\family sans
+Cancel
+\family default
+.
+ Fortunately, you can use the general undo feature in LyX to revert to a
+ previous state.
+\layout Subsection
+
+Examples
+\layout Standard
+
+In this section, we should include some examples of use of the external
+ material inset.
+ Those examples could include:
+\layout Itemize
+
+External raster images
+\layout Itemize
+
+External XFig figures
+\layout Itemize
+
+Chess diagrams
+\layout Itemize
+
+Sound samples
+\layout Itemize
+
+The use of makefiles
+\layout Itemize
+
+Recursive external LyX templates
+\layout Subsection
+
+The external template configuration file
+\layout Standard
+
+It is relatively easy to add custom external template definitions to LyX.
+ However, be aware this doing this in an careless manner most probably
+\emph on
+will
+\emph default
+ introduce an easily exploitable security hole.
+ So before you do this, please read the discussion about security which
+ will follow later.
+\layout Standard
+
+Having said that, we encourage you to submit any interesting templates that
+ you create.
+
+\layout Standard
+
+The external templates are defined in the
+\family typewriter
+lib/external_templates
+\family default
+ file.
+ You can place your own version in
+\family typewriter
+.lyx/external_templates
+\family default
+.
+ At some point in time, hopefully somebody will document the template contents,
+ and the syntax used to define your templates.
+\layout Subsection
+
+The substitution mechanism
+\layout Standard
+
+When the external material inset invokes an external program, it is done
+ on the basis of a command defined in the template configuration file.
+ These commands can contain various macros that are expanded before execution.
+ Execution always take place in the directory of the containing document.
+\layout Standard
+
+Also, whenever an external inset is to be displayed, the name will be produced
+ by the substitution mechanism.
+\layout Standard
+
+The available macros are the following:
+\layout Description
+
+$$FName The filename of the file specified in the external inset dialog.
+\layout Description
+
+$$Basename The filename without the extension.
+\layout Description
+
+$$Tempname A name and full path to a temporary file which will be automatically
+ deleted whenever the containing document is closed, or the external inset
+ deleted.
+\layout Description
+
+$$Contents(
+\begin_inset Quotes eld
+\end_inset
+
+filename.ext
+\begin_inset Quotes erd
+\end_inset
+
+) This macro will expand to the contents of the file with the name
+\family typewriter
+filename.ext
+\family default
+.
+\layout Description
+
+$$Sysdir This macro will expand to the absolute path of the system directory.
+ This is typically used to point to the various helper scripts that are
+ bundled with LyX.
+\layout Standard
+
+In addition to these, the facility will expand general environment variables
+ with a syntax like
+\family typewriter
+${PATH}
+\family default
+.
+\layout Subsection
+
+Security discussion
+\layout Standard
+
+The external material inset interfaces with a lot of external programs and
+ does so automatically, so we have to consider the security implications
+ of this.
+ In particular, since you have the option of including your own filenames
+ and/or parameter strings and those are expanded into a command, it seems
+ that it would be possible to create a malicious document which executes
+ arbitrary commands when a user views or prints the document.
+ This is something we definately want to avoid.
+\layout Standard
+
+However, since the external program commands are specified in the template
+ configuration file only, there are no security issues if LyX is properly
+ configured with safe templates only.
+ This is so because the external programs are invoked with the
+\family typewriter
+execvp
+\family default
+-system call rather than the
+\family typewriter
+system
+\family default
+ system-call, so it's not possible to execute arbitrary commands from the
+ filename or parameter section via the shell.
+\layout Standard
+
+This also implies that you are restricted in what command strings you can
+ use in the external material templates.
+ In particular, pipes and redirection are not readily available.
+ This has to be so if LyX should remain safe.
+ If you want to use some of the shell features, you should write a safe
+ script to do this in a controlled manner, and then invoke the script from
+ the command string.
+ In the
+\family typewriter
+lib/scripts
+\family default
+ directory of the LyX installation, you can find a safe wrapper script
+\family typewriter
+general_command_wrapper.py
+\family default
+ that supports redirection of input and output.
+ That can serve as an example for how to write safe template scripts.
+ For a more advanced example that uses
+\family typewriter
+fork
+\family default
+ and friends, take a look at the
+\family typewriter
+pic2ascii.py
+\family default
+ converter script.
+\layout Standard
+
+It is possible to design a template that interacts directly with the shell,
+ but since this would allow a malicious user to execute arbitrary commands
+ by writing clever filenames and/or parameters, we generally recommend that
+ you only use safe scripts that work with the
+\family typewriter
+execvp
+\family default
+ system call in a controlled manner.
+ Of course, for use in a controlled environment, it can be tempting to just
+ fall back to use ordinary shell scripts.
+ If you do so, be aware that you
+\emph on
+will
+\emph default
+ provide an easily exploitable security hole in your system.
+ Of course it stands to reason that such unsafe templates will never be
+ included in the standard LyX distribution, although we do encourage people
+ to submit new templates in the open source tradition.
+ But LyX as shipped from the official distribution channels will never have
+ unsafe templates.
+\layout Standard
+
+The external material inset provides a lot of power, and you have to be
+ careful not to introduce security hazards with this power.
+ A subtile error in a single line in an innocent looking script can open
+ the door to huge security problems.
+ So if you do not fully understand the issues, we recommend that you consult
+ a knowledgable security professional or the LyX development team if you
+ have any questions about whether a given template is safe or not.
+ And do this before you use it in an uncontrolled environment.
+\layout Subsection
+
+The future of the external inset
+\layout Standard
+
+The current implementation of the external inset is a stable and powerful
+ construct that provides raw access to the inner parts of LyX, but as with
+ any feature in LyX, it should always be considered work-in-progress.
+ When and if somebody has time to continue work on it, here are some general
+ directions that could be approached:
+\layout Itemize
+
+Support in-line previewing in various formats, rather than the button text
+ we are restricted to now.
+\layout Itemize
+
+Support in-line editing using OpenParts or any other relevant protocol.
+\layout Itemize
+
+Extend the dynamic information to have optional parameter fields for the
+ conversion commands in all export formats, and to have optional parameter
+ fields for what is produced into all the different exported formats.
+ At the moment, we are restricted to only one parameter string that is multiplex
+ed across these many applications.
+ Also, a change like this would allow us to get rid of the strange primary
+ target format restrictions.
+\layout Itemize
+
+Extend the framework to provide more intelligent customization options in
+ addition to the rather simplistic raw parameter strings.
+ With a suitable scripting language, it would be possible to implement user
+ friendly versions of many customizable insets that supports a wide range
+ of formats, LaTeX packages, editors, etc.
+\the_end
--- /dev/null
+#LyX 1.1 created this file. For more info see http://www.lyx.org/
+\lyxformat 2.16
+\textclass article
+\language default
+\inputencoding default
+\fontscheme default
+\graphics dvips
+\paperfontsize default
+\spacing single
+\papersize Default
+\paperpackage a4
+\use_geometry 0
+\use_amsmath 0
+\paperorientation portrait
+\secnumdepth 2
+\tocdepth 3
+\paragraph_separation indent
+\defskip medskip
+\quotes_language english
+\quotes_times 2
+\papercolumns 1
+\papersides 1
+\paperpagestyle plain
+
+\layout Title
+
+Inventory of your LaTeX and system configuration
+\layout Author
+
+Automatically generated by LyX (do not edit).
+\layout Date
+
+@chk_date@
+\layout Standard
+
+This file describes both the different LaTeX add-ons that LyX can handle
+ and different external programs that LyX can interact with.
+ Below you'll find the following sections:
+\layout Enumerate
+
+Some basic details about your LaTeX installation.
+ In particular, you should make sure that your version of LaTeX is recent
+ enough.
+\layout Enumerate
+
+Some common fonts that LyX knows about.
+ This is rather sparse at the moment.
+\layout Enumerate
+
+The document classes that should be standard on any LaTeX implementation.
+ This section is only here for completeness.
+\layout Enumerate
+
+Some optional document classes that LyX knows about.
+ If one of these is marked as missing (the
+\begin_inset Quotes eld
+\end_inset
+
+Found
+\begin_inset Quotes erd
+\end_inset
+
+ item is no) and you need its functionality, you can grab it at your nearest
+ CTAN ftp site
+\begin_float footnote
+\layout Standard
+
+The participating hosts in the Comprehensive TeX Archive Network are:
+\layout LyX-Code
+
+ftp://ftp.dante.de/tex-archive
+\layout LyX-Code
+
+ftp://ctan.tug.org/tex-archive
+\layout LyX-Code
+
+ftp://ftp.tex.ac.uk/tex-archive
+\layout Standard
+
+There are also a zillion mirror sites which are listed at the three primary
+ sites.
+\end_float
+ at the location indicated in the
+\begin_inset Quotes eld
+\end_inset
+
+CTAN
+\begin_inset Quotes erd
+\end_inset
+
+ item.
+ Note that only detected document classes can be selected as document layouts
+ in LyX.
+\layout Enumerate
+
+Some packages that LyX use when you try to change the margins of your document.
+ The detection of these items does not yet affect the options available
+ inside LyX.
+\layout Enumerate
+
+Some common LaTeX packages that you might need with LyX, and you might also
+ want to add to your LaTeX installation.
+ The detection of these items does not yet affect the options available
+ inside LyX.
+\layout Enumerate
+
+Different required external programs that LyX relies on.
+ LyX to a large extent relies on other programs to do it's work, and some
+ programs are required for LyX to be useful.
+\layout Enumerate
+
+Different optional external programs that LyX can interact with.
+ All of these are optional, and some you would want more than others.
+\layout Standard
+
+Note that most of these packages will be available if you use a modern TeX
+ distribution such as teTeX.
+ If you decide to install one of the missing items, you should tell LyX
+ about it.
+ After the installation, please use the menu entry
+\family sans
+\bar under
+O
+\bar default
+ptions\SpecialChar \menuseparator
+
+\bar under
+R
+\bar default
+econfigure
+\begin_float footnote
+\layout Standard
+
+or, if you want to change the system-wide settings, issue the command
+\family typewriter
+./configure
+\family default
+ from the LyX system directory (by default
+\family typewriter
+/usr/local/lib/lyx/
+\family default
+)
+\end_float
+ and reload this file to see if the new package was recognized.
+ If the
+\begin_inset Quotes eld
+\end_inset
+
+Found
+\begin_inset Quotes erd
+\end_inset
+
+ items read
+\begin_inset Quotes eld
+\end_inset
+
+???
+\begin_inset Quotes erd
+\end_inset
+
+, it means that LyX could not do the inventory of your LaTeX configuration
+ for some reason.
+ If you are using teTeX, it might be that the new package you installed
+ is not found.
+ This is because you forgot to run the command
+\family typewriter
+texhash
+\family default
+, which tells teTeX to update its own configuration.
+\layout Section
+
+LaTeX version currently in use
+\layout Standard
+
+The LaTeX version that LyX will use is:
+\family typewriter
+@chk_fmtversion@
+\family default
+.
+ Note that, for best results, you should be using at least LaTeX release
+
+\family typewriter
+1995/12/01
+\begin_float footnote
+\layout Standard
+
+In case it is not clear to you, this number is the date at which the version
+ has been released.
+\end_float
+.
+ In fact, earlier versions may work for many things, but will certainly
+ fail in some cases.
+ We feel that it is better to stick to a minimal version than try to work
+ around all the quirks of older ones.
+\layout Section
+
+Fonts
+\layout Subsection
+
+EC fonts
+\layout Description
+
+Found: @chk_ec@
+\layout Description
+
+CTAN:
+\family typewriter
+fonts/ec
+\layout Description
+
+Notes: LaTeX does not require the use of
+\family sans
+ec
+\family default
+ fonts, however they are strongly recommended.
+ The
+\family sans
+ec
+\family default
+ fonts are available in a more natural range of sizes and allow better hyphenati
+on and kerning than the old fonts such as
+\family sans
+cmr10
+\family default
+.
+ If you already have the so-called
+\family sans
+dc
+\family default
+ fonts installed, please upgrade to the
+\family sans
+ec
+\family default
+ fonts, which replace them.
+ They are used automatically if LyX determines that you have them installed.
+\layout Subsection
+
+psnfss
+\layout Description
+
+Found: @chk_psnfss@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/packages/psnfss/
+\layout Description
+
+Notes: The package
+\family sans
+psnfss
+\family default
+ allows you to change the fonts used by LyX to one of the 35 classical fonts
+ available on PostScript® printers.
+ Currently, the support for
+\family sans
+psnfss
+\family default
+ is limited in LyX: you can only chose a few combinations of PostScript®
+ fonts in
+\family sans
+\size normal
+Layout->Document
+\family default
+\size default
+.
+\layout Section
+
+Standard LaTeX document classes
+\layout Standard
+
+The document classes presented in this section are the basic document classes
+ provided by LaTeX.
+ In particular, they are all present on your system as long as LaTeX2e is
+ installed.
+ When the text indicates that a particular class has not been found, this
+ means the layout file supporting this particular class has not been found.
+\layout Subsection
+
+article
+\layout Description
+
+Found: @chk_article@
+\layout Description
+
+CTAN: N/A
+\layout Description
+
+Notes: The standard document class
+\family sans
+article
+\family default
+ is used to type articles or short texts.
+ It is the basic LaTeX document class.
+\layout Subsection
+
+report
+\layout Description
+
+Found: @chk_report@
+\layout Description
+
+CTAN: N/A
+\layout Description
+
+Notes: The standard document class
+\family sans
+report
+\family default
+ is similar to
+\family sans
+article
+\family default
+ but is slightly more structured (support for different parts).
+\layout Subsection
+
+book
+\layout Description
+
+Found: @chk_book@
+\layout Description
+
+CTAN: N/A
+\layout Description
+
+Notes: The standard document class
+\family sans
+book
+\family default
+ is, as its name suggests, intended to produce books.
+ It supports in particular sectioning by chapters.
+\layout Subsection
+
+letter
+\layout Description
+
+Found: @chk_letter@
+\layout Description
+
+CTAN: N/A
+\layout Description
+
+Notes: The standard document class
+\family sans
+letter
+\family default
+ is the basic class for writing letters, mostly in English.
+\layout Subsection
+
+slides
+\layout Description
+
+Found: @chk_slides@
+\layout Description
+
+CTAN: N/A
+\layout Description
+
+Notes: The standard document class
+\family sans
+slides
+\family default
+ is intended to produce transparencies.
+
+\layout Section
+
+Additional document classes
+\layout Subsection
+
+aa
+\layout Description
+
+Found: @chk_aapaper@
+\layout Description
+
+CTAN: N/A (available from Springer's ftp site
+\family typewriter
+ ftp.springer.de
+\family default
+ in directory
+\family typewriter
+/pub/tex/latex/aa
+\family default
+)
+\layout Description
+
+Notes: The document class
+\family sans
+aa
+\family default
+ can be used to write articles for submission to the scientific journal
+
+\emph on
+Astronomy and Astrophysics
+\emph default
+ and the accompanying
+\emph on
+Supplement Series
+\emph default
+published by Springer -Verlag.
+\layout Subsection
+
+aastex
+\layout Description
+
+Found: @chk_aastex@
+\layout Description
+
+CTAN: N/A (available from the American Astronomical Society's ftp site
+\family typewriter
+ ftp.aas.
+\family default
+org in directory
+\family typewriter
+/pub
+\family default
+s)
+\layout Description
+
+Notes: The document class
+\family sans
+aastex
+\family default
+ can be used to write articles for submission to the American journals
+\emph on
+Astrophysical Journal, Astronomical Journal
+\emph default
+ and
+\emph on
+Publications of the Astronomical Society of the Pacific
+\emph default
+.
+\layout Subsection
+
+amsart
+\layout Description
+
+Found: @chk_amsart@
+\layout Description
+
+CTAN:
+\family typewriter
+fonts/ams/amslatex/inputs/
+\layout Description
+
+Notes: The document class
+\family sans
+amsart
+\family default
+ is an alternative to the class
+\family sans
+article
+\family default
+.
+ It is part of the AMS-LaTeX package and is used for typesetting of mathematics
+ with a look the American Mathematical Society has developed.
+ They recommend it for the preparation of manuscripts intended for publication
+ both in the Society's books and journals, and also in other mathematical
+ literature.
+ The Society requests that published documents prepared with AMS-LaTeX include
+ an acknowledgment of its use.
+ LyX support is still limited.
+\layout Subsection
+
+broadway
+\layout Description
+
+Found: @chk_broadway@
+\layout Description
+
+CTAN: N/A (must be installed from the
+\family typewriter
+tex/
+\family default
+ subdirectory of LyX source distribution)
+\layout Description
+
+Notes: The document class
+\family sans
+broadway
+\family default
+ is for writing plays.
+ It is not an existing LaTeX document class, but a new one which is distributed
+ with LyX.
+\layout Subsection
+
+dinbrief
+\layout Description
+
+Found: @chk_dinbrief@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/dinbrief/
+\layout Description
+
+Notes: The document class
+\family sans
+dinbrief
+\family default
+ can be used to type letters according to German conventions.
+\layout Subsection
+
+docbook
+\layout Description
+
+Found: @chk_docbook@
+\layout Description
+
+CTAN: N/A
+\layout Description
+
+WWW:
+\begin_inset LatexCommand \url{http://www.sgmltools.org}
+
+\end_inset
+
+
+\layout Description
+
+Notes: The class docbook is not a LaTeX document class.
+ It is designed to produce Docbook SGML documents, which, in turn, can be
+ exported as HTML, RTF, text, or dvi (through
+\family typewriter
+jadetex
+\family default
+).
+ You need the sgmltools v2.0 package installed to use this.
+\layout Subsection
+
+g-brief-en
+\layout Description
+
+Found: @chk_g-brief-en@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/g-brief/
+\layout Description
+
+Notes: The document class
+\family sans
+g-brief
+\family default
+ can be used to type commercial letters with a nice outfit.
+\layout Subsection
+
+g-brief-de
+\layout Description
+
+Found: @chk_g-brief-de@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/g-brief/
+\layout Description
+
+Notes: The document class
+\family sans
+g-brief-de
+\family default
+ is the same as the above g-brief-en only with german labels.
+\layout Subsection
+
+Springer 2-columns Journals (ejour2)
+\layout Description
+
+Found: @chk_ejour2@
+\layout Description
+
+CTAN: N/A (must be installed from the
+\family typewriter
+tex/
+\family default
+ subdirectory of LyX source distribution)
+\layout Description
+
+Notes: The document class
+\family sans
+ejour2
+\family default
+ is for the two-column journal format used by Springer Verlag.
+ It is reasonably well tested only for the Journal of Geodesy.
+ It is not an existing LaTeX document class, but a new one which is distributed
+ with LyX.
+\layout Subsection
+
+foils
+\layout Description
+
+Found: @chk_foils@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/foiltex/
+\layout Description
+
+Notes: The document class
+\family sans
+foils
+\family default
+ (aka FoilTeX) provides an alternative to the standard
+\family sans
+slides
+\family default
+ class to make transparencies.
+ It allows cross references, uses a less ugly font, and is in general much
+ better to use than
+\family sans
+slides
+\family default
+.
+ It does not however have some of the advanced features found in the
+\family sans
+seminar
+\family default
+ class, which is not currently supported by LyX.
+
+\layout Subsection
+
+hollywood
+\layout Description
+
+Found: @chk_hollywood@
+\layout Description
+
+CTAN: N/A (must be installed from the
+\family typewriter
+tex/
+\family default
+ subdirectory of LyX source distribution)
+\layout Description
+
+Notes: The document class
+\family sans
+hollywood
+\family default
+ can be used to type spec scripts for the U.S.
+ film industry.
+ It is not an existing LaTeX document class, but a new one which is distributed
+ with LyX.
+\layout Subsection
+
+iletter
+\layout Description
+
+Found: @chk_iletter@
+\layout Description
+
+CTAN: N/A (must be installed from the
+\family typewriter
+tex/
+\family default
+ subdirectory of LyX source distribution)
+\layout Description
+
+Notes: The document class
+\family sans
+iletter
+\family default
+ can be used to type letters according to Italian conventions.
+ It is not an existing LaTeX document class, but a new one which is distributed
+ with LyX.
+\layout Subsection
+
+IEEEtran
+\layout Description
+
+Found: @chk_IEEEtran@
+\layout Description
+
+CTAN: N/A
+\layout Description
+
+FTP: Currently, the IEEE ftp site only has an old version at:
+\newline
+
+\family sans
+
+\begin_inset LatexCommand \url{ftp://ftp.ieee.org/info/publish/latex/ieeetran.cls}
+
+\end_inset
+
+
+\family default
+
+\family sans
+
+\newline
+
+\family default
+A newer version is available from:
+\newline
+
+\family sans
+
+\begin_inset LatexCommand \url{ftp://ftp.isi.edu/pub/graham/infocom99/latest/IEEEtran.cls}
+
+\end_inset
+
+
+\layout Description
+
+Notes: The class
+\family sans
+ IEEEtran
+\family default
+produces documents suitable for submission to most of the IEEE Transactions.
+ You should consult the IEEE Author Information pages at
+\family sans
+www.ieee.org
+\family default
+ if you intend to use this class.
+ Note that there are both
+\family sans
+IEEEtran.cls
+\family default
+ and
+\family sans
+IEEEtran.sty
+\family default
+ files you
+\emph on
+must
+\emph default
+ get the
+\family sans
+.cls
+\family default
+ file for use with LyX as the
+\family sans
+.sty
+\family default
+ file is for LaTeX 2.09 only.
+ Also note that if your
+\family sans
+ieeetran.cls
+\family default
+ is in lowercase like this example LyX will not find it and you should upgrade
+ to a newer version which has IEEE in capitals.
+\layout Subsection
+
+latex8
+\layout Description
+
+Found: @chk_latex8@
+\layout Description
+
+CTAN: N/A
+\layout Description
+
+Notes: The class
+\family sans
+latex8
+\family default
+ is actually a LaTeX style file that adds some extra features to the
+\family sans
+article
+\family default
+ document class.
+ It produces documents suitable for submission to IEEE Conferences.
+ The LaTeX files (including BibTeX style file) are distributed with the
+ Author Kit for IEEE sponsored conferences.
+\layout Subsection
+
+linuxdoc
+\layout Description
+
+Found: @chk_linuxdoc@
+\layout Description
+
+CTAN: N/A
+\layout Description
+
+Notes: The class
+\family sans
+linuxdoc
+\family default
+ is not a LaTeX document class.
+ It is designed to produce LinuxDoc-SGML documents, which, in turn, can
+ be exported as HTML, RTF, text or...
+ LaTeX.
+ You need to have the
+\family sans
+sgml-tools
+\family default
+ (previously known as
+\family sans
+LinuxDoc
+\family default
+) set of programs installed to use this.
+
+\layout Subsection
+
+llncs
+\layout Description
+
+Found: @chk_llncs@
+\layout Description
+
+CTAN: N/A
+\layout Description
+
+Notes: The document class
+\family sans
+llncs
+\family default
+can be used to write articles for submission to the Springer journal
+\begin_inset Quotes eld
+\end_inset
+
+Lecture Notes in Computer Science
+\begin_inset Quotes erd
+\end_inset
+
+.
+ LaTeX documents are available from Springer's ftp site on the following
+ URL:
+\newline
+
+\begin_inset LatexCommand \url{ftp://trick.ntp.springer.de/pub/tex/latex/llncs/latex2e}
+
+\end_inset
+
+.
+
+\begin_deeper
+\layout Standard
+
+The LyX layout file for this document class is still insufficiently tested.
+\end_deeper
+\layout Subsection
+
+paper
+\layout Description
+
+Found: @chk_paper@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/paper/
+\layout Description
+
+Notes: The document class
+\family sans
+paper
+\family default
+ provides an alternative to the standard
+\family sans
+article
+\family default
+ class.
+ It provides similar functionality, but you might prefer this layout with
+ sans serif sections, headings, and more.
+\layout Subsection
+
+Koma-Script (scrartcl, scrreprt, scrbook)
+\layout Description
+
+Found: @chk_scrartcl@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/koma-script/
+\layout Description
+
+Notes: These document classes provide different versions of the base LaTeX
+ document classes
+\family sans
+article
+\family default
+,
+\family sans
+report
+\family default
+ and
+\family sans
+book
+\family default
+.
+ They have been changed to look somewhat better and be more adapted to european
+ typesetting standards.
+\layout Subsection
+
+REVTeX
+\layout Description
+
+Found: @chk_revtex@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex209/contrib/revtex/
+\layout Description
+
+Notes: The document class
+\family sans
+revtex
+\family default
+ is used to write articles for the publications of the American Physical
+ Society (APS), American Institute of Physics (AIP), and Optical Society
+ of America (OSA).
+ For better results, you should use the file
+\family typewriter
+revtex.cls
+\family default
+ from the
+\family typewriter
+tex/
+\family default
+ subdirectory of LyX source distribution.
+\layout Subsection
+
+REVTeX 4
+\layout Description
+
+Found: @chk_revtex4@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/revtex4-beta/
+\layout Description
+
+Notes: RevTeX 4 is a class used for submitting manuscripts to journals including
+ APS (Physical Review A-E and Letters, Reviews in Modern Physics, Special
+ Topics---Accelerators and Beams), the American Institute of Physics, the
+ Optical Society of America, and the Society for Exploration Geophysicists.
+ [It is in BETA release as of September, 1999.]
+\layout Subsection
+
+Springer Journal of Geodesy
+\layout Description
+
+Found: @chk_svjog@
+\layout Description
+
+CTAN: N/A
+\layout Description
+
+WWW:
+\begin_inset LatexCommand \url{http://www.springer.de/author/tex/help-journals.html}
+
+\end_inset
+
+
+\layout Description
+
+Notes:
+\family sans
+Svjog
+\family default
+ is for the journal formats used by Springer Verlag, in particular that
+ of Journal of Geodesy.
+ It is not very well tested yet.
+ The corresponding documentclass files and associated material can be found
+ on the Springer site.
+ The layout consists of two parts:
+\family typewriter
+svjour.inc
+\family default
+ (which is generic for all Springer journals) and
+\family typewriter
+svjog.layout
+\family default
+, which includes
+\family typewriter
+svjour.inc
+\family default
+ and is specific for Journal of Geodesy.
+ You can write your own
+\family typewriter
+sv<journal>.layout
+\family default
+ to support any other Springer journals (hint, hint!)
+\layout Section
+
+Paper layout packages
+\layout Standard
+
+Changing the margins of a document is one thing people like to do.
+ While LaTeX offers built-in options to set the margins of the documents,
+ some people feel that these margins are too large and want to set them
+ up differently.
+ You can use the package
+\family sans
+geometry
+\family default
+for this purpose, but note that for the sake of readability, your lines
+ should not contain more than 60-70 characters.
+\layout Subsection
+
+a4
+\layout Description
+
+Found: @chk_a4@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/ntgclass/
+\layout Description
+
+Notes: The package
+\family sans
+a4
+\family default
+ changes the margins of your document to suit the European A4 page dimensions
+ with smaller margins that the default A4 format.
+\layout Subsection
+
+a4wide
+\layout Description
+
+Found: @chk_a4wide@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/other/misc/
+\layout Description
+
+Notes: The package
+\family sans
+a4wide
+\family default
+ is another package that allows setting of the margins of your document
+ to A4 paper.
+ With this package, the margins are very wide, but do not follow typographical
+ conventions.
+\layout Subsection
+
+geometry
+\layout Description
+
+Found: @chk_geometry@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/geometry
+\layout Description
+
+Notes: The package
+\family sans
+geometry
+\family default
+ allows to change the paper size and margins of your document in an arbitrary
+ way.
+ It does not provide a typographically correct page layout like
+\family sans
+a4
+\family default
+ or the standard options, though.
+\layout Section
+
+
+\series bold
+\size large
+Other packages
+\layout Subsection
+
+algorithm
+\layout Description
+
+Found: @chk_algorithm@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/algorithms/
+\layout Description
+
+Notes: The package
+\family sans
+algorithm
+\family default
+ is needed by LyX to be able to output
+\begin_inset Quotes eld
+\end_inset
+
+algorithm-floats
+\begin_inset Quotes erd
+\end_inset
+
+.
+ These are useful in placing short algorithms across pagebreaks and support
+ an
+\begin_inset Quotes eld
+\end_inset
+
+index of algorithms
+\begin_inset Quotes erd
+\end_inset
+
+ too.
+\layout Subsection
+
+babel
+\layout Description
+
+Found: @chk_babel@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/packages/babel/
+\layout Description
+
+Notes: The package
+\family sans
+babel
+\family default
+ allows you to customize your document for your favorite language (see the
+
+\family sans
+\size normal
+Layout->Document
+\family default
+\size default
+ popup).
+ In particular, it handles hyphenation and automatic translation of all
+ labels like
+\begin_inset Quotes eld
+\end_inset
+
+Chapter
+\begin_inset Quotes erd
+\end_inset
+
+ and
+\begin_inset Quotes eld
+\end_inset
+
+Table of contents
+\begin_inset Quotes erd
+\end_inset
+
+.
+ This package is not needed if you only plan to write in English, except
+ if you want to use non-English quotes.
+\layout Subsection
+
+color
+\layout Description
+
+Found: @chk_color@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/packages/graphics/
+\layout Description
+
+Notes: The package
+\family sans
+color
+\family default
+ is needed by LyX to handled colored text.
+ These colors will not show in the DVI preview window, but will be correct
+ on the printed output or with a PostScript® previewer.
+ This package is bundled with the
+\family sans
+graphics
+\family default
+ package (see
+\begin_inset LatexCommand \ref{ssec:graphics}
+
+\end_inset
+
+).
+\layout Subsection
+
+fancyhdr
+\layout Description
+
+Found: @chk_fancyhdr@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/fancyhdr/
+\layout Description
+
+Notes: The package
+\family sans
+fancyhdr
+\family default
+ (previously known as
+\family sans
+fancyheadings
+\family default
+) is used when you select the
+\begin_inset Quotes eld
+\end_inset
+
+fancy
+\begin_inset Quotes erd
+\end_inset
+
+ page style in the document layout popup.
+ It provides alternate headers and footers to your pages.
+\layout Subsection
+
+floatflt
+\layout Description
+
+Found: @chk_floatflt@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/other/floatflt/
+\layout Description
+
+Notes: The package
+\family sans
+ floatflt
+\family default
+(an extension of
+\family sans
+floatfig
+\family default
+) is used by LyX if you select the ``floatflt'' type in
+\family sans
+Layout->Paragraph->ExtraOpt
+\family default
+ in the paragraph of a figure float.
+ It allows you to create a figure float which is narrower than the full
+ page and wrap the text around it.
+\layout Subsection
+
+
+\begin_inset LatexCommand \label{ssec:graphics}
+
+\end_inset
+
+graphics
+\layout Description
+
+Found: @chk_graphics@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/packages/graphics/
+\layout Description
+
+Notes: The package
+\family sans
+graphics
+\family default
+ is needed by LyX to insert PostScript® figures.
+ You will also need the program
+\family typewriter
+\size normal
+ghostview
+\family default
+\size default
+ to see them on screen.
+ The configuration script has determined that the graphics driver used by
+ the package should be
+\family sans
+
+\begin_inset Quotes eld
+\end_inset
+
+@chk_graphicsdriver@
+\begin_inset Quotes erd
+\end_inset
+
+
+\begin_float footnote
+\layout Standard
+
+Here, a value of
+\latex no_latex
+
+\begin_inset Quotes eld
+\end_inset
+
+
+\latex default
+default
+\latex no_latex
+
+\begin_inset Quotes erd
+\end_inset
+
+
+\latex default
+ means that your LaTeX installation provides a sensible value for this parameter.
+\end_float
+.
+\layout Subsection
+
+rotating
+\layout Description
+
+Found: @chk_rotating@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/rotating
+\layout Description
+
+Notes: The package
+\family sans
+rotating
+\family default
+ is needed by LyX to change the orientation of some parts of your documents.
+ Note that it only really works with a PostScript® compatible printer.
+\layout Subsection
+
+subfigure
+\layout Description
+
+Found: @chk_subfigure@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/subfigure
+\layout Description
+
+Notes: The package
+\family sans
+ subfigure
+\family default
+is used by LyX when you select ``subfigure'' in the EPS figure popup.
+ Several figures marked in this way can be packed into a single float with
+ individual subcaptions.
+\layout Subsection
+
+setspace
+\layout Description
+
+Found: @chk_setspace@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/setspace/
+\layout Description
+
+Notes: The package
+\family sans
+setspace
+\family default
+ is needed by LyX to change the line spacing of your document.
+\layout Subsection
+
+longtable
+\layout Description
+
+Found: @chk_longtable@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/packages/tools/longtable.dtx
+\layout Description
+
+Notes: The package
+\family sans
+longtable
+\family default
+ is needed by LyX to be able to output correctly multipage tables.
+\layout Subsection
+
+url
+\layout Description
+
+Found: @chk_url@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/other/misc/url.sty
+\layout Description
+
+Notes: The package
+\family sans
+url
+\family default
+ is needed by LyX to be able to output url's corrently.
+\layout Subsection
+
+prettyref
+\layout Description
+
+Found: @chk_prettyref@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/contrib/supported/prettyref/
+\layout Description
+
+Notes: The
+\family sans
+prettyref
+\family default
+ package provides improved reference formatting for LaTeX and allows the
+ author to
+\begin_inset Quotes eld
+\end_inset
+
+preformat
+\begin_inset Quotes erd
+\end_inset
+
+ all types of labels.
+\layout Subsection
+
+varioref
+\layout Description
+
+Found: @chk_varioref@
+\layout Description
+
+CTAN:
+\family typewriter
+macros/latex/required/tools/varioref.dtx
+\layout Description
+
+Notes: The
+\family sans
+varioref
+\family default
+ pacakage provides commands that work like the normal references in LaTeX
+ except that it adds textual references, like 'on the facing page' or 'on
+ page 27' when the corresponding label is not on the same page.
+\layout Subsection
+
+chess and lyxchess
+\layout Standard
+
+Found: @chk_chess@ and @chk_lyxchess@
+\layout Description
+
+CTAN:
+\family typewriter
+fonts/chess/
+\family default
+, and the
+\family typewriter
+lyxchess.sty
+\family default
+ file from the
+\family typewriter
+tex/
+\family default
+ subdirectory of LyX source distribution
+\layout Description
+
+Notes: The package
+\family sans
+lyxchess.sty
+\family default
+ is needed in order to typeset chess diagrams with the external chess diagram
+ inset.
+ You also need to install the fonts from the
+\family sans
+chess.sty
+\family default
+ package, but leave out the
+\family sans
+chess.sty
+\family default
+ style itself since it's meant for older versions of LaTeX only.
+\layout Section
+
+Required external programs
+\layout Standard
+
+LyX is eager to invoke external programs to do some work.
+ In line with the Unix tradition, LyX tries to exploit existing programs
+ before implementing the same thing itself.
+ Over time, LyX is able to interact with an increasing number of both command
+ line and interactive applications, and this to a large degree explains
+ why LyX is succesful.
+\layout Standard
+
+Note: if you use a Linux distribution, such as RedHat or Debian, most of
+ these packages should be available as custom packages for the relevant
+ system, and you might have most of it installed already.
+ And most Unix systems will at least have LaTeX, although it may be a braindead
+ version.
+ Please check what you have before you go download the lot.
+\layout Subsection
+
+XForms
+\layout Description
+
+Found: @chk_xforms@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[The XForms home page]{http://world.std.com/~xforms/}
+
+\end_inset
+
+
+\layout Description
+
+Notes: XForms is the underlying GUI toolkit.
+ You'll need to
+\begin_inset LatexCommand \url[get a version]{http://world.std.com/~xforms/ftp/ftp.html}
+
+\end_inset
+
+ for your architechture, if you want to compile your own version of LyX.
+\layout Subsection
+
+libXpm
+\layout Description
+
+Found: @chk_libxpm@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[libXpm]{http://www.inria.fr/koala/lehors/xpm.html}
+
+\end_inset
+
+
+\layout Description
+
+Notes: libXpm is a library used to display pixmaps.
+ If you want to compile LyX yourself, you'll also need libXpm.
+ You'll have to get version 4.7 or newer.
+ Older versions are incompatible with the current XForms library.
+\layout Subsection
+
+teTeX
+\layout Description
+
+Found: @chk_tetex@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[The teTeX Homepage]{http://www.tug.org/tetex/}
+
+\end_inset
+
+
+\layout Description
+
+Notes: teTex is a LaTeX distribution.
+ In order to properly use LyX to create documents, you'll need to have a
+ LaTeX installation.
+ teTeX is pretty complete.
+\layout Subsection
+
+NTeX
+\layout Description
+
+Found: @chk_ntex@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[The NTeX homepage]{http://web.mathematik.uni-stuttgart.de/ntex/WWW/}
+
+\end_inset
+
+
+\layout Description
+
+Notes: NTeX is an alternative LaTeX distribution.
+ This one is not as extensive as teTeX, so you might have to pick up a few
+ more packages by hand compared to teTeX.
+\layout Section
+
+Optional external programs
+\layout Subsection
+
+ChkTeX
+\layout Description
+
+Found: @chk_chktex@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[ChkTeX Homepage]{http://www.ifi.uio.no/~jensthi/chktex/}
+
+\end_inset
+
+
+\layout Description
+
+Notes: ChkTeX performs typographical checking.
+ LyX can use ChkTeX as an aid to find common typograhical errors in your
+ document.
+\layout Subsection
+
+CTAN
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[CTAN]{http://tug.ctan.org/}
+
+\end_inset
+
+
+\layout Description
+
+Notes: The Comprehensive TeX Archive Network.
+ Since LyX is based on LaTeX, practically any tool made for use with LaTeX
+ can be used with LyX.
+ The CTAN is an archive of packages, tools, documentation and much more
+ about LaTeX, and therefore an invaluable resource if you want to become
+ a power user of LaTeX (and LyX).
+ (If you don't know anything about LaTeX yet, you may want to wait before
+ exploring CTAN, because it is big and confusing at first.)
+\layout Subsection
+
+gBib
+\layout Description
+
+Found: @chk_gbib@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[gBib]{http://www.mx.lyx.org/gbib}
+
+\end_inset
+
+
+\layout Description
+
+Notes: gBib is an interactive BibTeX database manager.
+ This GNOME program allows you to manage a BibTeX bibliography database,
+ and then interface it with LyX in a seamless fashion.
+\layout Subsection
+
+Ghostview
+\layout Description
+
+Found: @chk_ghostview@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[Ghostview]{http://www.cs.wisc.edu/~ghost/ghostview/index.html}
+
+\end_inset
+
+
+\layout Description
+
+Notes: Ghostview is used to preview PostScript files.
+ You'll also need
+\begin_inset LatexCommand \url[Ghostscript]{http://www.cs.wisc.edu/~ghost/aladdin/index.html}
+
+\end_inset
+
+ to be able to use Ghostview.
+\layout Subsection
+
+Gifscii
+\layout Description
+
+Found: @chk_gifscii@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[gifscii-2.2.tar.gz]{ftp://ftp.uni-passau.de/mount/common.lib.archive.unix/Text/gifscii-2.2.tar.gz}
+
+\end_inset
+
+
+\layout Description
+
+Notes: Gifscii is a program that can convert an raster image to an ascii
+ approximation.
+ This is utilized by the external raster image inset when you export a document
+ to Ascii.
+\layout Subsection
+
+GIMP
+\layout Description
+
+Found: @chk_gimp@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[The Gimp Homepage]{http://www.gimp.org}
+
+\end_inset
+
+
+\layout Description
+
+Notes: The GIMP is the GNU Image Manipulation Program.
+ It is a freely distributed piece of software suitable for such tasks as
+ photo retouching, image composition and image authoring.
+ The GIMP is used by LyX as the editor for the external raster image inset.
+\layout Subsection
+
+gv
+\layout Description
+
+Found: @chk_gv@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[The XForms home page]{http://world.std.com/~xforms/}
+
+\end_inset
+
+
+\layout Description
+
+Notes:
+\layout Standard
+
+
+\begin_inset LatexCommand \url[gv]{http://wwwthep.physik.uni-mainz.de/~plass/gv/}
+
+\end_inset
+
+- an alternative PostScript viewer.
+\layout Standard
+
+gv is a more modern PostScript viewer.
+ It also requires Ghostscript to work.
+\layout Subsection
+
+ImageMagick
+\layout Description
+
+Found: @chk_imagemagick@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[ImageMagick homepage]{http://www.imagemagick.org}
+
+\end_inset
+
+
+\layout Description
+
+Notes: ImageMagick is a robust collection of tools to read, write, and manipulat
+e an image in many image formats including popular formats like TIFF, JPEG,
+ PNG, PDF, and GIF.
+ With ImageMagick you can resize, rotate, sharpen, color reduce, or add
+ special effects to an image and save the result in a different image format.
+ LyX uses ImageMagick to both display and convert raster format images in
+ the external raster image inset.
+\layout Subsection
+
+Ispell
+\layout Description
+
+Found: @chk_ispell@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[International Ispell]{http://ficus-www.cs.ucla.edu/ficus-members/geoff/ispell.html}
+
+\end_inset
+
+
+\layout Description
+
+Notes: Ispell is a spellchecker for many languages.
+ LyX can use Ispell as a backend to do spellchecking.
+ You can find
+\begin_inset LatexCommand \url[dictionaries for many languages]{http://ficus-www.cs.ucla.edu/ficus-members/geoff/ispell-dictionaries.html}
+
+\end_inset
+
+ and be able to spellcheck documents in your own language.
+\layout Subsection
+
+NoWeb
+\layout Description
+
+Found: @chk_noweb@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[NoWeb]{http://www.cs.virginia.edu/~nr/noweb/}
+
+\end_inset
+
+
+\layout Description
+
+Notes: NoWeb is used for literate programming.
+ Use LyX to write programs whose documentation and manuals are included
+ in the program.
+\layout Subsection
+
+Perl
+\layout Description
+
+Found: @chk_perl@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[Perl]{http://www.perl.com}
+
+\end_inset
+
+
+\layout Description
+
+Notes: Perl is an interpreted, text-manipulation programming language.
+ If you want to import LaTeX documents into LyX, you'll need to have Perl
+ installed, because the reLyX script that does the conversion is written
+ in Perl.
+ Note that reLyX is bundled with LyX, but is only installed if Perl is found.
+
+\layout Subsection
+
+Pybliographer
+\layout Description
+
+Found: @chk_pybliographer@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[Pybliographer]{http://www.gnome.org/pybliographer/}
+
+\end_inset
+
+
+\layout Description
+
+Notes: Pybliographer is another GNOME BibTeX database manager.
+ This is said to have good support for 8 bit characters, avoid choking on
+ extra field definitions, produce very clean bibtex code and handle other
+ bibliographic formats than BibTeX.
+ And of course, it can interact with LyX.
+\layout Subsection
+
+Python
+\layout Standard
+
+Found: @chk_python@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[Python]{http://www.python.org}
+
+\end_inset
+
+
+\layout Description
+
+Notes: Python is an interpreted, text-manipulation programming language.
+ The Python interpreter is used for many of the gluing scripts that are
+ used by the external material inset.
+ For instance, it is required to use the ascii approximation of external
+ raster images or to include chess diagrams with the external chess diagram
+ inset.
+\layout Subsection
+
+SGMLtools
+\layout Description
+
+Found: @chk_sgmltools@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[The SGMLtools homepage]{http://www.sgmltools.org}
+
+\end_inset
+
+
+\layout Description
+
+Notes: SGMLtools is needed to use the LinuxDoc DTD.
+ If you want to create documents using the LinuxDOC DTD that is used for
+ the
+\begin_inset LatexCommand \url[Linux Documentation Project]{http://sunsite.unc.edu/LDP/}
+
+\end_inset
+
+ to create documents in a variety of different formats, you'll need to get
+ the SGMLtools.
+\layout Subsection
+
+tkbibtex
+\layout Description
+
+Found: @chk_tkbibtex@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[tkbibtex]{http://www.cat.csiro.au/dmt/programs/autom/pic/tkbibtex.html}
+
+\end_inset
+
+
+\layout Description
+
+Notes: tkbibtex - a portable Tcl/Tk browser/editor for BibTeX files.
+ tkbibtex is a portable editor and browser for BibTeX format file.
+ It provides an interface to LyX - insert a citation with a single keypress.
+\layout Subsection
+
+XBoard
+\layout Description
+
+Found: @chk_xboard@
+\layout Description
+
+URL:
+\begin_inset LatexCommand \url[The XBoard homepage]{http://www.research.digital.com/SRC/personal/Tim_Mann/chess.html}
+
+\end_inset
+
+
+\layout Description
+
+Notes: XBoard is a graphical chessboard that can serve as a user interface
+ for GNU Chess, for the Internet Chess Server, or for electronic mail correspond
+ence chess.
+ XBoard can also be used by itself, and it's in this capacity LyX can exploit
+ to as the editor for external chess diagrams.
+ Use the
+\family sans
+File->Save Position
+\family default
+ feature in XBoard to save your chess position as a
+\family typewriter
+.fen
+\family default
+ file.
+ Be sure you specify a relative path compared to your LyX document.
+ You might also want to investigate the
+\family sans
+Edit->Edit Position
+\family default
+ and
+\family sans
+Options->Test Legality
+\family default
+ commands, and remember to use the right mouse to insert new material on
+ the board.
+\the_end
-#This file was created by <lasgoutt> Fri Dec 10 15:52:11 1999
-#LyX 1.0 (C) 1995-1999 Matthias Ettrich and the LyX Team
-\lyxformat 2.15
+#LyX 1.1 created this file. For more info see http://www.lyx.org/
+\lyxformat 2.16
\textclass article
\language default
\inputencoding default
\layout Title
+
+\begin_inset External Bitmap,"filename.txt","parameters"
+
+\end_inset
+
THIS IS THE TITLE OF THE DOCUMENT
\layout Author
--- /dev/null
+# Basic External Templates for LyX
+
+Template RasterImage
+ GuiName "[Bitmap: $$FName]"
+ HelpText
+ A bitmap file.
+ In the parameters box, you can provide optional
+ parameters for the ImageMagick convert program.
+ E.g., use `-border 10x10 -bordercolor black'
+ to surround the picture with a black border
+ when you export to LaTeX.
+ When you export to Ascii, you can provide a
+ number describing how many columns the picture
+ should expand to.
+ This template uses Gimp for editing, and
+ ImageMagick to do conversions. It requires
+ Python for exporting to Ascii and DocBook,
+ and gifscii for exporting to Ascii.
+ HelpTextEnd
+ FileFilter "*.(gif|png|jpg|bmp|pbm|ppm|tga|tif|xpm|xbm)"
+ ViewCommand "display $$Basename.eps"
+ EditCommand "gimp $$FName"
+ AutomaticProduction true
+ Format LaTeX
+ Product "\\includegraphics{$$Basename.eps}"
+ UpdateCommand "convert $$Parameters $$FName $$Basename.eps"
+ Requirement "graphics"
+ FormatEnd
+ Format Ascii
+ Product "$$Contents(\"$$Basename.asc\")"
+ UpdateCommand "python $$Sysdir/scripts/pic2ascii.py $$FName $$Parameters"
+ FormatEnd
+ Format DocBook
+ Product "<graphic fileref=\"$$Basename.eps\"></graphic>"
+ UpdateCommand "python $$Sysdir/scripts/pic2png_eps.py $$FName $$Parameters"
+ FormatEnd
+ Format LinuxDoc
+ Product "[Bitmap: $$FName]"
+ FormatEnd
+TemplateEnd
+
+Template XFig
+ GuiName "[XFig: $$Basename]"
+ HelpText
+ An XFig figure.
+ In the parameters box, you can provide
+ optional parameters for fig2dev in the
+ case of LaTeX export.
+ For Ascii export, you can provide a
+ number that specifies the width of an
+ Ascii approximation of the figure.
+ For DocBook export, you can provide
+ optional parameters for the ImageMagick
+ convert script.
+ This template uses XFig for editing, and
+ fig2dev and ImageMagick to do conversions.
+ It requires Python for exporting to Ascii
+ and DocBook, and gifscii for exporting to
+ Ascii.
+ HelpTextEnd
+ FileFilter "*.fig"
+ ViewCommand "xfig $$FName"
+ EditCommand "xfig $$FName"
+ AutomaticProduction true
+ Format LaTeX
+ Product "$$Contents(\"$$Basename.tex\")"
+ UpdateCommand "fig2dev $$Parameters -L latex $$FName $$Basename.tex"
+ FormatEnd
+ Format Ascii
+ Product "$$Contents(\"$$Basename.asc\")"
+ UpdateCommand "python $$Sysdir/scripts/pic2ascii.py $$FName $$Parameters"
+ FormatEnd
+ Format DocBook
+ Product "<graphic fileref=\"$$Basename.eps\"></graphic>"
+ UpdateCommand "python $$Sysdir/scripts/pic2png_eps.py $$FName $$Parameters"
+ FormatEnd
+ Format LinuxDoc
+ Product "[XFig: $$FName]"
+ FormatEnd
+TemplateEnd
+
+Template ChessDiagram
+ GuiName "[Chess: $$Basename]"
+ HelpText
+ A chess position diagram.
+ This template will use XBoard to view
+ and edit the position. Use the
+ 'File->Save Position' in XBoard to save
+ the position that you want to display.
+ Make sure to give it a '.fen' extension
+ and remember to type in a relative path
+ to the LyX document location.
+ Within XBoard, use 'Edit->Edit Position'
+ to enable general editing of the board.
+ You might also check out the
+ 'Options->Test legality' option, and
+ remember to right click to insert new
+ material in the board.
+ In order for this to work, you have to
+ install the lyxchess.sty which is bundled
+ with LyX, and the chess.sty from CTAN.
+ HelpTextEnd
+ FileFilter "*.fen"
+ ViewCommand "xboard -lpf $$FName"
+ EditCommand "xboard -lpf $$FName"
+ AutomaticProduction true
+ Format LaTeX
+ Product "$$Contents(\"$$Basename.tex\")"
+ UpdateCommand "python $$Sysdir/scripts/fen2latex.py $$FName $$Basename.tex"
+ Requirement "chess"
+ FormatEnd
+ Format Ascii
+ Product "$$Contents(\"$$Basename.asc\")"
+ UpdateCommand "python $$Sysdir/scripts/fen2ascii.py $$FName $$Basename.tex"
+ FormatEnd
+ Format DocBook
+ Product "[Chess: $$Basename]"
+ FormatEnd
+ Format LinuxDoc
+ Product "[Chess: $$FName]"
+ FormatEnd
+TemplateEnd
+
+Template Date
+ GuiName "[Date]"
+ HelpText
+ Todays date.
+ In the parameters box, you can provide
+ optional parameters for the date
+ command.
+ Use empty to get "Mon Jun 12 05:20:41 CEST 2000"
+ Use -u to get "Mon Jun 12 03:20:41 UTC 2000"
+ Use -I to get "2000-06-12".
+ Use -R to get "Mon, 12 Jun 2000 05:20:41 +0200"
+ Use +%d-%m-%Y to get "20-06-2000"
+ Use +%T to get the time as "23:23:00"
+ Read 'info date' for more information.
+ HelpTextEnd
+ FileFilter "*"
+ ViewCommand "xterm -e less $$Tempname"
+ AutomaticProduction true
+ Format LaTeX
+ Product "$$Contents(\"$$Tempname\")"
+ UpdateCommand "python $$Sysdir/scripts/general_command_wrapper.py - $$Tempname date $$Parameters"
+ FormatEnd
+ Format Ascii
+ Product "$$Contents(\"$$Tempname\")"
+ UpdateCommand "python $$Sysdir/scripts/general_command_wrapper.py - $$Tempname date $$Parameters"
+ FormatEnd
+ Format DocBook
+ Product "$$Contents(\"$$Tempname\")"
+ UpdateCommand "python $$Sysdir/scripts/general_command_wrapper.py - $$Tempname date $$Parameters"
+ FormatEnd
+ Format LinuxDoc
+ Product "$$Contents(\"$$Tempname\")"
+ UpdateCommand "python $$Sysdir/scripts/general_command_wrapper.py - $$Tempname date $$Parameters"
+ FormatEnd
+TemplateEnd
+
AUTOMAKE_OPTIONS = foreign
DISTCLEANFILES= *.orig *.rej *~ *.bak reLyX reLyX.1
-MAINTAINERCLEANFILES = Makefile.in
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
bin_SCRIPTS = reLyX noweb2lyx
LYXDATADIRS = reLyX reLyX/Text
LYXDISTDIRS = Text
--- /dev/null
+#!/usr/bin/python
+#
+# Copyright (C) 2000 The LyX Team.
+#
+# This file is distributed under the GPL license.
+#
+# This script will convert a chess position in the FEN
+# format to a chunk of LaTeX to be used with the chess.sty
+# style.
+
+import sys,string,os
+
+os.close(0)
+os.close(1)
+sys.stdin = open(sys.argv[1],"r")
+sys.stdout = open(sys.argv[2],"w")
+
+line = sys.stdin.readline()
+if line[-1] == '\n':
+ line = line[:-1]
+
+line=string.split(line,' ')[0]
+comp=string.split(line,'/')
+
+first = 1
+cont=1
+margin= " "*6
+
+for i in range(8):
+
+ cont = cont + 1
+ tmp=""
+ for j in comp[i]:
+ if j>='0' and j <= '9':
+ for k in range(int(j)):
+ cont = cont + 1
+ x, mod = divmod(cont,2)
+ if mod : tmp = tmp + ' '
+ else : tmp = tmp + '*'
+ else :
+ tmp = tmp + j
+ cont = cont + 1
+
+ if first:
+ first = 0
+ print "\\board{"+tmp+"}"
+ else :
+ print margin+"{"+tmp+"}"
+
+print "\\showboard%"
+
--- /dev/null
+#!/usr/bin/python
+# This is a general wrapper script that will allow
+# us to maintain security in the external material
+# insets.
+# Use like this:
+# general_command_wrapper.py stdin-filename stdout-filename command args
+# Use "-" for stdin-filename and stdout-filename to use the normal stdio
+
+import sys
+import os
+import os.path
+
+
+
+if sys.argv[1] != "-":
+ os.close(0)
+ sys.stdin = open(sys.argv[1],"r")
+if sys.argv[2] != "-":
+ print "Redirecting" + sys.argv[2]
+ os.close(1)
+ os.close(2)
+ sys.stdout = open(sys.argv[2],"w")
+ sys.stderr = open(sys.argv[2],"w")
+
+os.execvp(sys.argv[3], sys.argv[3:])
+print "Could not run " + sys.argv[3]
+
--- /dev/null
+#!/usr/bin/python
+# This script converts a raster format picture into an ascii representation
+# with the suffix .asc
+
+import sys
+import os
+import os.path
+import string
+
+pid = os.fork()
+if pid == 0:
+ os.execvp("convert", ["convert", sys.argv[1], "temporary_filename_that_is_long.gif"])
+ print "Could not run convert"
+ os.exit(1)
+os.wait()
+
+os.system("identify temporary_filename_that_is_long.gif > temp.dim")
+
+fp = open("temp.dim", "r")
+line = fp.readline()
+lines = string.split(line,' ')
+dims = string.split(lines[1],'x')
+xsize = float(dims[0])
+ysize = float(string.split(dims[1],'+')[0])
+
+aspect_ratio = xsize / ysize
+
+if len(sys.argv) > 2:
+ resulting_x = int(sys.argv[2])
+else:
+ resulting_x = 40
+resulting_y = int(resulting_x / aspect_ratio)
+
+os.system("echo s | gifscii temporary_filename_that_is_long.gif %d %d" % (resulting_x, resulting_y))
+
+os.system("tail +3 temporary_filename_that_is_long.asc > temporary_filename_that_is_long2.asc")
+
+pid = os.fork()
+if pid == 0:
+ os.execvp("mv", ["mv", "temporary_filename_that_is_long2.asc", os.path.splitext(sys.argv[1])[0] + ".asc"])
+ print "Could not rename file"
+ os.exit(1)
+os.wait(pid)
+
+os.system("rm temporary_filename_that_is_long.gif temporary_filename_that_is_long.asc")
+
--- /dev/null
+#!/usr/bin/python
+# This script converts a raster format picture into a PNG and EPS file
+
+import sys
+import os
+import os.path
+
+if len(sys.argv) > 2:
+ pars = sys.argv[2]
+
+pid = os.fork()
+if pid == 0:
+ os.execvp("convert", ["convert", pars, sys.argv[1], os.path.splitext(sys.argv[1])[0] + ".eps"])
+ print "convert did not work"
+ os.exit(1)
+os.wait()
+
+pid = os.fork()
+if pid == 0:
+ os.execvp("convert", ["convert", pars, sys.argv[1], os.path.splitext(sys.argv[1])[0] + ".png"])
+ print "convert did not work second time"
+ os.exit(1)
+os.wait()
--- /dev/null
+#!/bin/sh
+convert $1 $2.eps
+convert $1 $2.png
--- /dev/null
+%
+% chess.sty
+% ---------
+% Style file for writing about chess games
+% Author : Piet Tutelaers (internet: rcpt@urc.tue.nl)
+% Version: 1.2 (Febr. 1992)
+% Improvements over version 1.1
+% - added `\v{S}ahovski Informator' symbols
+% -`en passant capture' bug fixed (reported by Jonathan Mestel)
+% -change {--} into \hbox{--} to prevent hyphenation within move
+% -\move's lined up on last row (or digit in case of castling)
+% -handling of promotion improved
+% * Black promotion problem solved (plain TeX)
+% * comment allowed also with promotion
+% * if no promotion piece is provided a default Q(ueen) is supposed
+% Thanks to: Jan Jaap Spreij (puls@cs.rug.nl)
+% -improved interface to plain TeX
+% -language support using the babel package from Johannes Braams
+% (currently support for english, dutch, german and french but you
+% can add an extra language `foreign' by:
+% 1. creating `foreign.sty' for cooperating with `babel'
+% 2. search for FOREIGN and follow the instructions in the comments)
+% - \begin{nochess} ... \end{nochess}
+% -chessfig10 renamed to chessf10 (service to MSDOS users)
+% Version: 1.1 (17 Nov 1990)
+% Improvements over version 1.0:
+% -TeX code cleaned up (thanks to TeX-wizzard Victor Eijkhout)
+% -moving a King does not generate a castling move when this
+% King already moved
+% -renamed internal macro `\\' because LaTeX uses that
+% -better hooks for foreign languages (look for lines marked with
+% %%FOREIGN%%)
+% Torture test:
+% If you change something in the chess.sty style check if everything
+% else is still working with torture-test.ltx (LaTeX) or
+% torture-test.tex (plain TeX).
+% Known problems:
+% -The analysis mode can not be used within arguments of macros
+% not: \centerline{|21.N5*f3|} but: |\centerline{21.N5*f3}|
+% Version: 1.0 (5 Jan 1990)
+%
+
+%
+% Macro specific initialisations
+%
+{\def\format{plain}
+\ifx\fmtname\format
+ \ifcat/@ \gdef\makeatletter{\catcode`@=11\relax}
+ \gdef\resetat{\catcode`@=12\relax}
+ \else\let\makeatletter\relax\let\resetat\relax\fi
+ \gdef\mbox#1{\leavevmode\hbox{#1}}
+ \gdef\Box{\vbox{\hrule height .1pt\hbox{\vrule width .1pt\kern3pt
+ \vbox{\kern6pt}\kern3pt\vrule width .1pt}\hrule height .1pt}}
+ \global\font\sc=cmcsc10
+\else
+ \gdef\line#1{\hbox to \textwidth{#1}}
+\fi}
+
+\makeatletter
+
+%
+% Do we have language support? Otherwise take default language!
+%
+% \ifx\undefined\babel@core@loaded\input english.sty\fi
+
+
+\def\@set[#1#2](#3){%arguments: [a-h1-8](<letter>)
+ \expandafter\xdef\csname#1#2\endcsname{#3}}
+
+\def\@get#1[#2#3]{%arguments:\cs[a-h1-8]
+ \edef#1{\csname#2#3\endcsname}}
+
+\font\Chess=chess20
+
+\newcount\@c % column
+\newcount\@r % row
+\newcount\@sum % row+column
+
+\def\@col{\ifcase\@c\or a\or b\or c\or d\or e\or f\or g\or h\fi}
+
+\def\@showchar{
+ \@get\piece[\@col\the\@r]
+ \if\piece E \ifodd\@sum 0\else Z\fi\else
+ \if\piece P \ifodd\@sum P\else O\fi\else
+ \if\piece p \ifodd\@sum p\else o\fi\else
+ \if\piece R \ifodd\@sum R\else S\fi\else
+ \if\piece B \ifodd\@sum B\else A\fi\else
+ \if\piece N \ifodd\@sum N\else M\fi\else
+ \if\piece r \ifodd\@sum r\else s\fi\else
+ \if\piece b \ifodd\@sum b\else a\fi\else
+ \if\piece n \ifodd\@sum n\else m\fi\else
+ \if\piece K \ifodd\@sum K\else J\fi\else
+ \if\piece Q \ifodd\@sum Q\else L\fi\else
+ \if\piece k \ifodd\@sum k\else j\fi\else
+ \if\piece q \ifodd\@sum q\else l\fi\else
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
+
+\def\@showrow#1{
+ \@r=#1\@c=1
+ \@sum=\@r\advance\@sum by\@c
+ \loop
+ \@showchar
+ \ifnum\@c<8 \advance\@c by1\advance\@sum by1
+ \repeat
+}
+
+\def\showboard{
+\vbox{\offinterlineskip
+ \hrule height1pt
+ \hbox{\vrule width1pt\Chess
+ \vbox{\hbox{\@showrow8}
+ \hbox{\@showrow7}
+ \hbox{\@showrow6}
+ \hbox{\@showrow5}
+ \hbox{\@showrow4}
+ \hbox{\@showrow3}
+ \hbox{\@showrow2}
+ \hbox{\@showrow1}}%
+ \vrule width1pt}
+ \hrule height1pt}
+}
+
+% inner loop needs extra { ... }
+
+\def\@emptyboard{
+ \@r=1
+ \loop
+ {\@c=1
+ \loop
+ \@set[\@col\the\@r](E)
+ \ifnum\@c<8 \advance\@c by1
+ \repeat}
+ \ifnum\@r<8 \advance\@r by 1
+ \repeat
+}
+
+\def\@initboard{
+% empty squares
+ \@r=3
+ \loop
+ {\@c=1
+ \loop
+ \@set[\@col\the\@r](E)
+ \ifnum\@c<8 \advance\@c by1
+ \repeat}
+ \ifnum\@r<6 \advance\@r by 1
+ \repeat
+% pawns
+ \@c=1
+ \loop
+ \@set[\@col2](P)\@set[\@col7](p)
+ \ifnum\@c<8 \advance\@c by1
+ \repeat
+% pieces
+ \@set[a1](R)\@set[h1](R)
+ \@set[a8](r)\@set[h8](r)
+ \@set[b1](N)\@set[g1](N)
+ \@set[b8](n)\@set[g8](n)
+ \@set[c1](B)\@set[f1](B)
+ \@set[c8](b)\@set[f8](b)
+ \@set[d1](Q)\@set[e1](K)
+ \@set[d8](q)\@set[e8](k)
+}
+
+%
+% The next part defines a user friendly notation for chess moves.
+% Some examples: |21. Nf3-e5, Ke8*f8 22. 0-0-0+, Bh8*a1|
+% : |21.: Ke8*f8 22. Bh8*a1, 0-0|
+% : |21 Nfe5 K*f8 22 0-0-0! B*a1|
+% : |21: K*f8 22 B*a1 0-0|
+%
+
+\font\Fig=chessf10
+
+\gdef\@king{{\Fig K}}
+\gdef\@queen{{\Fig Q}}
+\gdef\@rook{{\Fig R}}
+\gdef\@bishop{{\Fig B}}
+\gdef\@knight{{\Fig N}}
+\gdef\@dash{\hbox{--}}
+\gdef\@capt{$\times$}
+\gdef\@dots{~$\ldots$,}
+\gdef\@dot{\char46 }
+
+%
+% Make character codes for pieces depending on current language.
+% (I cann't derive the Black values from the White using `\lowercase'!)
+%
+
+\def\define@White@pieces#1#2#3#4#5#6{% define character codes for White pieces
+ \chardef\king@=`#1 \def\uc@king{#1}
+ \chardef\queen@=`#2 \def\uc@queen{#2}
+ \chardef\rook@=`#3 \def\uc@rook{#3}
+ \chardef\bishop@=`#4\def\uc@bishop{#4}
+ \chardef\knight@=`#5\def\uc@knight{#5}
+ \chardef\pawn@=`#6 \def\uc@pawn{#6}}
+\def\define@Black@pieces#1#2#3#4#5#6{% and now the Black pieces
+ \def\lc@king{#1}\def\lc@queen{#2}\def\lc@rook{#3}
+ \def\lc@bishop{#4}\def\lc@knight{#5}\def\lc@pawn{#6}}
+\def\activate@pieces{% make them active
+ \catcode\king@=\active\catcode\queen@=\active\catcode\rook@=\active%
+ \catcode\bishop@=\active\catcode\knight@=\active}
+\def\deactivate@pieces{% make them inactive
+ \catcode\king@=11\catcode\queen@=11\catcode\rook@=11%
+ \catcode\bishop@=11\catcode\knight@=11}
+\def\ifcurrentlanguage#1#2{%if language defined then compare with \language
+ \expandafter\ifx\csname l@#1\endcsname\relax%
+ \else\ifnum\language=\expandafter\csname l@#1\endcsname\relax#2\fi\fi}
+\def\select@pieces{% select pieces depending on language
+ \ifcurrentlanguage{english}{%
+ \define@White@pieces{K}{Q}{R}{B}{N}{P}
+ \define@Black@pieces{k}{q}{r}{b}{n}{p}}
+ \ifcurrentlanguage{dutch}{%
+ \define@White@pieces{K}{D}{T}{L}{P}{I}
+ \define@Black@pieces{k}{d}{t}{l}{p}{i}}
+ \ifcurrentlanguage{german}{%
+ \define@White@pieces{K}{D}{T}{L}{S}{B}
+ \define@Black@pieces{k}{d}{t}{l}{s}{b}}
+ \ifcurrentlanguage{french}{%
+ \define@White@pieces{R}{D}{T}{F}{C}{P}
+ \define@Black@pieces{r}{d}{t}{f}{c}{p}}
+% Define here your language and choose an unique set of uppercase letters
+% for the White pieces (KING, QUEEN, etc.) and the corresponding lowercase
+% letters for the Black pieces (king, queen, etc.).
+% \ifcurrentlanguage{FOREIGN}{%
+% \define@White@pieces{KING}{QUEEN}{ROOK}{BISHOP}{KNIGHT}{PAWN}
+% \define@Black@pieces{king}{queen}{rook}{bishop}{knight}{pawn}}
+ }
+\def\let@pieces#1#2#3#4#5{% let character codes be macros
+ \let#1=\@king\let#2=\@queen\let#3=\@rook%
+ \let#4=\@bishop\let#5=\@knight}
+
+\catcode`|=\active\select@pieces
+{\catcode`:=\active\catcode`.=\active\catcode`*=\active\catcode`-=\active
+ \activate@pieces
+ \gdef\trigger@pieces{
+ \catcode`:=\active\catcode`.=\active\catcode`*=\active\catcode`-=\active
+ \activate@pieces
+ % I would like to say ``\let\king@=\@king'' but how?
+ \ifcurrentlanguage{english}{\let@pieces{K}{Q}{R}{B}{N}}%
+ \ifcurrentlanguage{dutch}{\let@pieces{K}{D}{T}{L}{P}}%
+ \ifcurrentlanguage{german}{\let@pieces{K}{D}{T}{L}{S}}%
+ \ifcurrentlanguage{french}{\let@pieces{R}{D}{T}{F}{C}}%
+% Fill in your language and the uppercase letters for KING, QUEEN, etc.
+% \ifcurrentlanguage{FOREIGN}{\let@pieces{KING}{QUEEN}{ROOK}{BISHOP}{KNIGHT}}%
+% Your language will be activated by FOREIGN.sty.
+ \let-=\@dash\let*=\@capt\let:=\@dots\let.=\@dot}%
+ \gdef\@notation{\begingroup\let|=\endgroup\trigger@pieces}%
+%
+% Provide a `nochess' environment in which the `|' character becomes
+% inactive for situations where the `|' is already in use (like in
+% the LaTeX `tabular' environment for example).
+%
+ \gdef\nochess{\begingroup\let|=\relax\catcode`\|=12\relax
+ \catcode`:=12 \catcode`.=12 \catcode`*=12 \catcode`-=12
+ \deactivate@pieces\let\endnochess=\endgroup}
+ \gdef\chess{\begingroup\let\endchess=\endgroup\trigger@pieces}
+}
+\let|=\@notation
+
+%
+% Next part provides a ply (half move) generator
+%
+
+\newif\ifWhite \newif\ifFigure \newif\ifcapture
+
+%
+% next newif's needed for castling
+%
+\newif\ifKnotmoved \newif\ifknotmoved
+\newif\ifcastling \newif\ifoo
+
+%
+% Globals for special pawn moves (en passant capture and promotion)
+%
+
+\newif\ifenpassant \newif\ifpromotion
+
+\def\@color#1{ % Color of a piece 0: none, -1: black, 1: white
+ \if #1E0\else
+ \ifnum`#1=\uccode`#11\else-1\fi\fi}
+
+%
+% No checking is done for validity of moves, only legal moves behave well!!
+%
+
+\def\@ply#1#2#3#4#5 {% Syntax: [a-h][1-8][a-h][1-8]{Q|R|B|N}{Comment}
+ \@get\piece[#1#2]\@get\capture[#3#4]\Figuretrue
+ \if\capture E\capturefalse\else\capturetrue\fi
+ \ifWhite
+ \if\piece P\Figurefalse
+ \if#46
+ \if\eprow#3\capturetrue\enpassanttrue\fi
+ \xdef\eprow{x}%
+ \else
+ \xdef\eprow{x}%
+ \if#22
+ \if#44\xdef\eprow{#3}\fi
+ \else
+ \if#48\promotiontrue\fi
+ \fi
+ \fi
+ \else\xdef\eprow{x}
+ \if\piece K% check for possible castling
+ \ifKnotmoved
+ \if#3g\if#41\castlingtrue\ootrue\fi
+ \else\if#3c\if#41\castlingtrue\oofalse\fi\fi
+ \fi
+ \global\Knotmovedfalse
+ \fi
+ \fi
+ \fi
+ \ifcastling
+ \@set[#1#2](E)\@set[#3#4](K)%
+ \ifoo 0\@dash0\rlap{#5}\@set[f1](R)\@set[h1](E)%
+ \else 0\@dash0\@dash0\rlap{#5}\@set[d1](R)\@set[a1](E)\fi
+ \castlingfalse
+ \else
+ \ifFigure{\Fig\piece}\fi
+ #1#2\ifcapture\@capt\else\@dash\fi#3#4%
+ \rlap{\ifpromotion\expandafter\promovendus#5XYZ\else#5\fi}%
+ \@set[#1#2](E)%
+ \ifpromotion\@set[#3#4](\PROM)\else\@set[#3#4](\piece)\fi
+ \ifenpassant\@set[#3#2](E)\enpassantfalse\fi
+ \fi
+ \global\Whitefalse
+ \else % ``same'' for Black
+ \if\piece p\Figurefalse
+ \if#43
+ \if\eprow#3\capturetrue\enpassanttrue\fi
+ \xdef\eprow{x}%
+ \else
+ \xdef\eprow{x}%
+ \if#27
+ \if#45\xdef\eprow{#3}\fi
+ \else
+ \if#41\promotiontrue\fi
+ \fi
+ \fi
+ \else\xdef\eprow{x}
+ \if\piece k
+ \ifknotmoved
+ \if#3g\if#48\castlingtrue\ootrue\fi
+ \else\if#3c\if#48\castlingtrue\oofalse\fi\fi
+ \fi
+ \global\knotmovedfalse
+ \fi
+ \fi
+ \fi
+ \ifcastling
+ \@set[#1#2](E)\@set[#3#4](k)%
+ \ifoo 0\@dash0\rlap{#5}\@set[f8](r)\@set[h8](E)%
+ \else 0\@dash0\@dash0\rlap{#5}\@set[d8](r)\@set[a8](E)\fi%
+ \castlingfalse
+ \else
+ \ifFigure{\Fig\if\piece rR\else\if\piece bB\else\if\piece nN\else
+ \if\piece qQ\else K\fi\fi\fi\fi}\fi
+ #1#2\ifcapture\@capt\else\@dash\fi#3#4%
+ \rlap{\ifpromotion\expandafter\promovendus#5XYZ\else#5\fi}%
+ \@set[#1#2](E)%
+ \ifpromotion\@set[#3#4](\prom)\else\@set[#3#4](\piece)\fi
+ \ifenpassant\@set[#3#2](E)\enpassantfalse\fi
+ \fi
+ \global\Whitetrue
+ \fi}
+
+%
+% Promovendus: treat first char of argument as promotion piece if queen,
+% rook, knight or bishop; otherwise consider it as comment and take queen
+% as default promotion. Leave in \PROM White promoting piece (Q|R|B|N)
+% and in \prom Black's version (q|r|b|n).
+%
+
+\def\promovendus#1#2Z{%
+ \if#1X\def\C{}\gdef\PROM{Q}\gdef\prom{q}%
+ \else
+ \ifnum`#1=\queen@ \gdef\PROM{Q}\gdef\prom{q}\def\C{\@comment#2}\else
+ \ifnum`#1=\rook@ \gdef\PROM{R}\gdef\prom{r}\def\C{\@comment#2}\else
+ \ifnum`#1=\bishop@\gdef\PROM{B}\gdef\prom{b}\def\C{\@comment#2}\else
+ \ifnum`#1=\knight@\gdef\PROM{N}\gdef\prom{n}\def\C{\@comment#2}\else
+ \gdef\PROM{Q}\gdef\prom{q}\def\C{\comment#1#2}%
+ \fi\fi\fi\fi\fi%
+ {\Fig\PROM}{\C}}
+\def\@comment#1XY{#1}
+
+\newcount\movecount \movecount=0
+
+\def\showmove#1#2{\par
+ \line{\strut\hbox to1cm{\hfil\the\movecount.}%
+ \hbox to2.8cm{\hfil#1}\hbox to2.8cm{\hfil#2}\hfil}\par}
+
+\def\move#1 #2 {
+ \advance\movecount by 1
+ \showmove{\@ply#1 }{\@ply#2 }}
+
+\def\ply#1 {
+ \ifWhite
+ \advance\movecount by 1
+ \showmove{\@ply#1 }{}
+ \else
+ \showmove{$\ldots$}{\@ply#1 }
+ \fi}
+
+\def\newgame{\vskip0pt\movecount=0 \@initboard
+ \Whitetrue\castlingfalse\xdef\eprow{x}
+ \Knotmovedtrue\knotmovedtrue
+ \promotionfalse\enpassantfalse}
+
+\def\@dolist{\afterassignment\@dodolist\let\@@next= } % Answer 11.5 TeXbook
+\def\@dodolist{\ifx\@@next\@endlist \let\@@next\relax % adapted to generate
+ \else \@nextitem\let\@@next\@dolist \fi % chess diagrams
+ \@@next}
+
+\def\@endlist{\@endlist}
+
+\def\@nextitem{%
+ \if\@@next\space \@set[\@col\the\@r](E)\else
+ \if\@@next * \@set[\@col\the\@r](E)\else
+ \if\@@next\uc@pawn \@set[\@col\the\@r](P)\else
+ \if\@@next\lc@pawn \@set[\@col\the\@r](p)\else
+ \if\@@next\uc@rook \@set[\@col\the\@r](R)\else
+ \if\@@next\lc@rook \@set[\@col\the\@r](r)\else
+ \if\@@next\uc@bishop \@set[\@col\the\@r](B)\else
+ \if\@@next\lc@bishop \@set[\@col\the\@r](b)\else
+ \if\@@next\uc@knight \@set[\@col\the\@r](N)\else
+ \if\@@next\lc@knight \@set[\@col\the\@r](n)\else
+ \if\@@next\uc@queen \@set[\@col\the\@r](Q)\else
+ \if\@@next\lc@queen \@set[\@col\the\@r](q)\else
+ \if\@@next\uc@king \@set[\@col\the\@r](K)\else
+ \if\@@next\lc@king \@set[\@col\the\@r](k)\else
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+ \advance\@c by1}
+
+\def\@initrow#1#2{\@r=#1\@c=1\@dolist#2\@endlist}
+
+%
+% For setting up a position
+%
+\def\board#1#2#3#4#5#6#7#8{
+ \@initrow8{#1}
+ \@initrow7{#2}
+ \@initrow6{#3}
+ \@initrow5{#4}
+ \@initrow4{#5}
+ \@initrow3{#6}
+ \@initrow2{#7}
+ \@initrow1{#8}}
+
+%
+% Next macros for defining chess position (thanks to Victor Eijkhout)
+%
+\def\White(#1){\def\match{xxx}\xWhite#1,xxx,}
+\def\xWhite#1,{\def\temp{#1}
+ \ifx\temp\match \else \WhitePieceOrPawn#1XY \expandafter\xWhite \fi}
+\def\WhitePieceOrPawn#1#2#3#4Y{%
+ \if#3X \@set[#1#2](P)
+ \else\ifnum`#1=\king@ \@set[#2#3](K)\else % King
+ \ifnum`#1=\queen@ \@set[#2#3](Q)\else % Queen
+ \ifnum`#1=\rook@ \@set[#2#3](R)\else % Rook
+ \ifnum`#1=\bishop@\@set[#2#3](B)\else % Bishop
+ \ifnum`#1=\knight@\@set[#2#3](N)\else % kNight
+ \fi\fi\fi\fi\fi
+ \fi}
+
+\def\Black(#1){\def\match{xxx}\xBlack#1,xxx,}
+\def\xBlack#1,{\def\temp{#1}
+ \ifx\temp\match \else \BlackPieceOrPawn#1XY \expandafter\xBlack \fi}
+\def\BlackPieceOrPawn#1#2#3#4Y{
+ \if#3X\@set[#1#2](p)
+ \else\ifnum`#1=\king@ \@set[#2#3](k)\else % King
+ \ifnum`#1=\queen@ \@set[#2#3](q)\else % Queen
+ \ifnum`#1=\rook@ \@set[#2#3](r)\else % Rook
+ \ifnum`#1=\bishop@\@set[#2#3](b)\else % Bishop
+ \ifnum`#1=\knight@\@set[#2#3](n)\else % kNight
+ \fi\fi\fi\fi\fi
+ \fi}
+
+\def\position{\begingroup%
+ \@emptyboard\movecount=0\xdef\eprow{x}
+ \global\Whitetrue\global\castlingfalse
+ \global\Knotmovedtrue\global\knotmovedtrue
+ \global\promotionfalse\global\enpassantfalse}
+\def\endposition{\endgroup}
+
+% And now we define most symbols that are used in `\v{S}ahovski Informator'
+% (Chess Informant). For a complete list see Informant#51 (1991) pp 10-12.
+% If you add symbols realize that the macros should be usable by plain TeX
+% and LaTeX and that the (La)TeX names should be suggestive and clear!
+% But don't use uppercase letters or existing names (center)!
+% Thanks go to John Saba (saba@ccit.arizona.edu) and Henry Thomas
+% (hthomas@irisa.fr) for their help in defining next symbols.
+\font\symbolten=cmsy10 \font\smrm=cmr6 \font\symbolsix=cmsy6
+\def\wbetter{\mbox{\baselineskip0pt$\vcenter{\vbox{\hbox{+}\hbox{=}}}$}}
+\def\bbetter{\mbox{\baselineskip0pt
+ $\vcenter{\vbox{\hbox{=}\kern-.3ex\hbox{+}}}$}}
+\def\wupperhand{\mbox{$\pm$}}
+\def\bupperhand{\mbox{$\mp$}}
+\def\wdecisive{\mbox{$+\hbox{}-$}}
+\def\bdecisive{\mbox{$-\hbox{}+$}}
+\def\equal{=}
+\def\unclear{\mbox{$\infty$}}
+\def\compensation{\mbox{\baselineskip0pt$\vcenter{\vbox{%
+ \hbox{\kern.056em\vbox{\hrule width0.89em\kern0.35ex\hrule width0.89em}}
+ \kern.2ex\hbox{$\infty$}}}$}}
+% next symbol should be build using METAFONT
+\def\devadvantage{{\symbolten\char'015}\kern-4.8pt
+ \vrule width 2.4pt height6pt depth-5.6pt
+ \vrule width .4pt height8pt depth-5.6pt\kern2.4pt}
+\def\moreroom{{\symbolten\char'015}}
+\def\withattack{$\rightarrow$}
+\def\withinit{$\uparrow$}
+\def\counterplay{\hbox{\baselineskip0pt%
+ $\vcenter{\vbox{\hbox{$\leftarrow$}\hbox{$\rightarrow$}}}$}}
+\def\zugzwang{$\odot$}
+\def\mate{\kern.4pt\mbox{%
+ \vrule width2ex height1.18ex depth-1.1ex\kern-2ex
+ \vrule width2ex height.52ex depth-.44ex\kern-1.381ex
+ \vrule width.08ex height1.8ex depth.2ex\kern0.615ex
+ \vrule width.08ex height1.8ex depth.2ex\kern0.406ex}\kern.4pt}
+\def\withidea{$\triangle$}
+\def\onlymove{$\Box$}
+\def\betteris{\mbox{\baselineskip0pt
+ $\vcenter{\vbox{\hbox{$\frown$}\kern-0.35ex\hrule width0.95em}}$}}
+\def\file{$\Leftrightarrow$}
+% next symbol should be build using METAFONT
+\def\diagonal{$\nearrow$}
+\def\centre{$\Box$\kern-.6em\raise.54ex\hbox{\smrm\char'053}}
+\def\kside{$\gg$}
+\def\qside{$\ll$}
+\def\weakpt{$\times$}
+\def\ending{$\perp$}
+% John Saba's method:
+\def\blackbox{\vrule height .8ex width 1.2ex depth 0ex}
+\def\whitebox{\vbox{\hrule height .1pt\hbox{\vrule width .1pt\kern.6ex
+ \vbox{\kern.8ex}\kern.6ex\vrule width .1pt}\hrule height .1pt}}
+\def\bishoppair{\whitebox\kern-2pt\raise1.8pt\hbox{\whitebox}}
+\def\opposbishops{\whitebox\kern-2pt\raise1.8pt\hbox{\blackbox}}
+\def\samebishops{\blackbox\kern-2pt\raise1.8pt\hbox{\blackbox}}
+% My method
+%\def\bishoppair{\setbox0=\hbox{%
+% \vrule width1.4ex height1ex depth-.92ex\kern-1.4ex
+% \vrule width1.4ex height.08ex depth0pt\kern-1.4ex
+% \vrule width.08ex height1ex depth0ex\kern1.24ex
+% \vrule width.08ex height1ex depth0ex}%
+% \kern.4pt\mbox{\copy0\kern-.6ex\raise0.56ex\box0}\kern.4pt}
+%\def\opposbishops{\kern.4pt\mbox{%
+% \vrule width1.4ex height1ex depth-.92ex\kern-1.4ex
+% \vrule width1.4ex height.08ex depth0pt\kern-1.4ex
+% \vrule width.08ex height1ex depth0ex\kern1.24ex
+% \vrule width.08ex height1ex depth0ex\kern-.6ex
+% \vrule width1.4ex height1.56ex depth-0.56ex}\kern.4pt }
+%\def\samebishops{\kern.4pt\mbox{%
+% \vrule width1.4ex height1ex depth0ex\kern-.6ex
+% \vrule width1.4ex height1.56ex depth-0.56ex}\kern.4pt}
+\def\unitedpawns{$\circ\kern-.05em\circ$}
+\def\seppawns{$\circ\kern-.3em\cdot\kern-.35em\cdot\kern-.1em\circ$}
+\def\doublepawns{\mbox{\baselineskip0pt
+ $\vcenter{\vbox{\hbox{$\circ$}\vskip.8pt\hbox{$\circ$}}}$}}
+% Next symbol still not perfect ...
+\def\passedpawn{\mbox{\baselineskip0pt
+ $\vcenter{\vbox{\hbox{\kern0.14em\symbolsix\char'042}\hbox{$\circ$}}}$}}
+\def\morepawns{$>$}
+\def\timelimit{$\oplus$}
+\def\novelty{{\sc N}}
+\def\comment{{\sc RR}}
+\def\various{{\sc R}}
+\def\without{\kern.4pt\mbox{%
+ \vrule width 1ex height.08ex depth0ex\kern-0.08ex
+ \vrule width0.08ex height1.5ex depth0ex}\kern.4pt}
+\def\with{\kern.4pt\mbox{%
+ \vrule width 0.08ex height1.5ex depth0ex\kern-0.08ex
+ \vrule width 1ex height.08ex depth0ex}\kern.4pt}
+\def\etc{$\parallel$}
+\def\see{\kern.4pt\mbox{\vrule width 1em height.54ex depth-.46ex}\kern.4pt}
+
src/bullet_forms.C
src/bullet_forms_cb.C
src/Chktex.C
+src/cite.C
src/ColorHandler.C
src/combox.C
src/credits.C
src/filedlg.C
src/FontLoader.C
src/form1.C
+src/frontends/xforms/FormCopyright.C
+src/frontends/xforms/form_copyright.C
+src/frontends/xforms/FormPreferences.C
+src/frontends/xforms/form_preferences.C
+src/frontends/xforms/FormPrint.C
+src/frontends/xforms/form_print.C
src/gettext.h
src/insets/figinset.C
src/insets/form_graphics.C
src/insets/form_url.C
src/insets/insetbib.C
src/insets/inset.C
+src/insets/insetcite.C
src/insets/inseterror.C
src/insets/insetert.C
+src/insets/insetexternal.C
src/insets/insetfoot.C
src/insets/insetgraphics.C
src/insets/insetinclude.C
#include "BufferView.h"
#include "BufferView_pimpl.h"
#include "lyxtext.h"
+#include "WorkArea.h"
BufferView::BufferView(LyXView * o, int xpos, int ypos,
}
-#if 0
-extern "C" {
- void C_BufferView_CursorToggleCB(FL_OBJECT * ob, long buf)
- {
- BufferView::cursorToggleCB(ob, buf);
- }
-}
-#endif
-
void BufferView::enterView()
{
pimpl_->enterView();
}
-void BufferView::update(signed char f)
+void BufferView::update(UpdateCodes f)
{
pimpl_->update(f);
}
}
-unsigned short BufferView::paperWidth() const
+int BufferView::workWidth() const
{
- return text->paperWidth();
+ return pimpl_->workarea_->workWidth();
}
{
pimpl_->stuffClipboard(stuff);
}
+
+
+BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
+ BufferView::UpdateCodes uc2)
+{
+ return static_cast<BufferView::UpdateCodes>
+ (static_cast<int>(uc1) | static_cast<int>(uc2));
+}
///
class BufferView {
public:
+ ///
+ enum UpdateCodes {
+ UPDATE = 0,
+ SELECT = 1,
+ FITCUR = 2,
+ CHANGE = 4
+ };
+
///
BufferView(LyXView * owner, int , int , int, int);
///
///
void update();
///
- void update(signed char f);
+ void update(UpdateCodes uc);
///
void updateScrollbar();
///
*/
LyXText * text;
///
- unsigned short paperWidth() const;
+ int workWidth() const;
///
UpdatableInset * the_locking_inset;
///
Pimpl * pimpl_;
};
+
+BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
+ BufferView::UpdateCodes uc2);
+
#endif
while (par) {
// this has to be done before the delete
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
- text->SetCursor(cursor, par, 0);
+ text->SetCursor(this, cursor, par, 0);
if (par->AutoDeleteInsets()){
a = true;
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
- text->RedoParagraphs(cursor,
+ text->RedoParagraphs(this, cursor,
cursor.par()->Next());
- text->FullRebreak();
+ text->FullRebreak(this);
}
}
par = par->next;
// avoid forbidden cursor positions caused by error removing
if (tmpcursor.pos() > tmpcursor.par()->Last())
tmpcursor.pos(tmpcursor.par()->Last());
- text->SetCursorIntern(tmpcursor.par(), tmpcursor.pos());
+ text->SetCursorIntern(this, tmpcursor.par(), tmpcursor.pos());
return a;
}
continue;
InsetError * new_inset = new InsetError(msgtxt);
- text->SetCursorIntern(texrowpar, tmppos);
- text->InsertInset(new_inset);
- text->FullRebreak();
+ text->SetCursorIntern(this, texrowpar, tmppos);
+ text->InsertInset(this, new_inset);
+ text->FullRebreak(this);
}
// Restore the cursor position
- text->SetCursorIntern(cursor.par(), cursor.pos());
+ text->SetCursorIntern(this, cursor.par(), cursor.pos());
}
} else {
texrowpar = text->GetParFromID(tmpid);
}
- text->SetCursor(texrowpar, tmppos);
+ text->SetCursor(this, texrowpar, tmppos);
}
bool BufferView::insertInset(Inset * inset, string const & lout,
#endif
// not quite sure if we want this...
- text->SetCursorParUndo();
+ text->SetCursorParUndo(buffer());
text->FreezeUndo();
beforeChange();
if (!lout.empty()) {
- update(-2);
- text->BreakParagraph();
- update(-1);
+ update(BufferView::SELECT|BufferView::FITCUR);
+ text->BreakParagraph(this);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
if (text->cursor.par()->Last()) {
- text->CursorLeft();
+ text->CursorLeft(this);
- text->BreakParagraph();
- update(-1);
+ text->BreakParagraph(this);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
pair<bool, LyXTextClass::size_type> lres =
lay = 0;
}
- text->SetLayout(lay);
+ text->SetLayout(this, lay);
- text->SetParagraph(0, 0,
+ text->SetParagraph(this, 0, 0,
0, 0,
VSpace(VSpace::NONE), VSpace(VSpace::NONE),
LYX_ALIGN_LAYOUT,
string(),
0);
- update(-1);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
text->current_font.setLatex(LyXFont::OFF);
}
- text->InsertInset(inset);
+ text->InsertInset(this, inset);
#if 1
// if we enter a text-inset the cursor should be to the left side
// of it! This couldn't happen before as Undo was not handled inside
// does not return the inset!
if (inset->IsTextInset()) {
if (text->cursor.par()->isRightToLeftPar(buffer()->params))
- text->CursorRight();
+ text->CursorRight(this);
else
- text->CursorLeft();
+ text->CursorLeft(this);
}
#endif
- update(-1);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
text->UnFreezeUndo();
return true;
beforeChange();
text->FinishUndo();
insertInset(new_inset);
- text->CursorLeft();
- update(1);
+ text->CursorLeft(this);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
new_inset->Edit(this, 0, 0, 0);
}
if ( find(labels.begin(),labels.end(),label)
!= labels.end()) {
beforeChange();
- text->SetCursor(it.getPar(), it.getPos());
+ text->SetCursor(this, it.getPar(), it.getPos());
text->sel_cursor = text->cursor;
- update(0);
+ update(BufferView::SELECT|BufferView::FITCUR);
return true;
}
}
if (par->previous
&& par->previous->footnoteflag !=
LyXParagraph::CLOSED_FOOTNOTE){ /* should be */
- text->SetCursorIntern(par->previous,
+ text->SetCursorIntern(this,
+ par->previous,
0);
- text->OpenFootnote();
+ text->OpenFootnote(this);
}
}
} else {
)
)
) {
- text->SetCursorIntern(par, 0);
- text->CloseFootnote();
+ text->SetCursorIntern(this, par, 0);
+ text->CloseFootnote(this);
}
}
par = par->next;
}
- text->SetCursorIntern(cursor.par(), cursor.pos());
+ text->SetCursorIntern(this, cursor.par(), cursor.pos());
redraw();
fitCursor();
//updateScrollbar();
owner()->getMiniBuffer()->Set(_("Open/Close..."));
hideCursor();
beforeChange();
- update(-2);
- text->OpenStuff();
- update(0);
+ update(BufferView::SELECT|BufferView::FITCUR);
+ text->OpenStuff(this);
+ update(BufferView::SELECT|BufferView::FITCUR);
setState();
}
}
owner()->getMiniBuffer()->Set(_("Open/Close..."));
hideCursor();
beforeChange();
- update(-2);
- text->ToggleFootnote();
- update(0);
+ update(BufferView::SELECT|BufferView::FITCUR);
+ text->ToggleFootnote(this);
+ update(BufferView::SELECT|BufferView::FITCUR);
setState();
}
}
owner()->getMiniBuffer()->Set(_("Undo"));
hideCursor();
beforeChange();
- update(-2);
- if (!text->TextUndo())
+ update(BufferView::SELECT|BufferView::FITCUR);
+ if (!text->TextUndo(this))
owner()->getMiniBuffer()->Set(_("No further undo information"));
else
- update(-1);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
setState();
}
}
owner()->getMiniBuffer()->Set(_("Redo"));
hideCursor();
beforeChange();
- update(-2);
- if (!text->TextRedo())
+ update(BufferView::SELECT|BufferView::FITCUR);
+ if (!text->TextRedo(this))
owner()->getMiniBuffer()->Set(_("No further redo information"));
else
- update(-1);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
setState();
}
}
{
if (available()) {
hideCursor();
- update(-2);
+ update(BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
insertInset(new_inset);
{
if (available()) {
hideCursor();
- update(-2);
+ update(BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::LDOTS);
insertInset(new_inset);
{
if (available()) {
hideCursor();
- update(-2);
+ update(BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::END_OF_SENTENCE);
insertInset(new_inset);
{
if (available()) {
hideCursor();
- update(-2);
+ update(BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR);
insertInset(new_inset);
{
if (available()) {
hideCursor();
- update(-2);
- text->InsertChar(LyXParagraph::META_NEWLINE);
- update(-1);
+ update(BufferView::SELECT|BufferView::FITCUR);
+ text->InsertChar(this, LyXParagraph::META_NEWLINE);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
{
if (available()) {
hideCursor();
- update(-2);
+ update(BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
insertInset(new_inset);
{
if (available()) {
hideCursor();
- update(-2);
- text->InsertChar(LyXParagraph::META_HFILL);
- update(-1);
+ update(BufferView::SELECT|BufferView::FITCUR);
+ text->InsertChar(this, LyXParagraph::META_HFILL);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
// clear the selection, even if mark_set
toggleSelection();
text->ClearSelection();
- update(-2);
+ update(BufferView::SELECT|BufferView::FITCUR);
owner()->getMiniBuffer()->Set(_("Paragraph environment type copied"));
}
}
void BufferView::pasteEnvironment()
{
if (available()) {
- text->pasteEnvironmentType();
+ text->pasteEnvironmentType(this);
owner()->getMiniBuffer()->Set(_("Paragraph environment type set"));
- update(1);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
void BufferView::copy()
{
if (available()) {
- text->CopySelection();
+ text->CopySelection(buffer());
// clear the selection, even if mark_set
toggleSelection();
text->ClearSelection();
- update(-2);
+ update(BufferView::SELECT|BufferView::FITCUR);
owner()->getMiniBuffer()->Set(_("Copy"));
}
}
{
if (available()) {
hideCursor();
- update(-2);
- text->CutSelection();
- update(1);
+ update(BufferView::SELECT|BufferView::FITCUR);
+ text->CutSelection(this);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
owner()->getMiniBuffer()->Set(_("Cut"));
}
}
// clear the selection
toggleSelection();
text->ClearSelection();
- update(-2);
+ update(BufferView::SELECT|BufferView::FITCUR);
// paste
- text->PasteSelection();
- update(1);
+ text->PasteSelection(this);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
// clear the selection
toggleSelection();
text->ClearSelection();
- update(-2);
+ update(BufferView::SELECT|BufferView::FITCUR);
}
hideCursor();
beforeChange();
- update(-2);
+ update(BufferView::SELECT|BufferView::FITCUR);
LyXCursor tmp;
- if (!text->GotoNextNote()) {
+ if (!text->GotoNextNote(this)) {
if (text->cursor.pos()
|| text->cursor.par() != text->FirstParagraph()) {
tmp = text->cursor;
text->cursor.par(text->FirstParagraph());
text->cursor.pos(0);
- if (!text->GotoNextNote()) {
+ if (!text->GotoNextNote(this)) {
text->cursor = tmp;
owner()->getMiniBuffer()->Set(_("No more notes"));
LyXBell();
LyXBell();
}
}
- update(0);
+ update(BufferView::SELECT|BufferView::FITCUR);
text->sel_cursor = text->cursor;
}
return 0;
}
- char * string = text->SelectNextWord(value);
+ char * string = text->SelectNextWord(this, value);
return string;
}
hideCursor();
beforeChange();
- text->SelectSelectedWord();
+ text->SelectSelectedWord(this);
toggleSelection(false);
- update(0);
+ update(BufferView::SELECT|BufferView::FITCUR);
}
hideCursor();
beforeChange();
- text->SelectSelectedWord();
+ text->SelectSelectedWord(this);
text->ClearSelection();
- update(0);
+ update(BufferView::SELECT|BufferView::FITCUR);
}
if (!available()) return;
hideCursor();
- update(-2);
+ update(BufferView::SELECT|BufferView::FITCUR);
/* clear the selection (if there is any) */
toggleSelection(false);
- update(-2);
+ update(BufferView::SELECT|BufferView::FITCUR);
/* clear the selection (if there is any) */
toggleSelection(false);
- text->ReplaceSelectionWithString(replacestring.c_str());
+ text->ReplaceSelectionWithString(this, replacestring.c_str());
- text->SetSelectionOverString(replacestring.c_str());
+ text->SetSelectionOverString(this, replacestring.c_str());
// Go back so that replacement string is also spellchecked
for (string::size_type i = 0; i < replacestring.length() + 1; ++i) {
- text->CursorLeftIntern();
+ text->CursorLeftIntern(this);
}
- update(1);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
// End of spellchecker stuff
LyXParagraph::META_INSET) &&
(cursor.par()->GetInset(cursor.pos() - 1) ==
the_locking_inset->GetLockingInset()))
- text->SetCursor(cursor,
+ text->SetCursor(this, cursor,
cursor.par(), cursor.pos() - 1);
y += cursor.y() + the_locking_inset->InsetInInsetY();
pimpl_->screen->ShowManualCursor(x, y, asc, desc,
return; // shouldn't happen
if (kind == Undo::EDIT) // in this case insets would not be stored!
kind = Undo::FINISH;
- text->SetUndo(kind,
+ text->SetUndo(buffer(), kind,
text->cursor.par()->
ParFromPos(text->cursor.pos())->previous,
text->cursor.par()->
// first check for locking insets
if (the_locking_inset) {
if (the_locking_inset == inset) {
- if (text->UpdateInset(inset)){
+ if (text->UpdateInset(this, inset)){
update();
if (mark_dirty){
if (buffer()->isLyxClean())
return;
}
} else if (the_locking_inset->UpdateInsetInInset(this,inset)) {
- if (text->UpdateInset(the_locking_inset)) {
+ if (text->UpdateInset(this, the_locking_inset)) {
update();
if (mark_dirty){
if (buffer()->isLyxClean())
// then check the current buffer
if (available()) {
hideCursor();
- update(-3);
- if (text->UpdateInset(inset)){
+ update(BufferView::UPDATE);
+ if (text->UpdateInset(this, inset)){
if (mark_dirty)
- update(1);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
else
- update(3);
+ update(SELECT);
return;
}
}
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
// this is possible now, since SetCursor takes
// care about footnotes
- text->SetCursorIntern(par, 0);
- text->RedoParagraphs(text->cursor,
+ text->SetCursorIntern(this, par, 0);
+ text->RedoParagraphs(this, text->cursor,
text->cursor.par()->Next());
- text->FullRebreak();
+ text->FullRebreak(this);
}
}
par = par->next;
}
- text->SetCursorIntern(cursor.par(), cursor.pos());
+ text->SetCursorIntern(this, cursor.par(), cursor.pos());
return flag;
}
#include "lyxrc.h"
#include "intl.h"
#include "support/LAssert.h"
+#include "frontends/Dialogs.h"
using std::pair;
using std::endl;
using std::vector;
+using std::make_pair;
/* the selection possible is needed, that only motion events are
* used, where the bottom press event was on the drawing area too */
extern void sigchldhandler(pid_t pid, int * status);
extern int bibitemMaxWidth(Painter &, LyXFont const &);
-#if 0
-extern void FreeUpdateTimer();
-#endif
-#if 0
-extern "C"
-void C_BufferView_CursorToggleCB(FL_OBJECT * ob, long buf);
-#endif
+
static inline
void waitForX()
: bv_(b), owner_(o), cursor_timeout(400)
{
buffer_ = 0;
- workarea = new WorkArea(bv_, xpos, ypos, width, height);
+ workarea_ = new WorkArea(bv_, xpos, ypos, width, height);
screen = 0;
-#if 0
- timer_cursor = 0;
- create_view();
-#else
+
cursor_timeout.callback(BufferView::cursorToggleCB, bv_);
-#endif
current_scrollbar_value = 0;
-#if 0
- fl_set_timer(timer_cursor, 0.4);
-#else
cursor_timeout.start();
-#endif
- workarea->setFocus();
+ workarea_->setFocus();
work_area_focus = true;
lyx_focus = false;
using_xterm_cursor = false;
Painter & BufferView::Pimpl::painter()
{
- return workarea->getPainter();
+ return workarea_->getPainter();
}
// Put the old text into the TextCache, but
// only if the buffer is still loaded.
// Also set the owner of the test to 0
- bv_->text->owner(0);
- textcache.add(bv_->text);
+ // bv_->text->owner(0);
+ textcache.add(buffer_, workarea_->workWidth(), bv_->text);
if (lyxerr.debugging())
textcache.show(lyxerr, "BufferView::buffer");
buffer_->addUser(bv_);
owner_->getMenus()->showMenus();
// If we don't have a text object for this, we make one
- if (bv_->text == 0)
+ if (bv_->text == 0) {
resizeCurrentBuffer();
- else {
+ } else {
updateScreen();
updateScrollbar();
}
screen->first = screen->TopCursorVisible();
redraw();
- updateAllVisibleBufferRelatedPopups();
+ owner_->getDialogs()->updateBufferDependent();
bv_->insetWakeup();
} else {
lyxerr[Debug::INFO] << " No Buffer!" << endl;
owner_->getMenus()->hideMenus();
updateScrollbar();
- workarea->redraw();
+ workarea_->redraw();
// Also remove all remaining text's from the testcache.
// (there should not be any!) (if there is any it is a
void BufferView::Pimpl::resize(int xpos, int ypos, int width, int height)
{
- workarea->resize(xpos, ypos, width, height);
- update(3);
+ workarea_->resize(xpos, ypos, width, height);
+ update(SELECT);
redraw();
}
void BufferView::Pimpl::redraw()
{
lyxerr[Debug::INFO] << "BufferView::redraw()" << endl;
- workarea->redraw();
+ workarea_->redraw();
}
selection = bv_->text->selection;
mark_set = bv_->text->mark_set;
delete bv_->text;
- bv_->text = new LyXText(bv_, workarea->workWidth(), buffer_);
+ bv_->text = new LyXText(bv_);
} else {
// See if we have a text in TextCache that fits
// the new buffer_ with the correct width.
- bv_->text = textcache.findFit(buffer_, workarea->workWidth());
+ bv_->text = textcache.findFit(buffer_, workarea_->workWidth());
if (bv_->text) {
if (lyxerr.debugging()) {
lyxerr << "Found a LyXText that fits:\n";
- textcache.show(lyxerr, bv_->text);
+ textcache.show(lyxerr, make_pair(buffer_, make_pair(workarea_->workWidth(), bv_->text)));
}
// Set the owner of the newly found text
- bv_->text->owner(bv_);
+ // bv_->text->owner(bv_);
if (lyxerr.debugging())
textcache.show(lyxerr, "resizeCurrentBuffer");
} else {
- bv_->text = new LyXText(bv_, workarea->workWidth(), buffer_);
+ bv_->text = new LyXText(bv_);
}
}
updateScreen();
* Mechanism when setting the cursor */
bv_->text->mark_set = mark_set;
if (selection) {
- bv_->text->SetCursor(selstartpar, selstartpos);
+ bv_->text->SetCursor(bv_, selstartpar, selstartpos);
bv_->text->sel_cursor = bv_->text->cursor;
- bv_->text->SetCursor(selendpar, selendpos);
- bv_->text->SetSelection();
- bv_->text->SetCursor(par, pos);
+ bv_->text->SetCursor(bv_, selendpar, selendpos);
+ bv_->text->SetSelection(bv_);
+ bv_->text->SetCursor(bv_, par, pos);
} else {
- bv_->text->SetCursor(par, pos);
+ bv_->text->SetCursor(bv_, par, pos);
bv_->text->sel_cursor = bv_->text->cursor;
bv_->text->selection = false;
}
screen->HideCursor();
bv_->beforeChange();
- update(-2);
+ update(BufferView::SELECT|BufferView::FITCUR);
LyXCursor tmp;
- if (!bv_->text->GotoNextError()) {
+ if (!bv_->text->GotoNextError(bv_)) {
if (bv_->text->cursor.pos()
|| bv_->text->cursor.par() != bv_->text->FirstParagraph()) {
tmp = bv_->text->cursor;
bv_->text->cursor.par(bv_->text->FirstParagraph());
bv_->text->cursor.pos(0);
- if (!bv_->text->GotoNextError()) {
+ if (!bv_->text->GotoNextError(bv_)) {
bv_->text->cursor = tmp;
owner_->getMiniBuffer()
->Set(_("No more errors"));
LyXBell();
}
}
- update(0);
+ update(BufferView::SELECT|BufferView::FITCUR);
bv_->text->sel_cursor = bv_->text->cursor;
}
{
// Regenerate the screen.
delete screen;
- screen = new LyXScreen(*workarea, bv_->text);
+ screen = new LyXScreen(*workarea_, bv_->text);
}
-#if 0
-void BufferView::Pimpl::create_view()
-{
- FL_OBJECT * obj;
-
- //
- // TIMERS
- //
-
- // timer_cursor
- timer_cursor = obj = fl_add_timer(FL_HIDDEN_TIMER,
- 0, 0, 0, 0, "Timer");
- fl_set_object_callback(obj, C_BufferView_CursorToggleCB, 0);
- obj->u_vdata = bv_;
-}
-#endif
-
-
void BufferView::Pimpl::updateScrollbar()
{
/* If the text is smaller than the working area, the scrollbar
* be possible */
if (!buffer_) {
- workarea->setScrollbar(0, 1.0);
+ workarea_->setScrollbar(0, 1.0);
return;
}
// check if anything has changed.
if (max2 == cbth &&
- height2 == workarea->height() &&
+ height2 == workarea_->height() &&
current_scrollbar_value == cbsf)
return; // no
max2 = cbth;
- height2 = workarea->height();
+ height2 = workarea_->height();
current_scrollbar_value = cbsf;
if (cbth <= height2) { // text is smaller than screen
- workarea->setScrollbar(0, 1.0); // right?
+ workarea_->setScrollbar(0, 1.0); // right?
return;
}
- long maximum_height = workarea->height() * 3 / 4 + cbth;
+ long maximum_height = workarea_->height() * 3 / 4 + cbth;
long value = cbsf;
// set the scrollbar
- double hfloat = workarea->height();
+ double hfloat = workarea_->height();
double maxfloat = maximum_height;
float slider_size = 0.0;
int slider_value = value;
- workarea->setScrollbarBounds(0, bv_->text->height - workarea->height());
+ workarea_->setScrollbarBounds(0, bv_->text->height - workarea_->height());
double lineh = bv_->text->DefaultHeight();
- workarea->setScrollbarIncrements(lineh);
+ workarea_->setScrollbarIncrements(lineh);
if (maxfloat > 0.0) {
if ((hfloat / maxfloat) * float(height2) < 3)
slider_size = 3.0/float(height2);
} else
slider_size = hfloat;
- workarea->setScrollbar(slider_value, slider_size / workarea->height());
+ workarea_->setScrollbar(slider_value, slider_size / workarea_->height());
}
unsigned int height = vbt->DefaultHeight();
if (vbt->cursor.y() < screen->first + height) {
- vbt->SetCursorFromCoordinates(0,
+ vbt->SetCursorFromCoordinates(bv_, 0,
screen->first +
height);
} else if (vbt->cursor.y() >
- screen->first + workarea->height() - height) {
- vbt->SetCursorFromCoordinates(0,
+ screen->first + workarea_->height() - height) {
+ vbt->SetCursorFromCoordinates(bv_, 0,
screen->first +
- workarea->height() -
+ workarea_->height() -
height);
}
}
if (buffer_ == 0) return 0;
if (!screen) return 0;
- double value = workarea->getScrollbarValue();
+ double value = workarea_->getScrollbarValue();
if (value == 0) return 0;
float add_value = (bv_->text->DefaultHeight()
+ float(time) * float(time) * 0.125);
- if (add_value > workarea->height())
- add_value = float(workarea->height() -
+ if (add_value > workarea_->height())
+ add_value = float(workarea_->height() -
bv_->text->DefaultHeight());
value -= add_value;
if (value < 0)
value = 0;
- workarea->setScrollbarValue(value);
+ workarea_->setScrollbarValue(value);
bv_->scrollCB(value);
return 0;
if (buffer_ == 0) return 0;
if (!screen) return 0;
- double value= workarea->getScrollbarValue();
- pair<float, float> p = workarea->getScrollbarBounds();
+ double value= workarea_->getScrollbarValue();
+ pair<float, float> p = workarea_->getScrollbarBounds();
double max = p.second;
if (value == max) return 0;
float add_value = (bv_->text->DefaultHeight()
+ float(time) * float(time) * 0.125);
- if (add_value > workarea->height())
- add_value = float(workarea->height() -
+ if (add_value > workarea_->height())
+ add_value = float(workarea_->height() -
bv_->text->DefaultHeight());
value += add_value;
if (value > max)
value = max;
- workarea->setScrollbarValue(value);
+ workarea_->setScrollbarValue(value);
bv_->scrollCB(value);
return 0;
if (selection_possible) {
screen->HideCursor();
- bv_->text->SetCursorFromCoordinates(x, y + screen->first);
+ bv_->text->SetCursorFromCoordinates(bv_, x, y + screen->first);
if (!bv_->text->selection)
- update(-3); // Maybe an empty line was deleted
+ update(BufferView::UPDATE); // Maybe an empty line was deleted
- bv_->text->SetSelection();
+ bv_->text->SetSelection(bv_);
screen->ToggleToggle();
fitCursor();
screen->ShowCursor();
// Right button mouse click on a table
if (button == 3 &&
(bv_->text->cursor.par()->table ||
- bv_->text->MouseHitInTable(xpos, ypos + screen->first))) {
+ bv_->text->MouseHitInTable(bv_, xpos, ypos + screen->first))) {
// Set the cursor to the press-position
- bv_->text->SetCursorFromCoordinates(xpos, ypos + screen->first);
+ bv_->text->SetCursorFromCoordinates(bv_, xpos, ypos + screen->first);
bool doit = true;
// Only show the table popup if the hit is in
// the table, too
- if (!bv_->text->HitInTable(bv_->text->cursor.row(), xpos))
+ if (!bv_->text->HitInTable(bv_,
+ bv_->text->cursor.row(), xpos))
doit = false;
// Hit above or below the table?
if (!bv_->text->selection) {
screen->ToggleSelection();
bv_->text->ClearSelection();
- bv_->text->FullRebreak();
+ bv_->text->FullRebreak(bv_);
screen->Update();
updateScrollbar();
}
// Clear the selection
screen->ToggleSelection();
bv_->text->ClearSelection();
- bv_->text->FullRebreak();
+ bv_->text->FullRebreak(bv_);
screen->Update();
updateScrollbar();
}
if (!inset_hit) // otherwise it was already set in checkInsetHit(...)
- bv_->text->SetCursorFromCoordinates(xpos, ypos + screen_first);
+ bv_->text->SetCursorFromCoordinates(bv_, xpos, ypos + screen_first);
bv_->text->FinishUndo();
bv_->text->sel_cursor = bv_->text->cursor;
bv_->text->cursor.x_fix(bv_->text->cursor.x());
if (screen && button == 1) {
screen->HideCursor();
screen->ToggleSelection();
- bv_->text->SelectWord();
+ bv_->text->SelectWord(bv_);
screen->ToggleSelection(false);
/* This will fit the cursor on the screen
* if necessary */
- update(0);
+ update(BufferView::SELECT|BufferView::FITCUR);
}
}
}
if (buffer_ && screen && button == 1) {
screen->HideCursor();
screen->ToggleSelection();
- bv_->text->CursorHome();
+ bv_->text->CursorHome(bv_);
bv_->text->sel_cursor = bv_->text->cursor;
- bv_->text->CursorEnd();
- bv_->text->SetSelection();
+ bv_->text->CursorEnd(bv_);
+ bv_->text->SetSelection(bv_);
screen->ToggleSelection(false);
/* This will fit the cursor on the screen
* if necessary */
- update(0);
+ update(BufferView::SELECT|BufferView::FITCUR);
}
}
void BufferView::Pimpl::enterView()
{
if (active() && available()) {
- SetXtermCursor(workarea->getWin());
+ SetXtermCursor(workarea_->getWin());
using_xterm_cursor = true;
}
}
void BufferView::Pimpl::leaveView()
{
if (using_xterm_cursor) {
- XUndefineCursor(fl_display, workarea->getWin());
+ XUndefineCursor(fl_display, workarea_->getWin());
using_xterm_cursor = false;
}
}
bv_->text->cursor.par()->table->
CellHasContRow(bv_->text->cursor.par()->table->
GetCellAbove(cell))<0) {
- bv_->text->CursorUp();
+ bv_->text->CursorUp(bv_);
}
}
#endif
// ...or maybe the SetCursorParUndo()
// below isn't necessary at all anylonger?
if (inset_hit->LyxCode() == Inset::REF_CODE) {
- bv_->text->SetCursorParUndo();
+ bv_->text->SetCursorParUndo(bv_->buffer());
}
owner_->getMiniBuffer()->Set(inset_hit->EditMessage());
|| c == LyXParagraph::META_WIDE_TAB
|| c == LyXParagraph::META_ALGORITHM){
// We are one step too far to the right
- bv_->text->CursorLeft();
+ bv_->text->CursorLeft(bv_);
hit = true;
}
}
unsigned int y_tmp = y + screen->first;
LyXCursor cursor;
- bv_->text->SetCursorFromCoordinates(cursor, x, y_tmp);
+ bv_->text->SetCursorFromCoordinates(bv_, cursor, x, y_tmp);
#if 0 // Are you planning to use this Jürgen? (Lgb)
bool move_cursor = ((cursor.par != bv_->text->cursor.par) ||
(cursor.pos != bv_->text->cursor.pos()));
// Check whether the inset really was hit
Inset * tmpinset = cursor.par()->GetInset(cursor.pos());
- LyXFont font = bv_->text->GetFont(cursor.par(), cursor.pos());
+ LyXFont font = bv_->text->GetFont(bv_->buffer(),
+ cursor.par(), cursor.pos());
bool is_rtl = font.isVisibleRightToLeft();
int start_x, end_x;
#if 0
if (move_cursor && (tmpinset != bv_->the_locking_inset))
#endif
- bv_->text->SetCursor(cursor.par(),cursor.pos(),true);
+ bv_->text->SetCursor(bv_, cursor.par(),cursor.pos(),true);
x = x - start_x;
// The origin of an inset is on the baseline
y = y_tmp - (bv_->text->cursor.y());
(cursor.par()->GetInset(cursor.pos() - 1)) &&
(cursor.par()->GetInset(cursor.pos() - 1)->Editable())) {
Inset * tmpinset = cursor.par()->GetInset(cursor.pos()-1);
- LyXFont font = bv_->text->GetFont(cursor.par(), cursor.pos()-1);
+ LyXFont font = bv_->text->GetFont(bv_->buffer(), cursor.par(),
+ cursor.pos()-1);
bool is_rtl = font.isVisibleRightToLeft();
int start_x, end_x;
#if 0
if (move_cursor && (tmpinset != bv_->the_locking_inset))
#endif
- bv_->text->SetCursor(cursor.par(),cursor.pos()-1,true);
+ bv_->text->SetCursor(bv_, cursor.par(),cursor.pos()-1,true);
x = x - start_x;
// The origin of an inset is on the baseline
y = y_tmp - (bv_->text->cursor.y());
// redraw();
//}
- static unsigned int work_area_width = 0;
+ static int work_area_width = 0;
static unsigned int work_area_height = 0;
- bool widthChange = workarea->workWidth() != work_area_width;
- bool heightChange = workarea->height() != work_area_height;
+ bool widthChange = workarea_->workWidth() != work_area_width;
+ bool heightChange = workarea_->height() != work_area_height;
// update from work area
- work_area_width = workarea->workWidth();
- work_area_height = workarea->height();
+ work_area_width = workarea_->workWidth();
+ work_area_height = workarea_->height();
if (buffer_ != 0) {
if (widthChange) {
// All buffers need a resize
} else if (screen) screen->Redraw();
} else {
// Grey box when we don't have a buffer
- workarea->greyOut();
+ workarea_->greyOut();
}
// always make sure that the scrollbar is sane.
// update(-1) -> update(1 + 2 + 4) -> update(7) -> update(SELECT|FITCUR|CHANGE)
// update(1) -> update(1 + 2 + 4) -> update(7) -> update(SELECT|FITCUR|CHANGE)
// update(3) -> update(1) -> update(1) -> update(SELECT)
-void BufferView::Pimpl::update(signed char f)
+
+//void BufferView::Pimpl::update(signed char f)
+void BufferView::Pimpl::update(BufferView::UpdateCodes f)
{
-#if 1
owner_->updateLayoutChoice();
- if (!bv_->text->selection && f > -3)
+ if (!bv_->text->selection && (f & SELECT)) {
bv_->text->sel_cursor = bv_->text->cursor;
-#if 0
- FreeUpdateTimer();
-#endif
- bv_->text->FullRebreak();
-
- update();
-
- if (f != 3 && f != -3) {
- fitCursor();
- //updateScrollbar();
- }
-
- if (f == 1 || f == -1) {
- if (buffer_->isLyxClean()) {
- buffer_->markDirty();
- owner_->getMiniBuffer()->setTimer(4);
- } else {
- buffer_->markDirty();
- }
}
-#else
- owner_->updateLayoutChoice();
- if (!bv_->text->selection && (f & SELECT))
- bv_->text->sel_cursor = bv_->text->cursor;
-#if 1
- //owner_->update_timeout.stop();
-#else
- FreeUpdateTimer();
-#endif
- bv_->text->FullRebreak();
+ bv_->text->FullRebreak(bv_);
update();
if ((f & FITCUR)) {
fitCursor();
- //updateScrollbar();
}
if ((f & CHANGE)) {
buffer_->markDirty();
}
}
-#endif
}
}
set_timer_and_return:
-#if 1
cursor_timeout.restart();
-#else
- fl_set_timer(timer_cursor, 0.4);
-#endif
skip_timer:
return;
}
long y = screen->first;
Row * cursorrow = bv_->text->cursor.row();
- bv_->text->SetCursorFromCoordinates(bv_->text->cursor.x_fix(), y);
+ bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y);
bv_->text->FinishUndo();
// This is to allow jumping over large insets
if ((cursorrow == bv_->text->cursor.row()))
- bv_->text->CursorUp();
+ bv_->text->CursorUp(bv_);
- if (bv_->text->cursor.row()->height() < workarea->height())
+ if (bv_->text->cursor.row()->height() < workarea_->height())
screen->Draw(bv_->text->cursor.y()
- bv_->text->cursor.row()->baseline()
+ bv_->text->cursor.row()->height()
- - workarea->height() + 1 );
+ - workarea_->height() + 1 );
updateScrollbar();
}
long y = screen->first;
bv_->text->GetRowNearY(y);
Row * cursorrow = bv_->text->cursor.row();
- bv_->text->SetCursorFromCoordinates(bv_->text->cursor.x_fix(), y
- + workarea->height());
+ bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y
+ + workarea_->height());
bv_->text->FinishUndo();
// This is to allow jumping over large insets
if ((cursorrow == bv_->text->cursor.row()))
- bv_->text->CursorDown();
+ bv_->text->CursorDown(bv_);
- if (bv_->text->cursor.row()->height() < workarea->height())
+ if (bv_->text->cursor.row()->height() < workarea_->height())
screen->Draw(bv_->text->cursor.y()
- bv_->text->cursor.row()->baseline());
updateScrollbar();
{
toggleSelection();
bv_->text->ClearSelection();
-#if 1
+
// CHECK
//owner_->update_timeout.stop();
-#else
- FreeUpdateTimer();
-#endif
}
bufferlist.getBuffer(fname) :
bufferlist.loadLyXFile(fname); // don't ask, just load it
buffer(b);
- bv_->text->SetCursorFromCoordinates(x, y);
- update(0);
+ bv_->text->SetCursorFromCoordinates(bv_, x, y);
+ update(BufferView::SELECT|BufferView::FITCUR);
}
bool BufferView::Pimpl::NoSavedPositions()
bool BufferView::Pimpl::focus() const
{
- return workarea->hasFocus();
+ return workarea_->hasFocus();
}
void BufferView::Pimpl::focus(bool f)
{
- if (f) workarea->setFocus();
+ if (f) workarea_->setFocus();
}
bool BufferView::Pimpl::active() const
{
- return workarea->active();
+ return workarea_->active();
}
bool BufferView::Pimpl::belowMouse() const
{
- return workarea->belowMouse();
+ return workarea_->belowMouse();
}
void BufferView::Pimpl::center()
{
beforeChange();
- if (bv_->text->cursor.y() > workarea->height() / 2) {
- screen->Draw(bv_->text->cursor.y() - workarea->height() / 2);
+ if (bv_->text->cursor.y() > workarea_->height() / 2) {
+ screen->Draw(bv_->text->cursor.y() - workarea_->height() / 2);
} else {
screen->Draw(0);
}
- update(0);
+ update(BufferView::SELECT|BufferView::FITCUR);
redraw();
}
screen->HideCursor();
bv_->beforeChange();
- string clip(workarea->getClipboard());
+ string clip(workarea_->getClipboard());
if (clip.empty()) return;
if (asPara) {
- bv_->text->InsertStringB(clip);
+ bv_->text->InsertStringB(bv_, clip);
} else {
- bv_->text->InsertStringA(clip);
+ bv_->text->InsertStringA(bv_, clip);
}
- update(1);
+ update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
void BufferView::Pimpl::stuffClipboard(string const & stuff) const
{
- workarea->putClipboard(stuff);
+ workarea_->putClipboard(stuff);
}
///
void update();
///
- void update(signed char f);
+ void update(BufferView::UpdateCodes);
///
void gotoError();
/// Update pixmap of screen
void updateScrollbar();
///
void scrollCB(double value);
-#if 0
- ///
- void create_view();
-#endif
///
Inset * checkInsetHit(int & x, int & y, unsigned int button);
///
bool work_area_focus;
///
FL_OBJECT * figinset_canvas;
-#if 0
///
- FL_OBJECT * timer_cursor;
-#else
Timeout cursor_timeout;
-#endif
///
BackStack backstack;
///
int last_click_x, last_click_y;
///
- WorkArea * workarea;
+ WorkArea * workarea_;
///
UpdateInset updatelist;
///
#include <string>
using std::string;
#else
+#ifdef __STRING__
+#error The <string> header has been included before LString.h
+#else
+#define __STRING__
+#endif
#include "support/lyxstring.h"
// using lyx::string;
typedef lyxstring string;
url = false;
varioref = false;
prettyref = false;
+ chess = false;
// commands
lyx = false;
NeedLyXMinipageIndent = false;
}
+void LaTeXFeatures::require(string const & name) {
+ if (name == "color") {
+ color = true;
+ } else if (name == "graphics") {
+#ifdef USE_GRAPHICX
+ graphicx = true;
+#else
+ graphics = true;
+#endif
+ } else if (name == "setspace") {
+ setspace = true;
+ } else if (name == "makeidx") {
+ makeidx = true;
+ } else if (name == "verbatim") {
+ verbatim = true;
+ } else if (name == "longtable") {
+ longtable = true;
+ } else if (name == "algorithm") {
+ algorithm = true;
+ } else if (name == "rotating") {
+ rotating = true;
+ } else if (name == "amssymb") {
+ amssymb = true;
+ } else if (name == "latexsym") {
+ latexsym = true;
+ } else if (name == "pifont") {
+ pifont = true;
+ } else if (name == "subfigure") {
+ subfigure = true;
+ } else if (name == "floatflt") {
+ floatflt = true;
+ } else if (name == "url") {
+ url = true;
+ } else if (name == "varioref") {
+ varioref = true;
+ } else if (name == "prettyref") {
+ prettyref = true;
+ } else if (name == "chess") {
+ chess = true;
+ } else if (name == "amsstyle") {
+ amsstyle = true;
+ } else if (name == "boldsymbol") {
+ boldsymbol = true;
+ } else if (name == "binom") {
+ binom = true;
+ }
+}
string LaTeXFeatures::getPackages()
{
+ params.graphicsDriver + "]{graphics}\n";
}
- //verbatim.sty
+ // verbatim.sty
if (verbatim)
packages += "\\usepackage{verbatim}\n";
packages += "\\usepackage{algorithm}\n";
}
+ // lyxchess.sty
+ if (chess) {
+ packages += "\\usepackage{lyxchess}\n";
+ }
+
// setspace.sty
if ((params.spacing.getSpace() != Spacing::Single
&& !params.spacing.isDefault())
if (prettyref)
packages += "\\usepackage{prettyref}\n";
+ packages += externalPreambles;
+
return packages;
}
///
void showStruct();
+ /// Provide a string name-space to the requirements
+ void require(string const & name);
+
+ /// Static preamble bits from the external material insets
+ string externalPreambles;
+
//@Man: Packages
//@{
///
bool varioref; // varioref.sty
///
bool prettyref; // prettyref.sty
+ ///
+ bool chess; // chess.sty
//@}
// instead of calling newFunc numerous times because of compilation
// times. Since the array is not static we get back the memory it
// occupies after the init is completed. It compiles several
- //magnitudes faster.
+ // magnitudes faster.
static bool init = false;
if (init) return;
N_("Import document"), NoBuffer },
{ LFUN_BUFFERBULLETSSELECT, "buffer-itemize-bullets-select",
"", Noop },
+ { LFUN_BUFFER_PRINT, "buffer-print-xtl", N_("Print"),
+ ReadOnly },
+ { LFUN_PRINTER_PARAMS_GET, "printer-params-get",
+ N_("Get the printer parameters"), ReadOnly },
{ LFUN_MENUNEW, "buffer-new", N_("New document") , NoBuffer },
{ LFUN_MENUNEWTMPLT,"buffer-new-template",
N_("New document from template"), NoBuffer },
N_("Remove all error boxes"), ReadOnly },
{ LFUN_INSET_ERT, "ert-inset-insert",
N_("Insert a new ERT Inset"), Noop },
+ { LFUN_INSET_EXTERNAL, "external-inset-insert",
+ N_("Insert a new external inset"), Noop },
{ LFUN_FIGURE, "figure-insert", N_("Insert Figure"), Noop },
{ LFUN_INSERT_GRAPHICS, "graphics-insert",
N_("Insert Graphics"), Noop },
ReadOnly },
{ LFUN_HFILL, "hfill-insert",
N_("Insert horizontal fill"), Noop },
+ { LFUN_HELP_COPYRIGHT, "help-copyright",
+ N_("Display copyright information"), NoBuffer },
{ LFUN_HTMLURL, "html-insert", "", Noop },
{ LFUN_HYPHENATION, "hyphenation-point-insert",
N_("Insert hyphenation point"), Noop },
#include "lyxtext.h"
#include "buffer.h"
#include "menus.h"
+#include "frontends/Dialogs.h"
+#include "lyx_gui_misc.h" // [update,Close]AllBufferRelatedDialogs
using std::endl;
extern FD_form_document * fd_form_document;
extern void AutoSave(BufferView *);
-#if 0
-extern char updatetimer;
-#endif
extern void QuitLyX();
LyXTextClass::size_type current_layout = 0;
extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM *, void *);
+#ifdef SIGC_CXX_NAMESPACES
+using SigC::Connection;
+using SigC::slot;
+#endif
+
LyXView::LyXView(int width, int height)
// : update_timeout(300)
{
lyxerr[Debug::INIT] << "Initializing LyXFunc" << endl;
lyxfunc = new LyXFunc(this);
intl = new Intl;
+ dialogs_ = new Dialogs(this);
+ // temporary until all dialogs moved into Dialogs.
+ dialogs_->updateBufferDependent
+ .connect(slot(&updateAllVisibleBufferRelatedDialogs));
+ dialogs_->hideBufferDependent
+ .connect(slot(&CloseAllBufferRelatedDialogs));
}
delete minibuffer;
delete lyxfunc;
delete intl;
+ delete dialogs_;
}
}
-// Callback for update timer
-void LyXView::UpdateTimerCB(void * ob)
-{
- LyXView * view = static_cast<LyXView*>(ob);
- if (!view->view()->available())
- return;
-#if 0
- if (!updatetimer)
- return;
-#endif
-
- view->view()->hideCursor();
- view->view()->update(-2);
-#if 0
- /* This update can happen, even when the work area has lost
- * the focus. So suppress the cursor in that case */
- updatetimer = 0;
-#endif
-}
-
-
-#if 0
-// Wrapper for the above
-extern "C" void C_LyXView_UpdateTimerCB(FL_OBJECT * ob, long data)
-{
- LyXView::UpdateTimerCB(ob, data);
-}
-#endif
-
-
// Callback for autosave timer
void LyXView::AutoSave()
{
void LyXView::resetAutosaveTimer()
{
if (lyxrc.autosave)
-#if 1
autosave_timeout.restart();
-#else
- fl_set_timer(form_main_->timer_autosave, lyxrc.autosave);
-#endif
}
// TIMERS
//
-#if 0
- // timer_autosave
- fdui->timer_autosave = obj = fl_add_timer(FL_HIDDEN_TIMER,
- 0, 0, 0, 0, "Timer");
- obj->u_vdata = this;
- fl_set_object_callback(obj, C_LyXView_AutosaveTimerCB, 0);
-#else
autosave_timeout.callback(C_LyXView_AutosaveTimerCB, this);
-#endif
-#if 0
- // timer_update
- fdui->timer_update = obj = fl_add_timer(FL_HIDDEN_TIMER,
- 0, 0, 0, 0, "Timer");
- fl_set_object_callback(obj, C_LyXView_UpdateTimerCB, 0);
- obj->u_vdata = this;
-#else
- //update_timeout.callback(LyXView::UpdateTimerCB, this);
-#endif
//
// Misc
//
class Buffer;
class Menus;
class BufferView;
+class Dialogs;
///
struct FD_form_main {
///
FL_FORM * form_main;
-#if 0
- ///
- FL_OBJECT * timer_autosave;
-#endif
-#if 0
- ///
- FL_OBJECT * timer_update;
-#endif
-#if 0
- ///
- void * vdata;
- ///
- long ldata;
-#endif
};
///
Intl * getIntl() const;
+ ///
+ Dialogs * getDialogs() { return dialogs_; }
+
///
void updateLayoutChoice();
Menus * menus;
///
Intl * intl;
+ ///
+ Dialogs * dialogs_;
/** This is supposed to be a pointer or a list of pointers to the
BufferViews currently being shown in the LyXView. So far
void AutoSave();
/// A callback
static void UpdateTimerCB(void *);
-#if 1
- ///
- //Timeout update_timeout;
-#endif
private:
///
Timeout autosave_timeout;
AUTOMAKE_OPTIONS = foreign
-SUBDIRS = mathed insets support
-DISTCLEANFILES = libintl.h config.h
-MAINTAINERCLEANFILES = Makefile.in config.h.in
+SUBDIRS = mathed insets support frontends
+DISTCLEANFILES= *.orig *.rej *~ *.bak core libintl.h config.h
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in $(srcdir)/config.h.in
bin_PROGRAMS = lyx
-lyx_DEPENDENCIES = mathed/libmathed.la insets/libinsets.la support/libsupport.la
-lyx_LDADD = $(lyx_DEPENDENCIES) @INTLLIBS@ $(LYX_LIBS)
+lyx_DEPENDENCIES = mathed/libmathed.la insets/libinsets.la \
+ support/libsupport.la @FRONTEND_GUILIB@ frontends/libfrontends.la \
+ @INCLUDED_SIGC@
+lyx_LDADD = $(lyx_DEPENDENCIES) @INTLLIBS@ $(LYX_LIBS) $(SIGC_LIBS) \
+ @FRONTEND_LDFLAGS@ @FRONTEND_LIBS@
EXTRA_DIST = config.h.in stamp-h.in cheaders
-ETAGS_ARGS = --c++
-INCLUDES = -I${top_srcdir}/images
+ETAGS_ARGS = --lang=c++
+INCLUDES = -I${top_srcdir}/images $(SIGC_CFLAGS) @FRONTEND_INCLUDES@
localedir = $(datadir)/locale
lyx_SOURCES = \
BackStack.h \
PainterBase.h \
PaperLayout.C \
ParagraphExtra.C \
+ PrinterParams.h \
Spacing.C \
Spacing.h \
TableLayout.C \
}
+int PainterBase::paperHeight() const
+{
+ return owner.height();
+}
+
+
PainterBase & PainterBase::circle(int x, int y, unsigned int d,
LColor::color col)
{
int paperMargin() const;
///
int paperWidth() const;
+ ///
+ int paperHeight() const;
/**@Basic drawing routines */
/// Draw a line from point to point
} else if (fl_get_button(fd_form_paragraph_extra->radio_pextra_floatflt)) {
type = LyXParagraph::PEXTRA_FLOATFLT;
}
- text->SetParagraphExtraOpt(type, width, widthp, alignment, hfill,
+ text->SetParagraphExtraOpt(current_view, type, width, widthp, alignment, hfill,
start_minipage);
- current_view->update(1);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
current_view->owner()->getMiniBuffer()->
Set(_("ParagraphExtra layout set"));
}
--- /dev/null
+// -*- C++ -*-
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-2000 The LyX Team
+ *
+ * This file Copyright 1999-2000
+ * Allan Rae
+ *======================================================
+ */
+
+#ifndef PRINTERPARAMS_H
+#define PRINTERPARAMS_H
+
+#ifndef LYXRC_H
+#error You must include lyxrc.h before PrinterParams.h
+#endif
+
+#ifdef ENABLE_ASSERTIONS
+#include "support/LAssert.h"
+#endif
+
+/**
+ This struct contains (or should contain) all the parameters required for
+ printing a buffer. Some work still needs to be done on this struct and
+ printing handling in general to make it nice and full-featured.
+ The main things I'd like to add now is the ability to print a read-only
+ document with different orientation, papersize or single/duplex state
+ than the document's settings. ARRae 20000423
+*/
+struct PrinterParams {
+ ///
+ enum Target{PRINTER, FILE};
+ ///
+ Target target;
+ ///
+ string printer_name;
+ ///
+ string file_name;
+ ///We allow printing of even pages in a range and so on.
+ enum WhichPages{ALL, ODD, EVEN};
+ ///
+ WhichPages which_pages;
+ /** Print a page range. Both from_page and to_page used to be strings
+ because they're actually easier to work with that way. I've
+ switched to_page to be an int. However, from_page will remain a
+ string because I want the from_page field to be able to be used as
+ a page range "1,3-5" and so on.
+ I've modified the invariant test to match. ARRae 20000518
+ */
+ string from_page;
+ ///
+ int to_page;
+ ///
+ bool reverse_order;
+ ///
+ bool unsorted_copies;
+ ///
+ int count_copies;
+ // The settings below should allow us to print any read-only doc in
+ // whatever size/orientation we want it -- overriding the documents
+ // settings.
+ /// Override the documents orientation
+ //bool orientation;
+ /// Print n pages per physical sheet
+ //unsigned int nup;
+ /// Override document settings for duplex.
+ //bool duplex;
+
+ //@name Constructors and Deconstructors
+ //@{
+ ///
+ PrinterParams(Target const & t = PRINTER,
+ string const & pname = lyxrc.printer,
+ string const & fname = string(),
+ WhichPages const wp = ALL,
+ string const & from = string(),
+ int const & to = 0,
+ bool const reversed = false,
+ bool const unsorted = false,
+ int const & num_copies = 1)
+ : target(t),
+ printer_name(pname),
+ file_name(fname),
+ which_pages(wp),
+ from_page(from),
+ to_page(to),
+ reverse_order(reversed),
+ unsorted_copies(unsorted),
+ count_copies(num_copies)
+ {
+ testInvariant();
+ }
+ ///
+ PrinterParams(PrinterParams const & pp)
+ : target(pp.target),
+ printer_name(pp.printer_name),
+ file_name(pp.file_name),
+ which_pages(pp.which_pages),
+ from_page(pp.from_page),
+ to_page(pp.to_page),
+ reverse_order(pp.reverse_order),
+ unsorted_copies(pp.unsorted_copies),
+ count_copies(pp.count_copies)
+ {
+ testInvariant();
+ }
+ ///
+ ~PrinterParams() {}
+ //@}
+
+
+// do we need these?
+// friend bool operator==(PrinterParams const &, PrinterParams const &);
+// friend bool operator<(PrinterParams const &, PrinterParams const &);
+
+ //@name Invariant Test Method
+ //@{
+ /** Test that all the fields contain valid entries. It's unlikely
+ that the internal code will get this wrong (at least for the
+ xforms code anyway) however new ports and external scripts
+ might drive the wrong values in.
+ */
+ void testInvariant() const
+ {
+#ifdef ENABLE_ASSERTIONS
+ extern bool containsOnly(string const &, char const *);
+ if (!from_page.empty()) {
+ // Assert(from_page == number or empty)
+ Assert(containsOnly(from_page, "1234567890"));
+ }
+ if (to_page) {
+ // Assert(to_page == empty
+ // or number iff from_page set)
+ Assert(!from_page.empty());
+ }
+ switch (target) {
+ case PRINTER:
+// Assert(!printer_name.empty());
+ break;
+ case FILE:
+ Assert(!file_name.empty());
+ break;
+ default:
+ Assert(false);
+ break;
+ }
+ switch (which_pages) {
+ case ALL:
+ case ODD:
+ case EVEN:
+ break;
+ default:
+ Assert(false);
+ break;
+ }
+#endif
+ }
+ //@}
+};
+
+#endif
+
+
+
current_view->hideCursor();
if (!current_view->text->selection){
current_view->beforeChange();
- current_view->update(-2);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR);
}
if ((num == LyXTable::SET_SPECIAL_COLUMN) ||
(num == LyXTable::SET_SPECIAL_MULTI))
- current_view->text->TableFeatures(num, special);
+ current_view->text->TableFeatures(current_view, num, special);
else
- current_view->text->TableFeatures(num);
- current_view->update(1);
+ current_view->text->TableFeatures(current_view, num);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
if (num == LyXTable::DELETE_TABLE) {
fl_set_focus_object(fd_form_table_options->form_table_options,
current_view->hideCursor();
if (!current_view->text->selection) {
current_view->beforeChange();
- current_view->update(-2);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR);
}
- current_view->text->TableFeatures(LyXTable::SET_PWIDTH, str);
- current_view->update(1);
+ current_view->text->TableFeatures(current_view, LyXTable::SET_PWIDTH, str);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
MenuLayoutTable(0); // update for alignment
}
using std::remove_if;
using std::find_if;
using std::endl;
+using std::make_pair;
extern BufferList bufferlist;
class text_fits {
public:
- text_fits(Buffer * b, unsigned short p)
+ text_fits(Buffer * b, int p)
: buf(b), pw(p) {}
bool operator()(TextCache::value_type & vt) {
- if (vt->buffer() == buf && vt->paperWidth() == pw) return true;
+ if (vt.first == buf && vt.second.first == pw)
+ return true;
return false;
}
private:
Buffer * buf;
- unsigned short pw;
+ int pw;
};
-LyXText * TextCache::findFit(Buffer * b, unsigned short p)
+LyXText * TextCache::findFit(Buffer * b, int p)
{
Cache::iterator it = find_if(cache.begin(), cache.end(),
text_fits(b, p));
if (it != cache.end()) {
- LyXText * tmp = (*it);
+ LyXText * tmp = (*it).second.second;
cache.erase(it);
return tmp;
}
class show_text {
public:
show_text(ostream & o) : os(o) {}
- void operator()(TextCache::value_type & vt) {
- os << "\tBuffer: " << vt->buffer()
- << "\tWidth: " << vt->paperWidth() << endl;
+ void operator()(TextCache::value_type const & vt) {
+ os << "\tBuffer: " << vt.first
+ << "\tWidth: " << vt.second.first << endl;
}
private:
ostream & os;
}
-void TextCache::show(ostream & os, LyXText * lt)
+void TextCache::show(ostream & os, TextCache::value_type const & vt)
{
show_text st(os);
- st(lt);
+ st(vt);
}
-void TextCache::add(LyXText * text)
+void TextCache::add(Buffer *buf, int workwidth, LyXText * text)
{
lyxerr.debug() << "TextCache::add " << text;
- if (bufferlist.isLoaded(text->buffer())) {
- cache.push_back(text);
+ if (bufferlist.isLoaded(buf)) {
+ cache[buf] = make_pair(workwidth, text);
lyxerr.debug() << " added" << endl;
} else {
delete text;
class delete_text {
public:
void operator()(TextCache::value_type & vt) {
- delete vt;
+ delete vt.second.second;
}
};
has_buffer(Buffer * b)
: buf(b) {}
bool operator()(TextCache::value_type & vt) {
- if (vt->buffer() == buf) return true;
+ if (vt.first == buf) return true;
return false;
}
private:
- Buffer * buf;
+ Buffer const * buf;
};
void TextCache::removeAllWithBuffer(Buffer * buf)
{
- Cache::iterator it = remove_if(cache.begin(), cache.end(),
- has_buffer(buf));
- if (it != cache.end()) {
- if (lyxerr.debugging()) {
- lyxerr.debug() << "TextCache::removeAllWithbuffer "
- "Removing:\n";
- for_each(it, cache.end(), show_text(lyxerr));
- lyxerr << endl;
- }
- for_each(it, cache.end(), delete_text());
- cache.erase(it, cache.end());
- }
+ cache.erase(buf);
}
// Global instance
#endif
#include <iosfwd>
+#include <map>
#include "LString.h"
#include "lyxtext.h"
-
-class Buffer;
+#include "buffer.h"
// This is only the very first implemetation and use of the TextCache,
// operations on it needs to be put into a class or a namespace, that part
class TextCache {
public:
///
- typedef std::vector<LyXText*> Cache;
+ typedef std::map<Buffer *, std::pair<int,LyXText *> > Cache;
+
///
- typedef LyXText * value_type;
+ typedef Cache::value_type value_type;
/** Returns a pointer to a LyXText that fits the provided buffer
and width. Of there is no match 0 is returned. */
- LyXText * findFit(Buffer * b, unsigned short p);
+ LyXText * findFit(Buffer * b, int p);
/** Lists all the LyXText's currently in the cache.
Uses msg as header for the list. */
void show(std::ostream & o, string const & msg);
/// Gives info on a single LyXText (buffer and width)
- static void show(std::ostream & o, LyXText *);
+ static void show(std::ostream & o, value_type const &);
/** Adds a LyXText to the cache iff its buffer is
present in bufferlist. */
- void add(LyXText *);
+ void add(Buffer *, int witdth, LyXText *);
/** Clears the cache. Deletes all LyXText's and releases
the allocated memory. */
void clear();
WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
- : owner(o), workareapixmap(0), painter_(*this)
+ : owner_(o), workareapixmap(0), painter_(*this)
{
fl_freeze_all_forms();
// If we really want the accellerating scroll we can do that
// from here. IMHO that is a waste of effort since we already
// have other ways to move fast around in the document. (Lgb)
- area->owner->scrollCB(fl_get_scrollbar_value(ob));
+ area->owner_->scrollCB(fl_get_scrollbar_value(ob));
waitForX();
}
lyxerr.debug() << "Workarea event: DRAW" << endl;
area->createPixmap(area->workWidth(), area->height());
Lgb_bug_find_hack = true;
- area->owner->workAreaExpose();
+ area->owner_->workAreaExpose();
Lgb_bug_find_hack = false;
break;
case FL_PUSH:
if (!ev) break;
// Should really have used xbutton.state
lyxerr.debug() << "Workarea event: PUSH" << endl;
- area->owner->workAreaButtonPress(ev->xbutton.x - ob->x,
+ area->owner_->workAreaButtonPress(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y,
ev->xbutton.button);
break;
if (!ev) break;
// Should really have used xbutton.state
lyxerr.debug() << "Workarea event: RELEASE" << endl;
- area->owner->workAreaButtonRelease(ev->xbutton.x - ob->x,
+ area->owner_->workAreaButtonRelease(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y,
ev->xbutton.button);
break;
fl_get_scrollbar_value(area->scrollbar) != scrollbar_value_old
) {
lyxerr.debug() << "Workarea event: MOUSE" << endl;
- area->owner->workAreaMotionNotify(ev->xmotion.x - ob->x,
+ area->owner_->workAreaMotionNotify(ev->xmotion.x - ob->x,
ev->xmotion.y - ob->y,
ev->xbutton.state);
}
break;
case FL_ENTER:
lyxerr.debug() << "Workarea event: ENTER" << endl;
- area->owner->enterView();
+ area->owner_->enterView();
break;
case FL_LEAVE:
lyxerr.debug() << "Workarea event: LEAVE" << endl;
- area->owner->leaveView();
+ area->owner_->leaveView();
break;
case FL_DBLCLICK:
if (!ev) break;
lyxerr.debug() << "Workarea event: DBLCLICK" << endl;
- area->owner->doubleClick(ev->xbutton.x - ob->x,
+ area->owner_->doubleClick(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y,
ev->xbutton.button);
break;
case FL_TRPLCLICK:
if (!ev) break;
lyxerr.debug() << "Workarea event: TRPLCLICK" << endl;
- area->owner->tripleClick(ev->xbutton.x - ob->x,
+ area->owner_->tripleClick(ev->xbutton.x - ob->x,
ev->xbutton.y - ob->y,
ev->xbutton.button);
break;
///
Painter & getPainter() { return painter_; }
///
- unsigned int workWidth() const { return work_area->w; }
+ int workWidth() const { return work_area->w; }
///
unsigned int width() const { return work_area->w + scrollbar->w; }
///
string getClipboard() const;
///
void putClipboard(string const &) const;
+ ///
+ BufferView * owner() const { return owner_; }
+
private:
///
void createPixmap(int, int);
///
FL_OBJECT * scrollbar;
///
- BufferView * owner;
+ BufferView * owner_;
/// The pixmap overlay on the workarea
Pixmap workareapixmap;
///
#include "insets/insetlatexaccent.h"
#include "insets/insetbib.h"
#include "insets/insetcite.h"
+#include "insets/insetexternal.h"
#include "insets/insetindex.h"
#include "insets/insetinclude.h"
#include "insets/insettoc.h"
#include "lyxtext.h"
#include "gettext.h"
#include "language.h"
+#include "lyx_gui_misc.h" // WarnReadonly()
+#include "frontends/Dialogs.h"
using std::ostream;
using std::ofstream;
if (read_only != flag) {
read_only = flag;
updateTitles();
- updateAllVisibleBufferRelatedPopups();
+ users->owner()->getDialogs()->updateBufferDependent();
}
if (read_only) {
WarnReadonly(filename);
if(!par) {
par = new LyXParagraph;
} else {
- users->text->BreakParagraph();
+ users->text->BreakParagraph(users);
return_par = users->text->FirstParagraph();
pos = 0;
markDirty();
}
} else if (token == "\\i") {
Inset * inset = new InsetLatexAccent;
- inset->Read(lex);
+ inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
} else if (token == "\\tocdepth") {
lex.nextToken();
params.tocdepth = lex.GetInteger();
-#if 0
- } else if (token == "\\baselinestretch") { // obsolete
- lex.nextToken(); // should not be used directly
- // anymore.
- // Will probably keep a kind of support just for
- // compability.
- params.spacing.set(Spacing::Other, lex.GetFloat());
-#endif
} else if (token == "\\spacing") {
lex.next();
string tmp = strip(lex.GetString());
// test the different insets
if (tmptok == "Quotes") {
Inset * inset = new InsetQuotes;
- inset->Read(lex);
+ inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
#if 0
} else if (tmptok == "\\i") {
Inset * inset = new InsetLatexAccent;
- inset->Read(lex);
+ inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
#endif
+ } else if (tmptok == "External") {
+ Inset * inset = new InsetExternal;
+ inset->Read(this, lex);
+ par->InsertChar(pos, LyXParagraph::META_INSET);
+ par->InsertInset(pos, inset);
+ par->SetFont(pos, font);
+ ++pos;
} else if (tmptok == "FormulaMacro") {
Inset * inset = new InsetFormulaMacro;
- inset->Read(lex);
+ inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "Formula") {
Inset * inset = new InsetFormula;
- inset->Read(lex);
+ inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "Figure") {
Inset * inset = new InsetFig(100, 100, this);
- inset->Read(lex);
+ inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "Info") {
Inset * inset = new InsetInfo;
- inset->Read(lex);
+ inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "Include") {
Inset * inset = new InsetInclude(string(), this);
- inset->Read(lex);
+ inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "ERT") {
- Inset * inset = new InsetERT(this);
- inset->Read(lex);
+ Inset * inset = new InsetERT();
+ inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "Tabular") {
Inset * inset = new InsetTabular(this);
- inset->Read(lex);
+ inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "Text") {
- Inset * inset = new InsetText(this);
- inset->Read(lex);
+ Inset * inset = new InsetText();
+ inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "Foot") {
- Inset * inset = new InsetFoot(this);
- inset->Read(lex);
+ Inset * inset = new InsetFoot();
+ inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
++pos;
} else if (tmptok == "GRAPHICS") {
Inset * inset = new InsetGraphics;
- //inset->Read(lex);
+ //inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
} else if (tmptok == "LatexCommand") {
InsetCommand inscmd;
- inscmd.Read(lex);
+ inscmd.Read(this, lex);
Inset * inset = 0;
if (inscmd.getCmdName() == "cite") {
inset = new InsetCitation(inscmd.getContents(), inscmd.getOptions());
if (!inscmd.getOptions().empty() || !inscmd.getContents().empty()) {
inset = new InsetRef(inscmd, this);
}
- // CHECK if this else clause
- //is still needed. (Lgb)
-#if 0
- // This condition comes from a
- // temporary solution to the latexdel
- // ref inset that was transformed to
- // an empty ref inset plus the body
- // surronded by latexdel insets
- else {
- string cont, opt, tmptmptok, cmdname;
- lex.next();
- while(lex.IsOK() && lex.GetString() != "\\end_inset" ) {
- lex.next();
- }
- lex.next();
- while(lex.IsOK()) {
- tmptmptok = lex.GetString();
- if(tmptmptok[0] == '\\') {
- if( tmptmptok == "\\backslash")
- opt += '\\';
- else
- break;
- }
- else
- opt += tmptmptok;
- opt += ' ';
- lex.next();
- }
- while(lex.IsOK() && lex.GetString() != "\\end_inset" ) {
- lex.next();
- }
- lex.next();
- while(lex.IsOK()) {
- tmptmptok = lex.GetString();
- if(tmptmptok[0] == '\\') {
- if( tmptmptok == "\\backslash")
- cont += '\\';
- else
- break;
- }
- else
- cont += tmptmptok;
- cont += ' ';
- lex.next();
- }
- while(lex.IsOK() && lex.GetString() != "\\end_inset" ) {
- lex.next();
- }
-
- cont = strip(cont);
- opt = strip(opt);
- cmdname = "\\" + inscmd.getCmdName();
- cmdname += "[" + cont + "]";
- cmdname += "{" + opt + "}";
- inset = new InsetRef(cmdname, this);
- }
-#endif
} else if (inscmd.getCmdName() == "tableofcontents") {
inset = new InsetTOC(this);
} else if (inscmd.getCmdName() == "listoffigures") {
++pos;
}
}
-#if 0
- } else if (token == "\\InsetQuotes") {
- lyxerr << "InsetQuotes" << endl;
- Inset * inset = new InsetQuotes;
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
-#endif
-#if 0
- } else if (token == "\\InsetFormula") {
- lyxerr << "InsetFormula" << endl;
- Inset * inset = new InsetFormula;
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
-#endif
} else if (token == "\\SpecialChar") {
LyXLayout const & layout =
textclasslist.Style(params.textclass,
}
} else {
Inset * inset = new InsetSpecialChar;
- inset->Read(lex);
+ inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
}
++pos;
-#if 0
- } else if (token == "\\Figure") {
- lyxerr << "Figure" << endl;
- Inset * inset = new InsetFig(100, 100, this);
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
-#endif
} else if (token == "\\newline") {
par->InsertChar(pos, LyXParagraph::META_NEWLINE);
par->SetFont(pos, font);
} else if (token == "\\LyXTable") {
#ifdef USE_TABULAR_INSETS
Inset * inset = new InsetTabular(this);
- inset->Read(lex);
+ inset->Read(this, lex);
par->InsertChar(pos, LyXParagraph::META_INSET);
par->InsertInset(pos, inset);
par->SetFont(pos, font);
} else if (token == "\\bibitem") { // ale970302
if (!par->bibkey)
par->bibkey = new InsetBibKey;
- par->bibkey->Read(lex);
+ par->bibkey->Read(this, lex);
}else if (token == "\\backslash") {
par->InsertChar(pos, '\\');
par->SetFont(pos, font);
// this will write out all the paragraphs
// using recursive descent.
- paragraph->writeFile(ofs, params, footnoteflag, depth);
+ paragraph->writeFile(this, ofs, params, footnoteflag, depth);
// Write marker that shows file is complete
ofs << "\n\\the_end" << endl;
if ((inset = par->GetInset(i))) {
#ifdef HAVE_SSTREAM
std::ostringstream ost;
- inset->Ascii(ost);
+ inset->Ascii(this, ost);
h += ost.str().length();
#else
ostrstream ost;
- inset->Ascii(ost);
+ inset->Ascii(this, ost);
ost << '\0';
char * tmp = ost.str();
string tstr(tmp);
case LyXParagraph::META_INSET:
if ((inset = par->GetInset(i))) {
fpos = ofs.tellp();
- inset->Ascii(ofs);
+ inset->Ascii(this, ofs);
currlinelen += (ofs.tellp() - fpos);
actpos += (ofs.tellp() - fpos) - 1;
}
// LaTeX all paragraphs from par to endpar, if endpar == 0 then to the end
//
void Buffer::latexParagraphs(ostream & ofs, LyXParagraph *par,
- LyXParagraph *endpar, TexRow & texrow)
+ LyXParagraph *endpar, TexRow & texrow) const
{
bool was_title = false;
bool already_title = false;
ftcount = -1;
if (layout.isEnvironment()
|| par->pextra_type != LyXParagraph::PEXTRA_NONE) {
- par = par->TeXEnvironment(params, ofs, texrow,
+ par = par->TeXEnvironment(this, params, ofs, texrow,
ftnote, ft_texrow, ftcount);
} else {
- par = par->TeXOnePar(params, ofs, texrow, false,
+ par = par->TeXOnePar(this, params, ofs, texrow, false,
ftnote, ft_texrow, ftcount);
}
LyXLayout const & style =
textclasslist.Style(users->buffer()->params.textclass,
par->layout);
-#ifdef WITH_WARNINGS
-#warning please check if this call is really needed!!!
-#endif
-// par->AutoDeleteInsets();
// treat <toc> as a special case for compatibility with old code
if (par->GetChar(0) == LyXParagraph::META_INSET) {
++char_line_count;
} else if (c == LyXParagraph::META_INSET) {
inset = par->GetInset(i);
- inset->Linuxdoc(os);
+ inset->Linuxdoc(this, os);
} else {
string sgml_string;
if (par->linuxDocConvertChar(c, sgml_string)
LyXLayout const & style =
textclasslist.Style(users->buffer()->params.textclass,
par->layout);
-#ifdef WITH_WARNINGS
-#warning please check if this call is really needed!!!
-#endif
-// par->AutoDeleteInsets();
// environment tag closing
for( ; depth > par->depth; --depth) {
{
#ifndef NEW_TABULAR
if (par->table) {
- par->SimpleDocBookOneTablePar(params,
+ par->SimpleDocBookOneTablePar(this,
os, extra, desc_on, depth);
return;
}
Inset * inset = par->GetInset(i);
#ifdef HAVE_SSTREAM
std::ostringstream ost;
- inset->DocBook(ost);
+ inset->DocBook(this, ost);
string tmp_out = ost.str().c_str();
#else
ostrstream ost;
- inset->DocBook(ost);
+ inset->DocBook(this, ost);
ost << '\0';
char * ctmp = ost.str();
string tmp_out(ctmp);
if ((inset = par->GetInset(i))) {
#ifdef HAVE_SSTREAM
stringstresm ss(ios::in | ios::out);
- inset->Ascii(ss);
+ inset->Ascii(this, ss);
ss.seekp(0);
ss.get(c);
while (!ss) {
}
#else
strstream ss;
- inset->Ascii(ss);
+ inset->Ascii(this, ss);
ss.seekp(0);
ss.get(c);
while (!ss) {
TocItem tmp;
tmp.par = par;
tmp.depth = 0;
- tmp.str = par->String(params, false);
+ tmp.str = par->String(this, false);
switch (par->footnotekind) {
case LyXParagraph::FIG:
case LyXParagraph::WIDE_FIG:
tmp.depth = max(0,
labeltype -
textclasslist.TextClass(params.textclass).maxcounter());
- tmp.str = par->String(params, true);
+ tmp.str = par->String(this, true);
l[TOC_TOC].push_back(tmp);
}
}
while (par) {
if (par->bibkey)
keys.push_back(pair<string,string>(par->bibkey->getContents(),
- par->String(params, false)));
+ par->String(this, false)));
par = par->next;
}
class TeXErrors;
class LaTeXFeatures;
-extern void updateAllVisibleBufferRelatedPopups();
-
///
struct DEPCLEAN {
///
// if endpar == 0 then to the end
//
void latexParagraphs(std::ostream & os, LyXParagraph *par,
- LyXParagraph *endpar, TexRow & texrow);
+ LyXParagraph *endpar, TexRow & texrow) const;
///
int runLaTeX();
bv->owner()->getMiniBuffer()
->Set(_("Inserting Footnote..."));
bv->hideCursor();
- bv->update(-2);
- bv->text->InsertFootnoteEnvironment(LyXParagraph::FOOTNOTE);
- bv->update(1);
+ bv->update(BufferView::SELECT|BufferView::FITCUR);
+ bv->text->InsertFootnoteEnvironment(bv, LyXParagraph::FOOTNOTE);
+ bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
if (bv->available()) {
bv->owner()->getMiniBuffer()->Set(_("Inserting margin note..."));
bv->hideCursor();
- bv->update(-2);
- bv->text->InsertFootnoteEnvironment(LyXParagraph::MARGIN);
- bv->update(1);
+ bv->update(BufferView::SELECT|BufferView::FITCUR);
+ bv->text->InsertFootnoteEnvironment(bv, LyXParagraph::MARGIN);
+ bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
bv->owner()->getMiniBuffer()->Set(_("Melt"));
bv->hideCursor();
bv->beforeChange();
- bv->update(-2);
- bv->text->MeltFootnoteEnvironment();
- bv->update(1);
+ bv->update(BufferView::SELECT|BufferView::FITCUR);
+ bv->text->MeltFootnoteEnvironment(bv);
+ bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
if (!bv->available()) return;
bv->hideCursor();
- bv->update(-2);
+ bv->update(BufferView::SELECT|BufferView::FITCUR);
if (decInc >= 0)
- bv->text->IncDepth();
+ bv->text->IncDepth(bv);
else
- bv->text->DecDepth();
- bv->update(1);
+ bv->text->DecDepth(bv);
+ bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
bv->owner()->getMiniBuffer()
->Set(_("Changed environment depth"
" (in possible range, maybe not)"));
{
if (bv->available()) {
bv->hideCursor();
- bv->update(-2);
+ bv->update(BufferView::SELECT|BufferView::FITCUR);
if (bv->the_locking_inset)
bv->the_locking_inset->SetFont(bv, font, toggleall);
else
- bv->text->ToggleFree(font, toggleall);
- bv->update(1);
+ bv->text->ToggleFree(bv, font, toggleall);
+ bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
if (font.language() != ignore_language ||
font.latex() != LyXFont::IGNORE) {
LyXText * text = bv->text;
LyXCursor & cursor = text->cursor;
- text->ComputeBidiTables(cursor.row());
+ text->ComputeBidiTables(bv->buffer(), cursor.row());
if (cursor.boundary() !=
- text->IsBoundary(cursor.par(), cursor.pos(),
+ text->IsBoundary(bv->buffer(), cursor.par(), cursor.pos(),
text->real_current_font) )
- text->SetCursor(cursor.par(), cursor.pos(),
+ text->SetCursor(bv, cursor.par(), cursor.pos(),
false, !cursor.boundary());
}
}
-/** Header file generated with fdesign on Mon Apr 12 19:09:41 1999.**/
+/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
#ifndef FD_form_bullet_h_
#define FD_form_bullet_h_
--- /dev/null
+// File modified by fdfix.sh for use by lyx (with xforms 0.81) and gettext
+#include <config.h>
+#include "lyx_gui_misc.h"
+#include "gettext.h"
+
+/* Form definition file generated with fdesign. */
+
+#include FORMS_H_LOCATION
+#include <cstdlib>
+#include "cite.h"
+
+FD_citation_form *create_form_citation_form(void)
+{
+ FL_OBJECT *obj;
+ FD_citation_form *fdui = (FD_citation_form *) fl_calloc(1, sizeof(FD_citation_form));
+
+ fdui->citation_form = fl_bgn_form(FL_NO_BOX, 440, 790);
+ obj = fl_add_box(FL_UP_BOX, 0, 0, 440, 790, "");
+ obj = fl_add_browser(FL_HOLD_BROWSER, 20, 40, 170, 370, _("Inset keys"));
+ fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
+ obj = fl_add_browser(FL_HOLD_BROWSER, 250, 40, 170, 370, _("Bibliography keys"));
+ fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
+ obj = fl_add_button(FL_NORMAL_BUTTON, 200, 40, 40, 40, _("@4->"));
+ obj = fl_add_button(FL_NORMAL_BUTTON, 200, 90, 40, 40, _("@9+"));
+ obj = fl_add_button(FL_NORMAL_BUTTON, 200, 140, 40, 40, _("@8->"));
+ obj = fl_add_button(FL_NORMAL_BUTTON, 200, 190, 40, 40, _("@2->"));
+ obj = fl_add_browser(FL_NORMAL_BROWSER, 20, 440, 400, 110, _("Info"));
+ fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
+ obj = fl_add_choice(FL_NORMAL_CHOICE, 160, 570, 130, 30, _("Citation style"));
+ fl_set_object_boxtype(obj, FL_DOWN_BOX);
+ obj = fl_add_input(FL_NORMAL_INPUT, 100, 620, 250, 30, _("Text before"));
+ obj = fl_add_input(FL_NORMAL_INPUT, 100, 660, 250, 30, _("Text after"));
+ obj = fl_add_button(FL_RETURN_BUTTON, 190, 730, 110, 40, _("OK"));
+ obj = fl_add_button(FL_NORMAL_BUTTON, 310, 730, 110, 40, _("Cancel"));
+ fl_end_form();
+
+ //fdui->citation_form->fdui = fdui;
+
+ return fdui;
+}
+/*---------------------------------------*/
+
--- /dev/null
+/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
+
+#ifndef FD_citation_form_h_
+#define FD_citation_form_h_
+
+/** Callbacks, globals and object handlers **/
+
+
+/**** Forms and Objects ****/
+typedef struct {
+ FL_FORM *citation_form;
+ void *vdata;
+ char *cdata;
+ long ldata;
+} FD_citation_form;
+
+extern FD_citation_form * create_form_citation_form(void);
+
+#endif /* FD_citation_form_h_ */
LFUN_PREVIEW,
LFUN_PREVIEWPS,
LFUN_CLOSEBUFFER,
+ LFUN_BUFFER_PRINT, // ARRae 20000313
+ LFUN_PRINTER_PARAMS_GET, // ARRae 20000313
LFUN_QUIT,
LFUN_AUTOSAVE,
LFUN_UNDO,
LFUN_MENU_SEPARATOR, // Asger 990220
LFUN_SEQUENCE, // Andre' 991111
LFUN_SAVEPREFERENCES, // Lgb 991127
+ LFUN_HELP_COPYRIGHT, // ARRae 20000129
LFUN_DATE_INSERT, // jdblair 20000131
LFUN_LANGUAGE, // Dekel 20000203
LFUN_INSET_TEXT, // Jug 20000214
LFUN_LOFVIEW, // Dekel 20000519
LFUN_LOTVIEW, // Dekel 20000519
LFUN_LOAVIEW, // Dekel 20000519
+ LFUN_INSET_EXTERNAL, // Alstrup 20000609
LFUN_LASTACTION /* this marks the end of the table */
};
/**** Forms and Objects ****/
static FD_form_credits *fd_form_credits = 0;
-static FD_copyright *fd_form_copyright = 0;
void CreditsOKCB(FL_OBJECT *, long) {
fl_hide_form(fd_form_credits->form_credits);
_("Credits"));
}
}
-
-// Callback for copyright and warranty form
-void CopyrightOKCB(FL_OBJECT *, long) {
- fl_hide_form(fd_form_copyright->copyright);
- fl_free_form(fd_form_copyright->copyright);
- fd_form_copyright->copyright = 0;
-}
-
-// Show copyright and warranty form
-void ShowCopyright()
-{
- if (!fd_form_copyright || !fd_form_copyright->copyright) {
- fd_form_copyright = create_form_copyright();
- fl_set_form_atclose(fd_form_copyright->copyright,
- CancelCloseBoxCB, 0);
- }
-
- // Funny emotional remark by Asger deleted. (Lgb)
-
- if (fd_form_copyright->copyright->visible) {
- fl_raise_form(fd_form_copyright->copyright);
- } else {
- fl_show_form(fd_form_copyright->copyright,
- FL_PLACE_MOUSE, FL_FULLBORDER,
- _("Copyright and Warranty"));
- }
-}
#define CREDITS_H
void ShowCredits();
-void ShowCopyright();
#endif
/* Form definition file generated with fdesign. */
#include FORMS_H_LOCATION
-#include <stdlib.h>
+#include <cstdlib>
#include "credits_form.h"
FD_form_credits *create_form_form_credits(void)
}
/*---------------------------------------*/
-FD_copyright *create_form_copyright(void)
-{
- FL_OBJECT *obj;
- FD_copyright *fdui = (FD_copyright *) fl_calloc(1, sizeof(FD_copyright));
-
- fdui->copyright = fl_bgn_form(FL_NO_BOX, 450, 430);
- 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 1995 by Matthias Ettrich,\n1995-2000 LyX Team"));
- fl_set_object_boxtype(obj, FL_FRAME_BOX);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
- fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
- obj = fl_add_text(FL_NORMAL_TEXT, 10, 70, 430, 110, _("This program is free software; you can redistribute it\nand/or modify it under the terms of the GNU General\nPublic License as published by the Free Software\nFoundation; either version 2 of the License, or\n(at your option) any later version."));
- fl_set_object_boxtype(obj, FL_FRAME_BOX);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
- obj = fl_add_button(FL_RETURN_BUTTON, 160, 390, 140, 30, _("OK"));
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_gravity(obj, FL_South, FL_South);
- fl_set_object_resize(obj, FL_RESIZE_NONE);
- fl_set_object_callback(obj, CopyrightOKCB, 0);
- obj = fl_add_text(FL_NORMAL_TEXT, 10, 190, 430, 190, _("LyX is distributed in the hope that it will\nbe useful, but WITHOUT ANY WARRANTY;\nwithout even the implied warranty of MERCHANTABILITY\nor FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\nYou should have received a copy of\nthe GNU General Public License\nalong with this program; if not, write to\nthe Free Software Foundation, Inc.,\n675 Mass Ave, Cambridge, MA 02139, USA."));
- fl_set_object_boxtype(obj, FL_FRAME_BOX);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
- fl_end_form();
-
- //fdui->copyright->fdui = fdui;
-
- return fdui;
-}
-/*---------------------------------------*/
-
-/** Header file generated with fdesign on Mon Apr 12 19:09:41 1999.**/
+/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
#ifndef FD_form_credits_h_
#define FD_form_credits_h_
/** Callbacks, globals and object handlers **/
extern "C" void CreditsOKCB(FL_OBJECT *, long);
-extern "C" void CopyrightOKCB(FL_OBJECT *, long);
-
/**** Forms and Objects ****/
typedef struct {
} FD_form_credits;
extern FD_form_credits * create_form_form_credits(void);
-typedef struct {
- FL_FORM *copyright;
- void *vdata;
- char *cdata;
- long ldata;
-} FD_copyright;
-
-extern FD_copyright * create_form_copyright(void);
#endif /* FD_form_credits_h_ */
fdui->in1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 110, 80, 30, idex(_("inches|#n")));fl_set_button_shortcut(obj, scex(_("inches|#n")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, GraphicsCB, 12);
- // xgettext:no-c-format
+ // xgettext:no-c-format
fdui->page1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 130, 110, 30, idex(_("% of Page|#P")));fl_set_button_shortcut(obj, scex(_("% of Page|#P")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, GraphicsCB, 13);
- // xgettext:no-c-format
+ // xgettext:no-c-format
fdui->column1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 150, 110, 30, idex(_("% of Column|#o")));fl_set_button_shortcut(obj, scex(_("% of Column|#o")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, GraphicsCB, 14);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- obj = fl_add_button(FL_NORMAL_BUTTON, 200, 80, 90, 30, idex(_("@>|#F")));fl_set_button_shortcut(obj, scex(_("@>|#F")), 1);
+ obj = fl_add_button(FL_NORMAL_BUTTON, 200, 80, 90, 30, idex(_("@>|#F^s")));fl_set_button_shortcut(obj, scex(_("@>|#F^s")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, SearchForwardCB, 0);
- obj = fl_add_button(FL_NORMAL_BUTTON, 110, 80, 90, 30, idex(_("@<|#B")));fl_set_button_shortcut(obj, scex(_("@<|#B")), 1);
+ obj = fl_add_button(FL_NORMAL_BUTTON, 110, 80, 90, 30, idex(_("@<|#B^r")));fl_set_button_shortcut(obj, scex(_("@<|#B^r")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, SearchBackwardCB, 0);
-/** Header file generated with fdesign on Fri Apr 30 16:14:04 1999.**/
+/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
#ifndef FD_KeyMap_h_
#define FD_KeyMap_h_
-#include FORMS_H_LOCATION
-
/** Callbacks, globals and object handlers **/
extern "C" void GraphicsCB(FL_OBJECT *, long);
--- /dev/null
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-2000 The LyX Team.
+ *
+ * ====================================================== */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include <algorithm>
+
+#include "ExternalTemplate.h"
+
+#include "lyxlex.h"
+#include "support/path.h"
+
+using std::endl;
+using std::ostream;
+
+extern string user_lyxdir;
+
+
+// We have to have dummy default commands for security reasons!
+
+ExternalTemplate::ExternalTemplate()
+ : viewCommand("true"), editCommand("true")
+{}
+
+ExternalTemplate::FormatTemplate::FormatTemplate()
+ : updateCommand("true") {}
+
+
+ExternalTemplateManager::ExternalTemplateManager()
+{
+ // gimp gnuchess gnuplot ical netscape tetris xpaint
+ readTemplates(user_lyxdir);
+ dumpTemplates();
+}
+
+
+class dumpTemplate {
+public:
+ dumpTemplate(std::ostream & o)
+ : ost(o) {}
+ void operator()(ExternalTemplateManager::Templates::value_type const & vt) {
+ ExternalTemplate const & et = vt.second;
+
+ ost << "Template " << et.lyxName << "\n"
+ << "\tGuiName " << et.guiName << "\n"
+ << "\tHelpText\n"
+ << et.helpText
+ << "\tHelpTextEnd\n"
+ << "\tFileFilter " << et.fileRegExp << "\n"
+ << "\tViewCommand " << et.viewCommand << "\n"
+ << "\tEditCommand " << et.editCommand << "\n"
+ << "\tAutomaticProduction " << et.automaticProduction << "\n";
+ et.dumpFormats(ost);
+ ost << "TemplateEnd" << endl;
+
+ }
+
+private:
+ ostream & ost;
+};
+
+class dumpFormat {
+public:
+ dumpFormat(ostream & o)
+ : ost(o) {}
+ void operator()(ExternalTemplate::Formats::value_type const & vt) const{
+ ExternalTemplate::FormatTemplate const & ft = vt.second;
+ ost << "\tFormat " << vt.first << "\n"
+ << "\t\tProduct " << ft.product << "\n"
+ << "\t\tUpdateCommand " << ft.updateCommand << "\n"
+ << "\t\tRequirement " << ft.requirement << "\n"
+ << "\t\tPreamble\n"
+ << ft.preamble
+ << "\t\tPreambleEnd\n"
+ << "\tFormatEnd\n";
+ }
+private:
+ ostream & ost;
+};
+
+
+void ExternalTemplate::dumpFormats(ostream & os) const
+{
+ for_each(formats.begin(), formats.end(), dumpFormat(os));
+}
+
+void ExternalTemplateManager::dumpTemplates() const
+{
+ for_each(templates.begin(), templates.end(), dumpTemplate(lyxerr));
+}
+
+
+ExternalTemplateManager & ExternalTemplateManager::get()
+{
+ static ExternalTemplateManager externalTemplateManager;
+ return externalTemplateManager;
+}
+
+
+ExternalTemplateManager::Templates &
+ExternalTemplateManager::getTemplates()
+{
+ return templates;
+}
+
+
+ExternalTemplateManager::Templates const &
+ExternalTemplateManager::getTemplates() const
+{
+ return templates;
+}
+
+
+void ExternalTemplateManager::readTemplates(string const & path)
+{
+ Path p(path);
+
+ enum TemplateTags {
+ TM_TEMPLATE = 1,
+ TM_END
+ };
+
+ keyword_item templatetags[] = {
+ { "template", TM_TEMPLATE },
+ { "templateend", TM_END }
+ };
+
+ LyXLex lex(templatetags, TM_END);
+ if (!lex.setFile("external_templates")) {
+ lyxerr << "No template file" << endl;
+ return;
+ }
+
+ while (lex.IsOK()) {
+ switch(lex.lex()) {
+ case TM_TEMPLATE: {
+ lex.next();
+ string temp = lex.GetString();
+ ExternalTemplate & tmp = templates[temp];
+ tmp.lyxName = temp;
+ tmp.readTemplate(lex);
+ }
+ break;
+
+ case TM_END:
+ lyxerr << "TemplateEnd: " << lex.GetString() << endl;
+ lyxerr << "Warning: End outside Template." << endl;
+ break;
+ }
+ }
+}
+
+
+void ExternalTemplate::readTemplate(LyXLex & lex)
+{
+ enum TemplateOptionTags {
+ TO_GUINAME = 1,
+ TO_HELPTEXT,
+ TO_FILTER,
+ TO_VIEWCMD,
+ TO_EDITCMD,
+ TO_AUTOMATIC,
+ TO_FORMAT,
+ TO_END
+ };
+
+ keyword_item templateoptiontags[] = {
+ { "automaticproduction", TO_AUTOMATIC },
+ { "editcommand", TO_EDITCMD },
+ { "filefilter", TO_FILTER },
+ { "format", TO_FORMAT },
+ { "guiname", TO_GUINAME },
+ { "helptext", TO_HELPTEXT },
+ { "templateend", TO_END },
+ { "viewcommand", TO_VIEWCMD }
+ };
+
+ pushpophelper pph(lex, templateoptiontags, TO_END);
+
+ while (lex.IsOK()) {
+ switch (lex.lex()) {
+ case TO_GUINAME:
+ lex.next(true);
+ guiName = lex.GetString();
+ break;
+
+ case TO_HELPTEXT:
+ helpText = lex.getLongString("HelpTextEnd");
+ break;
+
+ case TO_FILTER:
+ lex.next(true);
+ fileRegExp = lex.GetString();
+ break;
+
+ case TO_VIEWCMD:
+ lex.next(true);
+ viewCommand = lex.GetString();
+ // For security reasons, a command may not be empty!
+ if (viewCommand.empty())
+ viewCommand = "true";
+ break;
+
+ case TO_EDITCMD:
+ lex.next(true);
+ editCommand = lex.GetString();
+ // For security reasons, a command may not be empty!
+ if (editCommand.empty())
+ editCommand = "true";
+ break;
+
+ case TO_AUTOMATIC:
+ lex.next();
+ automaticProduction = lex.GetBool();
+ break;
+
+ case TO_FORMAT:
+ lex.next(true);
+ formats[lex.GetString()].readFormat(lex);
+ break;
+
+ case TO_END:
+ return;
+
+ default:
+ lyxerr << "Default: " << lex.GetString() << endl;
+ Assert(false);
+ break;
+ }
+ }
+}
+
+
+void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
+{
+ enum FormatTags {
+ FO_PRODUCT = 1,
+ FO_UPDATECMD,
+ FO_REQUIREMENT,
+ FO_PREAMBLE,
+ FO_END
+ };
+
+ keyword_item formattags[] = {
+ { "formatend", FO_END },
+ { "preamble", FO_PREAMBLE },
+ { "product", FO_PRODUCT },
+ { "requirement", FO_REQUIREMENT },
+ { "updatecommand", FO_UPDATECMD }
+ };
+
+ pushpophelper pph(lex, formattags, FO_END);
+
+ while (lex.IsOK()) {
+ switch(lex.lex()) {
+ case FO_PRODUCT:
+ lex.next(true);
+ product = lex.GetString();
+ break;
+
+ case FO_UPDATECMD:
+ lex.next(true);
+ updateCommand = lex.GetString();
+ // For security reasons, a command may not be empty!
+ if (updateCommand.empty())
+ updateCommand = "true";
+ break;
+
+ case FO_REQUIREMENT:
+ lex.next(true);
+ requirement = lex.GetString();
+ break;
+
+ case FO_PREAMBLE:
+ preamble = lex.getLongString("preambleend");
+ break;
+
+ case FO_END:
+ lyxerr << "FormatEnd: " << lex.GetString() << endl;
+ return;
+ }
+ }
+}
+
--- /dev/null
+// -*- C++ -*-
+/* This file is part of*
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-2000 The LyX Team.
+ *
+ * ====================================================== */
+
+#ifndef EXTERNALTEMPLATE_H
+#define EXTERNALTEMPLATE_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include <iosfwd>
+#include <map>
+#include "LString.h"
+
+class LyXLex;
+
+struct ExternalTemplate {
+ /// What is the name of this template in the LyX format?
+ string lyxName;
+ /// What will the button in the GUI say?
+ string guiName;
+ /// A short help text
+ string helpText;
+ /// A file extension regular expression for the file browser
+ string fileRegExp;
+ /// What command should be executed to view the file?
+ string viewCommand;
+ /// What command should be executed to edit the file?
+ string editCommand;
+ /// Should we do automatic production of the output?
+ bool automaticProduction;
+ /// This is the information needed to support a specific output format
+ struct FormatTemplate {
+ /// The text that should be inserted into the exported file
+ string product;
+ /// The shell command to produce a resulting file
+ string updateCommand;
+ /// What features does this external inset require?
+ string requirement;
+ /// What should be inserted into the preamble
+ string preamble;
+ ///
+ void readFormat(LyXLex &);
+ /// This constructor has to default a command for safety reasons!
+ FormatTemplate();
+ };
+ void readTemplate(LyXLex &);
+
+ typedef std::map<string, FormatTemplate> Formats;
+
+ Formats formats;
+
+ void dumpFormats(std::ostream &) const;
+
+ /// We have to have default commands for safety reasons!
+ ExternalTemplate();
+
+};
+
+/**
+ * A singleton class that manages the external inset templates
+ */
+class ExternalTemplateManager {
+public:
+ /// Map from the LyX name of the template to the template structure
+ typedef std::map<string, ExternalTemplate> Templates;
+
+ static ExternalTemplateManager & get();
+ Templates & getTemplates();
+ Templates const & getTemplates() const;
+private:
+ ExternalTemplateManager();
+ void readTemplates(string const & path);
+ void dumpTemplates() const;
+ Templates templates;
+};
+
+#endif
+
AUTOMAKE_OPTIONS = foreign
-MAINTAINERCLEANFILES = Makefile.in
+DISTCLEANFILES= *.orig *.rej *~ *.bak core
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
noinst_LTLIBRARIES = libinsets.la
LIBS =
-ETAGS_ARGS = --c++
+ETAGS_ARGS = --lang=c++
INCLUDES = -I${srcdir}/../
libinsets_la_SOURCES = \
BoundingBox.h \
+ ExternalTemplate.C \
+ ExternalTemplate.h \
figinset.C \
figinset.h \
form_graphics.C \
inset.C \
insetbib.C \
insetbib.h \
+ insetbutton.C \
+ insetbutton.h \
insetcite.C \
insetcite.h \
insetcollapsable.C \
inseterror.h \
insetert.C \
insetert.h \
+ insetexternal.C \
+ insetexternal.h \
insetfoot.C \
insetfoot.h \
insetgraphics.C \
}
-void InsetFig::Write(ostream & os) const
+void InsetFig::Write(Buffer const *, ostream & os) const
{
Regenerate();
os << "Figure size " << wid << " " << hgh << "\n";
}
-void InsetFig::Read(LyXLex & lex)
+void InsetFig::Read(Buffer const *, LyXLex & lex)
{
string buf;
bool finished = false;
}
-int InsetFig::Latex(ostream & os,
+int InsetFig::Latex(Buffer const *, ostream & os,
bool /* fragile*/, bool /* fs*/) const
{
Regenerate();
}
-int InsetFig::Ascii(ostream &) const
+int InsetFig::Ascii(Buffer const *, ostream &) const
{
return 0;
}
-int InsetFig::Linuxdoc(ostream &) const
+int InsetFig::Linuxdoc(Buffer const *, ostream &) const
{
return 0;
}
-int InsetFig::DocBook(ostream & os) const
+int InsetFig::DocBook(Buffer const *, ostream & os) const
{
- string figurename = fname;
+ string buf1 = OnlyPath(owner->fileName());
+ string figurename = MakeRelPath(fname, buf1);
if(suffixIs(figurename, ".eps"))
figurename.erase(fname.length() - 4);
os << "@<graphic fileref=\"" << figurename << "\"></graphic>";
return 0;
-}
+}
void InsetFig::Validate(LaTeXFeatures & features) const
void draw(Painter &, LyXFont const & font,
int baseline, float & x) const;
///
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
///
- void Read(LyXLex & lex);
+ void Read(Buffer const *, LyXLex & lex);
///
- int Latex(std::ostream &, bool fragile, bool free_space) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool free_space) const;
///
- int Ascii(std::ostream &) const;
+ int Ascii(Buffer const *, std::ostream &) const;
///
- int Linuxdoc(std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream &) const;
///
- int DocBook(std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const;
/// Updates needed features for this inset.
void Validate(LaTeXFeatures & features) const;
scx = 0;
- mx_scx = abs((width(bv->painter(), font) - bv->paperWidth()) / 2);
+ mx_scx = abs((width(bv->painter(), font) - bv->workWidth()) / 2);
}
inset->setOptions(fl_get_input(bibitem_form->label));
fl_hide_form(bibitem_form->bibitem_form);
// Does look like a hack? It is! (but will change at 0.13)
- holder->view->text->RedoParagraph();
- holder->view->update(1);
+ holder->view->text->RedoParagraph(holder->view);
+ holder->view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
break;
} // fall through to Cancel on RO-mode
}
// as a LyX 2.x command, and lyxlex is not enough smart to understand
// real LaTeX commands. Yes, that could be fixed, but would be a waste
// of time cause LyX3 won't use lyxlex anyway. (ale)
-void InsetBibKey::Write(ostream & os) const
+void InsetBibKey::Write(Buffer const *, ostream & os) const
{
os << "\\bibitem ";
if (! getOptions().empty()) {
}
-int InsetBibtex::Latex(ostream & os,
+int InsetBibtex::Latex(Buffer const *, ostream & os,
bool /*fragile*/, bool/*fs*/) const
{
// this looks like an horrible hack and it is :) The problem
///
Inset * Clone() const { return new InsetBibKey(this); }
/// Currently \bibitem is used as a LyX2.x command, so we need this method.
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
///
virtual string getScreenLabel() const;
///
InsetBibKey * inset;
BufferView * view;
};
-
+
private:
///
int counter;
///
void Edit(BufferView *, int x, int y, unsigned int button);
///
- int Latex(std::ostream &, bool fragile, bool freespace) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool freespace) const;
///
std::vector< std::pair<string,string> > getKeys() const;
///
--- /dev/null
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 2000 The LyX Team.
+ *
+ * ====================================================== */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "insetbutton.h"
+#include "debug.h"
+#include "Painter.h"
+
+using std::ostream;
+using std::endl;
+
+
+InsetButton::InsetButton()
+{
+}
+
+int InsetButton::ascent(Painter & pain, LyXFont const &) const
+{
+ LyXFont font(LyXFont::ALL_SANE);
+ font.decSize();
+
+ int width, ascent, descent;
+ string s = getScreenLabel();
+
+ if (Editable()) {
+ pain.buttonText(0, 0, s, font,
+ false, width, ascent, descent);
+ } else {
+ pain.rectText(0, 0, s, font,
+ LColor::commandbg, LColor::commandframe,
+ false, width, ascent, descent);
+ }
+ return ascent;
+}
+
+
+int InsetButton::descent(Painter & pain, LyXFont const &) const
+{
+ LyXFont font(LyXFont::ALL_SANE);
+ font.decSize();
+
+ int width, ascent, descent;
+ string s = getScreenLabel();
+
+ if (Editable()) {
+ pain.buttonText(0, 0, s, font,
+ false, width, ascent, descent);
+ } else {
+ pain.rectText(0, 0, s, font,
+ LColor::commandbg, LColor::commandframe,
+ false, width, ascent, descent);
+ }
+ return descent;
+}
+
+
+int InsetButton::width(Painter & pain, LyXFont const &) const
+{
+ LyXFont font(LyXFont::ALL_SANE);
+ font.decSize();
+
+ int width, ascent, descent;
+ string s = getScreenLabel();
+
+ if (Editable()) {
+ pain.buttonText(0, 0, s, font,
+ false, width, ascent, descent);
+ } else {
+ pain.rectText(0, 0, s, font,
+ LColor::commandbg, LColor::commandframe,
+ false, width, ascent, descent);
+ }
+ return width + 4;
+}
+
+
+void InsetButton::draw(Painter & pain, LyXFont const &,
+ int baseline, float & x) const
+{
+ // Draw it as a box with the LaTeX text
+ LyXFont font(LyXFont::ALL_SANE);
+ font.setColor(LColor::command).decSize();
+
+ int width;
+ string s = getScreenLabel();
+
+ if (Editable()) {
+ pain.buttonText(int(x)+2, baseline, s, font, true, width);
+ } else {
+ pain.rectText(int(x)+2, baseline, s, font,
+ LColor::commandbg, LColor::commandframe,
+ true, width);
+ }
+
+ x += width + 4;
+}
--- /dev/null
+// -*- C++ -*-
+/* This file is part of*
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 2000 The LyX Team.
+ *
+ * ====================================================== */
+
+#ifndef INSET_BUTTON_H
+#define INSET_BUTTON_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "lyxinset.h"
+#include "LString.h"
+
+/** Used to provide an inset that looks like a button.
+ */
+class InsetButton: public Inset {
+public:
+ ///
+ InsetButton();
+
+ ///
+ int ascent(Painter &, LyXFont const &) const;
+ ///
+ int descent(Painter &, LyXFont const &) const;
+ ///
+ int width(Painter &, LyXFont const &) const;
+ ///
+ void draw(Painter &, LyXFont const &, int baseline, float & x) const;
+
+protected:
+ /// This should provide the text for the button
+ virtual string getScreenLabel() const = 0;
+};
+
+#endif
+
fl_activate_object( form->delBtn );
fl_set_object_lcol( form->delBtn, FL_BLACK );
- unsigned int sel = fl_get_browser( form->citeBrsr );
+ int sel = fl_get_browser( form->citeBrsr );
if( sel != 1 ) {
fl_activate_object( form->upBtn );
fl_set_object_lcol( form->upBtn, FL_INACTIVE );
}
- if( sel != fl_get_browser_maxline( form->citeBrsr ) ) {
+ if( sel != fl_get_browser_maxline(form->citeBrsr)) {
fl_activate_object( form->downBtn );
fl_set_object_lcol( form->downBtn, FL_BLACK );
} else {
using std::ostream;
-InsetCollapsable::InsetCollapsable(Buffer * bf)
- : InsetText(bf)
+InsetCollapsable::InsetCollapsable() : InsetText()
{
collapsed = true;
label = "Label";
Inset * InsetCollapsable::Clone() const
{
- InsetCollapsable * result = new InsetCollapsable(buffer);
- result->init(buffer, this);
+ InsetCollapsable * result = new InsetCollapsable();
+ result->init(this);
result->collapsed = collapsed;
return result;
}
-void InsetCollapsable::Write(ostream & os) const
+void InsetCollapsable::Write(Buffer const * buf, ostream & os) const
{
os << getInsetName() << "\n\ncollapsed ";
if (display())
os << "false\n";
else
os << "true\n";
- WriteParagraphData(os);
+ WriteParagraphData(buf, os);
}
-void InsetCollapsable::Read(LyXLex & lex)
+void InsetCollapsable::Read(Buffer const * buf, LyXLex & lex)
{
if (lex.IsOK()) {
lex.next();
collapsed = lex.GetBool();
}
}
- InsetText::Read(lex);
+ InsetText::Read(buf, lex);
}
static int const TEXT_TO_BOTTOM_OFFSET = 2;
///
explicit
- InsetCollapsable(Buffer *);
+ InsetCollapsable();
///
~InsetCollapsable() {}
///
Inset * Clone() const;
///
- void Read(LyXLex &);
+ void Read(Buffer const *, LyXLex &);
///
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
///
int ascent(Painter &, LyXFont const &) const;
///
}
-int InsetCommand::ascent(Painter & pain, LyXFont const &) const
-{
- LyXFont font(LyXFont::ALL_SANE);
- font.decSize();
-
- int width, ascent, descent;
- string s = getScreenLabel();
-
- if (Editable()) {
- pain.buttonText(0, 0, s, font,
- false, width, ascent, descent);
- } else {
- pain.rectText(0, 0, s, font,
- LColor::commandbg, LColor::commandframe,
- false, width, ascent, descent);
- }
- return ascent;
-}
-
-
-int InsetCommand::descent(Painter & pain, LyXFont const &) const
-{
- LyXFont font(LyXFont::ALL_SANE);
- font.decSize();
-
- int width, ascent, descent;
- string s = getScreenLabel();
-
- if (Editable()) {
- pain.buttonText(0, 0, s, font,
- false, width, ascent, descent);
- } else {
- pain.rectText(0, 0, s, font,
- LColor::commandbg, LColor::commandframe,
- false, width, ascent, descent);
- }
- return descent;
-}
-
-
-int InsetCommand::width(Painter & pain, LyXFont const &) const
-{
- LyXFont font(LyXFont::ALL_SANE);
- font.decSize();
-
- int width, ascent, descent;
- string s = getScreenLabel();
-
- if (Editable()) {
- pain.buttonText(0, 0, s, font,
- false, width, ascent, descent);
- } else {
- pain.rectText(0, 0, s, font,
- LColor::commandbg, LColor::commandframe,
- false, width, ascent, descent);
- }
- return width + 4;
-}
-
-
-void InsetCommand::draw(Painter & pain, LyXFont const &,
- int baseline, float & x) const
-{
- // Draw it as a box with the LaTeX text
- LyXFont font(LyXFont::ALL_SANE);
- font.setColor(LColor::command).decSize();
-
- int width;
- string s = getScreenLabel();
-
- if (Editable()) {
- pain.buttonText(int(x)+2, baseline, s, font, true, width);
- } else {
- pain.rectText(int(x)+2, baseline, s, font,
- LColor::commandbg, LColor::commandframe,
- true, width);
- }
-
- x += width + 4;
-}
-
-
// In lyxf3 this will be just LaTeX
-void InsetCommand::Write(ostream & os) const
+void InsetCommand::Write(Buffer const *, ostream & os) const
{
os << "LatexCommand " << getCommand() << "\n";
}
// This function will not be necessary when lyx3
-void InsetCommand::Read(LyXLex & lex)
+void InsetCommand::Read(Buffer const *, LyXLex & lex)
{
if (lex.EatLine()) {
string t = lex.GetString();
}
-int InsetCommand::Latex(ostream & os, bool /*fragile*/, bool/*fs*/) const
+int InsetCommand::Latex(Buffer const *, ostream & os, bool /*fragile*/, bool/*fs*/) const
{
os << getCommand();
return 0;
}
-int InsetCommand::Ascii(ostream &) const
+int InsetCommand::Ascii(Buffer const *, ostream &) const
{
return 0;
}
-int InsetCommand::Linuxdoc(ostream &) const
+int InsetCommand::Linuxdoc(Buffer const *, ostream &) const
{
return 0;
}
-int InsetCommand::DocBook(ostream &) const
+int InsetCommand::DocBook(Buffer const *, ostream &) const
{
return 0;
}
#pragma interface
#endif
-#include "lyxinset.h"
-#include "LString.h"
+#include "insetbutton.h"
// Created by Alejandro 970222
/** Used to insert a LaTeX command automatically
* Similar to InsetLaTeX but having control of the basic structure of a
* LaTeX command: \name[options]{contents}.
*/
-class InsetCommand: public Inset {
+class InsetCommand: public InsetButton {
public:
///
InsetCommand();
InsetCommand(string const & name, string const & arg = string(),
string const & opt = string());
///
- int ascent(Painter &, LyXFont const &) const;
- ///
- int descent(Painter &, LyXFont const &) const;
- ///
- int width(Painter &, LyXFont const &) const;
- ///
- void draw(Painter &, LyXFont const &, int baseline, float & x) const;
- ///
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
+
/// Parse the command.
void scanCommand(string const & cmd);
/// Will not be used when lyxf3
- void Read(LyXLex & lex);
+ void Read(Buffer const *, LyXLex & lex);
///
- virtual int Latex(std::ostream &,
+ virtual int Latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const;
///
- int Ascii(std::ostream &) const;
+ int Ascii(Buffer const *, std::ostream &) const;
///
- virtual int Linuxdoc(std::ostream &) const;
+ virtual int Linuxdoc(Buffer const *, std::ostream &) const;
///
- virtual int DocBook(std::ostream &) const;
+ virtual int DocBook(Buffer const *, std::ostream &) const;
///
Inset * Clone() const;
///
}
-void InsetError::Write(ostream &) const
+void InsetError::Write(Buffer const *, ostream &) const
{
}
-void InsetError::Read(LyXLex &)
+void InsetError::Read(Buffer const *, LyXLex &)
{
}
-int InsetError::Latex(ostream &,
+int InsetError::Latex(Buffer const *, ostream &,
bool /*fragile*/, bool /*fs*/) const
{
return 0;
}
-int InsetError::Ascii(ostream &) const
+int InsetError::Ascii(Buffer const *, ostream &) const
{
return 0;
}
-int InsetError::Linuxdoc(ostream &) const
+int InsetError::Linuxdoc(Buffer const *, ostream &) const
{
return 0;
}
-int InsetError::DocBook(ostream &) const
+int InsetError::DocBook(Buffer const *, ostream &) const
{
return 0;
}
///
void draw(Painter &, LyXFont const & font, int baseline, float & x) const;
///
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
///
- void Read(LyXLex & lex);
+ void Read(Buffer const *, LyXLex & lex);
///
- int Latex(std::ostream &, bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
///
- int Ascii(std::ostream &) const;
+ int Ascii(Buffer const *, std::ostream &) const;
///
- int Linuxdoc(std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream &) const;
///
- int DocBook(std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const;
///
bool AutoDelete() const;
/// what appears in the minibuffer when opening
using std::ostream;
-InsetERT::InsetERT(Buffer * bf)
- : InsetCollapsable(bf)
+InsetERT::InsetERT() : InsetCollapsable()
{
setLabel(_("ERT"));
LyXFont font(LyXFont::ALL_SANE);
Inset * InsetERT::Clone() const
{
- InsetERT * result = new InsetERT(buffer);
- result->init(buffer, this);
+ InsetERT * result = new InsetERT();
+ result->init(this);
result->collapsed = collapsed;
return result;
class InsetERT : public InsetCollapsable {
public:
///
- InsetERT(Buffer *);
+ InsetERT();
///
~InsetERT() {}
///
--- /dev/null
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-2000 The LyX Team.
+ *
+ * ====================================================== */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include FORMS_H_LOCATION
+#include <cstdio>
+
+#include "insetexternal.h"
+#include "ExternalTemplate.h"
+#include "lyx_gui_misc.h" // CancelCloseBoxCB
+#include "BufferView.h"
+#include "buffer.h"
+#include "filedlg.h"
+#include "lyx_main.h"
+#include "LaTeXFeatures.h"
+#include "support/filetools.h"
+#include "support/lstrings.h"
+#include "support/path.h"
+#include "support/syscall.h"
+
+using std::endl;
+
+InsetExternal::InsetExternal()
+ : form_external(0)
+{
+ tempname = TmpFileName();
+}
+
+InsetExternal::~InsetExternal() {
+ remove(tempname.c_str());
+}
+
+
+extern "C" void ExternalTemplateCB(FL_OBJECT * ob, long data)
+{
+ InsetExternal::templateCB(ob, data);
+}
+
+
+extern "C" void ExternalBrowseCB(FL_OBJECT * ob, long data)
+{
+ InsetExternal::browseCB(ob, data);
+}
+
+
+extern "C" void ExternalEditCB(FL_OBJECT * ob, long data)
+{
+ InsetExternal::editCB(ob, data);
+}
+
+
+extern "C" void ExternalViewCB(FL_OBJECT * ob, long data)
+{
+ InsetExternal::viewCB(ob, data);
+}
+
+
+extern "C" void ExternalUpdateCB(FL_OBJECT * ob, long data)
+{
+ InsetExternal::updateCB(ob, data);
+}
+
+
+extern "C" void ExternalOKCB(FL_OBJECT * ob, long data)
+{
+ InsetExternal::okCB(ob, data);
+}
+
+
+extern "C" void ExternalCancelCB(FL_OBJECT * ob, long data)
+{
+ InsetExternal::cancelCB(ob, data);
+}
+
+
+void InsetExternal::templateCB(FL_OBJECT * ob, long)
+{
+ Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
+ InsetExternal * inset = holder->inset;
+ ExternalTemplate et = inset->getTemplate(inset->getCurrentTemplate());
+ // Update the help text
+ fl_clear_browser(inset->form_external->helptext);
+ fl_addto_browser(inset->form_external->helptext, et.helpText.c_str());
+ fl_set_browser_topline(inset->form_external->helptext, 0);
+}
+
+
+void InsetExternal::browseCB(FL_OBJECT * ob, long)
+{
+ Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
+ InsetExternal * inset = holder->inset;
+
+ static string current_path;
+ static int once = 0;
+ LyXFileDlg fileDlg;
+
+ string p = inset->filename;
+ string buf = MakeAbsPath(holder->view->buffer()->fileName());
+ string buf2 = OnlyPath(buf);
+ if (!p.empty()) {
+ buf = MakeAbsPath(p, buf2);
+ buf = OnlyPath(buf);
+ } else {
+ buf = OnlyPath(holder->view->buffer()->fileName().c_str());
+ }
+
+ fileDlg.SetButton(0, _("Document"), buf);
+
+ /// Determine the template file extension
+ ExternalTemplate et = inset->getTemplate(inset->getCurrentTemplate());
+ string regexp = et.fileRegExp;
+ if (regexp.empty()) {
+ regexp = "*";
+ }
+
+ bool error = false;
+ do {
+ // ProhibitInput(current_view);
+ if (once) {
+ p = fileDlg.Select(_("External inset file"),
+ current_path,
+ regexp, string());
+ } else {
+ p = fileDlg.Select(_("External inset file"), buf,
+ regexp, string());
+ }
+ // AllowInput(current_view);
+
+ if (p.empty()) return;
+
+ buf = MakeRelPath(p, buf2);
+ current_path = OnlyPath(p);
+ once = 1;
+
+ if (contains(p, "#") || contains(p, "~") || contains(p, "$")
+ || contains(p, "%")) {
+ WriteAlert(_("Filename can't contain any "
+ "of these characters:"),
+ // xgettext:no-c-format
+ _("'#', '~', '$' or '%'."));
+ error = true;
+ }
+ } while (error);
+
+ if (inset->form_external)
+ fl_set_input(inset->form_external->filename, buf.c_str());
+
+}
+
+
+void InsetExternal::editCB(FL_OBJECT * ob, long)
+{
+ Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
+ InsetExternal * inset = holder->inset;
+ inset->doApply(holder->view);
+ inset->doEdit(holder->view);
+}
+
+
+void InsetExternal::viewCB(FL_OBJECT * ob, long)
+{
+ Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
+ InsetExternal * inset = holder->inset;
+ inset->doApply(holder->view);
+ inset->doView(holder->view);
+}
+
+
+void InsetExternal::updateCB(FL_OBJECT * ob, long)
+{
+ Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
+ InsetExternal * inset = holder->inset;
+ inset->doApply(holder->view);
+ inset->doUpdate(holder->view);
+}
+
+
+void InsetExternal::okCB(FL_OBJECT * ob, long data)
+{
+ Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
+ InsetExternal * inset = holder->inset;
+ inset->doApply(holder->view);
+ cancelCB(ob,data);
+}
+
+
+void InsetExternal::doApply(BufferView * bufview)
+{
+ bool update = false;
+ if (templatename != getCurrentTemplate()) {
+ templatename = getCurrentTemplate();
+ update = true;
+ }
+ if (filename != fl_get_input(form_external->filename)) {
+ filename = fl_get_input(form_external->filename);
+ update = true;
+ }
+ if (parameters != fl_get_input(form_external->parameters)) {
+ parameters = fl_get_input(form_external->parameters);
+ update = true;
+ }
+
+ if (update) {
+ // The text might have change, so we should update the button look
+ bufview->updateInset(this, true);
+ }
+}
+
+
+void InsetExternal::cancelCB(FL_OBJECT * ob, long)
+{
+ Holder * holder = static_cast<Holder*>(ob->form->u_vdata);
+
+ InsetExternal * inset = holder->inset;
+ // BufferView * bv = holder->view;
+
+ if (inset->form_external) {
+ fl_hide_form(inset->form_external->form_external);
+ fl_free_form(inset->form_external->form_external);
+ inset->form_external = 0;
+ }
+}
+
+
+const char * InsetExternal::EditMessage() const
+{
+ ExternalTemplate const & et = getTemplate(templatename);
+ return doSubstitution(0, et.guiName).c_str();
+}
+
+
+void InsetExternal::Edit(BufferView * bv,
+ int /*x*/, int /*y*/, unsigned int /*button*/)
+{
+ static int ow = -1, oh;
+
+ if (bv->buffer()->isReadonly())
+ WarnReadonly(bv->buffer()->fileName());
+
+ if (!form_external) {
+ form_external = create_form_form_external();
+ holder.inset = this;
+ // form_external->ok->u_vdata = &holder;
+ form_external->form_external->u_vdata = &holder;
+ fl_set_form_atclose(form_external->form_external,
+ CancelCloseBoxCB, 0);
+ }
+ holder.view = bv;
+ fl_addto_choice(form_external->templatechoice, getTemplateString().c_str());
+ fl_set_input(form_external->filename, filename.c_str());
+ fl_set_input(form_external->parameters, parameters.c_str());
+ if (!templatename.empty()) {
+ fl_set_choice(form_external->templatechoice, getTemplateNumber(templatename));
+ }
+ // Update the help text
+ templateCB(form_external->templatechoice, 0);
+
+ ExternalTemplate const & et = getTemplate(templatename);
+ if (et.automaticProduction) {
+ fl_deactivate_object(form_external->update);
+ fl_set_object_lcol(form_external->update, FL_INACTIVE);
+ } else {
+ fl_activate_object(form_external->update);
+ fl_set_object_lcol(form_external->update, FL_BLACK);
+ }
+
+ if (form_external->form_external->visible) {
+ fl_raise_form(form_external->form_external);
+ } else {
+ fl_show_form(form_external->form_external,
+ FL_PLACE_MOUSE | FL_FREE_SIZE,
+ FL_FULLBORDER, _("Insert external inset"));
+ if (ow < 0) {
+ ow = form_external->form_external->w;
+ oh = form_external->form_external->h;
+ }
+ fl_set_form_minsize(form_external->form_external, ow, oh);
+ }
+}
+
+
+void InsetExternal::Write(Buffer const *, std::ostream & os) const
+{
+ os << "External " << templatename << ",\"" << filename
+ << "\",\"" << parameters << "\"\n";
+}
+
+
+void InsetExternal::Read(Buffer const *, LyXLex & lex)
+{
+ lex.EatLine();
+ string format = lex.GetString();
+ int pos1 = format.find(",");
+ templatename = format.substr(0, pos1);
+ int pos2 = format.find("\",\"", pos1);
+ filename = format.substr(pos1 + 2, pos2 - (pos1 + 2));
+ parameters = format.substr(pos2 + 3, format.length() - (pos2 + 4));
+
+ lyxerr << templatename << " " << filename << " " << parameters << endl;
+}
+
+int InsetExternal::write(string const & format, Buffer const * buf,
+ std::ostream & os) const {
+ ExternalTemplate const & et = getTemplate(templatename);
+ ExternalTemplate::Formats::const_iterator cit =
+ et.formats.find(format);
+ if (et.automaticProduction) {
+ executeCommand(doSubstitution(buf, (*cit).second.updateCommand), buf);
+ }
+
+ os << doSubstitution(buf, (*cit).second.product);
+ return 0; // CHECK
+
+}
+
+int InsetExternal::Latex(Buffer const * buf, std::ostream & os, bool, bool) const
+{
+ return write("LaTeX", buf, os);
+}
+
+
+int InsetExternal::Ascii(Buffer const * buf, std::ostream & os) const
+{
+ return write("Ascii", buf, os);
+}
+
+
+int InsetExternal::Linuxdoc(Buffer const * buf, std::ostream & os) const
+{
+ return write("LinuxDoc", buf, os);
+}
+
+
+int InsetExternal::DocBook(Buffer const * buf, std::ostream & os) const
+{
+ return write("DocBook", buf, os);
+}
+
+
+void InsetExternal::Validate(LaTeXFeatures & features) const
+{
+ ExternalTemplate const & et = getTemplate(templatename);
+ ExternalTemplate::Formats::const_iterator cit =
+ et.formats.find("LaTeX");
+ if (!(*cit).second.requirement.empty()) {
+ features.require((*cit).second.requirement);
+ }
+ if (!(*cit).second.preamble.empty()) {
+ features.externalPreambles += (*cit).second.preamble + "\n";
+ }
+}
+
+
+Inset * InsetExternal::Clone() const
+{
+ InsetExternal * inset = new InsetExternal();
+ inset->templatename = templatename;
+ inset->filename = filename;
+ inset->parameters = parameters;
+ return inset;
+}
+
+
+string InsetExternal::getScreenLabel() const
+{
+ if (templatename.empty()) {
+ return _("External");
+ } else {
+ ExternalTemplate const & et = getTemplate(templatename);
+ return doSubstitution(0, et.guiName);
+ }
+}
+
+
+void InsetExternal::doUpdate(BufferView const * bv) const
+{
+ ExternalTemplate const & et = getTemplate(getCurrentTemplate());
+ ExternalTemplate::Formats::const_iterator cit =
+ et.formats.find("LaTeX");
+ executeCommand(doSubstitution(bv->buffer(), (*cit).second.updateCommand), bv->buffer());
+}
+
+
+void InsetExternal::doView(BufferView const * bv) const
+{
+ automaticUpdate(bv);
+ ExternalTemplate const & et = getTemplate(getCurrentTemplate());
+ executeCommand(doSubstitution(bv->buffer(), et.viewCommand), bv->buffer());
+}
+
+
+void InsetExternal::doEdit(BufferView const * bv) const
+{
+ automaticUpdate(bv);
+ ExternalTemplate const & et = getTemplate(getCurrentTemplate());
+ executeCommand(doSubstitution(bv->buffer(),et.editCommand), bv->buffer());
+}
+
+
+void InsetExternal::executeCommand(string const & s, Buffer const * buffer) const
+{
+ string buf = MakeAbsPath(buffer->fileName());
+ string path = OnlyPath(buf);
+ Path p(path);
+ Systemcalls one;
+ if (lyxerr.debugging()) {
+ lyxerr << "Executing '" << s << "' in '" << path << "'" << endl;
+ }
+ one.startscript(Systemcalls::Wait, s);
+}
+
+
+void InsetExternal::automaticUpdate(BufferView const * bv) const
+{
+ ExternalTemplate const & et = getTemplate(templatename);
+ if (et.automaticProduction) {
+ doUpdate(bv);
+ }
+}
+
+
+string InsetExternal::doSubstitution(Buffer const * buffer, string const & s) const
+{
+ string result;
+ string basename = ChangeExtension(filename, string());
+ result = subst(s, "$$FName", filename);
+ result = subst(result, "$$Basename", basename);
+ result = subst(result, "$$Parameters", parameters);
+ result = ReplaceEnvironmentPath(result);
+ result = subst(result, "$$Tempname", tempname);
+ result = subst(result, "$$Sysdir", system_lyxdir);
+
+ // Handle the $$Contents(filename) syntax
+ if (contains(result, "$$Contents(\"")) {
+
+ int pos = result.find("$$Contents(\"");
+ int end = result.find("\")", pos);
+ string file = result.substr(pos + 12, end - (pos + 12));
+ string contents;
+ if (buffer) {
+ // Make sure we are in the directory of the buffer
+ string buf = MakeAbsPath(buffer->fileName());
+ string path = OnlyPath(buf);
+ Path p(path);
+ contents = GetFileContents(file);
+ } else {
+ contents = GetFileContents(file);
+ }
+ result = subst(result, ("$$Contents(\"" + file + "\")").c_str(), contents);
+ }
+
+ return result;
+}
+
+
+string InsetExternal::getCurrentTemplate() const
+{
+ return getTemplateName(fl_get_choice(form_external->templatechoice));
+}
+
+
+ExternalTemplate InsetExternal::getTemplate(string const & name) const
+{
+ ExternalTemplateManager::Templates::const_iterator i =
+ ExternalTemplateManager::get().getTemplates().find(name);
+ // Make sure that the template exists in the map
+ if (i == ExternalTemplateManager::get().getTemplates().end()) {
+ lyxerr << "Unknown external material template!" << endl;
+ return ExternalTemplate();
+ }
+ return (*i).second;
+}
+
+
+int InsetExternal::getTemplateNumber(string const & name) const
+{
+ int i = 1;
+ ExternalTemplateManager::Templates::const_iterator i1, i2;
+ i1 = ExternalTemplateManager::get().getTemplates().begin();
+ i2 = ExternalTemplateManager::get().getTemplates().end();
+ for (; i1 != i2; ++i1) {
+ if ((*i1).second.lyxName == name)
+ return i;
+ ++i;
+ }
+ // This should never happen
+ Assert(false);
+ return 0;
+}
+
+
+string InsetExternal::getTemplateName(int i) const
+{
+ ExternalTemplateManager::Templates::const_iterator i1;
+ i1 = ExternalTemplateManager::get().getTemplates().begin();
+ for (int n = 1; n < i; ++n) {
+ ++i1;
+ }
+ return (*i1).second.lyxName;
+}
+
+
+string InsetExternal::getTemplateString() const
+{
+ string result;
+ bool first = true;
+ ExternalTemplateManager::Templates::const_iterator i1, i2;
+ i1 = ExternalTemplateManager::get().getTemplates().begin();
+ i2 = ExternalTemplateManager::get().getTemplates().end();
+ for (; i1 != i2; ++i1) {
+ if (!first) {
+ result += "|";
+ } else {
+ first = false;
+ }
+ result += (*i1).second.lyxName;
+ }
+ return result;
+}
--- /dev/null
+// -*- C++ -*-
+/* This file is part of*
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-2000 The LyX Team.
+ *
+ * ====================================================== */
+
+#ifndef INSET_EXTERNAL_H
+#define INSET_EXTERNAL_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "insetbutton.h"
+#include "LString.h"
+#include "../lyx.h"
+struct ExternalTemplate;
+
+class InsetExternal : public InsetButton {
+public:
+ InsetExternal();
+ ///
+ virtual ~InsetExternal();
+ /// what appears in the minibuffer when opening
+ virtual const char * EditMessage() const;
+ ///
+ virtual void Edit(BufferView *, int x, int y, unsigned int button);
+ ///
+ virtual EDITABLE Editable() const { return IS_EDITABLE; }
+ ///
+ virtual void Write(Buffer const *, std::ostream &) const;
+ ///
+ virtual void Read(Buffer const *, LyXLex & lex);
+ /** returns the number of rows (\n's) of generated tex code.
+ fragile == true means, that the inset should take care about
+ fragile commands by adding a \protect before.
+ If the free_spc (freespacing) variable is set, then this inset
+ is in a free-spacing paragraph.
+ */
+ virtual int Latex(Buffer const *, std::ostream &, bool fragile,
+ bool free_spc) const;
+ ///
+ virtual int Ascii(Buffer const *, std::ostream &) const;
+ ///
+ virtual int Linuxdoc(Buffer const *, std::ostream &) const;
+ ///
+ virtual int DocBook(Buffer const *, std::ostream &) const;
+ /// Updates needed features for this inset.
+ virtual void Validate(LaTeXFeatures & features) const;
+
+ /// returns LyX code associated with the inset. Used for TOC, ...)
+ virtual Inset::Code LyxCode() const { return EXTERNAL_CODE; }
+
+ ///
+ virtual Inset * Clone() const;
+
+ /// returns the text of the button
+ virtual string getScreenLabel() const;
+
+ /// Callback function for the template drop-down
+ static void templateCB(FL_OBJECT *, long);
+
+ /// Callback function for the browse button
+ static void browseCB(FL_OBJECT *, long);
+
+ /// Callback function for the edit button
+ static void editCB(FL_OBJECT *, long);
+
+ /// Callback function for the view button
+ static void viewCB(FL_OBJECT *, long);
+
+ /// Callback function for the update production button
+ static void updateCB(FL_OBJECT *, long);
+
+ /// Callback function for the ok button
+ static void okCB(FL_OBJECT *, long);
+
+ /// Callback function for the cancel button
+ static void cancelCB(FL_OBJECT *, long);
+private:
+ /// Write the output for a specific file format
+ int write(string const & format, Buffer const *, std::ostream &) const;
+
+ /// Apply the changes
+ void doApply(BufferView * bv);
+
+ /// Execute this command in the directory of this document
+ void executeCommand(string const & s, Buffer const * buf) const;
+
+ /// Update if automatic
+ void automaticUpdate(BufferView const *) const;
+
+ /// Do update
+ void doUpdate(BufferView const *) const;
+ /// Do edit
+ void doEdit(BufferView const *) const;
+ /// Do view
+ void doView(BufferView const *) const;
+
+ /// Substitute meta-variables in this string
+ string doSubstitution(Buffer const *, string const & s) const;
+
+ /// Get the LyX name of the currently selected template in the choice list
+ string getCurrentTemplate() const;
+
+ /// Get a certain template from a LyX name
+ ExternalTemplate getTemplate(string const & lyxname) const;
+
+ /**
+ * Get the number starting from 1 of a template with a
+ * specific LyX name for the choice list
+ */
+ int getTemplateNumber(string const & guiname) const;
+
+ /// Get the LyX name of a template with a given number starting from 1
+ string getTemplateName(int n) const;
+
+ /// Get a string with all the GUI template names separated by |
+ string getTemplateString() const;
+
+ ///
+ struct Holder {
+ InsetExternal * inset;
+ BufferView * view;
+ };
+ ///
+ Holder holder;
+
+ /// The external inset form
+ FD_form_external * form_external;
+
+ ///
+ string templatename;
+
+ ///
+ string filename;
+
+ ///
+ string parameters;
+
+ /// A temp filename
+ string tempname;
+};
+
+#endif
using std::ostream;
using std::endl;
-InsetFoot::InsetFoot(Buffer * bf)
- : InsetCollapsable(bf)
+InsetFoot::InsetFoot() : InsetCollapsable()
{
setLabel(_("foot"));
LyXFont font(LyXFont::ALL_SANE);
Inset * InsetFoot::Clone() const
{
- InsetFoot * result = new InsetFoot(buffer);
- result->init(buffer, this);
+ InsetFoot * result = new InsetFoot();
+ result->init(this);
result->collapsed = collapsed;
return result;
}
-int InsetFoot::Latex(ostream & os, bool fragile, bool fp) const
+int InsetFoot::Latex(Buffer const * buf, ostream & os, bool fragile, bool fp) const
{
os << "\\footnote{%" << endl;
- int i = InsetText::Latex(os, fragile, fp);
+ int i = InsetText::Latex(buf, os, fragile, fp);
os << "}%" << endl;
return i + 2;
}
-LyXFont InsetFoot::GetDrawFont(LyXParagraph * p, int pos) const
+LyXFont InsetFoot::GetDrawFont(Buffer const * buf, LyXParagraph * p, int pos) const
{
- LyXFont fn = InsetCollapsable::GetDrawFont(p, pos);
+ LyXFont fn = InsetCollapsable::GetDrawFont(buf, p, pos);
fn.decSize().decSize();
return fn;
}
public:
///
explicit
- InsetFoot(Buffer *);
+ InsetFoot();
///
~InsetFoot() {}
///
///
Inset::Code LyxCode() const { return Inset::FOOT_CODE; }
///
- int Latex(std::ostream &, bool fragile, bool fp) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
///
const char * EditMessage() const;
///
///
bool InsertInsetAllowed(Inset * inset) const;
///
- LyXFont GetDrawFont(LyXParagraph * par, int pos) const;
+ LyXFont GetDrawFont(Buffer const *, LyXParagraph * par, int pos) const;
///
};
}
-void InsetGraphics::Write(ostream & os) const
+void InsetGraphics::Write(Buffer const *, ostream & os) const
{
// The question on the file format is still open.
// Suggestions?
}
-void InsetGraphics::Read(LyXLex & /*lex*/)
+void InsetGraphics::Read(Buffer const *, LyXLex & /*lex*/)
{
// For now we only use a static file...
graphicsfile = "testfile.xpm";
}
-int InsetGraphics::Latex(ostream & os,
+int InsetGraphics::Latex(Buffer const *, ostream & os,
bool /*fragile*/, bool/*fs*/) const
{
// MISSING: We have to decide how to do the order of the options
}
-int InsetGraphics::Ascii(ostream &) const
+int InsetGraphics::Ascii(Buffer const *, ostream &) const
{
return 0;
}
-int InsetGraphics::Linuxdoc(ostream &) const
+int InsetGraphics::Linuxdoc(Buffer const *, ostream &) const
{
return 0;
}
-int InsetGraphics::DocBook(ostream &) const
+int InsetGraphics::DocBook(Buffer const *, ostream &) const
{
return 0;
}
///
EDITABLE Editable() const;
///
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
///
- void Read(LyXLex & lex);
+ void Read(Buffer const *, LyXLex & lex);
/** returns the number of rows (\n's) of generated tex code.
fragile == true means, that the inset should take care about
fragile commands by adding a \protect before.
*/
- int Latex(std::ostream &, bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
///
- int Ascii(std::ostream &) const;
+ int Ascii(Buffer const *, std::ostream &) const;
///
- int Linuxdoc(std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream &) const;
///
- int DocBook(std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const;
/// Updates needed features for this inset.
void Validate(LaTeXFeatures & features) const;
}
-void InsetInclude::Write(ostream & os) const
+void InsetInclude::Write(Buffer const *, ostream & os) const
{
os << "Include " << getCommand() << "\n";
}
-void InsetInclude::Read(LyXLex & lex)
+void InsetInclude::Read(Buffer const * buf, LyXLex & lex)
{
- InsetCommand::Read(lex);
+ InsetCommand::Read(buf, lex);
if (getCmdName() == "include")
setInclude();
}
-int InsetInclude::Latex(ostream & os,
+int InsetInclude::Latex(Buffer const *, ostream & os,
bool /*fragile*/, bool /*fs*/) const
{
// Do nothing if no file name has been specified
if (isVerb()) {
os << '\\' << getCmdName() << '{' << incfile << '}';
- }
- else if (isInput()) {
+ } else if (isInput()) {
// \input wants file with extension (default is .tex)
if (!IsLyXFilename(getFileName())) {
os << '\\' << getCmdName() << '{' << incfile << '}';
return IS_EDITABLE;
}
/// With lyx3 we won't overload these 3 methods
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
///
- void Read(LyXLex &);
+ void Read(Buffer const *, LyXLex &);
///
- int Latex(std::ostream &, bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
///
void Validate(LaTeXFeatures &) const;
}
-void InsetInfo::Write(ostream & os) const
+void InsetInfo::Write(Buffer const *, ostream & os) const
{
os << "Info " << contents;
}
-void InsetInfo::Read(LyXLex & lex)
+void InsetInfo::Read(Buffer const *, LyXLex & lex)
{
string tmp = lex.GetString(); // should be "Info"
if (tmp != "Info")
}
-int InsetInfo::Latex(ostream &,
+int InsetInfo::Latex(Buffer const *, ostream &,
bool /*fragile*/, bool /*free_spc*/) const
{
return 0;
}
-int InsetInfo::Ascii(ostream &) const
+int InsetInfo::Ascii(Buffer const *, ostream &) const
{
return 0;
}
-int InsetInfo::Linuxdoc(ostream &) const
+int InsetInfo::Linuxdoc(Buffer const *, ostream &) const
{
return 0;
}
-int InsetInfo::DocBook(ostream &) const
+int InsetInfo::DocBook(Buffer const *, ostream &) const
{
return 0;
}
///
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
///
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
///
- void Read(LyXLex & lex);
+ void Read(Buffer const *, LyXLex & lex);
///
- int Latex(std::ostream &, bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
///
- int Ascii(std::ostream &) const;
+ int Ascii(Buffer const *, std::ostream &) const;
///
- int Linuxdoc(std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream &) const;
///
- int DocBook(std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const;
/// what appears in the minibuffer when opening
char const * EditMessage() const;
///
bv->buffer()->markDirty();
bool flag = bv->ChangeRefs(getContents(),new_contents);
setContents( new_contents );
- bv->text->RedoParagraph();
+ bv->text->RedoParagraph(bv);
if (flag) {
bv->redraw();
bv->fitCursor();
//bv->updateScrollbar();
} else
- bv->update(1);
+ bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
}
-int InsetLabel::Latex(ostream & os,
+
+int InsetLabel::Latex(Buffer const *, ostream & os,
bool /*fragile*/, bool /*fs*/) const
{
os << escape(getCommand());
return 0;
}
-int InsetLabel::Ascii(ostream & os) const
+int InsetLabel::Ascii(Buffer const *, ostream & os) const
{
os << "<" << getContents() << ">";
return 0;
}
-int InsetLabel::Linuxdoc(ostream & os) const
+int InsetLabel::Linuxdoc(Buffer const *, ostream & os) const
{
os << "<label id=\"" << getContents() << "\" >";
return 0;
}
-int InsetLabel::DocBook(ostream & os) const
+int InsetLabel::DocBook(Buffer const *, ostream & os) const
{
os << "<anchor id=\"" << getContents() << "\" >";
return 0;
///
void Edit(BufferView *, int, int, unsigned int);
///
- int Latex(std::ostream &, bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
///
- int Ascii(std::ostream &) const;
+ int Ascii(Buffer const *, std::ostream &) const;
///
- int Linuxdoc(std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream &) const;
///
- int DocBook(std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const;
private:
/// This function escapes 8-bit characters
string escape(string const &) const;
}
-void InsetLatex::Read(LyXLex & lex)
+void InsetLatex::Read(Buffer const *, LyXLex & lex)
{
FILE * file = lex.getFile();
char c = 0;
///
void Write(FILE * file);
///
- void Read(LyXLex & lex);
+ void Read(Buffer const *, LyXLex & lex);
///
int Latex(FILE * file, signed char fragile, bool free_spc);
///
}
-void InsetLatexAccent::Write(ostream & os) const
+void InsetLatexAccent::Write(Buffer const *, ostream & os) const
{
os << "\\i " << contents << "\n";
}
-void InsetLatexAccent::Read(LyXLex & lex)
+void InsetLatexAccent::Read(Buffer const *, LyXLex & lex)
{
lex.EatLine();
contents = lex.GetString();
}
-int InsetLatexAccent::Latex(ostream & os,
+int InsetLatexAccent::Latex(Buffer const *, ostream & os,
bool /*fragile*/, bool/*fs*/) const
{
os << contents;
}
-int InsetLatexAccent::Ascii(ostream & os) const
+int InsetLatexAccent::Ascii(Buffer const *, ostream & os) const
{
os << contents;
return 0;
}
-int InsetLatexAccent::Linuxdoc(ostream & os) const
+int InsetLatexAccent::Linuxdoc(Buffer const *, ostream & os) const
{
os << contents;
return 0;
}
-int InsetLatexAccent::DocBook(ostream & os) const
+int InsetLatexAccent::DocBook(Buffer const *, ostream & os) const
{
os << contents;
return 0;
bool DisplayISO8859_9(Painter &, LyXFont const & font,
int baseline, float & x) const;
///
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
///
- void Read(LyXLex & lex);
+ void Read(Buffer const *, LyXLex & lex);
///
- int Latex(std::ostream &, bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
///
- int Ascii(std::ostream &) const;
+ int Ascii(Buffer const *, std::ostream &) const;
///
- int Linuxdoc(std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream &) const;
///
- int DocBook(std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const;
///
bool Deletable() const;
///
// LaTeX must just ignore this command
-int InsetParent::Latex(ostream & os,
+int InsetParent::Latex(Buffer const * buf, ostream & os,
bool fragile, bool free_spc) const
{
os << "%%#{lyx}";
- InsetCommand::Latex(os, fragile, free_spc);
+ InsetCommand::Latex(buf, os, fragile, free_spc);
return 0;
}
explicit
InsetParent(string const & fn, Buffer * owner = 0);
///
- int Latex(std::ostream &, bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
///
Inset * Clone() const { return new InsetParent(getContents()); }
///
}
-void InsetQuotes::Write(ostream & os) const
+void InsetQuotes::Write(Buffer const *, ostream & os) const
{
string text;
text += language_char[language];
}
-void InsetQuotes::Read(LyXLex & lex)
+void InsetQuotes::Read(Buffer const *, LyXLex & lex)
{
lex.nextToken();
ParseString(lex.GetString());
}
-int InsetQuotes::Latex(ostream & os, bool /*fragile*/, bool) const
+int InsetQuotes::Latex(Buffer const *, ostream & os, bool /*fragile*/, bool) const
{
string doclang =
current_view->buffer()->GetLanguage();
qstr = "\\og{}";
else
qstr = " \\fg{}";
- }
- else
+ } else
qstr = latex_quote_babel[times][quoteind];
- // protect against !` and ?` ligatures.
- // Is it very bad of us to always protect against those ligatures?
- // CHECK
-#if 0
- if ((suffixIs(file, '?') || suffixIs(file, '!'))
- && qstr[0] == '`')
- qstr = "{}" + qstr;
-#else
// Always guard against unfortunate ligatures (!` ?`)
qstr.insert(0, "{}");
-#endif
os << qstr;
return 0;
}
-int InsetQuotes::Ascii(ostream & os) const
+int InsetQuotes::Ascii(Buffer const *, ostream & os) const
{
os << "\"";
return 0;
}
-int InsetQuotes::Linuxdoc(ostream & os) const
+int InsetQuotes::Linuxdoc(Buffer const *, ostream & os) const
{
os << "\"";
return 0;
}
-int InsetQuotes::DocBook(ostream & os) const
+int InsetQuotes::DocBook(Buffer const *, ostream & os) const
{
if(times == InsetQuotes::DoubleQ) {
if (side == InsetQuotes::LeftQ)
///
LyXFont ConvertFont(LyXFont font);
///
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
///
- void Read(LyXLex & lex);
+ void Read(Buffer const *, LyXLex & lex);
///
- int Latex(std::ostream &, bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
///
- int Ascii(std::ostream &) const;
+ int Ascii(Buffer const *, std::ostream &) const;
///
- int Linuxdoc(std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream &) const;
///
- int DocBook(std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const;
///
void Validate(LaTeXFeatures &) const;
///
string InsetRef::getScreenLabel() const
{
static char const * labels[REF_LAST+1]
- = { N_("Ref: "), N_("Page: "), N_("vRef: "), N_("vPage: "),
+ = { N_("Ref: "), N_("Page: "), N_("TextRef: "), N_("TextPage: "),
N_("PrettyRef: ")};
string temp = _(labels[flag]) + getContents();
if(!current_view->buffer()->isLatex()
}
-int InsetRef::Latex(ostream & os,
+int InsetRef::Latex(Buffer const *, ostream & os,
bool /*fragile*/, bool /*fs*/) const
{
if(getOptions().empty())
}
-int InsetRef::Ascii(ostream & os) const
+int InsetRef::Ascii(Buffer const *, ostream & os) const
{
os << "[" << getContents() << "]";
return 0;
}
-int InsetRef::Linuxdoc(ostream & os) const
+int InsetRef::Linuxdoc(Buffer const *, ostream & os) const
{
os << "<ref id=\"" << getContents()
<< "\" name=\"" << getOptions() << "\" >";
}
-int InsetRef::DocBook(ostream & os) const
+int InsetRef::DocBook(Buffer const *, ostream & os) const
{
os << "<link linkend=\"" << getContents()
<< "\">" << getOptions() << "</link>";
///
void gotoLabel();
///
- int Latex(std::ostream &, bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
///
- int Ascii(std::ostream &) const;
+ int Ascii(Buffer const *, std::ostream &) const;
///
- int Linuxdoc(std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream &) const;
///
- int DocBook(std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const;
///
void Validate(LaTeXFeatures & features) const;
private:
// In lyxf3 this will be just LaTeX
-void InsetSpecialChar::Write(ostream & os) const
+void InsetSpecialChar::Write(Buffer const *, ostream & os) const
{
string command;
switch (kind) {
// This function will not be necessary when lyx3
-void InsetSpecialChar::Read(LyXLex & lex)
+void InsetSpecialChar::Read(Buffer const *, LyXLex & lex)
{
lex.nextToken();
string command = lex.GetString();
}
-int InsetSpecialChar::Latex(ostream & os, bool /*fragile*/,
+int InsetSpecialChar::Latex(Buffer const *, ostream & os, bool /*fragile*/,
bool free_space) const
{
switch (kind) {
return 0;
}
-int InsetSpecialChar::Ascii(ostream & os) const
+int InsetSpecialChar::Ascii(Buffer const *, ostream & os) const
{
switch (kind) {
case HYPHENATION: break;
}
-int InsetSpecialChar::Linuxdoc(ostream & os) const
+int InsetSpecialChar::Linuxdoc(Buffer const * buf, ostream & os) const
{
- return Ascii(os);
+ return Ascii(buf, os);
}
-int InsetSpecialChar::DocBook(ostream & os) const
+int InsetSpecialChar::DocBook(Buffer const * buf, ostream & os) const
{
- return Ascii(os);
+ return Ascii(buf, os);
}
///
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
///
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
/// Will not be used when lyxf3
- void Read(LyXLex & lex);
+ void Read(Buffer const *, LyXLex & lex);
///
- int Latex(std::ostream &, bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
///
- int Ascii(std::ostream &) const;
+ int Ascii(Buffer const *, std::ostream &) const;
///
- int Linuxdoc(std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream &) const;
///
- int DocBook(std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const;
///
Inset * Clone() const;
///
}
-void InsetTabular::Write(ostream & os) const
+void InsetTabular::Write(Buffer const * buf, ostream & os) const
{
os << " Tabular" << endl;
- tabular->Write(os);
+ tabular->Write(buf, os);
}
-void InsetTabular::Read(LyXLex & lex)
+void InsetTabular::Read(Buffer const * buf, LyXLex & lex)
{
bool old_format = (lex.GetString() == "\\LyXTable");
string token;
if (tabular)
delete tabular;
- tabular = new LyXTabular(this, lex);
+ tabular = new LyXTabular(buf, this, lex);
init_inset = true;
}
-int InsetTabular::Latex(ostream & os, bool fragile, bool fp) const
+int InsetTabular::Latex(Buffer const * buf, ostream & os, bool fragile, bool fp) const
{
- return tabular->Latex(os, fragile, fp);
+ return tabular->Latex(buf, os, fragile, fp);
}
-int InsetTabular::Ascii(ostream &) const
+int InsetTabular::Ascii(Buffer const *, ostream &) const
{
return 0;
}
-int InsetTabular::Linuxdoc(ostream &) const
+int InsetTabular::Linuxdoc(Buffer const *, ostream &) const
{
return 0;
}
-int InsetTabular::DocBook(ostream &) const
+int InsetTabular::DocBook(Buffer const *, ostream &) const
{
return 0;
}
sel_col_start = sel_col_end = tabular->column_of_cell(actcell);
sel_row_start = sel_row_end = tabular->row_of_cell(actcell);
}
- bv->text->SetUndo(Undo::FINISH,
+ bv->text->SetUndo(bv->buffer(), Undo::FINISH,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next);
break;
case LyXTabular::APPEND_ROW:
// append the row into the tabular
+ UnlockInsetInInset(bv, the_locking_inset);
tabular->AppendRow(actcell);
UpdateLocal(bv, true);
break;
// This returns paperWidth() if the cell-width is unlimited or the width
// in pixels if we have a pwidth for this cell.
-int InsetTabular::GetMaxWidthOfCell(Painter & pain, int cell) const
+int InsetTabular::GetMaxWidthOfCell(Painter &, int cell) const
{
string w;
-
+
if ((w=tabular->GetPWidth(cell)).empty())
- return pain.paperWidth();
+ return -1;
return VSpace(w).inPixels( 0, 0);
}
break;
}
if (cell >= n)
- return pain.paperWidth();
+ return -1;
int w = GetMaxWidthOfCell(pain, cell);
// this because text insets remove the xpos from the maxwidth because
// otherwise the would not break good!!!
///
Inset * Clone() const;
///
- void Read(LyXLex &);
+ void Read(Buffer const *, LyXLex &);
///
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
///
int ascent(Painter &, LyXFont const &) const;
///
///
UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &);
///
- int Latex(std::ostream &, bool, bool) const;
+ int Latex(Buffer const *, std::ostream &, bool, bool) const;
///
- int Ascii(std::ostream &) const;
+ int Ascii(Buffer const *, std::ostream &) const;
///
- int Linuxdoc(std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream &) const;
///
- int DocBook(std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const;
///
void Validate(LaTeXFeatures & features) const;
///
#include "LColor.h"
#include "support/textutils.h"
#include "support/LAssert.h"
+#include "lyxrow.h"
using std::ostream;
using std::ifstream;
using std::max;
extern unsigned char getCurrentTextClass(Buffer *);
-extern LyXTextClass::size_type current_layout;
+#warning BAAAAAAAADDDDDDD current_view (but Lars wanted it :) !!!
+extern BufferView * current_view;
-InsetText::InsetText(Buffer * buf)
+InsetText::InsetText()
{
par = new LyXParagraph();
- init(buf);
+ init();
+ text = new LyXText(this);
}
-InsetText::InsetText(InsetText const & ins, Buffer * buf)
+InsetText::InsetText(InsetText const & ins) : UpdatableInset()
{
par = 0;
- init(buf, &ins);
+ init(&ins);
+ text = new LyXText(this);
autoBreakRows = ins.autoBreakRows;
}
-void InsetText::init(Buffer * buf, InsetText const * ins)
+InsetText & InsetText::operator=(InsetText const & it)
+{
+ init(&it);
+ text = new LyXText(this);
+ autoBreakRows = it.autoBreakRows;
+ return * this;
+}
+
+void InsetText::init(InsetText const * ins)
{
the_locking_inset = 0;
- buffer = buf;
cursor_visible = false;
cursor.x_fix(-1);
interline_space = 1;
Inset * InsetText::Clone() const
{
- InsetText * t = new InsetText(*this, buffer);
+ InsetText * t = new InsetText(*this);
return t;
}
-void InsetText::Write(ostream & os) const
+void InsetText::Write(Buffer const * buf, ostream & os) const
{
os << "Text\n";
- WriteParagraphData(os);
+ WriteParagraphData(buf, os);
}
-void InsetText::WriteParagraphData(ostream & os) const
+void InsetText::WriteParagraphData(Buffer const * buf, ostream & os) const
{
- par->writeFile(os, buffer->params, 0, 0);
+ par->writeFile(buf, os, buf->params, 0, 0);
}
-void InsetText::Read(LyXLex & lex)
+void InsetText::Read(Buffer const * buf, LyXLex & lex)
{
string token, tmptok;
int pos = 0;
continue;
if (token == "\\end_inset")
break;
- if (buffer->parseSingleLyXformat2Token(lex, par, return_par,
- token, pos, depth,
- font, footnoteflag,
- footnotekind)) {
+ if (const_cast<Buffer*>(buf)->parseSingleLyXformat2Token(lex, par, return_par,
+ token, pos, depth,
+ font, footnoteflag,
+ footnotekind)) {
// the_end read this should NEVER happen
lex.printError("\\the_end read in inset! Error in document!");
return;
int InsetText::ascent(Painter & pain, LyXFont const & font) const
{
if (init_inset) {
+ text->init(current_view);
computeTextRows(pain);
- resetPos(pain);
init_inset = false;
}
- if (maxAscent)
- return maxAscent + 2;
- return lyxfont::maxAscent(font);
+ long int y_temp = 0;
+ Row * row = text->GetRowNearY(y_temp);
+ return row->ascent_of_text();
}
int InsetText::descent(Painter & pain, LyXFont const & font) const
{
if (init_inset) {
+ text->init(current_view);
computeTextRows(pain);
- resetPos(pain);
init_inset = false;
}
- if (maxDescent)
- return maxDescent + 2;
- return lyxfont::maxDescent(font);
+ long int y = 0;
+ Row * row = text->GetRowNearY(y);
+ return text->height - row->ascent_of_text();
}
int InsetText::width(Painter & pain, LyXFont const &) const
{
if (init_inset) {
+ text->init(current_view);
computeTextRows(pain);
- resetPos(pain);
init_inset = false;
}
- return insetWidth;
+ return text->width;
+// return insetWidth;
}
xpos = x;
UpdatableInset::draw(pain, f, baseline, x);
- if (init_inset || (baseline != top_baseline) || (top_x != int(x))) {
- top_baseline = baseline;
- if (init_inset || (top_x != int(x))) {
- top_x = int(x);
+ if (init_inset) {
+ text->init(current_view);
computeTextRows(pain);
init_inset = false;
}
+ if ((baseline != top_baseline) || (top_x != int(x))) {
+ top_baseline = baseline;
+ top_x = int(x);
computeBaselines(baseline);
}
- if (the_locking_inset && (cursor.pos() == inset_pos)) {
+ if (the_locking_inset && (text->cursor.pos() == inset_pos)) {
resetPos(pain);
- inset_x = cursor.x() - top_x + drawTextXOffset;
- inset_y = cursor.y() + drawTextYOffset;
+ inset_x = text->cursor.x() - top_x + drawTextXOffset;
+ inset_y = text->cursor.y() + drawTextYOffset;
}
if (drawLockedFrame && locked) {
pain.rectangle(int(x), baseline - ascent(pain, f), insetWidth,
ascent(pain,f) + descent(pain, f), frame_color);
}
x += TEXT_TO_INSET_OFFSET; // place for border
+#if 1
+ long int y = 0;
+ Row * row = text->GetRowNearY(y);
+ y += baseline - row->ascent_of_text();
+ text->width = 0;
+ while (row != 0) {
+ text->GetVisibleRow(current_view, y, top_x, row, y);
+ y += row->height();
+ row = row->next();
+ }
+#else
for(RowList::size_type r = 0; r < rows.size() - 1; ++r) {
drawRowSelection(pain, rows[r].pos, rows[r + 1].pos, r,
rows[r].baseline, x);
drawRowText(pain, rows[r].pos, rows[r + 1].pos, rows[r].baseline, x);
}
+#endif
x += insetWidth - TEXT_TO_INSET_OFFSET;
}
if ((p >= s_start) && (p <= s_end))
esel_x = int(x);
char ch = par->GetChar(p);
- font = GetDrawFont(par,p);
+ font = GetDrawFont(current_view->buffer(), par, p);
if (IsFloatChar(ch)) {
// skip for now
} else if (ch == LyXParagraph::META_INSET) {
for(int p = startpos; p < endpos; ++p) {
char ch = par->GetChar(p);
- LyXFont font = GetDrawFont(par,p);
+ LyXFont font = GetDrawFont(current_view->buffer(), par, p);
if (IsFloatChar(ch)) {
// skip for now
} else if (par->IsNewline(p)) {
setPos(bv->painter(), x, y);
checkAndActivateInset(bv, x, y, button);
selection_start_cursor = selection_end_cursor = cursor;
- current_font = real_current_font = GetFont(par, cursor.pos());
+ current_font = real_current_font =GetFont(bv->buffer(), par, cursor.pos());
bv->text->FinishUndo();
UpdateLocal(bv, true);
}
lyxerr[Debug::INSETS] << "InsetText::LockInsetInInset(" << inset << "): ";
if (!inset)
return false;
- if (inset == par->GetInset(cursor.pos())) {
+ if (inset == par->GetInset(text->cursor.pos())) {
lyxerr[Debug::INSETS] << "OK" << endl;
the_locking_inset = inset;
resetPos(bv->painter());
- inset_x = cursor.x() - top_x + drawTextXOffset;
- inset_y = cursor.y() + drawTextYOffset;
- inset_pos = cursor.pos();
+ inset_x = text->cursor.x() - top_x + drawTextXOffset;
+ inset_y = text->cursor.y() + drawTextYOffset;
+ inset_pos = text->cursor.pos();
return true;
} else if (the_locking_inset && (the_locking_inset == inset)) {
- if (cursor.pos() == inset_pos) {
+ if (text->cursor.pos() == inset_pos) {
lyxerr[Debug::INSETS] << "OK" << endl;
resetPos(bv->painter());
- inset_x = cursor.x() - top_x + drawTextXOffset;
- inset_y = cursor.y() + drawTextYOffset;
+ inset_x = text->cursor.x() - top_x + drawTextXOffset;
+ inset_y = text->cursor.y() + drawTextYOffset;
} else {
lyxerr[Debug::INSETS] << "cursor.pos != inset_pos" << endl;
}
lyxerr[Debug::INSETS] << "InsetText::UpdateInsetInInset(" << inset <<
")" << endl;
UpdateLocal(bv, true);
- if (cursor.pos() == inset_pos) {
- inset_x = cursor.x() - top_x + drawTextXOffset;
- inset_y = cursor.y() + drawTextYOffset;
+ if (text->cursor.pos() == inset_pos) {
+ inset_x = text->cursor.x() - top_x + drawTextXOffset;
+ inset_y = text->cursor.y() + drawTextYOffset;
}
return true;
}
switch (action) {
// Normal chars
case -1:
- bv->text->SetUndo(Undo::INSERT,
+ bv->text->SetUndo(bv->buffer(), Undo::INSERT,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next);
- cutSelection();
+ cutSelection(bv->buffer());
cursor = selection_start_cursor;
par->InsertChar(cursor.pos(), arg[0]);
- SetCharFont(cursor.pos(), current_font);
+ SetCharFont(bv->buffer(), cursor.pos(), current_font);
cursor.pos(cursor.pos() + 1);
selection_start_cursor = selection_end_cursor = cursor;
UpdateLocal(bv, true);
moveLeft(bv);
case LFUN_DELETE:
{
- bv->text->SetUndo(Undo::DELETE,
+ bv->text->SetUndo(bv->buffer(), Undo::DELETE,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next);
bool ret = true;
resetPos(bv->painter());
break;
case LFUN_CUT:
- bv->text->SetUndo(Undo::DELETE,
+ bv->text->SetUndo(bv->buffer(), Undo::DELETE,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next);
- if (cutSelection()) {
+ if (cutSelection(bv->buffer())) {
// we need update
cursor = selection_end_cursor = selection_start_cursor;
UpdateLocal(bv, true);
break;
case LFUN_COPY:
bv->text->FinishUndo();
- if (copySelection()) {
+ if (copySelection(bv->buffer())) {
// we need update
selection_start_cursor = selection_end_cursor = cursor;
UpdateLocal(bv, true);
break;
case LFUN_PASTE:
{
- bv->text->SetUndo(Undo::INSERT,
+ bv->text->SetUndo(bv->buffer(), Undo::INSERT,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next);
- if (pasteSelection()) {
+ if (pasteSelection(bv->buffer())) {
selection_start_cursor = selection_end_cursor = cursor;
UpdateLocal(bv, true);
}
case LFUN_BREAKLINE:
if (!autoBreakRows)
return DISPATCHED;
- bv->text->SetUndo(Undo::INSERT,
+ bv->text->SetUndo(bv->buffer(), Undo::INSERT,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next);
par->InsertChar(cursor.pos(),LyXParagraph::META_NEWLINE);
- SetCharFont(cursor.pos(),current_font);
+ SetCharFont(bv->buffer(), cursor.pos(),current_font);
UpdateLocal(bv, true);
cursor.pos(cursor.pos() + 1);
selection_start_cursor = selection_end_cursor = cursor;
break;
case LFUN_LAYOUT:
{
+ static LyXTextClass::size_type cur_layout = par->layout;
+
// Derive layout number from given argument (string)
// and current buffer's textclass (number). */
LyXTextClassList::ClassList::size_type tclass =
- buffer->params.textclass;
+ bv->buffer()->params.textclass;
std::pair <bool, LyXTextClass::size_type> layout =
textclasslist.NumberOfLayout(tclass, arg);
break;
}
- if (current_layout != layout.second) {
- bv->text->SetLayout(cursor, selection_start_cursor,
- selection_end_cursor, layout.second);
+ if (cur_layout != layout.second) {
+ cur_layout = layout.second;
+ text->SetLayout(bv, layout.second);
bv->owner()->getToolbar()->combox->select(cursor.par()->GetLayout()+1);
UpdateLocal(bv, true);
}
}
-int InsetText::Latex(ostream & os, bool /*fragile*/, bool /*fp*/) const
+int InsetText::Latex(Buffer const * buf, ostream & os, bool, bool) const
{
TexRow texrow;
- buffer->latexParagraphs(os, par, 0, texrow);
+ buf->latexParagraphs(os, par, 0, texrow);
return texrow.rows();
}
// Returns the width of a character at a certain spot
int InsetText::SingleWidth(Painter & pain, LyXParagraph * p, int pos) const
{
- LyXFont font = GetDrawFont(p, pos);
+ LyXFont font = GetDrawFont(current_view->buffer(), p, pos);
char c = p->GetChar(pos);
if (IsPrintable(c)) {
void InsetText::SingleHeight(Painter & pain, LyXParagraph * p,int pos,
int & asc, int & desc) const
{
- LyXFont font = GetDrawFont(p, pos);
+ LyXFont font = GetDrawFont(current_view->buffer(), p, pos);
char c = p->GetChar(pos);
asc = desc = 0;
// smaller. (Asger)
// If position is -1, we get the layout font of the paragraph.
// If position is -2, we get the font of the manual label of the paragraph.
-LyXFont InsetText::GetFont(LyXParagraph * p, int pos) const
+LyXFont InsetText::GetFont(Buffer const * buf, LyXParagraph * p, int pos) const
{
char par_depth = p->GetDepth();
LyXLayout const & layout =
- textclasslist.Style(buffer->params.textclass, p->GetLayout());
+ textclasslist.Style(buf->params.textclass, p->GetLayout());
// We specialize the 95% common case:
if (p->footnoteflag == LyXParagraph::NO_FOOTNOTE && !par_depth) {
if (pos >= 0) {
// 95% goes here
if (layout.labeltype == LABEL_MANUAL
- && pos < BeginningOfMainBody(p)) {
+ && pos < BeginningOfMainBody(buf, p)) {
// 1% goes here
- return p->GetFontSettings(buffer->params,
+ return p->GetFontSettings(buf->params,
pos).realize(layout.reslabelfont);
} else
- return p->GetFontSettings(buffer->params,
+ return p->GetFontSettings(buf->params,
pos).realize(layout.resfont);
} else {
// 5% goes here.
if (pos >= 0){
// 95% goes here
- if (pos < BeginningOfMainBody(p)) {
+ if (pos < BeginningOfMainBody(buf, p)) {
// 1% goes here
layoutfont = layout.labelfont;
} else {
// 99% goes here
layoutfont = layout.font;
}
- tmpfont = p->GetFontSettings(buffer->params, pos);
+ tmpfont = p->GetFontSettings(buf->params, pos);
tmpfont.realize(layoutfont);
} else{
// 5% goes here.
while (p && par_depth && !tmpfont.resolved()) {
p = p->DepthHook(par_depth - 1);
if (p) {
- tmpfont.realize(textclasslist.Style(buffer->params.textclass,
+ tmpfont.realize(textclasslist.Style(buf->params.textclass,
p->GetLayout()).font);
par_depth = p->GetDepth();
}
}
- tmpfont.realize((textclasslist.TextClass(buffer->params.textclass).
+ tmpfont.realize((textclasslist.TextClass(buf->params.textclass).
defaultfont()));
return tmpfont;
}
// the font for drawing may be different from the real font
-LyXFont InsetText::GetDrawFont(LyXParagraph * p, int pos) const
+LyXFont InsetText::GetDrawFont(Buffer const * buf, LyXParagraph * p, int pos) const
{
- return GetFont(p, pos);
+ return GetFont(buf, p, pos);
}
-int InsetText::BeginningOfMainBody(LyXParagraph * p) const
+int InsetText::BeginningOfMainBody(Buffer const * buf, LyXParagraph * p) const
{
- if (textclasslist.Style(buffer->params.textclass,
+ if (textclasslist.Style(buf->params.textclass,
p->GetLayout()).labeltype != LABEL_MANUAL)
return 0;
else
return;
}
- LyXFont font = GetDrawFont(par, cursor.pos());
+ LyXFont font = GetDrawFont(bv->buffer(), par, text->cursor.pos());
int asc = lyxfont::maxAscent(font);
int desc = lyxfont::maxDescent(font);
+ asc = text->cursor.row()->ascent_of_text();
+ desc = text->cursor.row()->height() - asc;
if (cursor_visible)
bv->hideLockedInsetCursor();
else
- bv->showLockedInsetCursor(cursor.x(), cursor.y(), asc, desc);
+ bv->showLockedInsetCursor(text->cursor.x(), text->cursor.y(),
+ asc, desc);
cursor_visible = !cursor_visible;
}
return;
}
if (!cursor_visible) {
- LyXFont font = GetDrawFont(par, cursor.pos());
+ LyXFont font = GetDrawFont(bv->buffer(), par, cursor.pos());
int asc = lyxfont::maxAscent(font);
int desc = lyxfont::maxDescent(font);
- bv->fitLockedInsetCursor(cursor.x(), cursor.y(), asc, desc);
- bv->showLockedInsetCursor(cursor.x(), cursor.y(), asc, desc);
+ asc = text->cursor.row()->ascent_of_text();
+ desc = text->cursor.row()->height() - asc;
+ bv->fitLockedInsetCursor(text->cursor.x(), text->cursor.y(), asc, desc);
+ bv->showLockedInsetCursor(text->cursor.x(), text->cursor.y(), asc, desc);
cursor_visible = true;
}
}
}
cursor.pos(cursor.pos() + 1);
resetPos(bv->painter());
- real_current_font = current_font = GetFont(par, cursor.pos());
+ real_current_font = current_font =GetFont(bv->buffer(), par, cursor.pos());
return DISPATCHED_NOUPDATE;
}
return the_locking_inset->InsertInset(bv, inset);
return false;
}
- bv->text->SetUndo(Undo::INSERT,
+ bv->text->SetUndo(bv->buffer(), Undo::INSERT,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->previous,
bv->text->cursor.par()->ParFromPos(bv->text->cursor.pos())->next);
if (inset->Editable() == Inset::IS_EDITABLE) {
if (!hasSelection()) {
// Determine basis font
LyXFont layoutfont;
- if (cursor.pos() < BeginningOfMainBody(par))
- layoutfont = GetFont(par, -2);
+ if (cursor.pos() < BeginningOfMainBody(bv->buffer(), par))
+ layoutfont = GetFont(bv->buffer(), par, -2);
else
- layoutfont = GetFont(par, -1);
+ layoutfont = GetFont(bv->buffer(), par, -1);
// Update current font
real_current_font.update(font, bv->buffer()->params.language_info,
}
LyXFont newfont;
while(s_start < s_end) {
- newfont = GetFont(par,s_start);
+ newfont = GetFont(bv->buffer(), par,s_start);
newfont.update(font, bv->buffer()->params.language_info, toggleall);
- SetCharFont(s_start, newfont);
+ SetCharFont(bv->buffer(), s_start, newfont);
++s_start;
}
UpdateLocal(bv, true);
}
-void InsetText::SetCharFont(int pos, LyXFont const & f)
+void InsetText::SetCharFont(Buffer const * buf, int pos, LyXFont const & f) //
{
/* let the insets convert their font */
LyXFont font(f);
font = par->GetInset(pos)->ConvertFont(font);
}
LyXLayout const & layout =
- textclasslist.Style(buffer->params.textclass,par->GetLayout());
+ textclasslist.Style(buf->params.textclass,par->GetLayout());
// Get concrete layout font to reduce against
LyXFont layoutfont;
- if (pos < BeginningOfMainBody(par))
+ if (pos < BeginningOfMainBody(buf, par))
layoutfont = layout.labelfont;
else
layoutfont = layout.font;
- layoutfont.realize((textclasslist.TextClass(buffer->params.textclass).
+ layoutfont.realize((textclasslist.TextClass(buf->params.textclass).
defaultfont()));
// Now, reduce font against full layout font
row.pos = 0;
row.baseline = 0;
rows.push_back(row);
- if (!autoBreakRows) {
+ if (!autoBreakRows || (getMaxTextWidth(pain, this) < 0)) {
for(p = 0; p < par->Last(); ++p) {
insetWidth += SingleWidth(pain, par, p);
SingleHeight(pain, par, p, asc, desc);
inset = par->GetInset(p);
if (inset && inset->display()) {
inset->setOwner(const_cast<InsetText *>(this));
- if (cw > maxWidth)
+ if (cw > insetWidth)
insetWidth = cw;
if (!is_first_word_in_row || (p != nwp)) {
oasc = max(oasc, wordAscent);
void InsetText::UpdateLocal(BufferView * bv, bool flag)
{
if (flag) {
+ text->FullRebreak(bv);
computeTextRows(bv->painter());
computeBaselines(top_baseline);
}
}
-bool InsetText::cutSelection()
+bool InsetText::cutSelection(Buffer const * buf)
{
if (!hasSelection())
return false;
end = selection_end_cursor.pos();
}
- return cap.cutSelection(par, &endpar,
- start, end, buffer->params.textclass);
+ return cap.cutSelection(par, &endpar, start, end, buf->params.textclass);
}
-bool InsetText::copySelection()
+bool InsetText::copySelection(Buffer const * buf)
{
if (!hasSelection())
return false;
start = selection_start_cursor.pos();
end = selection_end_cursor.pos();
}
- return cap.copySelection(par, par, start, end, buffer->params.textclass);
+ return cap.copySelection(par, par, start, end, buf->params.textclass);
}
-bool InsetText::pasteSelection()
+bool InsetText::pasteSelection(Buffer const * buf)
{
CutAndPaste cap;
LyXParagraph * actpar = par;
int pos = cursor.pos();
- bool ret = cap.pasteSelection(&actpar, &endpar, pos,
- buffer->params.textclass);
+ bool ret = cap.pasteSelection(&actpar, &endpar, pos,buf->params.textclass);
cursor.pos(pos);
return ret;
}
if (par->GetChar(cursor.pos()) == LyXParagraph::META_INSET) {
UpdatableInset * inset =
static_cast<UpdatableInset*>(par->GetInset(cursor.pos()));
- LyXFont font = GetFont(par, cursor.pos());
+ LyXFont font = GetFont(bv->buffer(), par, cursor.pos());
if (x < 0)
x = inset->width(bv->painter(), font);
if (y < 0)
class LyXCursor;
class LyXParagraph;
class LColor;
+class LyXText;
-/** A text inset is like a TeX box
-
- To write full text (including styles and other insets) in a given
- space.
-*/
+/**
+ * A text inset is like a TeX box to write full text
+ * (including styles and other insets) in a given space.
+ */
class InsetText : public UpdatableInset {
public:
///
enum { TEXT_TO_INSET_OFFSET = 2 };
///
explicit
- InsetText(Buffer *);
+ InsetText();
///
- InsetText(InsetText const &, Buffer *);
+ InsetText(InsetText const &);
///
~InsetText();
///
Inset * Clone() const;
///
+ InsetText & operator= (InsetText const & it);
+ ///
void clear() const { par->clearContents(); }
///
- void Read(LyXLex &);
+ void Read(Buffer const *, LyXLex &);
///
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
///
int ascent(Painter &, LyXFont const &) const;
///
///
UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &);
///
- int Latex(std::ostream &, bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
///
- int Ascii(std::ostream &) const { return 0; }
+ int Ascii(Buffer const *, std::ostream &) const { return 0; }
///
- int Linuxdoc(std::ostream &) const { return 0; }
+ int Linuxdoc(Buffer const *, std::ostream &) const { return 0; }
///
- int DocBook(std::ostream &) const { return 0; }
+ int DocBook(Buffer const *, std::ostream &) const { return 0; }
///
void Validate(LaTeXFeatures & features) const;
///
///
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
///
- void init(Buffer *, InsetText const * ins = 0);
+ void init(InsetText const * ins = 0);
///
void SetParagraphData(LyXParagraph *);
///
///
void computeTextRows(Painter &) const;
///
- Buffer * BufferOwner() const { return buffer; }
-
LyXParagraph * par;
+ ///
protected:
///
void UpdateLocal(BufferView *, bool);
///
- void WriteParagraphData(std::ostream &) const;
+ void WriteParagraphData(Buffer const *, std::ostream &) const;
///
void resetPos(Painter &) const;
///
///
int SingleWidth(Painter &, LyXParagraph * par, int pos) const;
///
- LyXFont GetFont(LyXParagraph * par, int pos) const;
+ LyXFont GetFont(Buffer const *, LyXParagraph * par, int pos) const;
///
- virtual LyXFont GetDrawFont(LyXParagraph * par, int pos) const;
+ virtual LyXFont GetDrawFont(Buffer const *, LyXParagraph * par, int pos) const;
///
virtual int getMaxTextWidth(Painter &, UpdatableInset const *) const;
- Buffer * buffer;
+ LyXText * text;
///
LyXFont current_font;
///
///
void computeBaselines(int) const;
///
- int BeginningOfMainBody(LyXParagraph * par) const;
+ int BeginningOfMainBody(Buffer const *, LyXParagraph * par) const;
///
void ShowInsetCursor(BufferView *);
///
void setPos(Painter &, int x, int y) const;
///
UpdatableInset::RESULT moveRight(BufferView *, bool activate_inset = true);
- ///
+ ///
UpdatableInset::RESULT moveLeft(BufferView *, bool activate_inset = true);
- ///
+ ///
UpdatableInset::RESULT moveUp(BufferView *);
- ///
+ ///
UpdatableInset::RESULT moveDown(BufferView *);
- ///
+ ///
bool Delete();
- ///
- bool cutSelection();
- ///
- bool copySelection();
- ///
- bool pasteSelection();
+ ///
+ bool cutSelection(Buffer const *);
+ ///
+ bool copySelection(Buffer const *);
+ ///
+ bool pasteSelection(Buffer const *);
///
bool hasSelection() const
- { return (selection_start_cursor != selection_end_cursor); }
+ { return (selection_start_cursor != selection_end_cursor); }
///
- void SetCharFont(int pos, LyXFont const & font);
+ void SetCharFont(Buffer const *, int pos, LyXFont const & font);
///
string getText(int);
///
typedef std::vector<row_struct> RowList;
///
mutable RowList rows;
- ///
- InsetText & operator = (InsetText const & it) {
- par = it.par;
- buffer = it.buffer; // suspect
- current_font = it.current_font;
- real_current_font = it.real_current_font;
- maxAscent = it.maxAscent;
- maxDescent = it.maxDescent;
- insetWidth = it.insetWidth;
- inset_pos = it.inset_pos;
- inset_x = it.inset_x;
- inset_y = it.inset_y;
- interline_space = it.interline_space;
- selection_start_cursor = selection_end_cursor = cursor = it.cursor;
- actrow = it.actrow;
- no_selection = it.no_selection;
- the_locking_inset = it.the_locking_inset; // suspect
- rows = it.rows;
- return * this;
- }
};
#endif
bv->owner()->getLyXFunc()->Dispatch(LFUN_TOCVIEW);
}
-int InsetTOC::Linuxdoc(ostream & os) const
+int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const
{
os << "<toc>";
return 0;
}
-int InsetTOC::DocBook(ostream & os) const
+int InsetTOC::DocBook(Buffer const *, ostream & os) const
{
os << "<toc></toc>";
return 0;
///
Inset::Code LyxCode() const { return Inset::TOC_CODE; }
///
- int Linuxdoc(std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream &) const;
///
- int DocBook(std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const;
private:
///
Buffer * owner;
temp += _("HtmlUrl: ");
else
temp += _("Url: ");
- temp += getContents();
if(!getOptions().empty()) {
- temp += "||";
temp += getOptions();
+ } else {
+ temp += getContents();
}
return temp;
}
-int InsetUrl::Latex(ostream & os,
+int InsetUrl::Latex(Buffer const *, ostream & os,
bool fragile, bool /*free_spc*/) const
{
if (!getOptions().empty())
}
-int InsetUrl::Ascii(ostream & os) const
+int InsetUrl::Ascii(Buffer const *, ostream & os) const
{
if (getOptions().empty())
os << "[" << getContents() << "]";
}
-int InsetUrl::Linuxdoc(ostream & os) const
+int InsetUrl::Linuxdoc(Buffer const *, ostream & os) const
{
os << "<" << getCmdName()
<< " url=\"" << getContents() << "\""
}
-int InsetUrl::DocBook(ostream & os) const
+int InsetUrl::DocBook(Buffer const *, ostream & os) const
{
os << "<ulink url=\"" << getContents() << "\">"
<< getOptions() << "</ulink>";
///
void gotoLabel();
///
- int Latex(std::ostream &, bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
///
- int Ascii(std::ostream &) const;
+ int Ascii(Buffer const *, std::ostream &) const;
///
- int Linuxdoc(std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream &) const;
///
- int DocBook(std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const;
///
static void CloseUrlCB(FL_OBJECT *, long data);
private:
class Painter;
class BufferView;
+class Buffer;
struct LaTeXFeatures;
///
SPECIALCHAR_CODE,
///
- TABULAR_CODE
+ TABULAR_CODE,
+ ///
+ EXTERNAL_CODE
};
enum EDITABLE {
virtual void Edit(BufferView *, int x, int y, unsigned int button);
///
virtual EDITABLE Editable() const;
- ///
+ /// This is called when the user clicks inside an inset
virtual void InsetButtonPress(BufferView *, int, int, int) {}
- ///
+ /// This is called when the user releases the button inside an inset
virtual void InsetButtonRelease(BufferView *, int, int, int) {}
- ///
+ /// This is caleld when the user moves the mouse inside an inset
virtual void InsetMotionNotify(BufferView *, int , int , int) {}
///
bool IsTextInset() const;
///
virtual bool AutoDelete() const;
///
- virtual void Write(std::ostream &) const = 0;
+ virtual void Write(Buffer const *, std::ostream &) const = 0;
///
- virtual void Read(LyXLex & lex) = 0;
+ virtual void Read(Buffer const *, LyXLex & lex) = 0;
/** returns the number of rows (\n's) of generated tex code.
fragile == true means, that the inset should take care about
fragile commands by adding a \protect before.
If the free_spc (freespacing) variable is set, then this inset
is in a free-spacing paragraph.
*/
- virtual int Latex(std::ostream &, bool fragile,
+ virtual int Latex(Buffer const *, std::ostream &, bool fragile,
bool free_spc) const = 0;
///
- virtual int Ascii(std::ostream &) const = 0;
+ virtual int Ascii(Buffer const *, std::ostream &) const = 0;
///
- virtual int Linuxdoc(std::ostream &) const = 0;
+ virtual int Linuxdoc(Buffer const *, std::ostream &) const = 0;
///
- virtual int DocBook(std::ostream &) const = 0;
+ virtual int DocBook(Buffer const *, std::ostream &) const = 0;
/// Updates needed features for this inset.
virtual void Validate(LaTeXFeatures & features) const;
///
/* Form definition file generated with fdesign. */
#include FORMS_H_LOCATION
-#include <stdlib.h>
+#include <cstdlib>
#include "latexoptions.h"
FD_LaTeXOptions *create_form_LaTeXOptions(void)
-/** Header file generated with fdesign on Mon Apr 12 19:09:41 1999.**/
+/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
#ifndef FD_LaTeXOptions_h_
#define FD_LaTeXOptions_h_
/* Form definition file generated with fdesign. */
#include FORMS_H_LOCATION
-#include <stdlib.h>
+#include <cstdlib>
#include "layout_forms.h"
FD_form_document *create_form_form_document(void)
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity);
fl_set_object_resize(obj, FL_RESIZE_NONE);
- fdui->choice_language = obj = fl_add_box(FL_FRAME_BOX, 120, 190, 190, 30, _("Language:"));
+ fdui->choice_language = obj = fl_add_choice(FL_NORMAL_CHOICE, 120, 190, 190, 30, _("Language:"));
+ fl_set_object_boxtype(obj, FL_FRAME_BOX);
+ fl_set_object_color(obj, FL_COL1, FL_COL1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_LEFT);
fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity);
fl_set_object_resize(obj, FL_RESIZE_NONE);
fdui->input_default_skip = obj = fl_add_input(FL_NORMAL_INPUT, 220, 310, 90, 30, "");
FL_OBJECT *obj;
FD_form_character *fdui = (FD_form_character *) fl_calloc(1, sizeof(FD_form_character));
- fdui->form_character = fl_bgn_form(FL_NO_BOX, 300, 415);
- obj = fl_add_box(FL_UP_BOX, 0, 0, 300, 415, "");
+ fdui->form_character = fl_bgn_form(FL_NO_BOX, 295, 385);
+ obj = fl_add_box(FL_UP_BOX, 0, 0, 295, 385, "");
fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
- obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 320, 280, 45, "");
+ fdui->choice_language = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 155, 190, 30, idex(_("Language|#L")));fl_set_button_shortcut(obj, scex(_("Language|#L")), 1);
+ fl_set_object_boxtype(obj, FL_FRAME_BOX);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
+ obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 295, 280, 45, "");
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 260, 280, 45, "");
+ obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 235, 280, 45, "");
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 10, 280, 235, "");
+ obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 10, 280, 210, "");
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
fdui->choice_family = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 15, 191, 30, idex(_("Family:|#F")));fl_set_button_shortcut(obj, scex(_("Family:|#F")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fdui->choice_series = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 55, 191, 30, idex(_("Series:|#S")));fl_set_button_shortcut(obj, scex(_("Series:|#S")), 1);
+ fdui->choice_series = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 50, 191, 30, idex(_("Series:|#S")));fl_set_button_shortcut(obj, scex(_("Series:|#S")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fdui->choice_shape = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 95, 191, 30, idex(_("Shape:|#H")));fl_set_button_shortcut(obj, scex(_("Shape:|#H")), 1);
+ fdui->choice_shape = obj = fl_add_choice(FL_NORMAL_CHOICE, 94, 85, 191, 30, idex(_("Shape:|#H")));fl_set_button_shortcut(obj, scex(_("Shape:|#H")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fdui->choice_size = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 270, 191, 30, idex(_("Size:|#Z")));fl_set_button_shortcut(obj, scex(_("Size:|#Z")), 1);
+ fdui->choice_size = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 245, 191, 30, idex(_("Size:|#Z")));fl_set_button_shortcut(obj, scex(_("Size:|#Z")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fdui->choice_bar = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 330, 190, 30, idex(_("Misc:|#M")));fl_set_button_shortcut(obj, scex(_("Misc:|#M")), 1);
+ fdui->choice_bar = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 305, 190, 30, idex(_("Misc:|#M")));fl_set_button_shortcut(obj, scex(_("Misc:|#M")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 370, 80, 30, idex(_("Apply|#A")));fl_set_button_shortcut(obj, scex(_("Apply|#A")), 1);
+ fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 60, 345, 80, 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, CharacterApplyCB, 0);
- fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON, 175, 370, 80, 30, _("Close"));
+ fdui->button_close = obj = fl_add_button(FL_RETURN_BUTTON, 175, 345, 80, 30, _("Close"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, CharacterCloseCB, 0);
- fdui->choice_color = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 135, 191, 30, idex(_("Color:|#C")));fl_set_button_shortcut(obj, scex(_("Color:|#C")), 1);
+ fdui->choice_color = obj = fl_add_choice(FL_NORMAL_CHOICE, 95, 120, 191, 30, idex(_("Color:|#C")));fl_set_button_shortcut(obj, scex(_("Color:|#C")), 1);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- fdui->choice_language = obj = fl_add_box(FL_FRAME_BOX,95,175,191,30,_("Language:"));
+ fdui->check_toggle_all = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 30, 190, 260, 25, idex(_("Toggle on all these|#T")));fl_set_button_shortcut(obj, scex(_("Toggle on all these|#T")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_LEFT);
- fl_set_object_gravity(obj, FL_NorthWest, FL_NoGravity);
- fl_set_object_resize(obj, FL_RESIZE_NONE);
- fdui->check_toggle_all = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 30, 215, 260, 25, idex(_("Toggle on all these|#T")));fl_set_button_shortcut(obj, scex(_("Toggle on all these|#T")), 1);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- obj = fl_add_text(FL_NORMAL_TEXT, 20, 250, 210, 20, _("These are never toggled"));
+ obj = fl_add_text(FL_NORMAL_TEXT, 20, 225, 210, 20, _("These are never toggled"));
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_resize(obj, FL_RESIZE_X);
- obj = fl_add_text(FL_NORMAL_TEXT, 20, 310, 215, 20, _("These are always toggled"));
+ obj = fl_add_text(FL_NORMAL_TEXT, 20, 285, 215, 20, _("These are always toggled"));
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, ParagraphExtraCancelCB, 0);
+ // xgettext:no-c-format
fdui->input_pextra_widthp = obj = fl_add_input(FL_INT_INPUT, 240, 70, 90, 30, idex(_("or %|#o")));fl_set_button_shortcut(obj, scex(_("or %|#o")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_callback(obj, CheckPExtraOptCB, 0);
-/** Header file generated with fdesign on Mon Apr 12 19:09:42 1999.**/
+/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
#ifndef FD_form_document_h_
#define FD_form_document_h_
+extern "C" {
+
/** Callbacks, globals and object handlers **/
extern "C" void ChoiceClassCB(FL_OBJECT *, long);
extern "C" void DocumentCancelCB(FL_OBJECT *, long);
extern "C" void TableOptionsCB(FL_OBJECT *, long);
extern "C" void TableSpeCloseCB(FL_OBJECT *, long);
+}
+
/* Additional Functions/Methods */
#include "bufferparams.h"
-extern bool UpdateLayoutDocument(BufferParams * params = 0);
+extern bool UpdateLayoutDocument(BufferParams *params = NULL);
extern bool UpdateLayoutPreamble();
extern bool UpdateLayoutPaper();
extern bool UpdateLayoutQuotes();
extern void MenuLayoutParagraph();
extern void MenuLayoutTable(int);
+extern "C" {
+
/**** Forms and Objects ****/
typedef struct {
FL_FORM *form_document;
void *vdata;
char *cdata;
long ldata;
+ FL_OBJECT *choice_language;
FL_OBJECT *choice_family;
FL_OBJECT *choice_series;
FL_OBJECT *choice_shape;
FL_OBJECT *button_apply;
FL_OBJECT *button_close;
FL_OBJECT *choice_color;
- FL_OBJECT *choice_language;
FL_OBJECT *check_toggle_all;
} FD_form_character;
extern FD_form_table_extra * create_form_form_table_extra(void);
+}
+
#endif /* FD_form_document_h_ */
/* Form definition file generated with fdesign. */
#include FORMS_H_LOCATION
-#include <stdlib.h>
+#include <cstdlib>
#include "lyx.h"
FD_form_title *create_form_form_title(void)
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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, RefHideCB, 0);
- fdui->ref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 60, 160, 30, idex(_("Insert Reference|#I^M")));fl_set_button_shortcut(obj, scex(_("Insert Reference|#I^M")), 1);
+ fdui->ref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 60, 160, 30, idex(_("Insert reference|#I^M")));fl_set_button_shortcut(obj, scex(_("Insert reference|#I^M")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, RefSelectCB, 0);
- fdui->pageref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 100, 160, 30, idex(_("Insert Page Number|#P")));fl_set_button_shortcut(obj, scex(_("Insert Page Number|#P")), 1);
+ fdui->pageref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 100, 160, 30, idex(_("Insert page number|#P")));fl_set_button_shortcut(obj, scex(_("Insert page number|#P")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, RefSelectCB, 1);
- fdui->gotoref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 280, 160, 30, idex(_("Go to Reference|#G")));fl_set_button_shortcut(obj, scex(_("Go to Reference|#G")), 1);
+ fdui->gotoref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 280, 160, 30, idex(_("Go to reference|#G")));fl_set_button_shortcut(obj, scex(_("Go to reference|#G")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, RefSelectCB, 5);
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
fl_set_object_callback(obj, RefUpdateCB, 0);
fl_set_button(obj, 1);
- fdui->vref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 140, 160, 30, idex(_("Insert vReference|#V")));fl_set_button_shortcut(obj, scex(_("Insert vReference|#V")), 1);
+ fdui->vref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 140, 160, 30, idex(_("Insert text reference|#V")));fl_set_button_shortcut(obj, scex(_("Insert text reference|#V")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, RefSelectCB, 2);
- fdui->vpageref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 180, 160, 30, idex(_("Insert vPage Number|#N")));fl_set_button_shortcut(obj, scex(_("Insert vPage Number|#N")), 1);
+ fdui->vpageref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 180, 160, 30, idex(_("Insert text page number|#N")));fl_set_button_shortcut(obj, scex(_("Insert text page number|#N")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, RefSelectCB, 3);
- fdui->prettyref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 220, 160, 30, idex(_("Insert Pretty Ref|#T")));fl_set_button_shortcut(obj, scex(_("Insert Pretty Ref|#T")), 1);
+ fdui->prettyref = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 220, 160, 30, idex(_("Insert pretty reference|#T")));fl_set_button_shortcut(obj, scex(_("Insert pretty reference|#T")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
fl_set_object_callback(obj, RefSelectCB, 4);
- fdui->back = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 320, 160, 30, idex(_("Go Back|#B")));fl_set_button_shortcut(obj,scex(_("Go Back|#B")), 1);
- fl_set_object_lsize(obj,FL_NORMAL_SIZE);
+ fdui->back = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 320, 160, 30, idex(_("Go back|#B")));fl_set_button_shortcut(obj, scex(_("Go back|#B")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
- fl_set_object_callback(obj,RefSelectCB, 6);
+ fl_set_object_callback(obj, RefSelectCB, 6);
fl_end_form();
//fdui->form_ref->fdui = fdui;
}
/*---------------------------------------*/
+FD_form_external *create_form_form_external(void)
+{
+ FL_OBJECT *obj;
+ FD_form_external *fdui = (FD_form_external *) fl_calloc(1, sizeof(FD_form_external));
+
+ fdui->form_external = fl_bgn_form(FL_NO_BOX, 560, 310);
+ obj = fl_add_box(FL_UP_BOX, 0, 0, 560, 310, "");
+ fdui->templatechoice = obj = fl_add_choice(FL_NORMAL_CHOICE, 130, 10, 300, 30, idex(_("Template|#t")));fl_set_button_shortcut(obj, scex(_("Template|#t")), 1);
+ fl_set_object_boxtype(obj, FL_FRAME_BOX);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
+ fl_set_object_callback(obj, ExternalTemplateCB, 0);
+ fdui->filename = obj = fl_add_input(FL_NORMAL_INPUT, 130, 190, 190, 30, idex(_("File|#F")));fl_set_button_shortcut(obj, scex(_("File|#F")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
+ fdui->filenamebrowse = obj = fl_add_button(FL_NORMAL_BUTTON, 330, 190, 100, 30, idex(_("Browse...|#B")));fl_set_button_shortcut(obj, scex(_("Browse...|#B")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
+ fl_set_object_callback(obj, ExternalBrowseCB, 0);
+ fdui->parameters = obj = fl_add_input(FL_NORMAL_INPUT, 130, 230, 300, 30, idex(_("Parameters|#P")));fl_set_button_shortcut(obj, scex(_("Parameters|#P")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_gravity(obj, FL_SouthWest, FL_SouthEast);
+ fdui->edit = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 50, 110, 30, idex(_("Edit file|#E")));fl_set_button_shortcut(obj, scex(_("Edit file|#E")), 1);
+ fl_set_object_color(obj, FL_COL1, FL_BLACK);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
+ fl_set_object_callback(obj, ExternalEditCB, 0);
+ fdui->view = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 90, 110, 30, idex(_("View result|#V")));fl_set_button_shortcut(obj, scex(_("View result|#V")), 1);
+ fl_set_object_color(obj, FL_COL1, FL_BLACK);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
+ fl_set_object_callback(obj, ExternalViewCB, 0);
+ fdui->update = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 130, 110, 30, idex(_("Update result|#U")));fl_set_button_shortcut(obj, scex(_("Update result|#U")), 1);
+ fl_set_object_color(obj, FL_COL1, FL_BLACK);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_gravity(obj, FL_NorthEast, FL_NorthEast);
+ fl_set_object_callback(obj, ExternalUpdateCB, 0);
+ fdui->ok = obj = fl_add_button(FL_RETURN_BUTTON, 315, 270, 110, 30, _("OK"));
+ fl_set_object_color(obj, FL_COL1, FL_BLACK);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
+ fl_set_object_callback(obj, ExternalOKCB, 0);
+ fdui->cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 435, 270, 110, 30, idex(_("Cancel|#C^[")));fl_set_button_shortcut(obj, scex(_("Cancel|#C^[")), 1);
+ fl_set_object_lsize(obj, FL_NORMAL_SIZE);
+ fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
+ fl_set_object_callback(obj, ExternalCancelCB, 0);
+ fdui->helptext = obj = fl_add_browser(FL_NORMAL_BROWSER, 130, 50, 300, 130, "");
+ fl_set_object_lalign(obj, FL_ALIGN_TOP);
+ fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
+ fl_end_form();
+
+ //fdui->form_external->fdui = fdui;
+
+ return fdui;
+}
+/*---------------------------------------*/
+
-/** Header file generated with fdesign on Mon Apr 12 19:09:42 1999.**/
+/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
#ifndef FD_form_title_h_
#define FD_form_title_h_
extern "C" void RefHideCB(FL_OBJECT *, long);
extern "C" void RefSelectCB(FL_OBJECT *, long);
+extern "C" void ExternalTemplateCB(FL_OBJECT *, long);
+extern "C" void ExternalBrowseCB(FL_OBJECT *, long);
+extern "C" void ExternalEditCB(FL_OBJECT *, long);
+extern "C" void ExternalViewCB(FL_OBJECT *, long);
+extern "C" void ExternalUpdateCB(FL_OBJECT *, long);
+extern "C" void ExternalOKCB(FL_OBJECT *, long);
+extern "C" void ExternalCancelCB(FL_OBJECT *, long);
+
/**** Forms and Objects ****/
typedef struct {
} FD_form_ref;
extern FD_form_ref * create_form_form_ref(void);
+typedef struct {
+ FL_FORM *form_external;
+ void *vdata;
+ char *cdata;
+ long ldata;
+ FL_OBJECT *templatechoice;
+ FL_OBJECT *filename;
+ FL_OBJECT *filenamebrowse;
+ FL_OBJECT *parameters;
+ FL_OBJECT *edit;
+ FL_OBJECT *view;
+ FL_OBJECT *update;
+ FL_OBJECT *ok;
+ FL_OBJECT *cancel;
+ FL_OBJECT *helptext;
+} FD_form_external;
+
+extern FD_form_external * create_form_form_external(void);
#endif /* FD_form_title_h_ */
#include "lyx.h"
#include "layout_forms.h"
#include "bullet_forms.h"
-#include "print_form.h"
#include "form1.h"
#include "lyx_main.h"
#include "lyx_cb.h"
extern FD_form_quotes * fd_form_quotes;
extern FD_form_preamble * fd_form_preamble;
extern FD_form_table * fd_form_table;
-extern FD_form_print * fd_form_print;
extern FD_form_figure * fd_form_figure;
extern FD_form_screen * fd_form_screen;
extern FD_form_toc * fd_form_toc;
}
-
-
-#if 0
-// only called from this file, LyXView and LyXFunc
-char updatetimer = 0;
-// only called from BufferView_pimpl and LyXFunc
-void FreeUpdateTimer()
-{
- /* a real free timer would be better but I don't know
- * how to do this with xforms */
- updatetimer = 0;
-}
-
-// Only called from LyXFunc
-void SetUpdateTimer(float time)
-{
- fl_set_timer(current_view->owner()->getMainForm()->timer_update, time);
- updatetimer = 1;
-}
-#endif
-
-
//
// Menu callbacks
//
}
-void MenuPrint(Buffer * buffer)
-{
- // Who cares?
- //if (!bv->text)
- // return;
-
- string input_file = OnlyFilename(ChangeExtension(buffer->fileName(),
- lyxrc.print_file_extension));
- fl_set_input(fd_form_print->input_file, input_file.c_str());
-
- if (fd_form_print->form_print->visible) {
- fl_raise_form(fd_form_print->form_print);
- }
- else {
- fl_show_form(fd_form_print->form_print,
- FL_PLACE_MOUSE, FL_FULLBORDER,
- _("Print"));
- }
-}
-
-
void MenuMakeHTML(Buffer * buffer)
{
// First, create LaTeX file
// postscript
else if (extyp == "postscript") {
// Start Print-dialog. Not as good as dvi... Bernhard.
- MenuPrint(buffer);
+ //should start lyxview->getDialogs()->showPrint();
+ // to get same as before
+ // MenuPrint(buffer);
// Since the MenuPrint is a pop-up, we can't use
// the same trick as above. (Asger)
// MISSING: Move of ps-file :-(
// clear the selection
bv->beforeChange();
if (!asParagraph)
- bv->text->InsertStringA(tmpstr);
+ bv->text->InsertStringA(bv, tmpstr);
else
- bv->text->InsertStringB(tmpstr);
- bv->update(1);
+ bv->text->InsertStringB(bv, tmpstr);
+ bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
labelwidthstring = fl_get_input(fd_form_paragraph->input_labelwidth);
noindent = fl_get_button(fd_form_paragraph->check_noindent);
- current_view->text->SetParagraph(line_top,
+ current_view->text->SetParagraph(current_view,
+ line_top,
line_bottom,
pagebreak_top,
pagebreak_bottom,
align,
labelwidthstring,
noindent);
- current_view->update(1);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
current_view->owner()->getMiniBuffer()->Set(_("Paragraph layout set"));
}
if (!current_view->available())
return;
- current_view->text->SetCursor(current_view->text->cursor.par(),
+ current_view->text->SetCursor(current_view,
+ current_view->text->cursor.par(),
current_view->text->cursor.pos());
current_view->setState();
current_view->hideCursor();
current_view->beforeChange();
- current_view->update(-2);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR);
- current_view->text->SetCursorParUndo();
+ current_view->text->SetCursorParUndo(current_view->buffer());
current_view->text->FreezeUndo();
- current_view->text->BreakParagraph();
- current_view->update(-1);
+ current_view->text->BreakParagraph(current_view);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
if (current_view->text->cursor.par()->Last()) {
- current_view->text->CursorLeft();
+ current_view->text->CursorLeft(current_view);
- current_view->text->BreakParagraph();
- current_view->update(-1);
+ current_view->text->BreakParagraph(current_view);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
current_view->text->current_font.setLatex(LyXFont::OFF);
//if (!fl_get_button(fd_form_table->check_latex)){
// insert the new wysiwy table
- current_view->text->SetLayout(0); // standard layout
+ current_view->text->SetLayout(current_view, 0); // standard layout
if (current_view->text->cursor.par()->footnoteflag ==
LyXParagraph::NO_FOOTNOTE) {
current_view->text
- ->SetParagraph(0, 0,
+ ->SetParagraph(current_view, 0, 0,
0, 0,
VSpace (0.3 * current_view->buffer()->
params.spacing.getValue(),
0);
} else {
current_view->text
- ->SetParagraph(0, 0,
+ ->SetParagraph(current_view, 0, 0,
0, 0,
VSpace(VSpace::NONE),
VSpace(VSpace::NONE),
current_view->text->cursor.par()->InsertChar(0, LyXParagraph::META_NEWLINE);
current_view->text->cursor.par()->SetFont(0, font);
}
- current_view->text->RedoParagraph();
+ current_view->text->RedoParagraph(current_view);
current_view->text->UnFreezeUndo();
- current_view->update(1);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
current_view->owner()->getMiniBuffer()->Set(_("Table inserted"));
current_view->setState();
}
}
-/* callbacks for form form_print */
-
-extern "C" void PrintCancelCB(FL_OBJECT *, long)
-{
- fl_hide_form(fd_form_print->form_print);
-}
-
-
-static
-bool stringOnlyContains (string const & LStr, char const * cset)
-{
- return LStr.find_first_not_of(cset) == string::npos;
-}
-
-
-extern "C" void PrintApplyCB(FL_OBJECT *, long)
-{
- if (!current_view->available())
- return;
- Buffer * buffer = current_view->buffer();
- string path = OnlyPath(buffer->fileName());
-
- string pageflag;
- if (fl_get_button(fd_form_print->radio_even_pages))
- pageflag = lyxrc.print_evenpage_flag + ' ';
- else if (fl_get_button(fd_form_print->radio_odd_pages))
- pageflag = lyxrc.print_oddpage_flag + ' ';
-
-// Changes by Stephan Witt (stephan.witt@beusen.de), 19-Jan-99
-// User may give a page (range) list
-// User may print multiple (unsorted) copies
- string pages = subst(fl_get_input(fd_form_print->input_pages), ';',',');
- pages = subst(pages, '+',',');
- pages = frontStrip(strip(pages)) ;
- while (!pages.empty()) { // a page range was given
- string piece ;
- pages = split (pages, piece, ',') ;
- piece = strip(piece) ;
- piece = frontStrip(piece) ;
- if ( !stringOnlyContains (piece, "0123456789-") ) {
- WriteAlert(_("ERROR! Unable to print!"),
- _("Check 'range of pages'!"));
- return;
- }
- if (piece.find('-') == string::npos) { // not found
- pageflag += lyxrc.print_pagerange_flag + piece + '-' + piece + ' ' ;
- } else if (suffixIs(piece, "-") ) { // missing last page
- pageflag += lyxrc.print_pagerange_flag + piece + "1000 ";
- } else if (prefixIs(piece, "-") ) { // missing first page
- pageflag += lyxrc.print_pagerange_flag + '1' + piece + ' ' ;
- } else {
- pageflag += lyxrc.print_pagerange_flag + piece + ' ' ;
- }
- }
-
- string copies = frontStrip(strip(fl_get_input(fd_form_print->input_copies)));
- if (!copies.empty()) { // a number of copies was given
- if ( !stringOnlyContains (copies, "0123456789") ) {
- WriteAlert(_("ERROR! Unable to print!"),
- _("Check 'number of copies'!"));
- return;
- }
- if (fl_get_button(fd_form_print->do_unsorted))
- pageflag += lyxrc.print_copies_flag;
- else
- pageflag += lyxrc.print_collcopies_flag;
- pageflag += " " + copies + ' ' ;
- }
-
- string reverseflag;
- if (fl_get_button(fd_form_print->radio_order_reverse))
- reverseflag = lyxrc.print_reverse_flag + ' ';
-
- string orientationflag;
- if (buffer->params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
- orientationflag = lyxrc.print_landscape_flag + ' ';
-
- string ps_file = fl_get_input(fd_form_print->input_file);
- string printer = strip(fl_get_input(fd_form_print->input_printer));
-
- string printerflag;
- if (lyxrc.print_adapt_output // printer name should be passed to dvips
- && ! printer.empty()) // a printer name has been given
- printerflag = lyxrc.print_to_printer + printer + ' ';
-
- string extraflags;
- if (!lyxrc.print_extra_options.empty())
- extraflags = lyxrc.print_extra_options + ' ';
-
- string command = lyxrc.print_command + ' '
- + printerflag + pageflag + reverseflag
- + orientationflag + extraflags;
-
- char real_papersize = buffer->params.papersize;
- if (real_papersize == BufferParams::PAPER_DEFAULT)
- real_papersize = lyxrc.default_papersize;
-
- string paper;
- switch (real_papersize) {
- case BufferParams::PAPER_USLETTER:
- paper = "letter";
- break;
- case BufferParams::PAPER_A3PAPER:
- paper = "a3";
- break;
- case BufferParams::PAPER_A4PAPER:
- paper = "a4";
- break;
- case BufferParams::PAPER_A5PAPER:
- paper = "a5";
- break;
- case BufferParams::PAPER_B5PAPER:
- paper = "b5";
- break;
- case BufferParams::PAPER_EXECUTIVEPAPER:
- paper = "foolscap";
- break;
- case BufferParams::PAPER_LEGALPAPER:
- paper = "legal";
- break;
- default: /* If nothing else fits, keep an empty value... */
- break;
- }
-
- if (buffer->params.use_geometry
- && buffer->params.papersize2 == BufferParams::VM_PAPER_CUSTOM
- && !lyxrc.print_paper_dimension_flag.empty()
- && !buffer->params.paperwidth.empty()
- && !buffer->params.paperheight.empty()) {
- // using a custom papersize
- command += ' ';
- command += lyxrc.print_paper_dimension_flag + ' ';
- command += buffer->params.paperwidth + ',';
- command += buffer->params.paperheight + ' ';
- } else if (!lyxrc.print_paper_flag.empty()
- && !paper.empty()
- && (real_papersize != BufferParams::PAPER_USLETTER ||
- buffer->params.orientation == BufferParams::ORIENTATION_PORTRAIT)) {
- command += " " + lyxrc.print_paper_flag + " " + paper + " ";
- }
- if (fl_get_button(fd_form_print->radio_file))
- command += lyxrc.print_to_file
- + QuoteName(MakeAbsPath(ps_file, path));
- else if (!lyxrc.print_spool_command.empty())
- command += lyxrc.print_to_file
- + QuoteName(ps_file);
-
- // push directorypath, if necessary
- if (lyxrc.use_tempdir || (IsDirWriteable(path) < 1)){
- path = buffer->tmppath;
- }
- Path p(path);
-
- bool result;
- if (!lyxrc.print_spool_command.empty() &&
- !fl_get_button(fd_form_print->radio_file)) {
- string command2 = lyxrc.print_spool_command + ' ';
- if (!printer.empty())
- command2 += lyxrc.print_spool_printerprefix
- + printer;
- // First run dvips and, if succesful, then spool command
- if ((result = RunScript(buffer, true, command))) {
- result = RunScript(buffer, false, command2, ps_file);
- }
- } else
- result = RunScript(buffer, false, command);
-
- if (!result)
- WriteAlert(_("Error:"),
- _("Unable to print"),
- _("Check that your parameters are correct"));
-}
-
-
-extern "C" void PrintOKCB(FL_OBJECT * ob, long data)
-{
- PrintCancelCB(ob, data);
- PrintApplyCB(ob, data);
-}
-
-
void Figure()
{
if (fd_form_figure->form_figure->visible) {
}
current_view->hideCursor();
- current_view->update(-2);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR);
current_view->beforeChange();
- current_view->text->SetCursorParUndo();
+ current_view->text->SetCursorParUndo(current_view->buffer());
current_view->text->FreezeUndo();
- current_view->text->BreakParagraph();
- current_view->update(-1);
+ current_view->text->BreakParagraph(current_view);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
if (current_view->text->cursor.par()->Last()) {
- current_view->text->CursorLeft();
+ current_view->text->CursorLeft(current_view);
- current_view->text->BreakParagraph();
- current_view->update(-1);
+ current_view->text->BreakParagraph(current_view);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
// The standard layout should always be numer 0;
- current_view->text->SetLayout(0);
+ current_view->text->SetLayout(current_view, 0);
if (current_view->text->cursor.par()->footnoteflag ==
LyXParagraph::NO_FOOTNOTE) {
current_view->text->
- SetParagraph(0, 0,
+ SetParagraph(current_view, 0, 0,
0, 0,
VSpace (0.3 * buffer->params.spacing.getValue(),
LyXLength::CM),
LyXLength::CM),
LYX_ALIGN_CENTER, string(), 0);
} else {
- current_view->text->SetParagraph(0, 0,
+ current_view->text->SetParagraph(current_view, 0, 0,
0, 0,
VSpace(VSpace::NONE),
VSpace(VSpace::NONE),
0);
}
- current_view->update(-1);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
Inset * new_inset = new InsetFig(100, 100, buffer);
current_view->insertInset(new_inset);
new_inset->Edit(current_view, 0, 0, 0);
- current_view->update(0);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR);
current_view->owner()->getMiniBuffer()->Set(_("Figure inserted"));
current_view->text->UnFreezeUndo();
current_view->setState();
unsigned int choice = fl_get_browser(ob);
if (0 < choice && choice - 1 < toclist.size()) {
current_view->beforeChange();
- current_view->text->SetCursor(toclist[choice-1].par, 0);
+ current_view->text->SetCursor(current_view, toclist[choice-1].par, 0);
current_view->text->sel_cursor =
current_view->text->cursor;
- current_view->update(0);
+ current_view->update(BufferView::SELECT|BufferView::FITCUR);
} else {
WriteAlert(_("Error"),
_("Couldn't find this label"),
#pragma implementation
#endif
+#ifdef KDEGUI
+# include <kapp.h>
+#endif
+
#include <fcntl.h>
-#include FORMS_H_LOCATION
#include "lyx_gui.h"
+#include FORMS_H_LOCATION
#include "combox.h"
#include "lyx.h"
#include "form1.h"
FD_form_quotes * fd_form_quotes;
FD_form_preamble * fd_form_preamble;
FD_form_table * fd_form_table;
-FD_form_print * fd_form_print;
FD_form_sendto * fd_form_sendto;
FD_form_figure * fd_form_figure;
FD_form_screen * fd_form_screen;
// all lyxrc settings has to be done here as lyxrc has not yet
// been read when the GUI is created (Jug)
- // the print form
- fl_set_input(fd_form_print->input_printer,
- lyxrc.printer.c_str());
-
// the sendto form
if (!lyxrc.custom_export_command.empty())
fl_set_input(fd_form_sendto->input_cmd,
FL_RETURN_ALWAYS);
fl_set_input_return(fd_form_paragraph_extra->input_pextra_widthp,
FL_RETURN_ALWAYS);
+ lyxerr[Debug::INIT] << "Initializing form_paragraph...done" << endl;
// the character form
fd_form_character = create_form_form_character();
fl_set_form_minsize(fd_form_character->form_character,
fd_form_character->form_character->w,
fd_form_character->form_character->h);
+ lyxerr[Debug::INIT] << "Initializing form_character::combox..." << endl;
fl_addto_form(fd_form_character->form_character);
combo_language2 = new Combox(FL_COMBOX_DROPLIST);
FL_OBJECT * ob = fd_form_character->choice_language;
combo_language2->add(ob->x, ob->y, ob->w, ob->h, 250);
combo_language2->shortcut("#L", 1);
fl_end_form();
+ lyxerr[Debug::INIT] << "Initializing form_character...done" << endl;
// the document form
fd_form_document = create_form_form_document();
fl_set_form_minsize(fd_form_document->form_document,
fd_form_document->form_document->w,
fd_form_document->form_document->h);
+ lyxerr[Debug::INIT] << "Initializing form_document...done" << endl;
// the paper form
fd_form_paper = create_form_form_paper();
FL_RETURN_ALWAYS);
fl_set_input_return(fd_form_paper->input_foot_skip,
FL_RETURN_ALWAYS);
+ lyxerr[Debug::INIT] << "Initializing form_paper...done" << endl;
// the table_options form
fd_form_table_options = create_form_form_table_options();
FL_RETURN_ALWAYS);
fl_set_input_return(fd_form_table_extra->input_special_multialign,
FL_RETURN_ALWAYS);
+ lyxerr[Debug::INIT] << "Initializing form_table_extra...done" << endl;
// the quotes form
fd_form_quotes = create_form_form_quotes();
fl_set_slider_value(fd_form_table->slider_columns, 5);
fl_set_slider_precision(fd_form_table->slider_rows, 0);
fl_set_slider_precision(fd_form_table->slider_columns, 0);
-
- // the print form
- fd_form_print = create_form_form_print();
- fl_set_form_atclose(fd_form_print->form_print, CancelCloseBoxCB, 0);
- fl_set_button(fd_form_print->radio_printer, 1);
- fl_set_button(fd_form_print->radio_file, 0);
- fl_set_button(fd_form_print->radio_order_normal, 1);
- fl_set_button(fd_form_print->radio_order_reverse, 0);
- fl_set_button(fd_form_print->radio_all_pages, 1);
- fl_set_button(fd_form_print->radio_odd_pages, 0);
- fl_set_button(fd_form_print->radio_even_pages, 0);
+ lyxerr[Debug::INIT] << "Initializing form_table...done" << endl;
// the sendto form
fd_form_sendto = create_form_form_sendto();
XEvent ev;
while (!finished) {
+#ifdef KDEGUI
+ kapp->processEvents();
+#endif
if (fl_check_forms() == FL_EVENT) {
lyxerr << "LyX: This shouldn't happen..." << endl;
fl_XNextEvent(&ev);
extern FD_form_quotes * fd_form_quotes;
extern FD_form_preamble * fd_form_preamble;
extern FD_form_table * fd_form_table;
-extern FD_form_print * fd_form_print;
extern FD_form_sendto * fd_form_sendto;
extern FD_form_figure * fd_form_figure;
extern FD_form_toc * fd_form_toc;
// This is also one of the functions that we _really_ dont want
// we should try to finds way to help us with that.
// The signal/slot mechanism can probably help.
-void CloseAllBufferRelatedPopups()
+void CloseAllBufferRelatedDialogs()
{
// don't forget to check that dynamically created forms
// have been created otherwise hiding one could cause a crash
if (fd_form_table->form_table->visible) {
fl_hide_form(fd_form_table->form_table);
}
- if (fd_form_print->form_print->visible) {
- fl_hide_form(fd_form_print->form_print);
- }
if (fd_form_figure->form_figure->visible) {
fl_hide_form(fd_form_figure->form_figure);
}
// This is another function we really don't want.
// Again the Signal/Slot mechanism is tailor made for this task.
-void updateAllVisibleBufferRelatedPopups()
+void updateAllVisibleBufferRelatedDialogs()
{
if (fd_form_document->form_document->visible) {
UpdateLayoutDocument();
if (fd_form_toc->browser_toc->visible) {
TocUpdateCB(0, 0);
}
+ if (fd_latex_log->LaTeXLog->visible) {
+ LatexLogUpdate(0,0);
+ }
#ifdef ALWAYS_UPDATE_REF
// Ideally, the RefUpdateCB should be modified so that if the
// current document is a subdocument the reference list should come
extern "C" int IgnoreCloseBoxCB(FL_FORM *, void *);
/// Prevents LyX from crashing when no buffers available
-void CloseAllBufferRelatedPopups();
+void CloseAllBufferRelatedDialogs();
/// Ensures info in visible popups are always correct.
-void updateAllVisibleBufferRelatedPopups();
+void updateAllVisibleBufferRelatedDialogs();
/// Extract shortcut from <ident>|<shortcut> string
char const * flyx_shortcut_extract(char const * sc);
/* Form definition file generated with fdesign. */
#include FORMS_H_LOCATION
-#include <stdlib.h>
+#include <cstdlib>
#include "lyx_sendfax.h"
FD_xsendfax *create_form_xsendfax(void)
-/** Header file generated with fdesign on Mon Apr 12 19:09:42 1999.**/
+/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
#ifndef FD_xsendfax_h_
#define FD_xsendfax_h_
// If nothing selected, select the word at the cursor.
// Returns the current selection
static inline
-string GetSelectionOrWordAtCursor(LyXText * lt)
+string GetSelectionOrWordAtCursor(BufferView * bv)
{
- lt->SelectWordWhenUnderCursor();
- return GetCurrentSelectionAsString(lt);
+ bv->text->SelectWordWhenUnderCursor(bv);
+ return GetCurrentSelectionAsString(bv->text);
}
// This is a copy of SetSelectionOverString from text.C
// It does the same, but uses only the length as a parameter
static inline
-void SetSelectionOverLenChars(LyXText * lt, int len)
+void SetSelectionOverLenChars(BufferView * bv, int len)
{
- lt->sel_cursor = lt->cursor;
+ bv->text->sel_cursor = bv->text->cursor;
for (int i = 0; i < len; ++i)
- lt->CursorRight();
- lt->SetSelection();
+ bv->text->CursorRight(bv);
+ bv->text->SetSelection(bv);
}
SF.replaceEnabled(!bv->buffer()->isReadonly());
searchForward = true;
if (SF.SearchString().empty())
- SF.SetSearchString(GetSelectionOrWordAtCursor(bv->text));
+ SF.SetSearchString(GetSelectionOrWordAtCursor(bv));
}
string const replacestring = SF.ReplaceString();
bv->hideCursor();
- bv->update(-2);
+ bv->update(BufferView::SELECT|BufferView::FITCUR);
LyXText * ltCur = bv->text;
if (ltCur->selection) {
// clear the selection (if there is any)
bv->toggleSelection(false);
bv->text->
- ReplaceSelectionWithString(replacestring.c_str());
+ ReplaceSelectionWithString(bv, replacestring.c_str());
bv->text->
- SetSelectionOverString(replacestring.c_str());
- bv->update(1);
+ SetSelectionOverString(bv, replacestring.c_str());
+ bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
// jump to next match:
// start at top
bv->text->ClearSelection();
- bv->text->CursorTop();
+ bv->text->CursorTop(bv);
int replace_count = 0;
LyXText * ltCur;
do {
ltCur = bv->text;
if (ltCur->selection) {
- bv->update(-2);
+ bv->update(BufferView::SELECT|BufferView::FITCUR);
bv->toggleSelection(false);
bv->text->
- ReplaceSelectionWithString(replacestring.c_str());
+ ReplaceSelectionWithString(bv, replacestring.c_str());
bv->text->
- SetSelectionOverString(replacestring.c_str());
- bv->update(1);
+ SetSelectionOverString(bv, replacestring.c_str());
+ bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
++replace_count;
}
} while (SearchCB(true));
return false;
bv->hideCursor();
- bv->update(-2);
+ bv->update(BufferView::SELECT|BufferView::FITCUR);
LyXText * ltCur = bv->text;
if (ltCur->selection)
ltCur->cursor = fForward ? ltCur->sel_end_cursor :
bool result;
if (!SF.ValidSearchData() ||
- (fForward ? SearchForward(ltCur) : SearchBackward(ltCur))) {
- bv->update(-2);
+ (fForward ? SearchForward(bv):SearchBackward(bv))) {
+ bv->update(BufferView::SELECT|BufferView::FITCUR);
// clear the selection (if there is any)
bv->toggleSelection();
bv->text->ClearSelection();
// set the new selection
- SetSelectionOverLenChars(bv->text, iLenSelected);
+ SetSelectionOverLenChars(bv, iLenSelected);
bv->toggleSelection(false);
bv->owner()->getMiniBuffer()->Set(_("Found."));
result = true;
// if the string can be found: return true and set the cursor to
// the new position
// (was: LyXText::SearchForward(char const* string) in text2.C )
-bool LyXFindReplace::SearchForward(LyXText * lt)
+bool LyXFindReplace::SearchForward(BufferView * bv)
{
- LyXParagraph * par = lt->cursor.par();
- LyXParagraph::size_type pos = lt->cursor.pos();
+ LyXParagraph * par = bv->text->cursor.par();
+ LyXParagraph::size_type pos = bv->text->cursor.pos();
while (par && !IsSearchStringInText(par, pos)) {
if (pos < par->Last() - 1)
}
}
if (par) {
- lt->SetCursor(par, pos);
+ bv->text->SetCursor(bv, par, pos);
return true;
} else
return false;
// if the string can be found: return true and set the cursor to
// the new position
// (was: LyXText::SearchBackward(char const* string) in text2.C )
-bool LyXFindReplace::SearchBackward(LyXText * lt)
+bool LyXFindReplace::SearchBackward(BufferView * bv)
{
- LyXParagraph * par = lt->cursor.par();
- int pos = lt->cursor.pos();
+ LyXParagraph * par = bv->text->cursor.par();
+ int pos = bv->text->cursor.pos();
do {
if (pos > 0)
} while (par && !IsSearchStringInText(par, pos));
if (par) {
- lt->SetCursor(par, pos);
+ bv->text->SetCursor(bv, par, pos);
return true;
} else
return false;
bool searchForward;
///
- bool SearchForward(LyXText * lt);
+ bool SearchForward(BufferView *);
///
- bool SearchBackward(LyXText * lt);
+ bool SearchBackward(BufferView *);
/** Compares 2 char values.
return value is
#include "insets/insetcite.h"
#include "insets/insettext.h"
#include "insets/insetert.h"
+#include "insets/insetexternal.h"
#include "insets/insetgraphics.h"
#include "insets/insetfoot.h"
#include "insets/insettabular.h"
#include "lyxfr1.h"
#include "menus.h"
#include "bufferview_funcs.h"
+#include "frontends/Dialogs.h"
using std::pair;
using std::endl;
extern tex_accent_struct get_accent(kb_action action);
extern void AutoSave(BufferView *);
-#if 0
-extern void SetUpdateTimer(float timer = 0.3);
-extern void FreeUpdateTimer();
-#endif
extern bool PreviewDVI(Buffer *);
extern bool PreviewPostscript(Buffer *);
extern void MenuInsertLabel(char const *);
void LyXFunc::moveCursorUpdate(bool selecting)
{
if (selecting || owner->view()->text->mark_set) {
- owner->view()->text->SetSelection();
+ owner->view()->text->SetSelection(owner->view());
owner->view()->toggleToggle();
- //owner->view()->update(0);
- //} else {
- //owner->view()->update(-2); // this IS necessary
- // (Matthias)
}
- owner->view()->update(0);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->showCursor();
/* ---> Everytime the cursor is moved, show the current font state. */
if (owner->view()->available() && tli && (keysym_return==XK_Escape)) {
if (tli == tli->GetLockingInset()) {
owner->view()->unlockInset(tli);
- owner->view()->text->CursorRight();
+ owner->view()->text->CursorRight(owner->view());
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
} else {
if (lyxaction.isPseudoAction(ac))
action = lyxaction.retrieveActionArg(ac, argument);
- else
+ else
action = static_cast<kb_action>(ac);
if (action == LFUN_UNKNOWN_ACTION) {
setErrorMessage(N_("Unknown action"));
return LyXFunc::Unknown;
- }
+ }
// Check whether we need a buffer
if (!lyxaction.funcHasFlag(action, LyXAction::NoBuffer)) {
switch (action) {
case LFUN_PREVIEW:
disable = noLaTeX || lyxrc.view_dvi_command == "none";
- break;
- case LFUN_PREVIEWPS:
+ break;
+ case LFUN_PREVIEWPS:
disable = noLaTeX || lyxrc.view_ps_command == "none";
break;
case LFUN_RUNLATEX:
disable = noLaTeX || lyxrc.print_command == "none";
break;
case LFUN_FAX:
- disable = noLaTeX || lyxrc.fax_command == "none";
+ disable = noLaTeX || lyxrc.fax_command == "none";
break;
case LFUN_IMPORT:
if (argument == "latex")
case LFUN_UNKNOWN_ACTION:
case LFUN_BREAKPARAGRAPH:
case LFUN_BREAKLINE:
- owner->view()->text->CursorRight();
+ owner->view()->text->CursorRight(owner->view());
owner->view()->setState();
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_RIGHT:
if (!owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
- owner->view()->text->CursorRight();
+ owner->view()->text->CursorRight(owner->view());
moveCursorUpdate(false);
owner->getMiniBuffer()->
Set(CurrentState(owner->view()));
return string();
case LFUN_LEFT:
if (owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
- owner->view()->text->CursorRight();
+ owner->view()->text->CursorRight(owner->view());
moveCursorUpdate(false);
owner->getMiniBuffer()->
Set(CurrentState(owner->view()));
}
return string();
case LFUN_DOWN:
- owner->view()->text->CursorDown();
+ owner->view()->text->CursorDown(owner->view());
moveCursorUpdate(false);
owner->getMiniBuffer()->
Set(CurrentState(owner->view()));
if (!searched_string.empty() &&
((action == LFUN_WORDFINDBACKWARD) ?
- ltCur->SearchBackward(searched_string.c_str()) :
- ltCur->SearchForward(searched_string.c_str()))) {
+ ltCur->SearchBackward(owner->view(), searched_string.c_str()) :
+ ltCur->SearchForward(owner->view(), searched_string.c_str()))) {
// ??? What is that ???
- owner->view()->update(-2);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
// ??? Needed ???
// clear the selection (if there is any)
// Move cursor so that successive C-s 's will not stand in place.
if( action == LFUN_WORDFINDFORWARD )
- owner->view()->text->CursorRightOneWord();
+ owner->view()->text->CursorRightOneWord(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
case LFUN_PREFIX:
{
if (owner->view()->available()) {
- owner->view()->update(-2);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
}
string buf;
keyseq.print(buf, true);
case LFUN_APPENDIX:
if (owner->view()->available()) {
- owner->view()->text->toggleAppendix();
- owner->view()->update(1);
+ owner->view()->text->toggleAppendix(owner->view());
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
break;
break;
case LFUN_MENUPRINT:
- MenuPrint(owner->buffer());
+ owner->getDialogs()->showPrint();
break;
-
+
case LFUN_FAX:
MenuFax(owner->buffer());
break;
owner->view()->setState();
break;
+ case LFUN_HELP_COPYRIGHT:
+ owner->getDialogs()->showCopyright();
+ break;
+
// --- version control -------------------------------
case LFUN_VC_REGISTER:
{
if (current_layout != layout.second) {
owner->view()->hideCursor();
current_layout = layout.second;
- owner->view()->update(-2);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->
- SetLayout(layout.second);
+ SetLayout(owner->view(), layout.second);
owner->getToolbar()->combox->
select(owner->view()->
text->cursor.par()->
GetLayout() + 1);
- owner->view()->update(1);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
owner->view()->setState();
}
}
break;
case LFUN_UPCASE_WORD:
- owner->view()->update(-2);
-#if 1
- //owner->update_timeout.stop();
-#else
- FreeUpdateTimer();
-#endif
- owner->view()->text->ChangeWordCase(LyXText::text_uppercase);
- owner->view()->update(1);
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->ChangeWordCase(owner->view(),
+ LyXText::text_uppercase);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
break;
case LFUN_LOWCASE_WORD:
- owner->view()->update(-2);
-#if 1
- //owner->update_timeout.stop();
-#else
- FreeUpdateTimer();
-#endif
- owner->view()->text->ChangeWordCase(LyXText::text_lowercase);
- owner->view()->update(1);
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->ChangeWordCase(owner->view(),
+ LyXText::text_lowercase);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
break;
case LFUN_CAPITALIZE_WORD:
- owner->view()->update(-2);
-#if 1
- //owner->update_timeout.stop();
-#else
- FreeUpdateTimer();
-#endif
- owner->view()->text->ChangeWordCase(LyXText::text_capitalization);
- owner->view()->update(1);
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->ChangeWordCase(owner->view(),
+ LyXText::text_capitalization);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
break;
case LFUN_INSERT_LABEL:
bool is_rtl = tmptext->cursor.par()->isRightToLeftPar(owner->buffer()->params);
if(!tmptext->mark_set)
owner->view()->beforeChange();
- owner->view()->update(-2);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
if (is_rtl)
- tmptext->CursorLeft(false);
+ tmptext->CursorLeft(owner->view(), false);
if (tmptext->cursor.pos() < tmptext->cursor.par()->Last()
&& tmptext->cursor.par()->GetChar(tmptext->cursor.pos())
== LyXParagraph::META_INSET
break;
}
if (!is_rtl)
- tmptext->CursorRight(false);
+ tmptext->CursorRight(owner->view(), false);
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
LyXText * txt = owner->view()->text;
bool is_rtl = txt->cursor.par()->isRightToLeftPar(owner->buffer()->params);
if(!txt->mark_set) owner->view()->beforeChange();
- owner->view()->update(-2);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
if (!is_rtl)
- txt->CursorLeft(false);
+ txt->CursorLeft(owner->view(), false);
if (txt->cursor.pos() < txt->cursor.par()->Last()
&& txt->cursor.par()->GetChar(txt->cursor.pos())
== LyXParagraph::META_INSET
&& txt->cursor.par()->GetInset(txt->cursor.pos())->Editable() == Inset::HIGHLY_EDITABLE) {
Inset * tmpinset = txt->cursor.par()->GetInset(txt->cursor.pos());
setMessage(tmpinset->EditMessage());
- LyXFont font = txt->GetFont(txt->cursor.par(),
+ LyXFont font = txt->GetFont(owner->view()->buffer(),
+ txt->cursor.par(),
txt->cursor.pos());
tmpinset->Edit(owner->view(),
tmpinset->x() + tmpinset->width(owner->view()->painter(),font),
break;
}
if (is_rtl)
- txt->CursorRight(false);
+ txt->CursorRight(owner->view(), false);
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
case LFUN_UP:
if(!owner->view()->text->mark_set) owner->view()->beforeChange();
- owner->view()->update(-3);
- owner->view()->text->CursorUp();
+ owner->view()->update(BufferView::UPDATE);
+ owner->view()->text->CursorUp(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
case LFUN_DOWN:
if(!owner->view()->text->mark_set)
owner->view()->beforeChange();
- owner->view()->update(-3);
- owner->view()->text->CursorDown();
+ owner->view()->update(BufferView::UPDATE);
+ owner->view()->text->CursorDown(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
case LFUN_UP_PARAGRAPH:
if(!owner->view()->text->mark_set)
owner->view()->beforeChange();
- owner->view()->update(-3);
- owner->view()->text->CursorUpParagraph();
+ owner->view()->update(BufferView::UPDATE);
+ owner->view()->text->CursorUpParagraph(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
case LFUN_DOWN_PARAGRAPH:
if(!owner->view()->text->mark_set)
owner->view()->beforeChange();
- owner->view()->update(-3);
- owner->view()->text->CursorDownParagraph();
+ owner->view()->update(BufferView::UPDATE);
+ owner->view()->text->CursorDownParagraph(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
case LFUN_PRIOR:
if(!owner->view()->text->mark_set)
owner->view()->beforeChange();
- owner->view()->update(-3);
+ owner->view()->update(BufferView::UPDATE);
owner->view()->cursorPrevious();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
case LFUN_NEXT:
if(!owner->view()->text->mark_set)
owner->view()->beforeChange();
- owner->view()->update(-3);
+ owner->view()->update(BufferView::UPDATE);
owner->view()->cursorNext();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
case LFUN_HOME:
if(!owner->view()->text->mark_set)
owner->view()->beforeChange();
- owner->view()->update(-2);
- owner->view()->text->CursorHome();
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->CursorHome(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
case LFUN_END:
if(!owner->view()->text->mark_set)
owner->view()->beforeChange();
- owner->view()->update(-2);
- owner->view()->text->CursorEnd();
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->CursorEnd(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
case LFUN_TAB:
if(!owner->view()->text->mark_set)
owner->view()->beforeChange();
- owner->view()->update(-2);
- owner->view()->text->CursorTab();
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->CursorTab(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
case LFUN_WORDRIGHT:
if(!owner->view()->text->mark_set)
owner->view()->beforeChange();
- owner->view()->update(-2);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
if (owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params))
- owner->view()->text->CursorLeftOneWord();
+ owner->view()->text->CursorLeftOneWord(owner->view());
else
- owner->view()->text->CursorRightOneWord();
+ owner->view()->text->CursorRightOneWord(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
case LFUN_WORDLEFT:
if(!owner->view()->text->mark_set)
owner->view()->beforeChange();
- owner->view()->update(-2);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
if (owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params))
- owner->view()->text->CursorRightOneWord();
+ owner->view()->text->CursorRightOneWord(owner->view());
else
- owner->view()->text->CursorLeftOneWord();
+ owner->view()->text->CursorLeftOneWord(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
case LFUN_BEGINNINGBUF:
if(!owner->view()->text->mark_set)
owner->view()->beforeChange();
- owner->view()->update(-2);
- owner->view()->text->CursorTop();
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->CursorTop(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
case LFUN_ENDBUF:
if(!owner->view()->text->mark_set)
owner->view()->beforeChange();
- owner->view()->update(-2);
- owner->view()->text->CursorBottom();
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->CursorBottom(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
/* cursor selection ---------------------------- */
case LFUN_RIGHTSEL:
- owner->view()->update(-2);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
if (owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params))
- owner->view()->text->CursorLeft();
+ owner->view()->text->CursorLeft(owner->view());
else
- owner->view()->text->CursorRight();
+ owner->view()->text->CursorRight(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_LEFTSEL:
- owner->view()->update(-2);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
if (owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params))
- owner->view()->text->CursorRight();
+ owner->view()->text->CursorRight(owner->view());
else
- owner->view()->text->CursorLeft();
+ owner->view()->text->CursorLeft(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_UPSEL:
- owner->view()->update(-2);
- owner->view()->text->CursorUp();
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->CursorUp(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_DOWNSEL:
- owner->view()->update(-2);
- owner->view()->text->CursorDown();
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->CursorDown(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_UP_PARAGRAPHSEL:
- owner->view()->update(-2);
- owner->view()->text->CursorUpParagraph();
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->CursorUpParagraph(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_DOWN_PARAGRAPHSEL:
- owner->view()->update(-2);
- owner->view()->text->CursorDownParagraph();
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->CursorDownParagraph(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_PRIORSEL:
- owner->view()->update(-2);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->cursorPrevious();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
break;
case LFUN_NEXTSEL:
- owner->view()->update(-2);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->cursorNext();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
break;
case LFUN_HOMESEL:
- owner->view()->update(-2);
- owner->view()->text->CursorHome();
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->CursorHome(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_ENDSEL:
- owner->view()->update(-2);
- owner->view()->text->CursorEnd();
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->CursorEnd(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_WORDRIGHTSEL:
- owner->view()->update(-2);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
if (owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params))
- owner->view()->text->CursorLeftOneWord();
+ owner->view()->text->CursorLeftOneWord(owner->view());
else
- owner->view()->text->CursorRightOneWord();
+ owner->view()->text->CursorRightOneWord(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_WORDLEFTSEL:
- owner->view()->update(-2);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
if (owner->view()->text->cursor.par()->isRightToLeftPar(owner->buffer()->params))
- owner->view()->text->CursorRightOneWord();
+ owner->view()->text->CursorRightOneWord(owner->view());
else
- owner->view()->text->CursorLeftOneWord();
+ owner->view()->text->CursorLeftOneWord(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_BEGINNINGBUFSEL:
- owner->view()->update(-2);
- owner->view()->text->CursorTop();
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->CursorTop(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_ENDBUFSEL:
- owner->view()->update(-2);
- owner->view()->text->CursorBottom();
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->CursorBottom(owner->view());
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
// --- text changing commands ------------------------
case LFUN_BREAKLINE:
owner->view()->beforeChange();
- owner->view()->text->InsertChar(LyXParagraph::META_NEWLINE);
- owner->view()->update(1);
-#if 1
- //owner->update_timeout.callback();
-#else
- SetUpdateTimer(0.01);
-#endif
+ owner->view()->text->InsertChar(owner->view(), LyXParagraph::META_NEWLINE);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
moveCursorUpdate(false);
break;
owner->view()->text->cursor.par()->GetLayout());
if (style.free_spacing) {
- owner->view()->text->InsertChar(' ');
- owner->view()->update(-1);
+ owner->view()->text->InsertChar(owner->view(), ' ');
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
} else {
owner->view()->protectedBlank();
}
case LFUN_SETMARK:
if(owner->view()->text->mark_set) {
owner->view()->beforeChange();
- owner->view()->update(0);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
setMessage(N_("Mark removed"));
} else {
owner->view()->beforeChange();
owner->view()->text->mark_set = 1;
- owner->view()->update(0);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
setMessage(N_("Mark set"));
}
owner->view()->text->sel_cursor =
break;
case LFUN_DELETE:
-#if 1
- //owner->update_timeout.stop();
-#else
- FreeUpdateTimer();
-#endif
if (!owner->view()->text->selection) {
- owner->view()->text->Delete();
+ owner->view()->text->Delete(owner->view());
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
- owner->view()->update(1);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
// It is possible to make it a lot faster still
// just comment out the lone below...
owner->view()->showCursor();
} else {
owner->view()->cut();
}
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
owner->view()->setState();
LyXCursor cursor = owner->view()->text->cursor;
-#if 1
- //owner->update_timeout.stop();
-#else
- FreeUpdateTimer();
-#endif
if (!owner->view()->text->selection) {
if (cursor.pos() == cursor.par()->Last()) {
- owner->view()->text->CursorRight();
+ owner->view()->text->CursorRight(owner->view());
cursor = owner->view()->text->cursor;
if (cursor.pos() == 0
&& !(cursor.par()->added_space_top
== VSpace (VSpace::NONE))) {
owner->view()->text->SetParagraph
- (cursor.par()->line_top,
+ (owner->view(),
+ cursor.par()->line_top,
cursor.par()->line_bottom,
cursor.par()->pagebreak_top,
cursor.par()->pagebreak_bottom,
cursor.par()->added_space_bottom,
cursor.par()->align,
cursor.par()->labelwidthstring, 0);
- owner->view()->text->CursorLeft();
- owner->view()->update (1);
+ owner->view()->text->CursorLeft(owner->view());
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
} else {
- owner->view()->text->CursorLeft();
- owner->view()->text->Delete();
+ owner->view()->text->CursorLeft(owner->view());
+ owner->view()->text->Delete(owner->view());
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
- owner->view()->update(1);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
} else {
- owner->view()->text->Delete();
+ owner->view()->text->Delete(owner->view());
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
- owner->view()->update(1);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
} else {
owner->view()->cut();
}
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
}
break;
/* -------> Delete word forward. */
case LFUN_DELETE_WORD_FORWARD:
- owner->view()->update(-2);
-#if 1
- //owner->update_timeout.stop();
-#else
- FreeUpdateTimer();
-#endif
- owner->view()->text->DeleteWordForward();
- owner->view()->update( 1 );
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->DeleteWordForward(owner->view());
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
/* -------> Delete word backward. */
case LFUN_DELETE_WORD_BACKWARD:
- owner->view()->update(-2);
-#if 1
- //owner->update_timeout.stop();
-#else
- FreeUpdateTimer();
-#endif
- owner->view()->text->DeleteWordBackward();
- owner->view()->update( 1 );
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->DeleteWordBackward(owner->view());
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
/* -------> Kill to end of line. */
case LFUN_DELETE_LINE_FORWARD:
-#if 1
- //owner->update_timeout.stop();
-#else
- FreeUpdateTimer();
-#endif
- owner->view()->update(-2);
- owner->view()->text->DeleteLineForward();
- owner->view()->update( 1 );
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
+ owner->view()->text->DeleteLineForward(owner->view());
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
moveCursorUpdate(false);
break;
/* -------> Set mark off. */
case LFUN_MARK_OFF:
owner->view()->beforeChange();
- owner->view()->update(0);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
setMessage(N_("Mark off"));
case LFUN_MARK_ON:
owner->view()->beforeChange();
owner->view()->text->mark_set = 1;
- owner->view()->update( 0 );
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
setMessage(N_("Mark on"));
case LFUN_BACKSPACE:
{
-#if 1
- //owner->update_timeout.stop();
-#else
- FreeUpdateTimer();
-#endif
if (!owner->view()->text->selection) {
if (owner->getIntl()->getTrans()->backspace()) {
- owner->view()->text->Backspace();
+ owner->view()->text->Backspace(owner->view());
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
- owner->view()->update(1);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
// It is possible to make it a lot faster still
// just comment out the lone below...
owner->view()->showCursor();
} else {
owner->view()->cut();
}
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
owner->view()->setState();
}
LyXCursor cursor = owner->view()->text->cursor;
-#if 1
- //owner->update_timeout.stop();
-#else
- FreeUpdateTimer();
-#endif
if (!owner->view()->text->selection) {
if (cursor.pos() == 0
&& !(cursor.par()->added_space_top
== VSpace (VSpace::NONE))) {
owner->view()->text->SetParagraph
- (cursor.par()->line_top,
+ (owner->view(),
+ cursor.par()->line_top,
cursor.par()->line_bottom,
cursor.par()->pagebreak_top,
cursor.par()->pagebreak_bottom,
VSpace(VSpace::NONE), cursor.par()->added_space_bottom,
cursor.par()->align,
cursor.par()->labelwidthstring, 0);
- owner->view()->update (1);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
} else {
- owner->view()->text->Backspace();
+ owner->view()->text->Backspace(owner->view());
owner->view()->text->sel_cursor
= cursor;
- owner->view()->update(1);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
} else
owner->view()->cut();
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
}
break;
case LFUN_BREAKPARAGRAPH:
{
owner->view()->beforeChange();
- owner->view()->text->BreakParagraph(0);
- owner->view()->update(1);
-#if 1
- //owner->update_timeout.callback();
-#else
- SetUpdateTimer(0.01);
-#endif
+ owner->view()->text->BreakParagraph(owner->view(), 0);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
owner->view()->setState();
case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
{
owner->view()->beforeChange();
- owner->view()->text->BreakParagraph(1);
- owner->view()->update(1);
-#if 1
- //owner->update_timeout.callback();
-#else
- SetUpdateTimer(0.01);
-#endif
+ owner->view()->text->BreakParagraph(owner->view(), 1);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
owner->view()->setState();
if (cursor.pos() == 0) {
if (cursor.par()->added_space_top == VSpace(VSpace::NONE)) {
owner->view()->text->SetParagraph
- (cursor.par()->line_top,
+ (owner->view(),
+ cursor.par()->line_top,
cursor.par()->line_bottom,
cursor.par()->pagebreak_top,
cursor.par()->pagebreak_bottom,
VSpace(VSpace::DEFSKIP), cursor.par()->added_space_bottom,
cursor.par()->align,
cursor.par()->labelwidthstring, 1);
- //owner->view()->update(1);
+ //owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
else {
- owner->view()->text->BreakParagraph(0);
- //owner->view()->update(1);
+ owner->view()->text->BreakParagraph(owner->view(), 0);
+ //owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
-#if 1
- owner->view()->update(1);
- //owner->update_timeout.callback();
-#else
- SetUpdateTimer(0.01);
-#endif
+
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
owner->view()->text->sel_cursor = cursor;
owner->view()->setState();
owner->getMiniBuffer()->Set(CurrentState(owner->view()));
}
if (cur_spacing != new_spacing || cur_value != new_value) {
par->spacing.set(new_spacing, new_value);
- owner->view()->text->RedoParagraph();
- owner->view()->update(-1);
+ owner->view()->text->RedoParagraph(owner->view());
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
break;
case LFUN_QUOTE:
owner->view()->beforeChange();
- owner->view()->text->InsertChar('\"'); // This " matches the single quote in the code
- owner->view()->update(1);
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
+ owner->view()->text->InsertChar(owner->view(), '\"'); // This " matches the single quote in the code
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
moveCursorUpdate(false);
break;
case LFUN_INSET_TEXT:
{
- InsetText * new_inset = new InsetText(owner->buffer());
+ InsetText * new_inset = new InsetText();
if (owner->view()->insertInset(new_inset))
new_inset->Edit(owner->view(), 0, 0, 0);
else
break;
case LFUN_INSET_ERT:
{
- InsetERT * new_inset = new InsetERT(owner->buffer());
+ InsetERT * new_inset = new InsetERT();
+ if (owner->view()->insertInset(new_inset))
+ new_inset->Edit(owner->view(), 0, 0, 0);
+ else
+ delete new_inset;
+ }
+ break;
+
+ case LFUN_INSET_EXTERNAL:
+ {
+ InsetExternal * new_inset = new InsetExternal();
if (owner->view()->insertInset(new_inset))
new_inset->Edit(owner->view(), 0, 0, 0);
else
case LFUN_INSET_FOOTNOTE:
{
- InsetFoot * new_inset = new InsetFoot(owner->buffer());
+ InsetFoot * new_inset = new InsetFoot();
if (owner->view()->insertInset(new_inset))
new_inset->Edit(owner->view(), 0, 0, 0);
else
int x;
long y;
sscanf(argument.c_str(), " %d %ld", &x, &y);
- owner->view()->text->SetCursorFromCoordinates(x, y);
+ owner->view()->text->SetCursorFromCoordinates(owner->view(), x, y);
}
break;
keyseq.length = 0;
// copied verbatim from do_accent_char
- owner->view()->update(1);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
}
setErrorMessage(N_("Unknown kind of footnote"));
break;
}
- owner->view()->text->InsertFootnoteEnvironment(kind);
- owner->view()->update(1);
+ owner->view()->text->InsertFootnoteEnvironment(owner->view(), kind);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
owner->view()->setState();
}
break;
case LFUN_SELFINSERT:
{
for (string::size_type i = 0; i < argument.length(); ++i) {
- owner->view()->text->InsertChar(argument[i]);
+ owner->view()->text->InsertChar(owner->view(), argument[i]);
// This needs to be in the loop, or else we
// won't break lines correctly. (Asger)
- owner->view()->update(1);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
moveCursorUpdate(false);
char datetmp[32];
int datetmp_len = strftime(datetmp, 32, arg.c_str(), now_tm);
for (int i = 0; i < datetmp_len; i++) {
- owner->view()->text->InsertChar(datetmp[i]);
- owner->view()->update(1);
+ owner->view()->text->InsertChar(owner->view(), datetmp[i]);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
+
owner->view()->text->sel_cursor = owner->view()->text->cursor;
moveCursorUpdate(false);
}
lyxrc.write("preferences");
}
break;
-
+
case LFUN_UNKNOWN_ACTION:
{
if(!owner->buffer()) {
if ( lyxrc.auto_region_delete ) {
if (owner->view()->text->selection){
- owner->view()->text->CutSelection(false);
- owner->view()->update(-1);
+ owner->view()->text->CutSelection(owner->view(), false);
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
owner->getIntl()->getTrans()->TranslateAndInsert(argument[i], owner->view()->text);
}
- owner->view()->update(1);
-#if 1
- //owner->update_timeout.start();
-#else
- SetUpdateTimer();
-#endif
+ owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
// need this otherwise SEGV may occur while trying to
// set variables that don't exist
// since there's no current buffer
- CloseAllBufferRelatedPopups();
+ owner->getDialogs()->hideBufferDependent();
}
else {
owner->view()->buffer(bufferlist.first());
{
dispatch_buffer = m;
}
+
+
+
+
explicit
LyXFunc(LyXView *);
- /// LyX distpatcher, executes lyx actions.
+ /// LyX dispatcher, executes lyx actions.
string Dispatch(int action, char const * arg = 0);
/// The same but uses the name of a lyx command.
/// Should a hint message be displayed?
void setHintMessage(bool);
+
private:
///
LyXView * owner;
&& prefixIs(tmpstr, prefix.c_str())) {
tmpstr.erase(0, prefix.length() - 1);
}
- str += tmpstr + '\n';
+ str += frontStrip(tmpstr, "\t") + '\n';
}
else // token == endtoken
break;
///
string const GetString() const;
- /// get a long string, ended by the tag `endtag'
+ /**
+ * Get a long string, ended by the tag `endtag'
+ * This string can span several lines. The first line
+ * serves as a template for how many spaces the lines
+ * are indented. This much white space is skipped from
+ * each following line. This mechanism does not work
+ * perfectly if you use tabs.
+ */
string getLongString(string const & endtag);
///
bool isMultiLingual(BufferParams const &);
///
- string String(BufferParams const &, bool label);
+ string String(Buffer const *, bool label);
///
- string String(size_type beg, size_type end);
+ string String(Buffer const *, size_type beg, size_type end);
///
- void writeFile(std::ostream &, BufferParams const &, char, char) const;
+ void writeFile(Buffer const *, std::ostream &, BufferParams const &,
+ char, char) const;
///
void validate(LaTeXFeatures &) const;
void read();
///
- LyXParagraph * TeXOnePar(BufferParams const &,
+ LyXParagraph * TeXOnePar(Buffer const *, BufferParams const &,
std::ostream &, TexRow & texrow,
bool moving_arg,
std::ostream & foot, TexRow & foot_texrow,
int & foot_count);
///
- bool SimpleTeXOnePar(BufferParams const &,
+ bool SimpleTeXOnePar(Buffer const *, BufferParams const &,
std::ostream &, TexRow & texrow, bool moving_arg);
///
- LyXParagraph * TeXEnvironment(BufferParams const &,
+ LyXParagraph * TeXEnvironment(Buffer const *, BufferParams const &,
std::ostream &, TexRow & texrow,
std::ostream & foot, TexRow & foot_texrow,
int & foot_count);
///
bool linuxDocConvertChar(char c, string & sgml_string);
///
- void DocBookContTableRows(BufferParams const &,
+ void DocBookContTableRows(Buffer const *,
std::ostream &, string & extra,
int & desc_on, size_type i,
int current_cell_number, int & column);
///
- void SimpleDocBookOneTablePar(BufferParams const &,
+ void SimpleDocBookOneTablePar(Buffer const *,
std::ostream &, string & extra,
int & desc_on, int depth);
private:
///
InsetList insetlist;
///
- LyXParagraph * TeXDeeper(BufferParams const &,
+ LyXParagraph * TeXDeeper(Buffer const *, BufferParams const &,
std::ostream &, TexRow & texrow,
std::ostream & foot, TexRow & foot_texrow,
int & foot_count);
///
- LyXParagraph * TeXFootnote(BufferParams const &,
+ LyXParagraph * TeXFootnote(Buffer const *, BufferParams const &,
std::ostream &, TexRow & texrow,
std::ostream & foot, TexRow & foot_texrow,
int & foot_count,
bool parent_is_rtl);
///
- bool SimpleTeXOneTablePar(BufferParams const &,
+ bool SimpleTeXOneTablePar(Buffer const *, BufferParams const &,
std::ostream &, TexRow & texrow);
///
- bool TeXContTableRows(BufferParams const &,
+ bool TeXContTableRows(Buffer const *, BufferParams const &,
std::ostream &, size_type i,
int current_cell_number,
int & column, TexRow & texrow);
int & column, LyXFont const & font,
LyXLayout const & style);
///
- void SimpleTeXSpecialChars(BufferParams const &,
+ void SimpleTeXSpecialChars(Buffer const *, BufferParams const &,
std::ostream &, TexRow & texrow,
bool moving_arg,
LyXFont & font, LyXFont & running_font,
break;
case RC_BINDFILE: // RVDK_PATCH_5
if (lexrc.next()) {
- ReadBindFile(lexrc.GetString());
+ string tmp(lexrc.GetString());
+ if (bind_file.empty()) {
+ // we only need the name of the first
+ // bind file since that (usually)
+ // includes several others.
+ bind_file = tmp;
+ }
+ ReadBindFile(tmp);
}
break;
// we should not do an explicit binding before
// loading a bind file. So, in this case, load
// the default bind file.
- if (!hasBindFile)
+ if (!hasBindFile) {
ReadBindFile();
-
+ bind_file = bindFile;
+ }
// !!!chb, dynamic key binding...
int action, res = 0;
string seq, cmd;
case RC_RTL_SUPPORT:
os << "\\rtl " << tostr(rtl_support) << "\n";
case RC_AUTO_NUMBER:
- os << "\\auto_number" << tostr(auto_number) << "\n";
+ os << "\\auto_number " << tostr(auto_number) << "\n";
case RC_MARK_FOREIGN_LANGUAGE:
os << "\\mark_foreign_language " <<
tostr(mark_foreign_language) << "\n";
case RC_MAKE_BACKUP:
os << "\\make_backup " << tostr(make_backup) << "\n";
case RC_BACKUPDIR_PATH:
- os << "\\backupdir_path" << backupdir_path << "\n";
+ os << "\\backupdir_path \"" << backupdir_path << "\"\n";
case RC_DATE_INSERT_FORMAT:
os << "\\date_insert_format \"" << date_insert_format
<< "\"\n";
///
ToolbarDefaults toolbardefaults;
///
+ string bind_file;
+ ///
string printer;
///
string print_command;
typedef unsigned short Dimension;
class WorkArea;
+class Buffer;
/** The class LyXScreen is used for the main Textbody.
Concretely, the screen is held in a pixmap. This pixmap is kept up to
#include "lyxcursor.h"
#include "lyxparagraph.h"
#include "layout.h"
+#include "insets/insettext.h"
class Buffer;
class BufferParams;
};
/// Constructor
- LyXText(BufferView *, int paperwidth, Buffer *);
+ LyXText(BufferView *);
+ LyXText(InsetText *);
/// Destructor
~LyXText();
+ void init(BufferView *);
///
mutable int number_of_rows;
///
mutable long height;
+ mutable long width;
/// the current font settings
mutable LyXFont current_font;
/// the current font
mutable LyXFont real_current_font;
///
- void owner(BufferView *);
+ // void owner(BufferView *);
///
- LyXFont GetFont(LyXParagraph * par,
+ LyXFont GetFont(Buffer const *, LyXParagraph * par,
LyXParagraph::size_type pos) const;
///
- void SetCharFont(LyXParagraph * par,
+ void SetCharFont(Buffer const *, LyXParagraph * par,
LyXParagraph::size_type pos,
LyXFont const & font);
/// returns a pointer to the very first LyXParagraph
LyXParagraph * FirstParagraph() const;
/// what you expect when pressing <enter> at cursor position
- void BreakParagraph(char keep_layout = 0);
+ void BreakParagraph(BufferView *, char keep_layout = 0);
/** set layout over selection and make a total rebreak of
those paragraphs
*/
- LyXParagraph * SetLayout(LyXCursor & actual_cursor,
+ LyXParagraph * SetLayout(BufferView *, LyXCursor & actual_cursor,
LyXCursor & selection_start,
LyXCursor & selection_end,
LyXTextClass::size_type layout);
- void SetLayout(LyXTextClass::size_type layout);
+ void SetLayout(BufferView *, LyXTextClass::size_type layout);
/// used in setlayout
- void MakeFontEntriesLayoutSpecific(LyXParagraph * par);
+ void MakeFontEntriesLayoutSpecific(Buffer const *, LyXParagraph * par);
/** increment depth over selection and make a total rebreak of those
paragraphs
*/
- void IncDepth();
+ void IncDepth(BufferView *);
/** decrement depth over selection and make a total rebreak of those
paragraphs */
- void DecDepth();
+ void DecDepth(BufferView *);
/** Get the depth at current cursor position
*/
paragraphs.
toggleall defaults to false.
*/
- void SetFont(LyXFont const & font, bool toggleall = false);
+ void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
/** deletes and inserts again all paragaphs between the cursor
and the specified par. The Cursor is needed to set the refreshing
parameters.
This function is needed after SetLayout and SetFont etc.
*/
- void RedoParagraphs(LyXCursor const & cursor,
+ void RedoParagraphs(BufferView *, LyXCursor const & cursor,
LyXParagraph const * end_par) const;
///
- void RedoParagraph() const;
+ void RedoParagraph(BufferView *) const;
///
- void ToggleFree(LyXFont const & font, bool toggleall = false);
+ void ToggleFree(BufferView *, LyXFont const &, bool toggleall = false);
/** recalculates the heights of all previous rows of the
specified paragraph. needed, if the last characters font
has changed.
*/
- void RedoHeightOfParagraph(LyXCursor const & cursor);
+ void RedoHeightOfParagraph(BufferView *, LyXCursor const & cursor);
/** forces the redrawing of a paragraph. Needed when manipulating a
right address box
*/
- void RedoDrawingOfParagraph(LyXCursor const & cursor);
+ void RedoDrawingOfParagraph(BufferView *, LyXCursor const & cursor);
/** insert a character, moves all the following breaks in the
same Paragraph one to the right and make a little rebreak
*/
- void InsertChar(char c);
+ void InsertChar(BufferView *, char c);
///
- void InsertInset(Inset * inset);
+ void InsertInset(BufferView *, Inset * inset);
/** Completes the insertion with a full rebreak.
Returns true if something was broken. */
- bool FullRebreak();
+ bool FullRebreak(BufferView *);
///
LyXParagraph::footnote_flag GetFootnoteFlag(int row);
/** returns the column near the specified x-coordinate of the row
x is set to the real beginning of this column
*/
- int GetColumnNearX(Row * row, int & x, bool & boundary) const;
+ int GetColumnNearX(BufferView *, Row * row, int & x, bool & boundary) const;
/** returns a pointer to a specified row. y is set to the beginning
of the row
LyXCursor toggle_end_cursor;
/// need the selection cursor:
- void SetSelection();
+ void SetSelection(BufferView *);
///
void ClearSelection() const;
///
- string selectionAsString() const;
+ string selectionAsString(Buffer const *) const;
/// just selects the word the cursor is in
- void SelectWord();
+ void SelectWord(BufferView *);
/** 'selects" the next word, where the cursor is not in
and returns this word as string. THe cursor will be moved
to the beginning of this word.
With SelectSelectedWord can this be highlighted really
*/
- char * SelectNextWord(float & value);
+ char * SelectNextWord(BufferView *, float & value);
///
- void SelectSelectedWord();
+ void SelectSelectedWord(BufferView *);
///
- void SetCursor(LyXParagraph * par,
+ void SetCursor(BufferView *, LyXParagraph * par,
LyXParagraph::size_type pos,
bool setfont = true,
bool boundary = false) const;
- void SetCursor(LyXCursor &, LyXParagraph * par,
+ void SetCursor(BufferView *, LyXCursor &, LyXParagraph * par,
LyXParagraph::size_type pos,
bool boundary = false) const;
///
- void SetCursorIntern(LyXParagraph * par,
+ void SetCursorIntern(BufferView *, LyXParagraph * par,
LyXParagraph::size_type pos,
bool setfont = true,
bool boundary = false) const;
///
- void SetCurrentFont() const;
+ void SetCurrentFont(BufferView *) const;
///
- bool IsBoundary(LyXParagraph * par,
+ bool IsBoundary(Buffer const *, LyXParagraph * par,
LyXParagraph::size_type pos) const;
///
- bool IsBoundary(LyXParagraph * par,
+ bool IsBoundary(Buffer const *, LyXParagraph * par,
LyXParagraph::size_type pos,
LyXFont const & font) const;
///
- void SetCursorFromCoordinates(int x, long y) const;
- void SetCursorFromCoordinates(LyXCursor &, int x, long y) const;
+ void SetCursorFromCoordinates(BufferView *, int x, long y) const;
+ void SetCursorFromCoordinates(BufferView *, LyXCursor &, int x, long y) const;
///
- void CursorUp() const;
+ void CursorUp(BufferView *) const;
///
- void CursorDown() const;
+ void CursorDown(BufferView *) const;
///
- void CursorLeft(bool internal = true) const;
+ void CursorLeft(BufferView *, bool internal = true) const;
///
- void CursorRight(bool internal = true) const;
+ void CursorRight(BufferView *, bool internal = true) const;
///
- void CursorLeftIntern(bool internal = true) const;
+ void CursorLeftIntern(BufferView *, bool internal = true) const;
///
- void CursorRightIntern(bool internal = true) const;
+ void CursorRightIntern(BufferView *, bool internal = true) const;
///
- void CursorLeftOneWord() const;
+ void CursorLeftOneWord(BufferView *) const;
///
- void CursorRightOneWord() const;
+ void CursorRightOneWord(BufferView *) const;
///
- void CursorUpParagraph() const;
+ void CursorUpParagraph(BufferView *) const;
///
- void CursorDownParagraph() const;
+ void CursorDownParagraph(BufferView *) const;
///
- void CursorHome() const;
+ void CursorHome(BufferView *) const;
///
- void CursorEnd() const;
+ void CursorEnd(BufferView *) const;
///
- void CursorTab() const;
+ void CursorTab(BufferView *) const;
///
- void CursorTop() const;
+ void CursorTop(BufferView *) const;
///
- void CursorBottom() const;
+ void CursorBottom(BufferView *) const;
///
- void Delete();
+ void Delete(BufferView *);
///
- void Backspace();
+ void Backspace(BufferView *);
///
- void DeleteWordForward();
+ void DeleteWordForward(BufferView *);
///
- void DeleteWordBackward();
+ void DeleteWordBackward(BufferView *);
///
- void DeleteLineForward();
+ void DeleteLineForward(BufferView *);
///
- bool SelectWordWhenUnderCursor();
+ bool SelectWordWhenUnderCursor(BufferView *);
enum TextCase {
text_lowercase = 0,
text_uppercase = 2
};
/// Change the case of the word at cursor position.
- void ChangeWordCase(TextCase action);
+ void ChangeWordCase(BufferView *, TextCase action);
/** returns a printed row in a pixmap. The y value is needed to
decide, wether it is selected text or not. This is a strange
solution but faster.
*/
- void GetVisibleRow(int offset, Row * row_ptr, long y);
+ void GetVisibleRow(BufferView *, int y_offset, int x_offset,
+ Row * row_ptr, long y);
/* footnotes: */
///
- void ToggleFootnote();
+ void ToggleFootnote(BufferView *);
///
- void OpenStuff();
+ void OpenStuff(BufferView *);
///
void OpenFootnotes();
///
- void OpenFootnote();
+ void OpenFootnote(BufferView *);
///
void CloseFootnotes();
///
- void CloseFootnote();
+ void CloseFootnote(BufferView *);
/** turn the selection into a new environment. If there is no
selection, create an empty environment
*/
- void InsertFootnoteEnvironment(LyXParagraph::footnote_kind kind);
+ void InsertFootnoteEnvironment(BufferView *,
+ LyXParagraph::footnote_kind kind);
///
- void MeltFootnoteEnvironment();
+ void MeltFootnoteEnvironment(BufferView *);
///
- void CutSelection(bool = true);
+ void CutSelection(BufferView *, bool = true);
///
- void CopySelection();
+ void CopySelection(Buffer const *);
///
- void PasteSelection();
+ void PasteSelection(BufferView *);
///
void copyEnvironmentType();
///
- void pasteEnvironmentType();
+ void pasteEnvironmentType(BufferView *);
///
void InsertFootnote();
///
settings are given to the new one. So I can make shure, they do not
duplicate themself (and you cannnot make dirty things with them! )
*/
- void SetParagraph(bool line_top, bool line_bottom,
+ void SetParagraph(BufferView *,
+ bool line_top, bool line_bottom,
bool pagebreak_top, bool pagebreak_bottom,
VSpace const & space_top,
VSpace const & space_bottom,
LyXAlignment align,
string labelwidthstring,
bool noindent);
- void SetParagraphExtraOpt(int type,
+ void SetParagraphExtraOpt(BufferView *, int type,
char const * width,
char const * widthp,
int alignment, bool hfill,
/** sets the selection over the number of characters of string,
no check!!
*/
- void SetSelectionOverString(char const * str);
+ void SetSelectionOverString(BufferView *, char const * str);
/** simple replacing. The font of the first selected character
is used
*/
- void ReplaceSelectionWithString(char const * str);
+ void ReplaceSelectionWithString(BufferView *, char const * str);
/** if the string can be found: return true and set the cursor to
the new position */
- bool SearchForward(char const * str) const;
- bool SearchBackward(char const * str) const;
+ bool SearchForward(BufferView *, char const * str) const;
+ bool SearchBackward(BufferView *, char const * str) const;
/// needed to insert the selection
- void InsertStringA(string const & str);
+ void InsertStringA(BufferView *, string const & str);
/// needed to insert the selection
- void InsertStringB(string const & str);
+ void InsertStringB(BufferView *, string const & str);
/// usefull when texing from within LyX
- bool GotoNextError() const;
+ bool GotoNextError(BufferView *) const;
/// just another feature :)
- bool GotoNextNote() const;
+ bool GotoNextNote(BufferView *) const;
/* for the greater insets */
/// returns 0 if inset wasn't found
- int UpdateInset(Inset * inset);
+ int UpdateInset(BufferView *, Inset * inset);
///
- void CheckParagraph(LyXParagraph * par,
+ void CheckParagraph(BufferView *, LyXParagraph * par,
LyXParagraph::size_type pos);
///
int NumberOfCell(LyXParagraph * par,
/** all table features of the text-class are put together in
this function. Possible values of feature are defined in table.h
*/
- void TableFeatures(int feature, string const & val) const;
+ void TableFeatures(BufferView *, int feature, string const & val) const;
///
- void TableFeatures(int feature) const;
+ void TableFeatures(BufferView *, int feature) const;
/** pos points at the beginning of the next cell (if there is one)
*/
- int WidthOfCell(LyXParagraph * par,
+ int WidthOfCell(BufferView *, LyXParagraph * par,
LyXParagraph::size_type & pos) const;
///
- void CheckParagraphInTable(LyXParagraph * par,
+ void CheckParagraphInTable(BufferView *, LyXParagraph * par,
LyXParagraph::size_type pos);
///
- void InsertCharInTable(char c);
+ void InsertCharInTable(BufferView *, char c);
///
- void BackspaceInTable();
+ void BackspaceInTable(BufferView *);
///
- bool HitInTable(Row * row, int x) const;
+ bool HitInTable(BufferView *, Row * row, int x) const;
///
- bool MouseHitInTable(int x, long y) const;
+ bool MouseHitInTable(BufferView *, int x, long y) const;
/* table stuff -- end*/
///
LyXParagraph * GetParFromID(int id);
// undo functions
/// returns false if no undo possible
- bool TextUndo();
+ bool TextUndo(BufferView *);
/// returns false if no redo possible
- bool TextRedo();
+ bool TextRedo(BufferView *);
/// used by TextUndo/TextRedo
- bool TextHandleUndo(Undo * undo);
+ bool TextHandleUndo(BufferView *, Undo * undo);
/// makes sure the next operation will be stored
void FinishUndo();
/// this is dangerous and for internal use only
/// a flag
bool undo_frozen;
///
- void SetUndo(Undo::undo_kind kind,
+ void SetUndo(Buffer *, Undo::undo_kind kind,
LyXParagraph const * before,
LyXParagraph const * end) const;
///
- void SetRedo(Undo::undo_kind kind,
+ void SetRedo(Buffer *, Undo::undo_kind kind,
LyXParagraph const * before,
LyXParagraph const * end);
///
- Undo * CreateUndo(Undo::undo_kind kind,
+ Undo * CreateUndo(Buffer *, Undo::undo_kind kind,
LyXParagraph const * before,
LyXParagraph const * end) const;
/// for external use in lyx_cb.C
- void SetCursorParUndo();
+ void SetCursorParUndo(Buffer *);
///
void RemoveTableRow(LyXCursor & cursor) const;
///
bool IsEmptyTableCell() const;
///
- void toggleAppendix();
+ void toggleAppendix(BufferView *);
///
- unsigned short paperWidth() const { return paperwidth; }
+ int workWidth(BufferView *) const;
///
- Buffer const * buffer() const {
- return buffer_;
- }
+ // Buffer * buffer() const;
///
- void ComputeBidiTables(Row * row) const;
+ void ComputeBidiTables(Buffer const *, Row * row) const;
/// Maps positions in the visual string to positions in logical string.
inline
}
private:
///
- BufferView * owner_;
- /// points to Buffer
- Buffer * buffer_;
-
- /// width of the paper
- unsigned short paperwidth;
-
+ void init();
+ ///
+ BufferView * bv_owner;
+ ///
+ InsetText * inset_owner;
///
mutable Row * firstrow;
///
void RemoveParagraph(Row * row) const;
/** insert the specified paragraph behind the specified row */
- void InsertParagraph(LyXParagraph * par, Row * row) const;
+ void InsertParagraph(BufferView *, LyXParagraph * par, Row * row) const;
/** appends the implizit specified paragraph behind the specified row,
* start at the implizit given position */
- void AppendParagraph(Row * row) const;
+ void AppendParagraph(BufferView *, Row * row) const;
///
- void BreakAgain(Row * row) const;
+ void BreakAgain(BufferView *, Row * row) const;
///
- void BreakAgainOneRow(Row * row);
+ void BreakAgainOneRow(BufferView *, Row * row);
/// Calculate and set the height of the row
- void SetHeightOfRow(Row * row_ptr) const;
+ void SetHeightOfRow(BufferView *, Row * row_ptr) const;
/** this calculates the specified parameters. needed when setting
* the cursor and when creating a visible row */
- void PrepareToPrint(Row * row, float & x,
+ void PrepareToPrint(BufferView *, Row * row, float & x,
float & fill_separator,
float & fill_hfill,
float & fill_label_hfill,
bool bidi = true) const;
///
- void DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const;
+ void DeleteEmptyParagraphMechanism(BufferView *,
+ LyXCursor const & old_cursor) const;
/** Updates all counters starting BEHIND the row. Changed paragraphs
* with a dynamic left margin will be rebroken. */
- void UpdateCounters(Row * row) const;
+ void UpdateCounters(BufferView *, Row * row) const;
///
- void SetCounter(LyXParagraph * par) const;
+ void SetCounter(Buffer const *, LyXParagraph * par) const;
/*
* some low level functions
*/
///
- int SingleWidth(LyXParagraph * par,
+ int SingleWidth(BufferView *, LyXParagraph * par,
LyXParagraph::size_type pos) const;
///
- int SingleWidth(LyXParagraph * par,
+ int SingleWidth(BufferView *, LyXParagraph * par,
LyXParagraph::size_type pos, char c) const;
///
- void draw(Row const * row,
+ void draw(BufferView *, Row const * row,
LyXParagraph::size_type & pos,
int offset, float & x);
/// get the next breakpoint in a given paragraph
- LyXParagraph::size_type NextBreakPoint(Row const * row,
+ LyXParagraph::size_type NextBreakPoint(BufferView *, Row const * row,
int width) const;
/// returns the minimum space a row needs on the screen in pixel
- int Fill(Row * row, int paperwidth) const;
+ int Fill(BufferView *, Row * row, int workwidth) const;
/** returns the minimum space a manual label needs on the
screen in pixel */
- int LabelFill(Row const * row) const;
+ int LabelFill(BufferView *, Row const * row) const;
///
LyXParagraph::size_type
- BeginningOfMainBody(LyXParagraph const * par) const;
+ BeginningOfMainBody(Buffer const *, LyXParagraph const * par) const;
/** Returns the left beginning of the text.
This information cannot be taken from the layouts-objekt, because
in LaTeX the beginning of the text fits in some cases
(for example sections) exactly the label-width.
*/
- int LeftMargin(Row const * row) const;
+ int LeftMargin(BufferView *, Row const * row) const;
///
- int RightMargin(Row const * row) const;
+ int RightMargin(Buffer const *, Row const * row) const;
///
- int LabelEnd (Row const * row) const;
+ int LabelEnd (BufferView *, Row const * row) const;
/** returns the number of separators in the specified row.
The separator on the very last column doesnt count
*/
- int NumberOfSeparators(Row const * row) const;
+ int NumberOfSeparators(Buffer const *, Row const * row) const;
/** returns the number of hfills in the specified row. The
LyX-Hfill is a LaTeX \hfill so that the hfills at the
beginning and at the end were ignored. This is {\em MUCH}
more usefull than not to ignore!
*/
- int NumberOfHfills(Row const * row) const;
+ int NumberOfHfills(Buffer const *, Row const * row) const;
/// like NumberOfHfills, but only those in the manual label!
- int NumberOfLabelHfills(Row const * row) const;
+ int NumberOfLabelHfills(Buffer const *, Row const * row) const;
/** returns true, if a expansion is needed. Rules are given by
LaTeX
*/
- bool HfillExpansion(Row const * row_ptr,
+ bool HfillExpansion(Buffer const *, Row const * row_ptr,
LyXParagraph::size_type pos) const;
///
void charInserted();
+ ///
+ /// special owner functions
+ ///
+ LyXParagraph * OwnerParagraph() const;
+ ///
+ LyXParagraph * OwnerParagraph(LyXParagraph *) const;
+ ///
};
#endif
#include <config.h>
#include <iostream>
+#ifdef KDEGUI
+# include <kapp.h>
+#endif
#include FORMS_H_LOCATION
#include "lyx_main.h"
"in continuing executing LyX!" << endl;
return 1;
}
-
+
+#ifdef KDEGUI
+ KApplication a( argc, argv );
+#endif
+
// lyx_localedir is used by gettext_init() is we have
// i18n support built-in
string lyx_localedir = GetEnvPath("LYX_LOCALEDIR");
AUTOMAKE_OPTIONS = foreign 1.4
-MAINTAINERCLEANFILES = Makefile.in
+DISTCLEANFILES= *.orig *.rej *~ *.bak core
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
noinst_LTLIBRARIES = libmathed.la
LIBS=
-ETAGS_ARGS = --c++
+ETAGS_ARGS = --lang=c++
INCLUDES = -I${top_srcdir}/images -I${srcdir}/../
libmathed_la_SOURCES = array.h \
}
-void InsetFormula::Write(ostream & os) const
+void InsetFormula::Write(Buffer const * buf, ostream & os) const
{
os << "Formula ";
- Latex(os, false, false);
+ Latex(buf, os, false, false);
}
-int InsetFormula::Latex(ostream & os, bool fragile, bool) const
+int InsetFormula::Latex(Buffer const *, ostream & os, bool fragile, bool) const
{
int ret = 0;
//#warning Alejandro, the number of lines is not returned in this case
}
-int InsetFormula::Ascii(ostream & os) const
+int InsetFormula::Ascii(Buffer const *, ostream & os) const
{
par->Write(os, false);
return 0;
}
-int InsetFormula::Linuxdoc(ostream &) const
+int InsetFormula::Linuxdoc(Buffer const * buf, ostream & os) const
{
- return 0;
+ return Ascii(buf, os);
}
-int InsetFormula::DocBook(ostream&) const
+int InsetFormula::DocBook(Buffer const * buf, ostream & os) const
{
- return 0;
+ return Ascii(buf, os);
}
}
-void InsetFormula::Read(LyXLex & lex)
+void InsetFormula::Read(Buffer const *, LyXLex & lex)
{
istream & is = lex.getStream();
///
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
///
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
///
- void Read(LyXLex & lex);
+ void Read(Buffer const *, LyXLex & lex);
///
- int Latex(std::ostream &, bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
///
- int Ascii(std::ostream &) const;
+ int Ascii(Buffer const *, std::ostream &) const;
///
- int Linuxdoc(std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream &) const;
///
- int DocBook(std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const;
///
void Validate(LaTeXFeatures &) const;
///
}
-void InsetFormulaMacro::Write(ostream & os) const
+void InsetFormulaMacro::Write(Buffer const *, ostream & os) const
{
os << "FormulaMacro ";
tmacro->WriteDef(os, false);
}
-int InsetFormulaMacro::Latex(ostream & os, bool /*fragile*/,
+int InsetFormulaMacro::Latex(Buffer const *, ostream & os, bool /*fragile*/,
bool /*free_spacing*/) const
{
tmacro->WriteDef(os, true); // or false?
}
-int InsetFormulaMacro::Linuxdoc(ostream &) const
+int InsetFormulaMacro::Linuxdoc(Buffer const * buf, ostream & os) const
{
- return 0;
+ return Ascii(buf, os);
}
-int InsetFormulaMacro::DocBook(ostream &) const
+int InsetFormulaMacro::DocBook(Buffer const * buf, ostream & os) const
{
- return 0;
+ return Ascii(buf, os);
}
-void InsetFormulaMacro::Read(LyXLex & lex)
+void InsetFormulaMacro::Read(Buffer const *, LyXLex & lex)
{
istream & is = lex.getStream();
mathed_parser_file(is, lex.GetLineNo());
///
void draw(Painter &, LyXFont const &, int baseline, float & x) const;
///
- void Read(LyXLex & lex);
+ void Read(Buffer const *, LyXLex & lex);
///
- void Write(std::ostream & os) const;
+ void Write(Buffer const *, std::ostream & os) const;
///
- int Latex(std::ostream & os, bool fragile, bool free_spc) const;
+ int Latex(Buffer const *, std::ostream & os, bool fragile,
+ bool free_spc) const;
///
- int Linuxdoc(std::ostream &) const;
+ int Linuxdoc(Buffer const *, std::ostream & os) const;
///
- int DocBook(std::ostream &) const;
+ int DocBook(Buffer const *, std::ostream &) const;
///
Inset * Clone() const;
#include <cstdlib>
#include "math_panel.h"
-FD_panel * create_form_panel(void)
+FD_panel *create_form_panel(void)
{
FL_OBJECT *obj;
FD_panel *fdui = (FD_panel *) fl_calloc(1, sizeof(FD_panel));
fdui->rows = obj = fl_add_valslider(FL_HOR_NICE_SLIDER, 10, 30, 160, 30, _("Rows"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_TOP);
- fl_set_object_callback(obj, matrix_cb,-1);
+ fl_set_object_callback(obj, matrix_cb, -1);
fl_set_slider_precision(obj, 0);
fl_set_slider_bounds(obj, 1, 20);
fl_set_slider_return(obj, FL_RETURN_END_CHANGED);
fl_set_object_boxtype(obj, FL_FRAME_BOX);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_TOP);
- fl_set_object_callback(obj, matrix_cb,-1);
+ fl_set_object_callback(obj, matrix_cb, -1);
fdui->halign = obj = fl_add_input(FL_NORMAL_INPUT, 180, 90, 90, 30, idex(_("Horizontal align|#H")));fl_set_button_shortcut(obj, scex(_("Horizontal align|#H")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_TOP);
-/** Header file generated with fdesign on Mon Apr 12 19:09:42 1999.**/
+/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
#ifndef FD_panel_h_
#define FD_panel_h_
/** Callbacks, globals and object handlers **/
-extern "C" {
-extern void button_cb(FL_OBJECT *, long);
+extern "C" void button_cb(FL_OBJECT *, long);
-extern void delim_cb(FL_OBJECT *, long);
+extern "C" void delim_cb(FL_OBJECT *, long);
-extern void matrix_cb(FL_OBJECT *, long);
+extern "C" void matrix_cb(FL_OBJECT *, long);
-extern void deco_cb(FL_OBJECT *, long);
+extern "C" void deco_cb(FL_OBJECT *, long);
+
+extern "C" void space_cb(FL_OBJECT *, long);
-extern void space_cb(FL_OBJECT *, long);
-}
/**** Forms and Objects ****/
typedef struct {
}
}
- // CHECK
- // Just make sure that the correct number of braces are output.
- // (Lgb)
-#if 0
- while (brace > 0) {
- os << '}';
- --brace;
- }
-#else
- // Something like this should work too:
if (brace > 0)
- os << string(brace, '}'); // not one-off error I hope.
-#endif
+ os << string(brace, '}');
}
os << "\\( "; // changed from " \\( " (Albrecht Dress)
}
else {
- // CHECK
- // Is this '\n' really needed, what can go wrong
- //if it is not there? The reason why I want to avoid this is
- // because of the "backlook" into the output stream.
- // Lgb.
-#if 0
- if (!suffixIs(outf, '\n')) {
- // in batchmode we need to make sure
- // a space before an equation doesn't
- // make the LaTeX output different
- // compared to "Exported LaTeX" ARRae
- // Modified to work in a cleaner and hopefully more general way
- // (JMarc)
- outf += "\n";
- ++number_of_newlines;
- }
-#endif
if (mathed_env == LM_EN_DISPLAY){
os << "\\[\n";
} else {
#include "insets/insettabular.h"
#include "tabular.h"
+#include "frontends/Dialogs.h"
+
using std::vector;
using std::endl;
using std::max;
extern void MenuLayoutSave();
extern void ShowCredits();
-extern void ShowCopyright();
extern void show_symbols_form(LyXFunc *);
extern void LaTeXOptions(BufferView *);
men->currentView()->hideCursor();
if (!men->currentView()->text->selection){
men->currentView()->beforeChange();
- men->currentView()->update(-2);
+ men->currentView()->update(BufferView::SELECT|BufferView::FITCUR);
}
if (men->currentView()->the_locking_inset &&
(men->currentView()->the_locking_inset->LyxCode()
inset->TabularFeatures(men->currentView(), choice - 32);
} else {
men->currentView()->text->
- TableFeatures(choice - 32);
- men->currentView()->update(1);
+ TableFeatures(men->currentView(), choice - 32);
+ men->currentView()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
break;
int num = (choice % BIG_NUM) - 1;
BufferView *bv = men->currentView();
bv->beforeChange();
- bv->text->SetCursor(toclist[type][num].par, 0);
+ bv->text->SetCursor(bv, toclist[type][num].par, 0);
bv->text->sel_cursor = bv->text->cursor;
- bv->update(0);
+ bv->update(BufferView::SELECT|BufferView::FITCUR);
}
for (unsigned int i = 0; i < menus.size(); ++i)
fl_freepup(menus[i]);
"|Table...%l"
"|Include File..."
"|Import ASCII File%m"
- "|Insert LyX File...%l"
+ "|Insert LyX File..."
+ "|Insert external material...%l"
"|Footnote"
"|Margin Note"
"|Floats%m%l"
fl_setpup_shortcut(InsertMenu, 3, scex(_("IM|cC#c#C")));
fl_setpup_shortcut(InsertMenu, 4, scex(_("IM|Aa#a#A")));
fl_setpup_shortcut(InsertMenu, 5, scex(_("IM|Xx#x#X")));
- fl_setpup_shortcut(InsertMenu, 6, scex(_("IM|Ff#f#F")));
- fl_setpup_shortcut(InsertMenu, 7, scex(_("IM|Mm#m#M")));
- fl_setpup_shortcut(InsertMenu, 8, scex(_("IM|oO#o#O")));
- fl_setpup_shortcut(InsertMenu, 9, scex(_("IM|Tt#t#T")));
- fl_setpup_shortcut(InsertMenu, 10, scex(_("IM|Ss#s#S")));
- fl_setpup_shortcut(InsertMenu, 11, scex(_("IM|Nn#n#N")));
- fl_setpup_shortcut(InsertMenu, 12, scex(_("IM|Ll#l#L")));
- fl_setpup_shortcut(InsertMenu, 13, scex(_("IM|rR#r#R")));
- fl_setpup_shortcut(InsertMenu, 14, scex(_("IM|iI#i#I")));
- fl_setpup_shortcut(InsertMenu, 15, scex(_("IM|dD#d#D")));
- fl_setpup_shortcut(InsertMenu, 16, scex(_("IM|wW#w#W")));
+ fl_setpup_shortcut(InsertMenu, 6, scex(_("IM|Ee#e#E")));
+ fl_setpup_shortcut(InsertMenu, 7, scex(_("IM|Ff#f#F")));
+ fl_setpup_shortcut(InsertMenu, 8, scex(_("IM|Mm#m#M")));
+ fl_setpup_shortcut(InsertMenu, 9, scex(_("IM|oO#o#O")));
+ fl_setpup_shortcut(InsertMenu, 10, scex(_("IM|Tt#t#T")));
+ fl_setpup_shortcut(InsertMenu, 11, scex(_("IM|Ss#s#S")));
+ fl_setpup_shortcut(InsertMenu, 12, scex(_("IM|Nn#n#N")));
+ fl_setpup_shortcut(InsertMenu, 13, scex(_("IM|Ll#l#L")));
+ fl_setpup_shortcut(InsertMenu, 14, scex(_("IM|rR#r#R")));
+ fl_setpup_shortcut(InsertMenu, 15, scex(_("IM|iI#i#I")));
+ fl_setpup_shortcut(InsertMenu, 16, scex(_("IM|dD#d#D")));
+ fl_setpup_shortcut(InsertMenu, 17, scex(_("IM|wW#w#W")));
fl_addtopup(InsertMenu, _("|URL..."));
- fl_setpup_shortcut(InsertMenu, 17, scex(_("IM|Uu#u#U")));
+ fl_setpup_shortcut(InsertMenu, 18, scex(_("IM|Uu#u#U")));
if (tmpbuffer->isReadonly()) {
- for (int ii = 1; ii <= 16; ++ii)
+ for (int ii = 1; ii <= 17; ++ii)
fl_setpup_mode(InsertMenu, ii, FL_PUP_GREY);
- fl_setpup_mode(InsertMenu, 17, FL_PUP_GREY);
+ fl_setpup_mode(InsertMenu, 18, FL_PUP_GREY);
}
fl_setpup_position(
case 43:
break;
- case 6: tmpfunc->Dispatch(LFUN_FOOTMELT); break
+ case 6: tmpfunc->Dispatch(LFUN_INSET_EXTERNAL); break;
+
+ case 7: tmpfunc->Dispatch(LFUN_FOOTMELT); break
;
- case 7: tmpfunc->Dispatch(LFUN_MARGINMELT); break;
+ case 8: tmpfunc->Dispatch(LFUN_MARGINMELT); break;
- case 8: // Float sub-menu
+ case 9: // Float sub-menu
case 71:
tmpfunc->Dispatch(LFUN_INSERTFOOTNOTE, "figure");
break;
tmpfunc->Dispatch(LFUN_INSERTFOOTNOTE, "algorithm");
break;
- case 9: // Table/List submenu
+ case 10: // Table/List submenu
break;
case 21: tmpfunc->Dispatch(LFUN_TOC_INSERT); break;
case 22: tmpfunc->Dispatch(LFUN_LOF_INSERT); break;
case 25: tmpfunc->Dispatch(LFUN_INDEX_PRINT); break;
case 26: tmpfunc->Dispatch(LFUN_INSERT_BIBTEX); break;
- case 10: // Special Character submenu
+ case 11: // Special Character submenu
break;
case 31: tmpfunc->Dispatch(LFUN_HFILL); break;
case 32: tmpfunc->Dispatch(LFUN_HYPHENATION); break;
case 37: tmpfunc->Dispatch(LFUN_QUOTE); break;
case 38: tmpfunc->Dispatch(LFUN_MENU_SEPARATOR); break;
- case 11: tmpfunc->Dispatch(LFUN_INSERT_NOTE); break;
- case 12: tmpfunc->Dispatch(LFUN_INSERT_LABEL); break;
- case 13: tmpfunc->Dispatch(LFUN_INSERT_REF); break;
- case 14: tmpfunc->Dispatch(LFUN_INSERT_CITATION); break;
- case 15: tmpfunc->Dispatch(LFUN_INDEX_INSERT); break;
- case 16: tmpfunc->Dispatch(LFUN_INDEX_INSERT_LAST); break;
- case 17: tmpfunc->Dispatch(LFUN_URL); break;
+ case 12: tmpfunc->Dispatch(LFUN_INSERT_NOTE); break;
+ case 13: tmpfunc->Dispatch(LFUN_INSERT_LABEL); break;
+ case 14: tmpfunc->Dispatch(LFUN_INSERT_REF); break;
+ case 15: tmpfunc->Dispatch(LFUN_INSERT_CITATION); break;
+ case 16: tmpfunc->Dispatch(LFUN_INDEX_INSERT); break;
+ case 17: tmpfunc->Dispatch(LFUN_INDEX_INSERT_LAST); break;
+ case 18: tmpfunc->Dispatch(LFUN_URL); break;
}
}
fl_freepup(InsertMenu);
show_symbols_form(tmpfunc);
break;
}
- men->currentView()->update(0);
+ men->currentView()->update(BufferView::SELECT|BufferView::FITCUR);
}
fl_freepup(MathMenu);
}
"|Spellchecker Options..."
"|Keyboard..."
"|LaTeX...%l"
- "|Reconfigure" ));
+ "|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|Ll#l#L")));
fl_setpup_shortcut(OptionsMenu, 5, scex(_("OM|Rr#r#R")));
+ fl_setpup_shortcut(OptionsMenu, 6, scex(_("OM|Pp#p#P")));
if(lyxrc.isp_command == "none")
fl_setpup_mode(OptionsMenu, 2, FL_PUP_GREY);
case 3: men->_view->getIntl()->MenuKeymap(); break;
case 4: LaTeXOptions(men->_view->view()); break;
case 5: tmpfunc->Dispatch(LFUN_RECONFIGURE); break;
+ case 6: men->_view->getDialogs()->showPreferences(); break;
default: break;
}
fl_freepup(OptionsMenu);
"UserGuide", "Extended",
"Customization", "Reference",
"FAQ", "TOC",
- "BUGS", "LaTeXConfig"};
+ "BUGS", "LyXConfig"};
void Menus::ShowHelpMenu(FL_OBJECT * ob, long)
{
Menus * men = static_cast<Menus*>(ob->u_vdata);
+ LyXFunc * tmpfunc = men->_view->getLyXFunc();
// set the pseudo menu-button
fl_set_object_boxtype(ob, FL_UP_BOX);
men->MenuDocu(doc_files[choice - 1]);
AllowInput(men->currentView());
break;
- case 11: ShowCopyright(); break;
+ case 11: tmpfunc->Dispatch(LFUN_HELP_COPYRIGHT); break;
case 12: ShowCredits(); break;
case 13:
ProhibitInput(men->currentView());
}
-void LyXParagraph::writeFile(ostream & os, BufferParams const & params,
+void LyXParagraph::writeFile(Buffer const * buf, ostream & os,
+ BufferParams const & params,
char footflag, char dth) const
{
LyXFont font1, font2;
#endif
// bibitem ale970302
if (bibkey)
- bibkey->Write(os);
+ bibkey->Write(buf, os);
font1 = LyXFont(LyXFont::ALL_INHERIT,params.language_info);
// international char, let it write
// code directly so it's shorter in
// the file
- inset->Write(os);
+ inset->Write(buf, os);
} else {
os << "\n\\begin_inset ";
- inset->Write(os);
+ inset->Write(buf, os);
os << "\n\\end_inset \n\n";
column = 0;
}
// now write the next paragraph
if (next)
- next->writeFile(os, params, footflag, dth);
+ next->writeFile(buf, os, params, footflag, dth);
}
}
-LyXParagraph * LyXParagraph::TeXOnePar(BufferParams const & bparams,
+LyXParagraph * LyXParagraph::TeXOnePar(Buffer const * buf,
+ BufferParams const & bparams,
ostream & os, TexRow & texrow,
bool moving_arg,
ostream & foot,
break;
case LATEX_ITEM_ENVIRONMENT:
if (bibkey) {
- bibkey->Latex(os, false, false);
+ bibkey->Latex(buf, os, false, false);
} else
os << "\\item ";
break;
break;
}
- bool need_par = SimpleTeXOnePar(bparams, os, texrow, moving_arg);
+ bool need_par = SimpleTeXOnePar(buf, bparams, os, texrow, moving_arg);
// Spit out footnotes
LyXParagraph * par = next;
is_rtl = getParLanguage(bparams)->RightToLeft();
while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE
&& par->footnoteflag != footnoteflag) {
- par = par->TeXFootnote(bparams,
+ par = par->TeXFootnote(buf, bparams,
os, texrow, foot,
foot_texrow, foot_count,
is_rtl);
- par->SimpleTeXOnePar(bparams,
+ par->SimpleTeXOnePar(buf, bparams,
os, texrow, moving_arg);
is_rtl = (par->size() > 0)
? par->GetFontSettings(bparams,
} else {
while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE
&& par->footnoteflag != footnoteflag) {
- par = par->TeXFootnote(bparams,
+ par = par->TeXFootnote(buf, bparams,
os, texrow,
foot, foot_texrow, foot_count,
false);
- par->SimpleTeXOnePar(bparams, os, texrow, moving_arg);
+ par->SimpleTeXOnePar(buf, bparams, os, texrow, moving_arg);
par = par->next;
}
}
// This one spits out the text of the paragraph
-bool LyXParagraph::SimpleTeXOnePar(BufferParams const & bparams,
+bool LyXParagraph::SimpleTeXOnePar(Buffer const * buf,
+ BufferParams const & bparams,
ostream & os, TexRow & texrow,
bool moving_arg)
{
#ifndef NEW_TABULAR
if (table)
- return SimpleTeXOneTablePar(bparams, os, texrow);
+ return SimpleTeXOneTablePar(buf, bparams, os, texrow);
#endif
bool return_value = false;
texrow.start(this, i + 1);
column = 0;
} else {
- SimpleTeXSpecialChars(bparams,
+ SimpleTeXSpecialChars(buf, bparams,
os, texrow, moving_arg,
font, running_font, basefont,
open_font, style, i, column, c);
// This one spits out the text of a table paragraph
-bool LyXParagraph::SimpleTeXOneTablePar(BufferParams const & bparams,
+bool LyXParagraph::SimpleTeXOneTablePar(Buffer const * buf,
+ BufferParams const & bparams,
ostream & os, TexRow & texrow)
{
lyxerr[Debug::LATEX] << "SimpleTeXOneTablePar... " << this << endl;
running_font = basefont;
++current_cell_number;
if (table->CellHasContRow(current_cell_number) >= 0) {
- TeXContTableRows(bparams, os, i + 1,
+ TeXContTableRows(buf, bparams, os, i + 1,
current_cell_number,
column, texrow);
}
}
texrow.start(this, i + 1);
} else {
- SimpleTeXSpecialChars(bparams,
+ SimpleTeXSpecialChars(buf, bparams,
os, texrow, false,
font, running_font, basefont,
open_font, style, i, column, c);
// This one spits out the text off ContRows in tables
-bool LyXParagraph::TeXContTableRows(BufferParams const & bparams,
+bool LyXParagraph::TeXContTableRows(Buffer const * buf,
+ BufferParams const & bparams,
ostream & os,
LyXParagraph::size_type i,
int current_cell_number,
column += 9;
}
}
- SimpleTeXSpecialChars(bparams,
+ SimpleTeXSpecialChars(buf, bparams,
os, texrow, false, font,
running_font, basefont,
open_font, style, i, column, c);
}
-void LyXParagraph::SimpleDocBookOneTablePar(BufferParams const & bparams,
+void LyXParagraph::SimpleDocBookOneTablePar(Buffer const * buffer,
ostream & os, string & extra,
int & desc_on, int depth)
{
+ BufferParams const & bparams = buffer->params;
if (!table) return;
lyxerr[Debug::LATEX] << "SimpleDocbookOneTablePar... " << this << endl;
int column = 0;
font1 = font2 = getFont(bparams, -1);
++current_cell_number;
if (table->CellHasContRow(current_cell_number) >= 0) {
- DocBookContTableRows(bparams,
+ DocBookContTableRows(buffer,
os, extra, desc_on, i + 1,
current_cell_number,
column);
inset = GetInset(i);
#ifdef HAVE_SSTREAM
std::ostringstream ost;
- inset->DocBook(ost);
+ inset->DocBook(buffer, ost);
string tmp_out = ost.str().c_str();
#else
ostrstream ost;
- inset->DocBook(ost);
+ inset->DocBook(buffer, ost);
ost << '\0';
char * ctmp = ost.str();
string tmp_out(ctmp);
}
-void LyXParagraph::DocBookContTableRows(BufferParams const & bparams,
+void LyXParagraph::DocBookContTableRows(Buffer const * buffer,
ostream & os, string & extra,
int & desc_on,
LyXParagraph::size_type i,
{
if (!table) return;
+
+ BufferParams const & bparams = buffer->params;
lyxerr[Debug::LATEX] << "DocBookContTableRows... " << this << endl;
inset = GetInset(i);
#ifdef HAVE_SSTREAM
std::ostringstream ost;
- inset->DocBook(ost);
+ inset->DocBook(buffer, ost);
string tmp_out = ost.str().c_str();
#else
ostrstream ost;
- inset->DocBook(ost);
+ inset->DocBook(buffer, ost);
ost << '\0';
char * ctmp = ost.str();
string tmp_out(ctmp);
}
-void LyXParagraph::SimpleTeXSpecialChars(BufferParams const & bparams,
+void LyXParagraph::SimpleTeXSpecialChars(Buffer const * buf,
+ BufferParams const & bparams,
ostream & os, TexRow & texrow,
bool moving_arg,
LyXFont & font,
close = true;
}
- int tmp = inset->Latex(os, moving_arg,
+ int tmp = inset->Latex(buf, os, moving_arg,
style.free_spacing);
if (close)
if ((inset = GetInset(i))) {
#ifdef HAVE_SSTREAM
stringstream ss(ios::in | ios::out);
- inset->Ascii(ss);
+ inset->Ascii(buffer, ss);
ss.seekp(0);
ss.get(c);
while (!ss) {
}
#else
strstream ss;
- inset->Ascii(ss);
+ inset->Ascii(buffer, ss);
ss.seekp(0);
ss.get(c);
while (!ss) {
#endif
-LyXParagraph * LyXParagraph::TeXDeeper(BufferParams const & bparams,
+LyXParagraph * LyXParagraph::TeXDeeper(Buffer const * buf,
+ BufferParams const & bparams,
ostream & os, TexRow & texrow,
ostream & foot,
TexRow & foot_texrow,
if (textclasslist.Style(bparams.textclass,
par->layout).isEnvironment()
|| par->pextra_type != PEXTRA_NONE) {
- par = par->TeXEnvironment(bparams,
+ par = par->TeXEnvironment(buf, bparams,
os, texrow,
foot, foot_texrow,
foot_count);
} else {
- par = par->TeXOnePar(bparams,
+ par = par->TeXOnePar(buf, bparams,
os, texrow, false,
foot, foot_texrow,
foot_count);
}
-LyXParagraph * LyXParagraph::TeXEnvironment(BufferParams const & bparams,
+LyXParagraph * LyXParagraph::TeXEnvironment(Buffer const * buf,
+ BufferParams const & bparams,
ostream & os, TexRow & texrow,
ostream & foot,
TexRow & foot_texrow,
}
LyXParagraph * par = this;
do {
- par = par->TeXOnePar(bparams,
+ par = par->TeXOnePar(buf, bparams,
os, texrow, false,
foot, foot_texrow, foot_count);
os << '\n';
texrow.newline();
}
- par = par->TeXDeeper(bparams, os, texrow,
+ par = par->TeXDeeper(buf, bparams, os, texrow,
foot, foot_texrow, foot_count);
}
if (par && par->layout == layout && par->depth == depth &&
}
-LyXParagraph * LyXParagraph::TeXFootnote(BufferParams const & bparams,
+LyXParagraph * LyXParagraph::TeXFootnote(Buffer const * buf,
+ BufferParams const & bparams,
ostream & os, TexRow & texrow,
ostream & foot, TexRow & foot_texrow,
int & foot_count,
// environments. Shouldn't be circular because
// we don't support footnotes inside
// floats (yet). ARRae
- par = par->TeXEnvironment(bparams, os, texrow,
+ par = par->TeXEnvironment(buf, bparams, os,
+ texrow,
foot, foot_texrow,
foot_count);
} else {
- par = par->TeXOnePar(bparams,
+ par = par->TeXOnePar(buf, bparams,
os, texrow, moving_arg,
foot, foot_texrow,
foot_count);
}
if (par && !par->IsDummy() && par->depth > depth) {
- par = par->TeXDeeper(bparams, os, texrow,
+ par = par->TeXDeeper(buf, bparams, os, texrow,
foot, foot_texrow,
foot_count);
}
// environments. Shouldn't be circular because
// we don't support footnotes inside
// floats (yet). ARRae
- par = par->TeXEnvironment(bparams,
+ par = par->TeXEnvironment(buf, bparams,
foot, foot_texrow,
dummy, dummy_texrow,
dummy_count);
} else {
- par = par->TeXOnePar(bparams,
+ par = par->TeXOnePar(buf, bparams,
foot, foot_texrow,
moving_arg,
dummy, dummy_texrow,
}
if (par && !par->IsDummy() && par->depth > depth) {
- par = par->TeXDeeper(bparams,
+ par = par->TeXDeeper(buf, bparams,
foot, foot_texrow,
dummy, dummy_texrow,
dummy_count);
// Convert the paragraph to a string.
// Used for building the table of contents
-string LyXParagraph::String(BufferParams const & bparams, bool label)
+string LyXParagraph::String(Buffer const * buffer, bool label)
{
+ BufferParams const & bparams = buffer->params;
string s;
if (label && !IsDummy() && !labelstring.empty())
s += labelstring + ' ';
GetInset(i)->LyxCode() == Inset::MATH_CODE) {
#ifdef HAVE_SSTREAM
std::ostringstream ost;
- GetInset(i)->Ascii(ost);
+ GetInset(i)->Ascii(buffer, ost);
#else
ostrstream ost;
- GetInset(i)->Ascii(ost);
+ GetInset(i)->Ascii(buffer, ost);
ost << '\0';
#endif
s += subst(ost.str(),'\n',' ');
if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE
&& footnoteflag == LyXParagraph::NO_FOOTNOTE)
- s += NextAfterFootnote()->String(bparams, false);
+ s += NextAfterFootnote()->String(buffer, false);
if (!IsDummy()) {
if (isRightToLeftPar(bparams))
}
-string LyXParagraph::String(LyXParagraph::size_type beg,
+string LyXParagraph::String(Buffer const * buffer,
+ LyXParagraph::size_type beg,
LyXParagraph::size_type end)
{
string s;
else if (c == META_INSET) {
#ifdef HAVE_SSTREAM
std::ostringstream ost;
- GetInset(i)->Ascii(ost);
+ GetInset(i)->Ascii(buffer, ost);
#else
ostrstream ost;
- GetInset(i)->Ascii(ost);
+ GetInset(i)->Ascii(buffer, ost);
ost << '\0';
#endif
s += ost.str();
/* Form definition file generated with fdesign. */
#include FORMS_H_LOCATION
-#include <stdlib.h>
+#include <cstdlib>
#include "print_form.h"
-FD_form_print *create_form_form_print(void)
-{
- FL_OBJECT *obj;
- FD_form_print *fdui = (FD_form_print *) fl_calloc(1, sizeof(FD_form_print));
-
- fdui->form_print = fl_bgn_form(FL_NO_BOX, 340, 360);
- 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);
- obj = fl_add_text(FL_NORMAL_TEXT, 20, 205, 70, 20, _("Print to"));
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
- fl_set_object_lstyle(obj, FL_BOLD_STYLE);
- fdui->input_printer = obj = fl_add_input(FL_NORMAL_INPUT, 90, 225, 230, 30, "");
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fdui->input_file = obj = fl_add_input(FL_NORMAL_INPUT, 90, 265, 230, 30, "");
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
-
- fdui->group_radio_printto = fl_bgn_group();
- fdui->radio_printer = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 225, 80, 30, idex(_("Printer|#P")));fl_set_button_shortcut(obj, scex(_("Printer|#P")), 1);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fdui->radio_file = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 265, 80, 30, idex(_("File|#F")));fl_set_button_shortcut(obj, scex(_("File|#F")), 1);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_end_group();
-
- obj = fl_add_frame(FL_ENGRAVED_FRAME, 180, 20, 150, 70, "");
- fl_set_object_color(obj, FL_COL1, FL_COL1);
- obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 20, 160, 180, "");
- fl_set_object_color(obj, FL_COL1, FL_COL1);
- obj = fl_add_button(FL_RETURN_BUTTON, 10, 315, 100, 30, _("OK"));
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_callback(obj, PrintOKCB, 0);
- obj = fl_add_button(FL_NORMAL_BUTTON, 120, 315, 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_callback(obj, PrintApplyCB, 0);
- obj = fl_add_button(FL_NORMAL_BUTTON, 230, 315, 100, 30, idex(_("Cancel|^[")));fl_set_button_shortcut(obj, scex(_("Cancel|^[")), 1);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_callback(obj, PrintCancelCB, 0);
-
- fdui->group_radio_pages = fl_bgn_group();
- fdui->radio_all_pages = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 30, 160, 30, idex(_("All Pages|#G")));fl_set_button_shortcut(obj, scex(_("All Pages|#G")), 1);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fdui->radio_odd_pages = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 60, 160, 30, idex(_("Only Odd Pages|#O")));fl_set_button_shortcut(obj, scex(_("Only Odd Pages|#O")), 1);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fdui->radio_even_pages = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 10, 90, 160, 30, idex(_("Only Even Pages|#E")));fl_set_button_shortcut(obj, scex(_("Only Even Pages|#E")), 1);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_end_group();
-
-
- fdui->group_radio_order = fl_bgn_group();
- fdui->radio_order_normal = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 180, 30, 150, 30, idex(_("Normal Order|#N")));fl_set_button_shortcut(obj, scex(_("Normal Order|#N")), 1);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fdui->radio_order_reverse = obj = fl_add_checkbutton(FL_RADIO_BUTTON, 180, 60, 150, 30, idex(_("Reverse Order|#R")));fl_set_button_shortcut(obj, scex(_("Reverse Order|#R")), 1);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_end_group();
-
- obj = fl_add_text(FL_NORMAL_TEXT, 200, 10, 60, 20, _("Order"));
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
- fl_set_object_lstyle(obj, FL_BOLD_STYLE);
- obj = fl_add_text(FL_NORMAL_TEXT, 20, 10, 50, 20, _("Print"));
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
- fl_set_object_lstyle(obj, FL_BOLD_STYLE);
- fdui->input_pages = obj = fl_add_input(FL_NORMAL_INPUT, 20, 160, 140, 30, _("Pages:"));
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
- obj = fl_add_frame(FL_ENGRAVED_FRAME, 180, 110, 150, 90, "");
- fl_set_object_color(obj, FL_COL1, FL_COL1);
- obj = fl_add_text(FL_NORMAL_TEXT, 200, 95, 50, 20, _("Copies"));
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
- fl_set_object_lstyle(obj, FL_BOLD_STYLE);
- fdui->input_copies = obj = fl_add_input(FL_NORMAL_INPUT, 190, 160, 130, 30, _("Count:"));
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
- fdui->do_unsorted = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 180, 115, 140, 30, idex(_("Unsorted|#U")));fl_set_button_shortcut(obj, scex(_("Unsorted|#U")), 1);
- fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- fl_end_form();
-
- //fdui->form_print->fdui = fdui;
-
- return fdui;
-}
-/*---------------------------------------*/
-
FD_form_sendto *create_form_form_sendto(void)
{
FL_OBJECT *obj;
-/** Header file generated with fdesign on Mon Apr 12 19:09:43 2000.**/
+/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
-#ifndef FD_form_print_h_
-#define FD_form_print_h_
+#ifndef FD_form_sendto_h_
+#define FD_form_sendto_h_
/** Callbacks, globals and object handlers **/
-extern "C" void PrintOKCB(FL_OBJECT *, long);
-extern "C" void PrintApplyCB(FL_OBJECT *, long);
-extern "C" void PrintCancelCB(FL_OBJECT *, long);
-
extern "C" void SendtoOKCB(FL_OBJECT *, long);
extern "C" void SendtoApplyCB(FL_OBJECT *, long);
extern "C" void SendtoCancelCB(FL_OBJECT *, long);
/**** Forms and Objects ****/
-typedef struct {
- FL_FORM *form_print;
- void *vdata;
- char *cdata;
- long ldata;
- FL_OBJECT *input_printer;
- FL_OBJECT *input_file;
- FL_OBJECT *group_radio_printto;
- FL_OBJECT *radio_printer;
- FL_OBJECT *radio_file;
- FL_OBJECT *group_radio_pages;
- FL_OBJECT *radio_all_pages;
- FL_OBJECT *radio_odd_pages;
- FL_OBJECT *radio_even_pages;
- FL_OBJECT *group_radio_order;
- FL_OBJECT *radio_order_normal;
- FL_OBJECT *radio_order_reverse;
- FL_OBJECT *input_pages;
- FL_OBJECT *input_copies;
- FL_OBJECT *do_unsorted;
-} FD_form_print;
-
-extern FD_form_print * create_form_form_print(void);
typedef struct {
FL_FORM *form_sendto;
void *vdata;
extern FD_form_sendto * create_form_form_sendto(void);
-#endif /* FD_form_print_h_ */
+#endif /* FD_form_sendto_h_ */
// y1 is now the real beginning of row on the screen
while (row != 0 && y < y2) {
- text->GetVisibleRow(y, row, y + first);
+ text->GetVisibleRow(owner.owner(), y, 0, row, y + first);
y += row->height();
row = row->next();
}
if (y + row->height() > 0
&& y - row->height() <= long(owner.height())) {
// ok there is something visible
- text->GetVisibleRow(y, row, y + first);
+ text->GetVisibleRow(owner.owner(), y, 0, row, y + first);
}
}
if (!cursor_visible) {
Cursor_Shape shape = BAR_SHAPE;
if (text->real_current_font.language() !=
- text->buffer()->params.language_info
+ owner.owner()->buffer()->params.language_info
|| text->real_current_font.isVisibleRightToLeft()
- != text->buffer()->params.language_info->RightToLeft())
+ != owner.owner()->buffer()->params.language_info->RightToLeft())
shape = (text->real_current_font.isVisibleRightToLeft())
? REVERSED_L_SHAPE : L_SHAPE;
ShowManualCursor(text->cursor.x(), text->cursor.y(),
/* Form definition file generated with fdesign. */
#include FORMS_H_LOCATION
-#include <stdlib.h>
+#include <cstdlib>
#include "sp_form.h"
FD_form_spell_options *create_form_form_spell_options(void)
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fdui->done = obj = fl_add_button(FL_NORMAL_BUTTON, 310, 240, 220, 30, idex(_("Close Spellchecker|#C^[")));fl_set_button_shortcut(obj, scex(_("Close Spellchecker|#C^[")), 1);
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
- // xgettext:no-c-format
+ // xgettext:no-c-format
obj = fl_add_box(FL_NO_BOX, 10, 250, 50, 20, _("0 %"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
- // xgettext:no-c-format
+ // xgettext:no-c-format
obj = fl_add_box(FL_NO_BOX, 250, 250, 50, 20, _("100 %"));
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
fl_set_object_lalign(obj, FL_ALIGN_RIGHT|FL_ALIGN_INSIDE);
-/** Header file generated with fdesign on Mon Apr 12 19:09:43 1999.**/
+/** Header file generated with fdesign on Mon Jun 12 06:32:31 2000.**/
#ifndef FD_form_spell_options_h_
#define FD_form_spell_options_h_
--- /dev/null
+/* This file is part of
+ * ======================================================
+ *
+ * LyX, The Document Processor
+ *
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-2000 The LyX Team.
+ *
+ * ====================================================== */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "LAssert.h"
+
+#ifdef ENABLE_ASSERTIONS
+#include "bufferlist.h"
+
+extern BufferList bufferlist;
+
+void emergencySave() {
+ static bool didSafe = false;
+ if (didSafe)
+ return;
+
+ didSafe = true;
+
+ // emergency save
+ if (!bufferlist.empty())
+ bufferlist.emergencyWriteAll();
+}
+
+#endif
#ifdef ENABLE_ASSERTIONS
+extern void emergencySave();
+
template<class A>
inline
void Assert(A assertion)
{
if (!assertion) {
+ ::emergencySave();
lyx::abort();
}
}
AUTOMAKE_OPTIONS = foreign
+DISTCLEANFILES= *.orig *.rej *~ *.bak core
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
noinst_LTLIBRARIES = libsupport.la
LIBS =
-ETAGS_ARGS = --c++
+ETAGS_ARGS = --lang=c++
INCLUDES = -I${srcdir}/../
EXTRA_DIST = lyxstring.C lyxstring.h regex.c lyxregex.h
DebugStream.h \
FileInfo.C \
FileInfo.h \
+ LAssert.C \
LAssert.h \
LIstream.h \
LOstream.h \
kill.C \
lstrings.C \
lstrings.h \
+ lxtl.h \
lyxalgo.h \
lyxlib.h \
lyxmanip.h \
#include <cctype>
#include <utility>
+#include <fstream>
+
+#ifdef HAVE_SSTREAM
+#include <sstream>
+#else
+#include <strstream>
+#endif
#ifdef __GNUG__
#pragma implementation "filetools.h"
using std::make_pair;
using std::pair;
using std::endl;
+using std::ifstream;
extern string system_lyxdir;
extern string build_lyxdir;
#endif
}
+string GetFileContents(string const & fname) {
+ FileInfo finfo(fname);
+ if (finfo.exist()) {
+ ifstream ifs(fname.c_str());
+#ifdef HAVE_SSTREAM
+ std::ostringstream ofs;
+#else
+#warning The rumour goes that this might leak, but who really cares?
+ ostrstream ofs;
+#endif
+ if (ifs && ofs) {
+ ofs << ifs.rdbuf();
+ ifs.close();
+#ifdef HAVE_SSTREAM
+ return ofs.str();
+#else
+ ofs << '\0';
+ char const * tmp = ofs.str();
+ string ret(tmp);
+ delete[] tmp;
+ return ret;
+#endif
+ }
+ }
+ lyxerr << "LyX was not able to read file '" << fname << "'" << endl;
+ return string();
+}
+
//
// Search ${...} as Variable-Name inside the string and replace it with
/// Strips path from filename
string OnlyFilename(string const & fname);
+/// Get the contents of a file as a huge string
+string GetFileContents(string const & fname);
+
/// Cleanup a path if necessary. Currently only useful with OS/2
string CleanupPath(string const & path) ;
tmpstr = frontStrip(strip(str, ' '), ' ');
// Do the conversion proper.
return atoi(tmpstr.c_str());
- } else
+ } else {
return 0;
+ }
}
+
+///
+bool isStrDbl(string const & str)
+{
+ if (str.empty()) return false;
+
+ // Remove leading and trailing white space chars.
+ string tmpstr = frontStrip(strip(str, ' '), ' ');
+ if (tmpstr.empty()) return false;
+ // if (1 < tmpstr.count('.')) return false;
+
+ string::const_iterator cit = tmpstr.begin();
+ bool found_dot(false);
+ if ( (*cit) == '-') ++cit;
+ for (; cit != tmpstr.end(); ++cit) {
+ if (!isdigit((*cit))
+ && '.' != (*cit)) {
+ return false;
+ }
+ if ('.' == (*cit)) {
+ if (found_dot) {
+ return false;
+ } else {
+ found_dot = true;
+ }
+ }
+ }
+ return true;
+}
+
+///
+double strToDbl(string const & str)
+{
+ string tmpstr;
+
+ if (isStrDbl(str)) {
+ // Remove leading and trailing white space chars.
+ tmpstr = frontStrip(strip(str, ' '), ' ');
+ // Do the conversion proper.
+ return atof(tmpstr.c_str());
+ } else {
+ return 0.0;
+ }
+}
+
+
+
string lowercase(string const & a)
{
string tmp(a);
}
+bool containsOnly(string const & s, char const * cset)
+{
+ return s.find_first_not_of(cset) == string::npos;
+}
+
+
+bool containsOnly(string const & s, string const & cset)
+{
+ return s.find_first_not_of(cset) == string::npos;
+}
+
+
+bool containsOnly(char const * s, char const * cset)
+{
+ return string(s).find_first_not_of(cset) == string::npos;
+}
+
+
+bool containsOnly(char const * s, string const & cset)
+{
+ return string(s).find_first_not_of(cset) == string::npos;
+}
+
+
unsigned int countChar(string const & a, char const c)
{
#ifdef HAVE_STD_COUNT
///
int strToInt(string const & str);
+///
+bool isStrDbl(string const & str);
+
+///
+double strToDbl(string const & str);
+
///
string lowercase(string const &);
///
bool contains(char const * a, char const * b);
+///
+bool containsOnly(string const &, char const *);
+
+///
+bool containsOnly(string const &, string const &);
+
+///
+bool containsOnly(char const *, char const *);
+
+///
+bool containsOnly(char const *, string const &);
+
/// Counts how many of character c there is in a
unsigned int countChar(string const & a, char const c);
int index = 0;
bool more;
do {
+ childcommand = frontStrip(childcommand);
if (syscmd == 0) {
syscmd = new char[childcommand.length() + 1];
childcommand.copy(syscmd, childcommand.length());
syscmd[childcommand.length()] = '\0';
}
+ if (!childcommand.empty()) {
char * tmp = new char[childcommand.length() + 1];
childcommand.copy(tmp, childcommand.length());
tmp[childcommand.length()] = '\0';
argv[index++] = tmp;
+ }
+
// reinit
more = !rest.empty();
if (more)
int TexEndOfCell(std::ostream &, int cell);
///
int DocBookEndOfCell(std::ostream &, int cell, int & depth);
+
#if 0
///
int RoffEndOfCell(std::ostream &, int cell);
#endif
+
///
char const * getDocBookAlign(int cell, bool isColumn = false);
bottom_line = false;
rotate = false;
linebreaks = false;
+#ifdef INSET_POINTER
inset = 0;
+#endif
}
-
+#ifdef INSET_POINTER
LyXTabular::cellstruct::~cellstruct()
{
delete inset;
}
-
LyXTabular::cellstruct::cellstruct(cellstruct const & cs)
{
cellno = cs.cellno;
bottom_line = cs.bottom_line;
rotate = cs.rotate;
linebreaks = cs.linebreaks;
- inset = 0;
-// if (cs.inset)
-// inset = static_cast<InsetText *>(cs.inset->Clone());
+ inset = cs.inset;
+#if 0
+ if (cs.inset)
+ inset = static_cast<InsetText *>(cs.inset->Clone());
+#endif
}
-
LyXTabular::cellstruct &
LyXTabular::cellstruct::operator=(cellstruct const & cs)
{
inset = static_cast<InsetText *>(cs.inset->Clone());
return *this;
}
+#endif
LyXTabular::rowstruct::rowstruct()
}
-LyXTabular::LyXTabular(InsetTabular * inset, LyXLex & lex)
+LyXTabular::LyXTabular(Buffer const * buf, InsetTabular * inset, LyXLex & lex)
{
owner_ = inset;
- Read(lex);
+ Read(buf, lex);
}
int i,j;
for(i=0; i < rows_; ++i) {
for(j=0; j < columns_; ++j) {
+#ifdef INSET_POINTER
delete result->cell_info[i][j].inset;
- result->cell_info[i][j].inset=new InsetText(*cell_info[i][j].inset,
- inset->BufferOwner());
- result->cell_info[i][j].inset->setOwner(inset);
+ result->cell_info[i][j].inset=new InsetText(*cell_info[i][j].inset);
+#else
+ result->cell_info[i][j].inset = cell_info[i][j].inset;
+#endif
+ result->cell_info[i][j].inset.setOwner(inset);
}
}
return result;
// Jürgen, use iterators.
for (i = 0; i < rows_; ++i) {
for (j = 0; j < columns_; ++j) {
+#ifdef INSET_POINTER
if (!cell_info[i][j].inset)
- cell_info[i][j].inset = new InsetText(owner_->BufferOwner());
- cell_info[i][j].inset->setOwner(owner_);
- cell_info[i][j].inset->SetDrawLockedFrame(true);
+ cell_info[i][j].inset = new InsetText();
+#endif
+ cell_info[i][j].inset.setOwner(owner_);
+ cell_info[i][j].inset.SetDrawLockedFrame(true);
cell_info[i][j].cellno = cellno++;
}
}
void LyXTabular::AppendRow(int cell )
{
-// cell_vector::iterator cit = cell_info.begin() + row;
-// cell_info.insert(cit, vector<cellstruct>(columns_, cellstruct()));
-// cell_info.insert(cell_info.begin(), vector<cellstruct>(columns_, cellstruct()));
-
++rows_;
-// row_vector r_info = row_vector(rows_, rowstruct());
-
- cell_vvector c_info = cell_vvector(rows_, cell_vector(columns_,
- cellstruct()));
int row = row_of_cell(cell);
- int i;
row_vector::iterator rit = row_info.begin() + row;
row_info.insert(rit, rowstruct());
- for(i = 0; i <= row; ++i) {
-// r_info[i] = row_info[i];
+#if 1
+ cell_vvector::iterator cit = cell_info.begin() + row;
+ cell_info.insert(cit, vector<cellstruct>(columns_, cellstruct()));
+#else
+ cell_vvector c_info = cell_vvector(rows_, cell_vector(columns_,
+ cellstruct()));
+
+ for(int i = 0; i <= row; ++i) {
for(int j = 0; j < columns_; ++j) {
c_info[i][j] = cell_info[i][j];
}
}
- for(i = row+1; i < rows_; ++i) {
-// r_info[i] = row_info[i-1];
+ for(int i = row+1; i < rows_; ++i) {
for(int j = 0; j < columns_; ++j) {
c_info[i][j] = cell_info[i-1][j];
}
}
-// row_info = r_info;
cell_info = c_info;
- for(i = 0; i < rows_; ++i) {
+#ifdef INSET_POINTER
+ for(int i = 0; i < rows_; ++i) {
for(int j = 0; j < columns_; ++j) {
- cell_info[i][j].inset = static_cast<InsetText *>(c_info[i][j].inset->Clone());
+ if (!cell_info[i][j].inset)
+ cell_info[i][j].inset = static_cast<InsetText *>(c_info[i][j].inset->Clone());
}
}
+#endif
++row;
for (int j = 0; j < columns_; ++j) {
- cell_info[row][j].inset->clear();
+ cell_info[row][j].inset.clear();
}
+#endif
Reinit();
}
}
}
cell_info = c_info;
+#ifdef INSET_POINTER
for(i = 0; i < rows_; ++i) {
for(j = 0; j < columns_; ++j) {
cell_info[i][j].inset = static_cast<InsetText *>(c_info[i][j].inset->Clone());
}
}
+#endif
++column;
for (i = 0; i < rows_; ++i) {
- cell_info[i][column].inset->clear();
+ cell_info[i][column].inset.clear();
}
Reinit();
}
for (; i < rows_; ++i) {
for (j = 0; j < columns_; ++j) {
cell_info[i][j].width_of_cell = 0;
+ cell_info[i][j].inset.setOwner(owner_);
}
}
for (column = 0; column<columns_; ++column) {
if (IsPartOfMultiColumn(row,column))
continue;
- cell_info[row][column].inset->SetAutoBreakRows(
+ cell_info[row][column].inset.SetAutoBreakRows(
!GetPWidth(GetCellNumber(row, column)).empty());
}
}
}
-void LyXTabular::Write(ostream & os) const
+void LyXTabular::Write(Buffer const * buf, ostream & os) const
{
int i, j;
"\" special=\"" << cell_info[i][j].align_special <<
"\">" << endl;
os << "\\begin_inset ";
- cell_info[i][j].inset->Write(os);
+ cell_info[i][j].inset.Write(buf, os);
os << "\n\\end_inset " << endl;
os << "</Cell>" << endl;
os << "</Column>" << endl;
}
-void LyXTabular::Read(LyXLex & lex)
+void LyXTabular::Read(Buffer const * buf, LyXLex & lex)
{
string line;
istream & is = lex.getStream();
(void)getTokenValue(line, "special", cell_info[i][j].align_special);
l_getline(is, line);
if (prefixIs(line, "\\begin_inset")) {
- cell_info[i][j].inset->Read(lex);
+ cell_info[i][j].inset.Read(buf, lex);
l_getline(is, line);
}
if (line != "</Cell>") {
}
-int LyXTabular::Latex(ostream & os, bool fragile, bool fp) const
+int LyXTabular::Latex(Buffer const * buf, ostream & os, bool fragile, bool fp) const
{
int ret = 0;
int i,j;
if (IsPartOfMultiColumn(i,j))
continue;
ret += TeXCellPreamble(os, cell);
- ret += GetCellInset(cell)->Latex(os, fragile, fp);
+ ret += GetCellInset(cell)->Latex(buf, os, fragile, fp);
ret += TeXCellPostamble(os, cell);
if (!IsLastCellInRow(cell)) { // not last cell in row
os << "&" << endl;
InsetText * LyXTabular::GetCellInset(int cell) const
{
- return cell_info[row_of_cell(cell)][column_of_cell(cell)].inset;
+ return & cell_info[row_of_cell(cell)][column_of_cell(cell)].inset;
}
void LyXTabular::Validate(LaTeXFeatures & features) const
#include "lyxlex.h"
#include "LString.h"
+#include "insets/insettext.h"
class InsetTabular;
-class InsetText;
class LaTeXFeatures;
+class Buffer;
/* The features the text class offers for tables */
LyXTabular(InsetTabular *, LyXTabular const &);
///
explicit
- LyXTabular(InsetTabular *, LyXLex & lex);
+ LyXTabular(Buffer const *, InsetTabular *, LyXLex & lex);
///
~LyXTabular();
///
///
int NumberOfCellsInRow(int cell) const;
///
- void Write(std::ostream &) const;
+ void Write(Buffer const *, std::ostream &) const;
///
- void Read(LyXLex &);
+ void Read(Buffer const *, LyXLex &);
///
void OldFormatRead(LyXLex &, string const &);
///
int TeXCellPreamble(std::ostream &, int cell) const;
int TeXCellPostamble(std::ostream &, int cell) const;
///
- int Latex(std::ostream &, bool, bool) const;
+ int Latex(Buffer const *, std::ostream &, bool, bool) const;
///
int DocBookEndOfCell(std::ostream &, int cell, int & depth) const;
#if 0
///
cellstruct();
///
+#ifdef INSET_POINTER
~cellstruct();
///
cellstruct(cellstruct const &);
///
cellstruct & operator=(cellstruct const &);
+#endif
///
int cellno;
///
///
string p_width; // this is only set for multicolumn!!!
///
- InsetText * inset;
+ InsetText inset;
};
typedef std::vector<cellstruct> cell_vector;
typedef std::vector<cell_vector> cell_vvector;
#include <config.h>
#include <cstdlib>
#include <cctype>
+#include <algorithm>
#ifdef __GNUG__
#pragma implementation "table.h"
}
+int LyXText::workWidth(BufferView * bview) const
+{
+ if (inset_owner) {
+#if 1
+ return inset_owner->getMaxWidth(bview->painter(), inset_owner);
+#else
+ LyXFont font(LyXFont::ALL_SANE);
+ return inset_owner->width(bview->painter(), font);
+#endif
+ }
+ return bview->workWidth();
+}
+
unsigned char LyXText::TransformChar(unsigned char c, Letter_Form form) const
{
if (is_arabic(c) &&
//
// Lgb
-int LyXText::SingleWidth(LyXParagraph * par,
+int LyXText::SingleWidth(BufferView * bview, LyXParagraph * par,
LyXParagraph::size_type pos) const
{
char c = par->GetChar(pos);
- return SingleWidth(par, pos, c);
+ return SingleWidth(bview, par, pos, c);
}
-int LyXText::SingleWidth(LyXParagraph * par,
+int LyXText::SingleWidth(BufferView * bview, LyXParagraph * par,
LyXParagraph::size_type pos, char c) const
{
- LyXFont font = GetFont(par, pos);
+ LyXFont font = GetFont(bview->buffer(), par, pos);
// The most common case is handled first (Asger)
if (IsPrintable(c)) {
} else if (c == LyXParagraph::META_INSET) {
Inset * tmpinset= par->GetInset(pos);
if (tmpinset)
- return par->GetInset(pos)->width(owner_->painter(),
+ return par->GetInset(pos)->width(bview->painter(),
font);
else
return 0;
}
-void LyXText::ComputeBidiTables(Row * row) const
+void LyXText::ComputeBidiTables(Buffer const * buf, Row * row) const
{
bidi_same_direction = true;
if (!lyxrc.rtl_support) {
log2vis_list[bidi_end + 1 - bidi_start] = -1;
LyXParagraph::size_type stack[2];
- bool rtl_par = row->par()->getParLanguage(buffer_->params)->RightToLeft();
+ bool rtl_par = row->par()->getParLanguage(buf->params)->RightToLeft();
int level = 0;
bool rtl = false;
bool rtl0 = false;
- LyXParagraph::size_type main_body = BeginningOfMainBody(row->par());
+ LyXParagraph::size_type main_body = BeginningOfMainBody(buf, row->par());
for (LyXParagraph::size_type lpos = bidi_start;
lpos <= bidi_end; ++lpos) {
(!row->par()->table
|| !row->par()->IsNewline(lpos + 1)) )
? lpos + 1 : lpos;
- LyXFont font = row->par()->GetFontSettings(buffer()->params,
- pos);
+ LyXFont font = row->par()->GetFontSettings(buf->params, pos);
bool new_rtl = font.isVisibleRightToLeft();
bool new_rtl0 = font.isRightToLeft();
int new_level;
// This method requires a previous call to ComputeBidiTables()
-bool LyXText::IsBoundary(LyXParagraph * par, LyXParagraph::size_type pos) const
+bool LyXText::IsBoundary(Buffer const * buf, LyXParagraph * par,
+ LyXParagraph::size_type pos) const
{
if (!lyxrc.rtl_support)
return false; // This is just for speedup
bool rtl2 = rtl;
if (pos == par->Last() ||
(par->table && par->IsNewline(pos)))
- rtl2 = par->isRightToLeftPar(buffer()->params);
+ rtl2 = par->isRightToLeftPar(buf->params);
else if (bidi_InRange(pos))
rtl2 = bidi_level(pos) % 2;
return rtl != rtl2;
}
-bool LyXText::IsBoundary(LyXParagraph * par, LyXParagraph::size_type pos,
- LyXFont const & font) const
+bool LyXText::IsBoundary(Buffer const * buf, LyXParagraph * par,
+ LyXParagraph::size_type pos,
+ LyXFont const & font) const
{
if (!lyxrc.rtl_support)
return false; // This is just for speedup
bool rtl2 = rtl;
if (pos == par->Last() ||
(par->table && par->IsNewline(pos)))
- rtl2 = par->isRightToLeftPar(buffer()->params);
+ rtl2 = par->isRightToLeftPar(buf->params);
else if (bidi_InRange(pos))
rtl2 = bidi_level(pos) % 2;
return rtl != rtl2;
}
-void LyXText::draw(Row const * row,
+void LyXText::draw(BufferView * bview, Row const * row,
LyXParagraph::size_type & vpos,
int offset, float & x)
{
- Painter & pain = owner_->painter();
+ Painter & pain = bview->painter();
LyXParagraph::size_type pos = vis2log(vpos);
char c = row->par()->GetChar(pos);
if (IsNewlineChar(c)) {
++vpos;
// Draw end-of-line marker
- LyXFont font = GetFont(row->par(), pos);
+ LyXFont font = GetFont(bview->buffer(), row->par(), pos);
int wid = lyxfont::width('n', font);
int asc = lyxfont::maxAscent(font);
int y = offset + row->baseline();
return;
}
- LyXFont font = GetFont(row->par(), pos);
+ LyXFont font = GetFont(bview->buffer(), row->par(), pos);
LyXFont font2 = font;
if (c == LyXParagraph::META_FOOTNOTE
} else if (c == LyXParagraph::META_INSET) {
Inset const * tmpinset = row->par()->GetInset(pos);
if (tmpinset) {
- tmpinset->draw(owner_->painter(), font,
+ tmpinset->draw(bview->painter(), font,
offset + row->baseline(), x);
}
++vpos;
if (lyxrc.mark_foreign_language &&
- font.language() != buffer()->params.language_info) {
+ font.language() != bview->buffer()->params.language_info) {
int y = offset + row->height() - 1;
pain.line(int(tmpx), y, int(x), y,
LColor::language);
++vpos2;
if (static_cast<unsigned char>(c = row->par()->GetChar(pos)) > ' '
&& !is_nikud(c)) {
- int width2 = SingleWidth(row->par(), pos, c);
+ int width2 = SingleWidth(bview, row->par(), pos, c);
dx = (c == 'ø' || c == 'ã')
? width2 - width : (width2 - width) / 2;
}
(pos = vis2log(vpos)) >= 0
&& static_cast<unsigned char>(c = row->par()->GetChar(pos)) > ' '
&& !is_nikud(c)
- && font2 == GetFont(row->par(), pos)) {
+ && font2 == GetFont(bview->buffer(), row->par(), pos)) {
textstring += c;
++vpos;
}
while (vpos <= last &&
(pos = vis2log(vpos)) >= 0
&& static_cast<unsigned char>(c = row->par()->GetChar(pos)) > ' '
- && font2 == GetFont(row->par(), pos)) {
+ && font2 == GetFont(bview->buffer(), row->par(), pos)) {
c = TransformChar(c, row->par(), pos);
textstring += c;
++vpos;
while (vpos <= last &&
(pos = vis2log(vpos)) >= 0
&& static_cast<unsigned char>(c = row->par()->GetChar(pos)) > ' '
- && font2 == GetFont(row->par(), pos)) {
+ && font2 == GetFont(bview->buffer(), row->par(), pos)) {
textstring += c;
++vpos;
}
int(x), offset + row->baseline() + 2);
} else if (lyxrc.mark_foreign_language &&
- font.language() != buffer()->params.language_info) {
+ font.language() != bview->buffer()->params.language_info) {
int y = offset + row->height() - 1;
pain.line(int(tmpx), y, int(x), y,
LColor::language);
// This information cannot be taken from the layouts-objekt, because in
// LaTeX the beginning of the text fits in some cases (for example sections)
// exactly the label-width.
-int LyXText::LeftMargin(Row const * row) const
+int LyXText::LeftMargin(BufferView * bview, Row const * row) const
{
LyXLayout const & layout =
- textclasslist.Style(buffer()->params.textclass,
+ textclasslist.Style(bview->buffer()->params.textclass,
row->par()->GetLayout());
string parindent = layout.parindent;
int x = LYX_PAPER_MARGIN;
x += lyxfont::signedWidth(textclasslist
- .TextClass(buffer()->params.textclass)
+ .TextClass(bview->buffer()->params.textclass)
.leftmargin(),
textclasslist
- .TextClass(buffer()->params.textclass)
+ .TextClass(bview->buffer()->params.textclass)
.defaultfont());
if (row->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
LyXParagraph * newpar = row->par()
->DepthHook(row->par()->GetDepth());
if (newpar &&
- textclasslist.Style(buffer()->params.textclass,
+ textclasslist.Style(bview->buffer()->params.textclass,
newpar->GetLayout())
.nextnoindent)
parindent.erase();
// check wether it is a sufficent paragraph
if (newpar && newpar->footnoteflag == row->par()->footnoteflag
&& textclasslist
- .Style(buffer()->params.textclass,
+ .Style(bview->buffer()->params.textclass,
newpar->GetLayout()).isEnvironment()) {
Row dummyrow;
dummyrow.par(newpar);
dummyrow.pos(newpar->Last());
- x = LeftMargin(&dummyrow);
+ x = LeftMargin(bview, &dummyrow);
} else {
// this is no longer an error, because this function
// is used to clear impossible depths after changing
parindent.erase();
else
parindent = textclasslist
- .Style(buffer()->params.textclass,
+ .Style(bview->buffer()->params.textclass,
newpar->GetLayout()).parindent;
}
}
- LyXFont labelfont = GetFont(row->par(), -2);
+ LyXFont labelfont = GetFont(bview->buffer(), row->par(), -2);
switch (layout.margintype) {
case MARGIN_DYNAMIC:
if (!layout.leftmargin.empty()) {
x += lyxfont::signedWidth(layout.leftmargin,
textclasslist
- .TextClass(buffer()->params.
+ .TextClass(bview->buffer()->params.
textclass)
.defaultfont());
}
break;
case MARGIN_MANUAL:
x += lyxfont::signedWidth(layout.labelindent, labelfont);
- if (row->pos() >= BeginningOfMainBody(row->par())) {
+ if (row->pos() >= BeginningOfMainBody(bview->buffer(), row->par())) {
if (!row->par()->GetLabelWidthString().empty()) {
x += lyxfont::width(row->par()->GetLabelWidthString(),
labelfont);
}
break;
case MARGIN_STATIC:
- x += lyxfont::signedWidth(layout.leftmargin, textclasslist.TextClass(buffer()->params.textclass).defaultfont()) * 4
+ x += lyxfont::signedWidth(layout.leftmargin, textclasslist.TextClass(bview->buffer()->params.textclass).defaultfont()) * 4
/ (row->par()->GetDepth() + 4);
break;
case MARGIN_FIRST_DYNAMIC:
if (layout.labeltype == LABEL_MANUAL) {
- if (row->pos() >= BeginningOfMainBody(row->par())) {
+ if (row->pos() >= BeginningOfMainBody(bview->buffer(), row->par())) {
x += lyxfont::signedWidth(layout.leftmargin,
labelfont);
} else {
x += lyxfont::signedWidth(layout.leftmargin,
textclasslist
- .TextClass(buffer()->params.textclass)
+ .TextClass(bview->buffer()->params.textclass)
.defaultfont());
x += minfill;
}
break;
}
- if (row->par()->pextra_type == LyXParagraph::PEXTRA_INDENT) {
+ if ((workWidth(bview) > 0) &&
+ (row->par()->pextra_type == LyXParagraph::PEXTRA_INDENT))
+ {
if (!row->par()->pextra_widthp.empty()) {
- x += paperwidth *
+ x += workWidth(bview) *
atoi(row->par()->pextra_widthp.c_str()) / 100;
} else if (!row->par()->pextra_width.empty()) {
- int xx = VSpace(row->par()->pextra_width).inPixels(owner_);
- if (xx > paperwidth)
- xx = paperwidth * 80 / 100;
+ int xx = VSpace(row->par()->pextra_width).inPixels(bview);
+ if (xx > workWidth(bview))
+ xx = workWidth(bview) * 80 / 100;
x += xx;
} else { // should not happen
LyXFont font(LyXFont::ALL_SANE);
&& align == LYX_ALIGN_BLOCK
&& !row->par()->noindent
&& (row->par()->layout ||
- buffer()->params.paragraph_separation ==
+ bview->buffer()->params.paragraph_separation ==
BufferParams::PARSEP_INDENT))
x += lyxfont::signedWidth(parindent,
textclasslist
- .TextClass(buffer()->params
+ .TextClass(bview->buffer()->params
.textclass)
.defaultfont());
else if (layout.labeltype == LABEL_BIBLIO) {
// ale970405 Right width for bibitems
- x += bibitemMaxWidth(owner_->painter(),
+ x += bibitemMaxWidth(bview->painter(),
textclasslist
- .TextClass(buffer()->params
+ .TextClass(bview->buffer()->params
.textclass)
.defaultfont());
}
}
-int LyXText::RightMargin(Row const * row) const
+int LyXText::RightMargin(Buffer const * buf, Row const * row) const
{
LyXLayout const & layout =
- textclasslist.Style(buffer()->params.textclass,
+ textclasslist.Style(buf->params.textclass,
row->par()->GetLayout());
int x = LYX_PAPER_MARGIN
+ lyxfont::signedWidth(textclasslist
- .TextClass(buffer()->params.textclass)
+ .TextClass(buf->params.textclass)
.rightmargin(),
textclasslist
- .TextClass(buffer()->params.textclass)
+ .TextClass(buf->params.textclass)
.defaultfont());
if (row->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
// check wether it is a sufficent paragraph
if (newpar && newpar->footnoteflag == row->par()->footnoteflag
- && textclasslist.Style(buffer()->params.textclass,
+ && textclasslist.Style(buf->params.textclass,
newpar->GetLayout())
.isEnvironment()) {
Row dummyrow;
dummyrow.par(newpar);
dummyrow.pos(0);
- x = RightMargin(&dummyrow);
+ x = RightMargin(buf, &dummyrow);
} else {
// this is no longer an error, because this function
// is used to clear impossible depths after changing
}
//lyxerr << "rightmargin: " << layout->rightmargin << endl;
- x += lyxfont::signedWidth(layout.rightmargin, textclasslist.TextClass(buffer()->params.textclass).defaultfont()) * 4
- / (row->par()->GetDepth() + 4);
+ x += lyxfont::signedWidth(layout.rightmargin, textclasslist
+ .TextClass(buf->params.textclass)
+ .defaultfont()) * 4 / (row->par()->GetDepth()
+ + 4);
return x;
}
-int LyXText::LabelEnd (Row const * row) const
+int LyXText::LabelEnd (BufferView * bview, Row const * row) const
{
- if (textclasslist.Style(buffer()->params.textclass,
+ if (textclasslist.Style(bview->buffer()->params.textclass,
row->par()->GetLayout()).margintype
== MARGIN_MANUAL) {
Row tmprow;
tmprow = *row;
tmprow.pos(row->par()->Last());
- return LeftMargin(&tmprow); /* just the beginning
+ return LeftMargin(bview, &tmprow); /* just the beginning
of the main body */
} else
return 0; /* LabelEnd is only needed, if the
}
-int LyXText::WidthOfCell(LyXParagraph * par,
+int LyXText::WidthOfCell(BufferView * bview, LyXParagraph * par,
LyXParagraph::size_type & pos) const
{
int w = 0;
while (pos < par->Last() && !par->IsNewline(pos)) {
- w += SingleWidth(par, pos);
+ w += SingleWidth(bview, par, pos);
++pos;
}
if (par->IsNewline(pos))
#ifndef NEW_TABULAR
-bool LyXText::HitInTable(Row * row, int x) const
+bool LyXText::HitInTable(BufferView * bview, Row * row, int x) const
{
float tmpx;
float fill_separator, fill_hfill, fill_label_hfill;
if (!row->par()->table)
return false;
- PrepareToPrint(row, tmpx, fill_separator,
+ PrepareToPrint(bview, row, tmpx, fill_separator,
fill_hfill, fill_label_hfill, false);
return (x > tmpx && x < tmpx + row->par()->table->WidthOfTable());
}
#endif
-bool LyXText::MouseHitInTable(int x, long y) const
+bool LyXText::MouseHitInTable(BufferView * bview, int x, long y) const
{
Row * row = GetRowNearY(y);
- return HitInTable(row, x);
+ return HitInTable(bview, row, x);
}
// get the next breakpoint in a given paragraph
LyXParagraph::size_type
-LyXText::NextBreakPoint(Row const * row, int width) const
+LyXText::NextBreakPoint(BufferView * bview, Row const * row, int width) const
{
LyXParagraph * par = row->par();
LyXParagraph::size_type pos = row->pos();
+ if (width < 0)
+ return par->Last();
#ifndef NEW_TABULAR
/* table stuff -- begin*/
if (par->table) {
// position of the last possible breakpoint
// -1 isn't a suitable value, but a flag
LyXParagraph::size_type last_separator = -1;
- width -= RightMargin(row);
+ width -= RightMargin(bview->buffer(), row);
- LyXParagraph::size_type main_body = BeginningOfMainBody(par);
+ LyXParagraph::size_type main_body = BeginningOfMainBody(bview->buffer(), par);
LyXLayout const & layout =
- textclasslist.Style(buffer()->params.textclass, par->GetLayout());
+ textclasslist.Style(bview->buffer()->params.textclass, par->GetLayout());
LyXParagraph::size_type i = pos;
if (layout.margintype == MARGIN_RIGHT_ADDRESS_BOX) {
LyXParagraph::size_type const last =
par->Last();
// this is the usual handling
- int x = LeftMargin(row);
+ int x = LeftMargin(bview, row);
while (x < width && i < last) {
char c = par->GetChar(i);
if (IsNewlineChar(c)) {
// non-display
if (layout.isCommand()
|| (layout.labeltype == LABEL_MANUAL
- && i < BeginningOfMainBody(par))){
+ && i < BeginningOfMainBody(bview->buffer(), par))){
// display istn't allowd
par->GetInset(i)->display(false);
- x += SingleWidth(par, i, c);
+ x += SingleWidth(bview, par, i, c);
} else {
// inset is display. So break the line here
if (i == pos){
} else {
if (IsLineSeparatorChar(c))
last_separator = i;
- x += SingleWidth(par, i, c);
+ x += SingleWidth(bview, par, i, c);
}
++i;
if (i == main_body) {
x += lyxfont::width(layout.labelsep,
- GetFont(par, -2));
+ GetFont(bview->buffer(), par, -2));
if (par->IsLineSeparator(i - 1))
- x-= SingleWidth(par, i - 1);
- int left_margin = LabelEnd(row);
+ x-= SingleWidth(bview, par, i - 1);
+ int left_margin = LabelEnd(bview, row);
if (x < left_margin)
x = left_margin;
}
// returns the minimum space a row needs on the screen in pixel
-int LyXText::Fill(Row * row, int paper_width) const
+int LyXText::Fill(BufferView * bview, Row * row, int paper_width) const
{
+ if (paper_width < 0)
+ return 0;
+
int w, fill;
// get the pure distance
LyXParagraph::size_type last = RowLastPrintable(row);
w = 0;
do {
row->par()->table->SetWidthOfCell(cell,
- WidthOfCell(row->par(),
+ WidthOfCell(bview,
+ row->par(),
pos));
++cell;
} while (pos <= last && !row->par()->table->IsFirstCell(cell));
// don't forget the very last table cell without characters
if (cell == row->par()->table->GetNumberOfCells() - 1)
row->par()->table->SetWidthOfCell(cell,
- WidthOfCell(row->par(),
+ WidthOfCell(bview,
+ row->par(),
pos));
return 0; /* width of table cannot be returned since
#endif
// special handling of the right address boxes
- if (textclasslist.Style(buffer()->params.textclass,
+ if (textclasslist.Style(bview->buffer()->params.textclass,
row->par()->GetLayout()).margintype
== MARGIN_RIGHT_ADDRESS_BOX) {
int tmpfill = row->fill();
row->fill(0); // the minfill in MarginLeft()
- w = LeftMargin(row);
+ w = LeftMargin(bview, row);
row->fill(tmpfill);
} else
- w = LeftMargin(row);
+ w = LeftMargin(bview, row);
- LyXLayout const & layout = textclasslist.Style(buffer()->params.textclass,
+ LyXLayout const & layout = textclasslist.Style(bview->buffer()->params.textclass,
row->par()->GetLayout());
LyXParagraph::size_type main_body =
- BeginningOfMainBody(row->par());
+ BeginningOfMainBody(bview->buffer(), row->par());
LyXParagraph::size_type i = row->pos();
while (i <= last) {
if (main_body > 0 && i == main_body) {
- w += lyxfont::width(layout.labelsep, GetFont(row->par(), -2));
+ w += lyxfont::width(layout.labelsep, GetFont(bview->buffer(), row->par(), -2));
if (row->par()->IsLineSeparator(i - 1))
- w -= SingleWidth(row->par(), i - 1);
- int left_margin = LabelEnd(row);
+ w -= SingleWidth(bview, row->par(), i - 1);
+ int left_margin = LabelEnd(bview, row);
if (w < left_margin)
w = left_margin;
}
- w += SingleWidth(row->par(), i);
+ w += SingleWidth(bview, row->par(), i);
++i;
}
if (main_body > 0 && main_body > last) {
- w += lyxfont::width(layout.labelsep, GetFont(row->par(), -2));
+ w += lyxfont::width(layout.labelsep, GetFont(bview->buffer(), row->par(), -2));
if (last >= 0 && row->par()->IsLineSeparator(last))
- w -= SingleWidth(row->par(), last);
- int left_margin = LabelEnd(row);
+ w -= SingleWidth(bview, row->par(), last);
+ int left_margin = LabelEnd(bview, row);
if (w < left_margin)
w = left_margin;
}
- fill = paper_width - w - RightMargin(row);
+ fill = paper_width - w - RightMargin(bview->buffer(), row);
return fill;
}
// returns the minimum space a manual label needs on the screen in pixel
-int LyXText::LabelFill(Row const * row) const
+int LyXText::LabelFill(BufferView * bview, Row const * row) const
{
- LyXParagraph::size_type last = BeginningOfMainBody(row->par()) - 1;
+ LyXParagraph::size_type last = BeginningOfMainBody(bview->buffer(), row->par())-1;
// -1 because a label ends either with a space that is in the label,
// or with the beginning of a footnote that is outside the label.
int w = 0;
int i = row->pos();
while (i <= last) {
- w += SingleWidth(row->par(), i);
+ w += SingleWidth(bview, row->par(), i);
++i;
}
int fill = 0;
if (!row->par()->labelwidthstring.empty()) {
fill = max(lyxfont::width(row->par()->labelwidthstring,
- GetFont(row->par(), -2)) - w,
+ GetFont(bview->buffer(), row->par(), -2)) - w,
0);
}
// returns the number of separators in the specified row. The separator
// on the very last column doesnt count
-int LyXText::NumberOfSeparators(Row const * row) const
+int LyXText::NumberOfSeparators(Buffer const * buf, Row const * row) const
{
int last = RowLast(row);
- int p = max(row->pos(), BeginningOfMainBody(row->par()));
+ int p = max(row->pos(), BeginningOfMainBody(buf, row->par()));
int n = 0;
for (; p < last; ++p) {
if (row->par()->IsSeparator(p)) {
// returns the number of hfills in the specified row. The LyX-Hfill is
// a LaTeX \hfill so that the hfills at the beginning and at the end were
// ignored. This is *MUCH* more usefull than not to ignore!
-int LyXText::NumberOfHfills(Row const * row) const
+int LyXText::NumberOfHfills(Buffer const * buf, Row const * row) const
{
int last = RowLast(row);
int first = row->pos();
++first;
}
- first = max(first, BeginningOfMainBody(row->par()));
+ first = max(first, BeginningOfMainBody(buf, row->par()));
int n = 0;
for (int p = first; p <= last; ++p) { // last, because the end is ignored!
if (row->par()->IsHfill(p)) {
// like NumberOfHfills, but only those in the manual label!
-int LyXText::NumberOfLabelHfills(Row const * row) const
+int LyXText::NumberOfLabelHfills(Buffer const * buf, Row const * row) const
{
LyXParagraph::size_type last = RowLast(row);
LyXParagraph::size_type first = row->pos();
++first;
}
- last = min(last, BeginningOfMainBody(row->par()));
+ last = min(last, BeginningOfMainBody(buf, row->par()));
int n = 0;
for (LyXParagraph::size_type p = first;
p < last; ++p) { // last, because the end is ignored!
// returns true, if a expansion is needed.
// Rules are given by LaTeX
-bool LyXText::HfillExpansion(Row const * row_ptr,
+bool LyXText::HfillExpansion(Buffer const * buf, Row const * row_ptr,
LyXParagraph::size_type pos) const
{
// by the way, is it a hfill?
return true;
// in some labels it does not count
- if (textclasslist.Style(buffer()->params.textclass,
+ if (textclasslist.Style(buf->params.textclass,
row_ptr->par()->GetLayout()).margintype
!= MARGIN_MANUAL
- && pos < BeginningOfMainBody(row_ptr->par()))
+ && pos < BeginningOfMainBody(buf, row_ptr->par()))
return false;
// if there is anything between the first char of the row and
}
-void LyXText::SetHeightOfRow(Row * row_ptr) const
+void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
{
/* get the maximum ascent and the maximum descent */
int asc = 0, desc = 0, pos = 0;
LyXParagraph * par = row_ptr->par()->LastPhysicalPar();
LyXParagraph * firstpar = row_ptr->par()->FirstPhysicalPar();
- LyXLayout const & layout = textclasslist.Style(buffer()->params.textclass,
+ LyXLayout const & layout = textclasslist.Style(bview->buffer()->params.textclass,
firstpar->GetLayout());
- LyXFont font = GetFont(par, par->Last() - 1);
+ LyXFont font = GetFont(bview->buffer(), par, par->Last() - 1);
LyXFont::FONT_SIZE size = font.size();
- font = GetFont(par, -1);
+ font = GetFont(bview->buffer(), par, -1);
font.setSize(size);
- LyXFont labelfont = GetFont(par, -2);
+ LyXFont labelfont = GetFont(bview->buffer(), par, -2);
float spacing_val = 1.0;
if (!row_ptr->par()->spacing.isDefault()) {
spacing_val = row_ptr->par()->spacing.getValue();
} else {
- spacing_val = buffer()->params.spacing.getValue();
+ spacing_val = bview->buffer()->params.spacing.getValue();
}
//lyxerr << "spacing_val = " << spacing_val << endl;
// Check if any insets are larger
for (pos = row_ptr->pos(); pos <= pos_end; ++pos) {
if (row_ptr->par()->GetChar(pos) == LyXParagraph::META_INSET) {
- tmpfont = GetFont(row_ptr->par(), pos);
+ tmpfont = GetFont(bview->buffer(), row_ptr->par(), pos);
tmpinset = row_ptr->par()->GetInset(pos);
if (tmpinset) {
- asc = tmpinset->ascent(owner_->painter(), tmpfont);
- desc = tmpinset->descent(owner_->painter(), tmpfont);
+ asc = tmpinset->ascent(bview->painter(), tmpfont);
+ desc = tmpinset->descent(bview->painter(), tmpfont);
if (asc > maxasc)
maxasc = asc;
if (desc > maxdesc)
row_ptr->ascent_of_text(maxasc);
/* is it a top line? */
- if (row_ptr->pos() == 0
- && row_ptr->par() == firstpar) {
+ if (!row_ptr->pos() && (row_ptr->par() == firstpar)) {
/* some parksips VERY EASY IMPLEMENTATION */
- if (buffer()->params.paragraph_separation == BufferParams::PARSEP_SKIP) {
+ if (bview->buffer()->params.paragraph_separation ==
+ BufferParams::PARSEP_SKIP) {
if (layout.isParagraph()
&& firstpar->GetDepth() == 0
&& firstpar->Previous())
- maxasc += buffer()->params.getDefSkip().inPixels(owner_);
+ maxasc += bview->buffer()->params.getDefSkip().inPixels(bview);
else if (firstpar->Previous()
- && textclasslist.Style(buffer()->params.textclass,
+ && textclasslist.Style(bview->buffer()->params.textclass,
firstpar->Previous()->GetLayout()).isParagraph()
&& firstpar->Previous()->GetDepth() == 0)
// is it right to use defskip here too? (AS)
- maxasc += buffer()->params.getDefSkip().inPixels(owner_);
+ maxasc += bview->buffer()->params.getDefSkip().inPixels(bview);
}
/* the paper margins */
- if (!row_ptr->par()->previous)
+ if (!row_ptr->par()->previous && bv_owner)
maxasc += LYX_PAPER_MARGIN;
/* add the vertical spaces, that the user added */
if (firstpar->added_space_top.kind() != VSpace::NONE)
- maxasc += int(firstpar->added_space_top.inPixels(owner_));
+ maxasc += int(firstpar->added_space_top.inPixels(bview));
/* do not forget the DTP-lines!
* there height depends on the font of the nearest character */
if (firstpar->line_top)
- maxasc += 2 * lyxfont::ascent('x', GetFont(firstpar, 0));
+ maxasc += 2 * lyxfont::ascent('x', GetFont(bview->buffer(),
+ firstpar, 0));
/* and now the pagebreaks */
if (firstpar->pagebreak_top)
/* this is special code for the chapter, since the label of this
* layout is printed in an extra row */
if (layout.labeltype == LABEL_COUNTER_CHAPTER
- && buffer()->params.secnumdepth >= 0) {
+ && bview->buffer()->params.secnumdepth >= 0) {
float spacing_val = 1.0;
if (!row_ptr->par()->spacing.isDefault()) {
spacing_val = row_ptr->par()->spacing.getValue();
} else {
- spacing_val = buffer()->params.spacing.getValue();
+ spacing_val = bview->buffer()->params.spacing.getValue();
}
labeladdon = int(lyxfont::maxDescent(labelfont) *
if (!row_ptr->par()->spacing.isDefault()) {
spacing_val = row_ptr->par()->spacing.getValue();
} else {
- spacing_val = buffer()->params.spacing.getValue();
+ spacing_val = bview->buffer()->params.spacing.getValue();
}
labeladdon = int(
tmptop = layout.topsep;
if (row_ptr->previous()->par()->GetDepth() >= row_ptr->par()->GetDepth())
- tmptop -= textclasslist.Style(buffer()->params.textclass, row_ptr->previous()->par()->GetLayout()).bottomsep;
+ tmptop -= textclasslist.Style(bview->buffer()->params.textclass,
+ row_ptr->previous()->par()->
+ GetLayout()).bottomsep;
if (tmptop > 0)
layoutasc = (tmptop * DefaultHeight());
prev = row_ptr->par()->DepthHook(row_ptr->par()->GetDepth()-1);
if (prev) {
- maxasc += int(textclasslist.Style(buffer()->params.textclass,
+ maxasc += int(textclasslist.Style(bview->buffer()->params.textclass,
prev->GetLayout()).parsep * DefaultHeight());
}
else {
/* add the vertical spaces, that the user added */
if (firstpar->added_space_bottom.kind() != VSpace::NONE)
- maxdesc += int(firstpar->added_space_bottom.inPixels(owner_));
+ maxdesc += int(firstpar->added_space_bottom.inPixels(bview));
/* do not forget the DTP-lines!
* there height depends on the font of the nearest character */
if (firstpar->line_bottom)
- maxdesc += 2 * lyxfont::ascent('x', GetFont(par, par->Last() - 1));
+ maxdesc += 2 * lyxfont::ascent('x', GetFont(bview->buffer(),
+ par, par->Last() - 1));
/* and now the pagebreaks */
if (firstpar->pagebreak_bottom)
float unusual = 0;
if (comparepar->GetDepth() > nextpar->GetDepth()) {
- usual = (textclasslist.Style(buffer()->params.textclass, comparepar->GetLayout()).bottomsep * DefaultHeight());
+ usual = (textclasslist.Style(bview->buffer()->params.textclass, comparepar->GetLayout()).bottomsep * DefaultHeight());
comparepar = comparepar->DepthHook(nextpar->GetDepth());
if (comparepar->GetLayout()!= nextpar->GetLayout()
|| nextpar->GetLabelWidthString() !=
comparepar->GetLabelWidthString())
- unusual = (textclasslist.Style(buffer()->params.textclass, comparepar->GetLayout()).bottomsep * DefaultHeight());
+ unusual = (textclasslist.Style(bview->buffer()->params.textclass, comparepar->GetLayout()).bottomsep * DefaultHeight());
if (unusual > usual)
layoutdesc = unusual;
if (comparepar->GetLayout()!= nextpar->GetLayout()
|| nextpar->GetLabelWidthString() !=
comparepar->GetLabelWidthString())
- layoutdesc = int(textclasslist.Style(buffer()->params.textclass, comparepar->GetLayout()).bottomsep * DefaultHeight());
+ layoutdesc = int(textclasslist.Style(bview->buffer()->params.textclass, comparepar->GetLayout()).bottomsep * DefaultHeight());
}
}
}
/* Appends the implicit specified paragraph behind the specified row,
* start at the implicit given position */
-void LyXText::AppendParagraph(Row * row) const
+void LyXText::AppendParagraph(BufferView * bview, Row * row) const
{
bool not_ready = true;
do {
// Get the next breakpoint
- int z = NextBreakPoint(row, paperwidth);
+ int z = NextBreakPoint(bview, row, workWidth(bview));
Row * tmprow = row;
not_ready = false;
// Set the dimensions of the row
- tmprow->fill(Fill(tmprow, paperwidth));
- SetHeightOfRow(tmprow);
+ tmprow->fill(Fill(bview, tmprow, workWidth(bview)));
+ SetHeightOfRow(bview, tmprow);
} while (not_ready);
}
-void LyXText::BreakAgain(Row * row) const
+void LyXText::BreakAgain(BufferView * bview, Row * row) const
{
bool not_ready = true;
do {
/* get the next breakpoint */
- LyXParagraph::size_type z =
- NextBreakPoint(row, paperwidth);
+ LyXParagraph::size_type z = NextBreakPoint(bview, row, workWidth(bview));
Row * tmprow = row;
if (z < row->par()->Last() ) {
}
/* set the dimensions of the row */
- tmprow->fill(Fill(tmprow, paperwidth));
- SetHeightOfRow(tmprow);
+ tmprow->fill(Fill(bview, tmprow, workWidth(bview)));
+ SetHeightOfRow(bview, tmprow);
} while (not_ready);
}
// this is just a little changed version of break again
-void LyXText::BreakAgainOneRow(Row * row)
+void LyXText::BreakAgainOneRow(BufferView * bview, Row * row)
{
// get the next breakpoint
- LyXParagraph::size_type z = NextBreakPoint(row, paperwidth);
+ LyXParagraph::size_type z = NextBreakPoint(bview, row, workWidth(bview));
Row * tmprow = row;
if (z < row->par()->Last() ) {
}
// set the dimensions of the row
- tmprow->fill(Fill(tmprow, paperwidth));
- SetHeightOfRow(tmprow);
+ tmprow->fill(Fill(bview, tmprow, workWidth(bview)));
+ SetHeightOfRow(bview, tmprow);
}
-void LyXText::BreakParagraph(char keep_layout)
+void LyXText::BreakParagraph(BufferView * bview, char keep_layout)
{
- LyXLayout const & layout = textclasslist.Style(buffer()->params.textclass,
+ LyXLayout const & layout = textclasslist.Style(bview->buffer()->params.textclass,
cursor.par()->GetLayout());
#ifndef NEW_TABULAR
/* table stuff -- begin */
layout.labeltype!= LABEL_SENSITIVE)
return;
- SetUndo(Undo::INSERT,
+ SetUndo(bview->buffer(), Undo::INSERT,
cursor.par()->ParFromPos(cursor.pos())->previous,
cursor.par()->ParFromPos(cursor.pos())->next);
if (cursor.par()->table) {
int cell = NumberOfCell(cursor.par(), cursor.pos());
if (cursor.par()->table->ShouldBeVeryLastCell(cell))
- SetCursor(cursor.par(), cursor.par()->size());
+ SetCursor(bview, cursor.par(), cursor.par()->size());
}
/* table stuff -- end */
#endif
keep_layout = 2;
else
keep_layout = layout.isEnvironment();
- cursor.par()->BreakParagraph(buffer()->params, cursor.pos(), keep_layout);
+ cursor.par()->BreakParagraph(bview->buffer()->params, cursor.pos(),
+ keep_layout);
#ifndef NEW_TABULAR
/* table stuff -- begin */
if (cursor.par()->table){
// well this is the caption hack since one caption is really enough
if (layout.labeltype == LABEL_SENSITIVE) {
if (!cursor.pos())
- cursor.par()->SetLayout(buffer()->params, 0); // set to standard-layout
+ // set to standard-layout
+ cursor.par()->SetLayout(bview->buffer()->params, 0);
else
- cursor.par()->Next()->SetLayout(buffer()->params, 0); // set to standard-layout
+ // set to standard-layout
+ cursor.par()->Next()->SetLayout(bview->buffer()->params, 0);
}
/* if the cursor is at the beginning of a row without prior newline,
* an empty row on the screen */
if (cursor.pos() && !cursor.row()->par()->IsNewline(cursor.row()->pos() - 1) &&
cursor.row()->pos() == cursor.pos()) {
- CursorLeft();
+ CursorLeft(bview);
}
status = LyXText::NEED_MORE_REFRESH;
if (layout.margintype == MARGIN_RIGHT_ADDRESS_BOX) {
while (refresh_row->previous() &&
refresh_row->previous()->par() == refresh_row->par()) {
- refresh_row = refresh_row->previous();
- refresh_y -= refresh_row->height();
- }
+ refresh_row = refresh_row->previous();
+ refresh_y -= refresh_row->height();
+ }
}
RemoveParagraph(cursor.row());
// set the dimensions of the cursor row
- cursor.row()->fill(Fill(cursor.row(), paperwidth));
+ cursor.row()->fill(Fill(bview, cursor.row(), workWidth(bview)));
- SetHeightOfRow(cursor.row());
+ SetHeightOfRow(bview, cursor.row());
while (!cursor.par()->Next()->table && cursor.par()->Next()->Last()
&& cursor.par()->Next()->IsNewline(0))
- cursor.par()->Next()->Erase(0);
+ cursor.par()->Next()->Erase(0);
- InsertParagraph(cursor.par()->Next(), cursor.row());
+ InsertParagraph(bview, cursor.par()->Next(), cursor.row());
- UpdateCounters(cursor.row()->previous());
+ UpdateCounters(bview, cursor.row()->previous());
/* This check is necessary. Otherwise the new empty paragraph will
* be deleted automatically. And it is more friendly for the user! */
if (cursor.pos())
- SetCursor(cursor.par()->Next(), 0);
+ SetCursor(bview, cursor.par()->Next(), 0);
else
- SetCursor(cursor.par(), 0);
+ SetCursor(bview, cursor.par(), 0);
if (cursor.row()->next())
- BreakAgain(cursor.row()->next());
+ BreakAgain(bview, cursor.row()->next());
need_break_row = 0;
}
-void LyXText::OpenFootnote()
+void LyXText::OpenFootnote(BufferView * bview)
{
LyXParagraph * endpar,* tmppar;
Row * row;
}
/* now the cursor is at the beginning of the physical par */
- SetCursor(cursor.par(),
+ SetCursor(bview, cursor.par(),
cursor.pos() + cursor.par()->ParFromPos(cursor.pos())->size());
/* the cursor must be exactly before the footnote */
tmppar->OpenFootnote(cursor.pos());
RemoveParagraph(row);
/* set the dimensions of the cursor row */
- row->fill(Fill(row, paperwidth));
- SetHeightOfRow(row);
+ row->fill(Fill(bview, row, workWidth(bview)));
+ SetHeightOfRow(bview, row);
// CHECK See comment on top of text.C
tmppar = tmppar->Next();
while (tmppar != endpar) {
if (tmppar) {
- InsertParagraph(tmppar, row);
+ InsertParagraph(bview, tmppar, row);
while (row->next() && row->next()->par() == tmppar)
row = row->next();
tmppar = tmppar->Next();
}
}
- SetCursor(par->next, 0);
+ SetCursor(bview, par->next, 0);
sel_cursor = cursor;
}
/* table stuff -- begin*/
-void LyXText::TableFeatures(int feature, string const & val) const
+void LyXText::TableFeatures(BufferView * bview, int feature, string const & val) const
{
if (!cursor.par()->table)
return; /* this should never happen */
int actCell = NumberOfCell(cursor.par(), cursor.pos());
- SetUndo(Undo::FINISH,
+ SetUndo(bview->buffer(), Undo::FINISH,
cursor.par()->ParFromPos(cursor.pos())->previous,
cursor.par()->ParFromPos(cursor.pos())->next);
default:
break;
}
- RedoParagraph();
+ RedoParagraph(bview);
}
-void LyXText::TableFeatures(int feature) const
+void LyXText::TableFeatures(BufferView * bview, int feature) const
{
int setLines = 0;
int setAlign = LYX_ALIGN_LEFT;
return; /* this should never happen */
int actCell = NumberOfCell(cursor.par(), cursor.pos());
- SetUndo(Undo::FINISH,
+ SetUndo(bview->buffer(), Undo::FINISH,
cursor.par()->ParFromPos(cursor.pos())->previous,
cursor.par()->ParFromPos(cursor.pos())->next);
/* insert the new cells */
int number = cursor.par()->table->NumberOfCellsInRow(cell_org);
- Language const * lang = cursor.par()->getParLanguage(buffer()->params);
+ Language const * lang = cursor.par()->getParLanguage(bview->buffer()->params);
LyXFont font(LyXFont::ALL_INHERIT,lang);
for (int i = 0; i < number; ++i) {
cursor.par()->InsertChar(pos, LyXParagraph::META_NEWLINE);
/* append the row into the table */
cursor.par()->table->AppendRow(cell_org);
- RedoParagraph();
+ RedoParagraph(bview);
return;
}
case LyXTable::APPEND_CONT_ROW: {
if (cursor.par()->table->RowHasContRow(cell_org) &&
(cursor.par()->table->CellHasContRow(cell_org)<0)) {
cursor.par()->table->AppendContRow(cell_org);
- RedoParagraph();
+ RedoParagraph(bview);
return;
}
while (pos < cursor.par()->Last() &&
/* insert the new cells */
int number = cursor.par()->table->NumberOfCellsInRow(cell_org);
- Language const * lang = cursor.par()->getParLanguage(buffer()->params);
+ Language const * lang = cursor.par()->getParLanguage(bview->buffer()->params);
LyXFont font(LyXFont::ALL_INHERIT,lang);
for (int i = 0; i < number; ++i) {
cursor.par()->InsertChar(pos, LyXParagraph::META_NEWLINE);
/* append the row into the table */
cursor.par()->table->AppendContRow(cell_org);
- RedoParagraph();
+ RedoParagraph(bview);
return;
}
case LyXTable::APPEND_COLUMN: {
LyXParagraph::size_type pos = 0;
int cell_org = actCell;
int cell = 0;
- Language const * lang = cursor.par()->getParLanguage(buffer()->params);
+ Language const * lang = cursor.par()->getParLanguage(bview->buffer()->params);
LyXFont font(LyXFont::ALL_INHERIT,lang);
do{
if (pos && (cursor.par()->IsNewline(pos-1))){
/* append the column into the table */
cursor.par()->table->AppendColumn(cell_org);
- RedoParagraph();
+ RedoParagraph(bview);
return;
}
case LyXTable::DELETE_ROW:
- if (owner_->the_locking_inset)
- owner_->unlockInset(owner_->the_locking_inset);
+ if (bview->the_locking_inset)
+ bview->unlockInset(bview->the_locking_inset);
RemoveTableRow(cursor);
- RedoParagraph();
+ RedoParagraph(bview);
return;
case LyXTable::DELETE_COLUMN: {
LyXParagraph::size_type pos = 0;
int cell_org = actCell;
int cell = 0;
- if (owner_->the_locking_inset)
- owner_->unlockInset(owner_->the_locking_inset);
+ if (bview->the_locking_inset)
+ bview->unlockInset(bview->the_locking_inset);
do {
if (!pos || (cursor.par()->IsNewline(pos-1))){
if (cursor.par()->table->DeleteCellIfColumnIsDeleted(cell, cell_org)){
/* set the cursor to the beginning of the table, where else? */
cursor.pos(0);
- RedoParagraph();
+ RedoParagraph(bview);
return;
}
case LyXTable::TOGGLE_LINE_TOP:
}
}
}
- RedoParagraph();
+ RedoParagraph(bview);
return;
case LyXTable::TOGGLE_LINE_BOTTOM:
}
}
}
- RedoParagraph();
+ RedoParagraph(bview);
return;
case LyXTable::TOGGLE_LINE_LEFT:
}
}
}
- RedoParagraph();
+ RedoParagraph(bview);
return;
case LyXTable::TOGGLE_LINE_RIGHT:
}
}
}
- RedoParagraph();
+ RedoParagraph(bview);
return;
case LyXTable::ALIGN_LEFT:
}
}
}
- RedoParagraph();
+ RedoParagraph(bview);
return;
case LyXTable::DELETE_TABLE:
- SetCursorIntern(cursor.par(), 0);
+ SetCursorIntern(bview, cursor.par(), 0);
delete cursor.par()->table;
cursor.par()->table = 0;
// temporary: Should put table in simple_cut_buffer (with before and after
for (LyXParagraph::size_type i =
cursor.par()->size() - 1; i >= 0; --i)
cursor.par()->Erase(i);
- RedoParagraph();
+ RedoParagraph(bview);
return;
case LyXTable::MULTICOLUMN: {
++pos;
for (; newlines; --newlines)
cursor.par()->InsertChar(pos, LyXParagraph::META_NEWLINE);
- RedoParagraph();
+ RedoParagraph(bview);
return;
}
else {
cursor.par()->table->SetMultiColumn(NumberOfCell(cursor.par(),
cursor.pos()),
1);
- RedoParagraph();
+ RedoParagraph(bview);
return;
}
else {
sel_start_cursor.pos()),
number);
cursor.pos(sel_start_cursor.pos());
- RedoParagraph();
+ RedoParagraph(bview);
return;
}
else {
}
}
}
- RedoParagraph();
+ RedoParagraph(bview);
return;
case LyXTable::SET_LONGTABLE:
cursor.par()->table->SetLongTable(true);
}
-void LyXText::InsertCharInTable(char c)
+void LyXText::InsertCharInTable(BufferView * bview, char c)
{
Row * row = 0;
Row * tmprow = 0;
// Get the font that is used to calculate the baselineskip
LyXParagraph::size_type const lastpos =
cursor.par()->Last();
- LyXFont rawparfont = cursor.par()->GetFontSettings(buffer()->params,
- lastpos - 1);
+ LyXFont rawparfont = cursor.par()->GetFontSettings(bview->buffer()->params,
+ lastpos - 1);
jumped_over_space = false;
if (IsLineSeparatorChar(c)) {
return;
} else if (IsNewlineChar(c)) {
if (!IsEmptyTableCell()) {
- TableFeatures(LyXTable::APPEND_CONT_ROW);
- CursorDown();
+ TableFeatures(bview, LyXTable::APPEND_CONT_ROW);
+ CursorDown(bview);
}
return;
}
if (c != LyXParagraph::META_INSET) /* in this case LyXText::InsertInset
* already inserted the character */
cursor.par()->InsertChar(cursor.pos(), c);
- SetCharFont(cursor.par(), cursor.pos(), rawtmpfont);
+ SetCharFont(bview->buffer(), cursor.par(), cursor.pos(), rawtmpfont);
if (!jumped_over_space) {
/* refresh the positions */
cursor.pos(cursor.pos() + 1);
- CheckParagraphInTable(cursor.par(), cursor.pos());
+ CheckParagraphInTable(bview, cursor.par(), cursor.pos());
current_font = rawtmpfont;
real_current_font = realtmpfont;
/* check, whether the last character's font has changed. */
if (cursor.pos() && cursor.pos() == cursor.par()->Last()
&& rawparfont != rawtmpfont)
- RedoHeightOfParagraph(cursor);
+ RedoHeightOfParagraph(bview, cursor);
}
-void LyXText::CheckParagraphInTable(LyXParagraph * par,
+void LyXText::CheckParagraphInTable(BufferView * bview, LyXParagraph * par,
LyXParagraph::size_type pos)
{
Row * row = GetRow(par, pos, y);
int tmpheight = row->height();
- SetHeightOfRow(row);
+ SetHeightOfRow(bview, row);
LyXParagraph::size_type tmp_pos = pos;
/* update the table information */
while (tmp_pos && !par->IsNewline(tmp_pos - 1))
--tmp_pos;
if (par->table->SetWidthOfCell(NumberOfCell(par, pos),
- WidthOfCell(par, tmp_pos))) {
+ WidthOfCell(bview, par, tmp_pos))) {
LyXCursor tmpcursor = cursor;
- SetCursorIntern(par, pos, false);
+ SetCursorIntern(bview, par, pos, false);
/* make a complete redraw */
- RedoDrawingOfParagraph(cursor);
+ RedoDrawingOfParagraph(bview, cursor);
cursor = tmpcursor;
}
else {
/* redraw only the row */
LyXCursor tmpcursor = cursor;
- SetCursorIntern(par, pos);
+ SetCursorIntern(bview, par, pos);
//CHECK See comment on top of text.C
refresh_y = y;
refresh_x = cursor.x();
else
status = LyXText::NEED_MORE_REFRESH;
}
- SetCursorIntern(cursor.par(), cursor.pos(), false, cursor.boundary());
+ SetCursorIntern(bview, cursor.par(), cursor.pos(), false,
+ cursor.boundary());
}
-void LyXText::BackspaceInTable()
+void LyXText::BackspaceInTable(BufferView * bview)
{
Row * tmprow, * row;
long y;
// Get the font that is used to calculate the baselineskip
int const lastpos = cursor.par()->Last();
- LyXFont rawparfont = cursor.par()->GetFontSettings(buffer()->params,
- lastpos - 1);
+ LyXFont rawparfont = cursor.par()->GetFontSettings(bview->buffer()->params,
+ lastpos - 1);
if (cursor.pos() == 0) {
/* no pasting of table paragraphs */
- CursorLeft();
+ CursorLeft(bview);
} else {
/* this is the code for a normal backspace, not pasting
* any paragraphs */
- SetUndo(Undo::DELETE,
+ SetUndo(bview->buffer(), Undo::DELETE,
cursor.par()->ParFromPos(cursor.pos())->previous,
cursor.par()->ParFromPos(cursor.pos())->next);
- CursorLeftIntern();
+ CursorLeftIntern(bview);
/* some insets are undeletable here */
if (cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET) {
}
}
- CheckParagraphInTable(cursor.par(), cursor.pos());
+ CheckParagraphInTable(bview, cursor.par(), cursor.pos());
/* check, wether the last characters font has changed. */
if (cursor.pos() && cursor.pos() == cursor.par()->Last()
&& rawparfont != rawtmpfont)
- RedoHeightOfParagraph(cursor);
+ RedoHeightOfParagraph(bview, cursor);
/* restore the current font
* That is what a user expects! */
current_font = rawtmpfont;
real_current_font = realtmpfont;
}
- SetCursorIntern(cursor.par(), cursor.pos(), true, cursor.boundary());
- if (IsBoundary(cursor.par(), cursor.pos()) != cursor.boundary())
- SetCursor(cursor.par(), cursor.pos(), false, !cursor.boundary());
+ SetCursorIntern(bview, cursor.par(), cursor.pos(), true,
+ cursor.boundary());
+ if (IsBoundary(bview->buffer(), cursor.par(), cursor.pos()) != cursor.boundary())
+ SetCursor(bview, cursor.par(), cursor.pos(), false, !cursor.boundary());
}
/* table stuff -- end*/
// Just a macro to make some thing easier.
-void LyXText::RedoParagraph() const
+void LyXText::RedoParagraph(BufferView * bview) const
{
ClearSelection();
- RedoParagraphs(cursor, cursor.par()->Next());
- SetCursorIntern(cursor.par(), cursor.pos());
+ RedoParagraphs(bview, cursor, cursor.par()->Next());
+ SetCursorIntern(bview, cursor.par(), cursor.pos());
}
/* insert a character, moves all the following breaks in the
* same Paragraph one to the right and make a rebreak */
-void LyXText::InsertChar(char c)
+void LyXText::InsertChar(BufferView * bview, char c)
{
- SetUndo(Undo::INSERT,
+ SetUndo(bview->buffer(), Undo::INSERT,
cursor.par()->ParFromPos(cursor.pos())->previous,
cursor.par()->ParFromPos(cursor.pos())->next);
// disable the double-space checking
bool freeSpacing =
- textclasslist.Style(buffer()->params.textclass,
+ textclasslist.Style(bview->buffer()->params.textclass,
cursor.row()->par()->GetLayout()).free_spacing;
#ifndef NEW_TABULAR
/* table stuff -- begin*/
if (cursor.par()->table) {
- InsertCharInTable(c);
+ InsertCharInTable(bview, c);
charInserted();
return;
}
// Get the font that is used to calculate the baselineskip
LyXParagraph::size_type lastpos = cursor.par()->Last();
- LyXFont rawparfont = cursor.par()->GetFontSettings(buffer()->params,
- lastpos - 1);
+ LyXFont rawparfont = cursor.par()->GetFontSettings(bview->buffer()->params,
+ lastpos - 1);
bool jumped_over_space = false;
&& cursor.par()->Previous()->footnoteflag
== LyXParagraph::OPEN_FOOTNOTE))) {
if (cursor.pos() == 0 )
- owner_->owner()->getMiniBuffer()->Set(_("You cannot insert a space at the beginning of a paragraph. Please read the Tutorial."));
+ bview->owner()->getMiniBuffer()->Set(_("You cannot insert a space at the beginning of a paragraph. Please read the Tutorial."));
else
- owner_->owner()->getMiniBuffer()->Set(_("You cannot type two spaces this way. Please read the Tutorial."));
+ bview->owner()->getMiniBuffer()->Set(_("You cannot type two spaces this way. Please read the Tutorial."));
charInserted();
return;
}
} else if (IsNewlineChar(c)) {
if (cursor.par()->FirstPhysicalPar() == cursor.par()
- && cursor.pos() <= BeginningOfMainBody(cursor.par())) {
+ && cursor.pos() <= BeginningOfMainBody(bview->buffer(), cursor.par())) {
charInserted();
return;
}
if (cursor.pos() < cursor.par()->Last() &&
cursor.par()->IsLineSeparator(cursor.pos()))
- CursorRightIntern(); // newline always after a blank!
+ // newline always after a blank!
+ CursorRightIntern(bview);
cursor.row()->fill(-1); // to force a new break
}
if (c != LyXParagraph::META_INSET) /* Here case LyXText::InsertInset
* already insertet the character */
cursor.par()->InsertChar(cursor.pos(), c);
- SetCharFont(cursor.par(), cursor.pos(), rawtmpfont);
+ SetCharFont(bview->buffer(), cursor.par(), cursor.pos(), rawtmpfont);
if (!jumped_over_space) {
// refresh the positions
|| cursor.par()->IsNewline(cursor.pos())
|| cursor.row()->fill() == -1)
&& row->previous() && row->previous()->par() == row->par()) {
- LyXParagraph::size_type z = NextBreakPoint(row->previous(),
- paperwidth);
+ LyXParagraph::size_type z = NextBreakPoint(bview,
+ row->previous(),
+ workWidth(bview));
if ( z >= row->pos()) {
row->pos(z + 1);
// set the dimensions of the row above
- row->previous()->fill(Fill(row->previous(),
- paperwidth));
+ row->previous()->fill(Fill(bview,
+ row->previous(),
+ workWidth(bview)));
- SetHeightOfRow(row->previous());
+ SetHeightOfRow(bview, row->previous());
y -= row->previous()->height();
refresh_y = y;
refresh_row = row->previous();
status = LyXText::NEED_MORE_REFRESH;
- BreakAgainOneRow(row);
+ BreakAgainOneRow(bview, row);
current_font = rawtmpfont;
real_current_font = realtmpfont;
- SetCursor(cursor.par(), cursor.pos() + 1, false, cursor.boundary());
+ SetCursor(bview, cursor.par(), cursor.pos() + 1,
+ false, cursor.boundary());
// cursor MUST be in row now.
if (row->next() && row->next()->par() == row->par())
// check, wether the last characters font has changed.
if (cursor.pos() && cursor.pos() == cursor.par()->Last()
&& rawparfont != rawtmpfont)
- RedoHeightOfParagraph(cursor);
+ RedoHeightOfParagraph(bview, cursor);
charInserted();
return;
if (row->fill() >= 0) /* needed because a newline
* will set fill to -1. Otherwise
* we would not get a rebreak! */
- row->fill(Fill(row, paperwidth));
+ row->fill(Fill(bview, row, workWidth(bview)));
if (row->fill() < 0 ) {
refresh_y = y;
refresh_row = row;
refresh_x = cursor.x();
refresh_pos = cursor.pos();
status = LyXText::NEED_MORE_REFRESH;
- BreakAgainOneRow(row);
+ BreakAgainOneRow(bview, row);
// will the cursor be in another row now?
if (RowLast(row) <= cursor.pos() + 1 && row->next()) {
if (row->next() && row->next()->par() == row->par())
// this should always be true
row = row->next();
- BreakAgainOneRow(row);
+ BreakAgainOneRow(bview, row);
}
current_font = rawtmpfont;
real_current_font = realtmpfont;
- SetCursor(cursor.par(), cursor.pos() + 1, false, cursor.boundary());
+ SetCursor(bview, cursor.par(), cursor.pos() + 1, false,
+ cursor.boundary());
if (row->next() && row->next()->par() == row->par())
need_break_row = row->next();
else
refresh_pos = cursor.pos();
int tmpheight = row->height();
- SetHeightOfRow(row);
+ SetHeightOfRow(bview, row);
if (tmpheight == row->height())
status = LyXText::NEED_VERY_LITTLE_REFRESH;
else
current_font = rawtmpfont;
real_current_font = realtmpfont;
- SetCursor(cursor.par(), cursor.pos() + 1, false, cursor.boundary());
+ SetCursor(bview, cursor.par(), cursor.pos() + 1, false,
+ cursor.boundary());
}
// check, wether the last characters font has changed.
if (cursor.pos() && cursor.pos() == cursor.par()->Last()
&& rawparfont != rawtmpfont) {
- RedoHeightOfParagraph(cursor);
+ RedoHeightOfParagraph(bview, cursor);
} else {
// now the special right address boxes
- if (textclasslist.Style(buffer()->params.textclass,
+ if (textclasslist.Style(bview->buffer()->params.textclass,
cursor.par()->GetLayout()).margintype
== MARGIN_RIGHT_ADDRESS_BOX) {
- RedoDrawingOfParagraph(cursor);
+ RedoDrawingOfParagraph(bview, cursor);
}
}
}
}
-void LyXText::PrepareToPrint(Row * row, float & x,
+void LyXText::PrepareToPrint(BufferView * bview,
+ Row * row, float & x,
float & fill_separator,
float & fill_hfill,
float & fill_label_hfill,
fill_separator = 0;
fill_label_hfill = 0;
- bool is_rtl = row->par()->isRightToLeftPar(buffer()->params);
+ bool is_rtl = row->par()->isRightToLeftPar(bview->buffer()->params);
if (is_rtl) {
- x = RightMargin(row);
+ x = RightMargin(bview->buffer(), row);
if (row->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
LyXFont font(LyXFont::ALL_SANE);
font.setSize(LyXFont::SIZE_SMALL);
x += lyxfont::width("Mwide-figM", font);
}
- } else
- x = LeftMargin(row);
+ } else if (workWidth(bview) > 0)
+ x = LeftMargin(bview, row);
+ else
+ x = 0;
// is there a manual margin with a manual label
- if (textclasslist.Style(buffer()->params.textclass,
+ if (textclasslist.Style(bview->buffer()->params.textclass,
row->par()->GetLayout()).margintype == MARGIN_MANUAL
- && textclasslist.Style(buffer()->params.textclass,
+ && textclasslist.Style(bview->buffer()->params.textclass,
row->par()->GetLayout()).labeltype == LABEL_MANUAL) {
- nlh = NumberOfLabelHfills(row) + 1; /* one more since labels
- * are left aligned*/
+ /* one more since labels are left aligned */
+ nlh = NumberOfLabelHfills(bview->buffer(), row) + 1;
if (nlh && !row->par()->GetLabelWidthString().empty()) {
- fill_label_hfill = LabelFill(row) / nlh;
+ fill_label_hfill = LabelFill(bview, row) / nlh;
}
}
// are there any hfills in the row?
- float nh = NumberOfHfills(row);
+ float nh = NumberOfHfills(bview->buffer(), row);
#ifndef NEW_TABULAR
/* table stuff -- begin*/
if (row->par()->table) {
- w = paperwidth - row->par()->table->WidthOfTable()
- - x - RightMargin(row);
+ w = workWidth(bview) - row->par()->table->WidthOfTable()
+ - x - RightMargin(bview->buffer(), row);
nh = 0; /* ignore hfills in tables */
}
/* table stuff -- end*/
// set x how you need it
int align;
if (row->par()->FirstPhysicalPar()->align == LYX_ALIGN_LAYOUT)
- align = textclasslist.Style(buffer()->params.textclass, row->par()->GetLayout()).align;
+ align = textclasslist.Style(bview->buffer()->params.textclass, row->par()->GetLayout()).align;
else
align = row->par()->FirstPhysicalPar()->align;
switch (align) {
case LYX_ALIGN_BLOCK:
- ns = NumberOfSeparators(row);
+ ns = NumberOfSeparators(bview->buffer(), row);
if (ns && row->next() && row->next()->par() == row->par() &&
!(row->next()->par()->IsNewline(row->next()->pos() - 1))
&& !(row->next()->par()->GetChar(row->next()->pos()) == LyXParagraph::META_INSET
if (!bidi)
return;
- ComputeBidiTables(row);
+ ComputeBidiTables(bview->buffer(), row);
if (is_rtl) {
LyXParagraph::size_type main_body =
- BeginningOfMainBody(row->par());
+ BeginningOfMainBody(bview->buffer(), row->par());
LyXParagraph::size_type last = RowLast(row);
if (main_body > 0 &&
(main_body-1 > last ||
!row->par()->IsLineSeparator(main_body-1))) {
- LyXLayout const & layout = textclasslist.Style(buffer()->params.textclass,
- row->par()->GetLayout());
+ LyXLayout const & layout =
+ textclasslist.Style(bview->buffer()->params.textclass,
+ row->par()->GetLayout());
x += lyxfont::width(layout.labelsep,
- GetFont(row->par(), -2));
+ GetFont(bview->buffer(), row->par(), -2));
if (main_body-1 <= last)
x += fill_label_hfill;
}
* realize, that you left an empty paragraph, they will delete it.
* They also delete the corresponding row */
-void LyXText::CursorRightOneWord() const
+void LyXText::CursorRightOneWord(BufferView * bview) const
{
// treat floats, HFills and Insets as words
LyXCursor tmpcursor = cursor;
++steps;
}
}
- SetCursor(tmpcursor.par(), tmpcursor.pos());
+ SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
-void LyXText::CursorTab() const
+void LyXText::CursorTab(BufferView * bview) const
{
#ifndef NEW_TABULAR
if (cursor.par()->table) {
int cell = NumberOfCell(cursor.par(), cursor.pos());
while(cursor.par()->table->IsContRow(cell)) {
- CursorUp();
+ CursorUp(bview);
cell = NumberOfCell(cursor.par(), cursor.pos());
}
if (cursor.par()->table->ShouldBeVeryLastCell(cell))
- TableFeatures(LyXTable::APPEND_ROW);
+ TableFeatures(bview, LyXTable::APPEND_ROW);
}
#endif
LyXCursor tmpcursor = cursor;
}
} else
tmpcursor.pos(tmpcursor.pos() + 1);
- SetCursor(tmpcursor.par(), tmpcursor.pos());
+ SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
#ifndef NEW_TABULAR
if (cursor.par()->table) {
int cell = NumberOfCell(cursor.par(), cursor.pos());
}
} else
tmpcursor.pos(tmpcursor.pos() + 1);
- SetCursor(tmpcursor.par(), tmpcursor.pos());
+ SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
cell = NumberOfCell(cursor.par(), cursor.pos());
}
}
/* -------> Skip initial whitespace at end of word and move cursor to *start*
of prior word, not to end of next prior word. */
-void LyXText::CursorLeftOneWord() const
+void LyXText::CursorLeftOneWord(BufferView * bview) const
{
// treat HFills, floats and Insets as words
LyXCursor tmpcursor = cursor;
tmpcursor.par()->IsWord(tmpcursor.pos()-1) )
tmpcursor.pos(tmpcursor.pos() - 1);
}
- SetCursor(tmpcursor.par(), tmpcursor.pos());
+ SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
/* -------> Select current word. This depends on behaviour of CursorLeftOneWord(), so it is
patched as well. */
-void LyXText::SelectWord()
+void LyXText::SelectWord(BufferView * bview)
{
// Move cursor to the beginning, when not already there.
if ( cursor.pos()
&& !cursor.par()->IsSeparator(cursor.pos()-1)
&& !cursor.par()->IsKomma(cursor.pos()-1) )
- CursorLeftOneWord();
+ CursorLeftOneWord(bview);
// set the sel cursor
sel_cursor = cursor;
&& !cursor.par()->IsSeparator(cursor.pos())
&& !cursor.par()->IsKomma(cursor.pos()) )
cursor.pos(cursor.pos() + 1);
- SetCursor( cursor.par(), cursor.pos() );
+ SetCursor(bview, cursor.par(), cursor.pos() );
// finally set the selection
- SetSelection();
+ SetSelection(bview);
}
1: no selection is currently set,
2: the cursor is not at the borders of the word. */
-bool LyXText::SelectWordWhenUnderCursor()
+bool LyXText::SelectWordWhenUnderCursor(BufferView * bview)
{
if (!selection &&
cursor.pos() > 0 && cursor.pos() < cursor.par()->Last()
&& !cursor.par()->IsKomma(cursor.pos())
&& !cursor.par()->IsSeparator(cursor.pos() -1)
&& !cursor.par()->IsKomma(cursor.pos() -1) ) {
- SelectWord();
+ SelectWord(bview);
return true;
}
return false;
// This function is only used by the spellchecker for NextWord().
// It doesn't handle LYX_ACCENTs and probably never will.
-char * LyXText::SelectNextWord(float & value)
+char * LyXText::SelectNextWord(BufferView * bview, float & value)
{
LyXParagraph * tmppar = cursor.par();
// Now, skip until we have real text (will jump paragraphs)
while ((cursor.par()->Last() > cursor.pos()
&& (!cursor.par()->IsLetter(cursor.pos())
- || cursor.par()->getFont(buffer()->params,
- cursor.pos()).latex() == LyXFont::ON))
- || (cursor.par()->Last() == cursor.pos()
+ || cursor.par()->getFont(bview->buffer()->params, cursor.pos())
+ .latex() == LyXFont::ON))
+ || (cursor.par()->Last() == cursor.pos()
&& cursor.par()->Next())){
if (cursor.pos() == cursor.par()->Last()) {
cursor.par(cursor.par()->Next());
// Update the value if we changed paragraphs
if (cursor.par() != tmppar){
- SetCursor(cursor.par(), cursor.pos());
+ SetCursor(bview, cursor.par(), cursor.pos());
value = float(cursor.y())/float(height);
}
&& (cursor.par()->IsLetter(cursor.pos()))
|| (cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET
&& cursor.par()->GetInset(cursor.pos()) != 0
- && cursor.par()->GetInset(cursor.pos())->Latex(latex, false, false) == 0
+ && cursor.par()->GetInset(cursor.pos())->Latex(bview->buffer(), latex, false, false) == 0
#ifdef HAVE_SSTREAM
&& latex.str() == "\\-"
#else
// This one is also only for the spellchecker
-void LyXText::SelectSelectedWord()
+void LyXText::SelectSelectedWord(BufferView * bview)
{
// move cursor to the beginning
- SetCursor(sel_cursor.par(), sel_cursor.pos());
+ SetCursor(bview, sel_cursor.par(), sel_cursor.pos());
// set the sel cursor
sel_cursor = cursor;
&& (cursor.par()->IsLetter(cursor.pos())
|| (cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET
&& cursor.par()->GetInset(cursor.pos()) != 0
- && cursor.par()->GetInset(cursor.pos())->Latex(latex, false, false) == 0
+ && cursor.par()->GetInset(cursor.pos())->Latex(bview->buffer(), latex, false, false) == 0
#ifdef HAVE_SSTREAM
&& latex.str() == "\\-"
#else
#ifndef HAVE_SSTREAM
delete [] latex.str();
#endif
- SetCursor(cursor.par(), cursor.pos());
+ SetCursor(bview, cursor.par(), cursor.pos());
// finally set the selection
- SetSelection();
+ SetSelection(bview);
}
/* -------> Delete from cursor up to the end of the current or next word. */
-void LyXText::DeleteWordForward()
+void LyXText::DeleteWordForward(BufferView * bview)
{
if (!cursor.par()->Last())
- CursorRight();
+ CursorRight(bview);
else {
LyXCursor tmpcursor = cursor;
tmpcursor.row(0); // ??
selection = true; // to avoid deletion
- CursorRightOneWord();
- SetCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos()); // ??
+ CursorRightOneWord(bview);
+ SetCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
sel_cursor = cursor;
cursor = tmpcursor;
- SetSelection();
+ SetSelection(bview);
/* -----> Great, CutSelection() gets rid of multiple spaces. */
- CutSelection();
+ CutSelection(bview);
}
}
/* -------> Delete from cursor to start of current or prior word. */
-void LyXText::DeleteWordBackward()
+void LyXText::DeleteWordBackward(BufferView * bview)
{
if (!cursor.par()->Last())
- CursorLeft();
+ CursorLeft(bview);
else {
LyXCursor tmpcursor = cursor;
tmpcursor.row(0); // ??
selection = true; // to avoid deletion
- CursorLeftOneWord();
- SetCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos()); // ??
+ CursorLeftOneWord(bview);
+ SetCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
sel_cursor = cursor;
cursor = tmpcursor;
- SetSelection();
- CutSelection();
+ SetSelection(bview);
+ CutSelection(bview);
}
}
/* -------> Kill to end of line. */
-void LyXText::DeleteLineForward()
+void LyXText::DeleteLineForward(BufferView * bview)
{
if (!cursor.par()->Last())
// Paragraph is empty, so we just go to the right
- CursorRight();
+ CursorRight(bview);
else {
LyXCursor tmpcursor = cursor;
// We can't store the row over a regular SetCursor
// so we set it to 0 and reset it afterwards.
tmpcursor.row(0); // ??
selection = true; // to avoid deletion
- CursorEnd();
- SetCursor(tmpcursor, tmpcursor.par(), tmpcursor.pos()); // ??
+ CursorEnd(bview);
+ SetCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
sel_cursor = cursor;
cursor = tmpcursor;
- SetSelection();
+ SetSelection(bview);
// What is this test for ??? (JMarc)
if (!selection) {
- DeleteWordForward();
+ DeleteWordForward(bview);
} else {
- CutSelection();
+ CutSelection(bview);
}
}
}
// LyXParagraph, but it will have to change for 1.1 anyway. At least
// it does not access outside of the allocated array as the older
// version did. (JMarc)
-void LyXText::ChangeWordCase(LyXText::TextCase action)
+void LyXText::ChangeWordCase(BufferView * bview, LyXText::TextCase action)
{
LyXParagraph * tmppar = cursor.par()->ParFromPos(cursor.pos());
- SetUndo(Undo::FINISH, tmppar->previous, tmppar->next);
+ SetUndo(bview->buffer(),Undo::FINISH, tmppar->previous, tmppar->next);
LyXParagraph::size_type tmppos =
cursor.par()->PositionInParFromPos(cursor.pos());
tmppar->SetChar(tmppos, c);
++tmppos;
}
- CheckParagraph(tmppar, tmppos);
- CursorRightOneWord();
+ CheckParagraph(bview, tmppar, tmppos);
+ CursorRightOneWord(bview);
}
-void LyXText::Delete()
+void LyXText::Delete(BufferView * bview)
{
// this is a very easy implementation
old_cursor.par()->previous->id() : 0;
// just move to the right
- CursorRightIntern();
+ CursorRightIntern(bview);
// CHECK Look at the comment here.
// This check is not very good...
if (old_cursor.par() != cursor.par() || old_cursor.pos() != cursor.pos()) {
LyXCursor tmpcursor = cursor;
cursor = old_cursor; // to make sure undo gets the right cursor position
- SetUndo(Undo::DELETE,
+ SetUndo(bview->buffer(), Undo::DELETE,
cursor.par()->ParFromPos(cursor.pos())->previous,
cursor.par()->ParFromPos(cursor.pos())->next);
cursor = tmpcursor;
- Backspace();
+ Backspace(bview);
}
}
-void LyXText::Backspace()
+void LyXText::Backspace(BufferView * bview)
{
#ifndef NEW_TABULAR
/* table stuff -- begin */
if (cursor.par()->table) {
- BackspaceInTable();
+ BackspaceInTable(bview);
return;
}
/* table stuff -- end */
// Get the font that is used to calculate the baselineskip
LyXParagraph::size_type lastpos = cursor.par()->Last();
- LyXFont rawparfont = cursor.par()->GetFontSettings(buffer()->params,
+ LyXFont rawparfont = cursor.par()->GetFontSettings(bview->buffer()->params,
lastpos - 1);
if (cursor.pos() == 0) {
tmppar->pagebreak_bottom = cursor.par()->pagebreak_bottom;
}
- CursorLeftIntern();
+ CursorLeftIntern(bview);
// the layout things can change the height of a row !
int tmpheight = cursor.row()->height();
- SetHeightOfRow(cursor.row());
+ SetHeightOfRow(bview, cursor.row());
if (cursor.row()->height() != tmpheight) {
refresh_y = cursor.y() - cursor.row()->baseline();
refresh_row = cursor.row();
}
if (cursor.par()->ParFromPos(cursor.pos())->previous){
- SetUndo(Undo::DELETE,
+ SetUndo(bview->buffer(), Undo::DELETE,
cursor.par()->ParFromPos(cursor.pos())->previous->previous,
cursor.par()->ParFromPos(cursor.pos())->next);
}
// without the dreaded mechanism. (JMarc)
if (cursor.par()->Previous()) {
// steps into the above paragraph.
- SetCursorIntern(cursor.par()->Previous(),
+ SetCursorIntern(bview, cursor.par()->Previous(),
cursor.par()->Previous()->Last(), false);
}
RemoveParagraph(tmprow);
RemoveRow(tmprow);
- cursor.par()->PasteParagraph(buffer()->params);
+ cursor.par()->PasteParagraph(bview->buffer()->params);
if (!cursor.pos() || !cursor.par()->IsSeparator(cursor.pos() - 1))
; //cursor.par()->InsertChar(cursor.pos(), ' ');
//RemoveParagraph(tmprow);
//RemoveRow(tmprow);
- AppendParagraph(cursor.row()); // This rebuilds the rows.
- UpdateCounters(cursor.row());
+ // This rebuilds the rows.
+ AppendParagraph(bview, cursor.row());
+ UpdateCounters(bview, cursor.row());
// the row may have changed, block, hfills etc.
- SetCursor(cursor.par(), cursor.pos(), false);
+ SetCursor(bview, cursor.par(), cursor.pos(), false);
}
} else {
/* this is the code for a normal backspace, not pasting
* any paragraphs */
- SetUndo(Undo::DELETE,
+ SetUndo(bview->buffer(), Undo::DELETE,
cursor.par()->ParFromPos(cursor.pos())->previous,
cursor.par()->ParFromPos(cursor.pos())->next);
// We used to do CursorLeftIntern() here, but it is
// not a good idea since it triggers the auto-delete
// mechanism. So we do a CursorLeftIntern()-lite,
// without the dreaded mechanism. (JMarc)
- SetCursorIntern(cursor.par(), cursor.pos() - 1, false, cursor.boundary());
+ SetCursorIntern(bview, cursor.par(), cursor.pos()- 1,
+ false, cursor.boundary());
// some insets are undeletable here
if (cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET) {
// this is a cruel method but safe..... Matthias
if (cursor.par()->GetInset(cursor.pos())->display()){
cursor.par()->Erase(cursor.pos());
- RedoParagraph();
+ RedoParagraph(bview);
return;
}
}
* when calculating the fill */
if (cursor.pos() < RowLast(row) ||
!cursor.par()->IsLineSeparator(cursor.pos())) {
- row->fill(row->fill() + SingleWidth(cursor.par(), cursor.pos()));
+ row->fill(row->fill() + SingleWidth(bview,
+ cursor.par(),
+ cursor.pos()));
}
/* some special code when deleting a newline. This is similar
// delete newlines at the beginning of paragraphs
while (cursor.par()->Last() &&
cursor.par()->IsNewline(cursor.pos()) &&
- cursor.pos() == BeginningOfMainBody(cursor.par())) {
+ cursor.pos() == BeginningOfMainBody(bview->buffer(),
+ cursor.par())) {
cursor.par()->Erase(cursor.pos());
// refresh the positions
tmprow = row;
// is there a break one row above
if (row->previous() && row->previous()->par() == row->par()) {
- z = NextBreakPoint(row->previous(), paperwidth);
+ z = NextBreakPoint(bview, row->previous(),
+ workWidth(bview));
if ( z >= row->pos()) {
row->pos(z + 1);
RemoveRow(row);
need_break_row = 0;
} else {
- BreakAgainOneRow(row);
+ BreakAgainOneRow(bview, row);
if (row->next() && row->next()->par() == row->par())
need_break_row = row->next();
else
// set the dimensions of the row above
y -= tmprow->height();
- tmprow->fill(Fill(tmprow, paperwidth));
- SetHeightOfRow(tmprow);
+ tmprow->fill(Fill(bview, tmprow,
+ workWidth(bview)));
+ SetHeightOfRow(bview, tmprow);
refresh_y = y;
refresh_row = tmprow;
status = LyXText::NEED_MORE_REFRESH;
- SetCursor(cursor.par(), cursor.pos(), false, cursor.boundary());
+ SetCursor(bview, cursor.par(), cursor.pos(),
+ false, cursor.boundary());
//current_font = rawtmpfont;
//real_current_font = realtmpfont;
// check, whether the last character's font has changed.
if (rawparfont !=
- cursor.par()->GetFontSettings(buffer()->params, cursor.par()->Last() - 1))
- RedoHeightOfParagraph(cursor);
+ cursor.par()->GetFontSettings(bview->buffer()->params,
+ cursor.par()->Last() - 1))
+ RedoHeightOfParagraph(bview, cursor);
return;
}
}
// break the cursor row again
- z = NextBreakPoint(row, paperwidth);
+ z = NextBreakPoint(bview, row, workWidth(bview));
if (z != RowLast(row) ||
(row->next() && row->next()->par() == row->par() &&
refresh_row = row;
status = LyXText::NEED_MORE_REFRESH;
- BreakAgainOneRow(row);
- SetCursor(cursor.par(), cursor.pos(), false, cursor.boundary());
+ BreakAgainOneRow(bview, row);
+ SetCursor(bview, cursor.par(), cursor.pos(), false, cursor.boundary());
// cursor MUST be in row now
if (row->next() && row->next()->par() == row->par())
need_break_row = 0;
} else {
// set the dimensions of the row
- row->fill(Fill(row, paperwidth));
+ row->fill(Fill(bview, row, workWidth(bview)));
int tmpheight = row->height();
- SetHeightOfRow(row);
+ SetHeightOfRow(bview, row);
if (tmpheight == row->height())
status = LyXText::NEED_VERY_LITTLE_REFRESH;
else
status = LyXText::NEED_MORE_REFRESH;
refresh_y = y;
refresh_row = row;
- SetCursor(cursor.par(), cursor.pos(), false, cursor.boundary());
+ SetCursor(bview, cursor.par(), cursor.pos(), false, cursor.boundary());
}
}
lastpos = cursor.par()->Last();
if (cursor.pos() == lastpos) {
- SetCurrentFont();
- if (IsBoundary(cursor.par(), cursor.pos()) != cursor.boundary())
- SetCursor(cursor.par(), cursor.pos(), false, !cursor.boundary());
+ SetCurrentFont(bview);
+ if (IsBoundary(bview->buffer(), cursor.par(), cursor.pos()) != cursor.boundary())
+ SetCursor(bview, cursor.par(), cursor.pos(), false, !cursor.boundary());
}
// check, wether the last characters font has changed.
if (rawparfont !=
- cursor.par()->GetFontSettings(buffer()->params, lastpos - 1)) {
- RedoHeightOfParagraph(cursor);
+ cursor.par()->GetFontSettings(bview->buffer()->params, lastpos - 1)) {
+ RedoHeightOfParagraph(bview, cursor);
} else {
// now the special right address boxes
- if (textclasslist.Style(buffer()->params.textclass,
+ if (textclasslist.Style(bview->buffer()->params.textclass,
cursor.par()->GetLayout()).margintype == MARGIN_RIGHT_ADDRESS_BOX) {
- RedoDrawingOfParagraph(cursor);
+ RedoDrawingOfParagraph(bview, cursor);
}
}
}
-void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
+void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
+ Row * row_ptr, long y)
{
/* returns a printed row */
- Painter & pain = owner_->painter();
+ Painter & pain = bview->painter();
- bool is_rtl = row_ptr->par()->isRightToLeftPar(buffer()->params);
+ bool is_rtl = row_ptr->par()->isRightToLeftPar(bview->buffer()->params);
LyXParagraph::size_type last = RowLastPrintable(row_ptr);
LyXParagraph::size_type vpos, pos;
<< row_ptr->height() << endl;
return;
}
- PrepareToPrint(row_ptr, x, fill_separator,
+ PrepareToPrint(bview, row_ptr, x, fill_separator,
fill_hfill, fill_label_hfill);
+ x += x_offset;
+
// clear the area where we want to paint/print
- pain.fillRectangle(0, offset, paperwidth, row_ptr->height());
+ int ww = workWidth(bview);
+ if (ww < 0)
+ ww = bview->workWidth();
+ pain.fillRectangle(x_offset, y_offset, ww, row_ptr->height());
if (selection) {
/* selection code */
if (sel_start_cursor.row() == row_ptr &&
sel_end_cursor.row() == row_ptr) {
if (sel_start_cursor.x() < sel_end_cursor.x())
- pain.fillRectangle(sel_start_cursor.x(), offset,
+ pain.fillRectangle(sel_start_cursor.x(), y_offset,
sel_end_cursor.x() - sel_start_cursor.x(),
row_ptr->height(),
LColor::selection);
else
- pain.fillRectangle(sel_end_cursor.x(), offset,
+ pain.fillRectangle(sel_end_cursor.x(), y_offset,
sel_start_cursor.x() - sel_end_cursor.x(),
row_ptr->height(),
LColor::selection);
} else if (sel_start_cursor.row() == row_ptr) {
if (is_rtl)
- pain.fillRectangle(0, offset,
+ pain.fillRectangle(0, y_offset,
sel_start_cursor.x(),
row_ptr->height(),
LColor::selection);
else
- pain.fillRectangle(sel_start_cursor.x(), offset,
- paperwidth - sel_start_cursor.x(),
+ pain.fillRectangle(sel_start_cursor.x(), y_offset,
+ ww - sel_start_cursor.x(),
row_ptr->height(),
LColor::selection);
} else if (sel_end_cursor.row() == row_ptr) {
if (is_rtl)
- pain.fillRectangle(sel_end_cursor.x(), offset,
- paperwidth - sel_end_cursor.x(),
+ pain.fillRectangle(sel_end_cursor.x(), y_offset,
+ ww - sel_end_cursor.x(),
row_ptr->height(),
LColor::selection);
else
- pain.fillRectangle(0, offset,
+ pain.fillRectangle(0, y_offset,
sel_end_cursor.x(),
row_ptr->height(),
LColor::selection);
} else if (y > long(sel_start_cursor.y())
&& y < long(sel_end_cursor.y())) {
- pain.fillRectangle(0, offset,
- paperwidth
- , row_ptr->height(),
+ pain.fillRectangle(0, y_offset,
+ ww, row_ptr->height(),
LColor::selection);
}
} else if ( sel_start_cursor.row() != row_ptr &&
sel_end_cursor.row() != row_ptr &&
y > long(sel_start_cursor.y())
&& y < long(sel_end_cursor.y())) {
- pain.fillRectangle(0, offset,
- paperwidth, row_ptr->height(),
+ pain.fillRectangle(0, y_offset, ww, row_ptr->height(),
LColor::selection);
} else if (sel_start_cursor.row() == row_ptr ||
sel_end_cursor.row() == row_ptr) {
#endif
if ( (sel_start_cursor.row() != row_ptr && !is_rtl) ||
(sel_end_cursor.row() != row_ptr && is_rtl))
- pain.fillRectangle(0, offset,
+ pain.fillRectangle(0, y_offset,
int(tmpx),
row_ptr->height(),
LColor::selection);
++cell;
tmpx += row_ptr->par()->table->GetBeginningOfTextInCell(cell);
} else {
- tmpx += SingleWidth(row_ptr->par(), pos);
+ tmpx += SingleWidth(bview, row_ptr->par(), pos);
}
if ( (sel_start_cursor.row() != row_ptr ||
sel_start_cursor.pos() <= pos) &&
(sel_end_cursor.row() != row_ptr ||
pos < sel_end_cursor.pos()) )
- pain.fillRectangle(int(old_tmpx), offset,
+ pain.fillRectangle(int(old_tmpx), y_offset,
int(tmpx - old_tmpx + 1),
row_ptr->height(),
LColor::selection);
} else {
#endif
LyXParagraph::size_type main_body =
- BeginningOfMainBody(row_ptr->par());
+ BeginningOfMainBody(bview->buffer(),
+ row_ptr->par());
for (vpos = row_ptr->pos(); vpos <= last; ++vpos) {
pos = vis2log(vpos);
float old_tmpx = tmpx;
if (main_body > 0 && pos == main_body-1) {
tmpx += fill_label_hfill +
- lyxfont::width(textclasslist.Style(buffer()->params.textclass,
+ lyxfont::width(textclasslist.Style(bview->buffer()->params.textclass,
row_ptr->par()->GetLayout()).labelsep,
- GetFont(row_ptr->par(), -2));
+ GetFont(bview->buffer(),row_ptr->par(), -2));
if (row_ptr->par()->IsLineSeparator(main_body-1))
- tmpx -= SingleWidth(row_ptr->par(), main_body-1);
+ tmpx -= SingleWidth(bview, row_ptr->par(), main_body-1);
}
- if (HfillExpansion(row_ptr, pos)) {
- tmpx += SingleWidth(row_ptr->par(), pos);
+ if (HfillExpansion(bview->buffer(), row_ptr, pos)) {
+ tmpx += SingleWidth(bview, row_ptr->par(), pos);
if (pos >= main_body)
tmpx += fill_hfill;
else
tmpx += fill_label_hfill;
}
else if (row_ptr->par()->IsSeparator(pos)) {
- tmpx += SingleWidth(row_ptr->par(), pos);
+ tmpx += SingleWidth(bview, row_ptr->par(), pos);
if (pos >= main_body)
tmpx += fill_separator;
} else
- tmpx += SingleWidth(row_ptr->par(), pos);
+ tmpx += SingleWidth(bview, row_ptr->par(), pos);
if ( (sel_start_cursor.row() != row_ptr ||
sel_start_cursor.pos() <= pos) &&
(sel_end_cursor.row() != row_ptr ||
pos < sel_end_cursor.pos()) )
- pain.fillRectangle(int(old_tmpx), offset,
+ pain.fillRectangle(int(old_tmpx), y_offset,
int(tmpx - old_tmpx + 1),
row_ptr->height(),
LColor::selection);
#endif
if ( (sel_start_cursor.row() != row_ptr && is_rtl) ||
(sel_end_cursor.row() != row_ptr && !is_rtl) )
- pain.fillRectangle(int(tmpx), offset,
- int(paperwidth - tmpx),
+ pain.fillRectangle(int(tmpx), y_offset,
+ int(ww - tmpx),
row_ptr->height(),
LColor::selection);
}
}
pain.fillRectangle(LYX_PAPER_MARGIN,
- offset + 1,
+ y_offset + 1,
box_x - LYX_PAPER_MARGIN,
int(lyxfont::maxAscent(font)
+ lyxfont::maxDescent(font)),
LColor::footnotebg);
- pain.line(LYX_PAPER_MARGIN, offset,
- paperwidth - LYX_PAPER_MARGIN, offset,
+ pain.line(LYX_PAPER_MARGIN, y_offset,
+ workWidth(bview) - LYX_PAPER_MARGIN, y_offset,
LColor::footnoteframe);
pain.text(LYX_PAPER_MARGIN,
- offset + int(lyxfont::maxAscent(font)) + 1,
+ y_offset + int(lyxfont::maxAscent(font)) + 1,
fs, font);
- pain.line(LYX_PAPER_MARGIN, offset,
+ pain.line(LYX_PAPER_MARGIN, y_offset,
LYX_PAPER_MARGIN,
- offset + int(lyxfont::maxAscent(font)
+ y_offset + int(lyxfont::maxAscent(font)
+ lyxfont::maxDescent(font)),
LColor::footnoteframe);
pain.line(LYX_PAPER_MARGIN,
- offset + int(lyxfont::maxAscent(font)
+ y_offset + int(lyxfont::maxAscent(font)
+ lyxfont::maxDescent(font)) + 1,
box_x,
- offset + int(lyxfont::maxAscent(font)
+ y_offset + int(lyxfont::maxAscent(font)
+ lyxfont::maxDescent(font)) + 1,
LColor::footnoteframe);
}
/* draw the open floats in a red box */
- pain.line(box_x, offset,
- box_x, offset + row_ptr->height(),
+ pain.line(box_x, y_offset,
+ box_x, y_offset + row_ptr->height(),
LColor::footnoteframe);
- pain.line(paperwidth - LYX_PAPER_MARGIN,
- offset,
- paperwidth - LYX_PAPER_MARGIN,
- offset + row_ptr->height(),
+ pain.line(workWidth(bview) - LYX_PAPER_MARGIN,
+ y_offset,
+ workWidth(bview) - LYX_PAPER_MARGIN,
+ y_offset + row_ptr->height(),
LColor::footnoteframe);
// Draw appendix lines
LyXParagraph * p = row_ptr->par()->PreviousBeforeFootnote()->FirstPhysicalPar();
if (p->appendix){
- pain.line(1, offset,
- 1, offset + row_ptr->height(),
+ pain.line(1, y_offset,
+ 1, y_offset + row_ptr->height(),
LColor::appendixline);
- pain.line(paperwidth - 2, offset,
- paperwidth - 2,
- offset + row_ptr->height(),
+ pain.line(workWidth(bview) - 2, y_offset,
+ workWidth(bview) - 2,
+ y_offset + row_ptr->height(),
LColor::appendixline);
}
// Draw minipage line
bool minipage = p->pextra_type == LyXParagraph::PEXTRA_MINIPAGE;
if (minipage)
- pain.line(LYX_PAPER_MARGIN/5, offset,
+ pain.line(LYX_PAPER_MARGIN/5, y_offset,
LYX_PAPER_MARGIN/5,
- offset + row_ptr->height() - 1,
+ y_offset + row_ptr->height() - 1,
LColor::minipageline);
// Draw depth lines
int depth = p->GetDepth();
for (int i = 1; i <= depth; ++i) {
int line_x = (LYX_PAPER_MARGIN / 5) * (i + minipage);
- pain.line(line_x, offset, line_x,
- offset + row_ptr->height() - 1,
+ pain.line(line_x, y_offset, line_x,
+ y_offset + row_ptr->height() - 1,
LColor::depthbar);
}
} else if (row_ptr->previous() &&
int box_x = LYX_PAPER_MARGIN;
box_x += lyxfont::width(" wide-tab ", font);
- pain.line(box_x, offset,
- paperwidth - LYX_PAPER_MARGIN,
- offset, LColor::footnote);
+ pain.line(box_x, y_offset,
+ workWidth(bview) - LYX_PAPER_MARGIN,
+ y_offset, LColor::footnote);
}
// Draw appendix lines
LyXParagraph * firstpar = row_ptr->par()->FirstPhysicalPar();
if (firstpar->appendix){
- pain.line(1, offset,
- 1, offset + row_ptr->height(),
+ pain.line(1, y_offset,
+ 1, y_offset + row_ptr->height(),
LColor::appendixline);
- pain.line(paperwidth - 2, offset,
- paperwidth - 2, offset + row_ptr->height(),
+ pain.line(ww - 2, y_offset,
+ ww - 2, y_offset + row_ptr->height(),
LColor::appendixline);
}
// Draw minipage line
bool minipage = firstpar->pextra_type == LyXParagraph::PEXTRA_MINIPAGE;
if (minipage)
- pain.line(LYX_PAPER_MARGIN/5 + box_x, offset,
+ pain.line(LYX_PAPER_MARGIN/5 + box_x, y_offset,
LYX_PAPER_MARGIN/5 + box_x,
- offset + row_ptr->height() - 1,
+ y_offset + row_ptr->height() - 1,
LColor::minipageline);
// Draw depth lines
for (int i = 1; i <= depth; ++i) {
int line_x = (LYX_PAPER_MARGIN / 5) * (i + minipage) + box_x;
- pain.line(line_x, offset, line_x,
- offset + row_ptr->height() - 1 - (i - next_depth - 1) * 3,
+ pain.line(line_x, y_offset, line_x,
+ y_offset + row_ptr->height() - 1 - (i - next_depth - 1) * 3,
LColor::depthbar);
if (i > prev_depth)
- pain.fillRectangle(line_x, offset, LYX_PAPER_MARGIN / 5, 2,
+ pain.fillRectangle(line_x, y_offset, LYX_PAPER_MARGIN / 5, 2,
LColor::depthbar);
if (i > next_depth)
pain.fillRectangle(line_x,
- offset + row_ptr->height() - 2 - (i - next_depth - 1) * 3,
+ y_offset + row_ptr->height() - 2 - (i - next_depth - 1) * 3,
LYX_PAPER_MARGIN / 5, 2,
LColor::depthbar);
}
LyXLayout const & layout =
- textclasslist.Style(buffer()->params.textclass,
+ textclasslist.Style(bview->buffer()->params.textclass,
row_ptr->par()->GetLayout());
y_top = 0;
y_bottom = row_ptr->height();
/* is it a first row? */
- if (row_ptr->pos() == 0
- && row_ptr->par() == firstpar) {
+ if (!row_ptr->pos() && (row_ptr->par() == firstpar)) {
/* start of appendix? */
if (row_ptr->par()->start_of_appendix){
- pain.line(1, offset,
- paperwidth - 2, offset,
+ pain.line(1, y_offset,
+ ww - 2, y_offset,
LColor::appendixline);
}
/* think about the margins */
- if (!row_ptr->previous())
+ if (!row_ptr->previous() && bv_owner)
y_top += LYX_PAPER_MARGIN;
if (row_ptr->par()->pagebreak_top){ /* draw a top pagebreak */
LyXFont pb_font;
pb_font.setColor(LColor::pagebreak).decSize();
int w = 0, a = 0, d = 0;
- pain.line(0, offset + y_top + 2*DefaultHeight(),
- paperwidth,
- offset + y_top + 2 * DefaultHeight(),
+ pain.line(0, y_offset + y_top + 2*DefaultHeight(),
+ ww,
+ y_offset + y_top + 2 * DefaultHeight(),
LColor::pagebreak,
Painter::line_onoffdash)
.rectText(0,
pb_font,
LColor::background,
LColor::background, false, w, a, d);
- pain.rectText((paperwidth - w)/2,
- offset + y_top + 2 * DefaultHeight() + d,
+ pain.rectText((ww - w)/2,
+ y_offset + y_top + 2 * DefaultHeight() + d,
_("Page Break (top)"),
pb_font,
LColor::background,
if (row_ptr->par()->added_space_top.kind() == VSpace::VFILL) {
/* draw a vfill top */
- pain.line(0, offset + 2 + y_top,
- LYX_PAPER_MARGIN, offset + 2 + y_top,
+ pain.line(0, y_offset + 2 + y_top,
+ LYX_PAPER_MARGIN, y_offset + 2 + y_top,
LColor::vfillline);
- pain.line(0, offset + y_top + 3 * DefaultHeight(),
+ pain.line(0, y_offset + y_top + 3 * DefaultHeight(),
LYX_PAPER_MARGIN,
- offset + y_top + 3 * DefaultHeight(),
+ y_offset + y_top + 3 * DefaultHeight(),
LColor::vfillline);
- pain.line(LYX_PAPER_MARGIN / 2, offset + 2 + y_top,
+ pain.line(LYX_PAPER_MARGIN / 2, y_offset + 2 + y_top,
LYX_PAPER_MARGIN / 2,
- offset + y_top + 3 * DefaultHeight(),
+ y_offset + y_top + 3 * DefaultHeight(),
LColor::vfillline);
y_top += 3 * DefaultHeight();
}
/* think about user added space */
- y_top += int(row_ptr->par()->added_space_top.inPixels(owner_));
+ y_top += int(row_ptr->par()->added_space_top.inPixels(bview));
/* think about the parskip */
/* some parskips VERY EASY IMPLEMENTATION */
- if (buffer()->params.paragraph_separation == BufferParams::PARSEP_SKIP) {
+ if (bview->buffer()->params.paragraph_separation == BufferParams::PARSEP_SKIP) {
if (layout.latextype == LATEX_PARAGRAPH
&& firstpar->GetDepth() == 0
&& firstpar->Previous())
- y_top += buffer()->params.getDefSkip().inPixels(owner_);
+ y_top += bview->buffer()->params.getDefSkip().inPixels(bview);
else if (firstpar->Previous()
- && textclasslist.Style(buffer()->params.textclass,
+ && textclasslist.Style(bview->buffer()->params.textclass,
firstpar->Previous()->GetLayout()).latextype == LATEX_PARAGRAPH
&& firstpar->Previous()->GetDepth() == 0)
// is it right to use defskip here, too? (AS)
- y_top += buffer()->params.getDefSkip().inPixels(owner_);
+ y_top += bview->buffer()->params.getDefSkip().inPixels(bview);
}
if (row_ptr->par()->line_top) { /* draw a top line */
y_top += lyxfont::ascent('x',
- GetFont(row_ptr->par(), 0));
+ GetFont(bview->buffer(),
+ row_ptr->par(), 0));
- pain.line(0, offset + y_top,
- paperwidth, offset + y_top,
+ pain.line(0, y_offset + y_top,
+ ww, y_offset + y_top,
LColor::topline,
Painter::line_solid,
Painter::line_thick);
- y_top += lyxfont::ascent('x',
- GetFont(row_ptr->par(), 0));
+ y_top += lyxfont::ascent('x',GetFont(bview->buffer(),
+ row_ptr->par(), 0));
}
/* should we print a label? */
&& (layout.labeltype != LABEL_STATIC
|| layout.latextype != LATEX_ENVIRONMENT
|| row_ptr->par()->IsFirstInSequence())) {
- font = GetFont(row_ptr->par(), -2);
+ font = GetFont(bview->buffer(), row_ptr->par(), -2);
if (!row_ptr->par()->GetLabelstring().empty()) {
tmpx = x;
string tmpstring = row_ptr->par()->GetLabelstring();
if (layout.labeltype == LABEL_COUNTER_CHAPTER) {
- if (buffer()->params.secnumdepth >= 0) {
+ if (bview->buffer()->params.secnumdepth >= 0) {
/* this is special code for the chapter layout. This is printed in
* an extra row and has a pagebreak at the top. */
float spacing_val = 1.0;
if (!row_ptr->par()->spacing.isDefault()) {
spacing_val = row_ptr->par()->spacing.getValue();
} else {
- spacing_val = buffer()->params.spacing.getValue();
+ spacing_val = bview->buffer()->params.spacing.getValue();
}
maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * spacing_val)
+ int(layout.parsep) * DefaultHeight();
if (is_rtl)
- tmpx = paperwidth - LeftMargin(row_ptr) -
+ tmpx = ww - LeftMargin(bview, row_ptr) -
lyxfont::width(tmpstring, font);
pain.text(int(tmpx),
- offset + row_ptr->baseline() - row_ptr->ascent_of_text() - maxdesc,
+ y_offset + row_ptr->baseline() - row_ptr->ascent_of_text() - maxdesc,
tmpstring, font);
}
} else {
if (is_rtl) {
- tmpx = paperwidth - LeftMargin(row_ptr)
+ tmpx = ww - LeftMargin(bview, row_ptr)
+ lyxfont::width(layout.labelsep, font);
if (row_ptr->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE) {
LyXFont font(LyXFont::ALL_SANE);
/* draw it! */
pain.text(int(tmpx),
- offset + row_ptr->baseline(),
+ y_offset + row_ptr->baseline(),
tmpstring, font);
}
}
layout.labeltype == LABEL_BIBLIO ||
layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
if (row_ptr->par()->IsFirstInSequence()) {
- font = GetFont(row_ptr->par(), -2);
+ font = GetFont(bview->buffer(),
+ row_ptr->par(), -2);
if (!row_ptr->par()->GetLabelstring().empty()) {
string tmpstring = row_ptr->par()->GetLabelstring();
float spacing_val = 1.0;
if (!row_ptr->par()->spacing.isDefault()) {
spacing_val = row_ptr->par()->spacing.getValue();
} else {
- spacing_val = buffer()->params.spacing.getValue();
+ spacing_val = bview->buffer()->params.spacing.getValue();
}
maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * spacing_val
tmpx = x;
if (layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT){
- tmpx = ( (is_rtl ? LeftMargin(row_ptr) : x)
- + paperwidth - RightMargin(row_ptr) ) / 2;
+ tmpx = ( (is_rtl ? LeftMargin(bview, row_ptr) : x)
+ + ww - RightMargin(bview->buffer(), row_ptr) ) / 2;
tmpx -= lyxfont::width(tmpstring, font) / 2;
} else if (is_rtl)
- tmpx = paperwidth - LeftMargin(row_ptr) -
+ tmpx = ww - LeftMargin(bview, row_ptr) -
lyxfont::width(tmpstring, font);
pain.text(int(tmpx),
- offset + row_ptr->baseline()
+ y_offset + row_ptr->baseline()
- row_ptr->ascent_of_text()
- maxdesc,
tmpstring, font);
}
}
if (layout.labeltype == LABEL_BIBLIO && row_ptr->par()->bibkey) {
- font = GetFont(row_ptr->par(), -1);
+ font = GetFont(bview->buffer(), row_ptr->par(), -1);
if (is_rtl)
- tmpx = paperwidth - LeftMargin(row_ptr)
+ tmpx = ww - LeftMargin(bview, row_ptr)
+ lyxfont::width(layout.labelsep, font);
else
tmpx = x - lyxfont::width(layout.labelsep, font)
- - row_ptr->par()->bibkey->width(owner_->painter(), font);
+ - row_ptr->par()->bibkey->width(bview->painter(), font);
row_ptr->par()->bibkey->draw(pain,
font,
- offset + row_ptr->baseline(),
+ y_offset + row_ptr->baseline(),
tmpx);
}
}
/* is it a last row? */
LyXParagraph * par = row_ptr->par()->LastPhysicalPar();
- if (row_ptr->par()->ParFromPos(last + 1) == par
- && (!row_ptr->next()
- || row_ptr->next()->par() != row_ptr->par())) {
-
+ if ((row_ptr->par()->ParFromPos(last + 1) == par) &&
+ (!row_ptr->next() || (row_ptr->next()->par() != row_ptr->par())))
+ {
/* think about the margins */
- if (!row_ptr->next())
+ if (!row_ptr->next() && bv_owner)
y_bottom -= LYX_PAPER_MARGIN;
/* draw a bottom pagebreak */
pb_font.setColor(LColor::pagebreak).decSize();
int w = 0, a = 0, d = 0;
pain.line(0,
- offset + y_bottom - 2 * DefaultHeight(),
- paperwidth,
- offset + y_bottom - 2 * DefaultHeight(),
+ y_offset + y_bottom - 2 * DefaultHeight(),
+ ww,
+ y_offset + y_bottom - 2 * DefaultHeight(),
LColor::pagebreak,
Painter::line_onoffdash)
.rectText(0,
pb_font,
LColor::background,
LColor::background, false, w, a, d);
- pain.rectText((paperwidth - w) / 2,
- offset + y_top + 2 * DefaultHeight() + d,
+ pain.rectText((ww - w) / 2,
+ y_offset + y_top + 2 * DefaultHeight() + d,
_("Page Break (bottom)"),
pb_font,
LColor::background,
if (firstpar->added_space_bottom.kind() == VSpace::VFILL) {
/* draw a vfill bottom */
- pain.line(0, offset + y_bottom - 3 * DefaultHeight(),
+ pain.line(0, y_offset + y_bottom - 3 * DefaultHeight(),
LYX_PAPER_MARGIN,
- offset + y_bottom - 3 * DefaultHeight(),
+ y_offset + y_bottom - 3 * DefaultHeight(),
LColor::vfillline);
- pain.line(0, offset + y_bottom - 2,
+ pain.line(0, y_offset + y_bottom - 2,
LYX_PAPER_MARGIN,
- offset + y_bottom - 2,
+ y_offset + y_bottom - 2,
LColor::vfillline);
pain.line(LYX_PAPER_MARGIN / 2,
- offset + y_bottom - 3 * DefaultHeight(),
+ y_offset + y_bottom - 3 * DefaultHeight(),
LYX_PAPER_MARGIN / 2,
- offset + y_bottom - 2,
+ y_offset + y_bottom - 2,
LColor::vfillline);
y_bottom -= 3 * DefaultHeight();
}
/* think about user added space */
- y_bottom -= int(firstpar->added_space_bottom.inPixels(owner_));
+ y_bottom -= int(firstpar->added_space_bottom.inPixels(bview));
if (firstpar->line_bottom) {
/* draw a bottom line */
- y_bottom -= lyxfont::ascent('x', GetFont(par, par->Last() - 1));
- pain.line(0, offset + y_bottom,
- paperwidth, offset + y_bottom,
+ y_bottom -= lyxfont::ascent('x', GetFont(bview->buffer(),
+ par, par->Last() - 1));
+ pain.line(0, y_offset + y_bottom,
+ ww, y_offset + y_bottom,
LColor::topline, Painter::line_solid,
Painter::line_thick);
- y_bottom -= lyxfont::ascent('x', GetFont(par, par->Last() - 1));
+ y_bottom -= lyxfont::ascent('x', GetFont(bview->buffer(),
+ par, par->Last() - 1));
}
// draw an endlabel
- int endlabel = row_ptr->par()->GetEndLabel(buffer()->params);
+ int endlabel = row_ptr->par()->GetEndLabel(bview->buffer()->params);
switch (endlabel) {
case END_LABEL_BOX:
case END_LABEL_FILLED_BOX:
{
- LyXFont font = GetFont(row_ptr->par(), last);
+ LyXFont font = GetFont(bview->buffer(),
+ row_ptr->par(), last);
int size = int(0.75 * lyxfont::maxAscent(font));
- int y = (offset + row_ptr->baseline()) - size;
+ int y = (y_offset + row_ptr->baseline()) - size;
int x = is_rtl ? LYX_PAPER_MARGIN
- : paperwidth - LYX_PAPER_MARGIN - size;
+ : ww - LYX_PAPER_MARGIN - size;
if (row_ptr->par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE)
if (is_rtl) {
LyXFont font(LyXFont::ALL_SANE);
case END_LABEL_STATIC:
{
LyXTextClass::LayoutList::size_type layout = row_ptr->par()->GetLayout();
- string tmpstring = textclasslist.Style(buffer()->params.textclass,
+ string tmpstring = textclasslist.Style(bview->buffer()->params.textclass,
layout).endlabelstring();
- font = GetFont(row_ptr->par(), -2);
+ font = GetFont(bview->buffer(), row_ptr->par(), -2);
int tmpx = is_rtl ? int(x) - lyxfont::width(tmpstring, font)
- : paperwidth - RightMargin(row_ptr) - row_ptr->fill();
- pain.text( tmpx, offset + row_ptr->baseline(), tmpstring, font);
+ : ww - RightMargin(bview->buffer(), row_ptr) - row_ptr->fill();
+ pain.text( tmpx, y_offset + row_ptr->baseline(), tmpstring, font);
break;
}
case END_LABEL_NO_LABEL:
!row_ptr->par()->table->TopAlreadyDrawed(cell)) &&
!row_ptr->par()->table->IsContRow(cell))
pain.line(int(x_old),
- offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
+ y_offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
int(x),
- offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
+ y_offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
LColor::tableline,
on_off ? Painter::line_onoffdash : Painter::line_solid);
row_ptr->par()->table->VeryLastRow(cell))
pain.line(int(x_old),
- offset + y_bottom - 1,
+ y_offset + y_bottom - 1,
int(x),
- offset + y_bottom - 1,
+ y_offset + y_bottom - 1,
LColor::tableline,
on_off ? Painter::line_onoffdash : Painter::line_solid);
on_off = !row_ptr->par()->table->LeftLine(cell);
pain.line(int(x_old),
- offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
+ y_offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
int(x_old),
- offset + y_bottom - 1,
+ y_offset + y_bottom - 1,
LColor::tableline,
on_off ? Painter::line_onoffdash : Painter::line_solid);
on_off = !row_ptr->par()->table->RightLine(cell);
pain.line(int(x) - row_ptr->par()->table->AdditionalWidth(cell),
- offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
+ y_offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
int(x) - row_ptr->par()->table->AdditionalWidth(cell),
- offset + y_bottom - 1,
+ y_offset + y_bottom - 1,
LColor::tableline,
on_off ? Painter::line_onoffdash : Painter::line_solid);
x += 1;
pain.line(int(x),
- offset + row_ptr->baseline() - DefaultHeight() / 2,
+ y_offset + row_ptr->baseline() - DefaultHeight() / 2,
int(x),
- offset + row_ptr->baseline(),
+ y_offset + row_ptr->baseline(),
LColor::vfillline);
x += 2;
++vpos;
} else if (row_ptr->par()->IsSeparator(pos)) {
tmpx = x;
- x+= SingleWidth(row_ptr->par(), pos);
+ x+= SingleWidth(bview,
+ row_ptr->par(), pos);
++vpos;
} else
- draw(row_ptr, vpos, offset, x);
+ draw(bview, row_ptr, vpos, y_offset, x);
}
/* do not forget the very last cell. This has no NEWLINE so
!row_ptr->par()->table->IsContRow(cell))
pain.line(int(x_old),
- offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
+ y_offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
int(x),
- offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
+ y_offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
LColor::tableline,
on_off ? Painter::line_onoffdash : Painter::line_solid);
on_off = !row_ptr->par()->table->BottomLine(cell);
row_ptr->par()->table->VeryLastRow(cell))
pain.line(int(x_old),
- offset + y_bottom - 1,
+ y_offset + y_bottom - 1,
int(x),
- offset + y_bottom - 1,
+ y_offset + y_bottom - 1,
LColor::tableline,
on_off ? Painter::line_onoffdash : Painter::line_solid);
on_off = !row_ptr->par()->table->LeftLine(cell);
pain.line(int(x_old),
- offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
+ y_offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
int(x_old),
- offset + y_bottom - 1,
+ y_offset + y_bottom - 1,
LColor::tableline,
on_off ? Painter::line_onoffdash : Painter::line_solid);
on_off = !row_ptr->par()->table->RightLine(cell);
pain.line(int(x) - row_ptr->par()->table->AdditionalWidth(cell),
- offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
+ y_offset + row_ptr->baseline() - row_ptr->ascent_of_text(),
int(x) - row_ptr->par()->table->AdditionalWidth(cell),
- offset + y_bottom - 1,
+ y_offset + y_bottom - 1,
LColor::tableline,
on_off ? Painter::line_onoffdash : Painter::line_solid);
}
/* table stuff -- end*/
#endif
LyXParagraph::size_type main_body =
- BeginningOfMainBody(row_ptr->par());
+ BeginningOfMainBody(bview->buffer(), row_ptr->par());
if (main_body > 0 &&
(main_body-1 > last ||
!row_ptr->par()->IsLineSeparator(main_body - 1)))
pos = vis2log(vpos);
if (main_body > 0 && pos == main_body - 1) {
x += fill_label_hfill
- + lyxfont::width(layout.labelsep, GetFont(row_ptr->par(), -2))
- - SingleWidth(row_ptr->par(),
+ + lyxfont::width(layout.labelsep,
+ GetFont(bview->buffer(),
+ row_ptr->par(), -2))
+ - SingleWidth(bview,
+ row_ptr->par(),
main_body - 1);
}
if (row_ptr->par() ->IsHfill(pos)) {
x += 1;
pain.line(int(x),
- offset + row_ptr->baseline() - DefaultHeight() / 2,
+ y_offset + row_ptr->baseline() - DefaultHeight() / 2,
int(x),
- offset + row_ptr->baseline(),
+ y_offset + row_ptr->baseline(),
LColor::vfillline);
- if (HfillExpansion(row_ptr, pos)) {
+ if (HfillExpansion(bview->buffer(),
+ row_ptr, pos)) {
if (pos >= main_body) {
pain.line(int(x),
- offset + row_ptr->baseline() - DefaultHeight() / 4,
+ y_offset + row_ptr->baseline() - DefaultHeight() / 4,
int(x + fill_hfill),
- offset + row_ptr->baseline() - DefaultHeight() / 4,
+ y_offset + row_ptr->baseline() - DefaultHeight() / 4,
LColor::vfillline,
Painter::line_onoffdash);
x += fill_hfill;
} else {
pain.line(int(x),
- offset + row_ptr->baseline() - DefaultHeight() / 4,
+ y_offset + row_ptr->baseline() - DefaultHeight() / 4,
int(x + fill_label_hfill),
- offset + row_ptr->baseline() - DefaultHeight() / 4,
+ y_offset + row_ptr->baseline() - DefaultHeight() / 4,
LColor::vfillline,
Painter::line_onoffdash);
x += fill_label_hfill;
}
pain.line(int(x),
- offset + row_ptr->baseline() - DefaultHeight() / 2,
+ y_offset + row_ptr->baseline() - DefaultHeight() / 2,
int(x),
- offset + row_ptr->baseline(),
+ y_offset + row_ptr->baseline(),
LColor::vfillline);
}
x += 2;
++vpos;
} else if (row_ptr->par()->IsSeparator(pos)) {
- x += SingleWidth(row_ptr->par(), pos);
+ x += SingleWidth(bview,
+ row_ptr->par(), pos);
if (pos >= main_body)
x += fill_separator;
++vpos;
} else
- draw(row_ptr, vpos, offset, x);
+ draw(bview, row_ptr, vpos, y_offset, x);
}
#ifndef NEW_TABULAR
}
#endif
+ width = max(x - x_offset, float(width));
}
/* returns the column near the specified x-coordinate of the row
* x is set to the real beginning of this column */
-int LyXText::GetColumnNearX(Row * row, int & x, bool & boundary) const
+int LyXText::GetColumnNearX(BufferView * bview, Row * row, int & x,
+ bool & boundary) const
{
float tmpx = 0.0;
float fill_separator, fill_hfill, fill_label_hfill;
- PrepareToPrint(row, tmpx, fill_separator,
+ PrepareToPrint(bview, row, tmpx, fill_separator,
fill_hfill, fill_label_hfill);
LyXParagraph::size_type vc = row->pos();
LyXParagraph::size_type last = RowLastPrintable(row);
LyXParagraph::size_type c = 0;
LyXLayout const & layout =
- textclasslist.Style(buffer()->params.textclass,
+ textclasslist.Style(bview->buffer()->params.textclass,
row->par()->GetLayout());
bool left_side = false;
} else
break;
} else {
- tmpx += SingleWidth(row->par(), c);
+ tmpx += SingleWidth(bview, row->par(), c);
++vc;
}
}
} else {
/* table stuff -- end*/
#endif
- LyXParagraph::size_type main_body = BeginningOfMainBody(row->par());
+ LyXParagraph::size_type
+ main_body = BeginningOfMainBody(bview->buffer(), row->par());
float last_tmpx = tmpx;
if (main_body > 0 &&
if (main_body > 0 && c == main_body-1) {
tmpx += fill_label_hfill +
lyxfont::width(layout.labelsep,
- GetFont(row->par(), -2));
+ GetFont(bview->buffer(), row->par(), -2));
if (row->par()->IsLineSeparator(main_body - 1))
- tmpx -= SingleWidth(row->par(), main_body-1);
+ tmpx -= SingleWidth(bview, row->par(), main_body-1);
}
- if (HfillExpansion(row, c)) {
- x += SingleWidth(row->par(), c);
+ if (HfillExpansion(bview->buffer(), row, c)) {
+ x += SingleWidth(bview, row->par(), c);
if (c >= main_body)
tmpx += fill_hfill;
else
tmpx += fill_label_hfill;
}
else if (row->par()->IsSeparator(c)) {
- tmpx += SingleWidth(row->par(), c);
+ tmpx += SingleWidth(bview, row->par(), c);
if (c >= main_body)
tmpx+= fill_separator;
} else
- tmpx += SingleWidth(row->par(), c);
+ tmpx += SingleWidth(bview, row->par(), c);
++vc;
}
bool rtl = (bidi_level(c) % 2 == 1);
if (left_side == rtl) {
++c;
- boundary = IsBoundary(row->par(), c);
+ boundary = IsBoundary(bview->buffer(), row->par(), c);
}
}
if (!row->par()->table && row->pos() <= last && c > last
&& row->par()->IsNewline(last)) {
if (bidi_level(last) % 2 == 0)
- tmpx -= SingleWidth(row->par(), last);
+ tmpx -= SingleWidth(bview, row->par(), last);
else
- tmpx += SingleWidth(row->par(), last);
+ tmpx += SingleWidth(bview, row->par(), last);
c = last;
}
/* turn the selection into a new environment. If there is no selection,
* create an empty environment */
-void LyXText::InsertFootnoteEnvironment(LyXParagraph::footnote_kind kind)
+void LyXText::InsertFootnoteEnvironment(BufferView * bview,
+ LyXParagraph::footnote_kind kind)
{
/* no footnoteenvironment in a footnoteenvironment */
if (cursor.par()->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
/* ok we have a selection. This is always between sel_start_cursor
* and sel_end cursor */
- SetUndo(Undo::FINISH,
+ SetUndo(bview->buffer(), Undo::FINISH,
sel_start_cursor.par()->ParFromPos(sel_start_cursor.pos())->previous,
sel_end_cursor.par()->ParFromPos(sel_end_cursor.pos())->next);
if (sel_end_cursor.pos() > 0
&& sel_end_cursor.par()->IsLineSeparator(sel_end_cursor.pos() - 1))
- sel_end_cursor.pos(sel_end_cursor.pos() - 1); /* please break before a space at
- * the end */
+ sel_end_cursor.pos(sel_end_cursor.pos() - 1);
+ /* please break before a space at the end */
if (sel_start_cursor.par() == sel_end_cursor.par()
&& sel_start_cursor.pos() > sel_end_cursor.pos())
- sel_start_cursor.pos(sel_start_cursor.pos() - 1);
+ sel_start_cursor.pos(sel_start_cursor.pos() - 1);
- sel_end_cursor.par()->BreakParagraphConservative(buffer()->params, sel_end_cursor.pos());
+ sel_end_cursor.par()->BreakParagraphConservative(bview->buffer()->params, sel_end_cursor.pos());
sel_end_cursor.par(sel_end_cursor.par()->Next());
sel_end_cursor.pos(0);
// don't forget to insert a dummy layout paragraph if necessary
if (sel_start_cursor.par()->GetLayout() != sel_end_cursor.par()->layout){
- sel_end_cursor.par()->BreakParagraphConservative(buffer()->params, 0);
+ sel_end_cursor.par()->BreakParagraphConservative(bview->buffer()->params, 0);
sel_end_cursor.par()->layout = LYX_DUMMY_LAYOUT;
sel_end_cursor.par(sel_end_cursor.par()->next);
}
sel_start_cursor.par()->Erase(sel_start_cursor.pos());
}
- sel_start_cursor.par()->BreakParagraphConservative(buffer()->params,
+ sel_start_cursor.par()->BreakParagraphConservative(bview->buffer()->params,
sel_start_cursor.pos());
tmppar = sel_start_cursor.par()->Next();
|| kind == LyXParagraph::WIDE_FIG
|| kind == LyXParagraph::ALGORITHM) {
pair<bool, LyXTextClass::size_type> lres =
- textclasslist.NumberOfLayout(buffer()->params.textclass,
+ textclasslist.NumberOfLayout(bview->buffer()->params.textclass,
"Caption");
LyXTextClass::size_type lay;
if (lres.first) {
// layout not found
lay = 0; // use default layout "Standard" (0)
}
- tmppar->SetLayout(buffer()->params, lay);
+ tmppar->SetLayout(bview->buffer()->params, lay);
}
} else {
if (sel_start_cursor.pos() > 0) {
tmppar = tmppar->Next();
}
- RedoParagraphs(sel_start_cursor, sel_end_cursor.par()->Next());
+ RedoParagraphs(bview, sel_start_cursor, sel_end_cursor.par()->Next());
- SetCursor(sel_start_cursor.par()->Next(), 0);
+ SetCursor(bview, sel_start_cursor.par()->Next(), 0);
ClearSelection();
}
using std::endl;
using std::pair;
-LyXText::LyXText(BufferView * bv, int pw, Buffer * p)
+LyXText::LyXText(BufferView * bv)
+{
+ bv_owner = bv;
+ inset_owner = 0;
+ init();
+}
+
+
+LyXText::LyXText(InsetText * inset)
+{
+ inset_owner = inset;
+ bv_owner = 0;
+ init();
+}
+
+
+void LyXText::init()
{
- owner_ = bv;
firstrow = 0;
lastrow = 0;
- paperwidth = pw;
- buffer_ = p;
number_of_rows = 0;
refresh_y = 0;
- status = LyXText::UNCHANGED;
- LyXParagraph * par = p->paragraph;
- current_font = GetFont(par, 0);
-
height = 0;
-
- while (par) {
- InsertParagraph(par, lastrow);
- par = par->Next();
- }
-
+ status = LyXText::UNCHANGED;
// set cursor at the very top position
selection = true; /* these setting is necessary
because of the delete-empty-
paragraph mechanism in
SetCursor */
- SetCursor(firstrow->par(), 0);
+ if (bv_owner) {
+ LyXParagraph * par = OwnerParagraph();
+ current_font = GetFont(bv_owner->buffer(), par, 0);
+ while (par) {
+ InsertParagraph(bv_owner, par, lastrow);
+ par = par->Next();
+ }
+ SetCursor(bv_owner, firstrow->par(), 0);
+ } else
+ current_font = LyXFont(LyXFont::ALL_SANE);
+
sel_cursor = cursor;
selection = false;
mark_set = false;
}
+void LyXText::init(BufferView * bview)
+{
+ if (firstrow)
+ return;
+
+ LyXParagraph * par = OwnerParagraph();
+ current_font = GetFont(bview->buffer(), par, 0);
+ while (par) {
+ InsertParagraph(bview, par, lastrow);
+ par = par->Next();
+ }
+ SetCursorIntern(bview, firstrow->par(), 0);
+#if 1
+ // Dump all rowinformation:
+ Row * tmprow = firstrow;
+ lyxerr << "Baseline Paragraph Pos Height Ascent Fill\n";
+ while (tmprow) {
+ lyxerr << tmprow->baseline() << '\t'
+ << tmprow->par() << '\t'
+ << tmprow->pos() << '\t'
+ << tmprow->height() << '\t'
+ << tmprow->ascent_of_text() << '\t'
+ << tmprow->fill() << '\n';
+ tmprow = tmprow->next();
+ }
+ lyxerr.flush();
+#endif
+}
+
LyXText::~LyXText()
{
// Delete all rows, this does not touch the paragraphs!
}
+#if 0
void LyXText::owner(BufferView * bv)
{
- if (owner_ && bv) lyxerr << "LyXText::owner_ already set!" << endl;
- owner_ = bv;
+ if (bv_owner && bv) lyxerr << "LyXText::bv_owner already set!" << endl;
+ bv_owner = bv;
}
+#endif
// Gets the fully instantiated font at a given position in a paragraph
// Basically the same routine as LyXParagraph::getFont() in paragraph.C.
// smaller. (Asger)
// If position is -1, we get the layout font of the paragraph.
// If position is -2, we get the font of the manual label of the paragraph.
-LyXFont LyXText::GetFont(LyXParagraph * par,
+LyXFont LyXText::GetFont(Buffer const * buf, LyXParagraph * par,
LyXParagraph::size_type pos) const
{
LyXLayout const & layout =
- textclasslist.Style(buffer()->params.textclass,
- par->GetLayout());
+ textclasslist.Style(buf->params.textclass, par->GetLayout());
char par_depth = par->GetDepth();
// We specialize the 95% common case:
if (pos >= 0){
// 95% goes here
if (layout.labeltype == LABEL_MANUAL
- && pos < BeginningOfMainBody(par)) {
+ && pos < BeginningOfMainBody(buf, par)) {
// 1% goes here
- return par->GetFontSettings(buffer()->params,
- pos).
- realize(layout.reslabelfont);
+ return par->GetFontSettings(buf->params, pos).
+ realize(layout.reslabelfont);
} else
- return par->GetFontSettings(buffer()->params,
- pos).
- realize(layout.resfont);
+ return par->GetFontSettings(buf->params, pos).
+ realize(layout.resfont);
} else {
// 5% goes here.
// process layoutfont for pos == -1 and labelfont for pos < -1
if (pos >= 0){
// 95% goes here
- if (pos < BeginningOfMainBody(par)) {
+ if (pos < BeginningOfMainBody(buf, par)) {
// 1% goes here
layoutfont = layout.labelfont;
} else {
// 99% goes here
layoutfont = layout.font;
}
- tmpfont = par->GetFontSettings(buffer()->params, pos);
+ tmpfont = par->GetFontSettings(buf->params, pos);
tmpfont.realize(layoutfont);
} else {
// 5% goes here.
par = par->DepthHook(par_depth - 1);
if (par) {
tmpfont.realize(textclasslist.
- Style(buffer()->params.textclass,
+ Style(buf->params.textclass,
par->GetLayout()).font);
par_depth = par->GetDepth();
}
}
- tmpfont.realize(textclasslist.TextClass(buffer()->params.textclass).defaultfont());
+ tmpfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont());
// Cosmetic improvement: If this is an open footnote, make the font
// smaller.
}
-void LyXText::SetCharFont(LyXParagraph * par,
+void LyXText::SetCharFont(Buffer const * buf, LyXParagraph * par,
LyXParagraph::size_type pos,
LyXFont const & fnt)
{
}
LyXLayout const & layout =
- textclasslist.Style(buffer()->params.textclass,
+ textclasslist.Style(buf->params.textclass,
par->GetLayout());
// Get concrete layout font to reduce against
LyXFont layoutfont;
- if (pos < BeginningOfMainBody(par))
+ if (pos < BeginningOfMainBody(buf, par))
layoutfont = layout.labelfont;
else
layoutfont = layout.font;
tp = tp->DepthHook(tp->GetDepth()-1);
if (tp)
layoutfont.realize(textclasslist.
- Style(buffer()->params.textclass,
+ Style(buf->params.textclass,
tp->GetLayout()).font);
}
}
- layoutfont.realize(textclasslist.TextClass(buffer()->params.textclass).defaultfont());
+ layoutfont.realize(textclasslist.TextClass(buf->params.textclass).defaultfont());
if (par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
&& par->footnotekind == LyXParagraph::FOOTNOTE) {
// insert the specified paragraph behind the specified row
-void LyXText::InsertParagraph(LyXParagraph * par, Row * row) const
+void LyXText::InsertParagraph(BufferView * bview, LyXParagraph * par,
+ Row * row) const
{
InsertRow(row, par, 0); /* insert a new row, starting
* at postition 0 */
- SetCounter(par); // set the counters
+ SetCounter(bview->buffer(), par); // set the counters
// and now append the whole paragraph behind the new row
if (!row) {
firstrow->height(0);
- AppendParagraph(firstrow);
+ AppendParagraph(bview, firstrow);
} else {
row->next()->height(0);
- AppendParagraph(row->next());
+ AppendParagraph(bview, row->next());
}
}
-void LyXText::ToggleFootnote()
+void LyXText::ToggleFootnote(BufferView * bview)
{
LyXParagraph * par = cursor.par()->ParFromPos(cursor.pos());
if (par->next
&& par->next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
- OpenFootnote();
- owner_->owner()->getMiniBuffer()->Set(_("Opened float"));
+ OpenFootnote(bview);
+ bview->owner()->getMiniBuffer()->Set(_("Opened float"));
} else {
- owner_->owner()->getMiniBuffer()->Set(_("Closed float"));
- CloseFootnote();
+ bview->owner()->getMiniBuffer()->Set(_("Closed float"));
+ CloseFootnote(bview);
}
}
-void LyXText::OpenStuff()
+void LyXText::OpenStuff(BufferView * bview)
{
if (cursor.pos() == 0 && cursor.par()->bibkey){
- cursor.par()->bibkey->Edit(owner_, 0, 0, 0);
+ cursor.par()->bibkey->Edit(bview, 0, 0, 0);
}
else if (cursor.pos() < cursor.par()->Last()
&& cursor.par()->GetChar(cursor.pos()) == LyXParagraph::META_INSET
&& cursor.par()->GetInset(cursor.pos())->Editable()) {
- owner_->owner()->getMiniBuffer()
+ bview->owner()->getMiniBuffer()
->Set(cursor.par()->GetInset(cursor.pos())->EditMessage());
if (cursor.par()->GetInset(cursor.pos())->Editable() != Inset::HIGHLY_EDITABLE)
- SetCursorParUndo();
- cursor.par()->GetInset(cursor.pos())->Edit(owner_, 0, 0, 0);
+ SetCursorParUndo(bview->buffer());
+ cursor.par()->GetInset(cursor.pos())->Edit(bview, 0, 0, 0);
} else {
- ToggleFootnote();
+ ToggleFootnote(bview);
}
}
-void LyXText::CloseFootnote()
+void LyXText::CloseFootnote(BufferView * bview)
{
LyXParagraph * tmppar;
LyXParagraph * par = cursor.par()->ParFromPos(cursor.pos());
if (!par->next ||
par->next->footnoteflag != LyXParagraph::OPEN_FOOTNOTE) {
- owner_->owner()->getMiniBuffer()
+ bview->owner()->getMiniBuffer()
->Set(_("Nothing to do"));
return;
}
}
// now the cursor is at the beginning of the physical par
- SetCursor(cursor.par(),
+ SetCursor(bview, cursor.par(),
cursor.pos() +
cursor.par()->ParFromPos(cursor.pos())->size());
} else {
// just a little bit faster than movin the cursor
tmppar = tmppar->Previous();
}
- SetCursor(tmppar, tmppar->Last());
+ SetCursor(bview, tmppar, tmppar->Last());
}
// the cursor must be exactly before the footnote
tmppar = 0;
}
- AppendParagraph(cursor.row());
+ AppendParagraph(bview, cursor.row());
- SetCursor(cursor.par(), cursor.pos());
+ SetCursor(bview, cursor.par(), cursor.pos());
sel_cursor = cursor;
// just necessary
if (cursor.row()->next())
- SetHeightOfRow(cursor.row()->next());
+ SetHeightOfRow(bview, cursor.row()->next());
}
/* used in setlayout */
// Asger is not sure we want to do this...
-void LyXText::MakeFontEntriesLayoutSpecific(LyXParagraph * par)
+void LyXText::MakeFontEntriesLayoutSpecific(Buffer const * buf, LyXParagraph * par)
{
LyXLayout const & layout =
- textclasslist.Style(buffer()->params.textclass,
- par->GetLayout());
+ textclasslist.Style(buf->params.textclass, par->GetLayout());
LyXFont layoutfont, tmpfont;
for (LyXParagraph::size_type pos = 0;
pos < par->Last(); ++pos) {
- if (pos < BeginningOfMainBody(par))
+ if (pos < BeginningOfMainBody(buf, par))
layoutfont = layout.labelfont;
else
layoutfont = layout.font;
- tmpfont = par->GetFontSettings(buffer()->params, pos);
+ tmpfont = par->GetFontSettings(buf->params, pos);
tmpfont.reduce(layoutfont);
par->SetFont(pos, tmpfont);
}
}
-LyXParagraph * LyXText::SetLayout(LyXCursor & cur, LyXCursor & sstart_cur,
+LyXParagraph * LyXText::SetLayout(BufferView * bview,
+ LyXCursor & cur, LyXCursor & sstart_cur,
LyXCursor & send_cur,
LyXTextClass::size_type layout)
{
endpar = endpar->Next(); // because of parindents etc.
}
- SetUndo(Undo::EDIT,
+ SetUndo(bview->buffer(), Undo::EDIT,
sstart_cur.par()->ParFromPos(sstart_cur.pos())->previous,
undoendpar);
cur = sstart_cur;
LyXLayout const & lyxlayout =
- textclasslist.Style(buffer()->params.textclass, layout);
+ textclasslist.Style(bview->buffer()->params.textclass, layout);
while (cur.par() != send_cur.par()) {
if (cur.par()->footnoteflag == sstart_cur.par()->footnoteflag) {
- cur.par()->SetLayout(buffer()->params, layout);
- MakeFontEntriesLayoutSpecific(cur.par());
+ cur.par()->SetLayout(bview->buffer()->params, layout);
+ MakeFontEntriesLayoutSpecific(bview->buffer(), cur.par());
LyXParagraph * fppar = cur.par()->FirstPhysicalPar();
fppar->added_space_top = lyxlayout.fill_top ?
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
cur.par(cur.par()->Next());
}
if (cur.par()->footnoteflag == sstart_cur.par()->footnoteflag) {
- cur.par()->SetLayout(buffer()->params, layout);
- MakeFontEntriesLayoutSpecific(cur.par());
+ cur.par()->SetLayout(bview->buffer()->params, layout);
+ MakeFontEntriesLayoutSpecific(bview->buffer(), cur.par());
LyXParagraph * fppar = cur.par()->FirstPhysicalPar();
fppar->added_space_top = lyxlayout.fill_top ?
VSpace(VSpace::VFILL) : VSpace(VSpace::NONE);
}
// set layout over selection and make a total rebreak of those paragraphs
-void LyXText::SetLayout(LyXTextClass::size_type layout)
+void LyXText::SetLayout(BufferView * bview, LyXTextClass::size_type layout)
{
LyXCursor
tmpcursor = cursor; /* store the current cursor */
cursor = sel_start_cursor;
LyXLayout const & lyxlayout =
- textclasslist.Style(buffer()->params.textclass, layout);
+ textclasslist.Style(bview->buffer()->params.textclass, layout);
while (cursor.par() != sel_end_cursor.par()) {
if (cursor.par()->footnoteflag ==
sel_end_cursor = cursor;
}
LyXParagraph *
- endpar = SetLayout(cursor, sel_start_cursor, sel_end_cursor, layout);
+ endpar = SetLayout(bview, cursor, sel_start_cursor,
+ sel_end_cursor, layout);
#endif
- RedoParagraphs(sel_start_cursor, endpar);
+ RedoParagraphs(bview, sel_start_cursor, endpar);
// we have to reset the selection, because the
// geometry could have changed */
- SetCursor(sel_start_cursor.par(), sel_start_cursor.pos(), false);
+ SetCursor(bview, sel_start_cursor.par(),
+ sel_start_cursor.pos(), false);
sel_cursor = cursor;
- SetCursor(sel_end_cursor.par(), sel_end_cursor.pos(), false);
- UpdateCounters(cursor.row());
+ SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos(),
+ false);
+ UpdateCounters(bview, cursor.row());
ClearSelection();
- SetSelection();
- SetCursor(tmpcursor.par(), tmpcursor.pos(), true);
+ SetSelection(bview);
+ SetCursor(bview, tmpcursor.par(), tmpcursor.pos(), true);
}
// increment depth over selection and
// make a total rebreak of those paragraphs
-void LyXText::IncDepth()
+void LyXText::IncDepth(BufferView * bview)
{
// If there is no selection, just use the current paragraph
if (!selection) {
endpar = endpar->Next(); // because of parindents etc.
}
- SetUndo(Undo::EDIT,
+ SetUndo(bview->buffer(), Undo::EDIT,
sel_start_cursor
.par()->ParFromPos(sel_start_cursor.pos())->previous,
undoendpar);
// NOTE: you can't change the depth of a bibliography entry
if (cursor.par()->footnoteflag ==
sel_start_cursor.par()->footnoteflag
- && textclasslist.Style(buffer()->params.textclass,
+ && textclasslist.Style(bview->buffer()->params.textclass,
cursor.par()->GetLayout()
).labeltype != LABEL_BIBLIO) {
LyXParagraph * prev =
if (prev
&& (prev->GetDepth() - cursor.par()->GetDepth() > 0
|| (prev->GetDepth() == cursor.par()->GetDepth()
- && textclasslist.Style(buffer()->params.textclass,
+ && textclasslist.Style(bview->buffer()->params.textclass,
prev->GetLayout()).isEnvironment()))) {
cursor.par()->FirstPhysicalPar()->depth++;
anything_changed = true;
cursor.par()->FirstPhysicalPar()->depth = 0;
}
- RedoParagraphs(sel_start_cursor, endpar);
+ RedoParagraphs(bview, sel_start_cursor, endpar);
// we have to reset the selection, because the
// geometry could have changed
- SetCursor(sel_start_cursor.par(), sel_start_cursor.pos());
+ SetCursor(bview, sel_start_cursor.par(),
+ sel_start_cursor.pos());
sel_cursor = cursor;
- SetCursor(sel_end_cursor.par(), sel_end_cursor.pos());
- UpdateCounters(cursor.row());
+ SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
+ UpdateCounters(bview, cursor.row());
ClearSelection();
- SetSelection();
- SetCursor(tmpcursor.par(), tmpcursor.pos());
+ SetSelection(bview);
+ SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
// decrement depth over selection and
// make a total rebreak of those paragraphs
-void LyXText::DecDepth()
+void LyXText::DecDepth(BufferView * bview)
{
// if there is no selection just set the layout
// of the current paragraph
endpar = endpar->Next(); // because of parindents etc.
}
- SetUndo(Undo::EDIT,
+ SetUndo(bview->buffer(), Undo::EDIT,
sel_start_cursor
.par()->ParFromPos(sel_start_cursor.pos())->previous,
undoendpar);
cursor.par(cursor.par()->Next());
}
- RedoParagraphs(sel_start_cursor, endpar);
+ RedoParagraphs(bview, sel_start_cursor, endpar);
// we have to reset the selection, because the
// geometry could have changed
- SetCursor(sel_start_cursor.par(), sel_start_cursor.pos());
+ SetCursor(bview, sel_start_cursor.par(),
+ sel_start_cursor.pos());
sel_cursor = cursor;
- SetCursor(sel_end_cursor.par(), sel_end_cursor.pos());
- UpdateCounters(cursor.row());
+ SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
+ UpdateCounters(bview, cursor.row());
ClearSelection();
- SetSelection();
- SetCursor(tmpcursor.par(), tmpcursor.pos());
+ SetSelection(bview);
+ SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
// set font over selection and make a total rebreak of those paragraphs
-void LyXText::SetFont(LyXFont const & font, bool toggleall)
+void LyXText::SetFont(BufferView * bview, LyXFont const & font, bool toggleall)
{
// if there is no selection just set the current_font
if (!selection) {
// Determine basis font
LyXFont layoutfont;
- if (cursor.pos() < BeginningOfMainBody(cursor.par()))
- layoutfont = GetFont(cursor.par(), -2);
+ if (cursor.pos() < BeginningOfMainBody(bview->buffer(),
+ cursor.par()))
+ layoutfont = GetFont(bview->buffer(), cursor.par(),-2);
else
- layoutfont = GetFont(cursor.par(), -1);
+ layoutfont = GetFont(bview->buffer(), cursor.par(),-1);
// Update current font
real_current_font.update(font,
- buffer()->params.language_info,
+ bview->buffer()->params.language_info,
toggleall);
// Reduce to implicit settings
// ok we have a selection. This is always between sel_start_cursor
// and sel_end cursor
- SetUndo(Undo::EDIT,
+ SetUndo(bview->buffer(), Undo::EDIT,
sel_start_cursor.par()->ParFromPos(sel_start_cursor.pos())->previous,
sel_end_cursor.par()->ParFromPos(sel_end_cursor.pos())->next);
cursor = sel_start_cursor;
== sel_start_cursor.par()->footnoteflag) {
// an open footnote should behave
// like a closed one
- LyXFont newfont = GetFont(cursor.par(), cursor.pos());
+ LyXFont newfont = GetFont(bview->buffer(),
+ cursor.par(), cursor.pos());
newfont.update(font,
- buffer()->params.language_info,
+ bview->buffer()->params.language_info,
toggleall);
- SetCharFont(cursor.par(), cursor.pos(), newfont);
+ SetCharFont(bview->buffer(),
+ cursor.par(), cursor.pos(), newfont);
cursor.pos(cursor.pos() + 1);
} else {
cursor.pos(0);
}
}
- RedoParagraphs(sel_start_cursor, sel_end_cursor.par()->Next());
+ RedoParagraphs(bview, sel_start_cursor, sel_end_cursor.par()->Next());
// we have to reset the selection, because the
// geometry could have changed
- SetCursor(sel_start_cursor.par(), sel_start_cursor.pos());
+ SetCursor(bview, sel_start_cursor.par(), sel_start_cursor.pos());
sel_cursor = cursor;
- SetCursor(sel_end_cursor.par(), sel_end_cursor.pos());
+ SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
ClearSelection();
- SetSelection();
- SetCursor(tmpcursor.par(), tmpcursor.pos(), true, tmpcursor.boundary());
+ SetSelection(bview);
+ SetCursor(bview, tmpcursor.par(), tmpcursor.pos(), true,
+ tmpcursor.boundary());
}
-void LyXText::RedoHeightOfParagraph(LyXCursor const & cur)
+void LyXText::RedoHeightOfParagraph(BufferView * bview, LyXCursor const & cur)
{
Row * tmprow = cur.row();
long y = cur.y() - tmprow->baseline();
- SetHeightOfRow(tmprow);
+ SetHeightOfRow(bview, tmprow);
LyXParagraph * first_phys_par = tmprow->par()->FirstPhysicalPar();
// find the first row of the paragraph
if (first_phys_par != tmprow->par())
&& tmprow->previous()->par() != first_phys_par) {
tmprow = tmprow->previous();
y -= tmprow->height();
- SetHeightOfRow(tmprow);
+ SetHeightOfRow(bview, tmprow);
}
while (tmprow->previous() && tmprow->previous()->par() == first_phys_par) {
tmprow = tmprow->previous();
y -= tmprow->height();
- SetHeightOfRow(tmprow);
+ SetHeightOfRow(bview, tmprow);
}
// we can set the refreshing parameters now
status = LyXText::NEED_MORE_REFRESH;
refresh_y = y;
refresh_row = tmprow;
- SetCursor(cur.par(), cur.pos(), false, cursor.boundary());
+ SetCursor(bview, cur.par(), cur.pos(), false, cursor.boundary());
}
-void LyXText::RedoDrawingOfParagraph(LyXCursor const & cur)
+void LyXText::RedoDrawingOfParagraph(BufferView * bview, LyXCursor const & cur)
{
Row * tmprow = cur.row();
long y = cur.y() - tmprow->baseline();
- SetHeightOfRow(tmprow);
+ SetHeightOfRow(bview, tmprow);
LyXParagraph * first_phys_par = tmprow->par()->FirstPhysicalPar();
// find the first row of the paragraph
if (first_phys_par != tmprow->par())
refresh_row = tmprow;
}
status = LyXText::NEED_MORE_REFRESH;
- SetCursor(cur.par(), cur.pos());
+ SetCursor(bview, cur.par(), cur.pos());
}
/* deletes and inserts again all paragaphs between the cursor
* and the specified par
* This function is needed after SetLayout and SetFont etc. */
-void LyXText::RedoParagraphs(LyXCursor const & cur,
+void LyXText::RedoParagraphs(BufferView * bview, LyXCursor const & cur,
LyXParagraph const * endpar) const
{
Row * tmprow2;
do {
if (tmppar) {
- InsertParagraph(tmppar, tmprow);
+ InsertParagraph(bview, tmppar, tmprow);
if (!tmprow)
tmprow = firstrow;
while (tmprow->next() && tmprow->next()->par() == tmppar)
// this is because of layout changes
if (refresh_row) {
refresh_y -= refresh_row->height();
- SetHeightOfRow(refresh_row);
+ SetHeightOfRow(bview, refresh_row);
} else {
refresh_row = firstrow;
refresh_y = 0;
- SetHeightOfRow(refresh_row);
+ SetHeightOfRow(bview, refresh_row);
}
if (tmprow && tmprow->next())
- SetHeightOfRow(tmprow->next());
+ SetHeightOfRow(bview, tmprow->next());
}
-bool LyXText::FullRebreak()
+bool LyXText::FullRebreak(BufferView * bview)
{
if (need_break_row) {
- BreakAgain(need_break_row);
+ BreakAgain(bview, need_break_row);
need_break_row = 0;
return true;
}
* They also delete the corresponding row */
// need the selection cursor:
-void LyXText::SetSelection()
+void LyXText::SetSelection(BufferView * bview)
{
if (!selection) {
last_sel_cursor = sel_cursor;
// finished. The solution used currently just works, to make it
// faster we need to be more clever and probably also have more
// calls to stuffClipboard. (Lgb)
- owner_->stuffClipboard(selectionAsString());
+ bview->stuffClipboard(selectionAsString(bview->buffer()));
}
-string LyXText::selectionAsString() const
+string LyXText::selectionAsString(Buffer const * buffer) const
{
if (!selection) return string();
string result;
// Special handling if the whole selection is within one paragraph
if (sel_start_cursor.par() == sel_end_cursor.par()) {
- result += sel_start_cursor.par()->String(sel_start_cursor.pos(),
- sel_end_cursor.pos());
+ result += sel_start_cursor.par()->String(buffer,
+ sel_start_cursor.pos(),
+ sel_end_cursor.pos());
return result;
}
// The selection spans more than one paragraph
// First paragraph in selection
- result += sel_start_cursor.par()->String(sel_start_cursor.pos(),
- sel_start_cursor.par()->Last())
+ result += sel_start_cursor.par()->String(buffer,
+ sel_start_cursor.pos(),
+ sel_start_cursor.par()->Last())
+ "\n\n";
// The paragraphs in between (if any)
LyXCursor tmpcur(sel_start_cursor);
tmpcur.par(tmpcur.par()->Next());
while (tmpcur.par() != sel_end_cursor.par()) {
- result += tmpcur.par()->String(0, tmpcur.par()->Last()) + "\n\n";
+ result += tmpcur.par()->String(buffer, 0, tmpcur.par()->Last()) + "\n\n";
tmpcur.par(tmpcur.par()->Next()); // Or NextAfterFootnote??
}
// Last paragraph in selection
- result += sel_end_cursor.par()->String(0, sel_end_cursor.pos());
+ result += sel_end_cursor.par()->String(buffer, 0, sel_end_cursor.pos());
return result;
}
}
-void LyXText::CursorHome() const
+void LyXText::CursorHome(BufferView * bview) const
{
- SetCursor(cursor.par(), cursor.row()->pos());
+ SetCursor(bview, cursor.par(), cursor.row()->pos());
}
-void LyXText::CursorEnd() const
+void LyXText::CursorEnd(BufferView * bview) const
{
if (!cursor.row()->next() || cursor.row()->next()->par() != cursor.row()->par())
- SetCursor(cursor.par(), RowLast(cursor.row()) + 1);
+ SetCursor(bview, cursor.par(), RowLast(cursor.row()) + 1);
else {
if (cursor.par()->Last() &&
(cursor.par()->GetChar(RowLast(cursor.row())) == ' '
|| cursor.par()->IsNewline(RowLast(cursor.row()))))
- SetCursor(cursor.par(), RowLast(cursor.row()));
+ SetCursor(bview, cursor.par(), RowLast(cursor.row()));
else
- SetCursor(cursor.par(), RowLast(cursor.row()) + 1);
+ SetCursor(bview,cursor.par(), RowLast(cursor.row()) + 1);
}
#ifndef NEW_TABULAR
if (cursor.par()->table) {
if (cursor.par()->table->RowHasContRow(cell) &&
cursor.par()->table->CellHasContRow(cell)<0) {
if (!cursor.row()->next() || cursor.row()->next()->par() != cursor.row()->par())
- SetCursor(cursor.par(), RowLast(cursor.row()) + 1);
+ SetCursor(bview, cursor.par(), RowLast(cursor.row()) + 1);
else {
if (cursor.par()->Last() &&
(cursor.par()->GetChar(RowLast(cursor.row())) == ' '
|| cursor.par()->IsNewline(RowLast(cursor.row()))))
- SetCursor(cursor.par(), RowLast(cursor.row()));
+ SetCursor(bview, cursor.par(), RowLast(cursor.row()));
else
- SetCursor(cursor.par(), RowLast(cursor.row()) + 1);
+ SetCursor(bview, cursor.par(), RowLast(cursor.row()) + 1);
}
}
}
}
-void LyXText::CursorTop() const
+void LyXText::CursorTop(BufferView * bview) const
{
while (cursor.par()->Previous())
cursor.par(cursor.par()->Previous());
- SetCursor(cursor.par(), 0);
+ SetCursor(bview, cursor.par(), 0);
}
-void LyXText::CursorBottom() const
+void LyXText::CursorBottom(BufferView * bview) const
{
while (cursor.par()->Next())
cursor.par(cursor.par()->Next());
- SetCursor(cursor.par(), cursor.par()->Last());
+ SetCursor(bview, cursor.par(), cursor.par()->Last());
}
}
-void LyXText::ToggleFree(LyXFont const & font, bool toggleall)
+void LyXText::ToggleFree(BufferView * bview, LyXFont const & font, bool toggleall)
{
// If the mask is completely neutral, tell user
if (font == LyXFont(LyXFont::ALL_IGNORE)) {
// Could only happen with user style
- owner_->owner()->getMiniBuffer()
+ bview->owner()->getMiniBuffer()
->Set(_("No font change defined. Use Character under"
- " the Layout menu to define font change."));
+ " the Layout menu to define font change."));
return;
}
// is disabled.
LyXCursor resetCursor = cursor;
bool implicitSelection = (font.language() == ignore_language)
- ? SelectWordWhenUnderCursor() : false;
+ ? SelectWordWhenUnderCursor(bview) : false;
// Set font
- SetFont(font, toggleall);
+ SetFont(bview, font, toggleall);
/* Implicit selections are cleared afterwards and cursor is set to the
original position. */
if (implicitSelection) {
ClearSelection();
cursor = resetCursor;
- SetCursor( cursor.par(), cursor.pos() );
+ SetCursor(bview, cursor.par(), cursor.pos());
sel_cursor = cursor;
}
}
LyXParagraph::size_type
-LyXText::BeginningOfMainBody(LyXParagraph const * par) const
+LyXText::BeginningOfMainBody(Buffer const * buf, LyXParagraph const * par) const
{
- if (textclasslist.Style(buffer()->params.textclass,
+ if (textclasslist.Style(buf->params.textclass,
par->GetLayout()).labeltype != LABEL_MANUAL)
return 0;
else
/* if there is a selection, reset every environment you can find
* in the selection, otherwise just the environment you are in */
-void LyXText::MeltFootnoteEnvironment()
+void LyXText::MeltFootnoteEnvironment(BufferView * bview)
{
LyXParagraph * tmppar, * firsttmppar;
if (cursor.par()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE)
return;
- SetUndo(Undo::FINISH,
+ SetUndo(bview->buffer(), Undo::FINISH,
cursor.par()->PreviousBeforeFootnote()->previous,
cursor.par()->NextAfterFootnote()->next);
while (cursor.par()->footnoteflag == LyXParagraph::OPEN_FOOTNOTE)
cursor.par(cursor.par()->Previous());
- SetCursor(cursor.par(), cursor.par()->Last());
+ SetCursor(bview, cursor.par(), cursor.par()->Last());
/* this is just faster than using CursorLeft(); */
firsttmppar = cursor.par()->ParFromPos(cursor.pos());
tmppar->footnoteflag = LyXParagraph::NO_FOOTNOTE;
/* remember the captions and empty paragraphs */
- if ((textclasslist.Style(buffer()->params.textclass,
+ if ((textclasslist.Style(bview->buffer()->params.textclass,
tmppar->GetLayout())
.labeltype == LABEL_SENSITIVE)
|| !tmppar->Last())
- tmppar->SetLayout(buffer()->params, 0);
+ tmppar->SetLayout(bview->buffer()->params, 0);
}
// now we will paste the ex-footnote, if the layouts allow it
if (tmppar->Next()->Last()
&& tmppar->Next()->IsLineSeparator(0))
tmppar->Next()->Erase(0);
- tmppar->PasteParagraph(buffer()->params);
+ tmppar->PasteParagraph(bview->buffer()->params);
}
tmppar = tmppar->Next(); /* make sure tmppar cannot be touched
&& first_footnote_par_is_not_empty) {
firsttmppar->next->InsertChar(0, ' ');
}
- firsttmppar->PasteParagraph(buffer()->params);
+ firsttmppar->PasteParagraph(bview->buffer()->params);
}
/* now redo the paragaphs */
- RedoParagraphs(cursor, tmppar);
+ RedoParagraphs(bview, cursor, tmppar);
- SetCursor(cursor.par(), cursor.pos());
+ SetCursor(bview, cursor.par(), cursor.pos());
/* sometimes it can happen, that there is a counter change */
Row * row = cursor.row();
while (row->next() && row->par() != tmppar && row->next()->par() != tmppar)
row = row->next();
- UpdateCounters(row);
+ UpdateCounters(bview, row);
ClearSelection();
* they do not duplicate themself and you cannnot make dirty things with
* them! */
-void LyXText::SetParagraph(bool line_top, bool line_bottom,
+void LyXText::SetParagraph(BufferView * bview,
+ bool line_top, bool line_bottom,
bool pagebreak_top, bool pagebreak_bottom,
VSpace const & space_top,
VSpace const & space_bottom,
endpar = endpar->Next(); // because of parindents etc.
}
- SetUndo(Undo::EDIT,
+ SetUndo(bview->buffer(), Undo::EDIT,
sel_start_cursor
.par()->ParFromPos(sel_start_cursor.pos())->previous,
undoendpar);
LyXParagraph * tmppar = sel_end_cursor.par();
while (tmppar != sel_start_cursor.par()->FirstPhysicalPar()->Previous()) {
- SetCursor(tmppar->FirstPhysicalPar(), 0);
+ SetCursor(bview, tmppar->FirstPhysicalPar(), 0);
status = LyXText::NEED_MORE_REFRESH;
refresh_row = cursor.row();
refresh_y = cursor.y() - cursor.row()->baseline();
// does the layout allow the new alignment?
if (align == LYX_ALIGN_LAYOUT)
align = textclasslist
- .Style(buffer()->params.textclass,
+ .Style(bview->buffer()->params.textclass,
cursor.par()->GetLayout()).align;
if (align & textclasslist
- .Style(buffer()->params.textclass,
+ .Style(bview->buffer()->params.textclass,
cursor.par()->GetLayout()).alignpossible) {
if (align == textclasslist
- .Style(buffer()->params.textclass,
+ .Style(bview->buffer()->params.textclass,
cursor.par()->GetLayout()).align)
cursor.par()->align = LYX_ALIGN_LAYOUT;
else
tmppar = cursor.par()->FirstPhysicalPar()->Previous();
}
- RedoParagraphs(sel_start_cursor, endpar);
+ RedoParagraphs(bview, sel_start_cursor, endpar);
ClearSelection();
- SetCursor(sel_start_cursor.par(), sel_start_cursor.pos());
+ SetCursor(bview, sel_start_cursor.par(), sel_start_cursor.pos());
sel_cursor = cursor;
- SetCursor(sel_end_cursor.par(), sel_end_cursor.pos());
- SetSelection();
- SetCursor(tmpcursor.par(), tmpcursor.pos());
+ SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
+ SetSelection(bview);
+ SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
-void LyXText::SetParagraphExtraOpt(int type,
+void LyXText::SetParagraphExtraOpt(BufferView * bview, int type,
char const * width,
char const * widthp,
int alignment, bool hfill,
endpar = endpar->Next(); // because of parindents etc.
}
- SetUndo(Undo::EDIT,
+ SetUndo(bview->buffer(), Undo::EDIT,
sel_start_cursor
.par()->ParFromPos(sel_start_cursor.pos())->previous,
undoendpar);
tmppar = sel_end_cursor.par();
while(tmppar != sel_start_cursor.par()->FirstPhysicalPar()->Previous()) {
- SetCursor(tmppar->FirstPhysicalPar(), 0);
+ SetCursor(bview, tmppar->FirstPhysicalPar(), 0);
status = LyXText::NEED_MORE_REFRESH;
refresh_row = cursor.row();
refresh_y = cursor.y() - cursor.row()->baseline();
sel_start_cursor.par()->footnoteflag) {
if (type == LyXParagraph::PEXTRA_NONE) {
if (cursor.par()->pextra_type != LyXParagraph::PEXTRA_NONE) {
- cursor.par()->UnsetPExtraType(buffer()->params);
+ cursor.par()->UnsetPExtraType(bview->buffer()->params);
cursor.par()->pextra_type = LyXParagraph::PEXTRA_NONE;
}
} else {
- cursor.par()->SetPExtraType(buffer()->params,
+ cursor.par()->SetPExtraType(bview->buffer()->params,
type, width, widthp);
cursor.par()->pextra_hfill = hfill;
cursor.par()->pextra_start_minipage = start_minipage;
}
tmppar = cursor.par()->FirstPhysicalPar()->Previous();
}
- RedoParagraphs(sel_start_cursor, endpar);
+ RedoParagraphs(bview, sel_start_cursor, endpar);
ClearSelection();
- SetCursor(sel_start_cursor.par(), sel_start_cursor.pos());
+ SetCursor(bview, sel_start_cursor.par(), sel_start_cursor.pos());
sel_cursor = cursor;
- SetCursor(sel_end_cursor.par(), sel_end_cursor.pos());
- SetSelection();
- SetCursor(tmpcursor.par(), tmpcursor.pos());
+ SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
+ SetSelection(bview);
+ SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
}
}
// set the counter of a paragraph. This includes the labels
-void LyXText::SetCounter(LyXParagraph * par) const
+void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
{
// this is only relevant for the beginning of paragraph
par = par->FirstPhysicalPar();
LyXLayout const & layout =
- textclasslist.Style(buffer()->params.textclass,
+ textclasslist.Style(buf->params.textclass,
par->GetLayout());
LyXTextClass const & textclass =
- textclasslist.TextClass(buffer()->params.textclass);
+ textclasslist.TextClass(buf->params.textclass);
/* copy the prev-counters to this one, unless this is the start of a
footnote or of a bibliography or the very first paragraph */
&& !(par->Previous()->footnoteflag == LyXParagraph::NO_FOOTNOTE
&& par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
&& par->footnotekind == LyXParagraph::FOOTNOTE)
- && !(textclasslist.Style(buffer()->params.textclass,
+ && !(textclasslist.Style(buf->params.textclass,
par->Previous()->GetLayout()
).labeltype != LABEL_BIBLIO
&& layout.labeltype == LABEL_BIBLIO)) {
&& par->Previous()
&& par->Previous()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE
&& (par->PreviousBeforeFootnote()
- && textclasslist.Style(buffer()->params.textclass,
+ && textclasslist.Style(buf->params.textclass,
par->PreviousBeforeFootnote()->GetLayout()
).labeltype >= LABEL_COUNTER_ENUMI)) {
// Any itemize or enumerate environment in a marginnote
*/
if (par->Previous()
&& par->Previous()->GetDepth() < par->GetDepth()
- && textclasslist.Style(buffer()->params.textclass,
+ && textclasslist.Style(buf->params.textclass,
par->Previous()->GetLayout()
).labeltype == LABEL_COUNTER_ENUMI
&& par->enumdepth < 3
if (layout.labeltype >= LABEL_FIRST_COUNTER) {
int i = layout.labeltype - LABEL_FIRST_COUNTER;
- if (i >= 0 && i<= buffer()->params.secnumdepth) {
+ if (i >= 0 && i<= buf->params.secnumdepth) {
par->incCounter(i); // increment the counter
// Is there a label? Useful for Chapter layout
} else { // appendix
switch (2 * LABEL_FIRST_COUNTER - textclass.maxcounter() + i) {
case LABEL_COUNTER_CHAPTER:
- if (par->isRightToLeftPar(buffer()->params))
+ if (par->isRightToLeftPar(buf->params))
s << hebrewCounter(par->getCounter(i));
else
s << alphaCounter(par->getCounter(i));
break;
case LABEL_COUNTER_SECTION:
- if (par->isRightToLeftPar(buffer()->params))
+ if (par->isRightToLeftPar(buf->params))
s << hebrewCounter(par->getCounter(i - 1));
else
s << alphaCounter(par->getCounter(i - 1));
break;
case LABEL_COUNTER_SUBSECTION:
- if (par->isRightToLeftPar(buffer()->params))
+ if (par->isRightToLeftPar(buf->params))
s << hebrewCounter(par->getCounter(i - 2));
else
s << alphaCounter(par->getCounter(i - 2));
break;
case LABEL_COUNTER_SUBSUBSECTION:
- if (par->isRightToLeftPar(buffer()->params))
+ if (par->isRightToLeftPar(buf->params))
s << hebrewCounter(par->getCounter(i-3));
else
s << alphaCounter(par->getCounter(i-3));
break;
case LABEL_COUNTER_PARAGRAPH:
- if (par->isRightToLeftPar(buffer()->params))
+ if (par->isRightToLeftPar(buf->params))
s << hebrewCounter(par->getCounter(i-4));
else
s << alphaCounter(par->getCounter(i-4));
break;
case LABEL_COUNTER_SUBPARAGRAPH:
- if (par->isRightToLeftPar(buffer()->params))
+ if (par->isRightToLeftPar(buf->params))
s << hebrewCounter(par->getCounter(i-5));
else
s << alphaCounter(par->getCounter(i-5));
#endif
switch (par->enumdepth) {
case 1:
- if (par->isRightToLeftPar(buffer()->params))
+ if (par->isRightToLeftPar(buf->params))
s << '('
<< hebrewCounter(number)
<< ')';
<< ')';
break;
case 2:
- if (par->isRightToLeftPar(buffer()->params))
+ if (par->isRightToLeftPar(buf->params))
s << '.' << romanCounter(number);
else
s << romanCounter(number) << '.';
break;
case 3:
- if (par->isRightToLeftPar(buffer()->params))
+ if (par->isRightToLeftPar(buf->params))
s << '.'
<< alphaCounter(number);
else
<< '.';
break;
default:
- if (par->isRightToLeftPar(buffer()->params))
+ if (par->isRightToLeftPar(buf->params))
s << '.' << number;
else
s << number << '.';
if (par->footnoteflag != LyXParagraph::NO_FOOTNOTE
&& (par->footnotekind == LyXParagraph::FIG
|| par->footnotekind == LyXParagraph::WIDE_FIG))
- s = (par->getParLanguage(buffer()->params)->lang() == "hebrew")
+ s = (par->getParLanguage(buf->params)->lang() == "hebrew")
? ":øåéà" : "Figure:";
else if (par->footnoteflag != LyXParagraph::NO_FOOTNOTE
&& (par->footnotekind == LyXParagraph::TAB
|| par->footnotekind == LyXParagraph::WIDE_TAB))
- s = (par->getParLanguage(buffer()->params)->lang() == "hebrew")
+ s = (par->getParLanguage(buf->params)->lang() == "hebrew")
? ":äìáè" : "Table:";
else if (par->footnoteflag != LyXParagraph::NO_FOOTNOTE
&& par->footnotekind == LyXParagraph::ALGORITHM)
- s = (par->getParLanguage(buffer()->params)->lang() == "hebrew")
+ s = (par->getParLanguage(buf->params)->lang() == "hebrew")
? ":íúéøåâìà" : "Algorithm:";
else {
/* par->SetLayout(0);
s = layout->labelstring; */
- s = (par->getParLanguage(buffer()->params)->lang() == "hebrew")
+ s = (par->getParLanguage(buf->params)->lang() == "hebrew")
? " :úåòîùî øñç" : "Senseless: ";
}
}
/* Updates all counters BEHIND the row. Changed paragraphs
* with a dynamic left margin will be rebroken. */
-void LyXText::UpdateCounters(Row * row) const
+void LyXText::UpdateCounters(BufferView * bview, Row * row) const
{
LyXParagraph * par;
if (!row) {
while (row->par() != par)
row = row->next();
- SetCounter(par);
+ SetCounter(bview->buffer(), par);
/* now check for the headline layouts. remember that they
* have a dynamic left margin */
if (!par->IsDummy()
- && ( textclasslist.Style(buffer()->params.textclass,
+ && ( textclasslist.Style(bview->buffer()->params.textclass,
par->layout).margintype == MARGIN_DYNAMIC
- || textclasslist.Style(buffer()->params.textclass,
+ || textclasslist.Style(bview->buffer()->params.textclass,
par->layout).labeltype == LABEL_SENSITIVE)
) {
/* Rebreak the paragraph */
RemoveParagraph(row);
- AppendParagraph(row);
+ AppendParagraph(bview, row);
/* think about the damned open footnotes! */
while (par->Next() &&
while (row->par() != par)
row = row->next();
RemoveParagraph(row);
- AppendParagraph(row);
+ AppendParagraph(bview, row);
}
}
}
/* insets an inset. */
-void LyXText::InsertInset(Inset *inset)
+void LyXText::InsertInset(BufferView * bview, Inset *inset)
{
if (!cursor.par()->InsertInsetAllowed(inset))
return;
- SetUndo(Undo::INSERT,
+ SetUndo(bview->buffer(), Undo::INSERT,
cursor.par()->ParFromPos(cursor.pos())->previous,
cursor.par()->ParFromPos(cursor.pos())->next);
cursor.par()->InsertChar(cursor.pos(), LyXParagraph::META_INSET);
cursor.par()->InsertInset(cursor.pos(), inset);
- InsertChar(LyXParagraph::META_INSET); /* just to rebreak and refresh correctly.
+ InsertChar(bview, LyXParagraph::META_INSET); /* just to rebreak and refresh correctly.
* The character will not be inserted a
* second time */
}
}
-void LyXText::pasteEnvironmentType()
+void LyXText::pasteEnvironmentType(BufferView * bview)
{
- SetLayout(copylayouttype);
+ SetLayout(bview, copylayouttype);
}
#ifdef USE_OLD_CUT_AND_PASTE
-void LyXText::CutSelection(bool doclear)
+void LyXText::CutSelection(Buffer const * buf, bool doclear)
{
// This doesn't make sense, if there is no selection
if (!selection)
endpar = endpar->Next(); // because of parindents etc.
}
- SetUndo(Undo::DELETE,
+ SetUndo(bview->buffer(), Undo::DELETE,
sel_start_cursor
.par->ParFromPos(sel_start_cursor.pos())->previous,
undoendpar);
DeleteSimpleCutBuffer();
// set the textclass
- simple_cut_buffer_textclass = buffer()->params.textclass;
+ simple_cut_buffer_textclass = buf->params.textclass;
#ifdef WITH_WARNINGS
#warning Asger: Make cut more intelligent here.
#else ///////////////////////////////////////////////////////////////////
-void LyXText::CutSelection(bool doclear)
+void LyXText::CutSelection(BufferView * bview, bool doclear)
{
// This doesn't make sense, if there is no selection
if (!selection)
endpar = endpar->Next(); // because of parindents etc.
}
- SetUndo(Undo::DELETE, sel_start_cursor
+ SetUndo(bview->buffer(), Undo::DELETE, sel_start_cursor
.par()->ParFromPos(sel_start_cursor.pos())->previous, undoendpar);
CutAndPaste cap;
int pos = sel_end_cursor.pos();
cap.cutSelection(sel_start_cursor.par(), &endpar,
sel_start_cursor.pos(), pos,
- buffer()->params.textclass, doclear);
+ bview->buffer()->params.textclass, doclear);
sel_end_cursor.pos(pos);
} else {
endpar = sel_end_cursor.par();
int pos = sel_end_cursor.pos();
cap.cutSelection(sel_start_cursor.par(), &endpar,
sel_start_cursor.pos(), pos,
- buffer()->params.textclass, doclear);
+ bview->buffer()->params.textclass, doclear);
cursor.par(endpar);
sel_end_cursor.par(endpar);
sel_end_cursor.pos(pos);
// sometimes necessary
if (doclear)
- sel_start_cursor.par()->StripLeadingSpaces(buffer()->params.textclass);
+ sel_start_cursor.par()->StripLeadingSpaces(bview->buffer()->params.textclass);
- RedoParagraphs(sel_start_cursor, endpar);
+ RedoParagraphs(bview, sel_start_cursor, endpar);
ClearSelection();
cursor = sel_start_cursor;
- SetCursor(cursor.par(), cursor.pos());
+ SetCursor(bview, cursor.par(), cursor.pos());
sel_cursor = cursor;
- UpdateCounters(cursor.row());
+ UpdateCounters(bview, cursor.row());
}
#endif
#ifdef USE_OLD_CUT_AND_PASTE
-void LyXText::CopySelection()
+void LyXText::CopySelection(Buffer const * buf)
{
// this doesnt make sense, if there is no selection
if (!selection)
DeleteSimpleCutBuffer();
// set the textclass
- simple_cut_buffer_textclass = buffer()->params.textclass;
+ simple_cut_buffer_textclass = buf->params.textclass;
// copy behind a space if there is one
while (sel_start_cursor.par()->Last() > sel_start_cursor.pos()
#else //////////////////////////////////////////////////////////////////////
-void LyXText::CopySelection()
+void LyXText::CopySelection(Buffer const * buf)
{
// this doesnt make sense, if there is no selection
if (!selection)
cap.copySelection(sel_start_cursor.par(), sel_end_cursor.par(),
sel_start_cursor.pos(), sel_end_cursor.pos(),
- buffer()->params.textclass);
+ buf->params.textclass);
}
#endif
#ifdef USE_OLD_CUT_AND_PASTE
-void LyXText::PasteSelection()
+void LyXText::PasteSelection(Buffer const * buf)
{
// this does not make sense, if there is nothing to paste
if (!simple_cut_buffer)
/* table stuff -- end */
#endif
- SetUndo(Undo::INSERT,
+ SetUndo(bview->buffer(), Undo::INSERT,
cursor.par()->ParFromPos(cursor.pos())->previous,
cursor.par()->ParFromPos(cursor.pos())->next);
// make sure there is no class difference
cap.SwitchLayoutsBetweenClasses(simple_cut_buffer_textclass,
- buffer()->params.textclass,
+ buf->params.textclass,
simple_cut_buffer);
// make the simple_cut_buffer exactly the same layout than
#else ////////////////////////////////////////////////////////////////////
-void LyXText::PasteSelection()
+void LyXText::PasteSelection(BufferView * bview)
{
- CutAndPaste cap;
+ CutAndPaste cap;
- // this does not make sense, if there is nothing to paste
- if (!cap.checkPastePossible(cursor.par(), cursor.pos()))
- return;
+ // this does not make sense, if there is nothing to paste
+ if (!cap.checkPastePossible(cursor.par(), cursor.pos()))
+ return;
- SetUndo(Undo::INSERT,
- cursor.par()->ParFromPos(cursor.pos())->previous,
- cursor.par()->ParFromPos(cursor.pos())->next);
+ SetUndo(bview->buffer(), Undo::INSERT,
+ cursor.par()->ParFromPos(cursor.pos())->previous,
+ cursor.par()->ParFromPos(cursor.pos())->next);
- LyXParagraph * endpar;
- LyXParagraph * actpar = cursor.par();
- int endpos = cursor.pos();
+ LyXParagraph * endpar;
+ LyXParagraph * actpar = cursor.par();
- int pos = cursor.pos();
- cap.pasteSelection(&actpar, &endpar, pos, buffer()->params.textclass);
- cursor.pos(pos);
-
- RedoParagraphs(cursor, endpar);
+ int pos = cursor.pos();
+ cap.pasteSelection(&actpar, &endpar, pos, bview->buffer()->params.textclass);
- SetCursor(cursor.par(), cursor.pos());
- ClearSelection();
+ RedoParagraphs(bview, cursor, endpar);
+
+ SetCursor(bview, cursor.par(), cursor.pos());
+ ClearSelection();
- sel_cursor = cursor;
- SetCursor(actpar, endpos);
- SetSelection();
- UpdateCounters(cursor.row());
+ sel_cursor = cursor;
+ SetCursor(bview, actpar, pos);
+ SetSelection(bview);
+ UpdateCounters(bview, cursor.row());
}
#endif
// returns a pointer to the very first LyXParagraph
LyXParagraph * LyXText::FirstParagraph() const
{
- return buffer()->paragraph;
+ return OwnerParagraph();
}
// sets the selection over the number of characters of string, no check!!
-void LyXText::SetSelectionOverString(char const * string)
+void LyXText::SetSelectionOverString(BufferView * bview, char const * string)
{
sel_cursor = cursor;
for (int i = 0; string[i]; ++i)
- CursorRight();
- SetSelection();
+ CursorRight(bview);
+ SetSelection(bview);
}
// simple replacing. The font of the first selected character is used
-void LyXText::ReplaceSelectionWithString(char const * str)
+void LyXText::ReplaceSelectionWithString(BufferView * bview, char const * str)
{
- SetCursorParUndo();
+ SetCursorParUndo(bview->buffer());
FreezeUndo();
if (!selection) { // create a dummy selection
// Get font setting before we cut
LyXParagraph::size_type pos = sel_end_cursor.pos();
- LyXFont font = sel_start_cursor.par()->GetFontSettings(buffer()->params,
+ LyXFont font = sel_start_cursor.par()->GetFontSettings(bview->buffer()->params,
sel_start_cursor.pos());
// Insert the new string
}
// Cut the selection
- CutSelection();
+ CutSelection(bview);
UnFreezeUndo();
}
// if the string can be found: return true and set the cursor to
// the new position
-bool LyXText::SearchForward(char const * str) const
+bool LyXText::SearchForward(BufferView * bview, char const * str) const
{
LyXParagraph * par = cursor.par();
LyXParagraph::size_type pos = cursor.pos();
}
}
if (par) {
- SetCursor(par, pos);
+ SetCursor(bview, par, pos);
return true;
}
else
}
-bool LyXText::SearchBackward(char const * string) const
+bool LyXText::SearchBackward(BufferView * bview, char const * string) const
{
LyXParagraph * par = cursor.par();
int pos = cursor.pos();
} while (par && !IsStringInText(par, pos, string));
if (par) {
- SetCursor(par, pos);
+ SetCursor(bview, par, pos);
return true;
} else
return false;
// needed to insert the selection
-void LyXText::InsertStringA(string const & str)
+void LyXText::InsertStringA(BufferView * bview, string const & str)
{
LyXParagraph * par = cursor.par();
LyXParagraph::size_type pos = cursor.pos();
int cell = 0;
LyXParagraph * endpar = cursor.par()->Next();
- SetCursorParUndo();
+ SetCursorParUndo(bview->buffer());
bool flag =
- textclasslist.Style(buffer()->params.textclass,
+ textclasslist.Style(bview->buffer()->params.textclass,
cursor.par()->GetLayout()).isEnvironment();
// only to be sure, should not be neccessary
ClearSelection();
}
++pos;
}
- par->BreakParagraph(buffer()->params, pos, flag);
+ par->BreakParagraph(bview->buffer()->params, pos, flag);
par = par->Next();
pos = 0;
#ifndef NEW_TABULAR
++i;
}
- RedoParagraphs(cursor, endpar);
- SetCursor(cursor.par(), cursor.pos());
+ RedoParagraphs(bview, cursor, endpar);
+ SetCursor(bview, cursor.par(), cursor.pos());
sel_cursor = cursor;
- SetCursor(par, pos);
- SetSelection();
+ SetCursor(bview, par, pos);
+ SetSelection(bview);
}
* that are ignored .Double spaces are also converted into one. Spaces at
* the beginning of a paragraph are forbidden. tabs are converted into one
* space. then InsertStringA is called */
-void LyXText::InsertStringB(string const & s)
+void LyXText::InsertStringB(BufferView * bview, string const & s)
{
string str(s);
LyXParagraph * par = cursor.par();
}
++i;
}
- InsertStringA(str);
+ InsertStringA(bview, str);
}
-bool LyXText::GotoNextError() const
+bool LyXText::GotoNextError(BufferView * bview) const
{
LyXCursor res = cursor;
do {
&& res.par()->GetInset(res.pos())->AutoDelete()));
if (res.par()) {
- SetCursor(res.par(), res.pos());
+ SetCursor(bview, res.par(), res.pos());
return true;
}
return false;
}
-bool LyXText::GotoNextNote() const
+bool LyXText::GotoNextNote(BufferView * bview) const
{
LyXCursor res = cursor;
do {
&& res.par()->GetInset(res.pos())->LyxCode() == Inset::IGNORE_CODE));
if (res.par()) {
- SetCursor(res.par(), res.pos());
+ SetCursor(bview, res.par(), res.pos());
return true;
}
return false;
}
-void LyXText::CheckParagraph(LyXParagraph * par,
+void LyXText::CheckParagraph(BufferView * bview, LyXParagraph * par,
LyXParagraph::size_type pos)
{
LyXCursor tmpcursor;
/* table stuff -- begin*/
if (par->table) {
- CheckParagraphInTable(par, pos);
+ CheckParagraphInTable(bview, par, pos);
}
else {
#endif
// is there a break one row above
if (row->previous() && row->previous()->par() == row->par()) {
- z = NextBreakPoint(row->previous(), paperwidth);
+ z = NextBreakPoint(bview, row->previous(), workWidth(bview));
if ( z >= row->pos()) {
// set the dimensions of the row above
y -= row->previous()->height();
refresh_row = row->previous();
status = LyXText::NEED_MORE_REFRESH;
- BreakAgain(row->previous());
+ BreakAgain(bview, row->previous());
// set the cursor again. Otherwise
// dangling pointers are possible
- SetCursor(cursor.par(), cursor.pos());
+ SetCursor(bview, cursor.par(), cursor.pos());
sel_cursor = cursor;
return;
}
refresh_y = y;
refresh_row = row;
- BreakAgain(row);
+ BreakAgain(bview, row);
if (row->height() == tmpheight && RowLast(row) == tmplast)
status = LyXText::NEED_VERY_LITTLE_REFRESH;
else
status = LyXText::NEED_MORE_REFRESH;
// check the special right address boxes
- if (textclasslist.Style(buffer()->params.textclass,
+ if (textclasslist.Style(bview->buffer()->params.textclass,
par->GetLayout()).margintype
== MARGIN_RIGHT_ADDRESS_BOX) {
tmpcursor.par(par);
tmpcursor.x(0);
tmpcursor.x_fix(0);
tmpcursor.pos(pos);
- RedoDrawingOfParagraph(tmpcursor);
+ RedoDrawingOfParagraph(bview, tmpcursor);
}
#ifndef NEW_TABULAR
}
if (selection) {
tmpcursor = cursor;
- SetCursorIntern(sel_cursor.par(), sel_cursor.pos());
+ SetCursorIntern(bview, sel_cursor.par(), sel_cursor.pos());
sel_cursor = cursor;
- SetCursorIntern(sel_start_cursor.par(), sel_start_cursor.pos());
+ SetCursorIntern(bview, sel_start_cursor.par(),
+ sel_start_cursor.pos());
sel_start_cursor = cursor;
- SetCursorIntern(sel_end_cursor.par(), sel_end_cursor.pos());
+ SetCursorIntern(bview, sel_end_cursor.par(),
+ sel_end_cursor.pos());
sel_end_cursor = cursor;
- SetCursorIntern(last_sel_cursor.par(), last_sel_cursor.pos());
+ SetCursorIntern(bview, last_sel_cursor.par(),
+ last_sel_cursor.pos());
last_sel_cursor = cursor;
cursor = tmpcursor;
}
- SetCursorIntern(cursor.par(), cursor.pos());
+ SetCursorIntern(bview, cursor.par(), cursor.pos());
}
// returns 0 if inset wasn't found
-int LyXText::UpdateInset(Inset * inset)
+int LyXText::UpdateInset(BufferView * bview, Inset * inset)
{
// first check the current paragraph
int pos = cursor.par()->GetPositionOfInset(inset);
if (pos != -1){
- CheckParagraph(cursor.par(), pos);
+ CheckParagraph(bview, cursor.par(), pos);
return 1;
}
if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
pos = par->GetPositionOfInset(inset);
if (pos != -1){
- CheckParagraph(par, pos);
+ CheckParagraph(bview, par, pos);
return 1;
}
}
}
-void LyXText::SetCursor(LyXParagraph * par,
+void LyXText::SetCursor(BufferView * bview, LyXParagraph * par,
LyXParagraph::size_type pos,
bool setfont, bool boundary) const
{
LyXCursor old_cursor = cursor;
- SetCursorIntern(par, pos, setfont, boundary);
- DeleteEmptyParagraphMechanism(old_cursor);
+ SetCursorIntern(bview, par, pos, setfont, boundary);
+ DeleteEmptyParagraphMechanism(bview, old_cursor);
}
-void LyXText::SetCursor(LyXCursor & cur, LyXParagraph * par,
+void LyXText::SetCursor(BufferView *bview, LyXCursor & cur, LyXParagraph * par,
LyXParagraph::size_type pos, bool boundary) const
{
// correct the cursor position if impossible
/* now get the cursors x position */
float x;
float fill_separator, fill_hfill, fill_label_hfill;
- PrepareToPrint(row, x, fill_separator, fill_hfill, fill_label_hfill);
+ PrepareToPrint(bview, row, x, fill_separator, fill_hfill,
+ fill_label_hfill);
LyXParagraph::size_type cursor_vpos = 0;
LyXParagraph::size_type last = RowLastPrintable(row);
if (last < row->pos())
cursor_vpos = row->pos();
else if (pos > last && !boundary)
- cursor_vpos = (row->par()->isRightToLeftPar(buffer()->params))
+ cursor_vpos = (row->par()->isRightToLeftPar(bview->buffer()->params))
? row->pos() : last + 1;
else if (pos > row->pos() &&
(pos > last || boundary ||
++cell;
x += row->par()->table->GetBeginningOfTextInCell(cell);
} else {
- x += SingleWidth(row->par(), pos);
+ x += SingleWidth(bview, row->par(), pos);
}
}
} else {
/* table stuff -- end*/
#endif
LyXParagraph::size_type main_body =
- BeginningOfMainBody(row->par());
+ BeginningOfMainBody(bview->buffer(), row->par());
if ((main_body > 0) &&
((main_body-1 > last) ||
!row->par()->IsLineSeparator(main_body-1)))
if (main_body > 0 && pos == main_body-1) {
x += fill_label_hfill +
lyxfont::width(textclasslist.Style(
- buffer()->params.textclass,
+ bview->buffer()->params.textclass,
row->par()->GetLayout())
.labelsep,
- GetFont(row->par(), -2));
+ GetFont(bview->buffer(), row->par(), -2));
if (row->par()->IsLineSeparator(main_body-1))
- x -= SingleWidth(row->par(),main_body-1);
+ x -= SingleWidth(bview, row->par(),main_body-1);
}
- if (HfillExpansion(row, pos)) {
- x += SingleWidth(row->par(), pos);
+ if (HfillExpansion(bview->buffer(), row, pos)) {
+ x += SingleWidth(bview, row->par(), pos);
if (pos >= main_body)
x += fill_hfill;
else
x += fill_label_hfill;
} else if (row->par()->IsSeparator(pos)) {
- x += SingleWidth(row->par(), pos);
+ x += SingleWidth(bview, row->par(), pos);
if (pos >= main_body)
x += fill_separator;
} else
- x += SingleWidth(row->par(), pos);
+ x += SingleWidth(bview, row->par(), pos);
}
#ifndef NEW_TABULAR
}
}
-void LyXText::SetCursorIntern(LyXParagraph * par,
+void LyXText::SetCursorIntern(BufferView * bview, LyXParagraph * par,
LyXParagraph::size_type pos,
bool setfont, bool boundary) const
{
- SetCursor(cursor, par, pos, boundary);
+ SetCursor(bview, cursor, par, pos, boundary);
// #warning Remove this when verified working (Jug 20000413)
#if 0
// correct the cursor position if impossible
if (main_body > 0 && pos == main_body-1) {
x += fill_label_hfill +
lyxfont::width(textclasslist
- .Style(buffer()->params.textclass,
+ .Style(bview->buffer()->params.textclass,
row->par()->GetLayout())
.labelsep,
GetFont(row->par(), -2));
cursor.row() = row;
#endif
if (setfont)
- SetCurrentFont();
+ SetCurrentFont(bview);
}
-void LyXText::SetCurrentFont() const
+void LyXText::SetCurrentFont(BufferView * bview) const
{
LyXParagraph::size_type pos = cursor.pos();
if (cursor.boundary() && pos > 0)
}
}
- current_font = cursor.par()->GetFontSettings(buffer()->params, pos);
- real_current_font = GetFont(cursor.par(), pos);
+ current_font = cursor.par()->GetFontSettings(bview->buffer()->params, pos);
+ real_current_font = GetFont(bview->buffer(), cursor.par(), pos);
}
-void LyXText::SetCursorFromCoordinates(int x, long y) const
+void LyXText::SetCursorFromCoordinates(BufferView * bview, int x, long y) const
{
LyXCursor old_cursor = cursor;
cursor.par(row->par());
bool bound = false;
- int column = GetColumnNearX(row, x, bound);
+ int column = GetColumnNearX(bview, row, x, bound);
cursor.pos(row->pos() + column);
cursor.x(x);
cursor.y(y + row->baseline());
cursor.row(row);
cursor.boundary(bound);
- SetCurrentFont();
- DeleteEmptyParagraphMechanism(old_cursor);
+ SetCurrentFont(bview);
+ DeleteEmptyParagraphMechanism(bview, old_cursor);
}
-void LyXText::SetCursorFromCoordinates(LyXCursor & cur, int x, long y) const
+void LyXText::SetCursorFromCoordinates(BufferView * bview, LyXCursor & cur,
+ int x, long y) const
{
/* get the row first */
Row * row = GetRowNearY(y);
bool bound = false;
- int column = GetColumnNearX(row, x, bound);
+ int column = GetColumnNearX(bview, row, x, bound);
cur.par(row->par());
cur.pos(row->pos() + column);
}
-void LyXText::CursorLeft(bool internal) const
+void LyXText::CursorLeft(BufferView * bview, bool internal) const
{
- CursorLeftIntern(internal);
+ CursorLeftIntern(bview, internal);
#ifndef NEW_TABULAR
if (cursor.par()->table) {
int cell = NumberOfCell(cursor.par(), cursor.pos());
if (cursor.par()->table->IsContRow(cell)
&& cursor.par()->table->CellHasContRow(cursor.par()->table->GetCellAbove(cell)) < 0) {
- CursorUp();
+ CursorUp(bview);
}
}
#endif
}
-void LyXText::CursorLeftIntern(bool internal) const
+void LyXText::CursorLeftIntern(BufferView * bview, bool internal) const
{
if (cursor.pos() > 0) {
bool boundary = cursor.boundary();
- SetCursor(cursor.par(), cursor.pos() - 1, true, false);
+ SetCursor(bview, cursor.par(), cursor.pos() - 1, true, false);
if (!internal && !boundary &&
- IsBoundary(cursor.par(), cursor.pos() + 1))
- SetCursor(cursor.par(), cursor.pos() + 1, true, true);
+ IsBoundary(bview->buffer(), cursor.par(), cursor.pos() + 1))
+ SetCursor(bview, cursor.par(), cursor.pos() + 1, true, true);
} else if (cursor.par()->Previous()) { // steps into the above paragraph.
LyXParagraph * par = cursor.par()->Previous();
LyXParagraph::size_type pos = par->Last();
- SetCursor(par, pos);
- if (IsBoundary(par, pos))
- SetCursor(par, pos, false, true);
+ SetCursor(bview, par, pos);
+ if (IsBoundary(bview->buffer(), par, pos))
+ SetCursor(bview, par, pos, false, true);
}
}
-void LyXText::CursorRight(bool internal) const
+void LyXText::CursorRight(BufferView * bview, bool internal) const
{
- CursorRightIntern(internal);
+ CursorRightIntern(bview, internal);
#ifndef NEW_TABULAR
if (cursor.par()->table) {
int cell = NumberOfCell(cursor.par(), cursor.pos());
if (cursor.par()->table->IsContRow(cell) &&
cursor.par()->table->CellHasContRow(cursor.par()->table->GetCellAbove(cell))<0) {
- CursorUp();
+ CursorUp(bview);
}
}
#endif
}
-void LyXText::CursorRightIntern(bool internal) const
+void LyXText::CursorRightIntern(BufferView * bview, bool internal) const
{
if (cursor.pos() < cursor.par()->Last()) {
if (!internal && cursor.boundary() &&
(!cursor.par()->table || !cursor.par()->IsNewline(cursor.pos())))
- SetCursor(cursor.par(), cursor.pos(), true, false);
+ SetCursor(bview, cursor.par(), cursor.pos(), true, false);
else {
- SetCursor(cursor.par(), cursor.pos() + 1, true, false);
- if (!internal && IsBoundary(cursor.par(), cursor.pos()))
- SetCursor(cursor.par(), cursor.pos(), true, true);
+ SetCursor(bview, cursor.par(), cursor.pos() + 1, true, false);
+ if (!internal && IsBoundary(bview->buffer(), cursor.par(), cursor.pos()))
+ SetCursor(bview, cursor.par(), cursor.pos(), true, true);
}
} else if (cursor.par()->Next())
- SetCursor(cursor.par()->Next(), 0);
+ SetCursor(bview, cursor.par()->Next(), 0);
}
-void LyXText::CursorUp() const
+void LyXText::CursorUp(BufferView * bview) const
{
- SetCursorFromCoordinates(cursor.x_fix(),
+ SetCursorFromCoordinates(bview, cursor.x_fix(),
cursor.y() - cursor.row()->baseline() - 1);
#ifndef NEW_TABULAR
if (cursor.par()->table) {
int cell = NumberOfCell(cursor.par(), cursor.pos());
if (cursor.par()->table->IsContRow(cell) &&
cursor.par()->table->CellHasContRow(cursor.par()->table->GetCellAbove(cell))<0) {
- CursorUp();
+ CursorUp(bview);
}
}
#endif
}
-void LyXText::CursorDown() const
+void LyXText::CursorDown(BufferView * bview) const
{
#ifndef NEW_TABULAR
if (cursor.par()->table &&
return;
#endif
- SetCursorFromCoordinates(cursor.x_fix(),
+ SetCursorFromCoordinates(bview, cursor.x_fix(),
cursor.y() - cursor.row()->baseline()
+ cursor.row()->height() + 1);
#ifndef NEW_TABULAR
while(cursor.par()->table &&
cursor.par()->table->IsContRow(cell) &&
(cursor.par()->table->CellHasContRow(cell_above)<0)) {
- SetCursorFromCoordinates(cursor.x_fix(),
+ SetCursorFromCoordinates(bview, cursor.x_fix(),
cursor.y() - cursor.row()->baseline()
+ cursor.row()->height() + 1);
if (cursor.par()->table) {
}
-void LyXText::CursorUpParagraph() const
+void LyXText::CursorUpParagraph(BufferView * bview) const
{
if (cursor.pos() > 0) {
- SetCursor(cursor.par(), 0);
+ SetCursor(bview, cursor.par(), 0);
}
else if (cursor.par()->Previous()) {
- SetCursor(cursor.par()->Previous(), 0);
+ SetCursor(bview, cursor.par()->Previous(), 0);
}
}
-void LyXText::CursorDownParagraph() const
+void LyXText::CursorDownParagraph(BufferView * bview) const
{
if (cursor.par()->Next()) {
- SetCursor(cursor.par()->Next(), 0);
+ SetCursor(bview, cursor.par()->Next(), 0);
} else {
- SetCursor(cursor.par(), cursor.par()->Last());
+ SetCursor(bview, cursor.par(), cursor.par()->Last());
}
}
-void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
+void LyXText::DeleteEmptyParagraphMechanism(BufferView * bview,
+ LyXCursor const & old_cursor) const
{
// Would be wrong to delete anything if we have a selection.
if (selection) return;
// We allow all kinds of "mumbo-jumbo" when freespacing.
- if (textclasslist.Style(buffer()->params.textclass,
+ if (textclasslist.Style(bview->buffer()->params.textclass,
old_cursor.par()->GetLayout()).free_spacing)
return;
&& old_cursor.par()->IsLineSeparator(old_cursor.pos())
&& old_cursor.par()->IsLineSeparator(old_cursor.pos() - 1)) {
old_cursor.par()->Erase(old_cursor.pos() - 1);
- RedoParagraphs(old_cursor, old_cursor.par()->Next());
+ RedoParagraphs(bview, old_cursor, old_cursor.par()->Next());
// correct cursor
if (old_cursor.par() == cursor.par() &&
cursor.pos() > old_cursor.pos()) {
- SetCursorIntern(cursor.par(), cursor.pos() - 1);
+ SetCursorIntern(bview, cursor.par(),
+ cursor.pos() - 1);
} else
- SetCursorIntern(cursor.par(), cursor.pos());
+ SetCursorIntern(bview, cursor.par(),
+ cursor.pos());
return;
}
}
// Do not delete empty paragraphs with keepempty set.
- if ((textclasslist.Style(buffer()->params.textclass,
+ if ((textclasslist.Style(bview->buffer()->params.textclass,
old_cursor.par()->GetLayout())).keepempty)
return;
endpar = endpar->LastPhysicalPar()->Next();
}
}
- SetUndo(Undo::DELETE,
+ SetUndo(bview->buffer(), Undo::DELETE,
old_cursor.par()->previous,
endpar);
cursor = tmpcursor;
// delete old row
RemoveRow(old_cursor.row());
- if (buffer()->paragraph == old_cursor.par()) {
- buffer_->paragraph = buffer_->paragraph->next;
+ if (OwnerParagraph() == old_cursor.par()) {
+ OwnerParagraph(OwnerParagraph()->next);
}
// delete old par
delete old_cursor.par();
* next row can change its height,
* if there is another layout before */
if (refresh_row->next()) {
- BreakAgain(refresh_row->next());
- UpdateCounters(refresh_row);
+ BreakAgain(bview, refresh_row->next());
+ UpdateCounters(bview, refresh_row);
}
- SetHeightOfRow(refresh_row);
+ SetHeightOfRow(bview, refresh_row);
} else {
refresh_row = old_cursor.row()->next();
refresh_y = old_cursor.y() - old_cursor.row()->baseline();
endpar = endpar->LastPhysicalPar()->Next();
}
}
- SetUndo(Undo::DELETE,
+ SetUndo(bview->buffer(), Undo::DELETE,
old_cursor.par()->previous,
endpar);
cursor = tmpcursor;
// delete old row
RemoveRow(old_cursor.row());
// delete old par
- if (buffer()->paragraph == old_cursor.par()) {
- buffer_->paragraph = buffer_->paragraph->next;
+ if (OwnerParagraph() == old_cursor.par()) {
+ OwnerParagraph(OwnerParagraph()->next);
}
delete old_cursor.par();
if there is another layout before
*/
if (refresh_row) {
- BreakAgain(refresh_row);
- UpdateCounters(refresh_row->previous());
+ BreakAgain(bview, refresh_row);
+ UpdateCounters(bview, refresh_row->previous());
}
}
// correct cursor y
- SetCursorIntern(cursor.par(), cursor.pos());
+ SetCursorIntern(bview, cursor.par(), cursor.pos());
if (sel_cursor.par() == old_cursor.par()
&& sel_cursor.pos() == sel_cursor.pos()) {
}
}
if (!deleted) {
- if (old_cursor.par()->StripLeadingSpaces(buffer()->params.textclass)) {
- RedoParagraphs(old_cursor, old_cursor.par()->Next());
+ if (old_cursor.par()->StripLeadingSpaces(bview->buffer()->params.textclass)) {
+ RedoParagraphs(bview, old_cursor, old_cursor.par()->Next());
// correct cursor y
- SetCursorIntern(cursor.par(), cursor.pos());
+ SetCursorIntern(bview, cursor.par(), cursor.pos());
sel_cursor = cursor;
}
}
// undo functions
-bool LyXText::TextUndo()
+bool LyXText::TextUndo(BufferView * bview)
{
// returns false if no undo possible
- Undo * undo = buffer_->undostack.pop();
+ Undo * undo = bview->buffer()->undostack.pop();
if (undo) {
FinishUndo();
if (!undo_frozen)
- buffer_->redostack
- .push(CreateUndo(undo->kind,
+ bview->buffer()->redostack
+ .push(CreateUndo(bview->buffer(), undo->kind,
GetParFromID(undo->number_of_before_par),
GetParFromID(undo->number_of_behind_par)));
}
- return TextHandleUndo(undo);
+ return TextHandleUndo(bview, undo);
}
-bool LyXText::TextRedo()
+bool LyXText::TextRedo(BufferView * bview)
{
// returns false if no redo possible
- Undo * undo = buffer_->redostack.pop();
+ Undo * undo = bview->buffer()->redostack.pop();
if (undo) {
FinishUndo();
if (!undo_frozen)
- buffer_->undostack
- .push(CreateUndo(undo->kind,
+ bview->buffer()->undostack
+ .push(CreateUndo(bview->buffer(), undo->kind,
GetParFromID(undo->number_of_before_par),
GetParFromID(undo->number_of_behind_par)));
}
- return TextHandleUndo(undo);
+ return TextHandleUndo(bview, undo);
}
-bool LyXText::TextHandleUndo(Undo * undo)
+bool LyXText::TextHandleUndo(BufferView * bview, Undo * undo)
{
// returns false if no undo possible
bool result = false;
// if there's no before take the beginning
// of the document for redoing
if (!before)
- SetCursorIntern(FirstParagraph(), 0);
+ SetCursorIntern(bview, FirstParagraph(), 0);
// replace the paragraphs with the undo informations
if (before)
tmppar5 = before->next;
else
- tmppar5 = buffer()->paragraph;
+ tmppar5 = OwnerParagraph();
tmppar2 = tmppar3;
while (tmppar5 && tmppar5 != behind){
tmppar = tmppar5;
if (before)
before->next = tmppar3;
else
- buffer_->paragraph = tmppar3;
+ OwnerParagraph(tmppar3);
tmppar3->previous = before;
}
else {
if (!before)
- buffer_->paragraph = behind;
+ OwnerParagraph(behind);
}
if (tmppar4) {
tmppar4->next = behind;
// Set the cursor for redoing
if (before) {
- SetCursorIntern(before->FirstSelfrowPar(), 0);
+ SetCursorIntern(bview, before->FirstSelfrowPar(), 0);
// check wether before points to a closed float and open it if necessary
if (before && before->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE
&& before->next && before->next->footnoteflag != LyXParagraph::NO_FOOTNOTE){
endpar = behind;
tmppar = GetParFromID(undo->number_of_cursor_par);
- RedoParagraphs(cursor, endpar);
+ RedoParagraphs(bview, cursor, endpar);
if (tmppar){
- SetCursorIntern(tmppar, undo->cursor_pos);
- UpdateCounters(cursor.row());
+ SetCursorIntern(bview, tmppar, undo->cursor_pos);
+ UpdateCounters(bview, cursor.row());
}
result = true;
delete undo;
}
-void LyXText::SetUndo(Undo::undo_kind kind, LyXParagraph const * before,
+void LyXText::SetUndo(Buffer * buf, Undo::undo_kind kind,
+ LyXParagraph const * before,
LyXParagraph const * behind) const
{
if (!undo_frozen)
- buffer_->undostack.push(CreateUndo(kind, before, behind));
- buffer_->redostack.clear();
+ buf->undostack.push(CreateUndo(buf, kind, before, behind));
+ buf->redostack.clear();
}
-void LyXText::SetRedo(Undo::undo_kind kind, LyXParagraph const * before,
- LyXParagraph const * behind)
+void LyXText::SetRedo(Buffer * buf, Undo::undo_kind kind,
+ LyXParagraph const * before, LyXParagraph const * behind)
{
- buffer_->redostack.push(CreateUndo(kind, before, behind));
+ buf->redostack.push(CreateUndo(buf, kind, before, behind));
}
-Undo * LyXText::CreateUndo(Undo::undo_kind kind, LyXParagraph const * before,
- LyXParagraph const * behind) const
+Undo * LyXText::CreateUndo(Buffer * buf, Undo::undo_kind kind,
+ LyXParagraph const * before,
+ LyXParagraph const * behind) const
{
int before_number = -1;
int behind_number = -1;
if (!undo_finished && kind != Undo::EDIT &&
kind != Undo::FINISH){
// check wether storing is needed
- if (!buffer()->undostack.empty() &&
- buffer_->undostack.top()->kind == kind &&
- buffer_->undostack.top()->number_of_before_par == before_number &&
- buffer_->undostack.top()->number_of_behind_par == behind_number ){
+ if (!buf->undostack.empty() &&
+ buf->undostack.top()->kind == kind &&
+ buf->undostack.top()->number_of_before_par == before_number &&
+ buf->undostack.top()->number_of_behind_par == behind_number ){
// no undo needed
return 0;
}
}
-void LyXText::SetCursorParUndo()
+void LyXText::SetCursorParUndo(Buffer * buf)
{
- SetUndo(Undo::FINISH,
+ SetUndo(buf, Undo::FINISH,
cursor.par()->ParFromPos(cursor.pos())->previous,
cursor.par()->ParFromPos(cursor.pos())->next);
}
#endif
-void LyXText::toggleAppendix(){
+void LyXText::toggleAppendix(BufferView * bview)
+{
LyXParagraph * par = cursor.par()->FirstPhysicalPar();
bool start = !par->start_of_appendix;
status = LyXText::NEED_MORE_REFRESH;
refresh_y = 0;
refresh_row = 0; // not needed for full update
- UpdateCounters(0);
- SetCursor(cursor.par(), cursor.pos());
+ UpdateCounters(bview, 0);
+ SetCursor(bview, cursor.par(), cursor.pos());
}
+LyXParagraph * LyXText::OwnerParagraph() const
+{
+ if (inset_owner)
+ return inset_owner->par;
+
+ return bv_owner->buffer()->paragraph;
+}
+
+
+LyXParagraph * LyXText::OwnerParagraph(LyXParagraph * p) const
+{
+ if (inset_owner)
+ inset_owner->par = p;
+ else
+ bv_owner->buffer()->paragraph = p;
+ return 0;
+}
for (int i = 0; i < l; ++i){
if (str[i] == '\"'
- && text->GetFont(text->cursor.par(),
+ && text->GetFont(current_view->buffer(),text->cursor.par(),
text->cursor.pos()).latex() == LyXFont::OFF
- && text->GetFont(text->cursor.par(),
+ && text->GetFont(current_view->buffer(),text->cursor.par(),
text->cursor.pos()).language()->lang() != "hebrew")
current_view->insertCorrectQuote();
else
- text->InsertChar(str[i]);
+ text->InsertChar(current_view, str[i]);
}
}
// Could not find an encoding
InsetLatexAccent ins(str);
if (ins.CanDisplay()) {
- text->InsertInset(new InsetLatexAccent(ins));
+ text->InsertInset(current_view, new InsetLatexAccent(ins));
} else {
insertVerbatim(str, text);
}