]> git.lyx.org Git - lyx.git/commitdiff
FILMagain changes (will need some work)
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 12 Jun 2000 11:27:15 +0000 (11:27 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 12 Jun 2000 11:27:15 +0000 (11:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@807 a592a061-630c-0410-9148-cb99ea01b6c8

174 files changed:
ChangeLog
Makefile.am
acconfig.h
acinclude.m4
autogen.sh
config/kde.m4 [new file with mode: 0644]
config/lyxinclude.m4
config/sigc++.m4 [new file with mode: 0644]
configure.in
development/tools/makeLyXsigc.sh [new file with mode: 0644]
forms/bullet_forms.C.patch
forms/credits_form.fd
forms/fdfix.sh
forms/form1.fd
forms/form_url.fd
forms/layout_forms.fd
forms/layout_forms.h.patch
forms/lyx.fd
forms/makefile
forms/math_forms.C.patch
forms/print_form.fd
lib/Makefile.am
lib/chkconfig.ltx
lib/doc/ExternalMaterial.lyx [new file with mode: 0644]
lib/doc/LyXConfig.lyx.in [new file with mode: 0644]
lib/examples/example_lyxified.lyx
lib/external_templates [new file with mode: 0644]
lib/reLyX/Makefile.am
lib/scripts/fen2latex.py [new file with mode: 0644]
lib/scripts/general_command_wrapper.py [new file with mode: 0644]
lib/scripts/pic2ascii.py [new file with mode: 0644]
lib/scripts/pic2png_eps.py [new file with mode: 0644]
lib/scripts/pic2png_eps.sh [new file with mode: 0644]
lib/tex/lyxchess.sty [new file with mode: 0644]
po/POTFILES.in
src/BufferView.C
src/BufferView.h
src/BufferView2.C
src/BufferView_pimpl.C
src/BufferView_pimpl.h
src/LString.h
src/LaTeXFeatures.C
src/LaTeXFeatures.h
src/LyXAction.C
src/LyXView.C
src/LyXView.h
src/Makefile.am
src/PainterBase.C
src/PainterBase.h
src/ParagraphExtra.C
src/PrinterParams.h [new file with mode: 0644]
src/TableLayout.C
src/TextCache.C
src/TextCache.h
src/WorkArea.C
src/WorkArea.h
src/buffer.C
src/buffer.h
src/bufferview_funcs.C
src/bullet_forms.h
src/cite.C [new file with mode: 0644]
src/cite.h [new file with mode: 0644]
src/commandtags.h
src/credits.C
src/credits.h
src/credits_form.C
src/credits_form.h
src/form1.C
src/form1.h
src/insets/ExternalTemplate.C [new file with mode: 0644]
src/insets/ExternalTemplate.h [new file with mode: 0644]
src/insets/Makefile.am
src/insets/figinset.C
src/insets/figinset.h
src/insets/inset.C
src/insets/insetbib.C
src/insets/insetbib.h
src/insets/insetbutton.C [new file with mode: 0644]
src/insets/insetbutton.h [new file with mode: 0644]
src/insets/insetcite.C
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h
src/insets/insetcommand.C
src/insets/insetcommand.h
src/insets/inseterror.C
src/insets/inseterror.h
src/insets/insetert.C
src/insets/insetert.h
src/insets/insetexternal.C [new file with mode: 0644]
src/insets/insetexternal.h [new file with mode: 0644]
src/insets/insetfoot.C
src/insets/insetfoot.h
src/insets/insetgraphics.C
src/insets/insetgraphics.h
src/insets/insetinclude.C
src/insets/insetinclude.h
src/insets/insetinfo.C
src/insets/insetinfo.h
src/insets/insetlabel.C
src/insets/insetlabel.h
src/insets/insetlatex.C
src/insets/insetlatex.h
src/insets/insetlatexaccent.C
src/insets/insetlatexaccent.h
src/insets/insetparent.C
src/insets/insetparent.h
src/insets/insetquotes.C
src/insets/insetquotes.h
src/insets/insetref.C
src/insets/insetref.h
src/insets/insetspecialchar.C
src/insets/insetspecialchar.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/insets/insettoc.C
src/insets/insettoc.h
src/insets/inseturl.C
src/insets/inseturl.h
src/insets/lyxinset.h
src/latexoptions.C
src/latexoptions.h
src/layout_forms.C
src/layout_forms.h
src/lyx.C
src/lyx.h
src/lyx_cb.C
src/lyx_gui.C
src/lyx_gui_misc.C
src/lyx_gui_misc.h
src/lyx_sendfax.C
src/lyx_sendfax.h
src/lyxfr1.C
src/lyxfr1.h
src/lyxfunc.C
src/lyxfunc.h
src/lyxlex.C
src/lyxlex.h
src/lyxparagraph.h
src/lyxrc.C
src/lyxrc.h
src/lyxscreen.h
src/lyxtext.h
src/main.C
src/mathed/Makefile.am
src/mathed/formula.C
src/mathed/formula.h
src/mathed/formulamacro.C
src/mathed/formulamacro.h
src/mathed/math_forms.C
src/mathed/math_forms.h
src/mathed/math_write.C
src/menus.C
src/paragraph.C
src/print_form.C
src/print_form.h
src/screen.C
src/sp_form.C
src/sp_form.h
src/support/LAssert.C [new file with mode: 0644]
src/support/LAssert.h
src/support/Makefile.am
src/support/filetools.C
src/support/filetools.h
src/support/lstrings.C
src/support/lstrings.h
src/support/syscall.C
src/table.h
src/tabular.C
src/tabular.h
src/text.C
src/text2.C
src/trans_mgr.C

index 963766124e6f23f00e2d1da8ef525172de749a77..e56ecd0a4c788242a2f82562be1e702090871268 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,424 @@
+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
index 7ff2005daf1637ed7bc741517fa8fb6d5242fa57..698ec378d281f8805e2e0993721238f2173ce7d8 100644 (file)
@@ -1,13 +1,14 @@
 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
index b0a1e0b0d3a84b22d6f14771b49e3ec1ae2f5e2e..2ef1ccd84cee76d900fe62bab74afa3e8c253822 100644 (file)
@@ -40,6 +40,9 @@
   e.g. <xpm.h> */
 #undef XPM_H_LOCATION
 
+/* here are the defines for what Toolkit to use (default is XForms) */
+#undef KDEGUI
+
 @BOTTOM@ 
 
 /************************************************************ 
index ac8165def8da673ab01613e99fda1a5e1e0e6dd8..fd73e8cfb325e7f2c9f3385e4e066d7098ff50f1 100644 (file)
@@ -676,6 +676,58 @@ dnl Usage: LYX_ADD_INC_DIR(var-name,dir) Adds a -I directive to variable
 dnl var-name. 
 AC_DEFUN(LYX_ADD_INC_DIR,[$1="${$1} -I$2 "])
 
+### Check which libsigc++ we're using and make sure any external one works
+### Check for libsigc++ library
+AC_DEFUN(LYX_WITH_SIGC,
+[AC_MSG_CHECKING(whether the included libsigc++ should be used)
+AC_ARG_WITH([included-libsigc],
+  [  --without-included-libsigc
+                             Use the libsigc++ installed on the system],
+  [lyx_use_included_libsigc=$withval],
+  [lyx_use_included_libsigc=yes])
+AC_MSG_RESULT([$lyx_use_included_libsigc])
+if test x$lyx_use_included_libsigc = xno; then
+  ### Check for libsigc++
+  ## can't use AC_SUBST right here!
+  AM_PATH_SIGC(0.8.7,
+    [ INCLUDED_SIGC=
+    ],
+    [LYX_ERROR(dnl
+    [Cannot find libsigc++ library or headers at least as recent as 0.8.7.
+     Check your installation.  Have you installed the development package?])
+  ])
+else
+  ### Use the included libsigc++
+  ### sigc-config hasn't been created yet so we can't just do the same as above
+  ### unless of course someone gets keen and merges the sigc++ configure.in 
+  ### with this one.  We don't really gain much by doing that though except
+  ### a considerably smaller dist and more difficult maintenance.
+  ### It'd also mean we'd have the equivalent of config/gettext.m4
+  lyx_flags="$lyx_flags included-libsigc"
+  SIGC_LIBS="\`\${top_builddir}/sigc++/sigc-config --libs-names | sed -e 's/-lsigc//'\`"
+  # Libsigc++ always installs into a subdirectory called sigc++.  Therefore we
+  # have to always use #include <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
@@ -787,6 +839,22 @@ extern int select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func
  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
@@ -1607,3 +1675,2626 @@ else
 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
+
+])
index 26e1ce64cd01b2b6f9968c6b1e43d8a3f90d4d55..efce8d6b60656cac4f10dc13dad7c491e1c6eddd 100755 (executable)
@@ -22,17 +22,21 @@ 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"
@@ -41,7 +45,7 @@ fi
 
 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"
@@ -50,7 +54,7 @@ fi
 
 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"
@@ -59,7 +63,7 @@ fi
 
 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"
diff --git a/config/kde.m4 b/config/kde.m4
new file mode 100644 (file)
index 0000000..624fab1
--- /dev/null
@@ -0,0 +1,2451 @@
+# 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
+
+])
index d9cef22ef73d55a2fc1c6a59a610ae7f03232ef1..f0545b73495331452488db866d1d08d0d6d6a2b0 100644 (file)
@@ -676,6 +676,58 @@ dnl Usage: LYX_ADD_INC_DIR(var-name,dir) Adds a -I directive to variable
 dnl var-name. 
 AC_DEFUN(LYX_ADD_INC_DIR,[$1="${$1} -I$2 "])
 
+### Check which libsigc++ we're using and make sure any external one works
+### Check for libsigc++ library
+AC_DEFUN(LYX_WITH_SIGC,
+[AC_MSG_CHECKING(whether the included libsigc++ should be used)
+AC_ARG_WITH([included-libsigc],
+  [  --without-included-libsigc
+                             Use the libsigc++ installed on the system],
+  [lyx_use_included_libsigc=$withval],
+  [lyx_use_included_libsigc=yes])
+AC_MSG_RESULT([$lyx_use_included_libsigc])
+if test x$lyx_use_included_libsigc = xno; then
+  ### Check for libsigc++
+  ## can't use AC_SUBST right here!
+  AM_PATH_SIGC(0.8.7,
+    [ INCLUDED_SIGC=
+    ],
+    [LYX_ERROR(dnl
+    [Cannot find libsigc++ library or headers at least as recent as 0.8.7.
+     Check your installation.  Have you installed the development package?])
+  ])
+else
+  ### Use the included libsigc++
+  ### sigc-config hasn't been created yet so we can't just do the same as above
+  ### unless of course someone gets keen and merges the sigc++ configure.in 
+  ### with this one.  We don't really gain much by doing that though except
+  ### a considerably smaller dist and more difficult maintenance.
+  ### It'd also mean we'd have the equivalent of config/gettext.m4
+  lyx_flags="$lyx_flags included-libsigc"
+  SIGC_LIBS="\`\${top_builddir}/sigc++/sigc-config --libs-names | sed -e 's/-lsigc//'\`"
+  # Libsigc++ always installs into a subdirectory called sigc++.  Therefore we
+  # have to always use #include <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
@@ -787,3 +839,19 @@ extern int select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func
  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)
+])
diff --git a/config/sigc++.m4 b/config/sigc++.m4
new file mode 100644 (file)
index 0000000..9319538
--- /dev/null
@@ -0,0 +1,172 @@
+# 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)
+])
+
index ee048f700e2cd6bbf65b4694a9d32f14f73d382a..1d80d3790b0505cc568b034e77b2a2f7575e3ef9 100644 (file)
@@ -114,6 +114,29 @@ if test x$lyx_use_liberty = xyes; then
   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")
@@ -220,7 +243,7 @@ if test "x$enable_assertions" = xyes ; then
 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 \
@@ -230,6 +253,9 @@ AC_OUTPUT([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])
 
 
@@ -249,4 +275,3 @@ EOF
 
 # Display a final warning if there has been a LYX_ERROR
 LYX_CHECK_ERRORS
-
diff --git a/development/tools/makeLyXsigc.sh b/development/tools/makeLyXsigc.sh
new file mode 100644 (file)
index 0000000..33b9a82
--- /dev/null
@@ -0,0 +1,393 @@
+#!/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
index 9f6f1d839daee8c14f8ed56cc1a020d1fef3e9af..647230cfbca815d4ca385b455d86830d2672cd85 100644 (file)
@@ -1,17 +1,15 @@
---- 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();
index e9353ae2981fae1eb73cf7e10b534fed64102cf8..f389ef4a95ae208fbf850a5a79addc6d5e1702e6 100644 (file)
@@ -3,7 +3,7 @@ Magic: 13000
 Internal Form Definition File
     (do not change)
 
-Number of forms: 2
+Number of forms: 1
 Unit of measure: FL_COORD_PIXEL
 
 =============== FORM ===============
@@ -102,101 +102,5 @@ name: browser_credits
 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
index 58001da1a011f02fc4b3081a20145ece7e467964..467432d23dd9d0cf4e578e7c091f3a2cea44068e 100755 (executable)
@@ -72,8 +72,33 @@ echo >> $2
 #  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/".[^|]*"/_(&)/' \
@@ -82,4 +107,10 @@ cat $1 | sed \
 -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
index d4aa11ef36b92e8dd139832e26f85b9181e4c668..a5dcbcaac3f8d9b62f60595d50b3c700f84aea80 100644 (file)
@@ -249,7 +249,7 @@ argument:
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -687,7 +687,7 @@ argument: 2
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -867,7 +867,7 @@ argument:
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -975,7 +975,7 @@ argument:
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -1594,7 +1594,7 @@ 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
@@ -1612,7 +1612,7 @@ alignment: FL_ALIGN_CENTER
 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
index cd4834d1d56277aac1274c57910a60fd3cc4eb5f..916d90e2119477c17b9cde7e98e53977cbc40f9e 100644 (file)
@@ -8,14 +8,14 @@ Unit of measure: FL_COORD_PIXEL
 
 =============== 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
@@ -33,14 +33,14 @@ argument:
 --------------------
 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
@@ -51,12 +51,12 @@ argument:
 --------------------
 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
@@ -69,12 +69,12 @@ argument:
 --------------------
 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
@@ -87,14 +87,14 @@ argument:
 --------------------
 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
index e7f46bea1357228748105753c348261df794b945..5c2e500c4da1ef533d41bbfcb5ea34e011abb572 100644 (file)
@@ -70,7 +70,7 @@ argument:
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -358,7 +358,7 @@ argument:
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -466,7 +466,7 @@ argument:
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -554,8 +554,8 @@ callback:
 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
@@ -717,14 +717,14 @@ argument: 0
 
 =============== 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
@@ -739,10 +739,28 @@ name:
 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
@@ -760,7 +778,7 @@ argument:
 --------------------
 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
@@ -778,7 +796,7 @@ argument:
 --------------------
 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
@@ -814,7 +832,7 @@ argument:
 --------------------
 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
@@ -832,7 +850,7 @@ argument:
 --------------------
 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
@@ -850,7 +868,7 @@ argument:
 --------------------
 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
@@ -868,7 +886,7 @@ argument:
 --------------------
 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
@@ -886,7 +904,7 @@ argument:
 --------------------
 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
@@ -904,7 +922,7 @@ argument: 0
 --------------------
 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
@@ -922,7 +940,7 @@ argument: 0
 --------------------
 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
@@ -940,12 +958,12 @@ argument:
 --------------------
 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: 
@@ -958,7 +976,7 @@ argument:
 --------------------
 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
@@ -976,7 +994,7 @@ argument:
 --------------------
 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
@@ -1288,7 +1306,7 @@ argument:
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -1786,7 +1804,7 @@ argument:
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -2134,7 +2152,7 @@ argument:
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -3406,7 +3424,7 @@ argument:
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -3550,7 +3568,7 @@ argument:
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 10 10 0
+box: 0 0 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
index 4cde3e98aab818c4bf793e89bf8a96fe1cb89c2c..66f07514aff0aa0be006b49054d68c6f79395c89 100644 (file)
@@ -1,9 +1,20 @@
---- 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_ */
index 8ac9045ef4ba722f9a3d40edcb355635a1b81120..22275539478ba29b57012cb7e0bb309db11ca528 100644 (file)
@@ -3,7 +3,7 @@ Magic: 13000
 Internal Form Definition File
     (do not change)
 
-Number of forms: 5
+Number of forms: 6
 Unit of measure: FL_COORD_PIXEL
 
 =============== FORM ===============
@@ -93,7 +93,7 @@ argument:
 --------------------
 class: FL_BEGIN_GROUP
 type: 0
-box: 0 0 0
+box: 0 10 10 0
 boxtype: FL_NO_BOX
 colors: FL_COL1 FL_MCOL
 alignment: FL_ALIGN_CENTER
@@ -268,7 +268,7 @@ alignment: FL_ALIGN_LEFT
 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
@@ -286,7 +286,7 @@ alignment: FL_ALIGN_LEFT
 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
@@ -304,7 +304,7 @@ alignment: FL_ALIGN_LEFT
 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
@@ -322,7 +322,7 @@ alignment: FL_ALIGN_LEFT
 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
@@ -340,7 +340,7 @@ alignment: FL_ALIGN_LEFT
 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
@@ -586,7 +586,7 @@ alignment: FL_ALIGN_CENTER
 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
@@ -604,7 +604,7 @@ alignment: FL_ALIGN_CENTER
 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
@@ -622,7 +622,7 @@ alignment: FL_ALIGN_CENTER
 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
@@ -677,7 +677,7 @@ alignment: FL_ALIGN_CENTER
 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
@@ -695,7 +695,7 @@ alignment: FL_ALIGN_CENTER
 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
@@ -713,7 +713,7 @@ alignment: FL_ALIGN_CENTER
 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
@@ -731,7 +731,7 @@ alignment: FL_ALIGN_CENTER
 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
@@ -739,5 +739,209 @@ name: back
 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
index 85f06e9cd69a0b6b8ae83f3dddf7146784e245e0..b08a088588515c02041e728cd0ac809c110604a1 100644 (file)
@@ -38,16 +38,35 @@ c: $(OBJS)
 
 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 $<
index d85697b588591ac9c9b5e96f7de73f54a4eec34c..1895ae5985e9d515b67560c672791430b259fe1d 100644 (file)
@@ -9,16 +9,6 @@
  
  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);
index dab01b8ffa50877fa2bf22f87eb167c382746e94..cd6badea2896a5004880b37c4ede0209ae8b6349 100644 (file)
@@ -3,555 +3,9 @@ Magic: 13000
 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
index 793cd02e0b31351b75932cd32550523c366265e4..cc794cccb062aee17605ee0facb6d7541f0ee6bb 100644 (file)
@@ -1,34 +1,35 @@
 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 \
@@ -41,8 +42,16 @@ install-data-local: libinstalldirs
           $(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 ; }
+
index ef8e1127c137a2dc20652c99f8088affd7447345..9f328741212f05222358d1a13d5a77a712ec5d3e 100644 (file)
@@ -4,7 +4,7 @@
 % 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.
@@ -19,7 +19,7 @@
 %%% 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.
@@ -27,7 +27,7 @@
 %%% 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
diff --git a/lib/doc/ExternalMaterial.lyx b/lib/doc/ExternalMaterial.lyx
new file mode 100644 (file)
index 0000000..5da5b1d
--- /dev/null
@@ -0,0 +1,556 @@
+#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
diff --git a/lib/doc/LyXConfig.lyx.in b/lib/doc/LyXConfig.lyx.in
new file mode 100644 (file)
index 0000000..745a99a
--- /dev/null
@@ -0,0 +1,1950 @@
+#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
index 0390f748d843324065ac89cc030056926e5bfd7f..e34f2fa6ea6e5c2fc98a19ac9b2c1834f82db2f1 100644 (file)
@@ -1,6 +1,5 @@
-#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
 
diff --git a/lib/external_templates b/lib/external_templates
new file mode 100644 (file)
index 0000000..30ccf26
--- /dev/null
@@ -0,0 +1,159 @@
+# 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
+
index 5e13ef49fe0ccacd69b0437e6fac865641141619..d2f06d7fe09afae6d4c3fb4b9b1ad49d2523dac2 100644 (file)
@@ -1,6 +1,6 @@
 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
diff --git a/lib/scripts/fen2latex.py b/lib/scripts/fen2latex.py
new file mode 100644 (file)
index 0000000..bca7b17
--- /dev/null
@@ -0,0 +1,51 @@
+#!/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%"
+
diff --git a/lib/scripts/general_command_wrapper.py b/lib/scripts/general_command_wrapper.py
new file mode 100644 (file)
index 0000000..7004417
--- /dev/null
@@ -0,0 +1,27 @@
+#!/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]
+
diff --git a/lib/scripts/pic2ascii.py b/lib/scripts/pic2ascii.py
new file mode 100644 (file)
index 0000000..069fd1b
--- /dev/null
@@ -0,0 +1,46 @@
+#!/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")
+
diff --git a/lib/scripts/pic2png_eps.py b/lib/scripts/pic2png_eps.py
new file mode 100644 (file)
index 0000000..90d868d
--- /dev/null
@@ -0,0 +1,23 @@
+#!/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()
diff --git a/lib/scripts/pic2png_eps.sh b/lib/scripts/pic2png_eps.sh
new file mode 100644 (file)
index 0000000..7f59c10
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+convert $1 $2.eps
+convert $1 $2.png
diff --git a/lib/tex/lyxchess.sty b/lib/tex/lyxchess.sty
new file mode 100644 (file)
index 0000000..2ae5848
--- /dev/null
@@ -0,0 +1,575 @@
+%
+% 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}
+
index bd351e0ff9eea72e42ba8d15b0d49b17d74d78d3..fc50126cfd4e041b6c20b1e162fc7509b52987b6 100644 (file)
@@ -17,6 +17,7 @@ src/BufferView_pimpl.C
 src/bullet_forms.C
 src/bullet_forms_cb.C
 src/Chktex.C
+src/cite.C
 src/ColorHandler.C
 src/combox.C
 src/credits.C
@@ -25,14 +26,22 @@ src/CutAndPaste.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
index c54820c3b19e8a95d77c1ab3e07753a7b336e412..7891d1502bc036e70bfafa54503c35833a91210f 100644 (file)
@@ -18,6 +18,7 @@
 #include "BufferView.h"
 #include "BufferView_pimpl.h"
 #include "lyxtext.h"
