better key handling, move some methods closer to caller, fix in lyxstring, change lyxsum to use istream_iterator

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2032 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-05-29 09:50:02 +00:00
parent 4bcf99c809
commit ee7a1321a7
17 changed files with 952 additions and 628 deletions

View File

@ -1,3 +1,11 @@
2001-05-29 Lars Gullik Bjønnes <larsbj@birdstep.com>
* boost/utility.hpp: update
* boost/smart_ptr.hpp: update... not finished
* boost/config.hpp: update
2001-04-17 Lars Gullik Bjønnes <larsbj@birdstep.com>
* boost/array.hpp: move array back into namespace boost

View File

@ -11,6 +11,13 @@
// http://www.boost.org/libs/config
// Revision History (excluding minor changes for specific compilers)
// 16 Mar 01 Added BOOST_VERSION (Jens Maurer)
// 06 Mar 01 Refactored EDG checks for Intel C++ (Dave Abrahams)
// 04 Mar 01 Factored EDG checks, added BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
// for Intel C++ 5.0 (Dave Abrahams)
// 17 Feb 01 BOOST_NO_CV_SPECIALIZATIONS
// BOOST_NO_CV_VOID_SPECIALIZATIONS (John Maddock)
// 11 Feb 01 Added BOOST_STATIC_CONSTANT (Dave Abrahams)
// 20 Jan 01 BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS moved here from
// cast.hpp. Added missing BOOST_NO_STRINGSTREAM which some
// boost code seemed to depend on. (Dave Abrahams)
@ -51,6 +58,13 @@
#ifndef BOOST_CONFIG_HPP
#define BOOST_CONFIG_HPP
#define BOOST_VERSION 102200
// BOOST_VERSION % 100 is the sub-minor version
// BOOST_VERSION / 100 % 1000 is the minor version
// BOOST_VERSION / 100000 is the major version
// Conformance Flag Macros -------------------------------------------------//
//
// Conformance flag macros should identify the absence of C++ Standard
@ -59,6 +73,12 @@
// burden where it should be, on non-conforming compilers. In the future,
// hopefully, less rather than more conformance flags will have to be defined.
// BOOST_NO_CV_SPECIALIZATIONS: if template specialisations for cv-qualified types
// conflict with a specialistaion for unqualififed type.
// BOOST_NO_CV_VOID_SPECIALIZATIONS: if template specialisations for cv-void types
// conflict with a specialistaion for void.
// BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP: Compiler does not implement
// argument-dependent lookup (also named Koenig lookup); see std::3.4.2
// [basic.koenig.lookup]
@ -194,6 +214,18 @@
// BOOST_NO_STD_MIN_MAX: The C++ standard library does not provide
// the min() and max() template functions that should be in <algorithm>.
// Common compiler front-ends precede all compiler checks ------------------//
// Edison Design Group front-ends
# if defined(__EDG_VERSION__)
# if __EDG_VERSION__ <= 241
# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
# endif
# endif
// Compiler-specific checks -------------------------------------------------//
// Compilers are listed in alphabetic order (except VC++ last - see below)---//
// GNU CC (also known as GCC and G++) --------------------------------------//
@ -203,9 +235,11 @@
// egcs 1.1 won't parse smart_ptr.hpp without this:
# define BOOST_NO_AUTO_PTR
# endif
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 95
# include <iterator> // not sure this is the right way to do this -JGS
# if !defined(_CXXRT_STD) && !defined(__SGI_STL) // need to ask Dietmar about this -JGS
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 97
# include <string> // not sure this is the right way to do this -JGS
# if defined(__BASTRING__) && !defined(__GLIBCPP__) && !defined(_CXXRT_STD) && !defined(__SGI_STL) // need to ask Dietmar about this -JGS
// this should only detect the stdlibc++ that ships with gcc, and
// not any replacements that may be installed...
# define BOOST_NO_STD_ITERATOR
# define BOOST_NO_LIMITS
# endif
@ -218,7 +252,7 @@
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 8
# define BOOST_NO_MEMBER_TEMPLATES
# endif
# if (__GNUC__ == 2 && __GNUC_MINOR__ > 95) || __GNUC__ > 2
# if (__GNUC__ == 2 && __GNUC_MINOR__ > 97) || __GNUC__ > 2
// upcoming gcc 3.0
# include <iterator>
# if defined(__GLIBCPP__)
@ -229,7 +263,16 @@
# endif
# endif
// Kai C++ ------------------------------------------------------------------//
// Intel on Linux ---------------------------------------------------------
#elif defined __ICC
# include <iterator>
# ifdef _CPPLIB_VER
// shipped with Dinkumware 3.10, which has a different hash_map
# define BOOST_NO_HASH
# endif
// Kai C++ ----------------------------------------------------------------
#elif defined __KCC
# define BOOST_NO_SLIST
@ -244,17 +287,11 @@
#elif defined __sgi
# if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 240
# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
# endif
// Compaq Tru64 Unix cxx ---------------------------------------------------
#elif defined __DECCXX
# if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 240
# define BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
# endif
# define BOOST_NO_SLIST
# define BOOST_NO_HASH
// Greenhills C++ -----------------------------------------------------------//
@ -267,6 +304,8 @@
#elif defined __BORLANDC__
# define BOOST_NO_SLIST
# define BOOST_NO_HASH
// pull in standard library version:
# include <memory>
# if __BORLANDC__ <= 0x0551
# define BOOST_NO_INTEGRAL_INT64_T
# define BOOST_NO_PRIVATE_IN_AGGREGATE
@ -290,8 +329,16 @@
# else
# define BOOST_DECL
# endif
#if (__BORLANDC__ == 0x550) || (__BORLANDC__ == 0x551)
// <climits> is partly broken, some macos define symbols that are really in
// namespace std, so you end up having to use illegal constructs like
// std::DBL_MAX, as a fix we'll just include float.h and have done with:
#include <float.h>
#endif
# define BOOST_NO_CV_SPECIALIZATIONS
# define BOOST_NO_CV_VOID_SPECIALIZATIONS
// Intel -------------------------------------------------------------------//
// Intel on Windows --------------------------------------------------------//
# elif defined __ICL
# include <iterator> // not sure this is the right way to do this -JGS
@ -299,6 +346,13 @@
// a perfectly good implementation of std::iterator is supplied
# elif defined(__SGI_STL_ITERATOR)
# define BOOST_NO_STD_ITERATOR // No std::iterator in this case
# elif defined(_CPPLIB_VER) && (_CPPLIB_VER >= 306)
# // full dinkumware 3.06 and above
# define BOOST_NO_HASH
# define BOOST_NO_STD_ITERATOR_TRAITS
# if !_GLOBAL_USING // can be defined in yvals.h
# define BOOST_NO_STDC_NAMESPACE
# endif
# else // assume using dinkumware's STL that comes with VC++ 6.0
# define BOOST_MSVC_STD_ITERATOR
# define BOOST_NO_STD_ITERATOR_TRAITS
@ -309,16 +363,17 @@
# define BOOST_NO_STD_ALLOCATOR
# define BOOST_NO_STD_MIN_MAX
# endif
# define BOOST_NO_INTRINSIC_WCHAR_T // tentative addition - required for VC6 compatibility? (added by JM 19 Feb 2001)
// Metrowerks CodeWarrior --------------------------------------------------//
# elif defined __MWERKS__
# if __MWERKS__ <= 0x4000
# if __MWERKS__ <= 0x2401 // 6.2
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
# endif
# if __MWERKS__ <= 0x2301
# if __MWERKS__ <= 0x2301 // 5.3?
# define BOOST_NO_POINTER_TO_MEMBER_CONST
# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
# endif
# if __MWERKS__ >= 0x2300
# define BOOST_SYSTEM_HAS_STDINT_H
@ -336,20 +391,41 @@
# define BOOST_STD_EXTENSION_NAMESPACE Metrowerks
// Sun Workshop Compiler C++ ------------------------------------------------//
// Sun Workshop Compiler C++ ------------------------------------------------
# elif defined __SUNPRO_CC
# if __SUNPRO_CC <= 0x520
# define BOOST_NO_SLIST
# define BOOST_NO_HASH
# define BOOST_NO_STD_ITERATOR_TRAITS
// although sunpro 5.1 supports the syntax for
// inline initialization it often gets the value
// wrong, especially where the value is computed
// from other constants (J Maddock 6th May 2001)
# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
// although sunpro 5.1 supports the syntax for
// partial specialization, it often seems to
// bind to the wrong specialization. Better
// to disable it until suppport becomes more stable
// (J Maddock 6th May 2001).
# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
# endif
# if __SUNPRO_CC <= 0x500
# define BOOST_NO_MEMBER_TEMPLATES
# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
# endif
// Microsoft Visual C++ (excluding Intel/EDG front end) --------------------//
// HP aCC -------------------------------------------------------------------
# elif defined __HP_aCC
# define BOOST_NO_SLIST
# define BOOST_NO_HASH
# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
# define BOOST_NO_OPERATORS_IN_NAMESPACE
// (support for HP aCC is not complete, see the regression test results)
// Microsoft Visual C++ (excluding Intel/EDG front end) --------------------
//
// Must remain the last #elif since some other vendors (Metrowerks, for
// example) also #define _MSC_VER
@ -384,6 +460,13 @@
// a perfectly good implementation of std::iterator is supplied
# elif defined(__SGI_STL_ITERATOR)
# define BOOST_NO_STD_ITERATOR // No std::iterator in this case
# elif defined(_CPPLIB_VER) && (_CPPLIB_VER >= 306)
// full dinkumware 3.06 and above
# define BOOST_NO_HASH
# define BOOST_NO_STD_ITERATOR_TRAITS
# ifndef _GLOBAL_USING // can be defined in yvals.h
# define BOOST_NO_STDC_NAMESPACE
# endif
# else
# define BOOST_MSVC_STD_ITERATOR 1
# define BOOST_NO_SLIST
@ -403,6 +486,7 @@
# endif
# endif
# define BOOST_NO_STD_ITERATOR_TRAITS
# define BOOST_NO_CV_VOID_SPECIALIZATIONS
// Make sure at least one standard library header is included so that library
@ -437,19 +521,22 @@
// end of compiler specific portion ----------------------------------------//
#if defined(BOOST_NO_LIMITS) || \
(defined(_RWSTD_VER) && _RWSTD_VER < 0x0203) || \
(defined(__SGI_STL_PORT) && __SGI_STL_PORT <= 0x410 && __STL_STATIC_CONST_INIT_BUG)
#if defined(BOOST_NO_LIMITS) || (defined(_RWSTD_VER) && defined(__BORLANDC__) && _RWSTD_VER < 0x020300) || (defined(__SGI_STL_PORT) && __SGI_STL_PORT <= 0x410 && defined(__STL_STATIC_CONST_INIT_BUG))
// STLPort 4.0 doesn't define the static constants in numeric_limits<> so that they
// can be used at compile time if the compiler bug indicated by
// __STL_STATIC_CONST_INIT_BUG is present.
// Rogue wave STL (C++ Builder) also has broken numeric_limits
// with default template defining members out of line.
// However, Compaq C++ also uses RogueWave (version 2.03) and it's ok.
// However, Compaq C++ also uses RogueWave (version 0x0203) and it's ok.
# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
#endif
#if defined(__hpux)
// HP-UX has a nice stdint.h in a different location, see boost/cstdint.hpp
# define BOOST_SYSTEM_HAS_STDINT_H
#endif
#ifndef BOOST_STD_EXTENSION_NAMESPACE
# define BOOST_STD_EXTENSION_NAMESPACE std
#endif
@ -497,5 +584,21 @@ namespace std {
}
#endif
// BOOST_STATIC_CONSTANT workaround --------------------------------------- //
// On compilers which don't allow in-class initialization of static integral
// constant members, we must use enums as a workaround if we want the constants
// to be available at compile-time. This macro gives us a convenient way to
// declare such constants.
#ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
# define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment }
#else
# define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
#endif
#endif // BOOST_CONFIG_HPP

