read ChangeLog, a lot of whitespace changes. experimental use of libtool

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@329 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 1999-11-22 16:19:48 +00:00
parent 6f5a5fac30
commit 1d7d3cc4af
89 changed files with 9332 additions and 1983 deletions

View File

@ -6,4 +6,4 @@ Makefile.in
configure
aclocal.m4
lyx.1
libtool

View File

@ -1,3 +1,62 @@
1999-11-22 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/support/lyxstring.h: made the methods that take iterators
use const_iterator.
* src/support/lstrings.C (countChar): use std::cound(itr, itr, val)
(regexMatch): made is use the real regex class.
* src/support/Makefile.am: changed to use libtool
* src/support/.cvsignore: added *.lo, .libs and libsupport.la
* src/mathed/math_defs.h: made the mathaligns be in a enum instead
of defines.
(MathIsInset ++): changed several macros to be inline functions
instead.
* src/mathed/Makefile.am: changed to use libtool
* src/mathed/.cvsignore: added *.lo, .libs and libmathed.la
* src/insets/inset* : Clone changed to const and return type is
the true insettype not just Inset*.
* src/insets/Makefile.am: changed to use libtool
* src/insets/.cvsignore: added *.lo, .libs and libinsets.la
* src/undo.[Ch] : added empty() and changed some of the method
names.
* src/texrow.[Ch]: rewrote to store texrow's in a std::list.
* src/lyxparagraph.h: use id() and id(...) instead of getID and
setID use block<> for the bullets array, added const several places.
* src/lyxfunc.C (getStatus): new function
* src/lyxfunc.[Ch] : small changes to take advantage of the new
LyXAction, added const to several funtions.
* src/filedlg.[Ch]: rewrote to store userchache and groupchache in
a std::map, and to store the dir items in a vector.
* src/Makefile.am (lyx_DEPENDENCIES): changed to use libtool files
as dependencies.
* src/LyXView.[Ch] + other files : changed currentView to view.
* src/LyXAction.[Ch] : ported from the old devel branch.
* src/.cvsignore: added .libs and a.out
* configure.in : changes to use libtool.
* acinclude.m4 : inserted libtool.m4
* .cvsignore: added libtool
1999-11-19 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/Makefile.am (lyx_DEPENDENCIES): give the explicit object

View File

@ -822,3 +822,436 @@ dnl =========================================================
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
< $srcdir/po/POTFILES.in > po/POTFILES
])
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
## Copyright (C) 1996-1999 Free Software Foundation, Inc.
## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
## As a special exception to the GNU General Public License, if you
## distribute this file as part of a program that contains a
## configuration script generated by Autoconf, you may include it under
## the same distribution terms that you use for the rest of that program.
# serial 40 AC_PROG_LIBTOOL
AC_DEFUN(AC_PROG_LIBTOOL,
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
# Save cache, so that ltconfig can load it
AC_CACHE_SAVE
# Actually configure libtool. ac_aux_dir is where install-sh is found.
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|| AC_MSG_ERROR([libtool configure failed])
# Reload cache, that may have been modified by ltconfig
AC_CACHE_LOAD
# This can be used to rebuild libtool when needed
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl
# Redirect the config.log output again, so that the ltconfig log is not
# clobbered by the next message.
exec 5>>./config.log
])
AC_DEFUN(AC_LIBTOOL_SETUP,
[AC_PREREQ(2.13)dnl
AC_REQUIRE([AC_ENABLE_SHARED])dnl
AC_REQUIRE([AC_ENABLE_STATIC])dnl
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AC_REQUIRE([AC_PROG_RANLIB])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_LD])dnl
AC_REQUIRE([AC_PROG_NM])dnl
AC_REQUIRE([AC_PROG_LN_S])dnl
dnl
# Check for any special flags to pass to ltconfig.
#
# the following will cause an existing older ltconfig to fail, so
# we ignore this at the expense of the cache file... Checking this
# will just take longer ... bummer!
#libtool_flags="--cache-file=$cache_file"
#
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
[libtool_flags="$libtool_flags --enable-dlopen"])
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
[libtool_flags="$libtool_flags --enable-win32-dll"])
AC_ARG_ENABLE(libtool-lock,
[ --disable-libtool-lock avoid locking (might break parallel builds)])
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case "$host" in
*-*-irix6*)
# Find out which ABI we are using.
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
LD="${LD-ld} -32"
;;
*N32*)
LD="${LD-ld} -n32"
;;
*64-bit*)
LD="${LD-ld} -64"
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
CFLAGS="$SAVE_CFLAGS"
fi
;;
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
[*-*-cygwin* | *-*-mingw*)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
;;
])
esac
])
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
# AC_ENABLE_SHARED - implement the --enable-shared flag
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_SHARED, [dnl
define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(shared,
changequote(<<, >>)dnl
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
])
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_ENABLE_SHARED(no)])
# AC_ENABLE_STATIC - implement the --enable-static flag
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_STATIC, [dnl
define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(static,
changequote(<<, >>)dnl
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
])
# AC_DISABLE_STATIC - set the default static flag to --disable-static
AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_ENABLE_STATIC(no)])
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(fast-install,
changequote(<<, >>)dnl
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
])
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_ENABLE_FAST_INSTALL(no)])
# AC_PROG_LD - find the path to the GNU or non-GNU linker
AC_DEFUN(AC_PROG_LD,
[AC_ARG_WITH(gnu-ld,
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
ac_prog=ld
if test "$ac_cv_prog_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by GCC])
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
changequote(,)dnl
[\\/]* | [A-Za-z]:[\\/]*)
re_direlt='/[^/][^/]*/\.\./'
changequote([,])dnl
# Canonicalize the path of ld
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL(ac_cv_path_LD,
[if test -z "$LD"; then
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
ac_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" != no && break
else
test "$with_gnu_ld" != yes && break
fi
fi
done
IFS="$ac_save_ifs"
else
ac_cv_path_LD="$LD" # Let the user override the test with a path.
fi])
LD="$ac_cv_path_LD"
if test -n "$LD"; then
AC_MSG_RESULT($LD)
else
AC_MSG_RESULT(no)
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_SUBST(LD)
AC_PROG_LD_GNU
])
AC_DEFUN(AC_PROG_LD_GNU,
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
ac_cv_prog_gnu_ld=yes
else
ac_cv_prog_gnu_ld=no
fi])
])
# AC_PROG_NM - find the path to a BSD-compatible name lister
AC_DEFUN(AC_PROG_NM,
[AC_MSG_CHECKING([for BSD-compatible nm])
AC_CACHE_VAL(ac_cv_path_NM,
[if test -n "$NM"; then
# Let the user override the test.
ac_cv_path_NM="$NM"
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -B"
break
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -p"
break
else
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
fi
fi
done
IFS="$ac_save_ifs"
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
fi])
NM="$ac_cv_path_NM"
AC_MSG_RESULT([$NM])
AC_SUBST(NM)
])
# AC_CHECK_LIBM - check for math library
AC_DEFUN(AC_CHECK_LIBM,
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
LIBM=
case "$host" in
*-*-beos* | *-*-cygwin*)
# These system don't have libm
;;
*-ncr-sysv4.3*)
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
;;
*)
AC_CHECK_LIB(m, main, LIBM="-lm")
;;
esac
])
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl convenience library, adds --enable-ltdl-convenience to
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
# '${top_builddir}/' (note the single quotes!) if your package is not
# flat, and, if you're not using automake, define top_builddir as
# appropriate in the Makefiles.
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
case "$enable_ltdl_convenience" in
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
"") enable_ltdl_convenience=yes
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
esac
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
])
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl installable library, and adds --enable-ltdl-install to
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
# '${top_builddir}/' (note the single quotes!) if your package is not
# flat, and, if you're not using automake, define top_builddir as
# appropriate in the Makefiles.
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_CHECK_LIB(ltdl, main,
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
[if test x"$enable_ltdl_install" = xno; then
AC_MSG_WARN([libltdl not installed, but installation disabled])
else
enable_ltdl_install=yes
fi
])
if test x"$enable_ltdl_install" = x"yes"; then
ac_configure_args="$ac_configure_args --enable-ltdl-install"
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
else
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
LIBLTDL="-lltdl"
INCLTDL=
fi
])
dnl old names
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
dnl This is just to silence aclocal about the macro not being used
ifelse([AC_DISABLE_FAST_INSTALL])dnl

3017
config/ltconfig Executable file

File diff suppressed because it is too large Load Diff