+#include "WorkArea.h"
 
 
 BufferView::BufferView(LyXView * o, int xpos, int ypos,
@@ -121,15 +122,6 @@ void BufferView::gotoError()
 }
 
 
-#if 0
-extern "C" {
-       void C_BufferView_CursorToggleCB(FL_OBJECT * ob, long buf)
-       {
-               BufferView::cursorToggleCB(ob, buf);
-       }
-}
-#endif
-
 void BufferView::enterView()
 {
        pimpl_->enterView();
@@ -236,7 +228,7 @@ bool BufferView::NoSavedPositions()
 }
 
 
-void BufferView::update(signed char f)
+void BufferView::update(UpdateCodes f)
 {
        pimpl_->update(f);
 }
@@ -284,9 +276,9 @@ bool BufferView::active() const
 }
 
 
-unsigned short BufferView::paperWidth() const
+int BufferView::workWidth() const
 {
-    return text->paperWidth();
+    return pimpl_->workarea_->workWidth();
 }
 
 
@@ -336,3 +328,11 @@ void BufferView::stuffClipboard(string const & stuff) const
 {
        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));
+}
index 8960a2e1697ab544f09c443304cacf078be971c2..4db6866c59bf606b200363714d0449b65bbb5266 100644 (file)
@@ -27,6 +27,14 @@ class Buffer;
 ///
 class BufferView {
 public:
+       ///
+       enum UpdateCodes {
+               UPDATE = 0,
+               SELECT = 1,
+               FITCUR = 2,
+               CHANGE = 4
+       };
+                                           
        ///
        BufferView(LyXView * owner, int , int , int, int);
        ///
@@ -48,7 +56,7 @@ public:
        ///
        void update();
        ///
-       void update(signed char f);
+       void update(UpdateCodes uc);
        ///
        void updateScrollbar();
        ///
@@ -78,7 +86,7 @@ public:
        */
        LyXText * text;
        ///
-       unsigned short paperWidth() const;
+       int workWidth() const;
        ///
        UpdatableInset * the_locking_inset;
        ///
@@ -229,4 +237,8 @@ private:
        Pimpl * pimpl_;
 };
 
+
+BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
+                                 BufferView::UpdateCodes uc2);
+
 #endif
index dce9e3fa7c23699ba5645d85c8a674a1e23d2d3f..ac40f726276e3f23ea41c54c4718cbcc0b94a541 100644 (file)
@@ -103,13 +103,13 @@ bool BufferView::removeAutoInsets()
        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;
@@ -117,7 +117,7 @@ bool BufferView::removeAutoInsets()
        // 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;
 }
@@ -159,12 +159,12 @@ void BufferView::insertErrors(TeXErrors & terr)
                        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());
 }
 
 
@@ -183,7 +183,7 @@ void BufferView::setCursorFromRow(int row)
        } else {
                texrowpar = text->GetParFromID(tmpid);
        }
-       text->SetCursor(texrowpar, tmppos);
+       text->SetCursor(this, texrowpar, tmppos);
 }
 
 bool BufferView::insertInset(Inset * inset, string const & lout,
@@ -209,20 +209,20 @@ 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 =
@@ -237,20 +237,20 @@ bool BufferView::insertInset(Inset * inset, string const & lout,
                        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
@@ -259,12 +259,12 @@ bool BufferView::insertInset(Inset * inset, string const & lout,
        // 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;
@@ -277,8 +277,8 @@ void BufferView::open_new_inset(UpdatableInset * new_inset)
        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);
 }
 
@@ -296,9 +296,9 @@ bool BufferView::gotoLabel(string const & label)
                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;
                }
        }
@@ -348,9 +348,10 @@ void BufferView::allFloats(char flag, char figmar)
                                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 {
@@ -377,14 +378,14 @@ void BufferView::allFloats(char flag, char figmar)
                                            )
                                    )
                                ) {
-                               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();
@@ -405,9 +406,9 @@ void BufferView::openStuff()
                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();
        }
 }
@@ -419,9 +420,9 @@ void BufferView::toggleFloat()
                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();
        }
 }
@@ -432,11 +433,11 @@ void BufferView::menuUndo()
                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();
        }
 }
@@ -453,11 +454,11 @@ void BufferView::menuRedo()
                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();
        }
 }
@@ -467,7 +468,7 @@ void BufferView::hyphenationPoint()
 {
        if (available()) {
                hideCursor();
-               update(-2);
+               update(BufferView::SELECT|BufferView::FITCUR);
                InsetSpecialChar * new_inset = 
                        new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
                insertInset(new_inset);
@@ -479,7 +480,7 @@ void BufferView::ldots()
 {
        if (available())  {
                hideCursor();
-               update(-2);
+               update(BufferView::SELECT|BufferView::FITCUR);
                InsetSpecialChar * new_inset = 
                        new InsetSpecialChar(InsetSpecialChar::LDOTS);
                insertInset(new_inset);
@@ -491,7 +492,7 @@ void BufferView::endOfSentenceDot()
 {
        if (available()) {
                hideCursor();
-               update(-2);
+               update(BufferView::SELECT|BufferView::FITCUR);
                InsetSpecialChar * new_inset = 
                        new InsetSpecialChar(InsetSpecialChar::END_OF_SENTENCE);
                insertInset(new_inset);
@@ -503,7 +504,7 @@ void BufferView::menuSeparator()
 {
        if (available()) {
                hideCursor();
-               update(-2);
+               update(BufferView::SELECT|BufferView::FITCUR);
                InsetSpecialChar * new_inset = 
                        new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR);
                insertInset(new_inset);
@@ -515,9 +516,9 @@ void BufferView::newline()
 {
        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);
        }
 }
 
@@ -526,7 +527,7 @@ void BufferView::protectedBlank()
 {
        if (available()) {
                hideCursor();
-               update(-2);
+               update(BufferView::SELECT|BufferView::FITCUR);
                InsetSpecialChar * new_inset =
                        new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
                insertInset(new_inset);
@@ -538,9 +539,9 @@ void BufferView::hfill()
 {
        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);
        }
 }
 
@@ -551,7 +552,7 @@ void BufferView::copyEnvironment()
                // clear the selection, even if mark_set
                toggleSelection();
                text->ClearSelection();
-               update(-2);
+               update(BufferView::SELECT|BufferView::FITCUR);
                owner()->getMiniBuffer()->Set(_("Paragraph environment type copied"));
        }
 }
@@ -560,9 +561,9 @@ void BufferView::copyEnvironment()
 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);
        }
 }
 
@@ -570,11 +571,11 @@ void BufferView::pasteEnvironment()
 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"));
        }
 }
@@ -583,9 +584,9 @@ void BufferView::cut()
 {
        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"));
        }
 }
@@ -600,16 +601,16 @@ void BufferView::paste()
        // 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);
 }
 
 
@@ -619,16 +620,16 @@ void BufferView::gotoNote()
    
        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();
@@ -638,7 +639,7 @@ void BufferView::gotoNote()
                                LyXBell();
                        }
        }
-       update(0);
+       update(BufferView::SELECT|BufferView::FITCUR);
        text->sel_cursor = text->cursor;
 }
 
@@ -664,7 +665,7 @@ char * BufferView::nextWord(float & value)
                return 0;
        }
 
-       char * string = text->SelectNextWord(value);
+       char * string = text->SelectNextWord(this, value);
 
        return string;
 }
@@ -676,9 +677,9 @@ void BufferView::selectLastWord()
    
        hideCursor();
        beforeChange();
-       text->SelectSelectedWord();
+       text->SelectSelectedWord(this);
        toggleSelection(false);
-       update(0);
+       update(BufferView::SELECT|BufferView::FITCUR);
 }
 
 
@@ -688,9 +689,9 @@ void BufferView::endOfSpellCheck()
    
        hideCursor();
        beforeChange();
-       text->SelectSelectedWord();
+       text->SelectSelectedWord(this);
        text->ClearSelection();
-       update(0);
+       update(BufferView::SELECT|BufferView::FITCUR);
 }
 
 
@@ -699,23 +700,23 @@ void BufferView::replaceWord(string const & replacestring)
        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
 
@@ -741,7 +742,7 @@ void BufferView::showLockedInsetCursor(long x, long y, int asc, int desc)
                     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,
@@ -790,7 +791,7 @@ void BufferView::lockedInsetStoreUndo(Undo::undo_kind kind)
                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()->
@@ -806,7 +807,7 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
        // 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())
@@ -818,7 +819,7 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
                                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())
@@ -835,12 +836,12 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
        // 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;
                }
        }
@@ -872,14 +873,14 @@ bool BufferView::ChangeRefs(string const & from, string const & to)
                        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;
 }
index a64d1a56479586bd3c3074208d629b1ee1061b36..731f4dd3943bfa49495b0af90700d15c10fbbbff 100644 (file)
 #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 */
@@ -40,13 +42,7 @@ extern char ascii_type;
 
 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()
@@ -75,21 +71,13 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o,
        : 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;
@@ -98,7 +86,7 @@ BufferView::Pimpl::Pimpl(BufferView * b, LyXView * o,
 
 Painter & BufferView::Pimpl::painter() 
 {
-       return workarea->getPainter();
+       return workarea_->getPainter();
 }
 
 
@@ -113,8 +101,8 @@ void BufferView::Pimpl::buffer(Buffer * b)
                // 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");
                
@@ -141,21 +129,21 @@ void BufferView::Pimpl::buffer(Buffer * b)
                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
@@ -173,8 +161,8 @@ void BufferView::Pimpl::buffer(Buffer * b)
 
 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();
 }
 
@@ -190,7 +178,7 @@ void BufferView::Pimpl::resize()
 void BufferView::Pimpl::redraw()
 {
        lyxerr[Debug::INFO] << "BufferView::redraw()" << endl;
-       workarea->redraw();
+       workarea_->redraw();
 }
 
 
@@ -241,22 +229,22 @@ int BufferView::Pimpl::resizeCurrentBuffer()
                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();
@@ -267,13 +255,13 @@ int BufferView::Pimpl::resizeCurrentBuffer()
                 * 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;
                }
@@ -302,16 +290,16 @@ void BufferView::Pimpl::gotoError()
    
        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"));
@@ -322,7 +310,7 @@ void BufferView::Pimpl::gotoError()
                        LyXBell();
                }
        }
-       update(0);
+       update(BufferView::SELECT|BufferView::FITCUR);
        bv_->text->sel_cursor = bv_->text->cursor;
 }
 
@@ -331,28 +319,10 @@ void BufferView::Pimpl::updateScreen()
 {
        // 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
@@ -360,7 +330,7 @@ void BufferView::Pimpl::updateScrollbar()
         * be possible */
 
        if (!buffer_) {
-               workarea->setScrollbar(0, 1.0);
+               workarea_->setScrollbar(0, 1.0);
                return;
        }
        
@@ -377,31 +347,31 @@ void BufferView::Pimpl::updateScrollbar()
 
        // 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);
@@ -410,7 +380,7 @@ void BufferView::Pimpl::updateScrollbar()
        } else
                slider_size = hfloat;
 
-       workarea->setScrollbar(slider_value, slider_size / workarea->height());
+       workarea_->setScrollbar(slider_value, slider_size / workarea_->height());
 }
 
 
@@ -435,14 +405,14 @@ void BufferView::Pimpl::scrollCB(double value)
                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);
                }
        }
@@ -455,15 +425,15 @@ int BufferView::Pimpl::scrollUp(long time)
        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;
@@ -471,7 +441,7 @@ int BufferView::Pimpl::scrollUp(long time)
        if (value < 0)
                value = 0;
    
-       workarea->setScrollbarValue(value);
+       workarea_->setScrollbarValue(value);
    
        bv_->scrollCB(value); 
        return 0;
@@ -483,8 +453,8 @@ int BufferView::Pimpl::scrollDown(long time)
        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;
@@ -492,8 +462,8 @@ int BufferView::Pimpl::scrollDown(long time)
        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;
@@ -501,7 +471,7 @@ int BufferView::Pimpl::scrollDown(long time)
        if (value > max)
                value = max;
 
-       workarea->setScrollbarValue(value);
+       workarea_->setScrollbarValue(value);
        
        bv_->scrollCB(value); 
        return 0;
@@ -532,12 +502,12 @@ void BufferView::Pimpl::workAreaMotionNotify(int x, int y, unsigned int state)
        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();
@@ -593,14 +563,15 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
        // 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?
@@ -608,7 +579,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
                        if (!bv_->text->selection) {
                                screen->ToggleSelection();
                                bv_->text->ClearSelection();
-                               bv_->text->FullRebreak();
+                               bv_->text->FullRebreak(bv_);
                                screen->Update();
                                updateScrollbar();
                        }
@@ -640,7 +611,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
        // Clear the selection
        screen->ToggleSelection();
        bv_->text->ClearSelection();
-       bv_->text->FullRebreak();
+       bv_->text->FullRebreak(bv_);
        screen->Update();
        updateScrollbar();
        
@@ -664,7 +635,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
        }
        
        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());
@@ -696,11 +667,11 @@ void BufferView::Pimpl::doubleClick(int /*x*/, int /*y*/, unsigned int button)
                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);
                }
        }            
 }
@@ -712,14 +683,14 @@ void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button)
        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);
        }
 }
 
@@ -727,7 +698,7 @@ void BufferView::Pimpl::tripleClick(int /*x*/, int /*y*/, unsigned int button)
 void BufferView::Pimpl::enterView()
 {
        if (active() && available()) {
-               SetXtermCursor(workarea->getWin());
+               SetXtermCursor(workarea_->getWin());
                using_xterm_cursor = true;
        }
 }
@@ -736,7 +707,7 @@ void BufferView::Pimpl::enterView()
 void BufferView::Pimpl::leaveView()
 {
        if (using_xterm_cursor) {
-               XUndefineCursor(fl_display, workarea->getWin());
+               XUndefineCursor(fl_display, workarea_->getWin());
                using_xterm_cursor = false;
        }
 }
@@ -773,7 +744,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
                     bv_->text->cursor.par()->table->
                     CellHasContRow(bv_->text->cursor.par()->table->
                                    GetCellAbove(cell))<0) {
-                        bv_->text->CursorUp();
+                        bv_->text->CursorUp(bv_);
                 }
         }
 #endif
@@ -804,7 +775,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
                // ...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());
@@ -847,7 +818,7 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
                            || 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;
                        }
                }
@@ -911,7 +882,7 @@ Inset * BufferView::Pimpl::checkInsetHit(int & x, int & y,
        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()));
@@ -923,7 +894,8 @@ Inset * BufferView::Pimpl::checkInsetHit(int & x, int & y,
 
                // 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;
 
@@ -941,7 +913,7 @@ Inset * BufferView::Pimpl::checkInsetHit(int & x, int & y,
 #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()); 
@@ -954,7 +926,8 @@ Inset * BufferView::Pimpl::checkInsetHit(int & x, int & 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;
 
@@ -971,7 +944,7 @@ Inset * BufferView::Pimpl::checkInsetHit(int & x, int & y,
 #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()); 
@@ -990,15 +963,15 @@ void BufferView::Pimpl::workAreaExpose()
        //      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
@@ -1029,7 +1002,7 @@ void BufferView::Pimpl::workAreaExpose()
                } 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.
@@ -1081,50 +1054,22 @@ void BufferView::Pimpl::update()
 // 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)) {
@@ -1135,7 +1080,6 @@ void BufferView::Pimpl::update(signed char f)
                        buffer_->markDirty();
                }
        }
-#endif
 }
 
 
@@ -1236,11 +1180,7 @@ void BufferView::Pimpl::cursorToggle()
        }
 
   set_timer_and_return:
-#if 1
        cursor_timeout.restart();
-#else
-       fl_set_timer(timer_cursor, 0.4);
-#endif
   skip_timer:
        return;
 }
@@ -1252,17 +1192,17 @@ void BufferView::Pimpl::cursorPrevious()
        
        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();
 }
 
@@ -1274,14 +1214,14 @@ void BufferView::Pimpl::cursorNext()
        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();
@@ -1299,12 +1239,9 @@ void BufferView::Pimpl::beforeChange()
 {
        toggleSelection();
        bv_->text->ClearSelection();
-#if 1
+
        // CHECK
        //owner_->update_timeout.stop();
-#else
-       FreeUpdateTimer();
-#endif
 }
 
 
@@ -1328,8 +1265,8 @@ void BufferView::Pimpl::restorePosition()
                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()
@@ -1386,25 +1323,25 @@ void BufferView::Pimpl::insetUnlock()
 
 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();
 }
 
 
@@ -1439,12 +1376,12 @@ void BufferView::Pimpl::toggleToggle()
 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();
 }
 
@@ -1456,20 +1393,20 @@ void BufferView::Pimpl::pasteClipboard(bool asPara)
        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);
 }
index eae9c2a4afd5bdfa06d4589862f2ee950eba0c88..954258ee438a311a0c91a4672fefe0ccc4703733 100644 (file)
@@ -38,7 +38,7 @@ struct BufferView::Pimpl {
        ///
        void update();
        ///
-       void update(signed char f);
+       void update(BufferView::UpdateCodes);
        ///
        void gotoError();
        /// Update pixmap of screen
@@ -49,10 +49,6 @@ struct BufferView::Pimpl {
        void updateScrollbar();
        ///
        void scrollCB(double value);
-#if 0
-       ///
-       void create_view();
-#endif
        ///
        Inset * checkInsetHit(int & x, int & y, unsigned int button);
        /// 
@@ -131,18 +127,14 @@ struct BufferView::Pimpl {
        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;
        ///
index 3d42a39facac3b84e8975952310f3d6468d69c56..3a684322a10d24dadfdd399265e85646732a232a 100644 (file)
 #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;
index cac7a883585e53848201e725289480aaab29258b..61dd8a821c805cd042ae91892a89d603fc88b45e 100644 (file)
@@ -45,6 +45,7 @@ LaTeXFeatures::LaTeXFeatures(BufferParams const & p, int n)
        url = false;
        varioref = false;
        prettyref = false;
+       chess = false;
        
        // commands
        lyx = false;
@@ -71,6 +72,53 @@ LaTeXFeatures::LaTeXFeatures(BufferParams const & p, int n)
        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()
 {
@@ -105,7 +153,7 @@ string LaTeXFeatures::getPackages()
                                + params.graphicsDriver + "]{graphics}\n";
        }
 
-       //verbatim.sty
+       // verbatim.sty
        if (verbatim)
                packages += "\\usepackage{verbatim}\n";
 
@@ -113,6 +161,11 @@ string LaTeXFeatures::getPackages()
                packages += "\\usepackage{algorithm}\n";
        }
 
+       // lyxchess.sty
+       if (chess) {
+               packages += "\\usepackage{lyxchess}\n";
+       }
+
        // setspace.sty
        if ((params.spacing.getSpace() != Spacing::Single
             && !params.spacing.isDefault())
@@ -192,6 +245,8 @@ string LaTeXFeatures::getPackages()
        if (prettyref)
                packages += "\\usepackage{prettyref}\n";
 
+       packages += externalPreambles;
+
        return packages;
 }
 
index 9b61f75132938edbe18a947abb50645de74ef42f..33b51556cf65f3589d62bd37d3607912980adad0 100644 (file)
@@ -44,6 +44,12 @@ struct LaTeXFeatures {
        ///
        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
        //@{
        ///
@@ -83,6 +89,8 @@ struct LaTeXFeatures {
        bool varioref;  // varioref.sty
        ///
        bool prettyref; // prettyref.sty
+       ///
+       bool chess;     // chess.sty
        //@}
 
        
index 2f15f9041c7054a68ac22e8239c721440dfba8b6..701c520d96efdc6c1c5287d9b9222f1e22eda765 100644 (file)
@@ -67,7 +67,7 @@ void LyXAction::init()
        // 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;
@@ -128,6 +128,10 @@ void LyXAction::init()
                  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 },
@@ -183,6 +187,8 @@ void LyXAction::init()
                  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 },
@@ -216,6 +222,8 @@ void LyXAction::init()
                  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 },
index 5617af5cc0c4e6f0878dcbd5993bccae90310fbf..7cf87eb60e1e2e09b2c4e0553c1f467a1078cfd6 100644 (file)
 #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;
 
@@ -51,6 +50,11 @@ BufferView * current_view;
 
 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)
 {
@@ -59,6 +63,12 @@ LyXView::LyXView(int width, int height)
        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));
 }
 
 
@@ -70,6 +80,7 @@ LyXView::~LyXView()
        delete minibuffer;
        delete lyxfunc;
        delete intl;
+       delete dialogs_;
 }
 
 
@@ -136,36 +147,6 @@ Intl * LyXView::getIntl() const
 }
 
 
-// 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()
 {
@@ -189,11 +170,7 @@ extern "C" {
 void LyXView::resetAutosaveTimer()
 {
        if (lyxrc.autosave)
-#if 1
                autosave_timeout.restart();
-#else
-               fl_set_timer(form_main_->timer_autosave, lyxrc.autosave);
-#endif
 }
 
 
@@ -287,25 +264,8 @@ void LyXView::create_form_form_main(int width, int height)
        // 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
        //
index b3807cfc04ba6293e2b90b8e37abd7329dba5236..e8c99e22cb669163b12463bb5d4f1528714a6a9f 100644 (file)
@@ -27,25 +27,12 @@ class Intl;
 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
 };
 
 
@@ -101,6 +88,9 @@ public:
        ///
        Intl * getIntl() const;
 
+       ///
+       Dialogs * getDialogs() { return dialogs_; }
+
        ///
        void updateLayoutChoice();
 
@@ -120,6 +110,8 @@ private:
        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
@@ -139,10 +131,6 @@ public:
        void AutoSave();
        /// A callback
        static void UpdateTimerCB(void *);
-#if 1
-       ///
-       //Timeout update_timeout;
-#endif
 private:
        ///
        Timeout autosave_timeout;
index 49b8e0668816cf07776a0c468f6e637125e55bdd..819ddbf45b69deefb018830e2358e2a34fbca986 100644 (file)
@@ -1,13 +1,16 @@
 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 \
@@ -56,6 +59,7 @@ lyx_SOURCES = \
        PainterBase.h \
        PaperLayout.C \
        ParagraphExtra.C \
+       PrinterParams.h \
        Spacing.C \
        Spacing.h \
        TableLayout.C \
index 6d703cff8fdb0a9bf2e2a6ab6778673933d78e92..e92125ac4e5d493a77731d565b733b784c9d14e5 100644 (file)
@@ -34,6 +34,12 @@ int PainterBase::paperWidth() const
 }
 
 