View File

@ -17,6 +17,10 @@
// See http://www.boost.org for most recent version including documentation.
// Revision History
// 21 May 01 Require complete type where incomplete type is unsafe.
// (suggested by Vladimir Prus)
// 21 May 01 operator= fails if operand transitively owned by *this, as in a
// linked list (report by Ken Johnson, fix by Beman Dawes)
// 21 Jan 01 Suppress some useless warnings with MSVC (David Abrahams)
// 19 Oct 00 Make shared_ptr ctor from auto_ptr explicit. (Robert Vugts)
// 24 Jul 00 Change throw() to // never throws. See lib guidelines
@ -60,13 +64,19 @@
#include <cstddef> // for std::size_t
#include <memory> // for std::auto_ptr
#include <algorithm> // for std::swap
#include <boost/utility.hpp> // for boost::noncopyable
#include <boost/utility.hpp> // for boost::noncopyable, checked_delete, checked_array_delete
#include <functional> // for std::less
#include <boost/static_assert.hpp> // for BOOST_STATIC_ASSERT
#ifdef LYX_NO_EXCEPTIONS
#include <assert.h>
#endif
#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
# pragma warning(push)
# pragma warning(disable:4284) // return type for 'identifier::operator->' is not a UDT or reference to a UDT. Will produce errors if applied using infix notation
#endif
namespace boost {
// scoped_ptr --------------------------------------------------------------//
@ -84,9 +94,9 @@ template<typename T> class scoped_ptr : noncopyable {
typedef T element_type;
explicit scoped_ptr( T* p=0 ) : ptr(p) {} // never throws
~scoped_ptr() { delete ptr; }
void reset( T* p=0 ) { if ( ptr != p ) { delete ptr; ptr = p; } }
~scoped_ptr() { checked_delete(ptr); }
void reset( T* p=0 ) { if ( ptr != p ) { checked_delete(ptr); ptr =
p; } }
T& operator*() const { return *ptr; } // never throws
#ifdef BOOST_MSVC
# pragma warning(push)

View File

@ -11,6 +11,9 @@
// Classes appear in alphabetical order
// Revision History
// 21 May 01 checked_delete() and checked_array_delete() added (Beman Dawes,
// suggested by Dave Abrahams, generalizing idea from Vladimir Prus)
// 21 May 01 made next() and prior() inline (Beman Dawes)
// 26 Jan 00 protected noncopyable destructor added (Miki Jovanovic)
// 10 Dec 99 next() and prior() templates added (Dave Abrahams)
// 30 Aug 99 moved cast templates to cast.hpp (Beman Dawes)
@ -22,12 +25,40 @@
#ifndef BOOST_UTILITY_HPP
#define BOOST_UTILITY_HPP
#include <boost/config.hpp>
#include <boost/config.hpp> // broken compiler workarounds
#include <boost/static_assert.hpp>
#include <cstddef> // for size_t
#include <utility> // for std::pair
namespace boost
{
// checked_delete() and checked_array_delete() -----------------------------//
// verify that types are complete for increased safety
template< typename T >
inline void checked_delete(T * x)
{
# if !((defined(__BORLANDC__) && __BORLANDC__ <= 0x0551) || (defined(__ICL) && __ICL <= 500))
BOOST_STATIC_ASSERT( sizeof(T) ); // assert type complete at point
// of instantiation
# else
sizeof(T); // force error if type incomplete
# endif
delete x;
}
template< typename T >
inline void checked_array_delete(T * x)
{
# if !((defined(__BORLANDC__) && __BORLANDC__ <= 0x0551) || (defined(__ICL) && __ICL <= 500))
BOOST_STATIC_ASSERT( sizeof(T) ); // assert type complete at point
// of instantiation
# else
sizeof(T); // force error if type incomplete
# endif
delete [] x;
}
// next() and prior() template functions -----------------------------------//
@ -41,10 +72,10 @@ namespace boost
// Contributed by Dave Abrahams
template <class T>
T next(T x) { return ++x; }
inline T next(T x) { return ++x; }
template <class T>
T prior(T x) { return --x; }
inline T prior(T x) { return --x; }
// class noncopyable -------------------------------------------------------//

View File

@ -1,3 +1,7 @@
2001-05-29 Lars Gullik Bjønnes <larsbj@birdstep.com>
* bind/latinkeys.bind: add some bindings for KP_ keys.
2001-05-23 Lars Gullik Bjønnes <larsbj@birdstep.com>
* bind/latinkeys.bind: set quotedbl to quote-insert, set

View File

@ -1,3 +1,20 @@
# KP_ keys. Should possibly be moved to another file
\bind "KP_0" "self-insert 0"
\bind "KP_1" "self-insert 1"
\bind "KP_2" "self-insert 2"
\bind "KP_3" "self-insert 3"
\bind "KP_4" "self-insert 4"
\bind "KP_5" "self-insert 5"
\bind "KP_6" "self-insert 6"
\bind "KP_7" "self-insert 7"
\bind "KP_8" "self-insert 8"
\bind "KP_9" "self-insert 9"
\bind "KP_Decimal" "self-insert ."
\bind "KP_Add" "self-insert +"
\bind "KP_Divide" "self-insert /"
\bind "KP_Multiply" "self-insert *"
\bind "KP_Subtract" "self-insert -"
# Latin 1

View File

@ -151,20 +151,6 @@ public:
///
void copyEnvironment();
///
void hfill();
///
void protectedBlank(LyXText *);
///
void newline();
///
void menuSeparator();
///
void endOfSentenceDot();
///
void ldots();
///
void hyphenationPoint();
///
void menuUndo();
///
void menuRedo();

View File

@ -20,7 +20,6 @@
#include "lyxtext.h"
#include "insets/inseterror.h"
#include "insets/insetinfo.h"
#include "insets/insetspecialchar.h"
#include "LyXView.h"
#include "bufferlist.h"
#include "support/FileInfo.h"
@ -44,6 +43,7 @@ using std::find;
using std::count;
using std::count_if;
// Inserts a file into current document
bool BufferView::insertLyXFile(string const & filen)
//
@ -313,91 +313,6 @@ void BufferView::menuRedo()
}
void BufferView::hyphenationPoint()
{
if (available()) {
hideCursor();
update(text, BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::HYPHENATION);
insertInset(new_inset);
}
}
void BufferView::ldots()
{
if (available()) {
hideCursor();
update(text, BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::LDOTS);
insertInset(new_inset);
}
}
void BufferView::endOfSentenceDot()
{
if (available()) {
hideCursor();
update(text, BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::END_OF_SENTENCE);
insertInset(new_inset);
}
}
void BufferView::menuSeparator()
{
if (available()) {
hideCursor();
update(text, BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::MENU_SEPARATOR);
insertInset(new_inset);
}
}
void BufferView::newline()
{
if (available()) {
hideCursor();
update(text, BufferView::SELECT|BufferView::FITCUR);
text->InsertChar(this, LyXParagraph::META_NEWLINE);
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
void BufferView::protectedBlank(LyXText * lt)
{
if (available()) {
hideCursor();
update(lt, BufferView::SELECT|BufferView::FITCUR);
InsetSpecialChar * new_inset =
new InsetSpecialChar(InsetSpecialChar::PROTECTED_SEPARATOR);
if (!insertInset(new_inset))
delete new_inset;
else
updateInset(new_inset, true);
}
}
void BufferView::hfill()
{
if (available()) {
hideCursor();
update(text, BufferView::SELECT|BufferView::FITCUR);
text->InsertChar(this, LyXParagraph::META_HFILL);
update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
}
}
void BufferView::copyEnvironment()
{
if (available()) {
@ -433,6 +348,7 @@ void BufferView::copy()
}
}
void BufferView::cut()
{
if (available()) {

File diff suppressed because it is too large Load Diff

View File

@ -125,6 +125,20 @@ private:
/// open and lock an updatable inset
bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
///
void protectedBlank(LyXText * lt);
///
void newline();
///
void hfill();
///
void menuSeparator();
///
void endOfSentenceDot();
///
void ldots();
///
void hyphenationPoint();
///
void insertNote();
///
BufferView * bv_;

View File

@ -1,3 +1,15 @@
2001-05-29 Lars Gullik Bjønnes <larsbj@birdstep.com>
* lyx_main.C (defaultKeyBindings): move self-insert KP_ bindings
to latinkeys.bind.
* lyxfunc.C (processKeySym): change method of getting to the
self-insert char.
* BufferView(2).[Ch]: move hfill, protectedBlank, newline,
menuSeparator, endOfSentenceDot, ldots, hypenationPoint and menuUndo
* BufferView_pimpl.[Ch]: here as private methods.
2001-05-28 Juergen Vigna <jug@sad.it>
* text.C (SetHeightOfRow): added the update() call again as it is

View File

@ -165,7 +165,7 @@ void InsetSpecialChar::Write(Buffer const *, ostream & os) const
void InsetSpecialChar::Read(Buffer const *, LyXLex & lex)
{
lex.nextToken();
string command = lex.GetString();
string const command = lex.GetString();
if (command == "\\-")
kind = HYPHENATION;

View File

@ -464,34 +464,29 @@ void LyX::defaultKeyBindings(kb_keymap * kbmap)
kbmap->bind("Next", LFUN_NEXT);
kbmap->bind("Return", LFUN_BREAKPARAGRAPH);
kbmap->bind("~C-~S-~M-nobreakspace", LFUN_PROTECTEDSPACE);
//kbmap->bind("~C-~S-~M-nobreakspace", LFUN_PROTECTEDSPACE);
kbmap->bind("Delete", LFUN_DELETE);
kbmap->bind("BackSpace", LFUN_BACKSPACE);
// kbmap->bindings to enable the use of the numeric keypad
// e.g. Num Lock set
kbmap->bind("KP_0", LFUN_SELFINSERT);
kbmap->bind("KP_Decimal", LFUN_SELFINSERT);
//kbmap->bind("KP_0", LFUN_SELFINSERT);
//kbmap->bind("KP_Decimal", LFUN_SELFINSERT);
kbmap->bind("KP_Enter", LFUN_BREAKPARAGRAPH);
kbmap->bind("KP_1", LFUN_SELFINSERT);
kbmap->bind("KP_2", LFUN_SELFINSERT);
kbmap->bind("KP_3", LFUN_SELFINSERT);
kbmap->bind("KP_4", LFUN_SELFINSERT);
kbmap->bind("KP_5", LFUN_SELFINSERT);
kbmap->bind("KP_6", LFUN_SELFINSERT);
kbmap->bind("KP_Add", LFUN_SELFINSERT);
kbmap->bind("KP_7", LFUN_SELFINSERT);
kbmap->bind("KP_8", LFUN_SELFINSERT);
kbmap->bind("KP_9", LFUN_SELFINSERT);
kbmap->bind("KP_Divide", LFUN_SELFINSERT);
kbmap->bind("KP_Multiply", LFUN_SELFINSERT);
kbmap->bind("KP_Subtract", LFUN_SELFINSERT);
/* Most self-insert keys are handled in the 'default:' section of
* WorkAreaKeyPress - so we don't have to define them all.
* However keys explicit decleared as self-insert are
* handled seperatly (LFUN_SELFINSERT.) Lgb. */
//kbmap->bind("KP_1", LFUN_SELFINSERT);
//kbmap->bind("KP_2", LFUN_SELFINSERT);
//kbmap->bind("KP_3", LFUN_SELFINSERT);
//kbmap->bind("KP_4", LFUN_SELFINSERT);
//kbmap->bind("KP_5", LFUN_SELFINSERT);
//kbmap->bind("KP_6", LFUN_SELFINSERT);
//kbmap->bind("KP_Add", LFUN_SELFINSERT);
//kbmap->bind("KP_7", LFUN_SELFINSERT);
//kbmap->bind("KP_8", LFUN_SELFINSERT);
//kbmap->bind("KP_9", LFUN_SELFINSERT);
//kbmap->bind("KP_Divide", LFUN_SELFINSERT);
//kbmap->bind("KP_Multiply", LFUN_SELFINSERT);
//kbmap->bind("KP_Subtract", LFUN_SELFINSERT);
kbmap->bind("C-Tab", LFUN_TABINSERT); // ale970515
kbmap->bind("S-Tab", LFUN_SHIFT_TAB); // jug20000522

View File

@ -237,31 +237,6 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state)
return;
}
#if 0
// This if clause should not be here, but should rather be changed
// to a lyxfunc and get XK_Escape bound to it (Lgb)
#warning Fix this please. (Lgb)
if (owner->view()->available()) {
// this function should be used always [asierra060396]
UpdatableInset * tli = owner->view()->theLockingInset();
if (tli && (keysym == XK_Escape)) {
if (tli == tli->GetLockingInset()) {
owner->view()->unlockInset(tli);
TEXT()->CursorRight(owner->view());
moveCursorUpdate(true, false);
owner->showState();
} else {
tli->UnlockInsetInInset(owner->view(),
tli->GetLockingInset(),
true);
}
//return 0;
//return FL_PREEMPT;
return;
}
}
#endif
// Can we be sure that this will work for all X-Windows
// implementations? (Lgb)
// This code snippet makes lyx ignore some keys. Perhaps
@ -309,7 +284,7 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state)
if (lyxerr.debugging(Debug::KEY)) {
string buf;
keyseq.print(buf);
lyxerr << "Key ["
lyxerr << "Key [action="
<< action << "]["
<< buf << "]"
<< endl;
@ -330,10 +305,6 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state)
// the modifiers? (Lgb)
action = keyseq.addkey(keysym, 0);
// We keep the shift state, but remove the others.
// This is for the sake of the LFUN_SELFINSERT below.
state &= ShiftMask;
if (lyxerr.debugging(Debug::KEY)) {
lyxerr << "Removing modifiers...\n"
<< "Action now set to ["
@ -347,38 +318,33 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state)
}
if (action == LFUN_SELFINSERT) {
// We must set the argument to the char looked up by
// XKeysymToString
XKeyEvent xke;
xke.type = KeyPress;
xke.serial = 0;
xke.send_event = False;
xke.display = fl_get_display();
xke.window = 0;
xke.root = 0;
xke.subwindow = 0;
xke.time = 0;
xke.x = 0;
xke.y = 0;
xke.x_root = 0;
xke.y_root = 0;
xke.state = state;
xke.keycode = XKeysymToKeycode(fl_get_display(), keysym);
xke.same_screen = True;
char ret[10];
KeySym tmpkeysym;
int const res = XLookupString(&xke, ret, 10, &tmpkeysym, 0);
//Assert(keysym == tmpkeysym);
lyxerr[Debug::KEY] << "TmpKeysym ["
<< tmpkeysym << "]" << endl;
// This is very X dependant.
unsigned int c = keysym;
if (res > 0)
argument = string(ret, res);
lyxerr[Debug::KEY] << "SelfInsert arg["
<< argument << "]" << endl;
switch (c & 0x0000FF00) {
// latin 1 byte 3 = 0
case 0x00000000: break;
// latin 2 byte 3 = 1
case 0x00000100:
// latin 3 byte 3 = 2
case 0x00000200:
// latin 4 byte 3 = 3
case 0x00000300:
// latin 8 byte 3 = 18 (0x12)
case 0x00001200:
// latin 9 byte 3 = 19 (0x13)
case 0x00001300:
c &= 0x000000FF;
break;
default:
c = 0;
break;
}
if (c > 0)
argument = static_cast<char>(c);
lyxerr[Debug::KEY] << "SelfInsert arg[`"
<< argument << "']" << endl;
}
bool tmp_sc = show_sc;
show_sc = false;
@ -1005,26 +971,6 @@ string const LyXFunc::Dispatch(int ac,
}
break;
case LFUN_HYPHENATION:
owner->view()->hyphenationPoint();
break;
case LFUN_LDOTS:
owner->view()->ldots();
break;
case LFUN_END_OF_SENTENCE:
owner->view()->endOfSentenceDot();
break;
case LFUN_MENU_SEPARATOR:
owner->view()->menuSeparator();
break;
case LFUN_HFILL:
owner->view()->hfill();
break;
case LFUN_DEPTH:
changeDepth(owner->view(), TEXT(false), 0);
break;

View File

@ -1,3 +1,11 @@
2001-05-29 Lars Gullik Bjønnes <larsbj@birdstep.com>
* lyxsum.C (sum): don't use sstream anymore, use istream_iterator
directly instead.
* lyxstring.C (operator): make const operator[] behave as
non-const and at.
2001-05-22 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* Makefile.am (EXTRA_DIST): add the os_*.C files.

View File

@ -658,9 +658,14 @@ lyxstring & lyxstring::assign(const_iterator first, const_iterator last)
lyxstring::const_reference lyxstring::operator[](size_type pos) const
{
#if 0
lyx::Assert(pos <= rep->sz); // OURS!
static char helper = '\0';
return pos == rep->sz ? helper : rep->s[pos];
#else
lyx::Assert(pos < rep->sz); // OURS!
return rep->s[pos];
#endif
}

View File

@ -4,7 +4,7 @@
* LyX, The Document Processor
*
* The function lyx::sum is taken from GNU textutill-1.22
* and is there part of the program chsum. The chsum program
* and is there part of the program chsum. The cksum program
* is written by Q. Frank Xia, qx@math.columbia.edu.
*
* Modified for use in LyX by Lars G. Bjønnes.
@ -16,13 +16,13 @@
#include <config.h>
#include <fstream>
#include "Lsstream.h"
#include <iterator>
#include "support/lyxlib.h"
using std::ifstream;
using std::ios;
using std::istream_iterator;
namespace {
@ -92,7 +92,7 @@ unsigned long do_crc(InputIterator first, InputIterator last)
{
unsigned long crc = 0;
long bytes_read = 0;
while(first != last) {
while (first != last) {
++bytes_read;
crc = (crc << 8)
^ crctab[((crc >> 24) ^ *first++) & 0xFF];
@ -114,11 +114,7 @@ unsigned long lyx::sum(string const & file)
ifstream ifs(file.c_str());
if (!ifs) return 0;
ifs.unsetf(ios::skipws);
ostringstream ostr;
ostr << ifs.rdbuf();
// The .c_str() is here in case we use our lyxstring class
// instead of standard string.
string w = ostr.str().c_str();
return do_crc(w.begin(), w.end());
istream_iterator<char> beg(ifs);
istream_iterator<char> end;
return do_crc(beg, end);
}