3975
config/ltmain.sh Normal file

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,7 @@ done
### Check for programs
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_RANLIB
#AC_PROG_RANLIB
AC_CHECK_PROG(KPSEWHICH, kpsewhich, kpsewhich, :)
if test "x$KPSEWHICH" = xkpsewhich ; then
AC_DEFINE(HAVE_KPSEWHICH, 1,
@ -56,6 +56,9 @@ AC_EXEEXT
AC_LANG_CPLUSPLUS
LYX_PROG_CXX
AC_PROG_CXXCPP
AC_DISABLE_SHARED
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
### check the size of pointers and ints
# the defaults are given for cross compilation.

View File

@ -5,4 +5,5 @@ Makefile.in
config.h.in
stamp-h
*.deps
.libs
a.out

View File

@ -18,7 +18,8 @@
#include FORMS_H_LOCATION
#include "lyxfont.h"
class LString;
#include "LString.h"
class FontInfo;
/** This class takes care of loading fonts. It uses FontInfo to make

File diff suppressed because it is too large Load Diff

View File

@ -6,77 +6,113 @@
#pragma interface
#endif
#include <map>
#include "commandtags.h"
class LString;
/// Command name - action
struct kb_func_table {
///
char const * name;
///
kb_action action;
};
#include "LString.h"
/** This class encapsulates LyX action and user command operations.
*/
class LyXAction {
private:
///
struct func_info {
string name;
unsigned int attrib;
string helpText;
};
///
struct pseudo_func {
kb_action action;
string arg;
};
public:
///
LyXAction();
typedef map<string, kb_action, less<string> > func_map;
///
~LyXAction();
typedef map<kb_action, func_info, less<kb_action> > info_map;
///
typedef map<unsigned int, pseudo_func, less<unsigned int> > pseudo_map;
///
typedef map<string, unsigned int, less<string> > arg_item;
///
typedef map<kb_action, arg_item, less<kb_action> > arg_map;
///
enum func_attrib {
/// nothing special about this func
Noop = 0,
/// can not be used in RO mode (perhaps this should change)
ReadOnly = 1, // ,
/// Can be used when there is no document open
NoBuffer = 2,
//Interactive = 2, // Is interactive (requires a GUI)
Argument=4 // Requires argument
//MathOnly = 8, // Only math mode
//EtcEtc = ... // Or other attributes...
};
///
LyXAction();
/** Returns an action tag from a string. Returns kb_action.
Include arguments in func_name ONLY if you
want to create new pseudo actions. */
int LookupFunc(char const * func_name);
int LookupFunc(string const & func_name) const;
/** Returns an action tag which name is the most similar to a string.
Don't include arguments, they would be ignored. */
int getApproxFunc(char const * func);
int getApproxFunc(string const & func) const;
/** Returns an action name the most similar to a string.
Don't include arguments, they would be ignored. */
char const * getApproxFuncName(char const * func);
string getApproxFuncName(string const & func) const;
/// Returns a pseudo-action given an action and its argument.
int getPseudoAction(kb_action action, char const * arg);
int getPseudoAction(kb_action action, string const & arg) const;
/// Retrieves the real action and its argument.
int retrieveActionArg(int i, char const ** arg);
kb_action retrieveActionArg(int i, string & arg) const;
/// Search for an existent pseudoaction, return -1 if it doesn't exist.
int searchActionArg(kb_action action, char const * arg);
int searchActionArg(kb_action action, string const & arg) const;
/// Check if a value is a pseudo-action.
bool isPseudoAction(int);
bool isPseudoAction(int) const;
/// Not sure if this function should be here
int bindKey(char const * seq, int action);
/// Return the name associated with command
char const * getActionName(int action) const;
string getActionName(int action) const;
/// Return one line help text associated with command
char const * helpText(kb_action action) const;
/// Return one line help text associated with (pseudo)action
string helpText(int action) const;
/// True if the command is Read Only (not allowed for RO buffers)
bool isFuncRO(kb_action action) const;
/// True if the command has `flag' set
bool funcHasFlag(kb_action action, func_attrib flag) const;
private:
/// Standard commands
static kb_func_table const * lyx_func_table;
/// Number of commands
int funcCount;
/// Pseudoactions
static kb_func_table * lyx_func_args;
/// Pseudoaction index
static int psd_idx;
/// Last action index found
int last_action_idx;
///
void init();
///
void newFunc(kb_action, string const & name,
string const & helpText, unsigned int attrib);
/** This is a list of all the LyXFunc names with the
coresponding action number. It is usually only used by the
minibuffer or when assigning commands to keys during init. */
func_map lyx_func_map;
/** This is a mapping from action number to an object holding
info about this action. f.ex. helptext, command name (string),
command attributes (ro) */
info_map lyx_info_map;
/** A mapping from the automatically created pseudo action number
to the real action and its argument. */
mutable pseudo_map lyx_pseudo_map;
/** A (multi) mapping from the lyx action to all the generated
pseudofuncs and the arguments the action should use. */
mutable arg_map lyx_arg_map;
};
@ -84,9 +120,9 @@ private:
inline
bool LyXAction::isPseudoAction(int a)
bool LyXAction::isPseudoAction(int a) const
{
return (a >= int(LFUN_LASTACTION));
return a > int(LFUN_LASTACTION);
}

View File

@ -80,12 +80,12 @@ void LyXView::redraw() {
void LyXView::UpdateTimerCB(FL_OBJECT * ob, long)
{
LyXView * view = static_cast<LyXView*>(ob->u_vdata);
if (!view->currentView()->available())
if (!view->view()->available())
return;
if (!view->currentView()->getScreen() || !updatetimer)
if (!view->view()->getScreen() || !updatetimer)
return;
view->currentView()->getScreen()->HideCursor();
view->view()->getScreen()->HideCursor();
view->buffer()->update(-2);
/* This update can happen, even when the work area has lost
* the focus. So suppress the cursor in that case */
@ -363,7 +363,7 @@ void LyXView::updateWindowTitle() {
static string last_title = "LyX";
string title = "LyX";
if (currentView()->available()) {
if (view()->available()) {
string cur_title = buffer()->getFileName();
if (!cur_title.empty()){
title += ": " + OnlyFilename(cur_title);

View File

@ -73,7 +73,7 @@ public:
Buffer * buffer() const { return bufferview->buffer(); }
///
BufferView * currentView() { return bufferview; }
BufferView * view() { return bufferview; }
/// returns a pointer to the form.
FL_FORM * getForm() { return _form; }

View File

@ -3,7 +3,7 @@ SUBDIRS = mathed insets support
DISTCLEANFILES = libintl.h config.h
MAINTAINERCLEANFILES = Makefile.in config.h.in
bin_PROGRAMS = lyx
lyx_DEPENDENCIES = mathed/mathed.o insets/insets.o support/libsupport.a
lyx_DEPENDENCIES = mathed/libmathed.la insets/libinsets.la support/libsupport.la
lyx_LDADD = $(lyx_DEPENDENCIES) @INTLLIBS@ $(LYX_LIBS)
EXTRA_DIST = config.h.in stamp-h.in cheaders
ETAGS_ARGS = --c++

View File

@ -1201,14 +1201,8 @@ bool Buffer::writeFile(string const & filename, bool flag)
string userName(getUserName()) ;
// write out a comment in the top of the file
// We do not print this anymore, since it annoys cvs and is useless
// anyway. It could even be seen as including private
// information without telling the user :) -- JMarc
// fprintf(file,
// "#This file was created by <%s> %s",
// userName.c_str(),(char*)date());
fprintf(file,
"#LyX 1.1 (C) 1995-1999 Matthias Ettrich"
"#LyX 1.1 Copyright 1995-1999 Matthias Ettrich"
" and the LyX Team\n");
// at the very beginning the used lyx format
@ -3469,7 +3463,7 @@ void Buffer::insertErrors(TeXErrors & terr)
if (texrowpar == 0)
continue;
InsetError *new_inset = new InsetError(msgtxt);
InsetError * new_inset = new InsetError(msgtxt);
text->SetCursorIntern(texrowpar, tmppos);
text->InsertInset(new_inset);

View File

@ -246,4 +246,3 @@ enum kb_action {
ostream & operator<<(ostream &, kb_action);
#endif

View File

@ -1,36 +0,0 @@
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "error.h"
#include <cstdio>
Error::Error(int level) // should loglevel also be an argument?
{
debuglevel = level;
loglevel = 0;
}
void Error::setDebugLevel(int level)
{
debuglevel = level;
}
void Error::debug(string const & msg, int level)
{
if (debuglevel & level)
print(msg);
// should also print to the logfile
}
void Error::print(string const & msg)
{
if (!msg.empty())
fprintf(stderr, "%s\n", msg.c_str());
}

View File

@ -1,79 +0,0 @@
// -*- C++ -*-
#ifndef _ERROR_H_
#define _ERROR_H_
#ifdef __GNUG__
#pragma interface
#endif
#include "LString.h"
///
class Error
{
public:
///
enum DEBUG_LEVELS {
///
INFO = (1), // 1
///
INIT = (1 << 1), // 2
///
KEY = (1 << 2), // 4
///
TOOLBAR = (1 << 3), // 8
///
LEX_PARSER = (1 << 4), // 16
///
LYXRC = (1 << 5), // 32
///
KBMAP = (1 << 6), // 64
///
LATEX = (1 << 7), // 128
///
MATHED = (1 << 8), // 256 // Alejandro, please use this.
///
FONT = (1 << 9), // 512
///
TCLASS = (1 << 10), // 1024
///
LYXVC = (1 << 11), // 2048
///
ROFF = (1 << 12), // 4096
///
LYXSERVER = (1 << 13), // 8192
///
ALL = (65535), // 2^16-1
///
ANY = ALL
};
///
Error(int level = 0);
///
void setDebugLevel(int level);
/// Not implemented yet.
void setLogLevel(int level);
/// Not implemented yet.
void setLogFile(string const & filename);
///
void debug(string const & msg, int level = INFO); // or ANY?
///
bool debugging(int level = INFO) // or ANY?
{
return (bool)(debuglevel & level);
}
///
void print(string const & msg);
protected:
private:
///
int debuglevel;
///
int loglevel;
};
/// The global instance of the Error class.
extern Error lyxerr;
#endif

View File

@ -17,6 +17,10 @@
#include <pwd.h>
#include <grp.h>
#include <cstring>
#include <map>
#include <algorithm>
using std::map;
using std::sort;
#include "lyx_gui_misc.h" // CancelCloseCB
#include "support/FileInfo.h"
@ -66,147 +70,101 @@ extern "C" int gettimeofday(struct timeval *, struct timezone *);
#include "support/filetools.h"
#include "filedlg.h"
static const long SIX_MONTH_SEC = 6L * 30L * 24L * 60L * 60L; // six months, in seconds
// six months, in seconds
static const long SIX_MONTH_SEC = 6L * 30L * 24L * 60L * 60L;
static const long ONE_HOUR_SEC = 60L * 60L;
// *** User cache class implementation
/// User cache class definition
class UserCache {
public:
/// seeks user name from group ID
string const & find(uid_t ID) const {
Users::const_iterator cit = users.find(ID);
if (cit == users.end()) {
add(ID);
return users[ID];
}
return (*cit).second;
}
private:
///
void add(uid_t ID) const {
string pszNewName;
struct passwd * pEntry;
// gets user name
if ((pEntry = getpwuid(ID)))
pszNewName = pEntry->pw_name;
else {
pszNewName = tostr(ID);
}
// adds new node
users[ID] = pszNewName;
}
///
typedef map<uid_t, string> Users;
///
mutable Users users;
};
// global instance (user cache root)
UserCache lyxUserCache = UserCache(string(), 0, 0);
/// Group cache class definition
class GroupCache {
public:
/// seeks group name from group ID
string const & find(gid_t ID) const {
Groups::const_iterator cit = groups.find(ID);
if (cit == groups.end()) {
add(ID);
return groups[ID];
}
return (*cit).second;
}
private:
///
void add(gid_t ID) const {
string pszNewName;
struct group * pEntry;
// gets user name
if ((pEntry = getgrgid(ID))) pszNewName = pEntry->gr_name;
else {
pszNewName = tostr(ID);
}
// adds new node
groups[ID] = pszNewName;
}
///
typedef map<gid_t, string> Groups;
///
mutable Groups groups;
};
// static instances
static UserCache lyxUserCache;
static GroupCache lyxGroupCache;
// some "C" wrappers around callbacks
extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT *, long lArgument);
extern "C" void C_LyXFileDlg_DoubleClickCB(FL_OBJECT *, long);
extern "C" int C_LyXFileDlg_CancelCB(FL_FORM *, void *);
extern "C" int C_LyXDirEntryC_ldeCompProc(const void * r1,
const void * r2);
// Add: creates a new user entry
UserCache * UserCache::Add(uid_t ID)
{
string pszNewName;
struct passwd * pEntry;
// gets user name
if ((pEntry = getpwuid(ID)))
pszNewName = pEntry->pw_name;
else {
pszNewName = tostr(ID);
// compares two LyXDirEntry objects content (used for sort)
class comp_direntry {
public:
int operator()(LyXDirEntry const & r1,
LyXDirEntry const & r2) const {
bool r1d = suffixIs(r1.pszName, '/');
bool r2d = suffixIs(r2.pszName, '/');
if (r1d && !r2d) return 1;
if (!r1d && r2d) return 0;
return r1.pszName < r2.pszName;
}
};
// adds new node
return new UserCache(pszNewName, ID, pRoot);
}
UserCache::UserCache(string const & pszName, uid_t ID, UserCache * pRoot)
{
// links node
if (pRoot) {
this->pRoot = pRoot;
pNext = pRoot->pNext;
pRoot->pNext = this;
} else {
this->pRoot = this;
pNext = 0;
}
// stores data
this->pszName = pszName;
this->ID = ID;
}
UserCache::~UserCache()
{
if (pNext) delete pNext;
}
// Find: seeks user name from user ID
string UserCache::Find(uid_t ID)
{
if ((!pszName.empty()) && (this->ID == ID)) return pszName;
if (pNext) return pNext->Find(ID);
return pRoot->Add(ID)->pszName;
}
// *** Group cache class implementation
// global instance (group cache root)
GroupCache lyxGroupCache = GroupCache(string(), 0, 0);
// Add: creates a new group entry
GroupCache * GroupCache::Add(gid_t ID)
{
string pszNewName;
struct group * pEntry;
// gets user name
if ((pEntry = getgrgid(ID))) pszNewName = pEntry->gr_name;
else {
pszNewName = tostr(ID);
}
// adds new node
return new GroupCache(pszNewName, ID, pRoot);
}
GroupCache::GroupCache(string const & pszName, gid_t ID, GroupCache * pRoot)
{
// links node
if (pRoot) {
this->pRoot = pRoot;
pNext = pRoot->pNext;
pRoot->pNext = this;
} else {
this->pRoot = this;
pNext = 0;
}
// stores data
this->pszName = pszName;
this->ID = ID;
}
GroupCache::~GroupCache()
{
if (pNext) delete pNext;
}
// Find: seeks group name from group ID
string GroupCache::Find(gid_t ID)
{
if ((!pszName.empty()) && (this->ID == ID)) return pszName;
if (pNext) return pNext->Find(ID);
return pRoot->Add(ID)->pszName;
}
// *** LyXDirEntry internal structure implementation
// ldeCompProc: compares two LyXDirEntry objects content (used for qsort)
int LyXDirEntry::ldeCompProc(const LyXDirEntry * r1,
const LyXDirEntry * r2)
{
bool r1d = suffixIs(r1->pszName, '/');
bool r2d = suffixIs(r2->pszName, '/');
if (r1d && !r2d) return -1;
if (!r1d && r2d) return 1;
return r1->pszName.compare(r2->pszName);
}
extern "C" int C_LyXDirEntry_ldeCompProc(const void * r1,
const void * r2)
{
return LyXDirEntry::ldeCompProc((const LyXDirEntry *)r1,
(const LyXDirEntry *)r2);
}
// *** LyXFileDlg class implementation
@ -218,17 +176,8 @@ LyXFileDlg * LyXFileDlg::pCurrentDlg = 0;
// Reread: updates dialog list to match class directory
void LyXFileDlg::Reread()
{
int i;
DIR * pDirectory;
struct dirent * pDirEntry;
string File;
string Buffer;
string Time;
char szMode[15];
FileInfo fileInfo;
// Opens directory
pDirectory = opendir(pszDirectory.c_str());
DIR * pDirectory = opendir(pszDirectory.c_str());
if (!pDirectory) {
WriteFSAlert(_("Warning! Couldn't open directory."),
pszDirectory);
@ -237,10 +186,7 @@ void LyXFileDlg::Reread()
}
// Clear the present namelist
if (pCurrentNames) {
delete [] pCurrentNames;
pCurrentNames = 0;
}
direntries.clear();
// Updates display
fl_hide_object(pFileDlgForm->List);
@ -250,7 +196,9 @@ void LyXFileDlg::Reread()
// Splits complete directory name into directories and compute depth
iDepth = 0;
string line, Temp;
File = pszDirectory;
char szMode[15];
FileInfo fileInfo;
string File = pszDirectory;
if (File != "/") {
File = split(File, Temp, '/');
}
@ -262,18 +210,11 @@ void LyXFileDlg::Reread()
++iDepth;
}
// Allocate names array
iNumNames = 0;
rewinddir(pDirectory);
while ((readdir(pDirectory))) ++iNumNames;
pCurrentNames = new LyXDirEntry[iNumNames];
// Parses all entries of the given subdirectory
iNumNames = 0;
time_t curTime = time(0);
rewinddir(pDirectory);
struct dirent * pDirEntry;
while ((pDirEntry = readdir(pDirectory))) {
bool isLink = false, isDir = false;
// If the pattern doesn't start with a dot, skip hidden files
@ -294,11 +235,11 @@ void LyXFileDlg::Reread()
fileInfo.newFile(File, true);
fileInfo.modeString(szMode);
unsigned int nlink = fileInfo.getNumberOfLinks();
string user = lyxUserCache.Find(fileInfo.getUid());
string group = lyxGroupCache.Find(fileInfo.getGid());
string user = lyxUserCache.find(fileInfo.getUid());
string group = lyxGroupCache.find(fileInfo.getGid());
time_t modtime = fileInfo.getModificationTime();
Time = ctime(&modtime);
string Time = ctime(&modtime);
if (curTime > fileInfo.getModificationTime() + SIX_MONTH_SEC
|| curTime < fileInfo.getModificationTime()
@ -314,7 +255,7 @@ void LyXFileDlg::Reread()
Time.erase(16, string::npos);
}
Buffer = string(szMode) + ' ' +
string Buffer = string(szMode) + ' ' +
tostr(nlink) + ' ' +
user + ' ' +
group + ' ' +
@ -324,21 +265,21 @@ void LyXFileDlg::Reread()
Buffer += fileInfo.typeIndicator();
if ((isLink = fileInfo.isLink())) {
string Link;
string Link;
if (LyXReadLink(File, Link)) {
Buffer += " -> ";
Buffer += Link;
if (LyXReadLink(File, Link)) {
Buffer += " -> ";
Buffer += Link;
// This gives the FileType of the file that
// is really pointed too after resolving all
// symlinks. This is not necessarily the same
// as the type of Link (which could again be a
// link). Is that intended?
// JV 199902
fileInfo.newFile(File);
Buffer += fileInfo.typeIndicator();
}
// This gives the FileType of the file that
// is really pointed too after resolving all
// symlinks. This is not necessarily the same
// as the type of Link (which could again be a
// link). Is that intended?
// JV 199902
fileInfo.newFile(File);
Buffer += fileInfo.typeIndicator();
}
}
// filters files according to pattern and type
@ -351,33 +292,35 @@ void LyXFileDlg::Reread()
} else if (!(isDir = fileInfo.isDir()))
continue;
// Note pszLsEntry is an string!
pCurrentNames[iNumNames].pszLsEntry = Buffer;
LyXDirEntry tmp;
// Note pszLsEntry is an string!
tmp.pszLsEntry = Buffer;
// creates used name
string temp = fname;
if (isDir) temp += '/';
pCurrentNames[iNumNames].pszName = temp;
tmp.pszName = temp;
// creates displayed name
temp = pDirEntry->d_name;
if (isLink)
temp += '@';
else
temp += fileInfo.typeIndicator();
pCurrentNames[iNumNames++].pszDisplayed = temp;
tmp.pszDisplayed = temp;
direntries.push_back(tmp);
}
closedir(pDirectory);
// Sort the names
qsort(pCurrentNames, iNumNames, sizeof(LyXDirEntry),
C_LyXDirEntry_ldeCompProc);
sort(direntries.begin(), direntries.end(), comp_direntry());
// Add them to directory box
for (i = 0; i < iNumNames; ++i) {
string temp = line + pCurrentNames[i].pszDisplayed;
for (DirEntries::const_iterator cit = direntries.begin();
cit != direntries.end(); ++cit) {
string temp = line + (*cit).pszDisplayed;
fl_add_browser_line(pFileDlgForm->List, temp.c_str());
}
fl_set_browser_topline(pFileDlgForm->List, iDepth);
@ -415,7 +358,6 @@ void LyXFileDlg::SetInfoLine(string const & Line)
LyXFileDlg::LyXFileDlg()
{
pCurrentNames = 0;
pszDirectory = MakeAbsPath(string("."));
pszMask = '*';
@ -445,28 +387,20 @@ LyXFileDlg::LyXFileDlg()
C_LyXFileDlg_CancelCB, 0);
// Register doubleclick callback
fl_set_browser_dblclick_callback(pFileDlgForm->List,
C_LyXFileDlg_DoubleClickCB, 0);
C_LyXFileDlg_DoubleClickCB,
0);
}
fl_hide_object(pFileDlgForm->User1);
fl_hide_object(pFileDlgForm->User2);
}
LyXFileDlg::~LyXFileDlg()
{
// frees directory entries
if (pCurrentNames) {
delete [] pCurrentNames;
}
}
// SetButton: sets file selector user button action
void LyXFileDlg::SetButton(int iIndex, string const & pszName,
string const & pszPath)
{
FL_OBJECT *pObject;
string *pTemp;
FL_OBJECT * pObject;
string * pTemp;
if (iIndex == 0) {
pObject = pFileDlgForm->User1;
@ -488,7 +422,7 @@ void LyXFileDlg::SetButton(int iIndex, string const & pszName,
// GetDirectory: gets last dialog directory
string LyXFileDlg::GetDirectory()
string LyXFileDlg::GetDirectory() const
{
if (!pszDirectory.empty())
return pszDirectory;
@ -556,7 +490,8 @@ void LyXFileDlg::FileDlgCB(FL_OBJECT *, long lArgument)
case 12: // user button 1
if (!pCurrentDlg->pszUserPath1.empty()) {
pCurrentDlg->SetDirectory(pCurrentDlg->pszUserPath1);
pCurrentDlg->SetMask(fl_get_input(pFileDlgForm->PatBox));
pCurrentDlg->SetMask(fl_get_input(pFileDlgForm
->PatBox));
pCurrentDlg->Reread();
}
break;
@ -564,7 +499,8 @@ void LyXFileDlg::FileDlgCB(FL_OBJECT *, long lArgument)
case 13: // user button 2
if (!pCurrentDlg->pszUserPath2.empty()) {
pCurrentDlg->SetDirectory(pCurrentDlg->pszUserPath2);
pCurrentDlg->SetMask(fl_get_input(pFileDlgForm->PatBox));
pCurrentDlg->SetMask(fl_get_input(pFileDlgForm
->PatBox));
pCurrentDlg->Reread();
}
break;
@ -572,7 +508,7 @@ void LyXFileDlg::FileDlgCB(FL_OBJECT *, long lArgument)
}
}
extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT *ob, long data)
extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data)
{
LyXFileDlg::FileDlgCB(ob, data);
}
@ -584,7 +520,7 @@ void LyXFileDlg::HandleListHit()
// set info line
int iSelect = fl_get_browser(pFileDlgForm->List);
if (iSelect > iDepth) {
SetInfoLine(pCurrentNames[iSelect - iDepth - 1].pszLsEntry);
SetInfoLine(direntries[iSelect - iDepth - 1].pszLsEntry);
} else {
SetInfoLine(string());
}
@ -599,7 +535,7 @@ void LyXFileDlg::DoubleClickCB(FL_OBJECT *, long)
pCurrentDlg->Force(false);
}
extern "C" void C_LyXFileDlg_DoubleClickCB(FL_OBJECT *ob, long data)
extern "C" void C_LyXFileDlg_DoubleClickCB(FL_OBJECT * ob, long data)
{
LyXFileDlg::DoubleClickCB(ob, data);
}
@ -607,16 +543,14 @@ extern "C" void C_LyXFileDlg_DoubleClickCB(FL_OBJECT *ob, long data)
// Handle double click from list
bool LyXFileDlg::HandleDoubleClick()
{
bool isDir;
string pszTemp;
int iSelect;
// set info line
isDir = true;
iSelect = fl_get_browser(pFileDlgForm->List);
bool isDir = true;
int iSelect = fl_get_browser(pFileDlgForm->List);
if (iSelect > iDepth) {
pszTemp = pCurrentNames[iSelect - iDepth - 1].pszName;
SetInfoLine(pCurrentNames[iSelect - iDepth - 1].pszLsEntry);
pszTemp = direntries[iSelect - iDepth - 1].pszName;
SetInfoLine(direntries[iSelect - iDepth - 1].pszLsEntry);
if (!suffixIs(pszTemp, '/')) {
isDir = false;
fl_set_input(pFileDlgForm->Filename, pszTemp.c_str());
@ -628,8 +562,6 @@ bool LyXFileDlg::HandleDoubleClick()
// executes action
if (isDir) {
int i;
string Temp;
// builds new directory name
@ -643,7 +575,7 @@ bool LyXFileDlg::HandleDoubleClick()
} else {
// Directory higher up
Temp.clear();
for (i = 0; i < iSelect; ++i) {
for (int i = 0; i < iSelect; ++i) {
string piece = fl_get_browser_line(pFileDlgForm->List, i+1);
// The '+2' is here to count the '@b' (JMarc)
Temp += piece.substr(i + 2);
@ -662,10 +594,8 @@ bool LyXFileDlg::HandleDoubleClick()
// Handle OK button call
bool LyXFileDlg::HandleOK()
{
string pszTemp;
// mask was changed
pszTemp = fl_get_input(pFileDlgForm->PatBox);
string pszTemp = fl_get_input(pFileDlgForm->PatBox);
if (pszTemp!= pszMask) {
SetMask(pszTemp);
Reread();
@ -683,7 +613,7 @@ bool LyXFileDlg::HandleOK()
// Handle return from list
int select = fl_get_browser(pFileDlgForm->List);
if (select > iDepth) {
string temp = pCurrentNames[select - iDepth - 1].pszName;
string temp = direntries[select - iDepth - 1].pszName;
if (!suffixIs(temp, '/')) {
// If user didn't type anything, use browser
string name = fl_get_input(pFileDlgForm->Filename);
@ -707,11 +637,13 @@ int LyXFileDlg::CancelCB(FL_FORM *, void *)
return FL_IGNORE;
}
extern "C" int C_LyXFileDlg_CancelCB(FL_FORM *fl, void *xev)
{
return LyXFileDlg::CancelCB(fl, xev);
}
// Simulates a click on OK/Cancel
void LyXFileDlg::Force(bool cancel)
{
@ -729,12 +661,10 @@ void LyXFileDlg::Force(bool cancel)
// Select: launches dialog and returns selected file
string LyXFileDlg::Select(string const & title, string const & path,
string const & mask, string const & suggested)
string const & mask, string const & suggested)
{
bool isOk;
// handles new mask and path
isOk = true;
bool isOk = true;
if (!mask.empty()) {
SetMask(mask);
isOk = false;

View File

@ -16,78 +16,22 @@
#pragma interface
#endif
#include "LString.h"
#include <vector>
// necessary for xForms related stuff
#include "LString.h"
#include FORMS_H_LOCATION
#include "form1.h"
/// User cache class definition
class UserCache
{
public:
///
UserCache(string const & pszName = string(), uid_t ID = 0,
UserCache *pRoot = 0);
///
~UserCache();
// interface
/// seeks user name from user ID
string Find(uid_t ID);
private:
///
uid_t ID;
///
string pszName;
///
UserCache *pNext, *pRoot;
// internal methods
/// creates a new user entry
UserCache *Add(uid_t ID);
};
extern UserCache lyxUserCache;
/// Group cache class definition
class GroupCache
{
public:
///
GroupCache(string const & pszName = string(), gid_t ID = 0,
GroupCache *pRoot = 0);
///
~GroupCache();
// interface
/// seeks group name from group ID
string Find(gid_t ID);
private:
///
gid_t ID;
///
string pszName;
///
GroupCache *pNext, *pRoot;
// internal methods
/// creates a new group entry
GroupCache *Add(gid_t ID);
};
extern GroupCache lyxGroupCache;
using std::vector;
/// LyXDirEntry internal structure definition
class LyXDirEntry
{
private:
friend class LyXFileDlg;
public:
string pszName;
string pszDisplayed;
string pszLsEntry;
LyXDirEntry() {};
public:
/// compares two LyXDirEntry objects content (used by qsort)
static int ldeCompProc(const LyXDirEntry *r1, const LyXDirEntry *r2);
};
@ -97,13 +41,12 @@ class LyXFileDlg
public:
///
LyXFileDlg();
///
~LyXFileDlg();
/// sets file selector user button action
void SetButton(int iIndex, string const & pszName = string(),
string const & pszPath = string());
/// gets last dialog directory
string GetDirectory();
string GetDirectory() const;
/// launches dialog and returns selected file
string Select(string const & pszTitle = string(),
string const & pszPath = string(),
@ -116,25 +59,37 @@ public:
/// Handle Cancel CB from WM close
static int CancelCB(FL_FORM *, void *);
private:
// data
static FD_FileDlg *pFileDlgForm;
static LyXFileDlg *pCurrentDlg;
/// data
static FD_FileDlg * pFileDlgForm;
///
static LyXFileDlg * pCurrentDlg;
///
string pszUserPath1;
///
string pszUserPath2;
///
string pszDirectory;
///
string pszMask;
///
string pszFileName;
///
int iDepth;
///
int iLastSel;
///
long lLastTime;
///
string pszInfoLine;
LyXDirEntry *pCurrentNames;
int iNumNames;
///
typedef vector<LyXDirEntry> DirEntries;
///
DirEntries direntries;
///
bool force_cancel;
///
bool force_ok;
// internal functions
/// updates dialog list to match class directory
void Reread();
/// sets dialog current directory

View File

@ -1,3 +1,6 @@
Makefile.in
Makefile
*.deps
*.lo
.libs
libinsets.la

View File

@ -1,12 +1,11 @@
AUTOMAKE_OPTIONS = foreign
MAINTAINERCLEANFILES = Makefile.in
noinst_PROGRAMS = insets.o
LIBS=
pkglib_LTLIBRARIES = libinsets.la
LIBS =
ETAGS_ARGS = --c++
INCLUDES = -I${srcdir}/../
CXXLINK = $(LD) $(LDFLAGS)-r -o $(noinst_PROGRAMS)
insets_o_SOURCES = \
libinsets_la_SOURCES = \
figinset.C \
figinset.h \
form_url.C \

View File

@ -438,7 +438,7 @@ int FindBmpIndex(figdata *tmpdata)
static void chpixmap(Pixmap, int, int)
{
Display* tempdisp = XOpenDisplay(XDisplayName(0));
Display * tempdisp = XOpenDisplay(XDisplayName(0));
// here read the pixmap and change all colors to those we
// have allocated
@ -520,9 +520,9 @@ static void runqueue()
return;
}
if (pid == 0) { // child
char **env, rbuf[80], gbuf[40];
char ** env, rbuf[80], gbuf[40];
int ne = 0;
Display* tempdisp = XOpenDisplay(XDisplayName(0));
Display * tempdisp = XOpenDisplay(XDisplayName(0));
// create translation file
sprintf(tbuf, "%s/~lyxgs%d.ps", system_tempdir.c_str(),
@ -1296,9 +1296,9 @@ void InsetFig::Edit(int, int)
}
Inset *InsetFig::Clone()
InsetFig * InsetFig::Clone() const
{
InsetFig *tmp = new InsetFig(100, 100, owner);
InsetFig * tmp = new InsetFig(100, 100, owner);
if (lyxerr.debugging()) {
lyxerr << "Clone Figure: buffer:["

View File

@ -57,7 +57,7 @@ public:
///
Inset::Code LyxCode() const;
///
Inset* Clone();
InsetFig * Clone() const;
///
void CallbackFig(long arg);
///

View File

@ -199,6 +199,7 @@ InsetBibKey::InsetBibKey(InsetBibKey const *b):
counter = b->counter;
}
InsetBibKey::~InsetBibKey()
{
if(bibitem_form && bibitem_form->bibitem_form
@ -219,7 +220,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(FILE *file)
void InsetBibKey::Write(FILE * file)
{
string s;
if (!options.empty()) {
@ -243,7 +244,8 @@ string InsetBibKey::getScreenLabel() const
/*
The value in "Key:" isn't allways set right after a few bibkey insets have
been added/removed. Perhaps the wrong object is deleted/used somewhere upwards?
been added/removed. Perhaps the wrong object is deleted/used somewhere
upwards?
(Joacim 1998-03-04)
*/
void InsetBibKey::Edit(int, int)
@ -282,11 +284,6 @@ InsetBibtex::InsetBibtex(string const & dbase, string const & style,
}
InsetBibtex::~InsetBibtex()
{
}
string InsetBibtex::getScreenLabel() const
{
return _("BibTeX Generated References");

View File

@ -26,13 +26,15 @@
class InsetCitation: public InsetCommand {
public:
///
InsetCitation(): InsetCommand("cite") { }
InsetCitation(): InsetCommand("cite") {}
///
InsetCitation(string const & key, string const & note = string());
///
~InsetCitation();
///
Inset * Clone() { return new InsetCitation(contents, options); }
InsetCitation * Clone() const {
return new InsetCitation(contents, options);
}
///
string getScreenLabel()const;
///
@ -52,7 +54,7 @@ public:
class InsetBibKey: public InsetCommand {
public:
///
InsetBibKey(): InsetCommand("bibitem") { counter = 1; }
InsetBibKey() : InsetCommand("bibitem") { counter = 1; }
///
InsetBibKey(string const & key, string const & label = string());
///
@ -60,7 +62,7 @@ public:
///
~InsetBibKey();
///
Inset * Clone() { return new InsetBibKey(this); }
InsetBibKey * Clone() const { return new InsetBibKey(this); }
/// Currently \bibitem is used as a LyX2.x command, so we need this method.
void Write(FILE *);
///
@ -96,9 +98,9 @@ public:
InsetBibtex(string const & dbase, string const & style,
Buffer *);
///
~InsetBibtex();
///
Inset * Clone() { return new InsetBibtex(contents, options, 0); }
InsetBibtex * Clone() const {
return new InsetBibtex(contents, options, 0);
}
///
Inset::Code LyxCode() const
{
@ -119,15 +121,14 @@ public:
return 1;
}
///
bool addDatabase(string const&);
bool addDatabase(string const &);
///
bool delDatabase(string const&);
bool delDatabase(string const &);
///
bool Display() const { return true; }
bool display() const { return true; }
private:
///
Buffer *owner;
Buffer * owner;
};
#endif

View File

@ -30,11 +30,6 @@ InsetCommand::InsetCommand(string const & cmd, string const & arg,
}
InsetCommand::~InsetCommand()
{
}
int InsetCommand::Ascent(LyXFont const & font) const
{
LyXFont f = font;
@ -200,10 +195,9 @@ int InsetCommand::DocBook(string &/*file*/)
}
Inset * InsetCommand::Clone()
InsetCommand * InsetCommand::Clone() const
{
InsetCommand * result = new InsetCommand(command, contents, options);
return result;
return new InsetCommand(command, contents, options);
}

View File

@ -33,8 +33,6 @@ public:
InsetCommand(string const & name, string const & arg = string(),
string const & opt = string());
///
~InsetCommand();
///
int Ascent(LyXFont const & font) const;
///
int Descent(LyXFont const & font) const;
@ -57,7 +55,7 @@ public:
///
virtual int DocBook(string & file);
///
Inset * Clone();
InsetCommand * Clone() const;
///
Inset::Code LyxCode() const
{

View File

@ -181,8 +181,7 @@ void InsetError::Edit(int, int)
}
Inset * InsetError::Clone()
InsetError * InsetError::Clone() const
{
InsetError * result = new InsetError(contents);
return result;
return new InsetError(contents);
}

View File

@ -62,7 +62,7 @@ public:
///
unsigned char Editable() const;
///
Inset * Clone();
InsetError * Clone() const;
///
Inset::Code LyxCode() const { return Inset::NO_CODE; }
/// We don't want "begin" and "end inset" in lyx-file

View File

@ -210,7 +210,7 @@ InsetInclude::~InsetInclude()
}
}
Inset * InsetInclude::Clone()
InsetInclude * InsetInclude::Clone() const
{
InsetInclude * ii = new InsetInclude (contents, master);
ii->setNoLoad(isNoLoad());

View File

@ -37,7 +37,7 @@ public:
///
~InsetInclude();
///
Inset * Clone();
InsetInclude * Clone() const;
///
Inset::Code LyxCode() const { return Inset::INCLUDE_CODE; }
/// This is 1 if the childs have labels, 0 otherwise
@ -66,7 +66,7 @@ public:
void Validate(LaTeXFeatures &) const;
/// Input inserts anything inside a paragraph, Display can give some visual feedback
bool Display() const { return !(isInput()); }
bool display() const { return !(isInput()); }
///
string getScreenLabel() const;
///

View File

@ -35,7 +35,7 @@ public:
///
~InsetIndex();
///
Inset * Clone() { return new InsetIndex(contents);}
InsetIndex * Clone() const { return new InsetIndex(contents);}
///
void Edit(int, int);
///
@ -65,7 +65,7 @@ public:
return 1;
}
///
bool Display() const { return true; }
bool display() const { return true; }
///
Inset::Code LyxCode() const;
///

View File

@ -215,10 +215,9 @@ void InsetInfo::Edit(int, int)
}
Inset* InsetInfo::Clone()
InsetInfo * InsetInfo::Clone() const
{
InsetInfo * result = new InsetInfo(contents);
return result;
return new InsetInfo(contents);
}

View File

@ -65,7 +65,7 @@ public:
///
Inset::Code LyxCode() const;
///
Inset * Clone();
InsetInfo * Clone() const;
///
static void CloseInfoCB(FL_OBJECT *, long data);
private:

View File

@ -25,15 +25,9 @@ InsetLabel::InsetLabel(string const & cmd)
}
InsetLabel::~InsetLabel()
InsetLabel * InsetLabel::Clone() const
{
}
Inset * InsetLabel::Clone()
{
InsetLabel * result = new InsetLabel(getCommand());
return result;
return new InsetLabel(getCommand());
}

View File

@ -27,9 +27,7 @@ public:
///
InsetLabel() : InsetCommand("label") {}
///
~InsetLabel();
///
Inset * Clone();
InsetLabel * Clone() const;
///
Inset::Code LyxCode() const { return Inset::LABEL_CODE; }
///

View File

@ -50,11 +50,6 @@ InsetLatexAccent::InsetLatexAccent(string const & string)
}
InsetLatexAccent::~InsetLatexAccent()
{
}
void InsetLatexAccent::checkContents()
// check, if we know the modifier and can display it ok on screen
{
@ -635,10 +630,9 @@ bool InsetLatexAccent::DirectWrite() const
}
Inset* InsetLatexAccent::Clone()
InsetLatexAccent * InsetLatexAccent::Clone() const
{
InsetLatexAccent * result = new InsetLatexAccent(contents);
return result;
return new InsetLatexAccent(contents);
}
@ -648,15 +642,6 @@ Inset::Code InsetLatexAccent::LyxCode() const
}
bool InsetLatexAccent::IsEqual(Inset * other)
{
if (other && other->LyxCode() == Inset::ACCENT_CODE){
InsetLatexAccent* otheraccent = (InsetLatexAccent*) other;
return (contents == otheraccent->contents);
}
return false;
}
ostream & operator<<(ostream & o, InsetLatexAccent::ACCENT_TYPES at)
{
return o << int(at);

View File

@ -36,8 +36,6 @@ public:
///
InsetLatexAccent(InsetLatexAccent const &);
///
~InsetLatexAccent();
///
int Ascent(LyXFont const & font) const;
///
int Descent(LyXFont const & font) const;
@ -65,12 +63,10 @@ public:
///
bool DirectWrite() const;
///
Inset * Clone();
InsetLatexAccent * Clone() const;
///
Inset::Code LyxCode()const;
///
bool IsEqual(Inset * other);
///
inline bool CanDisplay();
private:
/// all the accent types

View File

@ -32,7 +32,7 @@ public:
///
void Validate(LaTeXFeatures & features) const;
///
Inset * Clone() { return new InsetLOA(owner); }
InsetLOA * Clone() const { return new InsetLOA(owner); }
///
string getScreenLabel() const { return _("List of Algorithms"); }
@ -43,7 +43,7 @@ public:
return 0; // not yet
}
///
bool Display() const { return true; }
bool display() const { return true; }
///
Inset::Code LyxCode() const { return Inset::LOA_CODE; }
private:

View File

@ -30,7 +30,7 @@ public:
///
InsetLOF(Buffer * b): InsetCommand("listoffigures"), owner(b) {}
///
Inset * Clone() { return new InsetLOF(owner); }
InsetLOF * Clone() const { return new InsetLOF(owner); }
///
string getScreenLabel() const { return _("List of Figures"); }
@ -40,7 +40,7 @@ public:
return 0; // not yet
}
///
bool Display() const { return true; }
bool display() const { return true; }
///
Inset::Code LyxCode() const { return Inset::LOF_CODE; }
private:

View File

@ -30,7 +30,7 @@ public:
///
InsetLOT(Buffer * b): InsetCommand("listoftables"), owner(b) {}
///
Inset * Clone() { return new InsetLOT(owner); }
InsetLOT * Clone() const { return new InsetLOT(owner); }
///
string getScreenLabel() const { return _("List of Tables"); }
@ -40,7 +40,7 @@ public:
return 0; // not yet
}
///
bool Display() const { return true; }
bool display() const { return true; }
///
Inset::Code LyxCode() const { return Inset::LOT_CODE; }
private:

View File

@ -37,7 +37,7 @@ public:
///
int Latex(string & file, signed char fragile);
///
Inset * Clone() { return new InsetParent(getContents()); }
InsetParent * Clone() const { return new InsetParent(getContents()); }
///
string getScreenLabel() const { return string(_("Parent:"))+getContents(); }
///

View File

@ -308,7 +308,8 @@ void InsetQuotes::Validate(LaTeXFeatures & features) const
}
}
Inset * InsetQuotes::Clone()
InsetQuotes * InsetQuotes::Clone() const
{
return new InsetQuotes(language, side, times);
}

View File

@ -97,7 +97,7 @@ public:
///
void Validate(LaTeXFeatures &) const;
///
Inset* Clone();
InsetQuotes * Clone() const;
///
Inset::Code LyxCode() const;
private:

View File

@ -78,7 +78,7 @@ int InsetRef::Latex(FILE * file, signed char /*fragile*/)
fprintf(file, "%s", escape(getCommand()).c_str());
else {
string ns;
InsetCommand clone= InsetCommand(getCmdName(), getContents(), ns);
InsetCommand clone = InsetCommand(getCmdName(), getContents(), ns);
fprintf(file, "%s", escape(clone.getCommand()).c_str());
}
return 0;

View File

@ -41,7 +41,9 @@ public:
///
~InsetRef();
///
Inset * Clone() { return new InsetRef (getCommand(), master); }
InsetRef * Clone() const {
return new InsetRef (getCommand(), master);
}
///
Inset::Code LyxCode() const { return Inset::REF_CODE; }
///
@ -51,7 +53,7 @@ public:
return 1;
}
///
bool Display() const { return false; }
bool display() const { return false; }
///
string getScreenLabel() const;
///

View File

@ -18,20 +18,9 @@
#include "debug.h"
#include "LaTeXFeatures.h"
InsetSpecialChar::InsetSpecialChar()
{
}
InsetSpecialChar::InsetSpecialChar(Kind k)
: kind(k)
{
}
InsetSpecialChar::~InsetSpecialChar()
{
}
{}
int InsetSpecialChar::Ascent(LyXFont const & font) const
@ -195,10 +184,9 @@ int InsetSpecialChar::DocBook(string & file)
}
Inset * InsetSpecialChar::Clone()
InsetSpecialChar * InsetSpecialChar::Clone() const
{
InsetSpecialChar * result = new InsetSpecialChar(kind);
return result;
return new InsetSpecialChar(kind);
}

View File

@ -37,12 +37,10 @@ public:
};
///
InsetSpecialChar();
InsetSpecialChar() {}
///
InsetSpecialChar(Kind k);
///
~InsetSpecialChar();
///
int Ascent(LyXFont const & font) const;
///
int Descent(LyXFont const & font) const;
@ -63,7 +61,7 @@ public:
///
int DocBook(string & file);
///
Inset * Clone();
InsetSpecialChar * Clone() const;
///
Inset::Code LyxCode() const
{

View File

@ -30,7 +30,7 @@ public:
///
InsetTOC(Buffer * b): InsetCommand("tableofcontents"), owner(b) {}
///
Inset * Clone() { return new InsetTOC(owner); }
InsetTOC * Clone() const { return new InsetTOC(owner); }
///
string getScreenLabel() const { return _("Table of Contents"); }
/// On edit, we open the TOC pop-up
@ -40,7 +40,7 @@ public:
return 1;
}
///
bool Display() const { return true; }
bool display() const { return true; }
///
Inset::Code LyxCode() const { return Inset::TOC_CODE; }
///

View File

@ -46,7 +46,7 @@ public:
///
~InsetUrl();
///
Inset * Clone() { return new InsetUrl(getCommand()); }
InsetUrl * Clone() const { return new InsetUrl(getCommand()); }
///
Inset::Code LyxCode() const { return Inset::URL_CODE; }
///
@ -60,7 +60,7 @@ public:
///
char const * EditMessage() {return "Opened Url";}
///
bool Display() const { return false; }
bool display() const { return false; }
///
string getScreenLabel() const;
///

View File

@ -91,7 +91,7 @@ public:
virtual void Draw(LyXFont font, LyXScreen & scr,
int baseline, float & x) = 0;
/// what appears in the minibuffer when opening
virtual char const * EditMessage() {return _("Opened inset");}
virtual char const * EditMessage() const {return _("Opened inset");}
///
virtual void Edit(int, int);
///
@ -99,9 +99,9 @@ public:
///
virtual bool AutoDelete() const;
///
virtual void Write(FILE * file)= 0;
virtual void Write(FILE * file) = 0;
///
virtual void Read(LyXLex & lex)= 0;
virtual void Read(LyXLex & lex) = 0;
/** returns the number of rows (\n's) of generated tex code.
fragile != 0 means, that the inset should take care about
fragile commands by adding a \protect before.
@ -125,22 +125,16 @@ public:
return string();
}
/// used for autocorrection
virtual bool IsEqual(Inset * /*other*/){
return false;
}
///
virtual Inset * Clone() = 0;
virtual Inset * Clone() const = 0;
/// returns true to override begin and end inset in file
virtual bool DirectWrite() const;
/// Returns true if the inset should be centered alone
virtual bool Display() const { return false; }
virtual bool display() const { return false; }
/// Changes the display state of the inset
virtual void SetDisplay(bool) { }
virtual void display(bool) {}
///
virtual int GetNumberOfLabels() const {
return 0;
@ -185,7 +179,7 @@ public:
/// may call ToggleLockedInsetCursor
virtual void ToggleInsetCursor();
///
virtual void GetCursorPos(int &, int &) {}
virtual void GetCursorPos(int &, int &) const {}
///
virtual void InsetButtonPress(int x, int y, int button);
///

View File

@ -1159,7 +1159,7 @@ void MenuInsertLabel(char const *arg)
if (label.empty())
label = frontStrip(strip(askForText(_("Enter new label to insert:"))));
if (!label.empty()) {
InsetLabel *new_inset = new InsetLabel;
InsetLabel * new_inset = new InsetLabel;
new_inset->setContents(label);
current_view->buffer()->insertInset(new_inset);
}
@ -1259,8 +1259,12 @@ int RunLinuxDoc(int flag, string const & filename)
#endif
BufferParams::PAPER_SIZE ps = static_cast<BufferParams::PAPER_SIZE>(current_view->buffer()->params.papersize);
switch (ps) {
case BufferParams::PAPER_A4PAPER: add_flags = "-p a4"; break;
case BufferParams::PAPER_USLETTER: add_flags = "-p letter"; break;
case BufferParams::PAPER_A4PAPER:
add_flags = "-p a4";
break;
case BufferParams::PAPER_USLETTER:
add_flags = "-p letter";
break;
default: /* nothing to be done yet ;-) */ break;
}
}
@ -2036,10 +2040,9 @@ void MenuLayoutSave()
void NoteCB()
{
InsetInfo *new_inset = new InsetInfo();
InsetInfo * new_inset = new InsetInfo();
current_view->buffer()->insertInset(new_inset);
new_inset->Edit(0, 0);
//current_view->buffer()->update(-1);
}
@ -2113,10 +2116,9 @@ void HyphenationPoint()
if (current_view->available()) {
current_view->getScreen()->HideCursor();
current_view->buffer()->update(-2);
InsetSpecialChar *new_inset =
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
current_view->buffer()->insertInset(new_inset);
//current_view->buffer()->update(-1);
}
}
@ -2126,7 +2128,7 @@ void Ldots()
if (current_view->available()) {
current_view->getScreen()->HideCursor();
current_view->buffer()->update(-2);
InsetSpecialChar *new_inset =
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::LDOTS);
current_view->buffer()->insertInset(new_inset);
}
@ -2138,7 +2140,7 @@ void EndOfSentenceDot()
if (current_view->available()) {
current_view->getScreen()->HideCursor();
current_view->buffer()->update(-2);
InsetSpecialChar *new_inset =
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::END_OF_SENTENCE);
current_view->buffer()->insertInset(new_inset);
}
@ -2150,10 +2152,9 @@ void MenuSeparator()
if (current_view->available()) {
current_view->getScreen()->HideCursor();
current_view->buffer()->update(-2);
InsetSpecialChar *new_inset =
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR);
current_view->buffer()->insertInset(new_inset);
//current_view->buffer()->update(-1);
}
}
@ -3056,7 +3057,7 @@ void GotoNote()
void InsertCorrectQuote()
{
Buffer *cbuffer = current_view->buffer();
Buffer * cbuffer = current_view->buffer();
char c;
if (cbuffer->text->cursor.pos )
@ -3487,9 +3488,7 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long)
buffer->update(-1);
Inset *new_inset = 0;
new_inset = new InsetFig(100, 100, buffer);
Inset * new_inset = new InsetFig(100, 100, buffer);
buffer->insertInset(new_inset);
new_inset->Edit(0, 0);
buffer->update(0);
@ -3838,7 +3837,7 @@ extern "C" void RefSelectCB(FL_OBJECT *, long data)
else
t += "{" + s + "}";
Inset *new_inset =
Inset * new_inset =
new InsetRef(t, current_view->buffer());
current_view->buffer()->insertInset(new_inset);
}
@ -4002,7 +4001,7 @@ void FitLockedInsetCursor(long x, long y, int asc, int desc)
}
int UnlockInset(UpdatableInset* inset)
int UnlockInset(UpdatableInset * inset)
{
if (inset &&
current_view->buffer()->the_locking_inset == inset){
@ -4029,10 +4028,10 @@ void LockedInsetStoreUndo(Undo::undo_kind kind)
}
void PutInsetIntoInsetUpdateList(Inset* inset)
void PutInsetIntoInsetUpdateList(Inset * inset)
{
if (inset) {
InsetUpdateStruct* tmp = new InsetUpdateStruct();
InsetUpdateStruct * tmp = new InsetUpdateStruct();
tmp->inset = inset;
tmp->next = InsetUpdateList;
InsetUpdateList = tmp;
@ -4042,7 +4041,7 @@ void PutInsetIntoInsetUpdateList(Inset* inset)
void UpdateInsetUpdateList()
{
InsetUpdateStruct *tmp = InsetUpdateList;
InsetUpdateStruct * tmp = InsetUpdateList;
while (tmp) {
UpdateInset(tmp->inset, false); // "false" because no document change
tmp = tmp->next;

View File

@ -144,7 +144,7 @@ FL_resource res[] =
};
extern "C" int LyX_XErrHandler(Display *display, XErrorEvent *xeev)
extern "C" int LyX_XErrHandler(Display * display, XErrorEvent * xeev)
{
//#warning Please see if you can trigger this!
// emergency save
@ -173,7 +173,7 @@ LyXGUI::LyXGUI(LyX *owner, int *argc, char *argv[], bool GUI)
static const int num_res = sizeof(res)/sizeof(FL_resource);
fl_initialize(argc, argv, "LyX", cmdopt, num_res);
fl_get_app_resources(res, num_res);
Display *display = fl_get_display();
Display * display = fl_get_display();
if (!display) {
lyxerr << "LyX: unable to access X display, exiting" << endl;
exit(1);
@ -641,5 +641,5 @@ void LyXGUI::runTime()
void LyXGUI::regBuf(Buffer *b)
{
lyxViews->currentView()->buffer(b);
lyxViews->view()->buffer(b);
}

View File

@ -27,6 +27,7 @@
#include "intl.h"
#include "lyx_main.h"
#include "lyx_cb.h"
#include "LyXAction.h"
#if 0
#include "insets/insetlatex.h"
#endif
@ -148,7 +149,7 @@ extern void UpdateInset(Inset* inset, bool mark_dirty = true);
bool LyXFunc::show_sc = true;
LyXFunc::LyXFunc(LyXView *o)
LyXFunc::LyXFunc(LyXView * o)
:owner(o)
{
meta_fake_bit = 0;
@ -158,11 +159,6 @@ LyXFunc::LyXFunc(LyXView *o)
}
LyXFunc::~LyXFunc()
{
}
// I changed this func slightly. I commented out the ...FinishUndo(),
// this means that all places that used to have a moveCursorUpdate, now
// have a ...FinishUndo() as the preceeding statement. I have also added
@ -173,13 +169,13 @@ void LyXFunc::moveCursorUpdate(bool selecting)
{
if (selecting || owner->buffer()->text->mark_set) {
owner->buffer()->text->SetSelection();
owner->currentView()->getScreen()->ToggleToggle();
owner->view()->getScreen()->ToggleToggle();
owner->buffer()->update(0);
} else {
owner->buffer()->update(-2); // this IS necessary
// (Matthias)
}
owner->currentView()->getScreen()->ShowCursor();
owner->view()->getScreen()->ShowCursor();
/* ---> Everytime the cursor is moved, show the current font state. */
// should this too me moved out of this func?
@ -187,14 +183,14 @@ void LyXFunc::moveCursorUpdate(bool selecting)
}
int LyXFunc::processKeyEvent(XEvent *ev)
int LyXFunc::processKeyEvent(XEvent * ev)
{
char s_r[10];
s_r[9] = '\0';
int num_bytes;
int action;
string argument;
XKeyEvent *keyevent = &ev->xkey;
XKeyEvent * keyevent = &ev->xkey;
KeySym keysym_return;
num_bytes = LyXLookupString(ev, s_r, 10, &keysym_return);
@ -217,7 +213,7 @@ int LyXFunc::processKeyEvent(XEvent *ev)
}
// this function should be used always [asierra060396]
if (owner->currentView()->available() &&
if (owner->view()->available() &&
owner->buffer()->the_locking_inset &&
keysym_return == XK_Escape) {
UnlockInset(owner->buffer()->the_locking_inset);
@ -311,9 +307,130 @@ int LyXFunc::processKeyEvent(XEvent *ev)
}
string LyXFunc::Dispatch(string const& s)
LyXFunc::func_status LyXFunc::getStatus(int ac) const
{
// Split command string into command and argument
kb_action action;
func_status flag = LyXFunc::OK;
string argument;
Buffer * buf = owner->buffer();
if (lyxaction.isPseudoAction(ac))
action = lyxaction.retrieveActionArg(ac, argument);
else
action = static_cast<kb_action>(ac);
if (action == LFUN_UNKNOWN_ACTION) {
setErrorMessage(N_("Unknown action"));
return LyXFunc::Unknown;
}
// Check whether we need a buffer
if (!lyxaction.funcHasFlag(action, LyXAction::NoBuffer)) {
// Yes we need a buffer, do we have one?
if (buf) {
// yes
// Can we use a readonly buffer?
if (buf->isReadonly() &&
!lyxaction.funcHasFlag(action,
LyXAction::ReadOnly)) {
// no
setErrorMessage(N_("Document is read-only"));
flag = func_status(flag | LyXFunc::Disabled);
}
} else {
// no
setErrorMessage(N_("Command not allowed with"
"out any document open"));
flag = func_status(flag | LyXFunc::Disabled);
}
}
if (flag & LyXFunc::Disabled)
return flag;
static bool noLaTeX = lyxrc->latex_command == "none";
bool disable = false;
switch (action) {
case LFUN_PREVIEW:
disable = noLaTeX || lyxrc->view_dvi_command == "none";
break;
case LFUN_PREVIEWPS:
disable = noLaTeX || lyxrc->view_ps_command == "none";
break;
case LFUN_RUNLATEX:
case LFUN_RUNDVIPS:
disable = noLaTeX;
break;
case LFUN_MENUPRINT:
disable = noLaTeX || lyxrc->print_command == "none";
break;
case LFUN_FAX:
disable = noLaTeX || lyxrc->fax_command == "none";
break;
case LFUN_IMPORT:
if (argument == "latex")
disable = lyxrc->relyx_command == "none";
break;
case LFUN_EXPORT:
if (argument == "dvi" || argument == "postscript")
disable = noLaTeX;
break;
case LFUN_UNDO:
disable = buf->undostack.empty();
break;
case LFUN_REDO:
disable = buf->redostack.empty();
break;
case LFUN_SPELLCHECK:
disable = lyxrc->isp_command == "none";
break;
case LFUN_RUNCHKTEX:
disable = lyxrc->chktex_command == "none";
break;
case LFUN_LAYOUT_TABLE:
#warning change this and font code once it is possible to get to cursor
// disable = ! buf->text->cursor.par->table;
break;
default:
break;
}
if (disable)
flag = func_status(flag | LyXFunc::Disabled);
func_status box = LyXFunc::ToggleOff;
// LyXFont font = buf->text->real_current_font;
LyXFont font;
switch (action) {
case LFUN_EMPH:
if (font.emph() == LyXFont::ON)
box = LyXFunc::ToggleOn;
break;
case LFUN_NOUN:
if (font.noun() == LyXFont::ON)
box = LyXFunc::ToggleOn;
break;
case LFUN_BOLD:
if (font.series() == LyXFont::BOLD_SERIES)
box = LyXFunc::ToggleOn;
break;
case LFUN_TEX:
if (font.latex() == LyXFont::ON)
box = LyXFunc::ToggleOn;
break;
default:
box = LyXFunc::OK;
break;
}
flag = func_status(flag | box);
return flag;
}
string LyXFunc::Dispatch(string const & s)
{
// Split command string into command and argument
string cmd, line = frontStrip(s);
string arg = strip(frontStrip(split(line, cmd, ' ')));
@ -322,70 +439,41 @@ string LyXFunc::Dispatch(string const& s)
string LyXFunc::Dispatch(int ac,
char const *do_not_use_this_arg)
char const * do_not_use_this_arg)
{
string argument;
kb_action action;
FL_OBJECT *ob = 0; // This will disapear soon
FL_OBJECT * ob = 0; // This will disapear soon
// we have not done anything wrong yet.
errorstat = false;
dispatch_buffer = string();
dispatch_buffer.clear();
// if action is a pseudo-action, we need the real action
if (lyxaction.isPseudoAction(ac)) {
char const *tmparg = 0;
action = (kb_action)lyxaction.retrieveActionArg(ac, &tmparg);
if (tmparg)
string tmparg;
action = static_cast<kb_action>
(lyxaction.retrieveActionArg(ac, tmparg));
if (!tmparg.empty())
argument = tmparg;
} else {
action = (kb_action)ac;
action = static_cast<kb_action>(ac);
if (do_not_use_this_arg)
argument = do_not_use_this_arg; // except here
}
selection_possible = false;
if (owner->currentView()->available()
&& owner->currentView()->getScreen())
owner->currentView()->getScreen()->HideCursor();
if (owner->view()->available()
&& owner->view()->getScreen())
owner->view()->getScreen()->HideCursor();
if(!owner->currentView()->available()) {
// This lists the allowed funcs when we have no
// buffer loaded
switch(action){
case LFUN_MENU_OPEN_BY_NAME:
case LFUN_PREFIX:
case LFUN_MENUNEW:
case LFUN_MENUNEWTMPLT:
case LFUN_MENUOPEN:
case LFUN_QUIT:
case LFUN_PUSH_TOOLBAR:
case LFUN_ADD_TO_TOOLBAR:
case LFUN_EXEC_COMMAND:
case LFUN_DROP_LAYOUTS_CHOICE:
case LFUN_FILE_NEW:
case LFUN_FILE_OPEN:
case LFUN_IMPORT:
case LFUN_RECONFIGURE:
case LFUN_CANCEL:
case LFUN_APROPOS:
case LFUN_META_FAKE:
// We cannot use this function here
if (getStatus(action) & Disabled)
goto exit_with_message;
break;
case LFUN_UNKNOWN_ACTION:
setErrorMessage(N_("Unknown action"));
goto exit_with_message;
default:
setErrorMessage(N_("Command not allowed with"
"out any document open"));
goto exit_with_message; // action not allowed
}
}
commandshortcut = string();
commandshortcut.clear();
if (lyxrc->display_shortcuts && show_sc) {
if (action != LFUN_SELFINSERT) {
@ -433,44 +521,35 @@ string LyXFunc::Dispatch(int ac,
}
}
// Now that we know which action, if the buffer is RO let's check
// whether the action is legal. Alejandro 970603
if (owner->currentView()->available() &&
owner->buffer()->isReadonly() &&
lyxaction.isFuncRO(action)) {
setErrorMessage(N_("Document is read-only"));
lyxerr.debug() << "Error: Document is read-only." << endl;
goto exit_with_message;
}
// If in math mode pass the control to
// the math inset [asierra060396]
if (owner->currentView()->available() &&
if (owner->view()->available() &&
owner->buffer()->the_locking_inset) {
if (action>1 || (action == LFUN_UNKNOWN_ACTION && keyseq.length>= -1)) {
if (action > 1
|| (action == LFUN_UNKNOWN_ACTION && keyseq.length>= -1)) {
if (action == LFUN_UNKNOWN_ACTION && argument.empty()) {
argument = keyseq.getiso();
}
// Undo/Redo pre 0.13 is a bit tricky for insets.
// Undo/Redo pre 0.13 is a bit tricky for insets.
if (action == LFUN_UNDO) {
int slx, sly;
UpdatableInset* inset =
UpdatableInset * inset =
owner->buffer()->the_locking_inset;
inset->GetCursorPos(slx, sly);
UnlockInset(inset);
MenuUndo();
inset = (UpdatableInset*)owner->buffer()->text->cursor.par->GetInset(owner->buffer()->text->cursor.pos);
inset = static_cast<UpdatableInset*>(owner->buffer()->text->cursor.par->GetInset(owner->buffer()->text->cursor.pos));
if (inset)
inset->Edit(slx, sly);
return string();
} else
if (action == LFUN_REDO) {
int slx, sly;
UpdatableInset* inset = owner->buffer()->the_locking_inset;
UpdatableInset * inset = owner->buffer()->the_locking_inset;
inset->GetCursorPos(slx, sly);
UnlockInset(inset);
MenuRedo();
inset = (UpdatableInset*)owner->buffer()->text->cursor.par->GetInset(owner->buffer()->text->cursor.pos);
inset = static_cast<UpdatableInset*>(owner->buffer()->text->cursor.par->GetInset(owner->buffer()->text->cursor.pos));
if (inset)
inset->Edit(slx, sly);
return string();
@ -501,21 +580,20 @@ string LyXFunc::Dispatch(int ac,
searched_string = last_search;
}
LyXText * ltCur = owner->currentView()->buffer()->text ;
LyXText * ltCur = owner->view()->buffer()->text ;
if (!searched_string.empty() &&
( (action == LFUN_WORDFINDBACKWARD) ?
ltCur->SearchBackward( searched_string.c_str() ) :
ltCur->SearchForward( searched_string.c_str() )
)){
((action == LFUN_WORDFINDBACKWARD) ?
ltCur->SearchBackward(searched_string.c_str()) :
ltCur->SearchForward(searched_string.c_str()))) {
// ??? What is that ???
owner->currentView()->buffer()->update(-2);
owner->view()->buffer()->update(-2);
// ??? Needed ???
// clear the selection (if there is any)
owner->currentView()->getScreen()->ToggleSelection();
owner->currentView()->buffer()->text->ClearSelection();
owner->view()->getScreen()->ToggleSelection();
owner->view()->buffer()->text->ClearSelection();
// Move cursor so that successive C-s 's will not stand in place.
if( action == LFUN_WORDFINDFORWARD )
@ -525,20 +603,20 @@ string LyXFunc::Dispatch(int ac,
// ??? Needed ???
// set the new selection
// SetSelectionOverLenChars(owner->currentView()->currentBuffer()->text, iLenSelected);
owner->currentView()->getScreen()->ToggleSelection(false);
// SetSelectionOverLenChars(owner->view()->currentBuffer()->text, iLenSelected);
owner->view()->getScreen()->ToggleSelection(false);
} else
LyXBell();
// REMOVED : if (owner->currentView()->getWorkArea()->focus)
owner->currentView()->getScreen()->ShowCursor();
// REMOVED : if (owner->view()->getWorkArea()->focus)
owner->view()->getScreen()->ShowCursor();
}
break;
case LFUN_PREFIX:
{
if (owner->currentView()->available()
&& owner->currentView()->getScreen()) {
if (owner->view()->available()
&& owner->view()->getScreen()) {
owner->buffer()->update(-2);
}
char buf[100];
@ -555,9 +633,9 @@ string LyXFunc::Dispatch(int ac,
case LFUN_CANCEL: // RVDK_PATCH_5
keyseq.reset();
meta_fake_bit = 0;
if(owner->currentView()->available())
if(owner->view()->available())
// cancel any selection
Dispatch(int(LFUN_MARK_OFF), 0);
Dispatch(LFUN_MARK_OFF, 0);
setMessage(N_("Cancel"));
break;
@ -583,20 +661,20 @@ string LyXFunc::Dispatch(int ac,
case LFUN_CENTER: // this is center and redraw.
BeforeChange();
if (owner->buffer()->text->cursor.y >
owner->currentView()->getWorkArea()->h / 2) {
owner->currentView()->getScreen()->
owner->view()->getWorkArea()->h / 2) {
owner->view()->getScreen()->
Draw(owner->buffer()->text->cursor.y -
owner->currentView()->getWorkArea()->h/2);
owner->view()->getWorkArea()->h/2);
} else { // <=
owner->currentView()->getScreen()->
owner->view()->getScreen()->
Draw(0);
}
owner->buffer()->update(0);
owner->currentView()->redraw();
owner->view()->redraw();
break;
case LFUN_APPENDIX:
if (owner->currentView()->available()) {
if (owner->view()->available()) {
owner->buffer()->text->toggleAppendix();
owner->buffer()->update(1);
}
@ -666,7 +744,7 @@ string LyXFunc::Dispatch(int ac,
case LFUN_EXPORT:
{
//needs argument as string
string extyp= argument;
string extyp = argument;
// latex
if (extyp == "latex") {
@ -730,16 +808,16 @@ string LyXFunc::Dispatch(int ac,
Systemcalls one;
int res = one.startscript(Systemcalls::System, tmp);
if (res == 0) {
setMessage(_("Document exported as HTML to file `")
setMessage(N_("Document exported as HTML to file `")
+ MakeDisplayPath(result) +'\'');
} else {
setErrorMessage(_("Unable to convert to HTML the file `")
setErrorMessage(N_("Unable to convert to HTML the file `")
+ MakeDisplayPath(file)
+ '\'');
}
}
else {
setErrorMessage(_("Unknown export type: ")
setErrorMessage(N_("Unknown export type: ")
+ extyp);
}
}
@ -748,7 +826,7 @@ string LyXFunc::Dispatch(int ac,
case LFUN_IMPORT:
{
//needs argument as string
string imtyp= argument;
string imtyp = argument;
// latex
if (imtyp == "latex") {
@ -793,37 +871,29 @@ string LyXFunc::Dispatch(int ac,
case LFUN_TOC_INSERT:
{
Inset *new_inset =
new InsetTOC(owner->buffer());
owner->buffer()->insertInset(new_inset,
"Standard", true);
Inset * new_inset = new InsetTOC(owner->buffer());
owner->buffer()->insertInset(new_inset, "Standard", true);
break;
}
case LFUN_LOF_INSERT:
{
Inset *new_inset =
new InsetLOF(owner->buffer());
owner->buffer()->insertInset(new_inset,
"Standard", true);
Inset * new_inset = new InsetLOF(owner->buffer());
owner->buffer()->insertInset(new_inset, "Standard", true);
break;
}
case LFUN_LOA_INSERT:
{
Inset *new_inset =
new InsetLOA(owner->buffer());
owner->buffer()->insertInset(new_inset,
"Standard", true);
Inset * new_inset = new InsetLOA(owner->buffer());
owner->buffer()->insertInset(new_inset, "Standard", true);
break;
}
case LFUN_LOT_INSERT:
{
Inset *new_inset =
new InsetLOT(owner->buffer());
owner->buffer()->insertInset(new_inset,
"Standard", true);
Inset * new_inset = new InsetLOT(owner->buffer());
owner->buffer()->insertInset(new_inset, "Standard", true);
break;
}
@ -858,7 +928,7 @@ string LyXFunc::Dispatch(int ac,
case LFUN_PASTESELECTION:
{
bool asPara = false;
if (string(argument) == "paragraph") asPara = true;
if (argument == "paragraph") asPara = true;
MenuPasteSelection(asPara);
break;
}
@ -880,14 +950,14 @@ string LyXFunc::Dispatch(int ac,
break;
case LFUN_GOTOERROR:
owner->currentView()->gotoError();
owner->view()->gotoError();
break;
case LFUN_REMOVEERRORS:
if (owner->buffer()->removeAutoInsets()) {
owner->currentView()->redraw();
owner->currentView()->fitCursor();
owner->currentView()->updateScrollbar();
owner->view()->redraw();
owner->view()->fitCursor();
owner->view()->updateScrollbar();
}
break;
@ -948,7 +1018,7 @@ string LyXFunc::Dispatch(int ac,
break;
case LFUN_FOOTMELT:
if (owner->currentView()->available()
if (owner->view()->available()
&& !owner->buffer()->text->selection
&& owner->buffer()->text->cursor.par->footnoteflag
!= LyXParagraph::NO_FOOTNOTE)
@ -961,13 +1031,13 @@ string LyXFunc::Dispatch(int ac,
break;
case LFUN_MARGINMELT:
if (owner->currentView()->available()
if (owner->view()->available()
&& !owner->buffer()->text->selection
&& owner->buffer()->text->cursor.par->footnoteflag
!= LyXParagraph::NO_FOOTNOTE)
{ // only melt margins
if(owner->buffer()->text->cursor.par->footnotekind == LyXParagraph::MARGIN)
MeltCB(ob, 0);
!= LyXParagraph::NO_FOOTNOTE) {
// only melt margins
if(owner->buffer()->text->cursor.par->footnotekind == LyXParagraph::MARGIN)
MeltCB(ob, 0);
}
else
MarginCB(ob, 0);
@ -1022,13 +1092,13 @@ string LyXFunc::Dispatch(int ac,
#endif
// it is the LyXView or the BufferView that should
// remember the previous buffer, not bufferlist.
// if (owner->currentView()->available()){
// if (owner->view()->available()){
// BeforeChange();
// owner->buffer()->update(-2);
// }
// owner->currentView()->setBuffer(bufferlist.prev());
// owner->view()->setBuffer(bufferlist.prev());
// owner->currentView()->
// owner->view()->
// resizeCurrentBufferPseudoExpose();
break;
@ -1040,8 +1110,7 @@ string LyXFunc::Dispatch(int ac,
case LFUN_FILE_INSERT_ASCII:
{
bool asPara = false;
asPara = (string(argument) == "paragraph");
bool asPara = (argument == "paragraph");
InsertAsciiFile(string(), asPara);
}
break;
@ -1049,15 +1118,14 @@ string LyXFunc::Dispatch(int ac,
case LFUN_FILE_NEW:
{
// servercmd: argument must be <file>:<template>
Buffer * tmpbuf = 0;
tmpbuf = NewLyxFile(argument);
Buffer * tmpbuf = NewLyxFile(argument);
if (tmpbuf)
owner->currentView()->buffer(tmpbuf);
owner->view()->buffer(tmpbuf);
}
break;
case LFUN_FILE_OPEN:
owner->currentView()->buffer(
owner->view()->buffer(
bufferlist.loadLyXFile(argument));
break;
@ -1093,8 +1161,7 @@ string LyXFunc::Dispatch(int ac,
// Derive layout number from given argument (string)
// and current buffer's textclass (number). */
int layoutno = -1;
layoutno =
int layoutno =
textclasslist.NumberOfLayout(owner->
buffer()->
text->parameters->
@ -1109,7 +1176,7 @@ string LyXFunc::Dispatch(int ac,
}
if (current_layout != layoutno) {
owner->currentView()->getScreen()->HideCursor();
owner->view()->getScreen()->HideCursor();
current_layout = layoutno;
owner->buffer()->update(-2);
owner->buffer()->text->
@ -1138,7 +1205,7 @@ string LyXFunc::Dispatch(int ac,
case LFUN_LAYOUT_TABLE:
{
int flag = 0;
if (string(argument) == "true") flag = 1;
if (argument == "true") flag = 1;
MenuLayoutTable(flag);
}
break;
@ -1237,8 +1304,8 @@ string LyXFunc::Dispatch(int ac,
case LFUN_REFTOGGLE:
{
InsetRef *inset =
(InsetRef*)getInsetByCode(Inset::REF_CODE);
InsetRef * inset =
static_cast<InsetRef*>(getInsetByCode(Inset::REF_CODE));
if (inset) {
if (inset->getFlag() == InsetRef::REF)
inset->setFlag(InsetRef::PAGE_REF);
@ -1253,7 +1320,7 @@ string LyXFunc::Dispatch(int ac,
case LFUN_REFBACK:
{
owner->currentView()->restorePosition();
owner->view()->restorePosition();
}
break;
@ -1261,14 +1328,14 @@ string LyXFunc::Dispatch(int ac,
{
string label(argument);
if (label.empty()) {
InsetRef *inset =
(InsetRef*)getInsetByCode(Inset::REF_CODE);
InsetRef * inset =
static_cast<InsetRef*>(getInsetByCode(Inset::REF_CODE));
if (inset)
label = inset->getContents();
}
if (!label.empty()) {
owner->currentView()->savePosition();
owner->view()->savePosition();
owner->buffer()->gotoLabel(label.c_str());
}
}
@ -1286,8 +1353,8 @@ string LyXFunc::Dispatch(int ac,
// --- Cursor Movements -----------------------------
case LFUN_RIGHT:
{
Buffer *tmpbuffer = owner->buffer();
LyXText *tmptext = owner->buffer()->text;
Buffer * tmpbuffer = owner->buffer();
LyXText * tmptext = owner->buffer()->text;
if(!tmptext->mark_set)
BeforeChange();
tmpbuffer->update(-2);
@ -1296,7 +1363,7 @@ string LyXFunc::Dispatch(int ac,
== LyXParagraph::META_INSET
&& tmptext->cursor.par->GetInset(tmptext->cursor.pos)
&& tmptext->cursor.par->GetInset(tmptext->cursor.pos)->Editable() == 2){
Inset* tmpinset = tmptext->cursor.par->GetInset(tmptext->cursor.pos);
Inset * tmpinset = tmptext->cursor.par->GetInset(tmptext->cursor.pos);
setMessage(tmpinset->EditMessage());
tmpinset->Edit(0, 0);
break;
@ -1312,7 +1379,7 @@ string LyXFunc::Dispatch(int ac,
{
// This is soooo ugly. Isn`t it possible to make
// it simpler? (Lgb)
LyXText *txt= owner->buffer()->text;
LyXText * txt = owner->buffer()->text;
if(!txt->mark_set) BeforeChange();
owner->buffer()->update(-2);
txt->CursorLeft();
@ -1321,11 +1388,10 @@ string LyXFunc::Dispatch(int ac,
== LyXParagraph::META_INSET
&& txt->cursor.par->GetInset(txt->cursor.pos)
&& txt->cursor.par->GetInset(txt->cursor.pos)->Editable() == 2) {
Inset* tmpinset = txt->cursor.par->GetInset(txt->cursor.pos);
Inset * tmpinset = txt->cursor.par->GetInset(txt->cursor.pos);
setMessage(tmpinset->EditMessage());
tmpinset->Edit(tmpinset->Width(txt->GetFont(txt->cursor.par,
txt->cursor.pos)), 0);
// tmpinset->Edit(-1, 0); // -1 means go rightmost
break;
}
owner->buffer()->text->FinishUndo();
@ -1377,7 +1443,7 @@ string LyXFunc::Dispatch(int ac,
if(!owner->buffer()->text->mark_set)
BeforeChange();
owner->buffer()->update(-3);
owner->currentView()->cursorPrevious();
owner->view()->cursorPrevious();
owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
@ -1387,7 +1453,7 @@ string LyXFunc::Dispatch(int ac,
if(!owner->buffer()->text->mark_set)
BeforeChange();
owner->buffer()->update(-3);
owner->currentView()->cursorNext();
owner->view()->cursorNext();
owner->buffer()->text->FinishUndo();
moveCursorUpdate(false);
owner->getMiniBuffer()->Set(CurrentState());
@ -1515,7 +1581,7 @@ string LyXFunc::Dispatch(int ac,
case LFUN_PRIORSEL:
owner->buffer()->update(-2);
owner->currentView()->cursorPrevious();
owner->view()->cursorPrevious();
owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
@ -1523,7 +1589,7 @@ string LyXFunc::Dispatch(int ac,
case LFUN_NEXTSEL:
owner->buffer()->update(-2);
owner->currentView()->cursorNext();
owner->view()->cursorNext();
owner->buffer()->text->FinishUndo();
moveCursorUpdate(true);
owner->getMiniBuffer()->Set(CurrentState());
@ -1619,7 +1685,7 @@ string LyXFunc::Dispatch(int ac,
SmallUpdate(1);
// It is possible to make it a lot faster still
// just comment out the lone below...
owner->currentView()->getScreen()->ShowCursor();
owner->view()->getScreen()->ShowCursor();
} else {
CutCB();
}
@ -1731,7 +1797,7 @@ string LyXFunc::Dispatch(int ac,
SmallUpdate(1);
// It is possible to make it a lot faster still
// just comment out the lone below...
owner->currentView()->getScreen()->ShowCursor();
owner->view()->getScreen()->ShowCursor();
}
} else {
CutCB();
@ -1836,7 +1902,7 @@ string LyXFunc::Dispatch(int ac,
case LFUN_HTMLURL:
case LFUN_URL:
{
InsetCommand *new_inset;
InsetCommand * new_inset;
if (action == LFUN_HTMLURL)
new_inset = new InsetUrl("htmlurl", "", "");
else
@ -1930,9 +1996,9 @@ string LyXFunc::Dispatch(int ac,
// Either change buffer or load the file
if (bufferlist.exists(s))
owner->currentView()->buffer(bufferlist.getBuffer(s));
owner->view()->buffer(bufferlist.getBuffer(s));
else
owner->currentView()->buffer(bufferlist.loadLyXFile(s));
owner->view()->buffer(bufferlist.loadLyXFile(s));
// Set the cursor
owner->buffer()->setCursorFromRow(row);
@ -1940,16 +2006,16 @@ string LyXFunc::Dispatch(int ac,
// Recenter screen
BeforeChange();
if (owner->buffer()->text->cursor.y >
owner->currentView()->getWorkArea()->h / 2) {
owner->currentView()->getScreen()->
owner->view()->getWorkArea()->h / 2) {
owner->view()->getScreen()->
Draw(owner->buffer()->text->cursor.y -
owner->currentView()->getWorkArea()->h/2);
owner->view()->getWorkArea()->h/2);
} else { // <=
owner->currentView()->getScreen()->
owner->view()->getScreen()->
Draw(0);
}
owner->buffer()->update(0);
owner->currentView()->redraw();
owner->view()->redraw();
}
break;
@ -2081,7 +2147,7 @@ string LyXFunc::Dispatch(int ac,
case LFUN_MATH_DELIM:
case LFUN_INSERT_MATRIX:
{
if (owner->currentView()->available()) {
if (owner->view()->available()) {
owner->buffer()->
open_new_inset(new InsetFormula(false));
owner->buffer()->
@ -2098,14 +2164,14 @@ string LyXFunc::Dispatch(int ac,
case LFUN_MATH_DISPLAY:
{
if (owner->currentView()->available())
if (owner->view()->available())
owner->buffer()->open_new_inset(new InsetFormula(true));
break;
}
case LFUN_MATH_MACRO:
{
if (owner->currentView()->available()) {
if (owner->view()->available()) {
string s(argument);
if (s.empty())
setErrorMessage(N_("Missing argument"));
@ -2122,7 +2188,7 @@ string LyXFunc::Dispatch(int ac,
case LFUN_MATH_MODE: // Open or create a math inset
{
if (owner->currentView()->available())
if (owner->view()->available())
owner->buffer()->open_new_inset(new InsetFormula);
setMessage(N_("Math editor mode"));
}
@ -2290,11 +2356,11 @@ string LyXFunc::Dispatch(int ac,
OnlyPath(owner->buffer()->getFileName()));
setMessage(N_("Opening child document ") +
MakeDisplayPath(filename) + "...");
owner->currentView()->savePosition();
owner->view()->savePosition();
if (bufferlist.exists(filename))
owner->currentView()->buffer(bufferlist.getBuffer(filename));
owner->view()->buffer(bufferlist.getBuffer(filename));
else
owner->currentView()->buffer(bufferlist.loadLyXFile(filename));
owner->view()->buffer(bufferlist.loadLyXFile(filename));
}
break;
@ -2433,7 +2499,7 @@ string LyXFunc::Dispatch(int ac,
} // end of switch
exit_with_message:
string res= getMessage();
string res = getMessage();
if (res.empty()) {
if (!commandshortcut.empty()) {
@ -2449,7 +2515,7 @@ string LyXFunc::Dispatch(int ac,
+ " " + commandshortcut);
}
return getMessage();
return res;
}
@ -2465,7 +2531,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
string fname, initpath = lyxrc->document_path;
LyXFileDlg fileDlg;
if (owner->currentView()->available()) {
if (owner->view()->available()) {
string trypath = owner->buffer()->filepath;
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath) == 1)
@ -2504,7 +2570,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
return;
break;
case 2: // No: switch to the open document
owner->currentView()->buffer(bufferlist.getBuffer(s));
owner->view()->buffer(bufferlist.getBuffer(s));
return;
case 3: // Cancel: Do nothing
owner->getMiniBuffer()->Set(_("Canceled."));
@ -2523,7 +2589,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
owner->getMiniBuffer()->Set(_("Opening document"),
MakeDisplayPath(s), "...");
XFlush(fl_display);
owner->currentView()->buffer(
owner->view()->buffer(
bufferlist.loadLyXFile(s));
owner->getMiniBuffer()->Set(_("Document"),
MakeDisplayPath(s),
@ -2545,7 +2611,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
// find a free buffer
lyxerr.debug() << "Find a free buffer." << endl;
owner->currentView()->buffer(bufferlist.newFile(s, templname));
owner->view()->buffer(bufferlist.newFile(s, templname));
}
@ -2554,7 +2620,7 @@ void LyXFunc::MenuOpen()
string initpath = lyxrc->document_path;
LyXFileDlg fileDlg;
if (owner->currentView()->available()) {
if (owner->view()->available()) {
string trypath = owner->buffer()->filepath;
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath) == 1)
@ -2587,7 +2653,7 @@ void LyXFunc::MenuOpen()
MakeDisplayPath(filename), "...");
Buffer * openbuf = bufferlist.loadLyXFile(filename);
if (openbuf) {
owner->currentView()->buffer(openbuf);
owner->view()->buffer(openbuf);
owner->getMiniBuffer()->Set(_("Document"),
MakeDisplayPath(filename),
_("opened."));
@ -2603,7 +2669,7 @@ void LyXFunc::doImportASCII(bool linorpar)
string initpath = lyxrc->document_path;
LyXFileDlg fileDlg;
if (owner->currentView()->available()) {
if (owner->view()->available()) {
string trypath = owner->buffer()->filepath;
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath) == 1)
@ -2643,7 +2709,7 @@ void LyXFunc::doImportASCII(bool linorpar)
return;
break;
case 2: // No: switch to the open document
owner->currentView()->buffer(bufferlist.getBuffer(s));
owner->view()->buffer(bufferlist.getBuffer(s));
return;
case 3: // Cancel: Do nothing
owner->getMiniBuffer()->Set(_("Canceled."));
@ -2660,7 +2726,7 @@ void LyXFunc::doImportASCII(bool linorpar)
return;
}
owner->currentView()->buffer(bufferlist.newFile(s, string()));
owner->view()->buffer(bufferlist.newFile(s, string()));
owner->getMiniBuffer()->Set(_("Importing ASCII file"),
MakeDisplayPath(filename), "...");
// Insert ASCII file
@ -2676,7 +2742,7 @@ void LyXFunc::doImportLaTeX(bool isnoweb)
string initpath = lyxrc->document_path;
LyXFileDlg fileDlg;
if (owner->currentView()->available()) {
if (owner->view()->available()) {
string trypath = owner->buffer()->filepath;
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath) == 1)
@ -2722,7 +2788,7 @@ void LyXFunc::doImportLaTeX(bool isnoweb)
return;
break;
case 2: // No: switch to the open document
owner->currentView()->buffer(
owner->view()->buffer(
bufferlist.getBuffer(LyXfilename));
return;
case 3: // Cancel: Do nothing
@ -2754,7 +2820,7 @@ void LyXFunc::doImportLaTeX(bool isnoweb)
openbuf = myImport.run();
}
if (openbuf) {
owner->currentView()->buffer(openbuf);
owner->view()->buffer(openbuf);
owner->getMiniBuffer()->Set(isnoweb ?
_("Noweb file ") : _("LateX file "),
MakeDisplayPath(filename),
@ -2777,7 +2843,7 @@ void LyXFunc::MenuInsertLyXFile(string const & filen)
string initpath = lyxrc->document_path;
LyXFileDlg fileDlg;
if (owner->currentView()->available()) {
if (owner->view()->available()) {
string trypath = owner->buffer()->filepath;
// If directory is writeable, use this as default.
if (IsDirWriteable(trypath) == 1)
@ -2825,7 +2891,7 @@ void LyXFunc::reloadBuffer()
{
string fn = owner->buffer()->getFileName();
if (bufferlist.close(owner->buffer()))
owner->currentView()->buffer(bufferlist.loadLyXFile(fn));
owner->view()->buffer(bufferlist.loadLyXFile(fn));
}
@ -2839,7 +2905,7 @@ void LyXFunc::CloseBuffer()
CloseAllBufferRelatedPopups();
}
else {
owner->currentView()->buffer(bufferlist.first());
owner->view()->buffer(bufferlist.first());
}
}
}
@ -2873,7 +2939,7 @@ Inset * LyXFunc::getInsetByCode(Inset::Code code)
// This func is bit problematic when it comes to NLS, to make the
// lyx servers client be language indepenent we must not translate
// strings sent to this func.
void LyXFunc::setErrorMessage(string const &m)
void LyXFunc::setErrorMessage(string const & m) const
{
dispatch_buffer = m;
errorstat = true;

View File

@ -8,10 +8,9 @@
#include "commandtags.h"
#include "kbmap.h"
#include "tex-accent.h"
#include "LyXAction.h"
#include "insets/lyxinset.h"
#include "LString.h"
class LyXView;
/** This class encapsulates all the LyX command operations.
@ -22,62 +21,60 @@ class LyXView;
*/
class LyXFunc {
public:
/// The status of a function.
enum func_status {
OK = 0, // No problem
Unknown = 1,
Disabled = 2, // Command cannot be executed
ToggleOn = 4,
ToggleOff = 8
};
///
LyXFunc(LyXView*);
///
~LyXFunc();
LyXFunc(LyXView *);
/// LyX distpatcher, executes lyx actions.
string Dispatch(int action, char const* arg = 0);
string Dispatch(int action, char const * arg = 0);
/// The same but uses the name of a lyx command.
string Dispatch(string const &cmd);
string Dispatch(string const & cmd);
/// A keyboard event is processed to execute a lyx action.
int processKeyEvent(XEvent *ev);
int processKeyEvent(XEvent * ev);
///
func_status getStatus(int ac) const;
/// The last key was meta
bool wasMetaKey();
bool wasMetaKey() const;
// These can't be global because are part of the internat state (ale970227)
/// Get the current keyseq string
string keyseqStr(int l = 190);
string keyseqStr(int l = 190) const;
/// Is the key sequence uncomplete?
bool keyseqUncomplete();
bool keyseqUncomplete() const;
/// get options for the current keyseq
string keyseqOptions(int l = 190);
/// Returns the name of a funcion given a keyseq
char const* getFunc(char*)
{ /* unimplemented */ return 0; }
/// Return a string with the keybind to an action, if any
char const* getKeybind(int)
{ /* unimplemented */ return 0; }
string keyseqOptions(int l = 190) const;
/// True if lyxfunc reports an error
bool errorStat() const { return errorstat; }
/// Buffer to store result messages
void setMessage(string const &m);
void setMessage(string const & m);
/// Buffer to store result messages
void setErrorMessage(string const &);
void setErrorMessage(string const &) const;
/// Buffer to store result messages
string getMessage() const { return dispatch_buffer; }
/// Get next inset of this class from current cursor position
Inset* getInsetByCode(Inset::Code);
Inset * getInsetByCode(Inset::Code);
/// Should a hint message be displayed?
void setHintMessage(bool);
private:
///
LyXView *owner;
///
static kb_func_table* lyx_func_table;
///
static kb_func_table *lyx_func_args;
LyXView * owner;
///
static int psd_idx;
///
@ -95,12 +92,12 @@ private:
///
kb_action lyx_calling_dead_action;
/// Error status, only Dispatch can change this flag
bool errorstat;
mutable bool errorstat;
/** Buffer to store messages and result data. Is there a
good reason to have this one as static in Dispatch? (Ale)
*/
string dispatch_buffer;
mutable string dispatch_buffer;
/// Command name and shortcut information
string commandshortcut;
@ -133,14 +130,14 @@ private:
/*-------------------- inlines --------------------------*/
inline
bool LyXFunc::wasMetaKey()
bool LyXFunc::wasMetaKey() const
{
return (meta_fake_bit != 0);
}
inline
string LyXFunc::keyseqStr(int l)
string LyXFunc::keyseqStr(int l) const
{
char text[200];
keyseq.print(text, l, true);
@ -150,7 +147,7 @@ string LyXFunc::keyseqStr(int l)
inline
string LyXFunc::keyseqOptions(int l)
string LyXFunc::keyseqOptions(int l) const
{
char text[200];
keyseq.printOptions(text, l);
@ -160,7 +157,7 @@ string LyXFunc::keyseqOptions(int l)
inline
bool LyXFunc::keyseqUncomplete()
bool LyXFunc::keyseqUncomplete() const
{
return (keyseq.length > 0);
}

View File

@ -28,14 +28,16 @@ static XIC xic;
XComposeStatus compose_status= {0, 0};
// This is called after the main LyX window has been created
void InitLyXLookup(Display* display, Window window)
void InitLyXLookup(Display * display, Window window)
{
xic = 0;
// This part could be done before opening display
setlocale(LC_CTYPE, "");
if (!XSupportsLocale()) {
lyxerr.debug() << "InitLyXLookup: X does not support this locale." << endl;
lyxerr.debug()
<< "InitLyXLookup: X does not support this locale."
<< endl;
return;
}
if (!XSetLocaleModifiers("")) {
@ -43,15 +45,15 @@ void InitLyXLookup(Display* display, Window window)
"for this locale." << endl;
return;
}
// This part will have to be done for each frame
xim = XOpenIM (display, 0, 0, 0);
if (xim) {
xic = XCreateIC (xim,
XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
XNClientWindow, window,
XNFocusWindow, window,
0);
xic = XCreateIC(xim, XNInputStyle,
XIMPreeditNothing | XIMStatusNothing,
XNClientWindow, window,
XNFocusWindow, window,
0);
if (!xic) {
lyxerr.debug() << "InitLyXLookup: could not create "
@ -63,14 +65,13 @@ void InitLyXLookup(Display* display, Window window)
else
lyxerr.debug() << "InitLyXLookup: could not open "
"an input method." << endl;
}
static
bool isDeadEvent(XEvent *event,
char *buffer_return, int bytes_buffer,
KeySym *keysym_return)
bool isDeadEvent(XEvent * event,
char * buffer_return, int bytes_buffer,
KeySym * keysym_return)
{
XLookupString(&event->xkey, buffer_return,
bytes_buffer, keysym_return,
@ -136,9 +137,9 @@ bool isDeadEvent(XEvent *event,
// This is called instead of XLookupString()
int LyXLookupString(XEvent *event,
char *buffer_return, int bytes_buffer,
KeySym *keysym_return)
int LyXLookupString(XEvent * event,
char * buffer_return, int bytes_buffer,
KeySym * keysym_return)
{
int result = 0;
if (xic) {
@ -205,16 +206,16 @@ void CloseLyXLookup()
XComposeStatus compose_status= {0, 0};
// This is called after the main LyX window has been created
void InitLyXLookup(Display* , Window )
void InitLyXLookup(Display *, Window )
{
//Nothing to do.
}
// This is called instead of XLookupString(). I this particular case,
// this *is* XLookupString...
int LyXLookupString(XEvent *event,
char *buffer_return, int bytes_buffer,
KeySym *keysym_return)
int LyXLookupString(XEvent * event,
char * buffer_return, int bytes_buffer,
KeySym * keysym_return)
{
return XLookupString(&event->xkey, buffer_return,
bytes_buffer, keysym_return,
@ -227,5 +228,4 @@ void CloseLyXLookup()
// Nothing to do
}
#endif // HAVE_XOPENIM

View File

@ -16,13 +16,12 @@
#include <X11/Xlib.h>
// Initialize the compose key handling
extern void InitLyXLookup(Display* , Window ) ;
extern void InitLyXLookup(Display *, Window ) ;
// Read a keysym and/or a string (like XLookupString)
extern int LyXLookupString(XEvent *event,
char *buffer_return, int bytes_buffer,
KeySym *keysym_return);
extern int LyXLookupString(XEvent * event,
char * buffer_return, int bytes_buffer,
KeySym * keysym_return);
// Call this when you destroy your window
extern void CloseLyXLookup();

View File

@ -29,6 +29,7 @@
#include "table.h"
#include "vspace.h"
#include "layout.h"
#include "support/block.h"
class BufferParams;
class LyXBuffer;
@ -126,12 +127,12 @@ public:
void validate(LaTeXFeatures &);
///
int GetID(){
return id;
int id() const {
return id_;
}
///
void SetID(int id_arg){
id = id_arg;
void id(int id_arg) {
id_ = id_arg;
}
///
@ -151,17 +152,17 @@ public:
int & foot_count);
///
LyXParagraph * Clone();
LyXParagraph * Clone() const;
///
bool HasSameLayout(LyXParagraph * par);
bool HasSameLayout(LyXParagraph const * par);
///
void MakeSameLayout(LyXParagraph * par);
void MakeSameLayout(LyXParagraph const * par);
/// Is it the first par with same depth and layout?
bool IsFirstInSequence() {
LyXParagraph * dhook = DepthHook(GetDepth());
bool IsFirstInSequence() const {
LyXParagraph const * dhook = DepthHook(GetDepth());
return (dhook == this
|| dhook->GetLayout() != GetLayout()
|| dhook->GetDepth() != GetDepth());
@ -172,8 +173,7 @@ public:
typedef char value_type;
///
typedef vector<value_type> TextContainer;
//typedef deque<char> TextContainer;
//typedef rope<char> TextContainer;
///
typedef int size_type;
///
TextContainer text;
@ -224,13 +224,12 @@ public:
bool noindent;
private:
///
int counter[10];
block<int, 10> counter_;
public:
///
void setCounter(int i, int v) { counter[i] = v; }
int getCounter(int i) { return counter[i]; }
void incCounter(int i) { counter[i]++; }
void setCounter(int i, int v) { counter_[i] = v; }
int getCounter(int i) const { return counter_[i]; }
void incCounter(int i) { counter_[i]++; }
///
bool start_of_appendix;
@ -283,49 +282,57 @@ public:
///
LyXParagraph * Previous();
///
LyXParagraph const * Previous() const;
/** these function are able to hide open and closed footnotes
*/
LyXParagraph * NextAfterFootnote();
///
LyXParagraph * NextAfterFootnote() const;
LyXParagraph const * NextAfterFootnote() const;
///
LyXParagraph * PreviousBeforeFootnote();
///
LyXParagraph * LastPhysicalPar();
///
LyXParagraph * FirstPhysicalPar();
///
LyXParagraph const * FirstPhysicalPar() const;
/// returns the physical paragraph
LyXParagraph * ParFromPos(size_type pos);
/// returns the position in the physical par
int PositionInParFromPos(size_type pos);
int PositionInParFromPos(size_type pos) const;
/// for the environments
LyXParagraph * DepthHook(int depth);
/// for the environments
LyXParagraph const * DepthHook(int depth) const;
///
int BeginningOfMainBody();
int BeginningOfMainBody() const;
///
string GetLabestring();
string GetLabestring() const;
/// the next two functions are for the manual labels
string GetLabelWidthString();
string GetLabelWidthString() const;
///
void SetLabelWidthString(string const & s);
///
LyXTextClass::LayoutList::size_type GetLayout();
LyXTextClass::LayoutList::size_type GetLayout() const;
///
char GetAlign();
char GetAlign() const;
///
char GetDepth();
char GetDepth() const;
///
void SetLayout(LyXTextClass::LayoutList::size_type new_layout);
///
void SetOnlyLayout(LyXTextClass::LayoutList::size_type new_layout);
///
int GetFirstCounter(int i);
int GetFirstCounter(int i) const;
///
size_type Last();
size_type Last() const;
///
void Erase(size_type pos);
/** the flag determines wether the layout should be copied
@ -337,7 +344,7 @@ public:
between the characters font and the layoutfont.
This is what is stored in the fonttable
*/
LyXFont GetFontSettings(size_type pos);
LyXFont GetFontSettings(size_type pos) const;
/** Get fully instantiated font. If pos == -1, use the layout
font attached to this paragraph.
If pos == -2, use the label font of the layout attached here.
@ -345,7 +352,7 @@ public:
attributes with values LyXFont::INHERIT, LyXFont::IGNORE or
LyXFont::TOGGLE.
*/
LyXFont getFont(size_type pos);
LyXFont getFont(size_type pos) const;
///
char GetChar(size_type pos);
///
@ -353,7 +360,7 @@ public:
///
void SetFont(size_type pos, LyXFont const & font);
///
string GetWord(size_type &);
string GetWord(size_type &) const;
/// Returns the height of the highest font in range
LyXFont::FONT_SIZE HighestFontInRange(size_type startpos,
size_type endpos) const;
@ -364,13 +371,15 @@ public:
///
Inset * GetInset(size_type pos);
///
Inset const * GetInset(size_type pos) const;
///
Inset * ReturnNextInsetPointer(size_type & pos);
///
void OpenFootnote(size_type pos);
///
void CloseFootnote(size_type pos);
/// important for cut and paste
void CopyIntoMinibuffer(size_type pos);
void CopyIntoMinibuffer(size_type pos) const;
///
void CutIntoMinibuffer(size_type pos);
///
@ -409,7 +418,7 @@ public:
int AutoDeleteInsets();
/// returns -1 if inset not found
int GetPositionOfInset(Inset * inset);
int GetPositionOfInset(Inset * inset) const;
/// ok and now some footnote functions
void OpenFootnotes();
@ -440,7 +449,7 @@ public:
one (or more) paragraphs with the footnote, and finally
the a paragraph with the text after the footnote. Only the
first paragraph keeps information about layoutparameters, */
bool IsDummy(){
bool IsDummy() const{
return (footnoteflag == LyXParagraph::NO_FOOTNOTE && previous
&& previous->footnoteflag != LyXParagraph::NO_FOOTNOTE);
}
@ -545,7 +554,7 @@ private:
size_type & i,
int & column, char const c);
///
int id;
unsigned int id_;
///
static unsigned int paragraph_id;
};

View File

@ -54,6 +54,7 @@
#include "lyxfunc.h"
#include "lyx_main.h"
#include "debug.h"
#include "LyXAction.h"
#include "support/lstrings.h"
#ifdef __EMX__
@ -118,7 +119,7 @@ void LyXComm::openConnection() {
lyxerr << "LyXComm: Pipe " << tmp << " already exists.\n"
<< "If no other LyX program is active, please delete"
" the pipe by hand and try again." << endl;
pipename = string();
pipename.clear();
return;
}
#ifndef __EMX__
@ -169,7 +170,7 @@ void LyXComm::openConnection() {
lyxerr << "LyXComm: Pipe " << tmp << " already exists.\n"
<< "If no other LyX program is active, please delete"
" the pipe by hand and try again." << endl;
pipename = string();
pipename.clear();
return;
}
#ifndef __EMX__
@ -289,7 +290,7 @@ void LyXComm::closeConnection() {
// Receives messages and sends then to client
void LyXComm::callback(int fd, void *v)
{
LyXComm * c = (LyXComm *) v;
LyXComm * c = static_cast<LyXComm*>(v);
if (lyxerr.debugging(Debug::LYXSERVER)) {
lyxerr << "LyXComm: Receiving from fd " << fd << endl;

View File

@ -134,9 +134,7 @@ public:
/// completes the insertion with a full rebreak
int FullRebreak();
/// may be important for the menu
char * GetLayout(int row);
///
LyXParagraph::footnote_flag GetFootnoteFlag(int row);
///
@ -268,16 +266,13 @@ public:
void DeleteLineForward();
///
int SelectWordWhenUnderCursor();
/// Change the case of the word at cursor position
/** Change the case of the word at cursor position.
action is 0 for lower case, 1 for capitalization and 2 for
uppercase.
*/
enum TextCase {
text_lowercase = 0,
text_capitalization = 1,
text_uppercase = 2
};
/// Change the case of the word at cursor position.
void ChangeWordCase(TextCase action);
/** returns a printed row in a pixmap. The y value is needed to
@ -419,7 +414,7 @@ public:
///
void BackspaceInTable();
///
char HitInTable(Row * row, int x);
bool HitInTable(Row * row, int x);
///
bool MouseHitInTable(int x, long y);
/* table stuff -- end*/
@ -461,9 +456,9 @@ public:
///
void RemoveTableRow(LyXCursor * cursor);
///
bool IsEmptyTableRow(LyXCursor * cursor);
bool IsEmptyTableRow(LyXCursor * cursor) const;
///
bool IsEmptyTableCell();
bool IsEmptyTableCell() const;
///
void toggleAppendix();
@ -549,7 +544,7 @@ private:
int LabelFill(Row * row);
///
LyXParagraph::size_type BeginningOfMainBody(LyXParagraph * par);
LyXParagraph::size_type BeginningOfMainBody(LyXParagraph * par) const;
/** Returns the left beginning of the text.
This information cannot be taken from the layouts-objekt, because
in LaTeX the beginning of the text fits in some cases

View File

@ -1,4 +1,6 @@
Makefile.in
Makefile
*.deps
*.lo
.libs
libmathed.la

View File

@ -1,12 +1,11 @@
AUTOMAKE_OPTIONS = foreign
AUTOMAKE_OPTIONS = foreign 1.4
MAINTAINERCLEANFILES = Makefile.in
noinst_PROGRAMS = mathed.o
pkglib_LTLIBRARIES = libmathed.la
LIBS=
ETAGS_ARGS = --c++
INCLUDES = -I${top_srcdir}/images -I${srcdir}/../
CXXLINK = $(LD) $(LDFLAGS) -r -o $(noinst_PROGRAMS)
mathed_o_SOURCES = array.h \
libmathed_la_SOURCES = array.h \
formula.C \
formula.h \
formulamacro.C \

View File

@ -315,11 +315,11 @@ InsetFormula::~InsetFormula()
//if (label) delete label;
}
Inset* InsetFormula::Clone()
InsetFormula * InsetFormula::Clone() const
{
InsetFormula* f = new InsetFormula(par);
InsetFormula * f = new InsetFormula(par);
f->label = label;
return (Inset*)f;
return f;
}
void InsetFormula::Write(FILE *file)
@ -572,7 +572,7 @@ void InsetFormula::ToggleInsetSelection()
}
void InsetFormula::SetDisplay(bool dspf)
void InsetFormula::display(bool dspf)
{
if (dspf!= disp_flag) {
if (dspf) {
@ -580,7 +580,7 @@ void InsetFormula::SetDisplay(bool dspf)
par->SetStyle(LM_ST_DISPLAY);
} else {
if (par->GetType()>= LM_OT_MPAR) {
MathParInset *p = new MathParInset(par);
MathParInset * p = new MathParInset(par);
delete par;
par = p;
if (mathcursor)
@ -602,9 +602,9 @@ int InsetFormula::GetNumberOfLabels() const
{
// This is dirty, I know. I'll clean it at 0.13
if (par->GetType() == LM_OT_MPARN) {
MathMatrixInset *mt = (MathMatrixInset*)par;
int nl= 0;
MathedRowSt const* crow = mt->getRowSt();
MathMatrixInset * mt = (MathMatrixInset*)par;
int nl = 0;
MathedRowSt const * crow = mt->getRowSt();
while (crow) {
if (crow->getLabel()) nl++;
crow = crow->getNext();
@ -1046,7 +1046,7 @@ bool InsetFormula::LocalDispatch(int action, char const *arg)
case LFUN_MATH_DISPLAY:
//LockedInsetStoreUndo(Undo::INSERT);
LockedInsetStoreUndo(Undo::EDIT);
SetDisplay(!disp_flag);
display(!disp_flag);
UpdateLocal();
break;

View File

@ -59,7 +59,7 @@ public:
///
void Validate(LaTeXFeatures &) const;
///
Inset * Clone();
InsetFormula * Clone() const;
///
Inset::Code LyxCode() const { return Inset::MATH_CODE; }
///
@ -74,9 +74,9 @@ public:
///
void Edit(int x, int y);
///
bool Display() const { return (disp_flag) ? true: false; }
bool display() const { return (disp_flag) ? true: false; }
///
void SetDisplay(bool);
void display(bool);
///
void ToggleInsetCursor();
///

View File

@ -60,10 +60,9 @@ InsetFormulaMacro::~InsetFormulaMacro()
}
Inset* InsetFormulaMacro::Clone()
InsetFormulaMacro * InsetFormulaMacro::Clone() const
{
InsetFormulaMacro* f = new InsetFormulaMacro(name);
return (Inset*)f;
return new InsetFormulaMacro(name);
}

View File

@ -61,7 +61,7 @@ public:
///
int DocBook(string &file);
///
Inset* Clone();
InsetFormulaMacro * Clone() const;
/// what appears in the minibuffer when opening
char const* EditMessage() {return "Math macro editor mode";}

View File

@ -31,13 +31,16 @@
#include "array.h"
///
#define MATH_ALIGN_LEFT 1
///
#define MATH_ALIGN_RIGHT 2
///
#define MATH_ALIGN_BOTTOM 4
///
#define MATH_ALIGN_TOP 8
enum math_align {
///
MATH_ALIGN_LEFT = 1,
///
MATH_ALIGN_RIGHT = 2,
///
MATH_ALIGN_BOTTOM = 4,
///
MATH_ALIGN_TOP = 8
};
///
#define MATH_COLSEP 8
///
@ -47,7 +50,7 @@
/// Standard Math Sizes (Math mode styles)
enum MathedStyles {
///
LM_ST_DISPLAY= 0,
LM_ST_DISPLAY = 0,
///
LM_ST_TEXT,
///
@ -60,7 +63,7 @@ enum MathedStyles {
/// Standard LaTeX Math Environments
enum MathedEnvironment {
///
LM_EN_INTEXT= 0,
LM_EN_INTEXT = 0,
///
LM_EN_DISPLAY,
///
@ -204,7 +207,6 @@ enum MathedBinaryTypes {
LMB_BOP = (LMB_RELATION | LMB_OPERATOR)
};
class LString;
class MathedInset;
class MathParInset;
@ -217,25 +219,25 @@ class MathParInset;
class MathedInset {
public:
/// A math inset has a name (usually its LaTeX name), type and font-size
MathedInset(char const *nm, short ot, short st);
MathedInset(char const * nm, short ot, short st);
///
MathedInset(MathedInset*);
MathedInset(MathedInset *);
///
virtual ~MathedInset() { };
virtual ~MathedInset() {}
/// Draw the object
virtual void Draw(int x, int baseline)= 0;
virtual void Draw(int x, int baseline) = 0;
/// Write LaTeX and Lyx code
virtual void Write(FILE *file)= 0;
virtual void Write(FILE * file) = 0;
/// Write LaTeX and Lyx code
virtual void Write(string & file)= 0;
virtual void Write(string & file) = 0;
/// Reproduces itself
virtual MathedInset *Clone()= 0;
virtual MathedInset * Clone() = 0;
/// Compute the size of the object
virtual void Metrics()= 0;
virtual void Metrics() = 0;
///
virtual int Ascent() const { return ascent; }
///
@ -248,10 +250,10 @@ class MathedInset {
///
virtual bool GetLimits() const { return false; }
///
virtual void SetLimits(bool) { }
virtual void SetLimits(bool) {}
///
char const *GetName() const { return name; }
char const * GetName() const { return name; }
///
short GetType() const { return objtype; }
///
@ -263,13 +265,13 @@ class MathedInset {
///
virtual void SetStyle(short st) { size = st; } // Metrics();
///
virtual void SetName(char const* n) { name = n; }
virtual void SetName(char const * n) { name = n; }
///
void setDrawable(long unsigned int d) { pm = d; }
protected:
///
char const *name;
char const * name;
///
short objtype;
///
@ -287,7 +289,7 @@ class MathedInset {
static int df_asc, df_des, df_width;
/// In a near future maybe we use a better fonts renderer than X
void drawStr(short, int, int, int, byte*, int);
void drawStr(short, int, int, int, byte *, int);
///
friend class MathedCursor;
///
@ -319,21 +321,22 @@ enum MathedParFlag {
class MathParInset: public MathedInset {
public:
///
MathParInset(short st= LM_ST_TEXT, char const *nm= 0, short ot= LM_OT_MIN);
MathParInset(short st= LM_ST_TEXT, char const * nm= 0,
short ot= LM_OT_MIN);
///
MathParInset(MathParInset*);
MathParInset(MathParInset *);
///
virtual ~MathParInset();
///
virtual MathedInset *Clone();
virtual MathedInset * Clone();
/// Draw the object on a drawable
virtual void Draw(int x, int baseline);
/// Write LaTeX code
virtual void Write(FILE *file);
virtual void Write(FILE * file);
/// Write LaTeX code
virtual void Write(string &file);
virtual void Write(string & file);
///
virtual void Metrics();
///
@ -345,17 +348,17 @@ class MathParInset: public MathedInset {
virtual LyxArrayBase * GetData() { return array; }
/// Paragraph position
virtual void GetXY(int&, int&) const;
virtual void GetXY(int &, int &) const;
///
virtual void setXY(int x, int y) { xo = x; yo = y; }
///
virtual void SetFocus(int, int) { };
virtual void SetFocus(int, int) {}
///
virtual bool Inside(int, int);
// Tab stuff used by Matrix.
///
virtual void SetAlign(char, char const*) { };
virtual void SetAlign(char, char const *) {}
// ///
// virtual int GetTabPos() { return 0; }
// ///
@ -380,19 +383,19 @@ class MathParInset: public MathedInset {
///
virtual int getMaxArgumentIdx() { return 0; }
// ///
// virtual void SetLabel(char const*) { }
// virtual void SetLabel(char const *) {}
///
virtual void SetStyle(short);
///
virtual MathedRowSt *getRowSt() const { return 0; }
virtual MathedRowSt * getRowSt() const { return 0; }
///
virtual void setRowSt(MathedRowSt*) { }
virtual void setRowSt(MathedRowSt *) {}
///
virtual bool Permit(short f) { return (bool)(f & flag); }
virtual bool Permit(short f) { return bool(f & flag); }
protected:
/// Paragraph data is stored here
LyxArrayBase *array;
LyxArrayBase * array;
/// Cursor start position
int xo, yo;
///
@ -408,7 +411,9 @@ class MathParInset: public MathedInset {
///
friend class MathedCursor;
///
friend LyxArrayBase *mathed_parse(unsigned flags = 0, LyxArrayBase*a= 0, MathParInset**p= 0);
friend LyxArrayBase * mathed_parse(unsigned flags = 0,
LyxArrayBase * a = 0,
MathParInset ** p = 0);
};
@ -419,7 +424,7 @@ class MathParInset: public MathedInset {
struct MathedRowSt {
///
MathedRowSt(int n) {
w = new int[n+1]; // this leaks
w = new int[n + 1]; // this leaks
next = 0;
label = 0;
numbered = true;
@ -430,11 +435,11 @@ struct MathedRowSt {
if (label) delete[] label;
}
/// Should be const but...
MathedRowSt* getNext() const { return next; }
MathedRowSt * getNext() const { return next; }
/// ...we couldn't use this.
void setNext(MathedRowSt* n) { next = n; }
void setNext(MathedRowSt * n) { next = n; }
///
char const* getLabel() const { return label; }
char const * getLabel() const { return label; }
///
bool isNumbered() const { return numbered; }
///
@ -442,7 +447,7 @@ struct MathedRowSt {
///
int getTab(int i) { return w[i]; }
///
void setLabel(char* l) { label = l; }
void setLabel(char * l) { label = l; }
///
void setNumbered(bool nf) { numbered = nf; }
///
@ -452,13 +457,13 @@ struct MathedRowSt {
/// Vericals
int asc, desc, y;
/// widths
int *w;
int * w;
///
char *label;
char * label;
///
bool numbered;
///
MathedRowSt *next;
MathedRowSt * next;
///
friend class MathMatrixInset;
///
@ -473,27 +478,27 @@ struct MathedRowSt {
class MathMatrixInset: public MathParInset {
public:
///
MathMatrixInset(int m= 1, int n= 1, short st= LM_ST_TEXT);
MathMatrixInset(int m = 1, int n = 1, short st = LM_ST_TEXT);
///
MathMatrixInset(MathMatrixInset*);
MathMatrixInset(MathMatrixInset *);
///
MathedInset *Clone();
MathedInset * Clone();
///
virtual ~MathMatrixInset();
///
void Draw(int, int);
///
void Write(FILE *file);
void Write(FILE * file);
///
void Write(string &file);
void Write(string & file);
///
void Metrics();
///
void SetData(LyxArrayBase *);
///
void SetAlign(char, char const*);
void SetAlign(char, char const *);
///
char *GetAlign(char* vv) {
char * GetAlign(char * vv) {
*vv = v_align;
return h_align;
}
@ -507,21 +512,21 @@ class MathMatrixInset: public MathParInset {
virtual bool isMatrix() { return true; }
/// Use this to manage the extra information independently of paragraph
MathedRowSt *getRowSt() const { return row; }
MathedRowSt * getRowSt() const { return row; }
///
void setRowSt(MathedRowSt* r) { row = r; }
void setRowSt(MathedRowSt * r) { row = r; }
protected:
/// Number of columns & rows
int nc, nr;
/// tab sizes
int *ws;
int * ws;
///
char v_align; // add approp. signedness
///
char* h_align;
char * h_align;
/// Vertical structure
MathedRowSt *row;
MathedRowSt * row;
};
@ -529,52 +534,85 @@ class MathMatrixInset: public MathParInset {
/************************* Prototypes **********************************/
///
LyxArrayBase *mathed_parse(unsigned flags, LyxArrayBase *data, MathParInset **mt);
LyxArrayBase * mathed_parse(unsigned flags, LyxArrayBase * data,
MathParInset ** mt);
///
void mathed_write(MathParInset*, FILE *, int*, char fragile, char const* label= 0);
void mathed_write(MathParInset *, FILE *, int *, char fragile,
char const * label = 0);
///
void mathed_write(MathParInset*, string &, int*, char fragile, char const* label= 0);
void mathed_write(MathParInset *, string &, int *, char fragile,
char const * label = 0);
///
void mathed_parser_file(FILE*, int);
void mathed_parser_file(FILE *, int);
///
int mathed_parser_lineno();
///
int MathedLookupBOP(short);
/************************ Inline functions ********************************/
///
inline bool MathIsInset(short x)
{
return LM_TC_INSET <= x && x <= LM_TC_ACTIVE_INSET;
}
///
#define MathIsInset(x) (LM_TC_INSET<= (x) && (x)<= LM_TC_ACTIVE_INSET)
inline bool MathIsFont(short x)
{
return LM_TC_CONST <= x && x <= LM_TC_BSYM;
}
///
#define MathIsFont(x) (LM_TC_CONST<= (x) && (x)<= LM_TC_BSYM)
inline bool MathIsAlphaFont(short x)
{
return LM_TC_VAR <= x && x <= LM_TC_TEXTRM;
}
///
#define MathIsAlphaFont(x) (LM_TC_VAR<= (x) && (x)<= LM_TC_TEXTRM)
inline bool MathIsActive(short x)
{
return LM_TC_INSET < x && x <= LM_TC_ACTIVE_INSET;
}
///
#define MathIsActive(x) (LM_TC_INSET<(x) && (x)<= LM_TC_ACTIVE_INSET)
inline bool MathIsUp(short x)
{
return x == LM_TC_UP;
}
///
#define MathIsUp(x) ((x) == LM_TC_UP)
inline bool MathIsDown(short x)
{
return x == LM_TC_DOWN;
}
///
#define MathIsDown(x) ((x) == LM_TC_DOWN)
inline bool MathIsScript(short x)
{
return x == LM_TC_DOWN || x == LM_TC_UP;
}
///
#define MathIsScript(x) ((x) == LM_TC_DOWN || (x) == LM_TC_UP)
///
#define MathIsBOPS(x) (MathedLookupBOP(x)>LMB_NONE)
inline bool MathIsBOPS(short x)
{
return MathedLookupBOP(x) > LMB_NONE;
}
///
inline bool MathIsBinary(short x)
{
return (x == LM_TC_BOP || x == LM_TC_BOPS);
return x == LM_TC_BOP || x == LM_TC_BOPS;
}
///
inline bool MathIsSymbol(short x) {
return (LM_TC_SYMB<= x && x<= LM_TC_BSYM);
return LM_TC_SYMB <= x && x <= LM_TC_BSYM;
}
inline
MathedInset::MathedInset(char const *nm, short ot, short st):
MathedInset::MathedInset(char const * nm, short ot, short st):
name(nm), objtype(ot), size(st)
{
width = ascent = descent = 0;
@ -583,12 +621,12 @@ MathedInset::MathedInset(char const *nm, short ot, short st):
inline
bool MathParInset::Inside(int x, int y)
{
return (x>= xo && x<= xo+width && y<= yo+descent && y>= yo-ascent);
return (x >= xo && x <= xo + width && y <= yo + descent && y >= yo - ascent);
}
inline
void MathParInset::GetXY(int& x, int& y) const
void MathParInset::GetXY(int & x, int & y) const
{
x = xo; y = yo;
}
@ -597,7 +635,7 @@ void MathParInset::GetXY(int& x, int& y) const
inline
void MathParInset::UserSetSize(short sz)
{
if (sz>= 0) {
if (sz >= 0) {
size = sz;
flag = flag & ~LMPF_FIXED_SIZE;
}
@ -609,13 +647,12 @@ void MathParInset::SetStyle(short sz)
{
if (Permit(LMPF_FIXED_SIZE)) {
if (Permit(LMPF_SCRIPT))
sz = (sz<LM_ST_SCRIPT) ? LM_ST_SCRIPT: LM_ST_SCRIPTSCRIPT;
sz = (sz < LM_ST_SCRIPT) ? LM_ST_SCRIPT: LM_ST_SCRIPTSCRIPT;
if (Permit(LMPF_SMALLER) && sz < LM_ST_SCRIPTSCRIPT) {
sz++;
++sz;
}
MathedInset::SetStyle(sz);
}
}
#endif

View File

@ -164,9 +164,9 @@ MathDelimInset::MathDelimInset(int l, int r, short st):
{
}
MathedInset *MathDelimInset::Clone()
MathedInset * MathDelimInset::Clone()
{
MathDelimInset* p = new MathDelimInset(left, right, GetStyle());
MathDelimInset * p = new MathDelimInset(left, right, GetStyle());
MathedIter it(array);
p->SetData(it.Copy());
return p;
@ -179,9 +179,9 @@ MathDecorationInset::MathDecorationInset(int d, short st):
upper = (deco!= LM_underline && deco!= LM_underbrace);
}
MathedInset *MathDecorationInset::Clone()
MathedInset * MathDecorationInset::Clone()
{
MathDecorationInset* p = new MathDecorationInset(deco, GetStyle());
MathDecorationInset * p = new MathDecorationInset(deco, GetStyle());
MathedIter it(array);
p->SetData(it.Copy());
return p;
@ -204,9 +204,9 @@ MathFracInset::~MathFracInset()
delete den;
}
MathedInset *MathFracInset::Clone()
MathedInset * MathFracInset::Clone()
{
MathFracInset* p = new MathFracInset(GetType());
MathFracInset * p = new MathFracInset(GetType());
MathedIter itn(array);
MathedIter itd(den->GetData());
p->SetData(itn.Copy(), itd.Copy());

View File

@ -362,7 +362,7 @@ void math_insert_symbol(char const* s)
{
if (current_view->available()) {
if (!current_view->buffer()->the_locking_inset) {
InsetFormula* new_inset = new InsetFormula();
InsetFormula * new_inset = new InsetFormula();
BeforeChange();
current_view->buffer()->insertInset(new_inset);
// Update(1);//BUG

View File

@ -135,7 +135,7 @@ Menus::Menus(LyXView * view, int air)
inline BufferView * Menus::currentView()
{
return _view->currentView();
return _view->view();
}
@ -1017,9 +1017,9 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long)
fl_setpup_shortcut(EditMenu, 17, scex(_("EM|gG#g#G")));
// disable unavailable entries.
if(tmpbuffer->undostack.Top() == 0)
if(tmpbuffer->undostack.empty())
fl_setpup_mode(EditMenu, 1, FL_PUP_GREY);
if(tmpbuffer->redostack.Top() == 0)
if(tmpbuffer->redostack.empty())
fl_setpup_mode(EditMenu, 2, FL_PUP_GREY);
if(lyxrc->isp_command == "none")
fl_setpup_mode(EditMenu, 11, FL_PUP_GREY);

View File

@ -24,6 +24,7 @@
#include "LyXView.h"
#include "debug.h"
#include "gettext.h"
#include "LyXAction.h"
extern bool keyseqUncomplete();
extern string keyseqOptions(int l= 190);
@ -46,7 +47,7 @@ void MiniBuffer::ExecutingCB(FL_OBJECT * ob, long)
MiniBuffer * obj = static_cast<MiniBuffer*>(ob->u_vdata);
lyxerr.debug() << "Getting ready to execute: " << obj->cur_cmd << endl;
fl_set_focus_object(obj->owner->getForm(),
obj->owner->currentView()->getWorkArea());
obj->owner->view()->getWorkArea());
if (obj->cur_cmd.empty()) {
obj->Init();
return ;
@ -91,16 +92,16 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord,
case XK_Tab:
{
// complete or increment the command
char const * s = lyxaction.getApproxFuncName(fl_get_input(ob));
if (s && s[0])
fl_set_input(ob, s);
string s = lyxaction.getApproxFuncName(fl_get_input(ob));
if (!s.empty())
fl_set_input(ob, s.c_str());
return 1;
}
case 27:
case XK_Escape:
// Abort
fl_set_focus_object(mini->owner->getForm(),
mini->owner->currentView()->getWorkArea());
mini->owner->view()->getWorkArea());
mini->Init();
return 1;
case 13:
@ -195,7 +196,7 @@ void MiniBuffer::Init()
text = owner->getLyXFunc()->keyseqOptions();
// Else, show the buffer state.
else if (owner->currentView()->available()) {
else if (owner->view()->available()) {
string nicename =
MakeDisplayPath(owner->buffer()->
getFileName());

View File

@ -31,9 +31,9 @@ public:
fl_set_timer(timer, a);
}
///
void Set(string const& = string(),
string const& = string(),
string const& = string(),
void Set(string const & = string(),
string const & = string(),
string const & = string(),
int delay_secs= 6);
///
string GetText() const { return text; }

View File

@ -73,7 +73,7 @@ LyXParagraph::LyXParagraph()
/* table stuff -- begin*/
table = 0;
/* table stuff -- end*/
id = paragraph_id++;
id_ = paragraph_id++;
bibkey = 0; // ale970302
Clear();
}
@ -103,7 +103,7 @@ LyXParagraph::LyXParagraph(LyXParagraph * par)
/* table stuff -- begin*/
table = 0;
/* table stuff -- end*/
id = paragraph_id++;
id_ = paragraph_id++;
bibkey = 0; // ale970302
@ -420,7 +420,7 @@ void LyXParagraph::validate(LaTeXFeatures & features)
/* first few functions needed for cut and paste and paragraph breaking */
void LyXParagraph::CopyIntoMinibuffer(LyXParagraph::size_type pos)
void LyXParagraph::CopyIntoMinibuffer(LyXParagraph::size_type pos) const
{
minibuffer_char = GetChar(pos);
minibuffer_font = GetFontSettings(pos);
@ -841,9 +841,63 @@ Inset * LyXParagraph::GetInset(LyXParagraph::size_type pos)
}
Inset const * LyXParagraph::GetInset(LyXParagraph::size_type pos) const
{
if (pos >= size()) {
if (next
&& next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return NextAfterFootnote()
->GetInset(pos - text.size() - 1);
else {
lyxerr << "ERROR (LyXParagraph::GetInset): "
"position does not exist: "
<< pos << endl;
}
return 0;
}
#ifdef NEW_TABLE
/* find the inset */
for(InsetList::const_iterator cit = insetlist.begin();
cit != insetlist.end(); ++cit) {
if ((*cit).pos == pos) {
return (*cit).inset;
}
}
lyxerr << "ERROR (LyXParagraph::GetInset): "
"Inset does not exist: " << pos << endl;
text[pos] = ' '; /// WHY!!! does this set the pos to ' '????
// Did this commenting out introduce a bug? So far I have not
// seen any, please enlighten me. (Lgb)
// My guess is that since the inset does not exist, we might
// as well replace it with a space to prevent crashes. (Asger)
return 0;
#else
/* find the inset */
InsetTable * tmpi = insettable;
while (tmpi && tmpi->pos != pos)
tmpi = tmpi->next;
if (tmpi)
return tmpi->inset;
else {
lyxerr << "ERROR (LyXParagraph::GetInset): "
"Inset does not exist: " << pos << endl;
// in the const version we need to comment it out anyway...
//text[pos] = ' '; /// WHY!!! does this set the pos to ' '????
// Did this commenting out introduce a bug? So far I have not
// seen any, please enlighten me. (Lgb)
// My guess is that since the inset does not exist, we might
// as well replace it with a space to prevent crashes. (Asger)
return 0;
}
#endif
}
// Gets uninstantiated font setting at position.
// Optimized after profiling. (Asger)
LyXFont LyXParagraph::GetFontSettings(LyXParagraph::size_type pos)
LyXFont LyXParagraph::GetFontSettings(LyXParagraph::size_type pos) const
{
if (pos < size()) {
#ifdef NEW_TABLE
@ -893,7 +947,7 @@ LyXFont LyXParagraph::GetFontSettings(LyXParagraph::size_type pos)
// the true picture of the buffer. (Asger)
// If position is -1, we get the layout font of the paragraph.
// If position is -2, we get the font of the manual label of the paragraph.
LyXFont LyXParagraph::getFont(LyXParagraph::size_type pos)
LyXFont LyXParagraph::getFont(LyXParagraph::size_type pos) const
{
LyXFont tmpfont;
LyXLayout const & layout = textclasslist.Style(GetCurrentTextClass(),
@ -920,7 +974,7 @@ LyXFont LyXParagraph::getFont(LyXParagraph::size_type pos)
// check for environment font information
char par_depth = GetDepth();
LyXParagraph * par = this;
LyXParagraph const * par = this;
while (par && par_depth && !tmpfont.resolved()) {
par = par->DepthHook(par_depth - 1);
if (par) {
@ -1078,7 +1132,7 @@ char LyXParagraph::GetChar(LyXParagraph::size_type pos) const
}
string LyXParagraph::GetWord(LyXParagraph::size_type & lastpos)
string LyXParagraph::GetWord(LyXParagraph::size_type & lastpos) const
//Added 98/9/21 by REH
// return an string of the current word, and the end of the word
// in lastpos.
@ -1145,7 +1199,7 @@ string LyXParagraph::GetWord(LyXParagraph::size_type & lastpos)
}
LyXParagraph::size_type LyXParagraph::Last()
LyXParagraph::size_type LyXParagraph::Last() const
{
if (next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
return text.size() + NextAfterFootnote()->Last() + 1;
@ -1175,7 +1229,7 @@ LyXParagraph * LyXParagraph::ParFromPos(LyXParagraph::size_type pos)
}
int LyXParagraph::PositionInParFromPos(LyXParagraph::size_type pos)
int LyXParagraph::PositionInParFromPos(LyXParagraph::size_type pos) const
{
/* > because last is the next unused position, and you can
* use it if you want */
@ -1459,7 +1513,7 @@ LyXParagraph * LyXParagraph::NextAfterFootnote()
}
LyXParagraph * LyXParagraph::NextAfterFootnote() const
LyXParagraph const * LyXParagraph::NextAfterFootnote() const
{
if (next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
LyXParagraph * tmp = next;
@ -1526,6 +1580,23 @@ LyXParagraph * LyXParagraph::FirstPhysicalPar()
}
LyXParagraph const * LyXParagraph::FirstPhysicalPar() const
{
if (!IsDummy())
return this;
LyXParagraph const * tmppar = this;
while (tmppar && (tmppar->IsDummy()
|| tmppar->footnoteflag != LyXParagraph::NO_FOOTNOTE))
tmppar = tmppar->previous;
if (!tmppar)
return this; /* this should never happen! */
else
return tmppar;
}
/* this function is able to hide closed footnotes */
LyXParagraph * LyXParagraph::Previous()
{
@ -1550,6 +1621,30 @@ LyXParagraph * LyXParagraph::Previous()
}
/* this function is able to hide closed footnotes */
LyXParagraph const * LyXParagraph::Previous() const
{
LyXParagraph * tmp = previous;
if (!tmp)
return tmp;
if (tmp->previous
&& tmp->previous->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
tmp = tmp->previous;
while (tmp
&& tmp->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE)
tmp = tmp->previous;
if (tmp && tmp->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE)
return tmp->next->Previous();
else
return previous;
}
else
return previous;
}
void LyXParagraph::BreakParagraph(LyXParagraph::size_type pos,
int flag)
{
@ -1625,7 +1720,7 @@ void LyXParagraph::BreakParagraph(LyXParagraph::size_type pos,
}
void LyXParagraph::MakeSameLayout(LyXParagraph * par)
void LyXParagraph::MakeSameLayout(LyXParagraph const * par)
{
par = par->FirstPhysicalPar();
footnoteflag = par->footnoteflag;
@ -1672,7 +1767,7 @@ LyXParagraph * LyXParagraph::FirstSelfrowPar()
}
LyXParagraph * LyXParagraph::Clone()
LyXParagraph * LyXParagraph::Clone() const
{
/* create a new paragraph */
LyXParagraph * result = new LyXParagraph;
@ -1696,16 +1791,16 @@ LyXParagraph * LyXParagraph::Clone()
/* copy everything behind the break-position to the new paragraph */
result->text.reserve(size());
for (size_type i = 0; i < size(); i++) {
CopyIntoMinibuffer(i);
result->InsertFromMinibuffer(i);
}
result->text.resize(result->text.size());
return result;
}
bool LyXParagraph::HasSameLayout(LyXParagraph * par)
bool LyXParagraph::HasSameLayout(LyXParagraph const * par)
{
par = par->FirstPhysicalPar();
@ -1827,38 +1922,38 @@ void LyXParagraph::CloseFootnote(LyXParagraph::size_type pos)
}
LyXTextClass::LayoutList::size_type LyXParagraph::GetLayout()
LyXTextClass::LayoutList::size_type LyXParagraph::GetLayout() const
{
return FirstPhysicalPar()->layout;
}
char LyXParagraph::GetDepth()
char LyXParagraph::GetDepth() const
{
return FirstPhysicalPar()->depth;
}
char LyXParagraph::GetAlign()
char LyXParagraph::GetAlign() const
{
return FirstPhysicalPar()->align;
}
string LyXParagraph::GetLabestring()
string LyXParagraph::GetLabestring() const
{
return FirstPhysicalPar()->labelstring;
}
int LyXParagraph::GetFirstCounter(int i)
int LyXParagraph::GetFirstCounter(int i) const
{
return FirstPhysicalPar()->counter[i];
return FirstPhysicalPar()->counter_[i];
}
/* the next two functions are for the manual labels */
string LyXParagraph::GetLabelWidthString()
string LyXParagraph::GetLabelWidthString() const
{
if (!FirstPhysicalPar()->labelwidthstring.empty())
return FirstPhysicalPar()->labelwidthstring;
@ -1977,7 +2072,7 @@ void LyXParagraph::SetLayout(LyXTextClass::LayoutList::size_type new_layout)
* because there cannot be a newline or a blank <= the beginning of the
* main body in TeX. */
int LyXParagraph::BeginningOfMainBody()
int LyXParagraph::BeginningOfMainBody() const
{
if (FirstPhysicalPar() != this)
return -1;
@ -2034,6 +2129,27 @@ LyXParagraph * LyXParagraph::DepthHook(int deth)
}
LyXParagraph const * LyXParagraph::DepthHook(int deth) const
{
LyXParagraph const * newpar = this;
if (deth < 0)
return 0;
do {
newpar = newpar->FirstPhysicalPar()->Previous();
} while (newpar && newpar->GetDepth() > deth
&& newpar->footnoteflag == footnoteflag);
if (!newpar) {
if (Previous() || GetDepth())
lyxerr << "ERROR (LyXParagraph::DepthHook): "
"no hook." << endl;
newpar = this;
}
return newpar->FirstPhysicalPar();
}
int LyXParagraph::AutoDeleteInsets()
{
#ifdef NEW_TABLE
@ -2104,7 +2220,7 @@ Inset * LyXParagraph::ReturnNextInsetPointer(LyXParagraph::size_type & pos)
/* returns -1 if inset not found */
int LyXParagraph::GetPositionOfInset(Inset * inset)
int LyXParagraph::GetPositionOfInset(Inset * inset) const
{
#ifdef NEW_TABLE
for (InsetList::iterator it = insetlist.begin();

View File

@ -1,15 +1,12 @@
// -*- C++ -*-
#ifndef _SPELLCHECKER_H
#define _SPELLCHECKER_H
#ifndef SPELLCHECKER_H
#define SPELLCHECKER_H
/* These functions are defined in lyx_cb.C */
class LString;
/** The returned word has to be deleted manually
*/
char* NextWord(float &value);
char * NextWord(float & value);
/** MarkLastWord should only be used immidiately after NextWord().
@ -24,7 +21,7 @@ void ReplaceWord(string const & replacestringstring);
/** This function has to be implemented by the spell checker.
* It will show the spellcheker form*/
It will show the spellcheker form*/
void ShowSpellChecker();
///
void SpellCheckerOptions();

View File

@ -1,4 +1,6 @@
Makefile.in
Makefile
*.deps
*.lo
libsupport.la
.libs

View File

@ -1,6 +1,6 @@
// -*- C++ -*-
#ifndef _LASSERT_H_
#define _LASSERT_H_
#ifndef LASSERT_H
#define LASSERT_H
//namespace LyX {

View File

@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS = foreign
noinst_LIBRARIES = libsupport.a
libsupport_a_LIBADD = @LIBOBJS@
pkglib_LTLIBRARIES = libsupport.la
LIBS =
ETAGS_ARGS = --c++
INCLUDES = -I${srcdir}/../
@ -8,7 +8,7 @@ if USE_LYXSTRING
LYXSTRING = lyxstring.C lyxstring.h
endif
libsupport_a_SOURCES = \
libsupport_la_SOURCES = \
DebugStream.C \
DebugStream.h \
FileInfo.C \
@ -34,4 +34,3 @@ libsupport_a_SOURCES = \
syscontr.h \
syssingleton.C \
textutils.h

View File

@ -7,8 +7,7 @@
#include "LString.h"
#include "lstrings.h"
//#include "debug.h"
#include "LRegex.h"
using std::count;
@ -48,7 +47,7 @@ string lowercase(string const & a)
string tmp;
string::const_iterator cit = a.begin();
for(; cit != a.end(); ++cit) {
tmp += char(tolower(*cit));
tmp += static_cast<char>(tolower(*cit));
}
return tmp;
}
@ -122,7 +121,7 @@ bool prefixIs(string const & a, char const * pre)
bool suffixIs(string const & a, char c)
{
if (a.empty()) return false;
return a[a.length()-1] == c;
return a[a.length() - 1] == c;
}
@ -169,9 +168,7 @@ bool contains(char const * a, char const * b)
int countChar(string const & a, char const c)
{
unsigned int n = 0;
count(a.begin(), a.end(), c, n);
return n;
return count(a.begin(), a.end(), c);
}
@ -219,62 +216,16 @@ int tokenPos(string const & a, char delim, string const & tok)
bool regexMatch(string const & a, string const & pattern)
{
if (pattern.empty())
return true;
if (a.empty())
return false;
string::size_type si= 0, pi= 0;
string::size_type const sl = a.length();
string::size_type const pl = pattern.length();
while (si < sl && pi < pl) {
if (pattern[pi] == '*') {
// Skip all consequtive *s
while (pattern[pi] == '*') {
++pi;
if (pi == pl)
return true;
}
// Get next chunk of pattern to match
string chunk;
string temp =
split(pattern.substr(pi, pl-1), chunk, '*');
if (!chunk.empty() && pattern[pl-1] == '*' &&
temp.empty())
temp = '*';
if (temp.empty()) {
// Last chunk, see if tail matches
if (sl < chunk.length()) {
return false;
}
temp = a.substr(sl - chunk.length(), sl - 1);
return temp == chunk;
} else {
// Middle chunk, see if we can find a match
bool match = false;
while (!match && si<sl) {
temp = a.substr(si, sl - 1);
match = prefixIs(temp, chunk.c_str());
++si;
};
if (!match)
return false;
si += chunk.length()-1;
pi += chunk.length();
if (si == sl && pi == pl-1)
return true;
}
} else if (a[si++] != pattern[pi++]) {
return false;
}
}
if (pi < pl || si < sl)
return false;
return true;
// We massage the pattern a bit so that the usual
// shell pattern we all are used to will work.
// One nice thing about using a real regex is that
// things like "*.*[^~]" will work also.
// build the regex string.
string regex(pattern);
regex = subst(regex, ".", "\\.");
regex = subst(regex, "*", ".*");
LRegex reg(regex);
return reg.exact_match(a);
}

View File

@ -419,7 +419,7 @@ lyxstring::lyxstring(size_type n, value_type c)
}
lyxstring::lyxstring(iterator first, iterator last)
lyxstring::lyxstring(const_iterator first, const_iterator last)
{
rep = new Srep(last - first, first);
}
@ -612,7 +612,7 @@ lyxstring & lyxstring::assign(size_type n, value_type ch)
}
lyxstring & lyxstring::assign(iterator first, iterator last)
lyxstring & lyxstring::assign(const_iterator first, const_iterator last)
{
TestlyxstringInvariant(this);
@ -1687,12 +1687,25 @@ void swap(lyxstring & str1, lyxstring & str2)
istream & operator>>(istream & is, lyxstring & s)
{
#if 1
// very bad solution
char * nome = new char[1024];
is >> nome;
lyxstring tmp(nome);
delete [] nome;
if (!tmp.empty()) s = tmp;
#else
// better solution
int w = is.widdth(0);
s.clear();
char c = 0;
while (is.get(c)) {
if (isspace(c)) { is.putback(c); break; }
s += c;
if (--w == 1) break;
}
if (s.empty()) is.setstate(ios::failbit);
#endif
return is;
}

View File

@ -169,9 +169,19 @@ public:
/// lyxstring(5, 'n') -> "nnnnn"
lyxstring(size_type n, value_type c);
#if 1
///
lyxstring(iterator first, iterator last);
lyxstring(const_iterator first, const_iterator last);
#else
///
template<class InputIterator>
lyxstring::lyxstring(InputIterator begin, InputIterator end) {
while (begin != end) {
push_back((*begin));
++begin;
}
}
#endif
///
~lyxstring();
@ -234,9 +244,20 @@ public:
///
lyxstring & assign(size_type n, value_type c);
#if 1
///
lyxstring & assign(iterator first, iterator last);
lyxstring & assign(const_iterator first, const_iterator last);
#else
///
template<class InputIterator>
lyxstring & assign(InputIterator begin, InputIterator end) {
clear;
while (begin != end) {
push_back((*begin));
++begin;
}
}
#endif
//@}
/**@name Element Access. Since lyxstring does not use exceptions,
@ -288,9 +309,20 @@ public:
///
lyxstring & append(size_type n, value_type);
#if 1
///
lyxstring & append(iterator first, iterator last);
#else
///
template<class InputIterator>
lyxstring & append(InputIterator begin, InputIterator end) {
while (begin != end) {
push_back((*begin));
++begin;
}
return *this;
}
#endif
// insert characters before (*this)[pos]:
///
@ -318,8 +350,20 @@ public:
///
void insert(iterator p, size_type n , value_type c);
#if 1
///
void insert(iterator p, iterator first, iterator last);
#else
///
template<class InputIterator>
void insert(iterator p, InputIterator begin, InputIterator end) {
iterator it;
while (begin != end) {
it = insert(p, (*begin));
++begin;
}
}
#endif
//@}
@ -445,7 +489,7 @@ public:
///
lyxstring & replace(iterator i, iterator i2,
size_type n , value_type c);
///
lyxstring & replace(iterator i, iterator i2, iterator j, iterator j2);

View File

@ -52,7 +52,7 @@ LyXTable::~LyXTable() {
}
LyXTable* LyXTable::Clone()
LyXTable * LyXTable::Clone()
{
LyXTable *result = new LyXTable(rows, columns);
int row, column;;

View File

@ -18,69 +18,57 @@
#include "lyxparagraph.h"
#include "debug.h"
// Delete linked list
void TexRow::reset()
{
TexRow_Item *current, *iter = next;
while (iter) {
// Iterate through the list deleting as you go.
// A bit easier to debug than recursive deletion.
current = iter;
iter = iter->next;
delete current;
}
rowlist.clear();
count = 0;
next = 0;
lastpar = 0;
lastpos = -1;
}
// Defines paragraph and position for the beginning of this row
void TexRow::start(LyXParagraph *par, int pos) {
void TexRow::start(LyXParagraph * par, int pos)
{
lastpar = par;
lastpos = pos;
}
// Insert node when line is completed
void TexRow::newline()
{
TexRow_Item *tmp = new TexRow_Item;
tmp->pos = lastpos;
RowItem tmp;
tmp.pos = lastpos;
if (lastpar)
tmp->id = lastpar->GetID();
tmp.id = lastpar->id();
else
tmp->id = -1;
// Inserts at the beginning of the list
tmp->next = next;
next = tmp;
count++;
tmp->rownumber = count;
tmp.id = -1;
tmp.rownumber = ++count;
rowlist.push_back(tmp);
}
void TexRow::getIdFromRow(int row, int &id, int &pos)
void TexRow::getIdFromRow(int row, int & id, int & pos)
{
TexRow_Item *tmp = next;
while (tmp && tmp->rownumber != row) {
tmp = tmp->next;
RowList::const_iterator cit = rowlist.begin();
for (; cit != rowlist.end(); ++cit) {
if ((*cit).rownumber == row) break;
}
if (tmp) {
TexRow_Item *tmp2 = next;
if (cit != rowlist.end()) {
RowList::iterator kit = rowlist.begin();
// Increase the pos of all rows with the
// same id (and where the pos is larger)
// to avoid putting errorinsets at the
// same pos.
while (tmp2) {
if (tmp2 != tmp &&
tmp2->id == tmp->id &&
tmp2->pos >= tmp->pos)
tmp2->pos++;
tmp2 = tmp2->next;
for(; kit != rowlist.end(); ++kit) {
if (&(*kit) != &(*cit)
&& (*kit).id == (*cit).id
&& (*kit).pos >= (*cit).pos)
(*kit).pos++;
}
id = tmp->id;
pos = tmp->pos;
} else {
id = -1;
pos = 0;
@ -88,30 +76,8 @@ void TexRow::getIdFromRow(int row, int &id, int &pos)
}
TexRow & TexRow::operator+= (const TexRow &tr)
TexRow & TexRow::operator+= (TexRow const & tr)
{
// remember that the lists are stored in reverse
// so you've got to turn the second one around
// as you insert it in the first
for (int counter = tr.count; counter > 0; --counter) {
int i = 1;
TexRow_Item *iter = tr.next;
while (i < counter) {
iter = iter->next;
++i;
}
++count;
TexRow_Item *tmp;
tmp = new TexRow_Item;
tmp->id = iter->id;
tmp->pos = iter->pos;
tmp->next = next;
tmp->rownumber = count;
next = tmp;
}
// should I be doing this or not?
//lastpar = tr.lastpar;
//lastpos = tr.lastpos;
rowlist.insert(rowlist.end(), tr.rowlist.begin(), tr.rowlist.end());
return *this;
}

View File

@ -16,6 +16,9 @@
#pragma interface
#endif
#include <list>
using std::list;
class LyXParagraph;
// Controls correspondance between paragraphs and the generated LaTeX file
@ -24,38 +27,32 @@ public:
///
TexRow() {
count = 0;
next = 0;
lastpar = 0;
lastpos = -1;
}
///
~TexRow() {
reset();
}
/// Clears structure
void reset();
/// Define what paragraph and position the next row will represent
void start(LyXParagraph *par, int pos);
void start(LyXParagraph * par, int pos);
/// Insert node when line is completed
void newline();
/// Returns paragraph id and position from a row number
void getIdFromRow(int row, int &id, int &pos);
void getIdFromRow(int row, int & id, int & pos);
/// Appends another TexRow
TexRow & operator+= (const TexRow &);
TexRow & operator+= (TexRow const &);
private:
/// Linked list of items
struct TexRow_Item {
struct RowItem {
///
TexRow_Item() {
RowItem() {
id = -1;
pos = -1;
next = 0;
rownumber = 0;
}
@ -65,13 +62,13 @@ private:
int pos;
///
int rownumber;
///
TexRow_Item *next;
};
///
unsigned int count;
///
TexRow_Item *next;
typedef list<RowItem> RowList;
///
RowList rowlist;
/// Last paragraph
LyXParagraph * lastpar;
/// Last position

View File

@ -135,7 +135,7 @@ void LyXText::Draw(Row * row, LyXParagraph::size_type & pos,
char c = row->par->GetChar(pos);
if (IsNewlineChar(c)) {
pos++;
++pos;
// Draw end-of-line marker
LyXFont font = GetFont(row->par, pos);
@ -158,18 +158,18 @@ void LyXText::Draw(Row * row, LyXParagraph::size_type & pos,
LyXFont font = GetFont(row->par, pos);
LyXFont font2 = font;
if (c == LyXParagraph::META_FOOTNOTE ||
c == LyXParagraph::META_MARGIN ||
c == LyXParagraph::META_FIG ||
c == LyXParagraph::META_TAB ||
c == LyXParagraph::META_WIDE_FIG ||
c == LyXParagraph::META_WIDE_TAB ||
c == LyXParagraph::META_ALGORITHM) {
if (c == LyXParagraph::META_FOOTNOTE
|| c == LyXParagraph::META_MARGIN
|| c == LyXParagraph::META_FIG
|| c == LyXParagraph::META_TAB
|| c == LyXParagraph::META_WIDE_FIG
|| c == LyXParagraph::META_WIDE_TAB
|| c == LyXParagraph::META_ALGORITHM) {
string fs;
switch (c) {
case LyXParagraph::META_MARGIN:
fs = "margin";
/* draw a sign at the left margin! */
// Draw a sign at the left margin!
scr.drawText(font, "!", 1, offset + row->baseline,
(LYX_PAPER_MARGIN - font.width('!'))/2);
break;
@ -195,7 +195,7 @@ void LyXText::Draw(Row * row, LyXParagraph::size_type & pos,
font.decSize();
font.decSize();
/* calculate the position of the footnotemark */
// calculate the position of the footnotemark
int y = (row->baseline - font2.maxAscent()
+ font.maxAscent());
@ -203,7 +203,7 @@ void LyXText::Draw(Row * row, LyXParagraph::size_type & pos,
float tmpx = x;
/* draw it and set new x position */
// draw it and set new x position
x += scr.drawString(font, fs, offset + y, int(x));
scr.drawLine(gc_foot, offset + row->baseline,
@ -212,7 +212,7 @@ void LyXText::Draw(Row * row, LyXParagraph::size_type & pos,
pos++;
return;
} else if (c == LyXParagraph::META_INSET) {
Inset *tmpinset = row->par->GetInset(pos);
Inset * tmpinset = row->par->GetInset(pos);
if (tmpinset)
tmpinset->Draw(font, scr, offset + row->baseline, x);
pos++;
@ -226,71 +226,39 @@ void LyXText::Draw(Row * row, LyXParagraph::size_type & pos,
// This is dirty, but fast. Notice that it will never be too small.
// For the record, I'll note that Microsoft Word has a limit
// of 768 here. We have none :-) (Asger)
#if 0
static char textstring[1024];
#else
// Ok. I am the first to admit that the use of std::string will be
// a tiny bit slower. However, I claim that this slowdown is so
// small that it is close to inperceptive. So IMHO we should go
// with the easier and clearer implementation. And even if 1024
// is a large number here it might overflow, string will only
// overflow if the machine is out of memory...
// a tiny bit slower than using a POD char array. However, I claim
// that this slowdown is so small that it is close to inperceptive.
// So IMHO we should go with the easier and clearer implementation.
// And even if 1024 is a large number here it might overflow, string
// will only overflow if the machine is out of memory...
static string textstring;
textstring = c;
++pos;
#endif
LyXParagraph::size_type last = RowLast(row);
#if 0
// Prevent crash in the extremely unlikely event
// that our array is too small
if (last > pos+1020) last = pos + 1020;
textstring[0] = c;
pos++;
int i = 1;
#endif
while (pos <= last &&
static_cast<char>(c = row->par->GetChar(pos)) > ' ' &&
font2 == GetFont(row->par, pos)) {
#if 0
textstring[i++] = c;
#else
while (pos <= last
&& static_cast<char>(c = row->par->GetChar(pos)) > ' '
&& font2 == GetFont(row->par, pos)) {
textstring += c;
#endif
++pos;
}
#if 0
textstring[i] = 0;
#endif
float tmpx = x;
// If monochrome and LaTeX mode, provide reverse background
if (mono_video && font.latex() == LyXFont::ON) {
int a= font.maxAscent(), d= font.maxDescent();
#if 0
scr.fillRectangle(gc_copy, int(tmpx), offset + row->baseline-a,
font.textWidth(textstring, i), a+d);
#else
int a = font.maxAscent(), d = font.maxDescent();
scr.fillRectangle(gc_copy, int(tmpx), offset + row->baseline-a,
font.textWidth(textstring.c_str(),
textstring.length()), a+d);
#endif
}
#if 0
/* Draw text and set the new x position */
x += scr.drawText(font, textstring, i, offset + row->baseline,
int(x));
#else
/* Draw text and set the new x position */
// Draw text and set the new x position
x += scr.drawText(font, textstring.c_str(), textstring.length(),
offset + row->baseline,
int(x));
#endif
/* what about underbars? */
// what about underbars?
if (font.underbar() == LyXFont::ON && font.latex() != LyXFont::ON) {
scr.drawLine(gc_copy, offset + row->baseline + 2,
int(tmpx), int(x - tmpx));
@ -311,7 +279,8 @@ int LyXText::LeftMargin(Row * row)
LyXFont labelfont;
LyXParagraph * newpar;
Row dummyrow;
LyXLayout const & layout = textclasslist.Style(parameters->textclass, row->par->GetLayout());
LyXLayout const & layout = textclasslist.Style(parameters->textclass,
row->par->GetLayout());
string parindent = layout.parindent;
@ -339,7 +308,8 @@ int LyXText::LeftMargin(Row * row)
/* find the previous same level paragraph */
if (row->par->FirstPhysicalPar()->Previous()) {
newpar = row->par->DepthHook(row->par->GetDepth());
if (newpar && textclasslist.Style(parameters->textclass, newpar->GetLayout()).nextnoindent)
if (newpar && textclasslist.Style(parameters->textclass,
newpar->GetLayout()).nextnoindent)
parindent.clear();
}
}
@ -596,12 +566,12 @@ int LyXText::WidthOfCell(LyXParagraph * par, LyXParagraph::size_type & pos)
}
char LyXText::HitInTable(Row * row, int x)
bool LyXText::HitInTable(Row * row, int x)
{
float tmpx;
float fill_separator, fill_hfill, fill_label_hfill;
if (!row->par->table)
return 0;
return false;
PrepareToPrint(row, tmpx, fill_separator, fill_hfill, fill_label_hfill);
return (x > tmpx && x < tmpx + row->par->table->WidthOfTable());
}
@ -637,8 +607,8 @@ LyXText::NextBreakPoint(Row * row, int width)
&& (!par->IsNewline(pos)
|| !par->table->IsFirstCell(NumberOfCell(par, pos+1)))) {
if (par->GetChar(pos) == LyXParagraph::META_INSET &&
par->GetInset(pos) && par->GetInset(pos)->Display()){
par->GetInset(pos)->SetDisplay(false);
par->GetInset(pos) && par->GetInset(pos)->display()){
par->GetInset(pos)->display(false);
}
pos++;
}
@ -662,8 +632,8 @@ LyXText::NextBreakPoint(Row * row, int width)
i = par->Last() - 1;/* this means break */
x = width;
} else if (par->GetChar(i) == LyXParagraph::META_INSET &&
par->GetInset(i) && par->GetInset(i)->Display()){
par->GetInset(i)->SetDisplay(false);
par->GetInset(i) && par->GetInset(i)->display()){
par->GetInset(i)->display(false);
}
i++;
}
@ -679,14 +649,14 @@ LyXText::NextBreakPoint(Row * row, int width)
last_separator = i;
x = width; /* this means break */
} else if (c == LyXParagraph::META_INSET &&
par->GetInset(i) && par->GetInset(i)->Display()){
par->GetInset(i) && par->GetInset(i)->display()){
/* check wether a Display() inset is valid here .
if not, change it to non-display*/
if (layout.isCommand()
|| (layout.labeltype == LABEL_MANUAL
&& i < BeginningOfMainBody(par))){
/* display istn't allowd */
par->GetInset(i)->SetDisplay(false);
par->GetInset(i)->display(false);
x += SingleWidth(par, i, c);
} else {
/* inset is display. So break the line here */
@ -2064,8 +2034,8 @@ void LyXText::CheckParagraphInTable(LyXParagraph * par,
{
if (par->GetChar(pos) == LyXParagraph::META_INSET &&
par->GetInset(pos) && par->GetInset(pos)->Display()){
par->GetInset(pos)->SetDisplay(false);
par->GetInset(pos) && par->GetInset(pos)->display()){
par->GetInset(pos)->display(false);
}
long y;
@ -2315,7 +2285,7 @@ void LyXText::InsertChar(char c)
/* the display inset stuff */
if (cursor.row->par->GetChar(cursor.row->pos) == LyXParagraph::META_INSET
&& cursor.row->par->GetInset(cursor.row->pos)
&& cursor.row->par->GetInset(cursor.row->pos)->Display())
&& cursor.row->par->GetInset(cursor.row->pos)->display())
cursor.row->fill = -1; // to force a new break
/* get the cursor row fist */
@ -2503,7 +2473,7 @@ void LyXText::PrepareToPrint(Row * row, float & x, float & fill_separator,
/* center displayed insets */
if (row->par->GetChar(row->pos) == LyXParagraph::META_INSET
&& row->par->GetInset(row->pos)
&& row->par->GetInset(row->pos)->Display())
&& row->par->GetInset(row->pos)->display())
align = LYX_ALIGN_CENTER;
switch (align) {
@ -2513,7 +2483,7 @@ void LyXText::PrepareToPrint(Row * row, float & x, float & fill_separator,
!(row->next->par->IsNewline(row->next->pos-1))
&& !(row->next->par->GetChar(row->next->pos) == LyXParagraph::META_INSET
&& row->next->par->GetInset(row->next->pos)
&& row->next->par->GetInset(row->next->pos)->Display())
&& row->next->par->GetInset(row->next->pos)->display())
)
fill_separator = w / ns;
break;
@ -3046,7 +3016,7 @@ void LyXText::Backspace()
return;
/* force complete redo when erasing display insets */
/* this is a cruel mathod but save..... Matthias */
if (cursor.par->GetInset(cursor.pos)->Display()){
if (cursor.par->GetInset(cursor.pos)->display()){
cursor.par->Erase(cursor.pos);
RedoParagraph();
return;

View File

@ -1070,7 +1070,7 @@ void LyXText::ToggleFree(LyXFont font, bool toggleall)
}
LyXParagraph::size_type LyXText::BeginningOfMainBody(LyXParagraph * par)
LyXParagraph::size_type LyXText::BeginningOfMainBody(LyXParagraph * par) const
{
if (textclasslist.Style(parameters->textclass, par->GetLayout()).labeltype != LABEL_MANUAL)
return 0;
@ -2633,7 +2633,6 @@ bool LyXText::GotoNextNote()
int LyXText::SwitchLayoutsBetweenClasses(char class1, char class2,
LyXParagraph * par)
{
InsetError * new_inset = 0;
int ret = 0;
if (!par || class1 == class2)
return ret;
@ -2658,7 +2657,7 @@ int LyXText::SwitchLayoutsBetweenClasses(char class1, char class2,
+ "\nbecause of class conversion from\n"
+ textclasslist.NameOfClass(class1) + " to "
+ textclasslist.NameOfClass(class2);
new_inset = new InsetError(s);
InsetError * new_inset = new InsetError(s);
par->InsertChar(0, LyXParagraph::META_INSET);
par->InsertInset(0, new_inset);
}
@ -3193,7 +3192,7 @@ void LyXText::DeleteEmptyParagraphMechanism(LyXCursor old_cursor)
LyXParagraph * LyXText::GetParFromID(int id)
{
LyXParagraph * result = FirstParagraph();
while (result && result->GetID() != id)
while (result && result->id() != id)
result = result->next;
return result;
}
@ -3202,11 +3201,11 @@ LyXParagraph * LyXText::GetParFromID(int id)
// undo functions
bool LyXText::TextUndo()
{ // returns false if no undo possible
Undo * undo = params->undostack.Pop();
Undo * undo = params->undostack.pop();
if (undo){
FinishUndo();
if (!undo_frozen)
params->redostack.Push(CreateUndo(undo->kind,
params->redostack.push(CreateUndo(undo->kind,
GetParFromID(undo->number_of_before_par),
GetParFromID(undo->number_of_behind_par)));
}
@ -3216,11 +3215,11 @@ bool LyXText::TextUndo()
bool LyXText::TextRedo()
{ // returns false if no redo possible
Undo * undo = params->redostack.Pop();
Undo * undo = params->redostack.pop();
if (undo){
FinishUndo();
if (!undo_frozen)
params->undostack.Push(CreateUndo(undo->kind,
params->undostack.push(CreateUndo(undo->kind,
GetParFromID(undo->number_of_before_par),
GetParFromID(undo->number_of_behind_par)));
}
@ -3371,15 +3370,15 @@ void LyXText::SetUndo(Undo::undo_kind kind, LyXParagraph * before,
LyXParagraph * behind)
{
if (!undo_frozen)
params->undostack.Push(CreateUndo(kind, before, behind));
params->redostack.Clear();
params->undostack.push(CreateUndo(kind, before, behind));
params->redostack.clear();
}
void LyXText::SetRedo(Undo::undo_kind kind, LyXParagraph * before,
LyXParagraph * behind)
{
params->redostack.Push(CreateUndo(kind, before, behind));
params->redostack.push(CreateUndo(kind, before, behind));
}
@ -3389,9 +3388,9 @@ Undo * LyXText::CreateUndo(Undo::undo_kind kind, LyXParagraph * before,
int before_number = -1;
int behind_number = -1;
if (before)
before_number = before->GetID();
before_number = before->id();
if (behind)
behind_number = behind->GetID();
behind_number = behind->id();
// Undo::EDIT and Undo::FINISH are
// always finished. (no overlapping there)
// overlapping only with insert and delete inside one paragraph:
@ -3402,10 +3401,10 @@ Undo * LyXText::CreateUndo(Undo::undo_kind kind, LyXParagraph * before,
if (!undo_finished && kind != Undo::EDIT &&
kind != Undo::FINISH){
// check wether storing is needed
if (params->undostack.Top() &&
params->undostack.Top()->kind == kind &&
params->undostack.Top()->number_of_before_par == before_number &&
params->undostack.Top()->number_of_behind_par == behind_number ){
if (!params->undostack.empty() &&
params->undostack.top()->kind == kind &&
params->undostack.top()->number_of_before_par == before_number &&
params->undostack.top()->number_of_behind_par == behind_number ){
// no undo needed
return 0;
}
@ -3433,7 +3432,7 @@ Undo * LyXText::CreateUndo(Undo::undo_kind kind, LyXParagraph * before,
if (start && end && start != end->next && (before != behind || (!before && !behind))) {
tmppar = start;
tmppar2 = tmppar->Clone();
tmppar2->SetID(tmppar->GetID());
tmppar2->id(tmppar->id());
// a memory optimization: Just store the layout information when only edit
if (kind == Undo::EDIT){
@ -3447,7 +3446,7 @@ Undo * LyXText::CreateUndo(Undo::undo_kind kind, LyXParagraph * before,
while (tmppar != end && tmppar->next) {
tmppar = tmppar->next;
tmppar2->next = tmppar->Clone();
tmppar2->next->SetID(tmppar->GetID());
tmppar2->next->id(tmppar->id());
// a memory optimization: Just store the layout information when only edit
if (kind == Undo::EDIT){
tmppar2->next->text.clear();
@ -3461,7 +3460,7 @@ Undo * LyXText::CreateUndo(Undo::undo_kind kind, LyXParagraph * before,
else
undopar = 0; // nothing to replace (undo of delete maybe)
int cursor_par = cursor.par->ParFromPos(cursor.pos)->GetID();
int cursor_par = cursor.par->ParFromPos(cursor.pos)->id();
int cursor_pos = cursor.par->PositionInParFromPos(cursor.pos);
Undo * undo = new Undo(kind,
@ -3533,14 +3532,13 @@ void LyXText::RemoveTableRow(LyXCursor * cursor)
}
bool LyXText::IsEmptyTableRow(LyXCursor * old_cursor)
bool LyXText::IsEmptyTableRow(LyXCursor * old_cursor) const
{
if (!old_cursor->par->table)
return false;
#ifdef I_DONT_KNOW_IF_I_SHOULD_DO_THIS
int
pos = old_cursor->pos,
cell = NumberOfCell(old_cursor->par, pos);
int pos = old_cursor->pos;
int cell = NumberOfCell(old_cursor->par, pos);
// search first charater of this table row
while (pos && !old_cursor->par->table->IsFirstCell(cell)) {
@ -3566,7 +3564,7 @@ bool LyXText::IsEmptyTableRow(LyXCursor * old_cursor)
}
bool LyXText::IsEmptyTableCell()
bool LyXText::IsEmptyTableCell() const
{
LyXParagraph::size_type pos = cursor.pos - 1;
while (pos >= 0 && pos < cursor.par->Last()

View File

@ -29,6 +29,7 @@
#include "combox.h"
#include "lyx_cb.h"
#include "LyXView.h"
#include "LyXAction.h"
#include "support/lstrings.h"
#ifdef TWO_COLOR_ICONS
@ -471,8 +472,8 @@ void Toolbar::add(int action, bool doclean)
toolbarItem *newItem,*tmp;
if (lyxaction.isPseudoAction(action)) {
char const *arg;
kb_action act = (kb_action)lyxaction.retrieveActionArg(action, &arg);
string arg;
kb_action act = static_cast<kb_action>(lyxaction.retrieveActionArg(action, arg));
pixmap = getPixmap(act, arg);
help = lyxaction.helpText(act);
help += " ";

View File

@ -152,7 +152,7 @@ private:
bool cleaned;
///
char **getPixmap(kb_action, string const & arg= string());
char **getPixmap(kb_action, string const & arg = string());
/// removes all toolbar buttons from the toolbar.
void clean();

View File

@ -20,7 +20,7 @@ UndoStack::UndoStack()
: limit(100) {}
Undo * UndoStack::Pop()
Undo * UndoStack::pop()
{
if (stakk.empty()) return 0;
Undo * result = stakk.front();
@ -29,7 +29,7 @@ Undo * UndoStack::Pop()
}
Undo * UndoStack::Top()
Undo * UndoStack::top()
{
if (stakk.empty()) return 0;
return stakk.front();
@ -38,11 +38,11 @@ Undo * UndoStack::Top()
UndoStack::~UndoStack()
{
Clear();
clear();
}
void UndoStack::Clear()
void UndoStack::clear()
{
while (!stakk.empty()) {
Undo * tmp = stakk.front();
@ -58,7 +58,7 @@ void UndoStack::SetStackLimit(Stakk::size_type l)
}
void UndoStack::Push(Undo * undo_arg)
void UndoStack::push(Undo * undo_arg)
{
if (!undo_arg) return;

View File

@ -86,17 +86,19 @@ public:
///
UndoStack();
///
Undo * Pop();
Undo * pop();
///
Undo * Top();
Undo * top();
///
bool empty() const { return stakk.empty(); }
///
~UndoStack();
///
void Clear();
void clear();
///
void SetStackLimit(Stakk::size_type l);
///
void Push(Undo * undo_arg);
void push(Undo * undo_arg);
};
#endif