+int PainterBase::paperHeight() const
+{
+       return owner.height();
+}
+
+
 PainterBase & PainterBase::circle(int x, int y, unsigned int d,
                                  LColor::color col)
 {
index b6a47568f9349ad8710fd248f34f701fb90060ea..22f3a0782b0539b5b478962f2815c7c8523b9735 100644 (file)
@@ -66,6 +66,8 @@ public:
        int paperMargin() const;
        ///
        int paperWidth() const;
+       ///
+       int paperHeight() const;
        
        /**@Basic drawing routines */
        /// Draw a line from point to point
index 89a2afcabdf3af7295ee36d84453b1b6452f5294..b2d2a97d6acb506d270f13360c041ab41120c64a 100644 (file)
@@ -199,9 +199,9 @@ void ParagraphExtraApplyCB(FL_OBJECT *, long)
                } 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"));
        }
diff --git a/src/PrinterParams.h b/src/PrinterParams.h
new file mode 100644 (file)
index 0000000..6f738a0
--- /dev/null
@@ -0,0 +1,168 @@
+// -*- 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
+
+
+
index 4e02f2427ebb3fecf4e58f3655ade026bc840918..810b281358a25b943585dd52b28b26a5079546c2 100644 (file)
@@ -434,14 +434,14 @@ void TableOptionsCB(FL_OBJECT * ob, long l)
         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,
@@ -490,10 +490,10 @@ void SetPWidthCB(FL_OBJECT * ob, long l)
             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
     }
index e4ef2e1c4809b98130f7fe8acb75e926910c8f8e..52645966f41ca9882b8bbee400de8e0f8bd8e5de 100644 (file)
@@ -27,29 +27,31 @@ using std::for_each;
 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;
        }
@@ -60,9 +62,9 @@ LyXText * TextCache::findFit(Buffer * b, unsigned short p)
 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;
@@ -75,18 +77,18 @@ void TextCache::show(ostream & os, string const & str)
 }
 
 
-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;
@@ -98,7 +100,7 @@ void TextCache::add(LyXText * text)
 class delete_text {
 public:
        void operator()(TextCache::value_type & vt) {
-               delete vt;
+               delete vt.second.second;
        }
 };
 
@@ -115,28 +117,17 @@ public:
        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
index 68af6be328c73290d8a76407c767bb45761b15fa..c65111d45b9474821c9af18dff9286e9a48baf2a 100644 (file)
 #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
@@ -112,21 +112,22 @@ class Buffer;
 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();
index 00a6a02c54a7af7b414c15cc6478dc8ee24545ec..b20ec6b298ad23503b079e0315f2b40211787a60 100644 (file)
@@ -53,7 +53,7 @@ extern "C" {
 
 
 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();
 
@@ -254,7 +254,7 @@ void WorkArea::scroll_cb(FL_OBJECT * ob, long)
        // 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();
 }
 
@@ -281,14 +281,14 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
                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; 
@@ -296,7 +296,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
                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;
@@ -307,7 +307,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
                    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);
                }
@@ -322,23 +322,23 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
                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;
index 376a89a97d1155f5df39361f1d6f73e24559cccb..b57f3e713dc218ae9d37844dabe291c94f8489ce 100644 (file)
@@ -33,7 +33,7 @@ public:
        ///
        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; }
        ///
@@ -95,6 +95,9 @@ public:
        string getClipboard() const;
        ///
        void putClipboard(string const &) const;
+       ///
+       BufferView * owner() const { return owner_; }
+
 private:
        ///
        void createPixmap(int, int);
@@ -105,7 +108,7 @@ private:
        ///
        FL_OBJECT * scrollbar;
        ///
-       BufferView * owner;
+       BufferView * owner_;
        /// The pixmap overlay on the workarea
        Pixmap workareapixmap;
        ///
index ef4f37588288fdea0e928e61b8b061b72e7d5827..eef8cdb79995dfb5ddffbe1e1ea693aa97728fed 100644 (file)
@@ -52,6 +52,7 @@
 #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"
@@ -80,6 +81,8 @@
 #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;
@@ -166,7 +169,7 @@ void Buffer::setReadonly(bool flag)
        if (read_only != flag) {
                read_only = flag; 
                updateTitles();
-               updateAllVisibleBufferRelatedPopups();
+               users->owner()->getDialogs()->updateBufferDependent();
        }
        if (read_only) {
                WarnReadonly(filename);
@@ -246,7 +249,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
        if(!par) {
                par = new LyXParagraph;
        } else {
-               users->text->BreakParagraph();
+               users->text->BreakParagraph(users);
                return_par = users->text->FirstParagraph();
                pos = 0;
                markDirty();
@@ -309,7 +312,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
                }
        } 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);
@@ -604,14 +607,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
        } 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());
@@ -767,7 +762,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
                // 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);
@@ -775,84 +770,91 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
 #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());
@@ -878,63 +880,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
                                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") {
@@ -956,26 +901,6 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
                                ++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, 
@@ -1003,22 +928,12 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
                        }
                } 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);
@@ -1026,7 +941,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
        } 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);
@@ -1059,7 +974,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
        } 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);
@@ -1279,7 +1194,7 @@ bool Buffer::writeFile(string const & fname, bool flag) const
 
        // 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;
@@ -1418,11 +1333,11 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
                                        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);
@@ -1511,7 +1426,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
                        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;
                                }
@@ -2098,7 +2013,7 @@ void Buffer::makeLaTeXFile(string const & fname,
 // 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;
@@ -2146,10 +2061,10 @@ void Buffer::latexParagraphs(ostream & ofs, LyXParagraph *par,
                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);
                }
 
@@ -2280,10 +2195,6 @@ void Buffer::makeLinuxDocFile(string const & fname, int column)
                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) {
@@ -2756,7 +2667,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
                        ++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)
@@ -2883,10 +2794,6 @@ void Buffer::makeDocBookFile(string const & fname, int column)
                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) {
@@ -3121,7 +3028,7 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
 {
 #ifndef NEW_TABULAR
        if (par->table) {
-               par->SimpleDocBookOneTablePar(params,
+               par->SimpleDocBookOneTablePar(this,
                                              os, extra, desc_on, depth);
                return;
        }
@@ -3168,11 +3075,11 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
                        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);
@@ -3542,7 +3449,7 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
                        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) {
@@ -3554,7 +3461,7 @@ void Buffer::RoffAsciiTable(ostream & os, LyXParagraph * par)
                                }
 #else
                                strstream ss;
-                               inset->Ascii(ss);
+                               inset->Ascii(this, ss);
                                ss.seekp(0);
                                ss.get(c);
                                while (!ss) {
@@ -3797,7 +3704,7 @@ vector<vector<Buffer::TocItem> > Buffer::getTocList()
                                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:
@@ -3827,7 +3734,7 @@ vector<vector<Buffer::TocItem> > Buffer::getTocList()
                                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);
                        }
                }
@@ -3852,7 +3759,7 @@ vector<pair<string,string> > Buffer::getBibkeyList()
        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;
        }
 
index 85a5317390b79ebb05bb387879db219022765624..d4bc57188873b588d91e32393fb03a7183a7e20e 100644 (file)
@@ -38,8 +38,6 @@ class LyXRC;
 class TeXErrors;
 class LaTeXFeatures;
 
-extern void updateAllVisibleBufferRelatedPopups();
-
 ///
 struct DEPCLEAN {
        ///
@@ -158,7 +156,7 @@ public:
        // 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();
index e7113979a99ba73228be0142372c6feb63f2f67b..67782547a678b3ea0ee7f8504da5e655ea0d9375 100644 (file)
@@ -25,9 +25,9 @@ void Foot(BufferView * bv)
        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);
 }
 
 
@@ -60,9 +60,9 @@ void Margin(BufferView * bv)
        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);
        }
 }
 
@@ -86,9 +86,9 @@ void Melt(BufferView * bv)
        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);
 }
 
 
@@ -108,12 +108,12 @@ void changeDepth(BufferView * bv, int decInc)
        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)"));
@@ -287,22 +287,22 @@ void ToggleAndShow(BufferView * bv, LyXFont const & font)
 {
        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());
                }
        }
index 4ff02108fb579a88860a9d2aa99430ef039b5d87..ee0fbcafb348034ed2c9f54926758f09574f4e33 100644 (file)
@@ -1,4 +1,4 @@
-/** 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_
diff --git a/src/cite.C b/src/cite.C
new file mode 100644 (file)
index 0000000..3fd01f6
--- /dev/null
@@ -0,0 +1,42 @@
+// 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;
+}
+/*---------------------------------------*/
+
diff --git a/src/cite.h b/src/cite.h
new file mode 100644 (file)
index 0000000..27ae828
--- /dev/null
@@ -0,0 +1,19 @@
+/** 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_ */
index 1703b4a3c691add846dc6ed0e92e34b2097790f2..06c95a909b88e45c25b6033188d68f7ff12be73e 100644 (file)
@@ -31,6 +31,8 @@ enum kb_action {
        LFUN_PREVIEW,
        LFUN_PREVIEWPS,
        LFUN_CLOSEBUFFER,
+       LFUN_BUFFER_PRINT,              // ARRae 20000313
+       LFUN_PRINTER_PARAMS_GET,        // ARRae 20000313
        LFUN_QUIT,
        LFUN_AUTOSAVE,
        LFUN_UNDO,
@@ -239,6 +241,7 @@ enum kb_action {
        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
@@ -250,6 +253,7 @@ enum kb_action {
        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 */
 };
 
index 78d837411796951d578ddcc58ea6d4654604761c..430e56c580ecec7ee4f2ad0541f316215fdca568 100644 (file)
@@ -26,7 +26,6 @@ extern string system_lyxdir;
 /**** 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);
@@ -72,30 +71,3 @@ void ShowCredits()
                             _("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"));
-       }
-}
index a78fe0a59c3ee26c668a8e1170b4367592b0084d..8cfd8423568333323261633baf9ad9c84aae8995 100644 (file)
@@ -3,6 +3,5 @@
 #define CREDITS_H
 
 void ShowCredits();
-void ShowCopyright();
 
 #endif
index e98b16ef0acec13867a0922bd1bef4ce73bc97f0..f686225025c58a7feb0a3a247ff6f6b1b847dd20 100644 (file)
@@ -6,7 +6,7 @@
 /* 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)
@@ -40,36 +40,3 @@ 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;
-}
-/*---------------------------------------*/
-
index 5cd8777eb4cad6e77e8dea70b4899ce3001b3a6d..ba63e10b765efdc37d5c48dce399dd4e53da5d1a 100644 (file)
@@ -1,4 +1,4 @@
-/** 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_
@@ -6,8 +6,6 @@
 /** Callbacks, globals and object handlers **/
 extern "C" void CreditsOKCB(FL_OBJECT *, long);
 
-extern "C" void CopyrightOKCB(FL_OBJECT *, long);
-
 
 /**** Forms and Objects ****/
 typedef struct {
@@ -19,13 +17,5 @@ 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_ */
index c9e05d38e101dd9f93c00020a95602ebe60605c9..c6379ba7a0fcb0b7da03a5316c042c0304311eb2 100644 (file)
@@ -193,11 +193,11 @@ FD_Figure *create_form_Figure(void)
   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);
@@ -323,11 +323,11 @@ FD_form_search *create_form_form_search(void)
     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);
index 027d7cf32c6181c45a22130e8d0112425bee7ca5..e83d512bb7b8793eda74f939978a0cf9f6f7a8bb 100644 (file)
@@ -1,10 +1,8 @@
-/** 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);
diff --git a/src/insets/ExternalTemplate.C b/src/insets/ExternalTemplate.C
new file mode 100644 (file)
index 0000000..34e3386
--- /dev/null
@@ -0,0 +1,295 @@
+/* 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;
+               }
+       }
+}
+
diff --git a/src/insets/ExternalTemplate.h b/src/insets/ExternalTemplate.h
new file mode 100644 (file)
index 0000000..9b5566c
--- /dev/null
@@ -0,0 +1,87 @@
+// -*- 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
+
index 093913bcc58ffe88988eb2e7de921be7e86e9636..f8555a96cc4a7e843f32fe9ce0be0bfe758b0da8 100644 (file)
@@ -1,12 +1,15 @@
 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 \
@@ -16,6 +19,8 @@ libinsets_la_SOURCES = \
        inset.C \
        insetbib.C \
        insetbib.h \
+       insetbutton.C \
+       insetbutton.h \
        insetcite.C \
        insetcite.h \
        insetcollapsable.C \
@@ -26,6 +31,8 @@ libinsets_la_SOURCES = \
        inseterror.h \
        insetert.C \
        insetert.h \
+       insetexternal.C \
+       insetexternal.h \
        insetfoot.C \
        insetfoot.h \
        insetgraphics.C \
index f24394db7edd902ebfe797b9dc90984e296affa3..1b66a0fc15ba836a7f2636a837b6f22dbd3d6581 100644 (file)
@@ -1088,7 +1088,7 @@ void InsetFig::draw(Painter & pain, LyXFont const & f,
 }
 
 
-void InsetFig::Write(ostream & os) const
+void InsetFig::Write(Buffer const *, ostream & os) const
 {
        Regenerate();
        os << "Figure size " << wid << " " << hgh << "\n";
@@ -1107,7 +1107,7 @@ void InsetFig::Write(ostream & os) const
 }
 
 
-void InsetFig::Read(LyXLex & lex)
+void InsetFig::Read(Buffer const *, LyXLex & lex)
 {
        string buf;
        bool finished = false;
@@ -1191,7 +1191,7 @@ void InsetFig::Read(LyXLex & lex)
 }
 
 
-int InsetFig::Latex(ostream & os,
+int InsetFig::Latex(Buffer const *, ostream & os,
                    bool /* fragile*/, bool /* fs*/) const
 {
        Regenerate();
@@ -1200,28 +1200,29 @@ int InsetFig::Latex(ostream & os,
 }
 
 
-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
index 178ddf4acf9bd6446d429d2c92284570dc16b8b9..8df0d8f94f6e9ec31d33890e56a72ef466f63334 100644 (file)
@@ -33,17 +33,17 @@ public:
        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;
 
index bf489a647570455fb599ab1770841d7fe7694379..19249a574e4bf9a6ad7af379ba157397b4dec113 100644 (file)
@@ -141,7 +141,7 @@ void UpdatableInset::Edit(BufferView * bv, int, int, unsigned int)
 
     scx = 0;
 
-    mx_scx = abs((width(bv->painter(), font) - bv->paperWidth()) / 2);
+    mx_scx = abs((width(bv->painter(), font) - bv->workWidth()) / 2);
 }
 
 
index 4fca380b18e547167db8835cac15490e27906dd6..8dceec8e52c0cb080acaf81a062d74855c99d390 100644 (file)
@@ -51,8 +51,8 @@ extern "C" void bibitem_cb(FL_OBJECT *, long data)
                        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
        }
@@ -128,7 +128,7 @@ void InsetBibKey::setCounter(int c)
 // 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()) {
@@ -208,7 +208,7 @@ string InsetBibtex::getScreenLabel() const
 }
 
 
-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
index 62f7c0d5018fd6ec8785cbe27d833d460959b6ca..1c3adc371e56531f00ff575dd49529d469a64d2d 100644 (file)
@@ -41,7 +41,7 @@ public:
        ///
         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;
         ///
@@ -63,7 +63,7 @@ public:
                InsetBibKey * inset;
                BufferView * view;
        };
-
  private:
        ///
         int counter;
@@ -99,7 +99,7 @@ public:
        ///
        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;
        ///
diff --git a/src/insets/insetbutton.C b/src/insets/insetbutton.C
new file mode 100644 (file)
index 0000000..f167fe6
--- /dev/null
@@ -0,0 +1,108 @@
+/* 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;
+}
diff --git a/src/insets/insetbutton.h b/src/insets/insetbutton.h
new file mode 100644 (file)
index 0000000..917b57f
--- /dev/null
@@ -0,0 +1,44 @@
+// -*- 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
+
index 7c1461f9d1845f1aaa57fc3b3d64fc09e35d589c..7b523bdfa07c6d7b672014c9f14983cb519094c2 100644 (file)
@@ -432,7 +432,7 @@ void InsetCitation::setCiteButtons( FD_citation_form * form, State status ) cons
                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 );
@@ -442,7 +442,7 @@ void InsetCitation::setCiteButtons( FD_citation_form * form, State status ) cons
                        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 {
index bba9cf9442f0f35bc17f3922a1a2944408a7d2ff..75c582bee7d7b10000a2a8109a647b5dab49d6c4 100644 (file)
@@ -22,8 +22,7 @@
 
 using std::ostream;
 
-InsetCollapsable::InsetCollapsable(Buffer * bf)
-               : InsetText(bf)
+InsetCollapsable::InsetCollapsable() : InsetText()
 {
     collapsed = true;
     label = "Label";
@@ -38,25 +37,25 @@ InsetCollapsable::InsetCollapsable(Buffer * bf)
 
 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();
@@ -66,7 +65,7 @@ void InsetCollapsable::Read(LyXLex & lex)
            collapsed = lex.GetBool();
        }
     }
-    InsetText::Read(lex);
+    InsetText::Read(buf, lex);
 }
 
 
index 5d695996cd7e5601728d083c0f4644b3e7b0bf6d..604867de7d7cf1cab526e1e58f55536985e48084 100644 (file)
@@ -35,15 +35,15 @@ public:
     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;
     ///
index e95b798a530667f676c092ce5367fe18bb94fedf..1595b884dc496e8fc94d2bf262887be9ffe5e2fe 100644 (file)
@@ -34,90 +34,8 @@ InsetCommand::InsetCommand(string const & cmd, string const & arg,
 }
 
 
-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";
 }
@@ -187,7 +105,7 @@ void InsetCommand::scanCommand(string const & cmd)
 
 
 // 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();
@@ -197,26 +115,26 @@ void InsetCommand::Read(LyXLex & lex)
 }
 
 
-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;
 }
index ed473534ea618d94ed1185ec915d7515c63dce53..3d1d1bf53933a308741da66b18115ce81507cf2e 100644 (file)
@@ -16,8 +16,7 @@
 #pragma interface
 #endif
 
-#include "lyxinset.h"
-#include "LString.h"
+#include "insetbutton.h"
 
 // Created by Alejandro 970222
 /** Used to insert a LaTeX command automatically
@@ -25,7 +24,7 @@
  * 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();
@@ -34,28 +33,21 @@ public:
        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;
        ///  
index b1a879cfaa531a2959cc8b80029722a9af58f07a..a01ca847812a517c396ed0fbc192e01620ec78d9 100644 (file)
@@ -94,36 +94,36 @@ void InsetError::draw(Painter & pain, LyXFont const & font,
 }
 
 
-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;
 }
index 519da5fe93dff0ddeeac40001ac9138aee86016f..0a47116373efa414879e7f00707cfbcc4c213bf0 100644 (file)
@@ -44,17 +44,17 @@ public:
        ///
        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
index 5b8fd7f2a16fef02368e796c401de0cac357ca5b..396342f49f1114d74e2e556f919cd27d6c535a92 100644 (file)
@@ -23,8 +23,7 @@
 
 using std::ostream;
 
-InsetERT::InsetERT(Buffer * bf)
-       : InsetCollapsable(bf)
+InsetERT::InsetERT() : InsetCollapsable()
 {
     setLabel(_("ERT"));
     LyXFont font(LyXFont::ALL_SANE);
@@ -41,8 +40,8 @@ InsetERT::InsetERT(Buffer * bf)
 
 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;
index d49fae2742d4be2dfbe36b0cbd73776c825b64a5..0946976ac41464b6f220ed843c07a7fa9ab13f85 100644 (file)
@@ -30,7 +30,7 @@ class Painter;
 class InsetERT : public InsetCollapsable {
 public:
     ///
-    InsetERT(Buffer *);
+    InsetERT();
     ///
     ~InsetERT() {}
     ///
diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C
new file mode 100644 (file)
index 0000000..9e64a5e
--- /dev/null
@@ -0,0 +1,531 @@
+/* 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;
+}
diff --git a/src/insets/insetexternal.h b/src/insets/insetexternal.h
new file mode 100644 (file)
index 0000000..3f1906e
--- /dev/null
@@ -0,0 +1,150 @@
+// -*- 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
index 897b289888a543604d462a635685b1a42224672d..04323504159e587e4057e00e3b85f05e044100c7 100644 (file)
@@ -23,8 +23,7 @@
 using std::ostream;
 using std::endl;
 
-InsetFoot::InsetFoot(Buffer * bf)
-       : InsetCollapsable(bf)
+InsetFoot::InsetFoot() : InsetCollapsable()
 {
     setLabel(_("foot"));
     LyXFont font(LyXFont::ALL_SANE);
@@ -39,8 +38,8 @@ InsetFoot::InsetFoot(Buffer * bf)
 
 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;
@@ -53,11 +52,11 @@ char const * InsetFoot::EditMessage() const
 }
 
 
-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;
@@ -83,9 +82,9 @@ bool InsetFoot::InsertInsetAllowed(Inset * inset) const
 }
 
 
-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;
 }
index c3cadca668719d91f4aefff88f11a636f8020e88..f396d5aa0703333c80a0876c372d034e7e72fb00 100644 (file)
@@ -29,7 +29,7 @@ class InsetFoot : public InsetCollapsable {
 public:
     ///
        explicit
-    InsetFoot(Buffer *);
+    InsetFoot();
     ///
     ~InsetFoot() {}
     ///
@@ -37,7 +37,7 @@ public:
     ///
     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;
     ///
@@ -45,7 +45,7 @@ public:
     ///
     bool InsertInsetAllowed(Inset * inset) const;
     ///
-    LyXFont GetDrawFont(LyXParagraph * par, int pos) const;
+    LyXFont GetDrawFont(Buffer const *, LyXParagraph * par, int pos) const;
     ///
 };
 
index 088de19ed8e6e914b74e24a913b9eeac65ec982c..39c3b19e6323e5b8b25ac6f5e452403e1ab85b92 100644 (file)
@@ -171,7 +171,7 @@ Inset::EDITABLE InsetGraphics::Editable() 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?
@@ -181,7 +181,7 @@ void InsetGraphics::Write(ostream & os) const
 }
 
 
-void InsetGraphics::Read(LyXLex & /*lex*/) 
+void InsetGraphics::Read(Buffer const *, LyXLex & /*lex*/) 
 {
        // For now we only use a static file...
        graphicsfile = "testfile.xpm";
@@ -191,7 +191,7 @@ void InsetGraphics::Read(LyXLex & /*lex*/)
 }
 
 
