FILMagain changes (will need some work)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@807 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-06-12 11:27:15 +00:00
parent 2889b5fd3e
commit 6bba977f42
174 changed files with 14528 additions and 4070 deletions

421
ChangeLog
View File

@ -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

View 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

View 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@
/************************************************************

File diff suppressed because it is too large Load Diff

View File

@ -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"

2451
config/kde.m4 Normal file

File diff suppressed because it is too large Load Diff

View 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)
])

172
config/sigc++.m4 Normal file
View File

@ -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)
])

View 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

View File

@ -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

View 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);
@ -28,22 +26,16 @@
+ 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_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);

View 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

View File

@ -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

View File

@ -249,7 +249,7 @@ argument:
--------------------
class: FL_BEGIN_GROUP
type: 0
box: 0 10 10 0
box: 0 0 0 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
@ -687,7 +687,7 @@ argument: 2
--------------------
class: FL_BEGIN_GROUP
type: 0
box: 0 10 10 0
box: 0 0 0 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
@ -867,7 +867,7 @@ argument:
--------------------
class: FL_BEGIN_GROUP
type: 0
box: 0 10 10 0
box: 0 0 0 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
@ -975,7 +975,7 @@ argument:
--------------------
class: FL_BEGIN_GROUP
type: 0
box: 0 10 10 0
box: 0 0 0 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
@ -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

View 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

View File

@ -70,7 +70,7 @@ argument:
--------------------
class: FL_BEGIN_GROUP
type: 0
box: 0 10 10 0
box: 0 0 0 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
@ -358,7 +358,7 @@ argument:
--------------------
class: FL_BEGIN_GROUP
type: 0
box: 0 10 10 0
box: 0 0 0 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
@ -466,7 +466,7 @@ argument:
--------------------
class: FL_BEGIN_GROUP
type: 0
box: 0 10 10 0
box: 0 0 0 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER
@ -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 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 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 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 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 0
boxtype: FL_NO_BOX
colors: FL_COL1 FL_MCOL
alignment: FL_ALIGN_CENTER

View 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"
@ -23,4 +34,16 @@
+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_ */

View 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 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

View 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 $<

View 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);

View 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

View 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 ; }

View 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) %%%%%%%%%%%%%%%%%%%%%
@ -253,6 +253,6 @@
\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

View File

@ -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

1950
lib/doc/LyXConfig.lyx.in Normal file

File diff suppressed because it is too large Load Diff

View 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
@ -25,6 +24,11 @@
\layout Title
\begin_inset External Bitmap,"filename.txt","parameters"
\end_inset
THIS IS THE TITLE OF THE DOCUMENT
\layout Author

159
lib/external_templates Normal file
View File

@ -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

View 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

51
lib/scripts/fen2latex.py Normal file
View File

@ -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%"

View File

@ -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]

46
lib/scripts/pic2ascii.py Normal file
View File

@ -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")

View File

@ -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()

View File

@ -0,0 +1,3 @@
#!/bin/sh
convert $1 $2.eps
convert $1 $2.png

575
lib/tex/lyxchess.sty Normal file
View File

@ -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}

View 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

View 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));
}

View 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

View 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;
}

View File

@ -26,10 +26,12 @@
#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);
}

View 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;
///

View File

@ -16,6 +16,11 @@
#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;

View 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()
{
@ -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;
}

View 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
//@}

View File

@ -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 },

View File

@ -34,15 +34,14 @@
#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
//

View 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;

View 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 \

View 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)
{

View 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

View 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"));
}

168
src/PrinterParams.h Normal file
View File

@ -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

View 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
}

View 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

View File

@ -19,11 +19,11 @@
#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();

View 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;

View 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;
///

View 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;
}

View 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();

View 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());
}
}

View 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_

42
src/cite.C Normal file
View File

@ -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;
}
/*---------------------------------------*/

19
src/cite.h Normal file
View File

@ -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_ */

View 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 */
};

View 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"));
}
}

View File

@ -3,6 +3,5 @@
#define CREDITS_H
void ShowCredits();
void ShowCopyright();
#endif

View 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;
}
/*---------------------------------------*/

View 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_ */

View File

@ -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);

View 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);

View File

@ -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;
}
}
}

View File

@ -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

View 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 \

View 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,21 +1200,22 @@ 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);

View 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;

View 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);
}

View 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

View 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;
///
@ -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;
///

108
src/insets/insetbutton.C Normal file
View File

@ -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;
}

44
src/insets/insetbutton.h Normal file
View File

@ -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

View 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 );

View 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);
}

View 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;
///

View 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;
}

View 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;
///

View 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;
}

View 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

View 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;

View File

@ -30,7 +30,7 @@ class Painter;
class InsetERT : public InsetCollapsable {
public:
///
InsetERT(Buffer *);
InsetERT();
///
~InsetERT() {}
///

531
src/insets/insetexternal.C Normal file
View File

@ -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;
}

150
src/insets/insetexternal.h Normal file
View File

@ -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

View 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;
}

View 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;
///
};

View 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;
}

View 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;

View 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 << '}';

View 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;

View 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;
}

View 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;
///

View 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;

View 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;

Some files were not shown because too many files have changed in this diff Show More