]> git.lyx.org Git - lyx.git/commitdiff
re-enable spaces and hyphens in labels;
authorAndré Pönitz <poenitz@gmx.net>
Mon, 20 Aug 2001 13:45:02 +0000 (13:45 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 20 Aug 2001 13:45:02 +0000 (13:45 +0000)
small stuff;

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2559 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_cursor.C
src/mathed/math_cursor.h
src/mathed/math_parser.C
src/mathed/math_scriptinset.C
src/mathed/math_scriptinset.h

index 7cfaa77b20d9c65b146ff3166939cfb3ceaafd14..78c45a2d82f36855d7d599c8d796db9e70044e84 100644 (file)
@@ -210,12 +210,31 @@ bool MathCursor::isInside(MathInset const * p) const
 }
 
 
-bool MathCursor::openable(MathInset * p, bool sel, bool useupdown) const
+bool MathCursor::openable(MathInset * p, bool sel) const
 {
        if (!p)
                return false;
 
-       if (!(p->isActive() || (useupdown && p->isScriptInset())))
+       if (!p->isActive())
+               return false;
+
+       if (sel) {
+               // we can't move into anything new during selection
+               if (Cursor_.size() == Anchor_.size())
+                       return false;
+               if (p != Anchor_[Cursor_.size()].par_)
+                       return false;
+       }
+       return true;
+}
+
+
+bool MathCursor::positionable(MathInset * p, bool sel) const
+{
+       if (!p)
+               return false;
+
+       if (!p->nargs())
                return false;
 
        if (sel) {
@@ -259,7 +278,7 @@ bool MathCursor::left(bool sel)
        lastcode_ = LM_TC_VAR;
 
        MathInset * p = prevInset();
-       if (openable(p, sel, false)) {
+       if (openable(p, sel)) {
                pushRight(p);
                return true;
        } 
@@ -280,7 +299,7 @@ bool MathCursor::right(bool sel)
        lastcode_ = LM_TC_VAR;
 
        MathInset * p = nextInset();
-       if (openable(p, sel, false)) {
+       if (openable(p, sel)) {
                pushLeft(p);
                return true;
        }
@@ -338,9 +357,9 @@ void MathCursor::setPos(int x, int y)
                //      << pos()  << "\n";
                MathInset * n = nextInset();
                MathInset * p = prevInset();
-               if (openable(n, selection_, true) && n->covers(x, y))
+               if (positionable(n, selection_) && n->covers(x, y))
                        pushLeft(n);
-               else if (openable(p, selection_, true) && p->covers(x, y))
+               else if (positionable(p, selection_) && p->covers(x, y))
                        pushRight(p);
                else 
                        break;
index 523ec48dc782bbece32ae1183debba2db08ce456..90519bec17aa0cd1327c11cf083eac80e7adf45b 100644 (file)
@@ -209,8 +209,6 @@ public:
        void getSelection(MathCursorPos &, MathCursorPos &) const;
        /// returns the normalized anchor of the selection
        MathCursorPos normalAnchor() const;
-       /// returns the normalized anchor of the selection
-       bool openable(MathInset *, bool selection, bool useupdown) const;
 
        /// path of positions the cursor had to go if it were leving each inset
        std::vector<MathCursorPos> Cursor_;
@@ -249,9 +247,13 @@ private:
        string macroName() const;
        ///
        void insert(char, MathTextCodes t = LM_TC_MIN);
-       ///
+       /// can we enter the inset? 
+       bool openable(MathInset *, bool selection) const;
+       /// can the setPos routine enter that inset?
+       bool positionable(MathInset *, bool selection) const;
+       /// write access to cursor cell position
        int & pos();
-       ///
+       /// write access to cursor cell index
        int & idx();
        /// x-offset of current cell relative to par xo
        int cellXOffset() const;
index cb3eba1f7dd6721b9ebd84181904b16083993ae4..2010e43ad82c545748104f91a12d407b2ed5de18 100644 (file)
@@ -812,13 +812,13 @@ void Parser::parse_into(MathArray & array, unsigned flags)
                }
        
                else if (t.cs() == "label") {
-                       MathArray ar;
-                       parse_into(ar, FLAG_ITEM);
-                       ostringstream os;
-                       ar.write(os, true);
-                       curr_label_ = os.str();
+                       //MathArray ar;
+                       //parse_into(ar, FLAG_ITEM);
+                       //ostringstream os;
+                       //ar.write(os, true);
+                       //curr_label_ = os.str();
                        // was: 
-                       //curr_label_ = getArg('{', '}');
+                       curr_label_ = getArg('{', '}');
                }
 
                else if (t.cs() == "choose" || t.cs() == "over" || t.cs() == "atop") {
index 158c2b91c42e838f4ce635f3de9b2b38ab038668..8ee73f85a13c9e2e87bbffeab30896fc661448a6 100644 (file)
@@ -176,6 +176,12 @@ void MathScriptInset::idxDelete(int & idx, bool & popit, bool & deleteit)
 }
 
 
+bool MathScriptInset::isActive() const
+{
+       return false;
+}
+
+
 int MathScriptInset::limits() const
 {  
        return limits_;
@@ -274,3 +280,4 @@ void MathScriptInset::draw(Painter & pain, int x, int y) const
        if (down())
                xcell(1).draw(pain, x + dx1_, y + dy1_);
 }
+
index 7a95bf60187b684fd655879e582effc02c9fdb7d..e0d7e23222ddec28dc2630e3e8192e8961ab1f38 100644 (file)
@@ -70,7 +70,7 @@ public:
        ///
        int limits() const;
        ///
-       bool isActive() const { return false; }
+       bool isActive() const;
        /// Identifies ScriptInsets
        bool isScriptInset() const { return true; }
        ///