-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
@@ -334,19 +334,19 @@ int InsetGraphics::Latex(ostream & os,
 }
 
 
-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;
 }
index 92849ae22907c33eafbcf17ed8e94a05a569cd67..d5e5415354d9f58b872b610867a7c1c353818ea6 100644 (file)
@@ -42,20 +42,20 @@ public:
        ///
        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;
index 9594984db742118245e5eca9b9fbe2e2ce968320..3f511181550d4d5e6de77c8c551f98e7f97ed2a0 100644 (file)
@@ -264,15 +264,15 @@ void InsetInclude::Edit(BufferView * bv, int, int, unsigned int)
 }
 
 
-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();
@@ -334,7 +334,7 @@ bool InsetInclude::loadIfNeeded() const
 }
 
 
-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
@@ -383,8 +383,7 @@ int InsetInclude::Latex(ostream & os,
 
        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 << '}';
index b2839b03f72572c0981e2d2f32d26bee65a71741..90c1f71ef933a5d9659f2852b1a38bf169abdb9b 100644 (file)
@@ -52,11 +52,11 @@ public:
                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;
        
index 3c58a89091a6712664fb6cd0b797b7019277fab9..9433bf70a21fde2c12836586c68052a8acd7603e 100644 (file)
@@ -99,13 +99,13 @@ void InsetInfo::draw(Painter & pain, LyXFont const & f,
 }
 
 
-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")
@@ -132,26 +132,26 @@ void InsetInfo::Read(LyXLex & lex)
 }
       
 
-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;
 }
index 2e4267a8880f91efc0c68dad0fe99b895c44ab25..ca32a853d552b27dd84ab95b6f024f4e45365270 100644 (file)
@@ -46,17 +46,17 @@ public:
        ///
        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;
        ///
index 02f3930d4a2edaa05964c54209e12724e8b0ac94..0a8ca63951da5846a75aaf37bc27d0576d98b65e 100644 (file)
@@ -61,39 +61,40 @@ void InsetLabel::Edit(BufferView * bv, int, int, unsigned int)
                        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;
index 4730fd1d91405b0c9da1719004bd24f800a2bfbb..eb5bfe1b64c72e7201ab920e00d2ae6a3f260b06 100644 (file)
@@ -40,13 +40,13 @@ public:
        ///
        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;
index 38175672a3d622c6d279a7d054c341b70cdfc86f..664c041a9c1eef26f0ee5194d97ded6ff27b1c75 100644 (file)
@@ -80,7 +80,7 @@ void InsetLatex::Write(FILE * file)
 }
 
 
-void InsetLatex::Read(LyXLex & lex)
+void InsetLatex::Read(Buffer const *, LyXLex & lex)
 {
        FILE * file = lex.getFile();
        char c = 0;
index c3b5b52a500622c18ab241ffc82623a9ddd1a5cd..ad875ced24903c7b11ef3b73c506d594f4da7943 100644 (file)
@@ -44,7 +44,7 @@ public:
        ///
        void Write(FILE * file);
        ///
-       void Read(LyXLex & lex);
+       void Read(Buffer const *, LyXLex & lex);
        ///
        int Latex(FILE * file, signed char fragile, bool free_spc);
        ///
index 62141dbfb73d10f7786c1a38b2ef1c00855e909a..c332b6030b03431a6bfa78f477c268469126f0cb 100644 (file)
@@ -605,13 +605,13 @@ void InsetLatexAccent::draw(Painter & pain, LyXFont const & font,
 }
 
 
-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();
@@ -619,7 +619,7 @@ void InsetLatexAccent::Read(LyXLex & lex)
 }
 
 
-int InsetLatexAccent::Latex(ostream & os,
+int InsetLatexAccent::Latex(Buffer const *, ostream & os,
                            bool /*fragile*/, bool/*fs*/) const
 {
        os << contents;
@@ -627,21 +627,21 @@ int InsetLatexAccent::Latex(ostream & os,
 }
 
 
-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;
index 018eb86d181c03fab67a187bae5cf2d2a09f0882..8f83dd56dabb2f861084a04aa5fd4c5826c31683 100644 (file)
@@ -50,17 +50,17 @@ public:
        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;
        ///
index 7ed200b7f9e1bc1f1092f1e84099b49967264a47..71fc512398487e6a97bc2f918ec8dd1810c08008 100644 (file)
@@ -51,10 +51,10 @@ void InsetParent::Edit(BufferView * bv, int, int, unsigned int)
 
 
 // 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;
 }
index 293ca4df381dde907bdd0de3756afb18e1a0ffc7..59d77d7a1c5ffcfbda1e31da729fea2c6da49705 100644 (file)
@@ -33,7 +33,7 @@ public:
        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()); }
        ///
index fe09f6e0479a2838012c611c67993d657a3f220f..2e028cc40cbecec9e22af5bd5b9ec736b35910ae 100644 (file)
@@ -207,7 +207,7 @@ void InsetQuotes::draw(Painter & pain, LyXFont const & font,
 }
 
 
-void InsetQuotes::Write(ostream & os) const
+void InsetQuotes::Write(Buffer const *, ostream & os) const
 {
        string text;
        text += language_char[language];
@@ -217,14 +217,14 @@ void InsetQuotes::Write(ostream & os) const
 }
 
 
-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();
@@ -244,42 +244,32 @@ int InsetQuotes::Latex(ostream & os, bool /*fragile*/, bool) const
                        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)
index 31903afbd6da010e312e921fb30857e61a499eed..fd3565ba988b148d506256bea6c563d99e08d364 100644 (file)
@@ -82,17 +82,17 @@ public:
        ///
        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;
        ///
index 38180c7ba130c3f33fb1598989f3984570ed9876..b211db9ff5447af221be689ac36f79fb9990b639 100644 (file)
@@ -83,7 +83,7 @@ void InsetRef::Edit(BufferView * bv, int, int, unsigned int)
 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()
@@ -95,7 +95,7 @@ string InsetRef::getScreenLabel() const
 }
 
 
-int InsetRef::Latex(ostream & os,
+int InsetRef::Latex(Buffer const *, ostream & os,
                    bool /*fragile*/, bool /*fs*/) const
 {
        if(getOptions().empty())
@@ -110,14 +110,14 @@ int InsetRef::Latex(ostream & os,
 }
 
 
-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() << "\" >";
@@ -125,7 +125,7 @@ int InsetRef::Linuxdoc(ostream & os) const
 }
 
 
-int InsetRef::DocBook(ostream & os) const
+int InsetRef::DocBook(Buffer const *, ostream & os) const
 {
        os << "<link linkend=\"" << getContents()
           << "\">" << getOptions() << "</link>";
index c1e12cc90b710bdfd5c575ec232186b4dda46fbd..653d078d8b83ddf322d9c00af64dd798a0f7ca14 100644 (file)
@@ -69,13 +69,13 @@ public:
         ///
         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:
index ae93b68d869a87a21ef747101d4dd99f74a7ea44..cf8d0b6202e4d257200d152423b082de633c675f 100644 (file)
@@ -141,7 +141,7 @@ void InsetSpecialChar::draw(Painter & pain, LyXFont const & f,
 
 
 // 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) {
@@ -159,7 +159,7 @@ void InsetSpecialChar::Write(ostream & os) const
 
 
 // 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();
@@ -180,7 +180,7 @@ void InsetSpecialChar::Read(LyXLex & lex)
 }
 
 
-int InsetSpecialChar::Latex(ostream & os, bool /*fragile*/,
+int InsetSpecialChar::Latex(Buffer const *, ostream & os, bool /*fragile*/,
                            bool free_space) const
 {
        switch (kind) {
@@ -193,7 +193,7 @@ int InsetSpecialChar::Latex(ostream & os, bool /*fragile*/,
        return 0;
 }
 
-int InsetSpecialChar::Ascii(ostream & os) const
+int InsetSpecialChar::Ascii(Buffer const *, ostream & os) const
 {
        switch (kind) {
        case HYPHENATION:                       break;
@@ -206,15 +206,15 @@ int InsetSpecialChar::Ascii(ostream & os) const
 }
 
 
-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);
 }
 
 
index f8d5a20152e21b81e5020f8ea3e49be500417752..d9a737dd14e3ff97f2d95fb4acebb2025c65d1e1 100644 (file)
@@ -52,17 +52,17 @@ public:
        ///
        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;
        ///  
index a5ce99f1756f62990ea26fa507b6fc8245d682c2..5a139487a1554655d48c2365b0ee109fd3ed0f0e 100644 (file)
@@ -97,21 +97,21 @@ Inset * InsetTabular::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;
 
@@ -696,24 +696,24 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
 }
 
 
-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;
 }
@@ -1046,7 +1046,7 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
        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);
 
@@ -1068,6 +1068,7 @@ void InsetTabular::TabularFeatures(BufferView * bv, int feature, string val)
        break;
     case LyXTabular::APPEND_ROW:
        // append the row into the tabular
+       UnlockInsetInInset(bv, the_locking_inset);
        tabular->AppendRow(actcell);
        UpdateLocal(bv, true);
        break;
@@ -1271,12 +1272,12 @@ bool InsetTabular::InsetHit(BufferView * bv, int x, int ) const
 
 // 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);
 }
 
@@ -1290,7 +1291,7 @@ int InsetTabular::getMaxWidth(Painter & pain,
            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!!!
index e4534f480e5a1e32e2fdc84c6919d0fdd6ac45a9..4175f2376ff5b8e39a2600e770561eb3093ca0ec 100644 (file)
@@ -70,9 +70,9 @@ public:
     ///
     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;
     ///
@@ -116,13 +116,13 @@ public:
     ///
     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;
     ///
index 86841780c5e16fbece5b00ee4201b55e12ae984a..b69c8c6fd363783098ccf74353338cbacc7e50e3 100644 (file)
@@ -42,6 +42,7 @@
 #include "LColor.h"
 #include "support/textutils.h"
 #include "support/LAssert.h"
+#include "lyxrow.h"
 
 using std::ostream;
 using std::ifstream;
@@ -50,28 +51,38 @@ using std::min;
 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;
@@ -103,25 +114,25 @@ InsetText::~InsetText()
 
 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;
@@ -142,10 +153,10 @@ void InsetText::Read(LyXLex & lex)
             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;
@@ -162,37 +173,38 @@ void InsetText::Read(LyXLex & lex)
 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;
 }
 
 
@@ -202,30 +214,43 @@ void InsetText::draw(Painter & pain, LyXFont const & f,
     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;
 }
 
@@ -257,7 +282,7 @@ void InsetText::drawRowSelection(Painter & pain, int startpos, int endpos,
        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) {
@@ -287,7 +312,7 @@ void InsetText::drawRowText(Painter & pain, int startpos, int endpos,
 
     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)) {
@@ -352,7 +377,7 @@ void InsetText::Edit(BufferView * bv, int x, int y, unsigned int button)
     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);
 }
@@ -379,20 +404,20 @@ bool InsetText::LockInsetInInset(BufferView * bv, UpdatableInset * inset)
     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;
        }
@@ -430,9 +455,9 @@ bool InsetText::UpdateInsetInInset(BufferView * bv, Inset * inset)
     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;
 }
@@ -584,13 +609,13 @@ InsetText::LocalDispatch(BufferView * bv,
     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);
@@ -671,7 +696,7 @@ InsetText::LocalDispatch(BufferView * bv,
        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;
@@ -693,11 +718,11 @@ InsetText::LocalDispatch(BufferView * bv,
     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);
@@ -709,7 +734,7 @@ InsetText::LocalDispatch(BufferView * bv,
        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);
@@ -720,10 +745,10 @@ InsetText::LocalDispatch(BufferView * bv,
        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);
        }
@@ -769,11 +794,11 @@ InsetText::LocalDispatch(BufferView * bv,
     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;
@@ -781,10 +806,12 @@ InsetText::LocalDispatch(BufferView * bv,
        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);
 
@@ -804,9 +831,9 @@ InsetText::LocalDispatch(BufferView * bv,
            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);
        }
@@ -824,10 +851,10 @@ InsetText::LocalDispatch(BufferView * bv,
 }
 
 
-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();
 }
 
@@ -841,7 +868,7 @@ void InsetText::Validate(LaTeXFeatures & features) const
 // 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)) {
@@ -864,7 +891,7 @@ int InsetText::SingleWidth(Painter & pain, LyXParagraph * p, int pos) const
 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;
@@ -889,24 +916,24 @@ void InsetText::SingleHeight(Painter & pain, LyXParagraph * p,int pos,
 // 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.
@@ -923,14 +950,14 @@ LyXFont InsetText::GetFont(LyXParagraph * p, int pos) const
 
     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.
@@ -946,27 +973,27 @@ LyXFont InsetText::GetFont(LyXParagraph * p, int pos) const
     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
@@ -997,15 +1024,18 @@ void InsetText::ToggleInsetCursor(BufferView * bv)
         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;
 }
 
@@ -1017,12 +1047,14 @@ void InsetText::ShowInsetCursor(BufferView * bv)
        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;
     }
 }
@@ -1113,7 +1145,7 @@ InsetText::moveRight(BufferView * bv, bool activate_inset)
     }
     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;
 }
 
@@ -1178,7 +1210,7 @@ bool InsetText::InsertInset(BufferView * bv, Inset * inset)
            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) {
@@ -1220,10 +1252,10 @@ void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall)
     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,
@@ -1247,16 +1279,16 @@ void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall)
     }
     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);
@@ -1266,18 +1298,18 @@ void InsetText::SetCharFont(int pos, LyXFont const & 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
@@ -1308,7 +1340,7 @@ void InsetText::computeTextRows(Painter & pain) const
     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);
@@ -1350,7 +1382,7 @@ void InsetText::computeTextRows(Painter & pain) const
            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);
@@ -1459,6 +1491,7 @@ void InsetText::computeBaselines(int baseline) const
 void InsetText::UpdateLocal(BufferView * bv, bool flag)
 {
     if (flag) {
+       text->FullRebreak(bv);
        computeTextRows(bv->painter());
        computeBaselines(top_baseline);
     }
@@ -1469,7 +1502,7 @@ void InsetText::UpdateLocal(BufferView * bv, bool flag)
 }
 
 
-bool InsetText::cutSelection()
+bool InsetText::cutSelection(Buffer const * buf)
 {
     if (!hasSelection())
        return false;
@@ -1486,12 +1519,11 @@ bool InsetText::cutSelection()
            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;
@@ -1506,11 +1538,11 @@ bool InsetText::copySelection()
            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;
 
@@ -1524,8 +1556,7 @@ bool InsetText::pasteSelection()
     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;
 }
@@ -1537,7 +1568,7 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
     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)
index e6544af41d9f37e00939ac9a689127f0c79c7a5c..e76ea919f0ca24bbc0b557612853542aa4d5070b 100644 (file)
@@ -28,31 +28,33 @@ class Buffer;
 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;
     ///
@@ -84,13 +86,13 @@ public:
     ///
     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;
     ///
@@ -110,7 +112,7 @@ public:
     ///
     void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
     ///
-    void init(Buffer *, InsetText const * ins = 0);
+    void init(InsetText const * ins = 0);
     ///
     void SetParagraphData(LyXParagraph *);
     ///
@@ -122,15 +124,14 @@ public:
     ///
     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;
     ///
@@ -141,13 +142,13 @@ protected:
     ///
     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;
     ///
@@ -177,7 +178,7 @@ private:
     ///
     void computeBaselines(int) const;
     ///
-    int BeginningOfMainBody(LyXParagraph * par) const;
+    int BeginningOfMainBody(Buffer const *, LyXParagraph * par) const;
     ///
     void ShowInsetCursor(BufferView *);
     ///
@@ -186,25 +187,25 @@ private:
     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);
     ///
@@ -255,25 +256,5 @@ private:
     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
index 4c09831aeb630128c0fc44d65eea05bc1a7946cb..15414fb8f854f287d079bc5475a17069a3153fad 100644 (file)
@@ -24,14 +24,14 @@ void InsetTOC::Edit(BufferView * bv, int, int, unsigned int)
        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;
index bf12da1f6e1ef5c293e9d509e42b368f7cec5053..aed9460393404411ed29cb7c44e00ab4767f7893 100644 (file)
@@ -45,9 +45,9 @@ public:
        ///
        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;
index ae2c16a9fe1028ce8dfef62db6b4a6dfe2470875..722e439784162ee06404d1037ca4422466b3a569 100644 (file)
@@ -164,16 +164,16 @@ string InsetUrl::getScreenLabel() const
                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())
@@ -185,7 +185,7 @@ int InsetUrl::Latex(ostream & os,
 }
 
 
-int InsetUrl::Ascii(ostream & os) const
+int InsetUrl::Ascii(Buffer const *, ostream & os) const
 {
        if (getOptions().empty())
                os << "[" << getContents() << "]";
@@ -195,7 +195,7 @@ int InsetUrl::Ascii(ostream & os) const
 }
 
 
-int InsetUrl::Linuxdoc(ostream & os) const
+int InsetUrl::Linuxdoc(Buffer const *, ostream & os) const
 {
        os << "<" << getCmdName()
           << " url=\""  << getContents() << "\""
@@ -205,7 +205,7 @@ int InsetUrl::Linuxdoc(ostream & os) const
 }
 
 
-int InsetUrl::DocBook(ostream & os) const
+int InsetUrl::DocBook(Buffer const *, ostream & os) const
 {
        os << "<ulink url=\"" << getContents() << "\">"
           << getOptions() << "</ulink>";
index 81ae62d3705f692a19d5c063a532e9d18b495bf9..a610455b31e2ad90963ad9ad0b8d5458eb87a179 100644 (file)
@@ -72,13 +72,13 @@ public:
         ///
         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:
index ff08faa4685cd9fa744e307217577b41c106c2dd..e6ecafbd90a5ba37330848e169c3f09a9e7dee2e 100644 (file)
@@ -25,6 +25,7 @@
 
 class Painter;
 class BufferView;
+class Buffer;
 
 struct LaTeXFeatures;
 
@@ -92,7 +93,9 @@ public:
                ///
                SPECIALCHAR_CODE,
                ///
-               TABULAR_CODE
+               TABULAR_CODE,
+               ///
+               EXTERNAL_CODE
        };
 
        enum EDITABLE {
@@ -122,34 +125,34 @@ public:
        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;
        ///
index 3571c3060b50d6e054e7a44d5d21eddc86f3787a..650eab3e932763a02f0825d7b3ecf867a2a6399a 100644 (file)
@@ -6,7 +6,7 @@
 /* Form definition file generated with fdesign. */
 
 #include FORMS_H_LOCATION
-#include <stdlib.h>
+#include <cstdlib>
 #include "latexoptions.h"
 
 FD_LaTeXOptions *create_form_LaTeXOptions(void)
index 3a4161688baa97a67f25dff42811986e24fe5162..270eedd6935e4fe8b6e5ff6788f4956a71668e5c 100644 (file)
@@ -1,4 +1,4 @@
-/** 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_
index c81285548c146361eece0518dbae922f1a369823..06e24ee216ca683015b7d3e53851196e326f273d 100644 (file)
@@ -6,7 +6,7 @@
 /* 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)
@@ -138,9 +138,10 @@ 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, "");
@@ -196,16 +197,20 @@ FD_form_character *create_form_form_character(void)
   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);
@@ -213,53 +218,49 @@ FD_form_character *create_form_form_character(void)
     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);
@@ -711,6 +712,7 @@ FD_form_paragraph_extra *create_form_form_paragraph_extra(void)
     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);
index 0112c26f96dbcf03e2c2da1bb019fef346d37d8a..0af3976c1e05f89bc548a8c4d88ba18fccc42391 100644 (file)
@@ -1,8 +1,10 @@
-/** 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);
@@ -46,11 +48,13 @@ extern "C" void ParagraphExtraCancelCB(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();
@@ -66,6 +70,8 @@ extern void MenuLayoutQuotes();
 extern void MenuLayoutParagraph();
 extern void MenuLayoutTable(int);
 
+extern "C" {
+
 /**** Forms and Objects ****/
 typedef struct {
        FL_FORM *form_document;
@@ -109,6 +115,7 @@ typedef struct {
        void *vdata;
        char *cdata;
        long  ldata;
+       FL_OBJECT *choice_language;
        FL_OBJECT *choice_family;
        FL_OBJECT *choice_series;
        FL_OBJECT *choice_shape;
@@ -117,7 +124,6 @@ typedef struct {
        FL_OBJECT *button_apply;
        FL_OBJECT *button_close;
        FL_OBJECT *choice_color;
-       FL_OBJECT *choice_language;
        FL_OBJECT *check_toggle_all;
 } FD_form_character;
 
@@ -275,4 +281,6 @@ typedef struct {
 
 extern FD_form_table_extra * create_form_form_table_extra(void);
 
+}
+
 #endif /* FD_form_document_h_ */
index cb9f670162d1d987e31f340189debcf7728a48ef..4e1bacb461324171917a227009d13d9e1f943b0e 100644 (file)
--- a/src/lyx.C
+++ b/src/lyx.C
@@ -6,7 +6,7 @@
 /* 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)
@@ -72,23 +72,23 @@ FD_form_screen *create_form_form_screen(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);
@@ -160,15 +160,15 @@ FD_form_ref *create_form_form_ref(void)
     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);
@@ -179,22 +179,22 @@ FD_form_ref *create_form_form_ref(void)
     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;
@@ -203,3 +203,60 @@ FD_form_ref *create_form_form_ref(void)
 }
 /*---------------------------------------*/
 
+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;
+}
+/*---------------------------------------*/
+
index 5ba0cd9c0fc109f7dcc226ae32c9721a2889353d..53744a1f15a18825915a9db290f55592fd2b7ced 100644 (file)
--- a/src/lyx.h
+++ b/src/lyx.h
@@ -1,4 +1,4 @@
-/** 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_
@@ -22,6 +22,14 @@ extern "C" void RefUpdateCB(FL_OBJECT *, long);
 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 {
@@ -85,5 +93,23 @@ 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_ */
index fd1110a61983d06399edd7d225bac91d22a18626..c0d847f62779ffd5aa1ff51251a268a183778e66 100644 (file)
@@ -19,7 +19,6 @@
 #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"
@@ -70,7 +69,6 @@ extern FD_form_document * fd_form_document;
 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;
@@ -183,28 +181,6 @@ void ShowMessage(Buffer * buf,
 }
 
 
-
-
-#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
 //
@@ -820,27 +796,6 @@ void MenuMakeAscii(Buffer * buffer)
 }
 
 
-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
@@ -955,7 +910,9 @@ void MenuExport(Buffer * buffer, string const & extyp)
        // 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 :-(
@@ -1157,10 +1114,10 @@ void InsertAsciiFile(BufferView * bv, string const & f, bool asParagraph)
        // 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);
 }
 
 
