From d473dff41766665868f7e802181acbbbfb076657 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Mon, 5 Apr 2004 16:44:10 +0000 Subject: [PATCH] remove unneded math specific stuff, use altered notifyCursorLeave git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8608 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 +++++ src/cursor.C | 53 +++++++++------------------------------------------ src/cursor.h | 11 ----------- 3 files changed, 14 insertions(+), 55 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 21caf70185..59ece2c11f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ + +2004-04-05 André Pönitz + + * cursor.[Ch] (valign, halign...): remove unneeded functions + 2004-04-05 Angus Leeming * lyxlength.[Ch] (unit_name et al.): const-correct. diff --git a/src/cursor.C b/src/cursor.C index 6394ee3574..c213a1a9e8 100644 --- a/src/cursor.C +++ b/src/cursor.C @@ -203,7 +203,7 @@ bool LCursor::popLeft() { BOOST_ASSERT(!empty()); //lyxerr << "Leaving inset to the left" << endl; - inset().notifyCursorLeaves(idx()); + inset().notifyCursorLeaves(*this); if (depth() == 1) return false; pop(); @@ -215,7 +215,7 @@ bool LCursor::popRight() { BOOST_ASSERT(!empty()); //lyxerr << "Leaving inset to the right" << endl; - inset().notifyCursorLeaves(idx()); + inset().notifyCursorLeaves(*this); if (depth() == 1) return false; pop(); @@ -593,7 +593,6 @@ std::ostream & operator<<(std::ostream & os, LCursor const & cur) #include "mathed/math_factory.h" #include "mathed/math_gridinset.h" #include "mathed/math_macroarg.h" -#include "mathed/math_macrotemplate.h" #include "mathed/math_mathmlstream.h" #include "mathed/math_scriptinset.h" #include "mathed/math_support.h" @@ -665,7 +664,7 @@ void LCursor::plainErase() void LCursor::markInsert() { - cell().insert(pos(), MathAtom(new MathCharInset(0))); + insert(char(0)); } @@ -684,7 +683,7 @@ void LCursor::plainInsert(MathAtom const & t) void LCursor::insert(string const & str) { - lyxerr << "LCursor::insert str '" << str << "'" << endl; + //lyxerr << "LCursor::insert str '" << str << "'" << endl; for (string::const_iterator it = str.begin(); it != str.end(); ++it) insert(*it); } @@ -696,7 +695,7 @@ void LCursor::insert(char c) BOOST_ASSERT(!empty()); if (inMathed()) { selClearOrDel(); - plainInsert(MathAtom(new MathCharInset(c))); + insert(new MathCharInset(c)); } else { text()->insertChar(*this, c); } @@ -709,6 +708,7 @@ void LCursor::insert(MathAtom const & t) macroModeClose(); selClearOrDel(); plainInsert(t); + lyxerr << "LCursor::insert MathAtom: cur:\n" << *this << endl; } @@ -785,6 +785,7 @@ bool LCursor::backspace() if (pos() != 0 && prevAtom()->nargs() > 0) { // let's require two backspaces for 'big stuff' and // highlight on the first + resetAnchor(); selection() = true; --pos(); } else { @@ -823,7 +824,9 @@ bool LCursor::erase() return true; } + // 'clever' UI hack: only erase large items if previously slected if (pos() != lastpos() && inset().nargs() > 0) { + resetAnchor(); selection() = true; ++pos(); } else { @@ -938,28 +941,6 @@ MathUnknownInset * LCursor::activeMacro() } -bool LCursor::inMacroArgMode() const -{ - return pos() > 0 && prevAtom()->getChar() == '#'; -} - - -MathGridInset * LCursor::enclosingGrid(idx_type & idx) const -{ - for (MathInset::difference_type i = depth() - 1; i >= 0; --i) { - MathInset * m = operator[](i).inset().asMathInset(); - if (!m) - return 0; - MathGridInset * p = m->asGridInset(); - if (p) { - idx = operator[](i).idx(); - return p; - } - } - return 0; -} - - void LCursor::pullArg() { #ifdef WITH_WARNINGS @@ -1011,22 +992,6 @@ void LCursor::normalize() } -char LCursor::valign() -{ - idx_type idx; - MathGridInset * p = enclosingGrid(idx); - return p ? p->valign() : '\0'; -} - - -char LCursor::halign() -{ - idx_type idx; - MathGridInset * p = enclosingGrid(idx); - return p ? p->halign(idx % p->ncols()) : '\0'; -} - - bool LCursor::goUpDown(bool up) { // Be warned: The 'logic' implemented in this function is highly diff --git a/src/cursor.h b/src/cursor.h index 4791212fd0..c8a63b7de4 100644 --- a/src/cursor.h +++ b/src/cursor.h @@ -24,7 +24,6 @@ class FuncRequest; // these should go class MathUnknownInset; -class MathGridInset; class Encoding; @@ -250,8 +249,6 @@ public: void setScreenPos(int x, int y); /// in pixels from left of screen int targetX() const; - /// return the next enclosing grid inset and the cursor's index in it - MathGridInset * enclosingGrid(idx_type & idx) const; /// adjust anchor position after deletions/insertions void adjust(pos_type from, int diff); /// current offset in the top cell @@ -261,20 +258,12 @@ public: bool inMacroMode() const; /// get access to the macro we are currently typing MathUnknownInset * activeMacro(); - /// are we currently typing '#1' or '#2' or...? - bool inMacroArgMode() const; /// replace selected stuff with at, placing the former // selection in given cell of atom void handleNest(MathAtom const & at, int cell = 0); - /// remove this as soon as LyXFunc::getStatus is "localized" - //inline std::string getLastCode() { return "mathnormal"; } /// bool isInside(InsetBase const *); - /// - char valign(); - /// - char halign(); /// make sure cursor position is valid void normalize(); -- 2.39.2