]> git.lyx.org Git - features.git/commitdiff
remove unneded math specific stuff, use altered notifyCursorLeave
authorAndré Pönitz <poenitz@gmx.net>
Mon, 5 Apr 2004 16:44:10 +0000 (16:44 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 5 Apr 2004 16:44:10 +0000 (16:44 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8608 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/cursor.C
src/cursor.h

index 21caf701852ac376c6e6c1a55dde1a3fcd517e40..59ece2c11fbd40caf9d80dbdb8aa9fd77129af52 100644 (file)
@@ -1,3 +1,8 @@
+
+2004-04-05  André Pönitz  <poenitz@gmx.net>
+
+       * cursor.[Ch] (valign, halign...): remove unneeded functions
+
 2004-04-05  Angus Leeming  <leeming@lyx.org>
 
        * lyxlength.[Ch] (unit_name et al.): const-correct.
index 6394ee357437e933062847ced02794548a8fd98f..c213a1a9e8cb45a970241341c10f813d898763df 100644 (file)
@@ -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
index 4791212fd0b42d7a627b07da1d3d0776b63d7d12..c8a63b7de48a1cb1be4a4bdfaa47ec5d2704b049 100644 (file)
@@ -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();