@@ -2179,7 +2136,8 @@ extern "C" void ParagraphApplyCB(FL_OBJECT *, long)
        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,
@@ -2188,7 +2146,7 @@ extern "C" void ParagraphApplyCB(FL_OBJECT *, long)
                                         align, 
                                         labelwidthstring,
                                         noindent);
-       current_view->update(1);
+       current_view->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
        current_view->owner()->getMiniBuffer()->Set(_("Paragraph layout set"));
 }
 
@@ -2392,7 +2350,8 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long)
        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();
 
@@ -2638,29 +2597,29 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
    
        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(),
@@ -2673,7 +2632,7 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
                                       0);
        } else {
                current_view->text
-                       ->SetParagraph(0, 0,
+                       ->SetParagraph(current_view, 0, 0,
                                       0, 0,
                                       VSpace(VSpace::NONE),
                                       VSpace(VSpace::NONE),
@@ -2692,11 +2651,11 @@ extern "C" void TableApplyCB(FL_OBJECT *, long)
                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();
 }
@@ -2715,187 +2674,6 @@ extern "C" void TableOKCB(FL_OBJECT * ob, long data)
 }
 
 
-/* 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) {
@@ -2941,29 +2719,29 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long)
        }
        
        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),
@@ -2972,7 +2750,7 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long)
                                             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),
@@ -2981,12 +2759,12 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long)
                                                 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();
@@ -3095,10 +2873,10 @@ extern "C" void TocSelectCB(FL_OBJECT * ob, long)
        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"), 
index ebb32b9f67de6f6b45a20cb61503f82c1f9be401..18b007ae4c9cbc7a90cb488273872e24931a3d8c 100644 (file)
 #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"
@@ -58,7 +62,6 @@ FD_form_table_extra * fd_form_table_extra;
 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;
@@ -239,10 +242,6 @@ void LyXGUI::init()
         // 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,
@@ -344,6 +343,7 @@ void LyXGUI::create_forms()
                            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();
@@ -368,12 +368,14 @@ void LyXGUI::create_forms()
        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();
@@ -430,6 +432,7 @@ void LyXGUI::create_forms()
        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();
@@ -461,6 +464,7 @@ void LyXGUI::create_forms()
                            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();
@@ -477,6 +481,7 @@ void LyXGUI::create_forms()
                            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();
@@ -501,17 +506,7 @@ void LyXGUI::create_forms()
        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();
@@ -592,6 +587,9 @@ void LyXGUI::runTime()
        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);
index 42b694b6e12d75aa461bf0406013fe9c8f7e0827..1262e486a474886fbc8a5ae04fbf1ff42cbeaa05 100644 (file)
@@ -48,7 +48,6 @@ extern FD_form_table_options * fd_form_table_options;
 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;
@@ -88,7 +87,7 @@ extern "C" int IgnoreCloseBoxCB(FL_FORM *, void *)
 // 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
@@ -115,9 +114,6 @@ void CloseAllBufferRelatedPopups()
        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);
        }
@@ -199,7 +195,7 @@ void CloseAllBufferRelatedPopups()
 
 // 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();
@@ -230,6 +226,9 @@ void updateAllVisibleBufferRelatedPopups()
        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
index f9c6107e33a57188bd8db73077a6706b84c2c27a..8d67900ba5d3329cd5ad4ebaaec941fc9b828201 100644 (file)
@@ -24,10 +24,10 @@ extern "C" int CancelCloseBoxCB(FL_FORM *, void *);
 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);
index 490aa4706f2d3613b65152a8143caa0f276d75c3..acaf1101e927daceee3937316d3e6039076aae7b 100644 (file)
@@ -6,7 +6,7 @@
 /* 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)
index 60b3746c12956eb4b17d42159804872edbf541e5..505a9be531699e2b71798ef99a51c676cd96b55c 100644 (file)
@@ -1,4 +1,4 @@
-/** 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_
index 378419cefbbb62d6b798d12e9450a022821f5e8b..b2282715aaf694f83db4d2dbbf2ea272ff8e2a31 100644 (file)
@@ -67,22 +67,22 @@ string GetCurrentSelectionAsString(LyXText * lt)
 // 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);
 }
 
 
@@ -105,7 +105,7 @@ void LyXFindReplace::StartSearch(BufferView * b)
        SF.replaceEnabled(!bv->buffer()->isReadonly());
        searchForward = true;
        if (SF.SearchString().empty()) 
-               SF.SetSearchString(GetSelectionOrWordAtCursor(bv->text));
+               SF.SetSearchString(GetSelectionOrWordAtCursor(bv));
 }      
 
 
@@ -129,17 +129,17 @@ void LyXFindReplace::SearchReplaceCB()
        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:
@@ -169,20 +169,20 @@ void LyXFindReplace::SearchReplaceAllCB()
 
        // 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));
@@ -212,7 +212,7 @@ bool LyXFindReplace::SearchCB(bool fForward)
                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 :
@@ -222,15 +222,15 @@ bool LyXFindReplace::SearchCB(bool fForward)
        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;
@@ -250,10 +250,10 @@ bool LyXFindReplace::SearchCB(bool fForward)
 // 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)
@@ -264,7 +264,7 @@ bool LyXFindReplace::SearchForward(LyXText * lt)
                }
        }
        if (par) {
-               lt->SetCursor(par, pos);
+               bv->text->SetCursor(bv, par, pos);
                return true;
        } else
                return false;
@@ -274,10 +274,10 @@ bool LyXFindReplace::SearchForward(LyXText * lt)
 // 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)
@@ -293,7 +293,7 @@ bool LyXFindReplace::SearchBackward(LyXText * lt)
        } while (par && !IsSearchStringInText(par, pos));
   
        if (par) {
-               lt->SetCursor(par, pos);
+               bv->text->SetCursor(bv, par, pos);
                return true;
        } else
                return false;
index d1a6781d21b4617a26cb0ff0c43f969f81835110..edfbfdb3c258583df41b6447bb342de32d93e97d 100644 (file)
@@ -41,9 +41,9 @@ private:
        bool searchForward;
     
        ///
-       bool SearchForward(LyXText * lt);
+       bool SearchForward(BufferView *);
        ///
-       bool SearchBackward(LyXText * lt); 
+       bool SearchBackward(BufferView *); 
 
        /** Compares 2 char values. 
        return value is
index 00e4318fd03347e861ff4f62db2839bea533e00b..77cae6f4b18079c20b8cbe9d36fa2ef502ada129 100644 (file)
@@ -52,6 +52,7 @@ using std::istringstream;
 #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"
@@ -80,6 +81,7 @@ using std::istringstream;
 #include "lyxfr1.h"
 #include "menus.h"
 #include "bufferview_funcs.h"
+#include "frontends/Dialogs.h"
 
 using std::pair;
 using std::endl;
@@ -114,10 +116,6 @@ extern LyXAction lyxaction;
 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 *);
@@ -165,14 +163,10 @@ inline
 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. */
@@ -216,7 +210,7 @@ int LyXFunc::processKeyEvent(XEvent * ev)
        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 {
@@ -321,13 +315,13 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
        
        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)) {
@@ -360,8 +354,8 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
         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:
@@ -372,7 +366,7 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
                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")
@@ -590,13 +584,13 @@ string LyXFunc::Dispatch(int ac,
                                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()));
@@ -604,14 +598,14 @@ string LyXFunc::Dispatch(int ac,
                                        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()));
@@ -641,11 +635,11 @@ string LyXFunc::Dispatch(int ac,
 
                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) 
@@ -654,7 +648,7 @@ string LyXFunc::Dispatch(int ac,
 
                        // 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);
 
@@ -673,7 +667,7 @@ string LyXFunc::Dispatch(int ac,
        case LFUN_PREFIX:
        {
                if (owner->view()->available()) {
-                       owner->view()->update(-2);
+                       owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
                }
                string buf;
                keyseq.print(buf, true);
@@ -720,8 +714,8 @@ string LyXFunc::Dispatch(int ac,
                
        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;
 
@@ -788,9 +782,9 @@ string LyXFunc::Dispatch(int ac,
                break;
                
        case LFUN_MENUPRINT:
-               MenuPrint(owner->buffer());
+               owner->getDialogs()->showPrint();
                break;
-               
+
        case LFUN_FAX:
                MenuFax(owner->buffer());
                break;
@@ -1036,6 +1030,10 @@ string LyXFunc::Dispatch(int ac,
                owner->view()->setState();
                break;
                
+       case LFUN_HELP_COPYRIGHT:
+               owner->getDialogs()->showCopyright();
+               break;
+
                // --- version control -------------------------------
        case LFUN_VC_REGISTER:
        {
@@ -1161,14 +1159,14 @@ string LyXFunc::Dispatch(int ac,
                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();
                }
        }
@@ -1270,51 +1268,24 @@ string LyXFunc::Dispatch(int ac,
                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:
@@ -1380,9 +1351,9 @@ string LyXFunc::Dispatch(int ac,
                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
@@ -1394,7 +1365,7 @@ string LyXFunc::Dispatch(int ac,
                        break;
                }
                if (!is_rtl)
-                       tmptext->CursorRight(false);
+                       tmptext->CursorRight(owner->view(), false);
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
                owner->getMiniBuffer()->Set(CurrentState(owner->view()));
@@ -1408,9 +1379,9 @@ string LyXFunc::Dispatch(int ac,
                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
@@ -1418,7 +1389,8 @@ string LyXFunc::Dispatch(int ac,
                    && 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),
@@ -1427,7 +1399,7 @@ string LyXFunc::Dispatch(int ac,
                        break;
                }
                if  (is_rtl)
-                       txt->CursorRight(false);
+                       txt->CursorRight(owner->view(), false);
 
                owner->view()->text->FinishUndo();
                moveCursorUpdate(false);
@@ -1437,8 +1409,8 @@ string LyXFunc::Dispatch(int ac,
                
        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()));
@@ -1447,8 +1419,8 @@ string LyXFunc::Dispatch(int ac,
        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()));
@@ -1457,8 +1429,8 @@ string LyXFunc::Dispatch(int ac,
        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()));
@@ -1467,8 +1439,8 @@ string LyXFunc::Dispatch(int ac,
        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()));
@@ -1477,7 +1449,7 @@ string LyXFunc::Dispatch(int ac,
        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);
@@ -1487,7 +1459,7 @@ string LyXFunc::Dispatch(int ac,
        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);
@@ -1497,8 +1469,8 @@ string LyXFunc::Dispatch(int ac,
        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()));
@@ -1507,8 +1479,8 @@ string LyXFunc::Dispatch(int ac,
        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()));
@@ -1518,8 +1490,8 @@ string LyXFunc::Dispatch(int ac,
        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()));
@@ -1528,11 +1500,11 @@ string LyXFunc::Dispatch(int ac,
        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()));
@@ -1541,11 +1513,11 @@ string LyXFunc::Dispatch(int ac,
        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()));
@@ -1554,8 +1526,8 @@ string LyXFunc::Dispatch(int ac,
        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()));
@@ -1564,8 +1536,8 @@ string LyXFunc::Dispatch(int ac,
        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()));
@@ -1574,61 +1546,61 @@ string LyXFunc::Dispatch(int ac,
       
                /* 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);
@@ -1636,7 +1608,7 @@ string LyXFunc::Dispatch(int ac,
                break;
                
        case LFUN_NEXTSEL:
-               owner->view()->update(-2);
+               owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
                owner->view()->cursorNext();
                owner->view()->text->FinishUndo();
                moveCursorUpdate(true);
@@ -1644,54 +1616,54 @@ string LyXFunc::Dispatch(int ac,
                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()));
@@ -1700,13 +1672,8 @@ string LyXFunc::Dispatch(int ac,
                // --- 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;
                
@@ -1717,8 +1684,8 @@ string LyXFunc::Dispatch(int ac,
                                            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();
                }
@@ -1729,12 +1696,12 @@ string LyXFunc::Dispatch(int ac,
        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 = 
@@ -1742,27 +1709,17 @@ string LyXFunc::Dispatch(int ac,
                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();
@@ -1774,20 +1731,16 @@ string LyXFunc::Dispatch(int ac,
                
                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,
@@ -1795,92 +1748,57 @@ string LyXFunc::Dispatch(int ac,
                                                 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"));
@@ -1890,7 +1808,7 @@ string LyXFunc::Dispatch(int ac,
        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"));
@@ -1898,17 +1816,12 @@ string LyXFunc::Dispatch(int ac,
                
        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();
@@ -1916,11 +1829,6 @@ string LyXFunc::Dispatch(int ac,
                } else {
                        owner->view()->cut();
                }
-#if 1
-               //owner->update_timeout.start();
-#else
-               SetUpdateTimer();
-#endif
                owner->getMiniBuffer()->Set(CurrentState(owner->view()));
                owner->view()->setState();
        }
@@ -1932,50 +1840,36 @@ string LyXFunc::Dispatch(int ac,
                
                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();
@@ -1986,13 +1880,8 @@ string LyXFunc::Dispatch(int ac,
        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();
@@ -2012,26 +1901,23 @@ string LyXFunc::Dispatch(int ac,
                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()));
@@ -2080,21 +1966,16 @@ string LyXFunc::Dispatch(int ac,
                }
                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;
 
@@ -2115,7 +1996,7 @@ string LyXFunc::Dispatch(int ac,
        
        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
@@ -2124,7 +2005,17 @@ string LyXFunc::Dispatch(int ac,
        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
@@ -2134,7 +2025,7 @@ string LyXFunc::Dispatch(int ac,
        
        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
@@ -2183,7 +2074,7 @@ string LyXFunc::Dispatch(int ac,
                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;
        
@@ -2297,13 +2188,8 @@ string LyXFunc::Dispatch(int ac,
                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;
        }   
@@ -2630,8 +2516,8 @@ string LyXFunc::Dispatch(int ac,
                        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;
@@ -2663,16 +2549,11 @@ string LyXFunc::Dispatch(int ac,
        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);
@@ -2705,14 +2586,10 @@ string LyXFunc::Dispatch(int ac,
                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);
        }
@@ -2724,7 +2601,7 @@ string LyXFunc::Dispatch(int ac,
                lyxrc.write("preferences");
        }
        break;
-       
+
        case LFUN_UNKNOWN_ACTION:
        {
                if(!owner->buffer()) {
@@ -2749,8 +2626,8 @@ string LyXFunc::Dispatch(int ac,
                
                        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);
                                }
                        }
                        
@@ -2765,12 +2642,7 @@ string LyXFunc::Dispatch(int ac,
                                        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;
@@ -3205,7 +3077,7 @@ void LyXFunc::CloseBuffer()
                        // 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());
@@ -3245,3 +3117,7 @@ void LyXFunc::setMessage(string const & m)
 {
        dispatch_buffer = m;
 }
+
+
+
+
index 24a0456f17781298b6d190762482b2fe6ac9c2a9..f8a8e906e0d8c78705c54453c2943841e19acc9a 100644 (file)
@@ -33,7 +33,7 @@ public:
        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.
@@ -72,6 +72,7 @@ public:
        
        /// Should a hint message be displayed?
        void setHintMessage(bool);
+
 private:
        ///
        LyXView * owner;
index 3e7206dcc2a8892107ee9afee030af399f62272d..d50f08ebc441f0d0704462a8f988eeb7fb518598 100644 (file)
@@ -167,7 +167,7 @@ string LyXLex::getLongString(string const & endtoken)
                            && prefixIs(tmpstr, prefix.c_str())) {
                                tmpstr.erase(0, prefix.length() - 1);
                        }
-                       str += tmpstr + '\n';
+                       str += frontStrip(tmpstr, "\t") + '\n';
                 }
                else // token == endtoken
                        break;
index f2cab3d0938010bf12ed046a783e13e5ff0a491c..8da47fb035bbec87b5aabcd344906430e3f42cbd 100644 (file)
@@ -86,7 +86,14 @@ public:
        ///
        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);
        
        ///
index 8ce181ea92e604f0d39ab48f19971b2d7f5ca018..a2dbf2d5b8f2d7a9f3537bd2efcb6344bdb62211 100644 (file)
@@ -135,12 +135,13 @@ public:
        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;
        
@@ -157,17 +158,17 @@ public:
        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);
@@ -505,12 +506,12 @@ public:
        ///
        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:
@@ -571,21 +572,21 @@ 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);
@@ -595,7 +596,7 @@ private:
                             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,
index 5826dfae4c8880e81639330e38df97097d034654..f7359f6e5acf58bae776f9c1f6303552637db5c3 100644 (file)
@@ -443,7 +443,14 @@ int LyXRC::read(string const & filename)
                        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;
                        
@@ -841,9 +848,10 @@ int LyXRC::read(string const & filename)
                        // 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;
@@ -1324,7 +1332,7 @@ void LyXRC::output(ostream & os) const
        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";
@@ -1345,7 +1353,7 @@ void LyXRC::output(ostream & os) const
        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";
index b931af0111d5daa39eef20e5008195d738859ad4..7eec3c242fb2c7c75381b647410e836b67c298e1 100644 (file)
@@ -40,6 +40,8 @@ public:
        ///
        ToolbarDefaults toolbardefaults;
        ///
+       string bind_file;
+       ///
        string printer;
        ///
        string print_command;
index 944c722f880b7dfa8701c78a5412999f430a20c2..f70254e24f047c2d93ec60c69e32c0fef05b0cc9 100644 (file)
@@ -24,6 +24,7 @@ struct Row;
 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
index f1082af61e8616dd365e009cfa8e14b43466e610..8de309592cee36c7b4d7be789a0733a6ed9af1e2 100644 (file)
@@ -21,6 +21,7 @@
 #include "lyxcursor.h"
 #include "lyxparagraph.h"
 #include "layout.h"
+#include "insets/insettext.h"
 
 class Buffer;
 class BufferParams;
@@ -51,56 +52,59 @@ public:
        };
 
        /// 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
         */
@@ -110,42 +114,42 @@ public:
          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);
@@ -178,7 +182,7 @@ public:
        /** 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
@@ -220,93 +224,93 @@ public:
        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,
@@ -314,44 +318,46 @@ public:
                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();
        ///
@@ -367,14 +373,15 @@ public:
         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,
@@ -391,35 +398,35 @@ public:
        /** 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,
@@ -429,36 +436,36 @@ public:
        /** 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
@@ -470,33 +477,31 @@ public:
        /// 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
@@ -531,13 +536,11 @@ public:
        }
 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;
        ///
@@ -560,94 +563,95 @@ private:
        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;
 
 
@@ -685,6 +689,13 @@ private:
 
        ///
        void charInserted();
+       ///
+       /// special owner functions
+       ///
+       LyXParagraph * OwnerParagraph() const;
+       ///
+       LyXParagraph * OwnerParagraph(LyXParagraph *) const;
+       ///
 };
 
 #endif
index e3f9e6159e198bcfd75f92dca0fa2426f7c578f3..10785c5ffa85e032b4bf97b61f7d98d213be6651 100644 (file)
@@ -11,6 +11,9 @@
 #include <config.h>
 #include <iostream>
 
+#ifdef KDEGUI
+#    include <kapp.h>
+#endif
 #include FORMS_H_LOCATION
 
 #include "lyx_main.h"
@@ -57,7 +60,11 @@ int main(int argc, char * argv[])
                        "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");
index 791fe931cc33cafa5b788c8b972594f101d8a6ce..1f14e9ce62e2bf51e8b55c6860d3b9e4dd2cc029 100644 (file)
@@ -1,8 +1,9 @@
 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 \
index cc61c95dc89ffc86f72d7841ac93c2c665235233..74e2cc0ce4a39932e542c1e407eb52f1e298fd71 100644 (file)
@@ -306,14 +306,14 @@ Inset * InsetFormula::Clone() const
 }
 
 
-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
@@ -323,22 +323,22 @@ int InsetFormula::Latex(ostream & os, bool fragile, bool) const
 }
 
 
-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);
 }
 
 
@@ -351,7 +351,7 @@ void InsetFormula::Validate(LaTeXFeatures & features) const
 }
 
 
-void InsetFormula::Read(LyXLex & lex)
+void InsetFormula::Read(Buffer const *, LyXLex & lex)
 {
        istream & is = lex.getStream();
     
index da8f6d69dc54494e7eabe1e0618cf94f5c17e50b..5cb6a47b8d885726a9713d6f992b2dffbb9c5908 100644 (file)
@@ -49,17 +49,17 @@ public:
        ///
        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;
        ///
index 5e44baa19ee08d1a347d7aa48d7f6bc7433cb42e..503fa7be6d147087a5c980c415889a79f216c387 100644 (file)
@@ -66,14 +66,14 @@ Inset * InsetFormulaMacro::Clone() 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?
@@ -81,19 +81,19 @@ int InsetFormulaMacro::Latex(ostream & os, bool /*fragile*/,
 }
 
 
-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());   
index 6daeb3d9ff5b6b4487629c2001923cb1201fc214..7f2342dfc8ed22dee84884e8ba67b045dbb08d91 100644 (file)
@@ -45,15 +45,16 @@ public:
        ///
        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;
 
index f4dc0ca1f658c33df52f15841cf49af25a736efa..027abca627d430f151f4df36a5d756237f57bf6c 100644 (file)
@@ -9,7 +9,7 @@
 #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));
@@ -133,7 +133,7 @@ FD_matrix *create_form_matrix(void)
   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);
@@ -148,7 +148,7 @@ FD_matrix *create_form_matrix(void)
     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);
