From 53b464c5e95ed708e9464db0499826894be450fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Sat, 8 Jan 2000 21:02:58 +0000 Subject: [PATCH] some new (not extensive) changes, some fixes, will probably reverto to .la libs later .o libs is too much a hassle, please read the ChangeLog git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@408 a592a061-630c-0410-9148-cb99ea01b6c8 --- ABOUT-NLS | 73 +++--- ChangeLog | 70 ++++++ Makefile.am | 2 +- acinclude.m4 | 77 +++++- autogen.sh | 75 +++--- config/config.guess | 358 +++++++++++++++++++------- config/config.sub | 335 ++++++++++++++++++++++--- config/gettext.m4 | 47 +++- config/lcmessage.m4 | 5 + config/ltconfig | 4 - config/progtest.m4 | 5 + lib/Makefile.am | 3 +- po/Makefile.in.in | 46 ++-- src/BufferView.C | 9 +- src/BufferView.h | 79 +++++- src/LyXView.C | 45 +++- src/Spacing.h | 2 +- src/buffer.C | 181 ++++++-------- src/buffer.h | 20 +- src/bufferlist.C | 5 +- src/insets/insetref.h | 2 +- src/lyx_cb.C | 510 ++++++++++++++++---------------------- src/lyx_cb.h | 12 +- src/lyxfunc.C | 105 ++++---- src/mathed/formula.C | 60 ++--- src/mathed/math_symbols.C | 12 +- src/menus.C | 13 +- src/spellchecker.C | 10 +- src/spellchecker.h | 11 +- src/support/block.h | 23 +- src/support/filetools.C | 16 +- src/support/lstrings.C | 9 +- src/text.C | 6 +- src/text2.C | 1 - src/trans_mgr.C | 3 +- 35 files changed, 1435 insertions(+), 799 deletions(-) diff --git a/ABOUT-NLS b/ABOUT-NLS index dacb8b18be..28d38c76fd 100644 --- a/ABOUT-NLS +++ b/ABOUT-NLS @@ -137,7 +137,8 @@ Each translation team has its own mailing list, courtesy of Linux International. You may reach your translation team at the address `LL@li.org', replacing LL by the two-letter ISO 639 code for your language. Language codes are *not* the same as the country codes given -in ISO 3166. The following translation teams exist, as of August 1997: +in ISO 3166. The following translation teams exist, as of December +1997: Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en', Esperanto `eo', Finnish `fi', French `fr', German `de', Hungarian @@ -172,42 +173,42 @@ Available Packages ================== Languages are not equally supported in all packages. The following -matrix shows the current state of internationalization, as of August +matrix shows the current state of internationalization, as of December 1997. The matrix shows, in regard of each package, for which languages PO files have been submitted to translation coordination. - Ready PO files cs da de en es fi fr it ja ko nl no pl pt sl sv - .-------------------------------------------------. - bash | [] [] [] | 3 - bison | [] [] [] | 3 - clisp | [] [] [] [] | 4 - cpio | [] [] [] [] [] | 5 - diffutils | [] [] [] [] [] | 5 - enscript | [] [] [] [] [] [] | 6 - fileutils | [] [] [] [] [] [] [] [] [] [] | 10 - findutils | [] [] [] [] [] [] [] [] | 8 - flex | [] [] [] [] | 4 - gcal | [] [] [] [] [] | 5 - gettext | [] [] [] [] [] [] [] [] [] [] | 11 - grep | [] [] [] [] [] [] [] [] [] | 9 - hello | [] [] [] [] [] [] [] [] [] [] | 10 - id-utils | [] [] [] | 3 - indent | [] [] [] [] | 4 - libc | [] [] [] [] [] [] [] | 7 - m4 | [] [] [] [] [] | 5 - make | [] [] [] [] [] [] | 6 - music | [] [] | 2 - ptx | [] [] [] [] [] [] [] [] | 8 - recode | [] [] [] [] [] [] [] [] [] | 9 - sh-utils | [] [] [] [] [] [] [] | 7 - sharutils | [] [] [] [] [] | 5 - tar | [] [] [] [] [] [] [] [] [] [] | 10 - texinfo | [] | 1 - textutils | [] [] [] [] [] [] [] [] [] | 9 - wdiff | [] [] [] [] [] [] [] [] | 8 - `-------------------------------------------------' - 16 languages cs da de en es fi fr it ja ko nl no pl pt sl sv - 27 packages 3 2 24 1 17 1 26 2 1 11 20 9 19 7 7 17 167 + Ready PO files cs da de en es fi fr it ja ko nl no pl pt ru sl sv + .----------------------------------------------------. + bash | [] [] [] | 3 + bison | [] [] [] | 3 + clisp | [] [] [] [] | 4 + cpio | [] [] [] [] [] [] | 6 + diffutils | [] [] [] [] [] | 5 + enscript | [] [] [] [] [] [] | 6 + fileutils | [] [] [] [] [] [] [] [] [] [] | 10 + findutils | [] [] [] [] [] [] [] [] [] | 9 + flex | [] [] [] [] | 4 + gcal | [] [] [] [] [] | 5 + gettext | [] [] [] [] [] [] [] [] [] [] [] | 12 + grep | [] [] [] [] [] [] [] [] [] [] | 10 + hello | [] [] [] [] [] [] [] [] [] [] [] | 11 + id-utils | [] [] [] | 3 + indent | [] [] [] [] [] | 5 + libc | [] [] [] [] [] [] [] | 7 + m4 | [] [] [] [] [] [] | 6 + make | [] [] [] [] [] [] | 6 + music | [] [] | 2 + ptx | [] [] [] [] [] [] [] [] | 8 + recode | [] [] [] [] [] [] [] [] [] | 9 + sh-utils | [] [] [] [] [] [] [] [] | 8 + sharutils | [] [] [] [] [] [] | 6 + tar | [] [] [] [] [] [] [] [] [] [] [] | 11 + texinfo | [] [] [] | 3 + textutils | [] [] [] [] [] [] [] [] [] | 9 + wdiff | [] [] [] [] [] [] [] [] | 8 + `----------------------------------------------------' + 17 languages cs da de en es fi fr it ja ko nl no pl pt ru sl sv + 27 packages 6 4 25 1 18 1 26 2 1 12 20 9 19 7 4 7 17 179 Some counters in the preceding matrix are higher than the number of visible blocks let us expect. This is because a few extra PO files are @@ -220,6 +221,6 @@ distributed as such by its maintainer. There might be an observable lag between the mere existence a PO file and its wide availability in a distribution. - If August 1997 seems to be old, you may fetch a more recent copy of -this `ABOUT-NLS' file on most GNU archive sites. + If December 1997 seems to be old, you may fetch a more recent copy +of this `ABOUT-NLS' file on most GNU archive sites. diff --git a/ChangeLog b/ChangeLog index 75016c42f5..f77a6937ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,73 @@ +2000-01-08 Lars Gullik Bjønnes + + * src/bufferlist.C (close): don't call insetUnlock if the buffer + does not have a BufferView. + (unlockInset): ditto + don't access the_locking_inset if the + buffer does not have a BufferView. + + * src/LyXView.C (KeyPressMask_raw_callback): add a XSync in + certain circumstances so that we don't continue a keyboard + operation long after the key was released. Try f.ex. to load a + large document, press PageDown for some seconds and then release + it. Before this change the document would contine to scroll for + some time, with this change it stops imidiatly. + + * src/support/block.h: don't allocate more space than needed. As + long as we don't try to write to the arr[x] in a array_type arr[x] + it is perfectly ok. (if you write to it you might segfault). + added operator value_type*() so that is possible to pass the array + to functions expecting a C-pointer. + + * lib/Makefile.am (dist-hook): don't fail completely if unable to + cvs. + + * intl/*: updated to gettext 0.10.35, tried to add our own + required modifications. Please verify. + + * po/*: updated to gettext 0.10.35, tried to add our own required + modifications. Please verify. + + * src/support/lstrings.C (tostr): go at fixing the problem with + cxx and stringstream. When stringstream is used return + oss.str().c_str() so that problems with lyxstring and basic_string + are avoided. Note that the best solution would be for cxx to use + basic_string all the way, but it is not conformant yet. (it seems) + + * src/lyx_cb.C + other files: moved several global functions to + class BufferView, some have been moved to BufferView.[Ch] others + are still located in lyx_cb.C. Code changes because of this. (part + of "get rid of current_view project".) + + * src/buffer.C + other files: moved several Buffer functions to + class BufferView, the functions are still present in buffer.C. + Code changes because of this. + + * config/lcmessage.m4: updated to most recent. used when creating + acinclude.m4. + + * config/progtest.m4: updated to most recent. used when creating + acinclude.m4. + + * config/gettext.m4: updated to most recent. applied patch for + tmplinguas. + + * config/gettext.m4.patch: new file that shows what changes we + have done to the local copy of gettext.m4. + + * config/libtool.m4: new file, used in creation of acinclude.m4 + + * config/lyxinclude.m4: new file, this is the lyx created m4 + macros, used in making acinclude.m4. + + * autogen.sh: GNU m4 discovered as a separate task not as part of + the lib/configure creation. + Generate acinlucde from files in config. Actually cat + lyxinclude.m4, libtool.m4 and gettext.m4 together. This makes it + easier to upgrade .m4 files that really are external. + + * src/Spacing.h: moved using std::istringstream to right after + . This should fix the problem seen with some compilers. + 2000-01-06 Lars Gullik Bjønnes * src/lyx_cb.C: began some work to remove the dependency a lot of diff --git a/Makefile.am b/Makefile.am index dfa8b9cb32..7ff2005daf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure \ SUBDIRS = intl po src lib EXTRA_DIST = ANNOUNCE OLD-CHANGES INSTALL.OS2 INSTALL.autoconf README.OS2 \ - UPGRADING lyx.man \ + UPGRADING lyx.man acconfig.h \ config development forms images ETAGS_ARGS = --c++ man_MANS = lyx.1 diff --git a/acinclude.m4 b/acinclude.m4 index c45ad71700..1c78ee274b 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -185,7 +185,7 @@ dnl Check the version of g++ case $gxx_version in 2.7*) CXXFLAGS="$lyx_opt";; 2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";; - 2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti";; + 2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";; *) CXXFLAGS="-g $lyx_opt -fno-exceptions -fno-rtti";; esac else @@ -784,7 +784,6 @@ extern int select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5)) ]) -### BEGIN libtool.m4 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- ## Copyright (C) 1996-1999 Free Software Foundation, Inc. ## Originally by Gordon Matzigkeit , 1996 @@ -1215,9 +1214,6 @@ 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 - -### END libtool.m4 - # Macro to add for using GNU gettext. # Ulrich Drepper , 1995. # @@ -1447,11 +1443,12 @@ strdup __argz_count __argz_stringify __argz_next]) else AC_MSG_CHECKING(for catalogs to be installed) NEW_LINGUAS= -dnl ============== Fix is here! ======================= +dnl ============== Fix is here! ====================== dnl Some sh do not like substitution in bounds of for loops -dnl for lang in ${LINGUAS=$ALL_LINGUAS}; do +dnl for lang in ${LINGUAS=$ALL_LINGUAS}; do tmplinguas=${LINGUAS=$ALL_LINGUAS} for lang in ${tmplinguas}; do +dnl ==== end of fix case "$ALL_LINGUAS" in *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; esac @@ -1537,3 +1534,69 @@ dnl for lang in ${LINGUAS=$ALL_LINGUAS}; do sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ < $srcdir/po/POTFILES.in > po/POTFILES ]) +# Check whether LC_MESSAGES is available in . +# Ulrich Drepper , 1995. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 1 + +AC_DEFUN(AM_LC_MESSAGES, + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES) + fi + fi]) +# Search path for a program which passes the given test. +# Ulrich Drepper , 1996. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 1 + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN(AM_PATH_PROG_WITH_TEST, +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) diff --git a/autogen.sh b/autogen.sh index ffbf543bcd..5ab1e78fc2 100755 --- a/autogen.sh +++ b/autogen.sh @@ -4,73 +4,82 @@ ACLOCAL=aclocal AUTOHEADER=autoheader AUTOMAKE="automake -a -c --foreign" AUTOCONF=autoconf +GNUM4= + +echo -n "Locating GNU m4..." +for prog in $M4 gm4 gnum4 m4 ; do + case `$prog --version 2>&1` in + *GNU*) ok=yes + GNUM4=`type -path $prog` + echo "found: $GNUM4" + break ;; + *) ;; + esac +done +if test x$ok = xno ; then + echo "not found." +fi + +# Generate acinclude.m4 +echo -n "Generate acinclude.m4..." +rm -rf acinclude.m4 +touch acinclude.m4 +for fil in config/lyxinclude.m4 config/libtool.m4 config/gettext.m4 config/lcmessage.m4 config/progtest.m4 ; do + cat $fil >> acinclude.m4 +done +echo "done." # Generate the Makefiles and configure files if ( aclocal --version ) /dev/null 2>&1; then - echo "Building macros." + echo -n "Building macros..." $ACLOCAL ; (cd lib/reLyX; $ACLOCAL ) + echo "done." else echo "aclocal not found -- aborting" exit fi if ( autoheader --version ) /dev/null 2>&1; then - echo "Building config header template" + echo -n "Building config header template..." $AUTOHEADER + echo "done." else echo "autoheader not found -- aborting" exit fi if ( $AUTOMAKE --version ) /dev/null 2>&1; then - echo "Building Makefile templates" + echo -n "Building Makefile templates..." $AUTOMAKE ; (cd lib/reLyX ; $AUTOMAKE ) + echo "done." else echo "automake not found -- aborting" exit fi if ( $AUTOCONF --version ) /dev/null 2>&1; then - echo "Building configure" + echo -n "Building configure..." $AUTOCONF ; ( cd lib/reLyX ; $AUTOCONF ) + echo "done." echo 'run "./configure ; make"' else echo "autoconf not found -- aborting" exit fi -# Autogenerate lib/configure.m4. We need GNU m4 for that and thus have -# to try several ones. -ok=no -#for prog in $M4 gm4 gnum4 m4 ; do -# case `$prog --help < /dev/null 2>&1 | grep traditional` in -# *traditional*) echo "Building lib/configure" -# rm -f lib/configure -# $prog lib/configure.m4 >lib/configure -# chmod a+x lib/configure -# ok=yes -# break ;; -# *) ;; -# esac -#done -# Why not use --version ? (Lgb) -for prog in $M4 gm4 gnum4 m4 ; do - case `$prog --version 2>&1` in - *GNU*) echo "Building lib/configure" - rm -f lib/configure - $prog lib/configure.m4 >lib/configure - chmod a+x lib/configure - ok=yes - break ;; - *) ;; - esac -done -if test $ok = no ; then - echo "GNU m4 not found -- aborting" +# Autogenerate lib/configure.m4. +if test x$GNUM4 != x ; then + echo -n "Building lib/configure ..." + rm -f lib/configure + $GNUM4 lib/configure.m4 > lib/configure + chmod a+x lib/configure + echo "done." +else + echo "No GNU m4. Impossible to build lib/configure -- aborting" exit fi -echo "Creating POTFILES.in..." +echo -n "Creating POTFILES.in..." cat < tmppot # # This file is automatically generated by autogen.sh. This command was diff --git a/config/config.guess b/config/config.guess index 1ec70cc19e..e1b5871708 100755 --- a/config/config.guess +++ b/config/config.guess @@ -1,6 +1,7 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 +# Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -23,6 +24,7 @@ # Written by Per Bothner . # The master version of this file is at the FSF in /home/gd/gnu/lib. +# Please send patches to . # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and @@ -35,6 +37,20 @@ # (but try to keep the structure clean). # +# Use $HOST_CC if defined. $CC may point to a cross-compiler +if test x"$CC_FOR_BUILD" = x; then + if test x"$HOST_CC" != x; then + CC_FOR_BUILD="$HOST_CC" + else + if test x"$CC" != x; then + CC_FOR_BUILD="$CC" + else + CC_FOR_BUILD=cc + fi + fi +fi + + # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 8/24/94.) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then @@ -46,7 +62,8 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 # Note: order is significant - the case branches are not exclusive. @@ -59,7 +76,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - cat <dummy.s + cat <$dummy.s .globl main .ent main main: @@ -76,9 +93,9 @@ main: ret \$31,(\$26),1 .end main EOF - ${CC-cc} dummy.s -o dummy 2>/dev/null + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then - ./dummy + ./$dummy case "$?" in 7) UNAME_MACHINE="alpha" @@ -97,8 +114,14 @@ EOF ;; esac fi - rm -f dummy.s dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 @@ -133,6 +156,9 @@ EOF wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; @@ -142,7 +168,7 @@ EOF SR2?01:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; - Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*) + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 @@ -150,7 +176,7 @@ EOF echo pyramid-pyramid-bsd fi exit 0 ;; - NILE:*:*:dcosx) + NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) @@ -201,6 +227,32 @@ EOF atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; sun3*:NetBSD:*:*) echo m68k-sun-netbsd${UNAME_RELEASE} exit 0 ;; @@ -234,12 +286,16 @@ EOF VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; - 2020:CLIX:*:*) + 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) - sed 's/^ //' << EOF >dummy.c - int main (argc, argv) int argc; char **argv; { + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); @@ -254,10 +310,10 @@ EOF exit (-1); } EOF - ${CC-cc} dummy.c -o dummy \ - && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Night_Hawk:Power_UNIX:*:*) @@ -275,15 +331,18 @@ EOF AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ - -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then echo m88k-dg-dgux${UNAME_RELEASE} - else + else echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} fi - else echo i586-dg-dgux${UNAME_RELEASE} - fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 @@ -309,7 +368,7 @@ EOF exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - sed 's/^ //' << EOF >dummy.c + sed 's/^ //' << EOF >$dummy.c #include main() @@ -320,8 +379,8 @@ EOF exit(0); } EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 @@ -368,25 +427,25 @@ EOF case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/6?? | 9000/7?? | 9000/80[24] | 9000/8?[13679] | 9000/892 ) - sed 's/^ //' << EOF >dummy.c + 9000/[678][0-9][0-9]) + sed 's/^ //' << EOF >$dummy.c #include #include - + int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); - #endif + #endif long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) + + switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: + case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) - switch (bits) + switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; @@ -394,20 +453,20 @@ EOF } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; - #endif + #endif default: puts ("hppa1.0"); break; } exit (0); } EOF - (${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy` - rm -f dummy.c dummy + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + rm -f $dummy.c $dummy esac HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) - sed 's/^ //' << EOF >dummy.c + sed 's/^ //' << EOF >$dummy.c #include int main () @@ -432,8 +491,8 @@ EOF exit (0); } EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) @@ -442,6 +501,9 @@ EOF 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; + *9??*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; @@ -458,6 +520,9 @@ EOF parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; @@ -490,11 +555,14 @@ EOF CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} exit 0 ;; + CRAY*T3E:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} + exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F300:UNIX_System_V:*:*) - FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; @@ -507,29 +575,47 @@ EOF hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + i?86:BSD/386:*:* | i?86:BSD/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; - i?86:BSD/386:*:* | *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) + if test -x /usr/bin/objformat; then + if test "elf" = "`/usr/bin/objformat`"; then + echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` + exit 0 + fi + fi echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin32 + echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin32 + echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -538,15 +624,11 @@ EOF echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:Linux:*:*) - # uname on the ARM produces all sorts of strangeness, and we need to - # filter it out. - case "$UNAME_MACHINE" in - arm* | sa110*) UNAME_MACHINE="arm" ;; - esac # The BFD linker knows what the default object file format is, so - # first see if it will tell us. - ld_help_string=`ld --help 2>&1` + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_help_string=`cd /; ld --help 2>&1` ld_supported_emulations=`echo $ld_help_string \ | sed -ne '/supported emulations:/!d s/[ ][ ]*/ /g @@ -554,16 +636,74 @@ EOF s/ .*// p'` case "$ld_supported_emulations" in - i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; - i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; - sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; + *ia64) + echo "${UNAME_MACHINE}-unknown-linux" + exit 0 + ;; + i?86linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 + ;; + i?86coff) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 + ;; + sparclinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + armlinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + elf32arm*) + echo "${UNAME_MACHINE}-unknown-linux-gnu" + exit 0 + ;; + armelf_linux*) + echo "${UNAME_MACHINE}-unknown-linux-gnu" + exit 0 + ;; + m68klinux) + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" + exit 0 + ;; + elf32ppc) + # Determine Lib Version + cat >$dummy.c < +#if defined(__GLIBC__) +extern char __libc_version[]; +extern char __libc_release[]; +#endif +main(argc, argv) + int argc; + char *argv[]; +{ +#if defined(__GLIBC__) + printf("%s %s\n", __libc_version, __libc_release); +#else + printf("unkown\n"); +#endif + return 0; +} +EOF + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} + exit 0 + ;; esac if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <dummy.s + sed 's/^ //' <$dummy.s .globl main .ent main main: @@ -581,9 +721,9 @@ EOF .end main EOF LIBC="" - ${CC-cc} dummy.s -o dummy 2>/dev/null + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then - ./dummy + ./$dummy case "$?" in 7) UNAME_MACHINE="alpha" @@ -600,22 +740,23 @@ EOF 16) UNAME_MACHINE="alphaev6" ;; - esac + esac - objdump --private-headers dummy | \ + objdump --private-headers $dummy | \ grep ld.so.1 > /dev/null if test "$?" = 0 ; then LIBC="libc1" fi - fi - rm -f dummy.s dummy + fi + rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 elif test "${UNAME_MACHINE}" = "mips" ; then - cat >dummy.c <$dummy.c </dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy else # Either a pre-BFD a.out linker (linux-gnuoldld) # or one that does not give us useful --help. @@ -645,12 +786,13 @@ EOF ;; esac # Determine whether the default compiler is a.out or elf - cat >dummy.c <$dummy.c < -main(argc, argv) - int argc; - char *argv[]; -{ +#ifdef __cplusplus + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 @@ -667,8 +809,8 @@ main(argc, argv) return 0; } EOF - ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy fi ;; # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions # are messed up and put the nodename in both sysname and nodename. @@ -684,10 +826,20 @@ EOF echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i?86:*:5:7*) + # Fixed at (any) Pentium or better + UNAME_MACHINE=i586 + if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then + echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} fi exit 0 ;; i?86:*:3.2:*) @@ -699,18 +851,15 @@ EOF (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; - i?86:UnixWare:*:*) - if /bin/uname -X 2>/dev/null >/dev/null ; then - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - fi - echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION} - exit 0 ;; pc:*:*:*) # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. @@ -752,7 +901,7 @@ EOF mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i?86:LynxOS:2.*:*) + i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) @@ -764,6 +913,9 @@ EOF SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; @@ -794,7 +946,7 @@ EOF news*:NEWS-OS:*:6*) echo mips-sony-newsos6 exit 0 ;; - R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else @@ -810,12 +962,27 @@ EOF BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-qnx-qnx${UNAME_VERSION} + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 -cat >dummy.c <$dummy.c < # include @@ -853,7 +1020,10 @@ main () #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif @@ -913,8 +1083,8 @@ main () } EOF -${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 -rm -f dummy.c dummy +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy # Apollos put the system type in the environment. diff --git a/config/config.sub b/config/config.sub index ba26d742ae..28426bb8fa 100755 --- a/config/config.sub +++ b/config/config.sub @@ -1,6 +1,6 @@ #! /bin/sh # Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. +# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc. # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. @@ -98,11 +98,21 @@ case $os in os= basic_machine=$1 ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; -hiux*) os=-hiuxwe2 ;; -sco5) - os=sco3.2v5 + os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) @@ -121,6 +131,9 @@ case $os in os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -143,22 +156,33 @@ case $os in -psos*) os=-psos ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ - | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \ - | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ - | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ - | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ - | mipstx39 | mipstx39el | armv[34][lb] \ - | sparc | sparclet | sparclite | sparc64 | v850) + | 580 | i960 | h8300 \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \ + | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | miprs64vr5000el | mcore \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ + | thumb | d10v | fr30) basic_machine=$basic_machine-unknown ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) + ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. @@ -171,27 +195,45 @@ case $basic_machine in exit 1 ;; # Recognize the basic CPU types with company name. - vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ - | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \ - | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \ - | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \ + | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | mips64-* | mipsel-* | armv[34][lb]-*\ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mipstx39-* | mipstx39el-* \ - | f301-*) + | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f301-* | armv*-* | t3e-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* ) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; alliant | fx80) basic_machine=fx80-alliant ;; @@ -221,6 +263,10 @@ case $basic_machine in basic_machine=m68k-apollo os=-sysv ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; aux) basic_machine=m68k-apple os=-aux @@ -297,6 +343,10 @@ case $basic_machine in encore | umax | mmax) basic_machine=ns32k-encore ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; fx2800) basic_machine=i860-alliant ;; @@ -315,6 +365,14 @@ case $basic_machine in basic_machine=h8300-hitachi os=-hms ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; harris) basic_machine=m88k-harris os=-sysv3 @@ -330,13 +388,30 @@ case $basic_machine in basic_machine=m68k-hp os=-hpux ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; - hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) @@ -345,9 +420,16 @@ case $basic_machine in hppa-next) os=-nextstep3 ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; i370-ibm* | ibm*) basic_machine=i370-ibm - os=-mvs ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i[34567]86v32) @@ -366,6 +448,25 @@ case $basic_machine in basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + i386-go32 | go32) + basic_machine=i386-unknown + os=-go32 + ;; + i386-mingw32 | mingw32) + basic_machine=i386-unknown + os=-mingw32 + ;; + i386-qnx | qnx) + basic_machine=i386-qnx + ;; iris | iris4d) basic_machine=mips-sgi case $os in @@ -394,6 +495,10 @@ case $basic_machine in miniframe) basic_machine=m68000-convergent ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu @@ -408,10 +513,30 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-unknown + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos @@ -424,6 +549,10 @@ case $basic_machine in basic_machine=mips-sony os=-newsos ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; next | m*-next ) basic_machine=m68k-next case $os in @@ -449,9 +578,25 @@ case $basic_machine in basic_machine=i960-intel os=-nindy ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; np1) basic_machine=np1-gould ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -469,19 +614,19 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; - pentium | p5 | k5 | nexen) + pentium | p5 | k5 | k6 | nexen) basic_machine=i586-pc ;; - pentiumpro | p6 | k6 | 6x86) + pentiumpro | p6 | 6x86) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i786-pc ;; - pentium-* | p5-* | k5-* | nexen-*) + pentium-* | p5-* | k5-* | k6-* | nexen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumpro-* | p6-* | k6-* | 6x86-*) + pentiumpro-* | p6-* | 6x86-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) @@ -505,12 +650,20 @@ case $basic_machine in ps2) basic_machine=i386-ibm ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; sequent) basic_machine=i386-sequent ;; @@ -518,6 +671,10 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; sps7) basic_machine=m68k-bull os=-sysv2 @@ -525,6 +682,13 @@ case $basic_machine in spur) basic_machine=spur-unknown ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; sun2) basic_machine=m68000-sun ;; @@ -569,6 +733,10 @@ case $basic_machine in basic_machine=i386-sequent os=-dynix ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -586,6 +754,10 @@ case $basic_machine in basic_machine=a29k-nyu os=-sym1 ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; vaxv) basic_machine=vax-dec os=-sysv @@ -609,6 +781,14 @@ case $basic_machine in basic_machine=a29k-wrs os=-vxworks ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; xmp) basic_machine=xmp-cray os=-unicos @@ -616,6 +796,10 @@ case $basic_machine in xps | xps100) basic_machine=xps100-honeywell ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -623,6 +807,15 @@ case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown @@ -645,7 +838,7 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sparc) + sparc | sparcv9) basic_machine=sparc-sun ;; cydra) @@ -657,6 +850,16 @@ case $basic_machine in orion105) basic_machine=clipper-highlevel ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 @@ -710,13 +913,21 @@ case $os in | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos*) + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -opened* | -openstep* | -oskit*) # Remember, each alternative MUST END IN *, to match a version number. ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; @@ -726,6 +937,9 @@ case $os in -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; + -opened*) + os=-openedition + ;; -osfrose*) os=-osfrose ;; @@ -741,6 +955,9 @@ case $os in -acis*) os=-aos ;; + -386bsd) + os=-bsd + ;; -ctix* | -uts*) os=-sysv ;; @@ -760,6 +977,9 @@ case $os in -oss*) os=-sysv3 ;; + -qnx) + os=-qnx4 + ;; -svr4) os=-sysv4 ;; @@ -772,9 +992,18 @@ case $os in # This must come after -sysvr4. -sysv*) ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; -xenix) os=-xenix ;; + -*mint | -*MiNT) + os=-mint + ;; -none) ;; *) @@ -800,6 +1029,9 @@ case $basic_machine in *-acorn) os=-riscix1.2 ;; + arm*-rebel) + os=-linux + ;; arm*-semi) os=-aout ;; @@ -821,6 +1053,15 @@ case $basic_machine in # default. # os=-sunos4 ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; @@ -833,6 +1074,15 @@ case $basic_machine in *-ibm) os=-aix ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; *-hp) os=-hpux ;; @@ -896,6 +1146,18 @@ case $basic_machine in f301-fujitsu) os=-uxpv ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; *) os=-none ;; @@ -917,9 +1179,15 @@ case $basic_machine in -aix*) vendor=ibm ;; + -beos*) + vendor=be + ;; -hpux*) vendor=hp ;; + -mpeix*) + vendor=hp + ;; -hiux*) vendor=hitachi ;; @@ -935,7 +1203,7 @@ case $basic_machine in -genix*) vendor=ns ;; - -mvs*) + -mvs* | -opened*) vendor=ibm ;; -ptx*) @@ -947,6 +1215,15 @@ case $basic_machine in -aux*) vendor=apple ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -*MiNT) + vendor=atari + ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; diff --git a/config/gettext.m4 b/config/gettext.m4 index 64f2e8e74a..0784434634 100644 --- a/config/gettext.m4 +++ b/config/gettext.m4 @@ -1,7 +1,12 @@ # Macro to add for using GNU gettext. # Ulrich Drepper , 1995. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. -# serial 3 +# serial 5 AC_DEFUN(AM_WITH_NLS, [AC_MSG_CHECKING([whether NLS is requested]) @@ -41,12 +46,12 @@ AC_DEFUN(AM_WITH_NLS, if test "$gt_cv_func_gettext_libc" != "yes"; then AC_CHECK_LIB(intl, bindtextdomain, - [LIBS="-lintl $LIBS" - AC_CACHE_CHECK([for gettext in libintl], + [AC_CACHE_CHECK([for gettext in libintl], gt_cv_func_gettext_libintl, - [AC_TRY_LINK([], [return (int) gettext ("")], - gt_cv_func_gettext_libintl=yes, - gt_cv_func_gettext_libintl=no)])]) + [AC_CHECK_LIB(intl, gettext, + gt_cv_func_gettext_libintl=yes, + gt_cv_func_gettext_libintl=no)], + gt_cv_func_gettext_libintl=no)]) fi if test "$gt_cv_func_gettext_libc" = "yes" \ @@ -140,7 +145,7 @@ AC_DEFUN(AM_WITH_NLS, : ; else AC_MSG_RESULT( - [found xgettext programs is not GNU xgettext; ignore it]) + [found xgettext program is not GNU xgettext; ignore it]) XGETTEXT=":" fi fi @@ -152,6 +157,12 @@ AC_DEFUN(AM_WITH_NLS, nls_cv_header_intl=intl/libintl.h nls_cv_header_libgt=intl/libgettext.h fi + AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) + AC_OUTPUT_COMMANDS( + [case "$CONFIG_FILES" in *po/Makefile.in*) + sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile + esac]) + # If this is used in GNU gettext we have to set USE_NLS to `yes' # because some of the sources are only built for this goal. @@ -196,9 +207,9 @@ AC_DEFUN(AM_GNU_GETTEXT, AC_REQUIRE([AC_FUNC_MMAP])dnl AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ -unistd.h values.h sys/param.h]) +unistd.h sys/param.h]) AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ -__argz_count __argz_stringify __argz_next]) +strdup __argz_count __argz_stringify __argz_next]) if test "${ac_cv_func_stpcpy+set}" != "set"; then AC_CHECK_FUNCS(stpcpy) @@ -216,7 +227,12 @@ __argz_count __argz_stringify __argz_next]) else AC_MSG_CHECKING(for catalogs to be installed) NEW_LINGUAS= - for lang in ${LINGUAS=$ALL_LINGUAS}; do +dnl ============== Fix is here! ====================== +dnl Some sh do not like substitution in bounds of for loops +dnl for lang in ${LINGUAS=$ALL_LINGUAS}; do + tmplinguas=${LINGUAS=$ALL_LINGUAS} + for lang in ${tmplinguas}; do +dnl ==== end of fix case "$ALL_LINGUAS" in *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; esac @@ -231,6 +247,17 @@ __argz_count __argz_stringify __argz_next]) fi fi + dnl The reference to in the installed file + dnl must be resolved because we cannot expect the users of this + dnl to define HAVE_LOCALE_H. + if test $ac_cv_header_locale_h = yes; then + INCLUDE_LOCALE_H="#include " + else + INCLUDE_LOCALE_H="\ +/* The system does not provide the header . Take care yourself. */" + fi + AC_SUBST(INCLUDE_LOCALE_H) + dnl Determine which catalog format we have (if any is needed) dnl For now we know about two different formats: dnl Linux libc-5 and the normal X/Open format diff --git a/config/lcmessage.m4 b/config/lcmessage.m4 index d94fc3317f..e31bb5334b 100644 --- a/config/lcmessage.m4 +++ b/config/lcmessage.m4 @@ -1,5 +1,10 @@ # Check whether LC_MESSAGES is available in . # Ulrich Drepper , 1995. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. # serial 1 diff --git a/config/ltconfig b/config/ltconfig index de0026d8a7..a01334f921 100755 --- a/config/ltconfig +++ b/config/ltconfig @@ -1758,11 +1758,7 @@ reload_flag= reload_cmds='$LD$reload_flag -o $output$reload_objs' echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 # PORTME Some linkers may need a different reload flag. -if [ x$with_gnu_ld = xyes ] ; then -reload_flag='-Ur' -else reload_flag='-r' -fi echo "$ac_t$reload_flag" 1>&6 test -n "$reload_flag" && reload_flag=" $reload_flag" diff --git a/config/progtest.m4 b/config/progtest.m4 index 13a85fa08c..2482d4a9bf 100644 --- a/config/progtest.m4 +++ b/config/progtest.m4 @@ -1,5 +1,10 @@ # Search path for a program which passes the given test. # Ulrich Drepper , 1996. +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. # serial 1 diff --git a/lib/Makefile.am b/lib/Makefile.am index 1caddd80b9..335a5d7313 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -44,4 +44,5 @@ install-data-local: libinstalldirs dist-hook: cd ${distdir} ; rm -rf `find . -name \*CVS\*` ; \ rm -rf doc/BUGS.lyx ; \ - cvs -Q export -r HEAD -d doc lyxdoc + { cvs -Q export -r HEAD -d doc lyxdoc || \ + echo "WARNING: Unable to get LyX Documentation from CVS!" ; true ; } diff --git a/po/Makefile.in.in b/po/Makefile.in.in index 3b77898193..cb33dc4999 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -1,19 +1,10 @@ # Makefile for program source directory in GNU NLS utilities package. -# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper # -# 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, 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. +# This file file be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. PACKAGE = @PACKAGE@ VERSION = @VERSION@ @@ -48,7 +39,7 @@ DEFS = @DEFS@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ -INCLUDES = -I../src -I$(top_srcdir)/intl +INCLUDES = -I.. -I$(top_srcdir)/intl COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) @@ -91,18 +82,19 @@ INSTOBJEXT = @INSTOBJEXT@ all: all-@USE_NLS@ -all-yes: $(srcdir)/cat-id-tbl.c $(CATALOGS) +all-yes: cat-id-tbl.c $(CATALOGS) all-no: $(srcdir)/$(PACKAGE).pot: $(POTFILES) $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ --add-comments --keyword=_ --keyword=N_ \ - --files-from=$(srcdir)/POTFILES.in - rm -f $(srcdir)/$(PACKAGE).pot - mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot + --files-from=$(srcdir)/POTFILES.in \ + && test ! -f $(PACKAGE).po \ + || ( rm -f $(srcdir)/$(PACKAGE).pot \ + && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot ) -$(srcdir)/cat-id-tbl.c: $(srcdir)/stamp-cat-id; @: -$(srcdir)/stamp-cat-id: $(srcdir)/$(PACKAGE).pot +$(srcdir)/cat-id-tbl.c: stamp-cat-id; @: +$(srcdir)/stamp-cat-id: $(PACKAGE).pot rm -f cat-id-tbl.tmp sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \ | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp @@ -121,10 +113,10 @@ install-exec: install-data: install-data-@USE_NLS@ install-data-no: all install-data-yes: all - if test -r $(MKINSTALLDIRS); then \ + if test -r "$(MKINSTALLDIRS)"; then \ $(MKINSTALLDIRS) $(datadir); \ else \ - $(top_srcdir)/mkinstalldirs $(datadir); \ + $(SHELL) $(top_srcdir)/mkinstalldirs $(datadir); \ fi @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ @@ -135,10 +127,10 @@ install-data-yes: all esac; \ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ dir=$$destdir/$$lang/LC_MESSAGES; \ - if test -r $(MKINSTALLDIRS); then \ + if test -r "$(MKINSTALLDIRS)"; then \ $(MKINSTALLDIRS) $$dir; \ else \ - $(top_srcdir)/mkinstalldirs $$dir; \ + $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \ fi; \ if test -r $$cat; then \ $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ @@ -163,10 +155,10 @@ install-data-yes: all fi; \ done if test "$(PACKAGE)" = "gettext"; then \ - if test -r $(MKINSTALLDIRS); then \ + if test -r "$(MKINSTALLDIRS)"; then \ $(MKINSTALLDIRS) $(gettextsrcdir); \ else \ - $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \ + $(SHELL) $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \ fi; \ $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ $(gettextsrcdir)/Makefile.in.in; \ diff --git a/src/BufferView.C b/src/BufferView.C index 9adc7b2f30..7daf167b0f 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -54,8 +54,7 @@ extern void SetXtermCursor(Window win); extern bool input_prohibited; extern bool selection_possible; extern char ascii_type; -extern int UnlockInset(UpdatableInset * inset); -extern void ToggleFloat(); +//extern int UnlockInset(UpdatableInset * inset); extern void MenuPasteSelection(char at); extern InsetUpdateStruct * InsetUpdateList; extern void UpdateInsetUpdateList(); @@ -1047,7 +1046,7 @@ int BufferView::WorkAreaButtonPress(FL_OBJECT * ob, Window, button); return 0; } else { - UnlockInset(the_locking_inset); + unlockInset(the_locking_inset); } } @@ -1290,7 +1289,7 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT * ob, Window , } } if (hit == true) { - ToggleFloat(); + toggleFloat(); selection_possible = false; return 0; } @@ -1317,7 +1316,7 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT * ob, Window , && y + screen_first < text->cursor.y - text->cursor.row->baseline + font.maxAscent() * 1.2 + font.maxDescent() * 1.2) { - ToggleFloat(); + toggleFloat(); selection_possible = false; return 0; } diff --git a/src/BufferView.h b/src/BufferView.h index 1f50cb9812..1c7c180ee7 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -19,7 +19,7 @@ #include FORMS_H_LOCATION #include "BackStack.h" #include "lyxtext.h" - +#include "LaTeX.h" class LyXView; class Buffer; @@ -96,6 +96,83 @@ public: void insetSleep(); /// void insetWakeup(); + /// + void replaceWord(string const & replacestring); + /// + void endOfSpellCheck(); + /// + void selectLastWord(); + /// + char * nextWord(float & value); + /// + void insertCorrectQuote(); + /// + void gotoNote(); + /// + bool gotoLabel(string const & label); + /// + void paste(); + /// + void cut(); + /// + void copy(); + /// + void pasteEnvironment(); + /// + void copyEnvironment(); + /// + void hfill(); + /// + void protectedBlank(); + /// + void newline(); + /// + void menuSeparator(); + /// + void endOfSentenceDot(); + /// + void ldots(); + /// + void hyphenationPoint(); + /// + void menuUndo(); + /// + void menuRedo(); + /// + void toggleFloat(); + /// + void openStuff(); + /// + void insertNote(); + /// + void allFloats(char flag, char figmar); + /// removes all autodeletable insets + bool removeAutoInsets(); + /// + void insertErrors(TeXErrors & terr); + /// + void setCursorFromRow(int row); + /** Insert an inset into the buffer + Insert inset into buffer, placing it in a layout of lout, + if no_table make sure that it doesn't end up in a table. */ + void insertInset(Inset * inset, string const & lout = string(), + bool no_table = false); + /// open and lock an updatable inset + void open_new_inset(UpdatableInset * new_inset); + /// Inserts a lyx file at cursor position. Returns false if it fails. + bool insertLyXFile(string const & file); + /// + int lockInset(UpdatableInset * inset); + /// + void showLockedInsetCursor(long x, long y, int asc, int desc); + /// + void hideLockedInsetCursor(long x, long y, int asc, int desc); + /// + void fitLockedInsetCursor(long x, long y, int asc, int desc); + /// + int unlockInset(UpdatableInset * inset); + /// + void lockedInsetStoreUndo(Undo::undo_kind kind); private: /// Update pixmap of screen void updateScreen(); diff --git a/src/LyXView.C b/src/LyXView.C index 129aec0e00..148ff63dda 100644 --- a/src/LyXView.C +++ b/src/LyXView.C @@ -15,6 +15,9 @@ #pragma implementation #endif +#include +#include + #include "LyXView.h" #include "lyx_main.h" #include "lyxlookup.h" @@ -334,14 +337,54 @@ int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev) LyXView * view = static_cast(fl->u_vdata); int retval = 0; // 0 means XForms should have a look at this event +#define USE_XSYNC 1 +#ifdef USE_XSYNC + XKeyEvent * xke = static_cast(xev); + static Time last_time_pressed = 0; + static Time last_time_released = 0; + static unsigned int last_key_pressed = 0; + static unsigned int last_key_released = 0; + static unsigned int last_state_pressed = 0; + static unsigned int last_state_released = 0; +#endif // funny. Even though the raw_callback is registered with KeyPressMask, // also KeyRelease-events are passed through:-( // [It seems that XForms puts them in pairs... (JMarc)] if (static_cast(xev)->type == KeyPress && view->bufferview->getWorkArea()->focus - && view->bufferview->getWorkArea()->active) + && view->bufferview->getWorkArea()->active) { +#ifdef USE_XSYNC + last_time_pressed = xke->time; + last_key_pressed = xke->keycode; + last_state_pressed = xke->state; +#endif retval = view->getLyXFunc() ->processKeyEvent(static_cast(xev)); + } +#ifdef USE_XSYNC + else if (static_cast(xev)->type == KeyRelease + && view->bufferview->getWorkArea()->focus + && view->bufferview->getWorkArea()->active) { + last_time_released = xke->time; + last_key_released = xke->keycode; + last_state_released = xke->state; + } + + if (last_key_released == last_key_pressed + && last_state_released == last_state_pressed + && last_time_released == last_time_pressed) { + // When the diff between last_time_released and + // last_time_pressed is 0, that sinifies an autoreapeat + // at least on my system. It like some feedback from + // others, especially from user running LyX remote. + //lyxerr << "Syncing - purging X events." << endl; + XSync(fl_get_display(), 1); + // This purge make f.ex. scrolling stop imidiatly when + // releaseing the PageDown button. The question is if this + // purging of XEvents can cause any harm...after some testing + // I can see no problems, but I'd like other reports too. + } +#endif return retval; } diff --git a/src/Spacing.h b/src/Spacing.h index 56b4c2fd73..4ee1b284c0 100644 --- a/src/Spacing.h +++ b/src/Spacing.h @@ -14,10 +14,10 @@ #ifdef HAVE_SSTREAM #include +using std::istringstream; #else #include #endif -using std::istringstream; #include "support/LOstream.h" diff --git a/src/buffer.C b/src/buffer.C index ca873ba890..e0953cf145 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -200,9 +200,8 @@ void Buffer::fileName(string const & newfile) } -// candidate for move to BufferView // Inserts a file into current document -bool Buffer::insertLyXFile(string const & filen) +bool BufferView::insertLyXFile(string const & filen) // // (c) CHT Software Service GmbH // Uwe C. Schroeder @@ -225,7 +224,7 @@ bool Buffer::insertLyXFile(string const & filen) return false; } - users->beforeChange(); + beforeChange(); ifstream ifs(fname.c_str()); if (!ifs) { @@ -243,10 +242,10 @@ bool Buffer::insertLyXFile(string const & filen) if (c == '#') { lyxerr.debug() << "Will insert file with header" << endl; - res = readFile(lex, users->text->cursor.par); + res = buffer()->readFile(lex, text->cursor.par); } else { lyxerr.debug() << "Will insert file without header" << endl; - res = readLyXformat2(lex, users->text->cursor.par); + res = buffer()->readLyXformat2(lex, text->cursor.par); } resize(); @@ -2108,14 +2107,6 @@ bool Buffer::isSGML() const void Buffer::sgmlOpenTag(ostream & os, int depth, string const & latexname) const { -#if 0 - static char const * space[] = { - " "," ", " ", " ", " ", " ", - " ", - " ", " ", " ", - " "}; - os << space[depth] << "<" << latexname << ">\n"; -#endif os << string(depth, ' ') << "<" << latexname << ">\n"; } @@ -2123,13 +2114,6 @@ void Buffer::sgmlOpenTag(ostream & os, int depth, void Buffer::sgmlCloseTag(ostream & os, int depth, string const & latexname) const { -#if 0 - static char * space[] = {" ", " ", " ", " ", " ", - " ", " ", " ", - " ", " ", " "}; - - os << space[depth] << "\n"; -#endif os << string(depth, ' ') << "\n"; } @@ -2196,13 +2180,13 @@ void Buffer::makeLinuxDocFile(string const & fname, int column) } } - /* environment tag closing */ + // environment tag closing for( ; depth > par->depth; --depth) { sgmlCloseTag(ofs, depth, environment_stack[depth]); environment_stack[depth].clear(); } - /* write opening SGML tags */ + // write opening SGML tags switch(style.latextype) { case LATEX_PARAGRAPH: if(depth == par->depth @@ -3122,12 +3106,11 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra, } -// candidate for move to BufferView -bool Buffer::removeAutoInsets() +bool BufferView::removeAutoInsets() { - LyXParagraph * par = paragraph; + LyXParagraph * par = buffer()->paragraph; - LyXCursor cursor = users->text->cursor; + LyXCursor cursor = text->cursor; LyXCursor tmpcursor = cursor; cursor.par = tmpcursor.par->ParFromPos(tmpcursor.pos); cursor.pos = tmpcursor.par->PositionInParFromPos(tmpcursor.pos); @@ -3137,19 +3120,20 @@ bool Buffer::removeAutoInsets() if (par->AutoDeleteInsets()){ a = true; if (par->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){ - /* this is possible now, since SetCursor takes - care about footnotes */ - users->text->SetCursorIntern(par, 0); - users->text->RedoParagraphs(users->text->cursor, users->text->cursor.par->Next()); - users->text->FullRebreak(); + // this is possible now, since SetCursor takes + // care about footnotes + text->SetCursorIntern(par, 0); + text->RedoParagraphs(text->cursor, + text->cursor.par->Next()); + text->FullRebreak(); } } par = par->next; } - /* avoid forbidden cursor positions caused by error removing */ + // avoid forbidden cursor positions caused by error removing if (cursor.pos > cursor.par->Last()) cursor.pos = cursor.par->Last(); - users->text->SetCursorIntern(cursor.par, cursor.pos); + text->SetCursorIntern(cursor.par, cursor.pos); return a; } @@ -3175,7 +3159,7 @@ int Buffer::runLaTeX() users->owner()->getMiniBuffer()->Set(_("Running LaTeX...")); // Remove all error insets - bool a = removeAutoInsets(); + bool a = users->removeAutoInsets(); // Always generate the LaTeX file makeLaTeXFile(name, org_path, false); @@ -3194,7 +3178,7 @@ int Buffer::runLaTeX() } else if ((res & LaTeX::ERRORS)) { users->owner()->getMiniBuffer()->Set(_("Done")); // Insert all errors as errors boxes - insertErrors(terr); + users->insertErrors(terr); // Dvi should also be kept dirty if the latex run // ends up with errors. However it should be possible @@ -3241,7 +3225,7 @@ int Buffer::runLiterate() users->owner()->getMiniBuffer()->Set(_("Running Literate...")); // Remove all error insets - bool a = removeAutoInsets(); + bool a = users->removeAutoInsets(); // generate the Literate file if necessary if (!isDviClean() || a) { @@ -3263,7 +3247,7 @@ int Buffer::runLiterate() } else if ((res & Literate::ERRORS)) { users->owner()->getMiniBuffer()->Set(_("Done")); // Insert all errors as errors boxes - insertErrors(terr); + users->insertErrors(terr); // Dvi should also be kept dirty if the latex run // ends up with errors. However it should be possible @@ -3310,7 +3294,7 @@ int Buffer::buildProgram() users->owner()->getMiniBuffer()->Set(_("Building Program...")); // Remove all error insets - bool a = removeAutoInsets(); + bool a = users->removeAutoInsets(); // generate the LaTeX file if necessary if (!isNwClean() || a) { @@ -3332,7 +3316,7 @@ int Buffer::buildProgram() } else if ((res & Literate::ERRORS)) { users->owner()->getMiniBuffer()->Set(_("Done")); // Insert all errors as errors boxes - insertErrors(terr); + users->insertErrors(terr); // Literate files should also be kept dirty if the literate // command run ends up with errors. @@ -3377,7 +3361,7 @@ int Buffer::runChktex() users->owner()->getMiniBuffer()->Set(_("Running chktex...")); // Remove all error insets - bool a = removeAutoInsets(); + bool a = users->removeAutoInsets(); // Generate the LaTeX file if neccessary if (!isDviClean() || a) { @@ -3394,7 +3378,7 @@ int Buffer::runChktex() _("Could not run with file:"), name); } else if (res > 0) { // Insert all errors as errors boxes - insertErrors(terr); + users->insertErrors(terr); } // if we removed error insets before we ran chktex or if we inserted @@ -3410,18 +3394,14 @@ int Buffer::runChktex() } -extern void AllFloats(char, char); - - -// candidate for move to BufferView -void Buffer::insertErrors(TeXErrors & terr) +void BufferView::insertErrors(TeXErrors & terr) { // Save the cursor position - LyXCursor cursor = users->text->cursor; + LyXCursor cursor = text->cursor; // This is drastic, but it's the only fix, I could find. (Asger) - AllFloats(1, 0); - AllFloats(1, 1); + allFloats(1, 0); + allFloats(1, 1); for (TeXErrors::Errors::const_iterator cit = terr.begin(); cit != terr.end(); @@ -3435,47 +3415,46 @@ void Buffer::insertErrors(TeXErrors & terr) int tmpid = -1; int tmppos = -1; - texrow.getIdFromRow(errorrow, tmpid, tmppos); + buffer()->texrow.getIdFromRow(errorrow, tmpid, tmppos); LyXParagraph * texrowpar = 0; if (tmpid == -1) { - texrowpar = users->text->FirstParagraph(); + texrowpar = text->FirstParagraph(); tmppos = 0; } else { - texrowpar = users->text->GetParFromID(tmpid); + texrowpar = text->GetParFromID(tmpid); } if (texrowpar == 0) continue; InsetError * new_inset = new InsetError(msgtxt); - users->text->SetCursorIntern(texrowpar, tmppos); - users->text->InsertInset(new_inset); - users->text->FullRebreak(); + text->SetCursorIntern(texrowpar, tmppos); + text->InsertInset(new_inset); + text->FullRebreak(); } // Restore the cursor position - users->text->SetCursorIntern(cursor.par, cursor.pos); + text->SetCursorIntern(cursor.par, cursor.pos); } -// candidate for move to BufferView -void Buffer::setCursorFromRow (int row) +void BufferView::setCursorFromRow(int row) { int tmpid = -1; int tmppos = -1; - texrow.getIdFromRow(row, tmpid, tmppos); + buffer()->texrow.getIdFromRow(row, tmpid, tmppos); LyXParagraph * texrowpar; if (tmpid == -1) { - texrowpar = users->text->FirstParagraph(); + texrowpar = text->FirstParagraph(); tmppos = 0; } else { - texrowpar = users->text->GetParFromID(tmpid); + texrowpar = text->GetParFromID(tmpid); } - users->text->SetCursor(texrowpar, tmppos); + text->SetCursor(texrowpar, tmppos); } @@ -3738,74 +3717,72 @@ void Buffer::setOldPaperStuff() #endif -// candidate for move to BufferView -void Buffer::insertInset(Inset * inset, string const & lout, +void BufferView::insertInset(Inset * inset, string const & lout, bool no_table) { // check for table/list in tables - if (no_table && users->text->cursor.par->table){ + if (no_table && text->cursor.par->table){ WriteAlert(_("Impossible Operation!"), _("Cannot insert table/list in table."), _("Sorry.")); return; } // not quite sure if we want this... - users->text->SetCursorParUndo(); - users->text->FreezeUndo(); + text->SetCursorParUndo(); + text->FreezeUndo(); - users->beforeChange(); + beforeChange(); if (!lout.empty()) { - users->update(-2); - users->text->BreakParagraph(); - users->update(-1); + update(-2); + text->BreakParagraph(); + update(-1); - if (users->text->cursor.par->Last()) { - users->text->CursorLeft(); + if (text->cursor.par->Last()) { + text->CursorLeft(); - users->text->BreakParagraph(); - users->update(-1); + text->BreakParagraph(); + update(-1); } - int lay = textclasslist.NumberOfLayout(params.textclass, + int lay = textclasslist.NumberOfLayout(buffer()->params.textclass, lout).second; if (lay == -1) // layout not found // use default layout "Standard" (0) lay = 0; - users->text->SetLayout(lay); + text->SetLayout(lay); - users->text->SetParagraph(0, 0, + text->SetParagraph(0, 0, 0, 0, VSpace(VSpace::NONE), VSpace(VSpace::NONE), LYX_ALIGN_LAYOUT, string(), 0); - users->update(-1); + update(-1); - users->text->current_font.setLatex(LyXFont::OFF); + text->current_font.setLatex(LyXFont::OFF); } - users->text->InsertInset(inset); - users->update(-1); + text->InsertInset(inset); + update(-1); - users->text->UnFreezeUndo(); + text->UnFreezeUndo(); } // Open and lock an updatable inset -// candidate for move to BufferView -void Buffer::open_new_inset(UpdatableInset * new_inset) +void BufferView::open_new_inset(UpdatableInset * new_inset) { - users->beforeChange(); - users->text->FinishUndo(); + beforeChange(); + text->FinishUndo(); insertInset(new_inset); - users->text->CursorLeft(); - users->update(1); + text->CursorLeft(); + update(1); new_inset->Edit(0, 0); } -/* This function should be in Buffer because it's a buffer's property (ale) */ +// This function should be in Buffer because it's a buffer's property (ale) string Buffer::getIncludeonlyList(char delim) { string lst; @@ -3834,7 +3811,7 @@ string Buffer::getIncludeonlyList(char delim) } -/* This is also a buffer property (ale) */ +// This is also a buffer property (ale) string Buffer::getReferenceList(char delim) { /// if this is a child document and the parent is already loaded @@ -3866,7 +3843,7 @@ string Buffer::getReferenceList(char delim) } -/* This is also a buffer property (ale) */ +// This is also a buffer property (ale) string Buffer::getBibkeyList(char delim) { /// if this is a child document and the parent is already loaded @@ -3920,16 +3897,15 @@ string Buffer::getBibkeyList(char delim) } -// candidate for move to BufferView /* This is also a buffer property (ale) */ // Not so sure about that. a goto Label function can not be buffer local, just // think how this will work in a multiwindo/buffer environment, all the // cursors in all the views showing this buffer will move. (Lgb) // OK, then no cursor action should be allowed in buffer. (ale) -bool Buffer::gotoLabel(string const & label) +bool BufferView::gotoLabel(string const & label) { - LyXParagraph * par = paragraph; + LyXParagraph * par = buffer()->paragraph; LyXParagraph::size_type pos; Inset * inset; while (par) { @@ -3937,10 +3913,10 @@ bool Buffer::gotoLabel(string const & label) while ((inset = par->ReturnNextInsetPointer(pos))){ for (int i = 0; i < inset->GetNumberOfLabels(); i++) { if (label == inset->getLabel(i)) { - users->beforeChange(); - users->text->SetCursor(par, pos); - users->text->sel_cursor = users->text->cursor; - users->update(0); + beforeChange(); + text->SetCursor(par, pos); + text->sel_cursor = text->cursor; + update(0); return true; } } @@ -3984,7 +3960,8 @@ void Buffer::markDepClean(string const & name) } } -void Buffer::Dispatch(const string & command) + +void Buffer::Dispatch(string const & command) { // Split command string into command and argument string cmd, line = frontStrip(command); @@ -3993,7 +3970,8 @@ void Buffer::Dispatch(const string & command) Dispatch(lyxaction.LookupFunc(cmd.c_str()), arg.c_str()); } -void Buffer::Dispatch(int action, const string & argument) + +void Buffer::Dispatch(int action, string const & argument) { switch (action) { case LFUN_EXPORT: @@ -4005,5 +3983,4 @@ void Buffer::Dispatch(int action, const string & argument) break; } // end of switch - } diff --git a/src/buffer.h b/src/buffer.h index 54262cbc44..95cfdb8d7d 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -120,7 +120,7 @@ public: } /// Open and lock an updatable inset - void open_new_inset(UpdatableInset *); + //void open_new_inset(UpdatableInset *); /// void loadAutoSaveFile(); @@ -136,7 +136,7 @@ public: bool readLyXformat2(LyXLex &, LyXParagraph * par = 0); /// Inserts a lyx file at cursor position. Returns false if it fails. - bool insertLyXFile(string const & filename); + //bool insertLyXFile(string const & filename); /// Write file. Returns false if unsuccesful. bool writeFile(string const &, bool); @@ -296,11 +296,11 @@ public: /** Insert an inset into the buffer Insert inset into buffer, placing it in a layout of lout, if no_table make sure that it doesn't end up in a table. */ - void insertInset(Inset *, string const & lout = string(), - bool no_table = false); + //void insertInset(Inset *, string const & lout = string(), + // bool no_table = false); /// - void setCursorFromRow (int); + //void setCursorFromRow (int); /// string getIncludeonlyList(char delim = ','); @@ -309,10 +309,10 @@ public: /// string getBibkeyList(char delim = '|'); /// - bool gotoLabel(string const &); + //bool gotoLabel(string const &); /// removes all autodeletable insets - bool removeAutoInsets(); + //bool removeAutoInsets(); /** This will clearly have to change later. Later we can have more than one user per buffer. */ @@ -346,9 +346,11 @@ public: doing a 'nice' LaTeX file */ bool niceFile; + /// Used when typesetting to place errorboxes. + TexRow texrow; private: /// - void insertErrors(TeXErrors &); + //void insertErrors(TeXErrors &); /// void linuxDocHandleFootnote(ostream & os, @@ -425,8 +427,6 @@ private: */ BufferView * users; - /// Used when typesetting to place errorboxes. - TexRow texrow; }; diff --git a/src/bufferlist.C b/src/bufferlist.C index a8c9b1919b..97e84b1113 100644 --- a/src/bufferlist.C +++ b/src/bufferlist.C @@ -249,7 +249,7 @@ void BufferList::resize() bool BufferList::close(Buffer * buf) { - buf->getUser()->insetUnlock(); + if (buf->getUser()) buf->getUser()->insetUnlock(); if (buf->paragraph && !buf->isLyxClean() && !quitting) { ProhibitInput(); @@ -325,7 +325,8 @@ int BufferList::unlockInset(UpdatableInset * inset) if (!inset) return 1; for(BufferStorage::iterator it = bstore.begin(); it != bstore.end(); ++it) { - if ((*it)->getUser()->the_locking_inset == inset) { + if ((*it)->getUser() + && (*it)->getUser()->the_locking_inset == inset) { (*it)->getUser()->insetUnlock(); return 0; } diff --git a/src/insets/insetref.h b/src/insets/insetref.h index a117418efa..10a742c1ce 100644 --- a/src/insets/insetref.h +++ b/src/insets/insetref.h @@ -82,7 +82,7 @@ inline void InsetRef::gotoLabel() { if (master) { - master->gotoLabel(getContents()); + master->getUser()->gotoLabel(getContents()); } } #endif diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 596ce7d3f0..8ac601124e 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -114,9 +114,6 @@ bool selection_possible = false; // away. Definitely not the best solution, but I think it sorta works. bool toggleall = true; -void InsertCorrectQuote(); - - /* This is the inset locking stuff needed for mathed -------------------- @@ -157,11 +154,11 @@ void UpdateInset(Inset * inset, bool mark_dirty = true); /* these functions return 1 if an error occured, otherwise 0 */ // Now they work only for updatable insets. [Alejandro 080596] -int LockInset(UpdatableInset * inset); +//int LockInset(UpdatableInset * inset); void ToggleLockedInsetCursor(long x, long y, int asc, int desc); -void FitLockedInsetCursor(long x, long y, int asc, int desc); -int UnlockInset(UpdatableInset * inset); -void LockedInsetStoreUndo(Undo::undo_kind kind); +//void FitLockedInsetCursor(long x, long y, int asc, int desc); +//int UnlockInset(UpdatableInset * inset); +//void LockedInsetStoreUndo(Undo::undo_kind kind); /* this is for asyncron updating. UpdateInsetUpdateList will be called automatically from LyX. Just insert the Inset into the Updatelist */ @@ -177,17 +174,6 @@ InsetUpdateStruct * InsetUpdateList = 0; /* some function prototypes */ -void GotoNote(); -void OpenStuff(); -void ToggleFloat(); -void MenuUndo(); -void MenuRedo(); -void HyphenationPoint(); -void MenuSeparator(); -void HFill(); -void Newline(); -void ProtectedBlank(); -void CopyCB(); int RunLinuxDoc(int, string const &); int RunDocBook(int, string const &); void MenuWrite(Buffer * buf); @@ -1229,7 +1215,7 @@ void MenuInsertLabel(char const * arg) if (!label.empty()) { InsetLabel * new_inset = new InsetLabel; new_inset->setContents(label); - current_view->buffer()->insertInset(new_inset); + current_view->insertInset(new_inset); } AllowInput(); } @@ -1431,13 +1417,11 @@ int RunDocBook(int flag, string const & filename) } -// candidate for move to BufferView -void AllFloats(char flag, char figmar) +void BufferView::allFloats(char flag, char figmar) { - if (!current_view->available()) - return; + if (!available()) return; - LyXCursor cursor = current_view->text->cursor; + LyXCursor cursor = text->cursor; if (!flag && cursor.par->footnoteflag != LyXParagraph::NO_FOOTNOTE && ((figmar @@ -1449,15 +1433,15 @@ void AllFloats(char flag, char figmar) && cursor.par->footnotekind != LyXParagraph::WIDE_FIG && cursor.par->footnotekind != LyXParagraph::WIDE_TAB && cursor.par->footnotekind != LyXParagraph::ALGORITHM))) - ToggleFloat(); + toggleFloat(); else - current_view->beforeChange(); + beforeChange(); LyXCursor tmpcursor = cursor; cursor.par = tmpcursor.par->ParFromPos(tmpcursor.pos); cursor.pos = tmpcursor.par->PositionInParFromPos(tmpcursor.pos); - LyXParagraph *par = current_view->buffer()->paragraph; + LyXParagraph *par = buffer()->paragraph; while (par) { if (flag) { if (par->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE @@ -1476,11 +1460,9 @@ void AllFloats(char flag, char figmar) if (par->previous && par->previous->footnoteflag != LyXParagraph::CLOSED_FOOTNOTE){ /* should be */ - current_view->text - ->SetCursorIntern(par - ->previous, - 0); - current_view->text->OpenFootnote(); + text->SetCursorIntern(par->previous, + 0); + text->OpenFootnote(); } } } @@ -1508,17 +1490,17 @@ void AllFloats(char flag, char figmar) ) ) ) { - current_view->text->SetCursorIntern(par, 0); - current_view->text->CloseFootnote(); + text->SetCursorIntern(par, 0); + text->CloseFootnote(); } } par = par->next; } - current_view->text->SetCursorIntern(cursor.par, cursor.pos); - current_view->redraw(); - current_view->fitCursor(); - current_view->updateScrollbar(); + text->SetCursorIntern(cursor.par, cursor.pos); + redraw(); + fitCursor(); + updateScrollbar(); } @@ -2102,169 +2084,152 @@ void MenuLayoutSave() } -// candidate for move to BufferView -void NoteCB() +void BufferView::insertNote() { InsetInfo * new_inset = new InsetInfo(); - current_view->buffer()->insertInset(new_inset); + insertInset(new_inset); new_inset->Edit(0, 0); } -// candidate for move to BufferView -void OpenStuff() +void BufferView::openStuff() { - if (current_view->available()) { - current_view->owner()->getMiniBuffer()->Set(_("Open/Close...")); - current_view->getScreen()->HideCursor(); - current_view->beforeChange(); - current_view->update(-2); - current_view->text->OpenStuff(); - current_view->update(0); + if (available()) { + owner()->getMiniBuffer()->Set(_("Open/Close...")); + getScreen()->HideCursor(); + beforeChange(); + update(-2); + text->OpenStuff(); + update(0); } } -// candidate for move to BufferView -void ToggleFloat() +void BufferView::toggleFloat() { - if (current_view->available()) { - current_view->owner()->getMiniBuffer()->Set(_("Open/Close...")); - current_view->getScreen()->HideCursor(); - current_view->beforeChange(); - current_view->update(-2); - current_view->text->ToggleFootnote(); - current_view->update(0); + if (available()) { + owner()->getMiniBuffer()->Set(_("Open/Close...")); + getScreen()->HideCursor(); + beforeChange(); + update(-2); + text->ToggleFootnote(); + update(0); } } -// candidate for move to BufferView -void MenuUndo() +void BufferView::menuUndo() { -/* if (current_view->buffer()->the_locking_inset) { - current_view->owner()->getMiniBuffer()->Set(_("Undo not yet supported in math mode")); - return; - }*/ - - if (current_view->available()) { - current_view->owner()->getMiniBuffer()->Set(_("Undo")); - current_view->getScreen()->HideCursor(); - current_view->beforeChange(); - current_view->update(-2); - if (!current_view->text->TextUndo()) - current_view->owner()->getMiniBuffer()->Set(_("No further undo information")); + if (available()) { + owner()->getMiniBuffer()->Set(_("Undo")); + getScreen()->HideCursor(); + beforeChange(); + update(-2); + if (!text->TextUndo()) + owner()->getMiniBuffer()->Set(_("No further undo information")); else - current_view->update(-1); + update(-1); } } -// candidate for move to BufferView -void MenuRedo() +void BufferView::menuRedo() { - if (current_view->the_locking_inset) { - current_view->owner()->getMiniBuffer()->Set(_("Redo not yet supported in math mode")); + if (the_locking_inset) { + owner()->getMiniBuffer()->Set(_("Redo not yet supported in math mode")); return; } - if (current_view->available()) { - current_view->owner()->getMiniBuffer()->Set(_("Redo")); - current_view->getScreen()->HideCursor(); - current_view->beforeChange(); - current_view->update(-2); - if (!current_view->text->TextRedo()) - current_view->owner()->getMiniBuffer()->Set(_("No further redo information")); + if (available()) { + owner()->getMiniBuffer()->Set(_("Redo")); + getScreen()->HideCursor(); + beforeChange(); + update(-2); + if (!text->TextRedo()) + owner()->getMiniBuffer()->Set(_("No further redo information")); else - current_view->update(-1); + update(-1); } } -// candidate for move to BufferView -void HyphenationPoint() +void BufferView::hyphenationPoint() { - if (current_view->available()) { - current_view->getScreen()->HideCursor(); - current_view->update(-2); + if (available()) { + getScreen()->HideCursor(); + update(-2); InsetSpecialChar * new_inset = new InsetSpecialChar(InsetSpecialChar::HYPHENATION); - current_view->buffer()->insertInset(new_inset); + insertInset(new_inset); } } -// candidate for move to BufferView -void Ldots() +void BufferView::ldots() { - if (current_view->available()) { - current_view->getScreen()->HideCursor(); - current_view->update(-2); + if (available()) { + getScreen()->HideCursor(); + update(-2); InsetSpecialChar * new_inset = new InsetSpecialChar(InsetSpecialChar::LDOTS); - current_view->buffer()->insertInset(new_inset); + insertInset(new_inset); } } -// candidate for move to BufferView -void EndOfSentenceDot() +void BufferView::endOfSentenceDot() { - if (current_view->available()) { - current_view->getScreen()->HideCursor(); - current_view->update(-2); + if (available()) { + getScreen()->HideCursor(); + update(-2); InsetSpecialChar * new_inset = new InsetSpecialChar(InsetSpecialChar::END_OF_SENTENCE); - current_view->buffer()->insertInset(new_inset); + insertInset(new_inset); } } -// candidate for move to BufferView -void MenuSeparator() +void BufferView::menuSeparator() { - if (current_view->available()) { - current_view->getScreen()->HideCursor(); - current_view->update(-2); + if (available()) { + getScreen()->HideCursor(); + update(-2); InsetSpecialChar * new_inset = new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR); - current_view->buffer()->insertInset(new_inset); + insertInset(new_inset); } } -// candidate for move to BufferView -void Newline() +void BufferView::newline() { - if (current_view->available()) { - current_view->getScreen()->HideCursor(); - current_view->update(-2); - current_view->text->InsertChar(LyXParagraph::META_NEWLINE); - current_view->update(-1); + if (available()) { + getScreen()->HideCursor(); + update(-2); + text->InsertChar(LyXParagraph::META_NEWLINE); + update(-1); } } -// candidate for move to BufferView -void ProtectedBlank() +void BufferView::protectedBlank() { - if (current_view->available()) { - current_view->getScreen()->HideCursor(); - current_view->update(-2); - current_view->text->InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR); - current_view->update(-1); + if (available()) { + getScreen()->HideCursor(); + update(-2); + text->InsertChar(LyXParagraph::META_PROTECTED_SEPARATOR); + update(-1); } } -// candidate for move to BufferView -void HFill() +void BufferView::hfill() { - if (current_view->available()) { - current_view->getScreen()->HideCursor(); - current_view->update(-2); - current_view->text->InsertChar(LyXParagraph::META_HFILL); - current_view->update(-1); + if (available()) { + getScreen()->HideCursor(); + update(-2); + text->InsertChar(LyXParagraph::META_HFILL); + update(-1); } } @@ -2393,10 +2358,6 @@ void ToggleAndShow(LyXFont const & font) current_view->text->ToggleFree(font, toggleall); current_view->update(1); } - // removed since it overrides the ToggleFree Message about the style - // Since Styles are more "High Level" than raw fonts I think the user - // prefers it like this Matthias - // FontStateShowCB( 0, 0 ); } @@ -2437,78 +2398,73 @@ extern "C" void TableCB(FL_OBJECT *, long) } -// candidate for move to BufferView -void CopyEnvironmentCB() +void BufferView::copyEnvironment() { - if (current_view->available()) { - current_view->text->copyEnvironmentType(); - /* clear the selection, even if mark_set */ - current_view->getScreen()->ToggleSelection(); - current_view->text->ClearSelection(); - current_view->update(-2); - current_view->owner()->getMiniBuffer()->Set(_("Paragraph environment type copied")); + if (available()) { + text->copyEnvironmentType(); + // clear the selection, even if mark_set + getScreen()->ToggleSelection(); + text->ClearSelection(); + update(-2); + owner()->getMiniBuffer()->Set(_("Paragraph environment type copied")); } } -// candidate for move to BufferView -void PasteEnvironmentCB() +void BufferView::pasteEnvironment() { - if (current_view->available()) { - current_view->text->pasteEnvironmentType(); - current_view->owner()->getMiniBuffer()->Set(_("Paragraph environment type set")); - current_view->update(1); + if (available()) { + text->pasteEnvironmentType(); + owner()->getMiniBuffer()->Set(_("Paragraph environment type set")); + update(1); } } -// candidate for move to BufferView -void CopyCB() +void BufferView::copy() { - if (current_view->available()) { - current_view->text->CopySelection(); - /* clear the selection, even if mark_set */ - current_view->getScreen()->ToggleSelection(); - current_view->text->ClearSelection(); - current_view->update(-2); - current_view->owner()->getMiniBuffer()->Set(_("Copy")); + if (available()) { + text->CopySelection(); + // clear the selection, even if mark_set + getScreen()->ToggleSelection(); + text->ClearSelection(); + update(-2); + owner()->getMiniBuffer()->Set(_("Copy")); } } -// candidate for move to BufferView -void CutCB() +void BufferView::cut() { - if (current_view->available()) { - current_view->getScreen()->HideCursor(); - current_view->update(-2); - current_view->text->CutSelection(); - current_view->update(1); - current_view->owner()->getMiniBuffer()->Set(_("Cut")); + if (available()) { + getScreen()->HideCursor(); + update(-2); + text->CutSelection(); + update(1); + owner()->getMiniBuffer()->Set(_("Cut")); } } -// candidate for move to BufferView -void PasteCB() +void BufferView::paste() { - if (!current_view->available()) return; + if (!available()) return; - current_view->owner()->getMiniBuffer()->Set(_("Paste")); - current_view->getScreen()->HideCursor(); - /* clear the selection */ - current_view->getScreen()->ToggleSelection(); - current_view->text->ClearSelection(); - current_view->update(-2); + owner()->getMiniBuffer()->Set(_("Paste")); + getScreen()->HideCursor(); + // clear the selection + getScreen()->ToggleSelection(); + text->ClearSelection(); + update(-2); - /* paste */ - current_view->text->PasteSelection(); - current_view->update(1); + // paste + text->PasteSelection(); + update(1); - /* clear the selection */ - current_view->getScreen()->ToggleSelection(); - current_view->text->ClearSelection(); - current_view->update(-2); + // clear the selection + getScreen()->ToggleSelection(); + text->ClearSelection(); + update(-2); } @@ -3104,54 +3060,46 @@ extern "C" void DocumentBulletsCB(FL_OBJECT *, long) } -// candidate for move to BufferView -void GotoNote() +void BufferView::gotoNote() { - if (!current_view->getScreen()) - return; + if (!getScreen()) return; - current_view->getScreen()->HideCursor(); - current_view->beforeChange(); - current_view->update(-2); + getScreen()->HideCursor(); + beforeChange(); + update(-2); LyXCursor tmp; - if (!current_view->text->GotoNextNote()) { - if (current_view->text->cursor.pos - || current_view->text->cursor.par != - current_view->text->FirstParagraph()) - { - tmp = current_view->text->cursor; - current_view->text->cursor.par = - current_view->text->FirstParagraph(); - current_view->text->cursor.pos = 0; - if (!current_view->text->GotoNextNote()) { - current_view->text->cursor = tmp; - current_view->owner()->getMiniBuffer()->Set(_("No more notes")); + if (!text->GotoNextNote()) { + if (text->cursor.pos + || text->cursor.par != text->FirstParagraph()) { + tmp = text->cursor; + text->cursor.par = text->FirstParagraph(); + text->cursor.pos = 0; + if (!text->GotoNextNote()) { + text->cursor = tmp; + owner()->getMiniBuffer()->Set(_("No more notes")); LyXBell(); } } else { - current_view->owner()->getMiniBuffer()->Set(_("No more notes")); + owner()->getMiniBuffer()->Set(_("No more notes")); LyXBell(); } } - current_view->update(0); - current_view->text->sel_cursor = - current_view->text->cursor; + update(0); + text->sel_cursor = text->cursor; } -// candidate for move to BufferView -void InsertCorrectQuote() +void BufferView::insertCorrectQuote() { - Buffer * cbuffer = current_view->buffer(); char c; - if (current_view->text->cursor.pos ) - c = current_view->text->cursor.par->GetChar(current_view->text->cursor.pos - 1); + if (text->cursor.pos) + c = text->cursor.par->GetChar(text->cursor.pos - 1); else c = ' '; - cbuffer->insertInset(new InsetQuotes(c, cbuffer->params)); + insertInset(new InsetQuotes(c, buffer()->params)); } @@ -3525,7 +3473,7 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long) if (fl_get_button(fd_form_figure->radio_inline) || current_view->text->cursor.par->table) { InsetFig * new_inset = new InsetFig(100, 20, buffer); - buffer->insertInset(new_inset); + current_view->insertInset(new_inset); current_view->owner()->getMiniBuffer()->Set(_("Figure inserted")); new_inset->Edit(0, 0); return; @@ -3574,7 +3522,7 @@ extern "C" void FigureApplyCB(FL_OBJECT *, long) current_view->update(-1); Inset * new_inset = new InsetFig(100, 100, buffer); - buffer->insertInset(new_inset); + current_view->insertInset(new_inset); new_inset->Edit(0, 0); current_view->update(0); current_view->owner()->getMiniBuffer()->Set(_("Figure inserted")); @@ -3661,74 +3609,66 @@ void Reconfigure() } -// candidate for move to BufferView /* these functions are for the spellchecker */ -char * NextWord(float & value) +char * BufferView::nextWord(float & value) { - if (!current_view->available()){ + if (!available()) { value = 1; return 0; } - char * string = current_view->text->SelectNextWord(value); + char * string = text->SelectNextWord(value); return string; } -// candidate for move to BufferView -void SelectLastWord() +void BufferView::selectLastWord() { - if (!current_view->available()) - return; + if (!available()) return; - current_view->getScreen()->HideCursor(); - current_view->beforeChange(); - current_view->text->SelectSelectedWord(); - current_view->getScreen()->ToggleSelection(false); - current_view->update(0); + getScreen()->HideCursor(); + beforeChange(); + text->SelectSelectedWord(); + getScreen()->ToggleSelection(false); + update(0); } -// candidate for move to BufferView -void EndOfSpellCheck() +void BufferView::endOfSpellCheck() { - if (!current_view->available()) - return; + if (!available()) return; - current_view->getScreen()->HideCursor(); - current_view->beforeChange(); - current_view->text->SelectSelectedWord(); - current_view->text->ClearSelection(); - current_view->update(0); + getScreen()->HideCursor(); + beforeChange(); + text->SelectSelectedWord(); + text->ClearSelection(); + update(0); } -// candidate for move to BufferView -void ReplaceWord(string const & replacestring) +void BufferView::replaceWord(string const & replacestring) { - if (!current_view->getScreen()) - return; + if (!getScreen()) return; - current_view->getScreen()->HideCursor(); - current_view->update(-2); + getScreen()->HideCursor(); + update(-2); /* clear the selection (if there is any) */ - current_view->getScreen()->ToggleSelection(false); - current_view->update(-2); + getScreen()->ToggleSelection(false); + update(-2); /* clear the selection (if there is any) */ - current_view->getScreen()->ToggleSelection(false); - current_view->text-> - ReplaceSelectionWithString(replacestring.c_str()); + getScreen()->ToggleSelection(false); + text->ReplaceSelectionWithString(replacestring.c_str()); - current_view->text->SetSelectionOverString(replacestring.c_str()); + text->SetSelectionOverString(replacestring.c_str()); // Go back so that replacement string is also spellchecked for (string::size_type i = 0; i < replacestring.length() + 1; ++i) { - current_view->text->CursorLeftIntern(); + text->CursorLeftIntern(); } - current_view->update(1); + update(1); } // End of spellchecker stuff @@ -3932,7 +3872,7 @@ extern "C" void RefSelectCB(FL_OBJECT *, long data) Inset * new_inset = new InsetRef(t, current_view->buffer()); - current_view->buffer()->insertInset(new_inset); + current_view->insertInset(new_inset); } @@ -4048,81 +3988,71 @@ void UpdateInset(Inset * inset, bool mark_dirty) } -// candidate for move to BufferView /* these functions return 1 if an error occured, otherwise 0 */ -int LockInset(UpdatableInset * inset) +int BufferView::lockInset(UpdatableInset * inset) { - if (!current_view->the_locking_inset && inset){ - current_view->the_locking_inset = inset; + if (!the_locking_inset && inset){ + the_locking_inset = inset; return 0; } return 1; } -// candidate for move to BufferView -void ShowLockedInsetCursor(long x, long y, int asc, int desc) +void BufferView::showLockedInsetCursor(long x, long y, int asc, int desc) { - if (current_view->the_locking_inset && - current_view->getScreen()){ - y += current_view->text->cursor.y; - current_view->getScreen()->ShowManualCursor(x, y, - asc, desc); + if (the_locking_inset && getScreen()) { + y += text->cursor.y; + getScreen()->ShowManualCursor(x, y, + asc, desc); } } -// candidate for move to BufferView -void HideLockedInsetCursor(long x, long y, int asc, int desc) +void BufferView::hideLockedInsetCursor(long x, long y, int asc, int desc) { - if (current_view->the_locking_inset && - current_view->getScreen()){ - y += current_view->text->cursor.y; - current_view->getScreen()->HideManualCursor(x, y, - asc, desc); + if (the_locking_inset && getScreen()) { + y += text->cursor.y; + getScreen()->HideManualCursor(x, y, + asc, desc); } } -// candidate for move to BufferView -void FitLockedInsetCursor(long x, long y, int asc, int desc) +void BufferView::fitLockedInsetCursor(long x, long y, int asc, int desc) { - if (current_view->the_locking_inset && - current_view->getScreen()){ - y += current_view->text->cursor.y; - if (current_view->getScreen()->FitManualCursor(x, y, asc, desc)) - current_view->updateScrollbar(); + if (the_locking_inset && getScreen()){ + y += text->cursor.y; + if (getScreen()->FitManualCursor(x, y, asc, desc)) + updateScrollbar(); } } -// candidate for move to BufferView -int UnlockInset(UpdatableInset * inset) +int BufferView::unlockInset(UpdatableInset * inset) { - if (inset && - current_view->the_locking_inset == inset){ + if (inset && the_locking_inset == inset) { inset->InsetUnlock(); - current_view->the_locking_inset = 0; - current_view->text->FinishUndo(); + the_locking_inset = 0; + text->FinishUndo(); return 0; } return bufferlist.unlockInset(inset); } -// candidate for move to BufferView -void LockedInsetStoreUndo(Undo::undo_kind kind) +void BufferView::lockedInsetStoreUndo(Undo::undo_kind kind) { - if (!current_view->the_locking_inset) + if (!the_locking_inset) return; // shouldn't happen if (kind == Undo::EDIT) // in this case insets would not be stored! kind = Undo::FINISH; - current_view->text->SetUndo(kind, - current_view->text->cursor.par-> - ParFromPos(current_view->text->cursor.pos)->previous, - current_view->text->cursor.par-> - ParFromPos(current_view->text->cursor.pos)->next); + text->SetUndo(kind, + text->cursor.par-> + ParFromPos(text->cursor.pos)->previous, + text->cursor.par-> + ParFromPos(text->cursor.pos)->next); } diff --git a/src/lyx_cb.h b/src/lyx_cb.h index 503733ff2b..9619bdd979 100644 --- a/src/lyx_cb.h +++ b/src/lyx_cb.h @@ -38,14 +38,6 @@ extern "C" void DepthCB(FL_OBJECT *, long); /// extern void FreeCB(); /// -extern void CutCB(); -/// -extern void PasteCB(); -/// -extern void CopyCB(); -/// -extern void NoteCB(); -/// extern void HtmlUrlCB(); /// extern void UrlCB(); @@ -71,9 +63,9 @@ extern void AllowInput(); /// struct InsetUpdateStruct { /// - Inset* inset; + Inset * inset; /// - InsetUpdateStruct* next; + InsetUpdateStruct * next; }; #endif diff --git a/src/lyxfunc.C b/src/lyxfunc.C index a997bf8e24..b44d7e6cc9 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -96,19 +96,6 @@ extern tex_accent_struct get_accent(kb_action action); extern void AutoSave(); extern void MenuSearch(); -extern void CopyCB(); -extern void CopyEnvironmentCB(); -extern void PasteEnvironmentCB(); -extern void GotoNote(); -extern void NoteCB(); -extern void OpenStuff(); -extern void HyphenationPoint(); -extern void Ldots(); -extern void EndOfSentenceDot(); -extern void MenuSeparator(); -extern void HFill(); -extern void MenuUndo(); -extern void MenuRedo(); extern void SetUpdateTimer(float timer = 0.3); extern void FreeUpdateTimer(); extern bool MenuPreview(Buffer *); @@ -132,7 +119,7 @@ extern void Reconfigure(); extern int current_layout; extern int getISOCodeFromLaTeX(char *); -extern int UnlockInset(UpdatableInset *); +//extern int UnlockInset(UpdatableInset *); extern void ShowLatexLog(); @@ -209,7 +196,7 @@ int LyXFunc::processKeyEvent(XEvent * ev) if (owner->view()->available() && owner->view()->the_locking_inset && keysym_return == XK_Escape) { - UnlockInset(owner->view()->the_locking_inset); + owner->view()->unlockInset(owner->view()->the_locking_inset); owner->view()->text->CursorRight(); return 0; } @@ -534,8 +521,8 @@ string LyXFunc::Dispatch(int ac, UpdatableInset * inset = owner->view()->the_locking_inset; inset->GetCursorPos(slx, sly); - UnlockInset(inset); - MenuUndo(); + owner->view()->unlockInset(inset); + owner->view()->menuUndo(); inset = static_cast(owner->view()->text->cursor.par->GetInset(owner->view()->text->cursor.pos)); if (inset) inset->Edit(slx, sly); @@ -545,8 +532,8 @@ string LyXFunc::Dispatch(int ac, int slx, sly; UpdatableInset * inset = owner->view()->the_locking_inset; inset->GetCursorPos(slx, sly); - UnlockInset(inset); - MenuRedo(); + owner->view()->unlockInset(inset); + owner->view()->menuRedo(); inset = static_cast(owner->view()->text->cursor.par->GetInset(owner->view()->text->cursor.pos)); if (inset) inset->Edit(slx, sly); @@ -792,28 +779,28 @@ string LyXFunc::Dispatch(int ac, case LFUN_TOC_INSERT: { Inset * new_inset = new InsetTOC(owner->buffer()); - owner->buffer()->insertInset(new_inset, "Standard", true); + owner->view()->insertInset(new_inset, "Standard", true); break; } case LFUN_LOF_INSERT: { Inset * new_inset = new InsetLOF(owner->buffer()); - owner->buffer()->insertInset(new_inset, "Standard", true); + owner->view()->insertInset(new_inset, "Standard", true); break; } case LFUN_LOA_INSERT: { Inset * new_inset = new InsetLOA(owner->buffer()); - owner->buffer()->insertInset(new_inset, "Standard", true); + owner->view()->insertInset(new_inset, "Standard", true); break; } case LFUN_LOT_INSERT: { Inset * new_inset = new InsetLOT(owner->buffer()); - owner->buffer()->insertInset(new_inset, "Standard", true); + owner->view()->insertInset(new_inset, "Standard", true); break; } @@ -830,11 +817,11 @@ string LyXFunc::Dispatch(int ac, break; case LFUN_UNDO: - MenuUndo(); + owner->view()->menuUndo(); break; case LFUN_REDO: - MenuRedo(); + owner->view()->menuRedo(); break; case LFUN_MENUSEARCH: @@ -842,7 +829,7 @@ string LyXFunc::Dispatch(int ac, break; case LFUN_PASTE: - PasteCB(); + owner->view()->paste(); break; case LFUN_PASTESELECTION: @@ -854,19 +841,19 @@ string LyXFunc::Dispatch(int ac, } case LFUN_CUT: - CutCB(); + owner->view()->cut(); break; case LFUN_COPY: - CopyCB(); + owner->view()->copy(); break; case LFUN_LAYOUT_COPY: - CopyEnvironmentCB(); + owner->view()->copyEnvironment(); break; case LFUN_LAYOUT_PASTE: - PasteEnvironmentCB(); + owner->view()->pasteEnvironment(); break; case LFUN_GOTOERROR: @@ -874,7 +861,7 @@ string LyXFunc::Dispatch(int ac, break; case LFUN_REMOVEERRORS: - if (owner->buffer()->removeAutoInsets()) { + if (owner->view()->removeAutoInsets()) { owner->view()->redraw(); owner->view()->fitCursor(); owner->view()->updateScrollbar(); @@ -882,31 +869,31 @@ string LyXFunc::Dispatch(int ac, break; case LFUN_GOTONOTE: - GotoNote(); + owner->view()->gotoNote(); break; case LFUN_OPENSTUFF: - OpenStuff(); + owner->view()->openStuff(); break; case LFUN_HYPHENATION: - HyphenationPoint(); + owner->view()->hyphenationPoint(); break; case LFUN_LDOTS: - Ldots(); + owner->view()->ldots(); break; case LFUN_END_OF_SENTENCE: - EndOfSentenceDot(); + owner->view()->endOfSentenceDot(); break; case LFUN_MENU_SEPARATOR: - MenuSeparator(); + owner->view()->menuSeparator(); break; case LFUN_HFILL: - HFill(); + owner->view()->hfill(); break; case LFUN_DEPTH: @@ -1255,7 +1242,7 @@ string LyXFunc::Dispatch(int ac, if (!label.empty()) { owner->view()->savePosition(); - owner->buffer()->gotoLabel(label.c_str()); + owner->view()->gotoLabel(label.c_str()); } } break; @@ -1605,7 +1592,7 @@ string LyXFunc::Dispatch(int ac, // just comment out the lone below... owner->view()->getScreen()->ShowCursor(); } else { - CutCB(); + owner->view()->cut(); } SetUpdateTimer(); break; @@ -1649,7 +1636,7 @@ string LyXFunc::Dispatch(int ac, owner->view()->smallUpdate(1); } } else { - CutCB(); + owner->view()->cut(); } SetUpdateTimer(); } @@ -1718,7 +1705,7 @@ string LyXFunc::Dispatch(int ac, owner->view()->getScreen()->ShowCursor(); } } else { - CutCB(); + owner->view()->cut(); } SetUpdateTimer(); } @@ -1751,7 +1738,7 @@ string LyXFunc::Dispatch(int ac, owner->view()->smallUpdate (1); } } else - CutCB(); + owner->view()->cut(); SetUpdateTimer(); } break; @@ -1825,7 +1812,7 @@ string LyXFunc::Dispatch(int ac, new_inset = new InsetUrl("htmlurl", "", ""); else new_inset = new InsetUrl("url", "", ""); - owner->buffer()->insertInset(new_inset); + owner->view()->insertInset(new_inset); new_inset->Edit(0, 0); } break; @@ -1919,7 +1906,7 @@ string LyXFunc::Dispatch(int ac, owner->view()->buffer(bufferlist.loadLyXFile(s)); // Set the cursor - owner->buffer()->setCursorFromRow(row); + owner->view()->setCursorFromRow(row); // Recenter screen owner->view()->beforeChange(); @@ -2066,7 +2053,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_INSERT_MATRIX: { if (owner->view()->available()) { - owner->buffer()-> + owner->view()-> open_new_inset(new InsetFormula(false)); owner->view()-> the_locking_inset->LocalDispatch(action, argument.c_str()); @@ -2083,7 +2070,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_MATH_DISPLAY: { if (owner->view()->available()) - owner->buffer()->open_new_inset(new InsetFormula(true)); + owner->view()->open_new_inset(new InsetFormula(true)); break; } @@ -2096,7 +2083,7 @@ string LyXFunc::Dispatch(int ac, else { string s1 = token(s, ' ', 1); int na = s1.empty() ? 0: atoi(s1.c_str()); - owner->buffer()-> + owner->view()-> open_new_inset(new InsetFormulaMacro(token(s, ' ', 0), na)); } } @@ -2107,7 +2094,7 @@ string LyXFunc::Dispatch(int ac, { if (owner->view()->available()) - owner->buffer()->open_new_inset(new InsetFormula); + owner->view()->open_new_inset(new InsetFormula); setMessage(N_("Math editor mode")); } break; @@ -2132,9 +2119,9 @@ string LyXFunc::Dispatch(int ac, new_inset->setOptions(token(lsarg, '|', 1)); } else new_inset->setContents(lsarg); - owner->buffer()->insertInset(new_inset); + owner->view()->insertInset(new_inset); } else { - owner->buffer()->insertInset(new_inset); + owner->view()->insertInset(new_inset); new_inset->Edit(0, 0); } } @@ -2154,7 +2141,7 @@ string LyXFunc::Dispatch(int ac, bibstyle, owner->buffer()); - owner->buffer()->insertInset(new_inset); + owner->view()->insertInset(new_inset); if (lsarg.empty()) { new_inset->Edit(0, 0); } @@ -2203,7 +2190,7 @@ string LyXFunc::Dispatch(int ac, if (!argument.empty()) { string lsarg(argument); new_inset->setContents(lsarg); - owner->buffer()->insertInset(new_inset); + owner->view()->insertInset(new_inset); } else { //reh 98/09/21 //get the current word for an argument @@ -2235,7 +2222,7 @@ string LyXFunc::Dispatch(int ac, //put the new inset into the buffer. // there should be some way of knowing the user //cancelled & avoiding this, but i don't know how - owner->buffer()->insertInset(new_inset); + owner->view()->insertInset(new_inset); } } break; @@ -2243,7 +2230,7 @@ string LyXFunc::Dispatch(int ac, case LFUN_INDEX_PRINT: { Inset * new_inset = new InsetPrintIndex(owner->buffer()); - owner->buffer()->insertInset(new_inset, "Standard", true); + owner->view()->insertInset(new_inset, "Standard", true); } break; @@ -2251,7 +2238,7 @@ string LyXFunc::Dispatch(int ac, { lyxerr << "arg " << argument << endl; Inset * new_inset = new InsetParent(argument, owner->buffer()); - owner->buffer()->insertInset(new_inset, "Standard", true); + owner->view()->insertInset(new_inset, "Standard", true); } break; @@ -2259,7 +2246,7 @@ string LyXFunc::Dispatch(int ac, { Inset * new_inset = new InsetInclude(argument, owner->buffer()); - owner->buffer()->insertInset(new_inset, "Standard", true); + owner->view()->insertInset(new_inset, "Standard", true); new_inset->Edit(0, 0); } break; @@ -2280,7 +2267,7 @@ string LyXFunc::Dispatch(int ac, break; case LFUN_INSERT_NOTE: - NoteCB(); + owner->view()->insertNote(); break; case LFUN_INSERTFOOTNOTE: @@ -2803,7 +2790,7 @@ void LyXFunc::MenuInsertLyXFile(string const & filen) // Inserts document owner->getMiniBuffer()->Set(_("Inserting document"), MakeDisplayPath(filename), "..."); - bool res = owner->buffer()->insertLyXFile(filename); + bool res = owner->view()->insertLyXFile(filename); if (res) { owner->getMiniBuffer()->Set(_("Document"), MakeDisplayPath(filename), diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 82565a5298..6444ce8ec1 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -42,12 +42,12 @@ #include "LyXView.h" extern void UpdateInset(Inset * inset, bool mark_dirty = true); -extern void LockedInsetStoreUndo(Undo::undo_kind); -extern void ShowLockedInsetCursor(long, long, int, int); -extern void HideLockedInsetCursor(long, long, int, int); -extern void FitLockedInsetCursor(long, long, int, int); -extern int LockInset(UpdatableInset *); -extern int UnlockInset(UpdatableInset *); +//extern void LockedInsetStoreUndo(Undo::undo_kind); +//extern void ShowLockedInsetCursor(long, long, int, int); +//extern void HideLockedInsetCursor(long, long, int, int); +//extern void FitLockedInsetCursor(long, long, int, int); +//extern int LockInset(UpdatableInset *); +//extern int UnlockInset(UpdatableInset *); extern GC canvasGC, mathGC, mathLineGC, latexGC, cursorGC, mathFrameGC; @@ -483,7 +483,7 @@ void InsetFormula::Draw(LyXFont f, LyXScreen & scr, int baseline, float & x) void InsetFormula::Edit(int x, int y) { mathcursor = new MathedCursor(par); - LockInset(this); + current_view->lockInset(this); par->Metrics(); UpdateInset(this, false); x += par->xo; @@ -538,9 +538,9 @@ void InsetFormula::ToggleInsetCursor() desc = font.maxDescent(); if (cursor_visible) - HideLockedInsetCursor(x, y, asc, desc); + current_view->hideLockedInsetCursor(x, y, asc, desc); else - ShowLockedInsetCursor(x, y, asc, desc); + current_view->showLockedInsetCursor(x, y, asc, desc); cursor_visible = !cursor_visible; } @@ -556,7 +556,7 @@ void InsetFormula::ShowInsetCursor() LyXFont font = WhichFont(LM_TC_TEXTRM, LM_ST_TEXT); asc = font.maxAscent(); desc = font.maxDescent(); - FitLockedInsetCursor(x, y, asc, desc); + current_view->fitLockedInsetCursor(x, y, asc, desc); } ToggleInsetCursor(); } @@ -786,24 +786,24 @@ bool InsetFormula::LocalDispatch(int action, char const * arg) mathcursor->End(); break; case LFUN_DELETE_LINE_FORWARD: - //LockedInsetStoreUndo(Undo::INSERT); - LockedInsetStoreUndo(Undo::DELETE); + //current_view->lockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::DELETE); mathcursor->DelLine(); UpdateLocal(); break; case LFUN_BREAKLINE: - LockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::INSERT); mathcursor->Insert(' ', LM_TC_CR); par = mathcursor->GetPar(); UpdateLocal(); break; case LFUN_TAB: - LockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::INSERT); mathcursor->Insert(0, LM_TC_TAB); //UpdateInset(this); break; case LFUN_TABINSERT: - LockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::INSERT); mathcursor->Insert('T', LM_TC_TAB); UpdateLocal(); break; @@ -817,8 +817,8 @@ bool InsetFormula::LocalDispatch(int action, char const * arg) } case LFUN_DELETE: - //LockedInsetStoreUndo(Undo::INSERT); - LockedInsetStoreUndo(Undo::DELETE); + //current_view->lockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::DELETE); mathcursor->Delete(); UpdateInset(this); break; @@ -840,10 +840,10 @@ bool InsetFormula::LocalDispatch(int action, char const * arg) case LFUN_PASTE: if (was_macro) mathcursor->MacroModeClose(); - LockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::INSERT); mathcursor->SelPaste(); UpdateLocal(); break; case LFUN_CUT: - LockedInsetStoreUndo(Undo::DELETE); + current_view->lockedInsetStoreUndo(Undo::DELETE); mathcursor->SelCut(); UpdateLocal(); break; case LFUN_COPY: mathcursor->SelCopy(); break; case LFUN_HOMESEL: @@ -904,7 +904,7 @@ bool InsetFormula::LocalDispatch(int action, char const * arg) case LFUN_MATH_NUMBER: { - LockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::INSERT); if (disp_flag) { short type = par->GetType(); bool oldf = (type == LM_OT_PARN || type == LM_OT_MPARN); @@ -939,7 +939,7 @@ bool InsetFormula::LocalDispatch(int action, char const * arg) case LFUN_MATH_LIMITS: { - LockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::INSERT); if (mathcursor->Limits()) UpdateLocal(); } @@ -955,14 +955,14 @@ bool InsetFormula::LocalDispatch(int action, char const * arg) case LFUN_INSERT_MATH: { - LockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::INSERT); InsertSymbol(arg); break; } case LFUN_INSERT_MATRIX: { - LockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::INSERT); int k, m, n; char s[80], arg2[80]; // This is just so that too long args won't ooze out of s. @@ -988,7 +988,7 @@ bool InsetFormula::LocalDispatch(int action, char const * arg) case LFUN_MATH_DELIM: { - LockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::INSERT); char lf[40], rg[40], arg2[40]; int ilf = '(', irg = '.'; latexkeys * l; @@ -1032,7 +1032,7 @@ bool InsetFormula::LocalDispatch(int action, char const * arg) case LFUN_PROTECTEDSPACE: { - LockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::INSERT); sp = new MathSpaceInset(1); mathcursor->Insert(sp); space_on = true; @@ -1042,7 +1042,7 @@ bool InsetFormula::LocalDispatch(int action, char const * arg) case LFUN_INSERT_LABEL: { - LockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::INSERT); if (par->GetType() < LM_OT_PAR) break; string lb = arg; if (lb.empty()) { @@ -1069,8 +1069,8 @@ bool InsetFormula::LocalDispatch(int action, char const * arg) } case LFUN_MATH_DISPLAY: - //LockedInsetStoreUndo(Undo::INSERT); - LockedInsetStoreUndo(Undo::EDIT); + //current_view->lockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::EDIT); display(!disp_flag); UpdateLocal(); break; @@ -1099,7 +1099,7 @@ bool InsetFormula::LocalDispatch(int action, char const * arg) default: if ((action == -1 || action == LFUN_SELFINSERT) && arg) { unsigned char c = arg[0]; - LockedInsetStoreUndo(Undo::INSERT); + current_view->lockedInsetStoreUndo(Undo::INSERT); if (c == ' ' && mathcursor->getAccent() == LM_hat) { c = '^'; @@ -1214,7 +1214,7 @@ bool InsetFormula::LocalDispatch(int action, char const * arg) if (result) ShowInsetCursor(); else - UnlockInset(this); + current_view->unlockInset(this); return result; } diff --git a/src/mathed/math_symbols.C b/src/mathed/math_symbols.C index ef25770805..3766bc2e53 100644 --- a/src/mathed/math_symbols.C +++ b/src/mathed/math_symbols.C @@ -39,8 +39,8 @@ using std::max; #include "math_panel.h" #include "math_parser.h" -extern void Update(signed char); -extern int UnlockInset(UpdatableInset *); +//extern void Update(signed char); +//extern int UnlockInset(UpdatableInset *); extern short greek_kb_flag; extern BufferView * current_view; @@ -355,20 +355,21 @@ Bool math_insert_greek(char const c) math_insert_symbol(s); if (greek_kb_flag<2) { greek_kb_flag = 0; - UnlockInset(current_view->the_locking_inset); + current_view->unlockInset(current_view->the_locking_inset); } return True; } else return False; } -void math_insert_symbol(char const* s) + +void math_insert_symbol(char const * s) { if (current_view->available()) { if (!current_view->the_locking_inset) { InsetFormula * new_inset = new InsetFormula(); current_view->beforeChange(); - current_view->buffer()->insertInset(new_inset); + current_view->insertInset(new_inset); // Update(1);//BUG new_inset->Edit(0, 0); new_inset->InsertSymbol(s); @@ -381,6 +382,7 @@ void math_insert_symbol(char const* s) } } + BitmapMenu * sym_menu= 0; void create_symbol_menues(FD_panel * symb_form) diff --git a/src/menus.C b/src/menus.C index b0138cb079..686dc9c827 100644 --- a/src/menus.C +++ b/src/menus.C @@ -59,9 +59,6 @@ extern void ShowCopyright(); extern void show_symbols_form(LyXFunc *); extern void ProhibitInput(); extern void AllowInput(); -extern void OpenStuff(); -extern void ToggleFloat(); -extern void AllFloats(char flag, char figmar); extern void LaTeXOptions(); // A bunch of wrappers @@ -1067,12 +1064,12 @@ void Menus::ShowEditMenu(FL_OBJECT * ob, long) case 17: tmpfunc->Dispatch(LFUN_PASTESELECTION, "paragraph"); break; // floats & insets sub-menu - case 21: ToggleFloat(); break; + case 21: men->currentView()->toggleFloat(); break; case 22: tmpfunc->Dispatch(LFUN_MELT); break; - case 23: AllFloats(1, 0); break; - case 24: AllFloats(0, 0); break; - case 25: AllFloats(1, 1); break; - case 26: AllFloats(0, 1); break; + case 23: men->currentView()->allFloats(1, 0); break; + case 24: men->currentView()->allFloats(0, 0); break; + case 25: men->currentView()->allFloats(1, 1); break; + case 26: men->currentView()->allFloats(0, 1); break; case 27: tmpfunc->Dispatch(LFUN_REMOVEERRORS); break; case 31: tmpfunc->Dispatch(LFUN_TABLE); break; diff --git a/src/spellchecker.C b/src/spellchecker.C index 2d1f385cc8..4c01047754 100644 --- a/src/spellchecker.C +++ b/src/spellchecker.C @@ -626,7 +626,7 @@ void ShowSpellChecker() if (obj == fd_form_spell_check->done) break; } fl_hide_form(fd_form_spell_check->form_spell_check); - EndOfSpellCheck(); + current_view->endOfSpellCheck(); return; } @@ -666,7 +666,7 @@ bool RunSpellChecker(string const & lang) ispell_terse_mode(); while (true) { - word = NextWord(newval); + word = current_view->nextWord(newval); if (word == 0) break; word_count++; @@ -700,7 +700,7 @@ bool RunSpellChecker(string const & lang) switch (result->flag) { case ISP_UNKNOWN: case ISP_MISSED: - SelectLastWord(); + current_view->selectLastWord(); fl_set_object_label(fd_form_spell_check->text, word); fl_set_input(fd_form_spell_check->input, word); fl_clear_browser(fd_form_spell_check->browser); @@ -725,7 +725,7 @@ bool RunSpellChecker(string const & lang) if (obj == fd_form_spell_check->replace || obj == fd_form_spell_check->input) { ispell_store_replacement(word, fl_get_input(fd_form_spell_check->input)); - ReplaceWord(fl_get_input(fd_form_spell_check->input)); + current_view->replaceWord(fl_get_input(fd_form_spell_check->input)); break; } if (obj == fd_form_spell_check->browser) { @@ -734,7 +734,7 @@ bool RunSpellChecker(string const & lang) if (clickline == fl_get_browser(fd_form_spell_check->browser)) { ispell_store_replacement(word, fl_get_input(fd_form_spell_check->input)); - ReplaceWord(fl_get_input(fd_form_spell_check->input)); + current_view->replaceWord(fl_get_input(fd_form_spell_check->input)); break; } clickline = fl_get_browser(fd_form_spell_check->browser); diff --git a/src/spellchecker.h b/src/spellchecker.h index 1487e025a0..65e0a8f973 100644 --- a/src/spellchecker.h +++ b/src/spellchecker.h @@ -4,21 +4,14 @@ /* These functions are defined in lyx_cb.C */ -/** The returned word has to be deleted manually - */ -char * NextWord(float & value); - /** MarkLastWord should only be used immidiately after NextWord(). If you give control back to the user, you _have_ to call EndOfSpellCheck() or SelectLastWord(), otherwise segfaults should appear. */ -void EndOfSpellCheck(); +//void EndOfSpellCheck(); /// -void SelectLastWord(); -/// -void ReplaceWord(string const & replacestringstring); - +//void SelectLastWord(); /** This function has to be implemented by the spell checker. It will show the spellcheker form*/ diff --git a/src/support/block.h b/src/support/block.h index 49279b1879..7c44eedd9c 100644 --- a/src/support/block.h +++ b/src/support/block.h @@ -10,13 +10,22 @@ class block { public: typedef T value_type; typedef size_t size_type; - typedef value_type * pointer; - typedef value_type const * const_pointer; - typedef value_type & reference; - typedef value_type const & const_reference; - typedef value_type * iterator; - typedef value_type const * const_iterator; + typedef T * pointer; + typedef T const * const_pointer; + typedef T & reference; + typedef T const & const_reference; + typedef T * iterator; + typedef T const * const_iterator; size_type size() const { return s; } + operator T* () { return arr; } + reference at(int i) { + Assert(i >= 0 && i < s); + return arr[i]; + } + const_reference at(int i) const { + Assert(i >= 0 && i < s); + return arr[i]; + } reference operator[](int i) { return arr[i]; } const_reference operator[](int i) const { return arr[i]; } void operator=(block const & b) { @@ -37,7 +46,7 @@ public: const_iterator begin() const { return arr[0]; } const_iterator end() const { return arr[s]; } private: - value_type arr[s + 1]; + T arr[s]; }; #endif // BLOCK_H_ diff --git a/src/support/filetools.C b/src/support/filetools.C index 34d1aac5a6..5f3e939d20 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -324,9 +324,21 @@ bool PutEnv(string const & envstr) // Is doing a getenv() and a free() of the older value // a good idea? (JMarc) // Actually we don't have to leak...calling putenv like this - // should be enough: + // should be enough: ... and this is obviously not enough if putenv + // does not make a copy of the string. It is also not very wise to + // put a string on the free store. If we have to leak we should do it + // like this: + /* + char * leaker = new char[envstr.length() + 1]; + envstr.copy(leaker, envstr.length()); + leaker[envstr.length()] = '\0'; + int retval = putenv(const_cast(leaker)); + */ + + // If putenv does not make a copy of the char const * this + // is very dangerous. OTOH if it does take a copy this is the + // best solution. int retval = putenv(const_cast(envstr.c_str())); - //int retval = putenv(const_cast((new string(envstr))->c_str())); #else #ifdef HAVE_SETENV string varname; diff --git a/src/support/lstrings.C b/src/support/lstrings.C index 09cdb6a28b..47ee77cdb1 100644 --- a/src/support/lstrings.C +++ b/src/support/lstrings.C @@ -146,11 +146,12 @@ string tostr(long i) char str[30]; ostrstream oss(str, 30); oss << i << '\0'; + return oss.str(); #else ostringstream oss; oss << i; + return oss.str().c_str(); #endif - return oss.str(); } @@ -160,11 +161,12 @@ string tostr(unsigned long i) char str[30]; ostrstream oss(str, 30); oss << i << '\0'; + return oss.str(); #else ostringstream oss; oss << i; + return oss.str().c_str(); #endif - return oss.str(); } @@ -204,11 +206,12 @@ string tostr(double d) char tmp[40]; ostrstream oss(tmp, 40); oss << d << '\0'; + return oss.str(); #else ostringstream oss; oss << d; + return oss.str().c_str(); #endif - return oss.str(); } diff --git a/src/text.C b/src/text.C index dfd8dd2a4a..ae73c68b5b 100644 --- a/src/text.C +++ b/src/text.C @@ -36,7 +36,7 @@ extern int mono_video; extern int reverse_video; extern int fast_selection; extern BufferView * current_view; -extern int UnlockInset(UpdatableInset * inset); +//extern int UnlockInset(UpdatableInset * inset); // ale070405 extern int bibitemMaxWidth(LyXFont const &); @@ -1648,7 +1648,7 @@ void LyXText::TableFeatures(int feature) } case LyXTable::DELETE_ROW: if (current_view->the_locking_inset) - UnlockInset(current_view->the_locking_inset); + current_view->unlockInset(current_view->the_locking_inset); RemoveTableRow(&cursor); RedoParagraph(); return; @@ -1658,7 +1658,7 @@ void LyXText::TableFeatures(int feature) int cell_org = actCell; int cell = 0; if (current_view->the_locking_inset) - UnlockInset(current_view->the_locking_inset); + current_view->unlockInset(current_view->the_locking_inset); do { if (!pos || (cursor.par->IsNewline(pos-1))){ if (cursor.par->table->DeleteCellIfColumnIsDeleted(cell, cell_org)){ diff --git a/src/text2.C b/src/text2.C index c012715c5f..7cd63f721d 100644 --- a/src/text2.C +++ b/src/text2.C @@ -1059,7 +1059,6 @@ void LyXText::ToggleFree(LyXFont font, bool toggleall) // Set font SetFont(font, toggleall); - //current_view->owner()->getMiniBuffer()->Set(_("Font style changed")); /* Implicit selections are cleared afterwards and cursor is set to the original position. */ diff --git a/src/trans_mgr.C b/src/trans_mgr.C index 26beac92ef..286058d2cd 100644 --- a/src/trans_mgr.C +++ b/src/trans_mgr.C @@ -18,7 +18,6 @@ extern LyXRC * lyxrc; extern string DoAccent(string const &, tex_accent); -extern void InsertCorrectQuote(); extern string DoAccent(char, tex_accent); extern BufferView * current_view; @@ -290,7 +289,7 @@ void TransManager::insertVerbatim(string const & str, LyXText * text) if (str[i] == '\"' && text->GetFont(text->cursor.par, text->cursor.pos).latex() == LyXFont::OFF) - InsertCorrectQuote(); + current_view->insertCorrectQuote(); else text->InsertChar(str[i]); }