index f093b96d95d3d829b51ba84a5047ba21257bcdbb..5cecb5f30e48d20dbe41c2309f50b4cafba65bd1 100644 (file)
@@ -1,20 +1,19 @@
-/** 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 {
index f7d2e069849f39bdd067eefefd2ba9e54db620f3..bd5bff06595ba776eb9cb945929aaea88dbd19c0 100644 (file)
@@ -277,19 +277,8 @@ void MathParInset::Write(ostream & os, bool fragile)
                }
        }
 
-       // 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, '}');
 }
 
 
@@ -335,23 +324,6 @@ void mathed_write(MathParInset * p, ostream & os, int * newlines,
           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 {
index 4252f50a9100db783a8ad6321431834b5fd23b59..3f7fedc37692c4c2d1e428ae7c8716fc7dce7277 100644 (file)
@@ -52,6 +52,8 @@
 #include "insets/insettabular.h"
 #include "tabular.h"
 
+#include "frontends/Dialogs.h"
+
 using std::vector;
 using std::endl;
 using std::max;
@@ -66,7 +68,6 @@ extern BufferList bufferlist;
 
 extern void MenuLayoutSave();
 extern void ShowCredits();
-extern void ShowCopyright();
 extern void show_symbols_form(LyXFunc *);
 extern void LaTeXOptions(BufferView *);
 
@@ -1240,7 +1241,7 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
                        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()
@@ -1251,8 +1252,8 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
                                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;
@@ -1414,9 +1415,9 @@ void Menus::ShowTocMenu(FL_OBJECT * ob, long)
                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]);
@@ -1747,7 +1748,8 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
                                     "|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"      
@@ -1769,25 +1771,26 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
        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(
@@ -1815,11 +1818,13 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
                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;
@@ -1836,7 +1841,7 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
                        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;
@@ -1845,7 +1850,7 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
                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;
@@ -1856,13 +1861,13 @@ void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
                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);
@@ -1953,7 +1958,7 @@ void Menus::ShowMathMenu(FL_OBJECT * ob, long)
                        show_symbols_form(tmpfunc);
                        break;
                }
-               men->currentView()->update(0);
+               men->currentView()->update(BufferView::SELECT|BufferView::FITCUR);
        } 
        fl_freepup(MathMenu);
 }
@@ -1976,13 +1981,15 @@ void Menus::ShowOptionsMenu(FL_OBJECT * ob, long)
                                      "|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);
@@ -2002,6 +2009,7 @@ void Menus::ShowOptionsMenu(FL_OBJECT * ob, long)
        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);
@@ -2049,11 +2057,12 @@ char const * doc_files [] = {"Intro", "Tutorial",
                             "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);
@@ -2106,7 +2115,7 @@ void Menus::ShowHelpMenu(FL_OBJECT * ob, long)
                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());
index 02023d9b0af87f5879e48e6da07f9a8bcb4d812e..7ff89a722b03af772a8ec95f5ddc3e3b54a905d4 100644 (file)
@@ -120,7 +120,8 @@ LyXParagraph::LyXParagraph(LyXParagraph * par)
 }
 
 
-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;
@@ -245,7 +246,7 @@ void LyXParagraph::writeFile(ostream & os, BufferParams const & params,
 #endif
        // bibitem  ale970302
        if (bibkey)
-               bibkey->Write(os);
+               bibkey->Write(buf, os);
 
        font1 = LyXFont(LyXFont::ALL_INHERIT,params.language_info);
 
@@ -274,10 +275,10 @@ void LyXParagraph::writeFile(ostream & os, BufferParams const & params,
                                        // 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;
                                }
@@ -322,7 +323,7 @@ void LyXParagraph::writeFile(ostream & os, BufferParams const & params,
 
        // now write the next paragraph
        if (next)
-               next->writeFile(os, params, footflag, dth);
+               next->writeFile(buf, os, params, footflag, dth);
 }
 
 
@@ -2007,7 +2008,8 @@ int LyXParagraph::GetPositionOfInset(Inset * inset) const
 }
 
 
-LyXParagraph * LyXParagraph::TeXOnePar(BufferParams const & bparams,
+LyXParagraph * LyXParagraph::TeXOnePar(Buffer const * buf,
+                                      BufferParams const & bparams,
                                       ostream & os, TexRow & texrow,
                                       bool moving_arg, 
                                       ostream & foot,
@@ -2077,7 +2079,7 @@ LyXParagraph * LyXParagraph::TeXOnePar(BufferParams const & bparams,
                break;
        case LATEX_ITEM_ENVIRONMENT:
                if (bibkey) {
-                       bibkey->Latex(os, false, false);
+                       bibkey->Latex(buf, os, false, false);
                } else
                        os << "\\item ";
                break;
@@ -2088,7 +2090,7 @@ LyXParagraph * LyXParagraph::TeXOnePar(BufferParams const & bparams,
                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;
@@ -2106,11 +2108,11 @@ LyXParagraph * LyXParagraph::TeXOnePar(BufferParams const & bparams,
                                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,
@@ -2128,11 +2130,11 @@ LyXParagraph * LyXParagraph::TeXOnePar(BufferParams const & 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;
                }
        }
@@ -2244,7 +2246,8 @@ LyXParagraph * LyXParagraph::TeXOnePar(BufferParams const & bparams,
 
 
 // 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)
 {
@@ -2252,7 +2255,7 @@ bool LyXParagraph::SimpleTeXOnePar(BufferParams const & bparams,
 
 #ifndef NEW_TABULAR
        if (table)
-               return SimpleTeXOneTablePar(bparams, os, texrow);
+               return SimpleTeXOneTablePar(buf, bparams, os, texrow);
 #endif
 
        bool return_value = false;
@@ -2430,7 +2433,7 @@ bool LyXParagraph::SimpleTeXOnePar(BufferParams const & bparams,
                        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);
@@ -2460,7 +2463,8 @@ bool LyXParagraph::SimpleTeXOnePar(BufferParams const & bparams,
 
 
 // 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;
@@ -2590,7 +2594,7 @@ bool LyXParagraph::SimpleTeXOneTablePar(BufferParams const & bparams,
                        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);
                        }
@@ -2618,7 +2622,7 @@ bool LyXParagraph::SimpleTeXOneTablePar(BufferParams const & bparams,
                        }
                        texrow.start(this, i + 1);
                } else {
-                       SimpleTeXSpecialChars(bparams,
+                       SimpleTeXSpecialChars(buf, bparams,
                                              os, texrow, false,
                                              font, running_font, basefont,
                                              open_font, style, i, column, c);
@@ -2641,7 +2645,8 @@ bool LyXParagraph::SimpleTeXOneTablePar(BufferParams const & bparams,
 
 
 // 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,
@@ -2731,7 +2736,7 @@ bool LyXParagraph::TeXContTableRows(BufferParams const & bparams,
                                        column += 9;
                                }
                        }
-                       SimpleTeXSpecialChars(bparams,
+                       SimpleTeXSpecialChars(buf, bparams,
                                              os, texrow, false, font,
                                              running_font, basefont,
                                              open_font, style, i, column, c);
@@ -2815,10 +2820,11 @@ bool LyXParagraph::linuxDocConvertChar(char c, string & sgml_string)
 }
 
 
-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;
@@ -2884,7 +2890,7 @@ void LyXParagraph::SimpleDocBookOneTablePar(BufferParams const & bparams,
                        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);
@@ -2906,11 +2912,11 @@ void LyXParagraph::SimpleDocBookOneTablePar(BufferParams const & bparams,
                        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);
@@ -2993,7 +2999,7 @@ void LyXParagraph::SimpleDocBookOneTablePar(BufferParams const & bparams,
 }
 
 
-void LyXParagraph::DocBookContTableRows(BufferParams const & bparams,
+void LyXParagraph::DocBookContTableRows(Buffer const * buffer,
                                        ostream & os, string & extra,
                                         int & desc_on,
                                        LyXParagraph::size_type i,
@@ -3001,6 +3007,8 @@ void LyXParagraph::DocBookContTableRows(BufferParams const & bparams,
 
 {
        if (!table) return;
+
+       BufferParams const & bparams = buffer->params;
        
        lyxerr[Debug::LATEX] << "DocBookContTableRows... " << this << endl;
 
@@ -3073,11 +3081,11 @@ void LyXParagraph::DocBookContTableRows(BufferParams const & bparams,
                                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);
@@ -3183,7 +3191,8 @@ void LyXParagraph::SimpleTeXBlanks(ostream & os, TexRow & texrow,
 }
 
 
-void LyXParagraph::SimpleTeXSpecialChars(BufferParams const & bparams,
+void LyXParagraph::SimpleTeXSpecialChars(Buffer const * buf,
+                                        BufferParams const & bparams,
                                         ostream & os, TexRow & texrow,
                                         bool moving_arg,
                                         LyXFont & font,
@@ -3211,7 +3220,7 @@ void LyXParagraph::SimpleTeXSpecialChars(BufferParams const & bparams,
                                close = true;
                        }
 
-                       int tmp = inset->Latex(os, moving_arg,
+                       int tmp = inset->Latex(buf, os, moving_arg,
                                               style.free_spacing);
 
                        if (close)
@@ -3478,7 +3487,7 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
                                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) {
@@ -3490,7 +3499,7 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
                                        }
 #else
                                        strstream ss;
-                                       inset->Ascii(ss);
+                                       inset->Ascii(buffer, ss);
                                        ss.seekp(0);
                                        ss.get(c);
                                        while (!ss) {
@@ -3528,7 +3537,8 @@ bool LyXParagraph::RoffContTableRows(ostream & os,
 #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,
@@ -3545,12 +3555,12 @@ LyXParagraph * LyXParagraph::TeXDeeper(BufferParams const & bparams,
                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);
@@ -3562,7 +3572,8 @@ LyXParagraph * LyXParagraph::TeXDeeper(BufferParams const & bparams,
 }
 
 
-LyXParagraph * LyXParagraph::TeXEnvironment(BufferParams const & bparams,
+LyXParagraph * LyXParagraph::TeXEnvironment(Buffer const * buf,
+                                           BufferParams const & bparams,
                                            ostream & os, TexRow & texrow,
                                            ostream & foot,
                                            TexRow & foot_texrow,
@@ -3703,7 +3714,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(BufferParams const & bparams,
        }
        LyXParagraph * par = this;
        do {
-               par = par->TeXOnePar(bparams,
+               par = par->TeXOnePar(buf, bparams,
                                     os, texrow, false,
                                     foot, foot_texrow, foot_count);
 
@@ -3739,7 +3750,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(BufferParams const & bparams,
                                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 &&
@@ -3847,7 +3858,8 @@ LyXParagraph * LyXParagraph::TeXEnvironment(BufferParams const & bparams,
 }
 
 
-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,
@@ -3997,18 +4009,19 @@ LyXParagraph * LyXParagraph::TeXFootnote(BufferParams const & bparams,
                                // 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);
                        }
@@ -4037,12 +4050,12 @@ LyXParagraph * LyXParagraph::TeXFootnote(BufferParams const & bparams,
                                // 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,
@@ -4050,7 +4063,7 @@ LyXParagraph * LyXParagraph::TeXFootnote(BufferParams const & bparams,
                        }
 
                        if (par && !par->IsDummy() && par->depth > depth) {
-                               par = par->TeXDeeper(bparams,
+                               par = par->TeXDeeper(buf, bparams,
                                                     foot, foot_texrow,
                                                     dummy, dummy_texrow,
                                                     dummy_count);
@@ -4339,8 +4352,9 @@ bool LyXParagraph::isMultiLingual(BufferParams const & bparams)
 
 // 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 + ' ';
@@ -4354,10 +4368,10 @@ string LyXParagraph::String(BufferParams const & bparams, bool label)
                         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',' ');
@@ -4366,7 +4380,7 @@ string LyXParagraph::String(BufferParams const & bparams, bool label)
 
        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))
@@ -4376,7 +4390,8 @@ string LyXParagraph::String(BufferParams const & bparams, bool label)
 }
 
 
-string LyXParagraph::String(LyXParagraph::size_type beg,
+string LyXParagraph::String(Buffer const * buffer, 
+                           LyXParagraph::size_type beg,
                            LyXParagraph::size_type end)
 {
        string s;
@@ -4404,10 +4419,10 @@ string LyXParagraph::String(LyXParagraph::size_type beg,
                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();
index f1b806ca7d1efa6ed4a66a74f5156e3ac200ba0c..1b8867f2186a25528c80ab803d1b15c4952492dd 100644 (file)
@@ -6,95 +6,9 @@
 /* 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;
index 98c73e55b9361670a65666e4d1600d0d2474d464..ae797a0131e4ac6193087fc5cbae549210cc3586 100644 (file)
@@ -1,42 +1,15 @@
-/** 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;
@@ -53,4 +26,4 @@ typedef struct {
 
 extern FD_form_sendto * create_form_form_sendto(void);
 
-#endif /* FD_form_print_h_ */
+#endif /* FD_form_sendto_h_ */
index d8a9e2046e21df5718900d977ea79a74cda4c32d..16b64314e270135cab42841a2db5ed0c20261fb8 100644 (file)
@@ -99,7 +99,7 @@ void LyXScreen::DrawFromTo(int y1, int y2)
        // 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();
        }
@@ -121,7 +121,7 @@ void LyXScreen::DrawOneRow(Row * row, long y_text)
        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);
        }
 }
 
@@ -186,9 +186,9 @@ void LyXScreen::ShowCursor()
        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(),
index fe8d53d9507486e4f733e33fed50c5edbd9ad4b9..474efbffd4d535e0a4c9f94ae8de0dd8db1adb35 100644 (file)
@@ -6,7 +6,7 @@
 /* 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)
@@ -102,11 +102,11 @@ FD_form_spell_check *create_form_form_spell_check(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);
index 1d1a16058d1901216d5087ca75841cb6ae7ca5b7..733c64f07083e9c878e0642dc8d9a4bbccb8ae24 100644 (file)
@@ -1,4 +1,4 @@
-/** 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_
diff --git a/src/support/LAssert.C b/src/support/LAssert.C
new file mode 100644 (file)
index 0000000..cd30509
--- /dev/null
@@ -0,0 +1,36 @@
+/* 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
index f4d92782388bd6f654664eb887fe2827a470bbfc..f44f9ceaa201956f4f704e12669f28e2005b98ed 100644 (file)
@@ -8,11 +8,14 @@
 
 #ifdef ENABLE_ASSERTIONS
 
+extern void emergencySave();
+
 template<class A>
 inline
 void Assert(A assertion)
 {
        if (!assertion) {
+               ::emergencySave();
                lyx::abort();
        }
 }
index 8d83462371b3a032205194d9441c5d58220995e2..9f5e17451f8816905315092448207c8bd38f619f 100644 (file)
@@ -1,7 +1,9 @@
 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
@@ -18,6 +20,7 @@ libsupport_la_SOURCES = \
        DebugStream.h \
        FileInfo.C \
        FileInfo.h \
+       LAssert.C \
        LAssert.h \
        LIstream.h \
        LOstream.h \
@@ -36,6 +39,7 @@ libsupport_la_SOURCES = \
        kill.C \
        lstrings.C \
        lstrings.h \
+       lxtl.h \
        lyxalgo.h \
        lyxlib.h \
        lyxmanip.h \
index 6523d87cda367ee435e6f711a728c081fcba026d..33c6dd4d82c28ed541c9a6ac3a186862e0c840a9 100644 (file)
 #include <cctype>
 
 #include <utility>
+#include <fstream>
+
+#ifdef HAVE_SSTREAM
+#include <sstream>
+#else
+#include <strstream>
+#endif
 
 #ifdef __GNUG__
 #pragma implementation "filetools.h"
@@ -53,6 +60,7 @@
 using std::make_pair;
 using std::pair;
 using std::endl;
+using std::ifstream;
 
 extern string system_lyxdir;
 extern string build_lyxdir;
@@ -713,6 +721,34 @@ string CleanupPath(string const & path)
 #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
index 2686897258c5b0dbf2f033b1ed5cf07d76cdb9bb..14ba9027fc56873c98998ea665cfcfea78c23fba 100644 (file)
@@ -173,6 +173,9 @@ string NormalizePath(string const & path);
 /// 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) ;
 
index 2d53a5ca5a6eb2a4cb7e85e98a1253fdcc12e25b..3d2a1c00e8ecb55954103e2dd2da7dfb2eeb0d78 100644 (file)
@@ -90,11 +90,59 @@ int  strToInt(string const & str)
                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);
@@ -185,6 +233,30 @@ bool contains(char const * a, char const * b)
 }
 
 
+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
index d3ae42ec80b41c2f7a1fa05147ca40a51e2d4ab1..6da511b2fd3d36116f11584d497b8e16e938b7a9 100644 (file)
@@ -48,6 +48,12 @@ bool isStrInt(string const & str);
 ///
 int strToInt(string const & str);
 
+///
+bool isStrDbl(string const & str);
+
+///
+double strToDbl(string const & str);
+
 ///
 string lowercase(string const &);
 
@@ -105,6 +111,18 @@ bool contains(string const & a, string const & b);
 ///
 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);
 
index 5795aea81e9de1a7becbd5574598e3f85999c219..8086ab73b2af2bf511406455bebe0e12666a68a1 100644 (file)
@@ -151,15 +151,19 @@ pid_t Systemcalls::fork()
                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) 
index bb0fe532f1b3c4145505bad8f2758ec131f1b5cc..997103a902c30a7dde80b47e0c4890462070f374 100644 (file)
@@ -187,10 +187,12 @@ public:
     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);
 
index 2a973eff79942259aa075d69a7ba90d0b8a4a307..6175721742f6581895d79ed1333ecb045f302fae 100644 (file)
@@ -54,16 +54,17 @@ LyXTabular::cellstruct::cellstruct()
     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;
@@ -74,12 +75,13 @@ LyXTabular::cellstruct::cellstruct(cellstruct const & cs)
     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)
 {
@@ -95,6 +97,7 @@ LyXTabular::cellstruct::operator=(cellstruct const & cs)
        inset = static_cast<InsetText *>(cs.inset->Clone());
     return *this;
 }
+#endif
 
 
 LyXTabular::rowstruct::rowstruct() 
@@ -133,10 +136,10 @@ LyXTabular::LyXTabular(InsetTabular * inset, LyXTabular const & lt)
 }
 
 
-LyXTabular::LyXTabular(InsetTabular * inset, LyXLex & lex)
+LyXTabular::LyXTabular(Buffer const * buf, InsetTabular * inset, LyXLex & lex)
 {
     owner_ = inset;
-    Read(lex);
+    Read(buf, lex);
 }
 
 
@@ -183,10 +186,13 @@ LyXTabular * LyXTabular::Clone(InsetTabular * inset)
     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;
@@ -209,10 +215,12 @@ void LyXTabular::Init(int rows_arg, int columns_arg)
     // 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++;
         }
     }
@@ -240,45 +248,44 @@ void LyXTabular::Init(int rows_arg, int columns_arg)
 
 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();
 }
 
@@ -322,14 +329,16 @@ void LyXTabular::AppendColumn(int cell)
         }
     }
     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();
 }
@@ -358,6 +367,7 @@ void LyXTabular::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_);
        }
     }
   
@@ -411,7 +421,7 @@ void LyXTabular::set_row_column_number_info()
        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());
        }
     }
@@ -907,7 +917,7 @@ int LyXTabular::right_column_of_cell(int cell) const
 }
 
 
-void LyXTabular::Write(ostream & os) const
+void LyXTabular::Write(Buffer const * buf, ostream & os) const
 {
     int i, j;
 
@@ -946,7 +956,7 @@ void LyXTabular::Write(ostream & os) const
                "\" 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;
@@ -1039,7 +1049,7 @@ void l_getline(istream & is, string & str)
 }
 
 
-void LyXTabular::Read(LyXLex & lex)
+void LyXTabular::Read(Buffer const * buf, LyXLex & lex)
 {
     string line;
     istream & is = lex.getStream();
@@ -1112,7 +1122,7 @@ void LyXTabular::Read(LyXLex & lex)
            (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>") {
@@ -1947,7 +1957,7 @@ int LyXTabular::TeXCellPostamble(ostream & os, int cell) const
 }
 
 
-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;
@@ -2003,7 +2013,7 @@ int LyXTabular::Latex(ostream & os, bool fragile, bool fp) const
            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;
@@ -2056,7 +2066,7 @@ int LyXTabular::Latex(ostream & os, bool fragile, bool fp) const
 
 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
index 5430545b83a8f1d7187cbec1784fd1a389e170b9..78c87575e498b80d750581ab387f5b91ffd939bb 100644 (file)
 
 #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 */ 
 
@@ -76,7 +77,7 @@ public:
     LyXTabular(InsetTabular *, LyXTabular const &);
     ///
     explicit
-    LyXTabular(InsetTabular *, LyXLex & lex);
+    LyXTabular(Buffer const *, InsetTabular *, LyXLex & lex);
     ///
     ~LyXTabular();
     ///
@@ -169,9 +170,9 @@ public:
     ///
     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 &);
     ///
@@ -182,7 +183,7 @@ public:
     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
@@ -271,11 +272,13 @@ private: //////////////////////////////////////////////////////////////////
        ///
         cellstruct();
        ///
+#ifdef INSET_POINTER
        ~cellstruct();
        ///
         cellstruct(cellstruct const &);
        ///
        cellstruct & operator=(cellstruct const &);
+#endif
        ///
        int cellno;
        ///
@@ -297,7 +300,7 @@ private: //////////////////////////////////////////////////////////////////
        ///
        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;
index f2a8ce3323555e9359484004141b400484198ae3..ef0fbebc9c4d78e8c0fd35fa445e6037901d9f7f 100644 (file)
@@ -11,6 +11,7 @@
 #include <config.h>
 #include <cstdlib>
 #include <cctype>
+#include <algorithm>
 
 #ifdef __GNUG__
 #pragma implementation "table.h"
@@ -112,6 +113,19 @@ bool is_nikud(unsigned char c)
 }
 
 
+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) && 
@@ -169,18 +183,18 @@ unsigned char LyXText::TransformChar(unsigned char c, LyXParagraph * par,
 //
 // 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)) {
@@ -234,7 +248,7 @@ int LyXText::SingleWidth(LyXParagraph * par,
        } 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;
@@ -272,7 +286,7 @@ LyXParagraph::size_type LyXText::RowLastPrintable(Row const * row) const
 }
 
 
-void LyXText::ComputeBidiTables(Row * row) const
+void LyXText::ComputeBidiTables(Buffer const * buf, Row * row) const
 {
        bidi_same_direction = true;
        if (!lyxrc.rtl_support) {
@@ -302,11 +316,11 @@ void LyXText::ComputeBidiTables(Row * row) const
        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) {
@@ -317,8 +331,7 @@ void LyXText::ComputeBidiTables(Row * row) const
                         (!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;
@@ -391,7 +404,8 @@ void LyXText::ComputeBidiTables(Row * row) const
 
 
 // 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
@@ -404,14 +418,15 @@ bool LyXText::IsBoundary(LyXParagraph * par, LyXParagraph::size_type pos) const
        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
@@ -420,18 +435,18 @@ bool LyXText::IsBoundary(LyXParagraph * par, LyXParagraph::size_type pos,
        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);
@@ -440,7 +455,7 @@ void LyXText::draw(Row const * row,
        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();
@@ -495,7 +510,7 @@ void LyXText::draw(Row const * row,
                return;
        }
 
-       LyXFont font = GetFont(row->par(), pos);
+       LyXFont font = GetFont(bview->buffer(), row->par(), pos);
        LyXFont font2 = font;
 
        if (c == LyXParagraph::META_FOOTNOTE
@@ -551,13 +566,13 @@ void LyXText::draw(Row const * row,
        } 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);
@@ -597,7 +612,7 @@ void LyXText::draw(Row const * row,
                                ++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;
                        }
@@ -609,7 +624,7 @@ void LyXText::draw(Row const * row,
                               (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;
                        }
@@ -624,7 +639,7 @@ void LyXText::draw(Row const * row,
                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;
@@ -636,7 +651,7 @@ void LyXText::draw(Row const * row,
                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;
                }
@@ -651,7 +666,7 @@ void LyXText::draw(Row const * row,
                          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);
@@ -667,10 +682,10 @@ void LyXText::draw(Row const * row,
 // 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; 
@@ -684,10 +699,10 @@ int LyXText::LeftMargin(Row const * row) const
        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)  {
@@ -707,7 +722,7 @@ int LyXText::LeftMargin(Row const * row) const
                                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();
@@ -724,12 +739,12 @@ int LyXText::LeftMargin(Row const * row) const
                // 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
@@ -743,19 +758,19 @@ int LyXText::LeftMargin(Row const * row) const
                                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());
                }
@@ -769,7 +784,7 @@ int LyXText::LeftMargin(Row const * row) const
                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);
@@ -778,12 +793,12 @@ int LyXText::LeftMargin(Row const * row) const
                }
                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 {
@@ -831,20 +846,22 @@ int LyXText::LeftMargin(Row const * row) const
                
                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);
@@ -870,18 +887,18 @@ int LyXText::LeftMargin(Row const * row) const
                    && 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());
                }
@@ -890,18 +907,18 @@ int LyXText::LeftMargin(Row const * row) const
 }
 
 
-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)  {
@@ -927,13 +944,13 @@ int LyXText::RightMargin(Row const * row) const
                
                // 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
@@ -944,21 +961,23 @@ int LyXText::RightMargin(Row const * row) const
        }
        
        //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  
@@ -982,12 +1001,12 @@ int LyXText::NumberOfCell(LyXParagraph * par,
 }
 
 
-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))
@@ -997,23 +1016,23 @@ int LyXText::WidthOfCell(LyXParagraph * par,
 
 
 #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);
 }
 
 
@@ -1022,11 +1041,13 @@ bool LyXText::MouseHitInTable(int x, long y) const
 
 // 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) {
@@ -1046,11 +1067,11 @@ LyXText::NextBreakPoint(Row const * row, int width) const
        // 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) {
@@ -1071,7 +1092,7 @@ LyXText::NextBreakPoint(Row const * row, int width) const
                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)) {
@@ -1084,10 +1105,10 @@ LyXText::NextBreakPoint(Row const * row, int width) const
                                // 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){
@@ -1104,15 +1125,15 @@ LyXText::NextBreakPoint(Row const * row, int width) const
                        } 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;
                        }
@@ -1137,8 +1158,11 @@ LyXText::NextBreakPoint(Row const * row, int width) const
 
 
 // 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);
@@ -1152,14 +1176,16 @@ int LyXText::Fill(Row * row, int paper_width) const
                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
@@ -1170,52 +1196,52 @@ int LyXText::Fill(Row * row, int paper_width) const
 #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.
 
@@ -1233,14 +1259,14 @@ int LyXText::LabelFill(Row const * row) const
        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);
        }
        
@@ -1250,10 +1276,10 @@ int LyXText::LabelFill(Row const * row) const
 
 // 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)) {
@@ -1267,7 +1293,7 @@ int LyXText::NumberOfSeparators(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 *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();
@@ -1277,7 +1303,7 @@ int LyXText::NumberOfHfills(Row const * row) const
                        ++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)) {
@@ -1289,7 +1315,7 @@ int LyXText::NumberOfHfills(Row const * row) const
 
 
 // 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();
@@ -1299,7 +1325,7 @@ int LyXText::NumberOfLabelHfills(Row const * row) const
                        ++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!
@@ -1313,7 +1339,7 @@ int LyXText::NumberOfLabelHfills(Row const * row) const
 
 // 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?
@@ -1330,10 +1356,10 @@ bool LyXText::HfillExpansion(Row const * row_ptr,
                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
@@ -1348,7 +1374,7 @@ bool LyXText::HfillExpansion(Row const * row_ptr,
 }
 
 
-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;
@@ -1374,21 +1400,21 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const
    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;
    
@@ -1406,11 +1432,11 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const
    // 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)
@@ -1453,35 +1479,36 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const
    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)
@@ -1490,12 +1517,12 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const
       /*  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) *
@@ -1516,7 +1543,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const
              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(
@@ -1547,7 +1574,9 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const
            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());
@@ -1561,7 +1590,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const
         
         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 {
@@ -1587,12 +1616,13 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const
        
          /* 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)
@@ -1607,12 +1637,12 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const
             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;
@@ -1624,7 +1654,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const
                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());
             }
          }
        }
@@ -1653,7 +1683,7 @@ void LyXText::SetHeightOfRow(Row * row_ptr) const
 
 /* 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;
    
@@ -1663,7 +1693,7 @@ void LyXText::AppendParagraph(Row * row) const
 
    do {
       // Get the next breakpoint
-      int z = NextBreakPoint(row, paperwidth);
+      int z = NextBreakPoint(bview, row, workWidth(bview));
       
       Row * tmprow = row;
 
@@ -1678,21 +1708,20 @@ void LyXText::AppendParagraph(Row * row) const
         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() ) {
@@ -1726,17 +1755,17 @@ void LyXText::BreakAgain(Row * row) const
       }
        
       /* 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() ) {
@@ -1768,14 +1797,14 @@ void LyXText::BreakAgainOneRow(Row * row)
        }
        
        // 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 */
@@ -1793,7 +1822,7 @@ void LyXText::BreakParagraph(char keep_layout)
        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); 
 
@@ -1802,7 +1831,7 @@ void LyXText::BreakParagraph(char keep_layout)
    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
@@ -1816,7 +1845,8 @@ void LyXText::BreakParagraph(char keep_layout)
      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){
@@ -1831,9 +1861,11 @@ void LyXText::BreakParagraph(char keep_layout)
    // 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, 
@@ -1842,7 +1874,7 @@ void LyXText::BreakParagraph(char keep_layout)
     * 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;
@@ -1853,40 +1885,40 @@ void LyXText::BreakParagraph(char keep_layout)
    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;
@@ -1907,7 +1939,7 @@ void LyXText::OpenFootnote()
    }
    
    /* 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 */ 
@@ -1924,33 +1956,33 @@ void LyXText::OpenFootnote()
    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); 
        
@@ -1965,11 +1997,11 @@ void LyXText::TableFeatures(int feature, string const & val) const
        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;
@@ -1980,7 +2012,7 @@ void LyXText::TableFeatures(int feature) const
         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); 
 
@@ -2042,7 +2074,7 @@ void LyXText::TableFeatures(int feature) const
                
           /* 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);
@@ -2051,7 +2083,7 @@ void LyXText::TableFeatures(int feature) const
                
           /* append the row into the table */
           cursor.par()->table->AppendRow(cell_org);
-          RedoParagraph();
+          RedoParagraph(bview);
           return;
       }
       case LyXTable::APPEND_CONT_ROW: {
@@ -2066,7 +2098,7 @@ void LyXText::TableFeatures(int feature) const
           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() && 
@@ -2081,7 +2113,7 @@ void LyXText::TableFeatures(int feature) const
                
           /* 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);
@@ -2090,14 +2122,14 @@ void LyXText::TableFeatures(int feature) const
 
           /* 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))){
@@ -2123,22 +2155,22 @@ void LyXText::TableFeatures(int feature) const
           /* 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)){
@@ -2161,7 +2193,7 @@ void LyXText::TableFeatures(int feature) const
                
           /* set the cursor to the beginning of the table, where else? */ 
           cursor.pos(0);
-          RedoParagraph();
+          RedoParagraph(bview);
           return;
       }
       case LyXTable::TOGGLE_LINE_TOP:
@@ -2178,7 +2210,7 @@ void LyXText::TableFeatures(int feature) const
                   }
               }
           }
-          RedoParagraph();
+          RedoParagraph(bview);
           return;
     
       case LyXTable::TOGGLE_LINE_BOTTOM:
@@ -2195,7 +2227,7 @@ void LyXText::TableFeatures(int feature) const
                   }
               }
           }
-          RedoParagraph();
+          RedoParagraph(bview);
           return;
                
       case LyXTable::TOGGLE_LINE_LEFT:
@@ -2212,7 +2244,7 @@ void LyXText::TableFeatures(int feature) const
                   }
               }
           }
-          RedoParagraph();
+          RedoParagraph(bview);
           return;
 
       case LyXTable::TOGGLE_LINE_RIGHT:
@@ -2229,7 +2261,7 @@ void LyXText::TableFeatures(int feature) const
                   }
               }
           }
-          RedoParagraph();
+          RedoParagraph(bview);
           return;
     
       case LyXTable::ALIGN_LEFT:
@@ -2247,11 +2279,11 @@ void LyXText::TableFeatures(int feature) const
                   }
               }
           }
-          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
@@ -2260,7 +2292,7 @@ void LyXText::TableFeatures(int feature) const
           for (LyXParagraph::size_type i = 
                       cursor.par()->size() - 1; i >= 0; --i)
              cursor.par()->Erase(i);
-          RedoParagraph();
+          RedoParagraph(bview);
           return;
                
       case LyXTable::MULTICOLUMN: {
@@ -2279,7 +2311,7 @@ void LyXText::TableFeatures(int feature) const
                   ++pos;
              for (; newlines; --newlines)
                   cursor.par()->InsertChar(pos, LyXParagraph::META_NEWLINE);
-             RedoParagraph();
+             RedoParagraph(bview);
              return;
           }
           else {
@@ -2288,7 +2320,7 @@ void LyXText::TableFeatures(int feature) const
                   cursor.par()->table->SetMultiColumn(NumberOfCell(cursor.par(),
                                                                  cursor.pos()),
                                                     1);
-                  RedoParagraph();
+                  RedoParagraph(bview);
                   return;
              }
              else {
@@ -2317,7 +2349,7 @@ void LyXText::TableFeatures(int feature) const
                                                      sel_start_cursor.pos()),
                                         number);
                       cursor.pos(sel_start_cursor.pos());
-                      RedoParagraph();
+                      RedoParagraph(bview);
                       return;
                   }
                   else {
@@ -2346,7 +2378,7 @@ void LyXText::TableFeatures(int feature) const
                   }
               }
           }
-          RedoParagraph();
+          RedoParagraph(bview);
           return;
       case LyXTable::SET_LONGTABLE:
           cursor.par()->table->SetLongTable(true);
@@ -2423,7 +2455,7 @@ void LyXText::TableFeatures(int feature) const
 }
        
 
-void LyXText::InsertCharInTable(char c)
+void LyXText::InsertCharInTable(BufferView * bview, char c)
 {
        Row * row = 0;
        Row * tmprow = 0;
@@ -2446,8 +2478,8 @@ void LyXText::InsertCharInTable(char c)
        // 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)) {
@@ -2461,8 +2493,8 @@ void LyXText::InsertCharInTable(char c)
                        return;
        } else if (IsNewlineChar(c)) {
             if (!IsEmptyTableCell()) {
-                TableFeatures(LyXTable::APPEND_CONT_ROW);
-                CursorDown();
+                TableFeatures(bview, LyXTable::APPEND_CONT_ROW);
+                CursorDown(bview);
             }
          return;
        }
@@ -2472,7 +2504,7 @@ void LyXText::InsertCharInTable(char c)
        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 */
@@ -2485,7 +2517,7 @@ void LyXText::InsertCharInTable(char c)
 
        cursor.pos(cursor.pos() + 1);
 
-       CheckParagraphInTable(cursor.par(), cursor.pos());
+       CheckParagraphInTable(bview, cursor.par(), cursor.pos());
        
        current_font = rawtmpfont;
        real_current_font = realtmpfont;
@@ -2493,11 +2525,11 @@ void LyXText::InsertCharInTable(char c)
        /* 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)
 {
        
@@ -2510,24 +2542,24 @@ void LyXText::CheckParagraphInTable(LyXParagraph * par,
        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();
@@ -2540,11 +2572,12 @@ void LyXText::CheckParagraphInTable(LyXParagraph * par,
                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;
@@ -2554,21 +2587,21 @@ void LyXText::BackspaceInTable()
 
        // 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) {
@@ -2595,40 +2628,41 @@ void LyXText::BackspaceInTable()
                        }
                }
       
-               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);
 
@@ -2636,13 +2670,13 @@ void LyXText::InsertChar(char c)
        // 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;
        }
@@ -2668,8 +2702,8 @@ void LyXText::InsertChar(char c)
 
        // 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;
    
@@ -2683,15 +2717,15 @@ void LyXText::InsertChar(char c)
                             && 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;
                }
@@ -2701,7 +2735,8 @@ void LyXText::InsertChar(char c)
                
                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
        }
    
@@ -2717,7 +2752,7 @@ void LyXText::InsertChar(char c)
        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
@@ -2733,27 +2768,30 @@ void LyXText::InsertChar(char c)
             || 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())
@@ -2764,7 +2802,7 @@ void LyXText::InsertChar(char c)
                        // 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;
@@ -2775,25 +2813,26 @@ void LyXText::InsertChar(char c)
        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
@@ -2805,7 +2844,7 @@ void LyXText::InsertChar(char c)
                refresh_pos = cursor.pos();
                
                int tmpheight = row->height();
-               SetHeightOfRow(row);
+               SetHeightOfRow(bview, row);
                if (tmpheight == row->height())
                        status = LyXText::NEED_VERY_LITTLE_REFRESH;
                else
@@ -2813,19 +2852,20 @@ void LyXText::InsertChar(char c)
             
                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); 
                }
        }
 
@@ -2846,7 +2886,8 @@ void LyXText::charInserted()
        }
 }
 
-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,
@@ -2860,39 +2901,41 @@ void LyXText::PrepareToPrint(Row * row, float & x,
        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*/
@@ -2904,7 +2947,7 @@ void LyXText::PrepareToPrint(Row * row, float & x,
                // 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;
           
@@ -2916,7 +2959,7 @@ void LyXText::PrepareToPrint(Row * row, float & x,
 
           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
@@ -2938,19 +2981,20 @@ void LyXText::PrepareToPrint(Row * row, float & x,
        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;
                }
@@ -2964,7 +3008,7 @@ void LyXText::PrepareToPrint(Row * row, float & x,
 * 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;
@@ -2994,21 +3038,21 @@ void LyXText::CursorRightOneWord() const
                        ++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;
@@ -3023,7 +3067,7 @@ void LyXText::CursorTab() const
         }
     } 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());
@@ -3041,7 +3085,7 @@ void LyXText::CursorTab() const
                 }
             } else
                 tmpcursor.pos(tmpcursor.pos() + 1);
-            SetCursor(tmpcursor.par(), tmpcursor.pos());
+            SetCursor(bview, tmpcursor.par(), tmpcursor.pos());
             cell = NumberOfCell(cursor.par(), cursor.pos());
         }
     }
@@ -3052,7 +3096,7 @@ void LyXText::CursorTab() const
 /* -------> 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;
@@ -3079,19 +3123,19 @@ void LyXText::CursorLeftOneWord()  const
                       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;
@@ -3100,10 +3144,10 @@ void LyXText::SelectWord()
                        && !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);
 }
 
 
@@ -3111,7 +3155,7 @@ void LyXText::SelectWord()
                        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()
@@ -3119,7 +3163,7 @@ bool LyXText::SelectWordWhenUnderCursor()
            && !cursor.par()->IsKomma(cursor.pos())
            && !cursor.par()->IsSeparator(cursor.pos() -1)
            && !cursor.par()->IsKomma(cursor.pos() -1) ) {
-               SelectWord();
+               SelectWord(bview);
                return true;
        }
        return false;
@@ -3128,7 +3172,7 @@ bool LyXText::SelectWordWhenUnderCursor()
 
 // 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();
        
@@ -3143,9 +3187,9 @@ char * LyXText::SelectNextWord(float & value)
        // 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());
@@ -3156,7 +3200,7 @@ char * LyXText::SelectNextWord(float & value)
   
        // 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);
        }
 
@@ -3174,7 +3218,7 @@ char * LyXText::SelectNextWord(float & value)
               && (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
@@ -3203,10 +3247,10 @@ char * LyXText::SelectNextWord(float & value)
 
 
 // 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;
@@ -3222,7 +3266,7 @@ void LyXText::SelectSelectedWord()
               && (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
@@ -3234,75 +3278,75 @@ void LyXText::SelectSelectedWord()
 #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);
                }
        }
 }
@@ -3315,11 +3359,11 @@ void LyXText::DeleteLineForward()
 // 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());
@@ -3346,12 +3390,12 @@ void LyXText::ChangeWordCase(LyXText::TextCase action)
                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
 
@@ -3361,7 +3405,7 @@ void LyXText::Delete()
                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...
@@ -3378,21 +3422,21 @@ void LyXText::Delete()
        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 */
@@ -3404,7 +3448,7 @@ void LyXText::Backspace()
        
        // 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) {
@@ -3436,11 +3480,11 @@ void LyXText::Backspace()
                                        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();
@@ -3451,7 +3495,7 @@ void LyXText::Backspace()
                }
                
                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);
                }
@@ -3465,7 +3509,7 @@ void LyXText::Backspace()
                // 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);
                }
 
@@ -3492,7 +3536,7 @@ void LyXText::Backspace()
 
                        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(), ' ');
@@ -3515,23 +3559,25 @@ void LyXText::Backspace()
                        //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) {
@@ -3541,7 +3587,7 @@ void LyXText::Backspace()
                        // this is a cruel method but safe..... Matthias 
                        if (cursor.par()->GetInset(cursor.pos())->display()){
                                cursor.par()->Erase(cursor.pos());
-                               RedoParagraph();
+                               RedoParagraph(bview);
                                return;
                        }
                }
@@ -3553,7 +3599,9 @@ void LyXText::Backspace()
                 * 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
@@ -3592,7 +3640,8 @@ void LyXText::Backspace()
                        // 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;
@@ -3606,7 +3655,8 @@ void LyXText::Backspace()
                
                // 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);
                                
@@ -3618,7 +3668,7 @@ void LyXText::Backspace()
                                        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
@@ -3627,25 +3677,28 @@ void LyXText::Backspace()
                                
                                // 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() &&
@@ -3663,8 +3716,8 @@ void LyXText::Backspace()
                        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())
@@ -3673,16 +3726,16 @@ void LyXText::Backspace()
                                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());
                }
        }
 
@@ -3691,31 +3744,32 @@ void LyXText::Backspace()
 
        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;
@@ -3730,11 +3784,16 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                       << 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 */
@@ -3742,50 +3801,48 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                        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) {
@@ -3799,7 +3856,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
 #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);
@@ -3815,13 +3872,13 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                                                ++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);
@@ -3829,38 +3886,39 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                        } 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);
@@ -3870,8 +3928,8 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
 #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);
                }
@@ -3912,74 +3970,74 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                        }
                        
                        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() &&
@@ -3991,28 +4049,28 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                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
@@ -4036,16 +4094,16 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
 
                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);
                }
@@ -4053,34 +4111,33 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
 
        
        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,
@@ -4089,8 +4146,8 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                                          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,
@@ -4100,53 +4157,54 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                
                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? */ 
@@ -4154,34 +4212,34 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                    && (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);
@@ -4194,7 +4252,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
 
                                        /* draw it! */
                                        pain.text(int(tmpx),
-                                                 offset + row_ptr->baseline(),
+                                                 y_offset + row_ptr->baseline(),
                                                  tmpstring, font);
                                }
                        }
@@ -4203,14 +4261,15 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                           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
@@ -4218,14 +4277,14 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                                        
                                        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);
@@ -4233,28 +4292,27 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                        }
                }
                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 */ 
@@ -4263,9 +4321,9 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                        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,
@@ -4274,8 +4332,8 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                                          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,
@@ -4285,46 +4343,49 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                
                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);
@@ -4351,12 +4412,12 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                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:
@@ -4386,9 +4447,9 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                                     !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);
                                
@@ -4397,27 +4458,27 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                                    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);
                                
@@ -4432,19 +4493,20 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                                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 
@@ -4457,9 +4519,9 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                            !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);
@@ -4467,27 +4529,27 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                            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);
                }
@@ -4495,7 +4557,7 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                /* 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)))
@@ -4505,57 +4567,63 @@ void LyXText::GetVisibleRow(int offset, Row * row_ptr, long y)
                        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));
 }
 
 
@@ -4568,19 +4636,20 @@ int LyXText::DefaultHeight() const
    
 /* 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;
 
@@ -4607,7 +4676,7 @@ int LyXText::GetColumnNearX(Row * row, int & x, bool & boundary) const
                               } else
                                       break;
                       } else {
-                              tmpx += SingleWidth(row->par(), c);
+                              tmpx += SingleWidth(bview, row->par(), c);
                               ++vc;
                       }
                }
@@ -4619,7 +4688,8 @@ int LyXText::GetColumnNearX(Row * row, int & x, bool & boundary) const
        } 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 &&
@@ -4633,24 +4703,24 @@ int LyXText::GetColumnNearX(Row * row, int & x, bool & boundary) const
                        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;
                }
 
@@ -4681,16 +4751,16 @@ int LyXText::GetColumnNearX(Row * row, int & x, bool & boundary) const
                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;
        }
 
@@ -4702,7 +4772,8 @@ int LyXText::GetColumnNearX(Row * row, int & x, bool & boundary) const
    
 /* 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) {
@@ -4756,26 +4827,26 @@ void LyXText::InsertFootnoteEnvironment(LyXParagraph::footnote_kind kind)
    /* 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);
    }
@@ -4793,7 +4864,7 @@ void LyXText::InsertFootnoteEnvironment(LyXParagraph::footnote_kind kind)
       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();
    
@@ -4805,7 +4876,7 @@ void LyXText::InsertFootnoteEnvironment(LyXParagraph::footnote_kind kind)
               || 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) {
@@ -4815,7 +4886,7 @@ void LyXText::InsertFootnoteEnvironment(LyXParagraph::footnote_kind kind)
                           // 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) {
@@ -4835,9 +4906,9 @@ void LyXText::InsertFootnoteEnvironment(LyXParagraph::footnote_kind kind)
       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();
 }
index 0cbe81c4b4f77d4829542f3fbaae4bc7bd613a6c..c119a12ebf8efc9129a225b268cbd8ab7ec46e9c 100644 (file)
@@ -46,32 +46,46 @@ using std::copy;
 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;
@@ -103,6 +117,35 @@ LyXText::LyXText(BufferView * bv, int pw, Buffer * p)
 }
 
 
+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!
@@ -115,11 +158,13 @@ LyXText::~LyXText()
 }
 
 
+#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.
@@ -128,12 +173,11 @@ void LyXText::owner(BufferView * bv)
 // 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:
@@ -141,15 +185,13 @@ LyXFont LyXText::GetFont(LyXParagraph * par,
                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
@@ -166,14 +208,14 @@ LyXFont LyXText::GetFont(LyXParagraph * par,
 
        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.
@@ -189,13 +231,13 @@ LyXFont LyXText::GetFont(LyXParagraph * par,
                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.
@@ -208,7 +250,7 @@ LyXFont LyXText::GetFont(LyXParagraph * par,
 }
 
 
-void LyXText::SetCharFont(LyXParagraph * par,
+void LyXText::SetCharFont(Buffer const * buf, LyXParagraph * par,
                          LyXParagraph::size_type pos,
                          LyXFont const & fnt)
 {
@@ -220,13 +262,13 @@ void LyXText::SetCharFont(LyXParagraph * par,
        }
 
        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;
@@ -238,12 +280,12 @@ void LyXText::SetCharFont(LyXParagraph * par,
                        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) {
@@ -331,58 +373,59 @@ void LyXText::RemoveParagraph(Row * row) const
    
 
 // 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());
@@ -393,7 +436,7 @@ void LyXText::CloseFootnote()
       
                if (!par->next ||
                    par->next->footnoteflag != LyXParagraph::OPEN_FOOTNOTE) {
-                       owner_->owner()->getMiniBuffer()
+                       bview->owner()->getMiniBuffer()
                                ->Set(_("Nothing to do"));
                        return;
                }
@@ -406,7 +449,7 @@ void LyXText::CloseFootnote()
                        }
                
                // 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  {
@@ -418,7 +461,7 @@ void LyXText::CloseFootnote()
                        // 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
@@ -442,41 +485,41 @@ void LyXText::CloseFootnote()
                        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)
 {
@@ -492,7 +535,7 @@ LyXParagraph * LyXText::SetLayout(LyXCursor & cur, LyXCursor & sstart_cur,
                endpar = endpar->Next(); // because of parindents etc.
        }
    
-       SetUndo(Undo::EDIT,
+       SetUndo(bview->buffer(), Undo::EDIT,
                sstart_cur.par()->ParFromPos(sstart_cur.pos())->previous, 
                undoendpar);
 
@@ -501,12 +544,12 @@ LyXParagraph * LyXText::SetLayout(LyXCursor & cur, LyXCursor & sstart_cur,
        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);
@@ -523,8 +566,8 @@ LyXParagraph * LyXText::SetLayout(LyXCursor & cur, LyXCursor & sstart_cur,
                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);
@@ -542,7 +585,7 @@ LyXParagraph * LyXText::SetLayout(LyXCursor & cur, LyXCursor & sstart_cur,
 }
 
 // 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  */
@@ -577,7 +620,7 @@ void LyXText::SetLayout(LyXTextClass::size_type layout)
        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 ==
@@ -624,25 +667,28 @@ void LyXText::SetLayout(LyXTextClass::size_type layout)
                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) {
@@ -664,7 +710,7 @@ void  LyXText::IncDepth()
                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);
@@ -681,7 +727,7 @@ void  LyXText::IncDepth()
                // 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 =
@@ -689,7 +735,7 @@ void  LyXText::IncDepth()
                        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;
@@ -711,23 +757,24 @@ void  LyXText::IncDepth()
                        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
@@ -749,7 +796,7 @@ void  LyXText::DecDepth()
                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);
@@ -771,34 +818,36 @@ void  LyXText::DecDepth()
                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
@@ -814,7 +863,7 @@ void LyXText::SetFont(LyXFont const & font, bool toggleall)
        // 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;
@@ -827,11 +876,13 @@ void LyXText::SetFont(LyXFont const & font, bool toggleall)
                    == 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);
@@ -839,25 +890,26 @@ void LyXText::SetFont(LyXFont const & font, bool toggleall)
                }
        }
    
-       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())
@@ -865,28 +917,28 @@ void LyXText::RedoHeightOfParagraph(LyXCursor const & cur)
                       && 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())
@@ -905,14 +957,14 @@ void LyXText::RedoDrawingOfParagraph(LyXCursor const & cur)
                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;
@@ -969,7 +1021,7 @@ void LyXText::RedoParagraphs(LyXCursor const & cur,
 
        do {
                if (tmppar) {
-                       InsertParagraph(tmppar, tmprow);
+                       InsertParagraph(bview, tmppar, tmprow);
                        if (!tmprow)
                                tmprow = firstrow;
                        while (tmprow->next() && tmprow->next()->par() == tmppar)
@@ -981,22 +1033,22 @@ void LyXText::RedoParagraphs(LyXCursor const & cur,
        // 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;
        }
@@ -1012,7 +1064,7 @@ bool LyXText::FullRebreak()
  * 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;
@@ -1068,39 +1120,41 @@ void LyXText::SetSelection()
        // 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;
 }
@@ -1113,23 +1167,23 @@ void LyXText::ClearSelection() const
 }
 
 
-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) {
@@ -1137,14 +1191,14 @@ void LyXText::CursorEnd() const
                 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);
                         }
                 }
         }
@@ -1152,19 +1206,19 @@ void LyXText::CursorEnd() const
 }
 
 
-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());
 }
    
    
@@ -1186,14 +1240,14 @@ Row * LyXText::GetRowNearY(long & y) const
 }
 
 
-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;
        }
 
@@ -1202,26 +1256,26 @@ void LyXText::ToggleFree(LyXFont const & font, bool toggleall)
        // 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
@@ -1231,7 +1285,7 @@ LyXText::BeginningOfMainBody(LyXParagraph const * par) const
 
 /* 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;
    
@@ -1242,7 +1296,7 @@ void LyXText::MeltFootnoteEnvironment()
        if (cursor.par()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE)
                return;
    
-       SetUndo(Undo::FINISH, 
+       SetUndo(bview->buffer(), Undo::FINISH, 
                cursor.par()->PreviousBeforeFootnote()->previous,
                cursor.par()->NextAfterFootnote()->next);
 
@@ -1250,7 +1304,7 @@ void LyXText::MeltFootnoteEnvironment()
        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());
@@ -1268,11 +1322,11 @@ void LyXText::MeltFootnoteEnvironment()
                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
@@ -1289,7 +1343,7 @@ void LyXText::MeltFootnoteEnvironment()
                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
@@ -1306,19 +1360,19 @@ void LyXText::MeltFootnoteEnvironment()
                    && 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();
@@ -1331,7 +1385,8 @@ void LyXText::MeltFootnoteEnvironment()
 * 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,
@@ -1359,7 +1414,7 @@ void LyXText::SetParagraph(bool line_top, bool line_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);
@@ -1367,7 +1422,7 @@ void LyXText::SetParagraph(bool line_top, bool line_bottom,
        
        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();
@@ -1382,13 +1437,13 @@ void LyXText::SetParagraph(bool line_top, bool line_bottom,
                        // 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
@@ -1401,18 +1456,18 @@ void LyXText::SetParagraph(bool line_top, bool line_bottom,
                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,
@@ -1439,14 +1494,14 @@ void LyXText::SetParagraphExtraOpt(int type,
                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();
@@ -1454,11 +1509,11 @@ void LyXText::SetParagraphExtraOpt(int type,
                     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;
@@ -1467,13 +1522,13 @@ void LyXText::SetParagraphExtraOpt(int type,
                 }
                 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());
 }
 
 
@@ -1521,17 +1576,17 @@ static char const * romanCounter(int n)
 }
 
 // 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 */
@@ -1539,7 +1594,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
            && !(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)) {
@@ -1574,7 +1629,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
            && 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
@@ -1596,7 +1651,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
         */
        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
@@ -1640,7 +1695,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
        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
@@ -1706,13 +1761,13 @@ void LyXText::SetCounter(LyXParagraph * par) const
                        } 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));
@@ -1722,7 +1777,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
 
                                        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));
@@ -1733,7 +1788,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
 
                                        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));
@@ -1745,7 +1800,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
 
                                        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));
@@ -1758,7 +1813,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
 
                                        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));
@@ -1811,7 +1866,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
 #endif
                        switch (par->enumdepth) {
                        case 1:
-                               if (par->isRightToLeftPar(buffer()->params))
+                               if (par->isRightToLeftPar(buf->params))
                                        s << '('
                                          << hebrewCounter(number)
                                          << ')';
@@ -1821,13 +1876,13 @@ void LyXText::SetCounter(LyXParagraph * par) const
                                          << ')';
                                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
@@ -1835,7 +1890,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
                                          << '.';
                                break;
                        default:
-                               if (par->isRightToLeftPar(buffer()->params))
+                               if (par->isRightToLeftPar(buf->params))
                                        s << '.' << number;
                                else
                                        s << number << '.';
@@ -1874,21 +1929,21 @@ void LyXText::SetCounter(LyXParagraph * par) const
                        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: ";
                        }
                }
@@ -1904,7 +1959,7 @@ void LyXText::SetCounter(LyXParagraph * par) const
 
 /* 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) {
@@ -1924,20 +1979,20 @@ void LyXText::UpdateCounters(Row * row) const
                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() &&
@@ -1948,7 +2003,7 @@ void LyXText::UpdateCounters(Row * row) const
                                        while (row->par() != par)
                                                row = row->next();
                                        RemoveParagraph(row);
-                                       AppendParagraph(row);
+                                       AppendParagraph(bview, row);
                                }
                        }
                }
@@ -1960,16 +2015,16 @@ void LyXText::UpdateCounters(Row * row) const
 
 
 /* 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 */
 }
@@ -2001,13 +2056,13 @@ void LyXText::copyEnvironmentType()
 }
 
 
-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)
@@ -2059,7 +2114,7 @@ void LyXText::CutSelection(bool doclear)
                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);
@@ -2068,7 +2123,7 @@ void LyXText::CutSelection(bool doclear)
        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.
@@ -2207,7 +2262,7 @@ void LyXText::CutSelection(bool doclear)
 
 #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)
@@ -2259,7 +2314,7 @@ void LyXText::CutSelection(bool doclear)
        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;
@@ -2273,7 +2328,7 @@ void LyXText::CutSelection(bool doclear)
        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();
@@ -2281,7 +2336,7 @@ void LyXText::CutSelection(bool doclear)
        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);
@@ -2291,20 +2346,20 @@ void LyXText::CutSelection(bool doclear)
 
     // 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)
@@ -2348,7 +2403,7 @@ void LyXText::CopySelection()
        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()
@@ -2412,7 +2467,7 @@ void LyXText::CopySelection()
 
 #else //////////////////////////////////////////////////////////////////////
 
-void LyXText::CopySelection()
+void LyXText::CopySelection(Buffer const * buf)
 {
        // this doesnt make sense, if there is no selection
        if (!selection)
@@ -2463,12 +2518,12 @@ void LyXText::CopySelection()
 
        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)
@@ -2509,7 +2564,7 @@ void LyXText::PasteSelection()
        /* table stuff -- end */
 #endif
    
-       SetUndo(Undo::INSERT, 
+       SetUndo(bview->buffer(), Undo::INSERT, 
                cursor.par()->ParFromPos(cursor.pos())->previous, 
                cursor.par()->ParFromPos(cursor.pos())->next); 
 
@@ -2603,7 +2658,7 @@ void LyXText::PasteSelection()
      
                // 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
@@ -2680,42 +2735,40 @@ void LyXText::PasteSelection()
 
 #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();
 }
 
 
@@ -2738,19 +2791,19 @@ bool LyXText::IsStringInText(LyXParagraph * par,
 
 
 // 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
@@ -2760,7 +2813,7 @@ void LyXText::ReplaceSelectionWithString(char const * str)
 
        // 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
@@ -2771,7 +2824,7 @@ void LyXText::ReplaceSelectionWithString(char const * str)
        }
 
        // Cut the selection
-       CutSelection();
+       CutSelection(bview);
 
        UnFreezeUndo();
 }
@@ -2779,7 +2832,7 @@ void LyXText::ReplaceSelectionWithString(char const * str)
 
 // 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();
@@ -2792,7 +2845,7 @@ bool LyXText::SearchForward(char const * str) const
                }
        }
        if (par) {
-               SetCursor(par, pos);
+               SetCursor(bview, par, pos);
                return true;
        }
        else
@@ -2800,7 +2853,7 @@ bool LyXText::SearchForward(char const * str) const
 }
 
 
-bool LyXText::SearchBackward(char const * string) const
+bool LyXText::SearchBackward(BufferView * bview, char const * string) const
 {
        LyXParagraph * par = cursor.par();
        int pos = cursor.pos();
@@ -2819,7 +2872,7 @@ bool LyXText::SearchBackward(char const * string) const
        } while (par && !IsStringInText(par, pos, string));
   
        if (par) {
-               SetCursor(par, pos);
+               SetCursor(bview, par, pos);
                return true;
        } else
                return false;
@@ -2827,7 +2880,7 @@ bool LyXText::SearchBackward(char const * string) const
 
 
 // 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();
@@ -2835,10 +2888,10 @@ void LyXText::InsertStringA(string const & str)
         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();
@@ -2940,7 +2993,7 @@ void LyXText::InsertStringA(string const & str)
                                        }
                                         ++pos;
                                 }
-                                par->BreakParagraph(buffer()->params, pos, flag);
+                                par->BreakParagraph(bview->buffer()->params, pos, flag);
                                 par = par->Next();
                                 pos = 0;
 #ifndef NEW_TABULAR
@@ -2950,11 +3003,11 @@ void LyXText::InsertStringA(string const & str)
                ++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);
 }
 
 
@@ -2962,7 +3015,7 @@ void LyXText::InsertStringA(string const & str)
  * 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();
@@ -2990,11 +3043,11 @@ void LyXText::InsertStringB(string const & s)
                }
                ++i;
        }
-       InsertStringA(str);
+       InsertStringA(bview, str);
 }
 
 
-bool LyXText::GotoNextError() const
+bool LyXText::GotoNextError(BufferView * bview) const
 {
        LyXCursor res = cursor;
        do {
@@ -3010,14 +3063,14 @@ bool LyXText::GotoNextError() const
                   && 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 {
@@ -3033,14 +3086,14 @@ bool LyXText::GotoNextNote() const
                   && 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;                    
@@ -3049,7 +3102,7 @@ void LyXText::CheckParagraph(LyXParagraph * par,
        /* table stuff -- begin*/
    
        if (par->table) {
-               CheckParagraphInTable(par, pos);
+               CheckParagraphInTable(bview, par, pos);
        }
        else {
 #endif
@@ -3061,7 +3114,7 @@ void LyXText::CheckParagraph(LyXParagraph * par,
      
                // 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();
@@ -3069,11 +3122,11 @@ void LyXText::CheckParagraph(LyXParagraph * par,
                                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;
                        }
@@ -3084,14 +3137,14 @@ void LyXText::CheckParagraph(LyXParagraph * par,
                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);
@@ -3100,7 +3153,7 @@ void LyXText::CheckParagraph(LyXParagraph * par,
                        tmpcursor.x(0);
                        tmpcursor.x_fix(0);
                        tmpcursor.pos(pos);
-                       RedoDrawingOfParagraph(tmpcursor); 
+                       RedoDrawingOfParagraph(bview, tmpcursor); 
                }
 #ifndef NEW_TABULAR
        }
@@ -3111,27 +3164,30 @@ void LyXText::CheckParagraph(LyXParagraph * par,
    
        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;
        }
   
@@ -3143,7 +3199,7 @@ int LyXText::UpdateInset(Inset * inset)
                if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){
                        pos = par->GetPositionOfInset(inset);
                        if (pos != -1){
-                               CheckParagraph(par, pos);
+                               CheckParagraph(bview, par, pos);
                                return 1;
                        }
                }
@@ -3154,17 +3210,17 @@ int LyXText::UpdateInset(Inset * inset)
 }
 
 
-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
@@ -3208,7 +3264,8 @@ void LyXText::SetCursor(LyXCursor & cur, LyXParagraph * par,
        /* 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);
 
@@ -3220,7 +3277,7 @@ void LyXText::SetCursor(LyXCursor & cur, LyXParagraph * par,
        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 || 
@@ -3248,14 +3305,14 @@ void LyXText::SetCursor(LyXCursor & cur, LyXParagraph * par,
                                ++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)))
@@ -3267,25 +3324,25 @@ void LyXText::SetCursor(LyXCursor & cur, LyXParagraph * par,
                        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
        }
@@ -3297,11 +3354,11 @@ void LyXText::SetCursor(LyXCursor & cur, LyXParagraph * par,
 }
 
 
-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
@@ -3394,7 +3451,7 @@ void LyXText::SetCursorIntern(LyXParagraph * par,
                        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));
@@ -3424,10 +3481,10 @@ void LyXText::SetCursorIntern(LyXParagraph * par,
        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)
@@ -3447,12 +3504,12 @@ void LyXText::SetCurrentFont() const
                }
        }
 
-       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;
    
@@ -3462,24 +3519,25 @@ void LyXText::SetCursorFromCoordinates(int x, long y) const
        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);
@@ -3490,87 +3548,87 @@ void LyXText::SetCursorFromCoordinates(LyXCursor & cur, int x, long y) const
 }
 
 
-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 &&
@@ -3579,7 +3637,7 @@ void LyXText::CursorDown() const
                 return;
 #endif
        
-       SetCursorFromCoordinates(cursor.x_fix(), 
+       SetCursorFromCoordinates(bview, cursor.x_fix(), 
                                 cursor.y() - cursor.row()->baseline()
                                 + cursor.row()->height() + 1);
 #ifndef NEW_TABULAR
@@ -3589,7 +3647,7 @@ void LyXText::CursorDown() const
                 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) {
@@ -3602,34 +3660,35 @@ void LyXText::CursorDown() const
 }
 
 
-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;
 
@@ -3667,19 +3726,21 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
                    && 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;
 
@@ -3719,15 +3780,15 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
                                                        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();
@@ -3738,10 +3799,10 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
                                         * 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();
@@ -3754,7 +3815,7 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
                                                        endpar = endpar->LastPhysicalPar()->Next();
                                                }
                                        }
-                                       SetUndo(Undo::DELETE,
+                                       SetUndo(bview->buffer(), Undo::DELETE,
                                                old_cursor.par()->previous,
                                                endpar);
                                        cursor = tmpcursor;
@@ -3762,8 +3823,8 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
                                        // 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();
                                        
@@ -3774,14 +3835,14 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
                                           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()) {
@@ -3791,10 +3852,10 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
                        }
                }
                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;
                        }
                }
@@ -3812,39 +3873,39 @@ LyXParagraph * LyXText::GetParFromID(int id)
 
 
 // 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;
@@ -3861,7 +3922,7 @@ bool LyXText::TextHandleUndo(Undo * undo)
                // 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
 
@@ -3878,7 +3939,7 @@ bool LyXText::TextHandleUndo(Undo * undo)
                        if (before)
                                tmppar5 = before->next;
                        else
-                               tmppar5 = buffer()->paragraph;
+                               tmppar5 = OwnerParagraph();
                        tmppar2 = tmppar3;
                        while (tmppar5 && tmppar5 != behind){
                                tmppar = tmppar5;
@@ -3898,12 +3959,12 @@ bool LyXText::TextHandleUndo(Undo * undo)
                        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;
@@ -3914,7 +3975,7 @@ bool LyXText::TextHandleUndo(Undo * undo)
     
                // 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){
@@ -3949,10 +4010,10 @@ bool LyXText::TextHandleUndo(Undo * undo)
                        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;
@@ -3983,24 +4044,26 @@ void LyXText::UnFreezeUndo()
 }
 
 
-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;
@@ -4018,10 +4081,10 @@ Undo * LyXText::CreateUndo(Undo::undo_kind kind, LyXParagraph const * before,
        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;
                }
@@ -4092,9 +4155,9 @@ Undo * LyXText::CreateUndo(Undo::undo_kind kind, LyXParagraph const * before,
 }
 
 
-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); 
 }
@@ -4164,7 +4227,8 @@ bool LyXText::IsEmptyTableCell() const
 #endif
 
 
-void LyXText::toggleAppendix(){
+void LyXText::toggleAppendix(BufferView * bview)
+{
        LyXParagraph * par = cursor.par()->FirstPhysicalPar();
        bool start = !par->start_of_appendix;
 
@@ -4178,7 +4242,24 @@ void LyXText::toggleAppendix(){
        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;
+}
index 7fe6879dff1b617e8b590c5e138577b0362416ad..05b84f64a16b1b196fa23aeaf8ef24d17389128a 100644 (file)
@@ -289,13 +289,13 @@ void TransManager::insertVerbatim(string const & str, LyXText * text)
        
        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]);
        }
 }
 
@@ -314,7 +314,7 @@ void TransManager::insert(string const & str, LyXText * text)
                // 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);
                }