]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_cursor.h
prepare infrastructure for multicell selection
[lyx.git] / src / mathed / math_cursor.h
index 928431907053bfd1a036115d9eae50822c1ace51..da2a4ecf769ae7d709e3fb4fdc7770d60d87e52f 100644 (file)
@@ -25,7 +25,7 @@
 
 class MathInset;
 class MathFuncInset;
-class MathScriptInset;
+class MathUpDownInset;
 class InsetFormulaBase;
 class MathArray;
 class MathXArray;
@@ -56,6 +56,10 @@ public:
        /// Put the cursor in the last position
        void last();
        ///
+       bool plainLeft();
+       ///
+       bool plainRight();
+       ///
        void Delete();
        ///
        void DelLine();
@@ -78,10 +82,6 @@ public:
        void SetSize(MathStyles);
        ///
        bool toggleLimits();
-       /// Set accent: if argument = 0 it's considered consumed 
-       void setAccent(int ac = 0);
-       /// Returns last accent
-       int getAccent() const;
        ///
        // Macro mode methods
        void MacroModeOpen();
@@ -114,13 +114,23 @@ public:
        ///
        void setLastCode(MathTextCodes t);
        ///
-       void toggleLastCode(MathTextCodes t);
+       void handleFont(MathTextCodes t);
+       ///
+       void handleAccent(string const & name, int code);
+       ///
+       void handleDelim(int l, int r);
+       /// Splits cells and shifts right part to the next cell
+       void splitCell();
+       /// Splits line and insert new row of cell 
+       void breakLine();
        ///
        MathTextCodes getLastCode() const;
        ///
-       int idx() const { return idx_; }
+       int idx() const { return cursor_.idx_; }
+       ///
+       void idxNext();
        ///
-       void idxRight();
+       void idxPrev();
        ///
        void pullArg();
        ///
@@ -130,34 +140,25 @@ public:
        ///
        MathTextCodes prevCode() const;
        ///
-       void selArray(MathArray &) const;
-       
+       char valign() const;
+       ///
+       char halign() const;
+       ///
+       int col() const;
+       ///
+       int row() const;
+
 //protected:
        ///
        bool macro_mode;
        
        // Selection stuff
-       ///
+       /// do we currently select
        bool selection;
-       ///
-       int anchor_;
-       ///
-       int cursor_;
-       ///
-       int idx_;
-       ///
-       MathInset       * par_;
+
        ///
        InsetFormulaBase * const formula_;
        ///
-       void doAccent(char c, MathTextCodes t);
-       ///
-       void doAccent(MathInset * p);
-       ///
-       int accent;
-       ///
-       int nestaccent[8];
-       ///
        MathTextCodes lastcode;
 
        ///
@@ -167,24 +168,36 @@ public:
 
        ///
        MathStyles style() const;
-       ///
+       /// Make sure cursor position is valid
        void normalize() const;
        
+       /// Enter a new MathInset from the front or the back
+       void push(MathInset * par, bool first);
+       /// Leave current MathInset
+       bool pop();
+
 private:
        /// Description of a position 
        struct MathIter {
+               /// inset
                MathInset * par_;
+               /// cell inset
                int idx_;
-               int cursor_;
+               ///
+               int pos_;
        };
 
-       /// MathPath
+       /// path of positions the cursor had to go if it were leving each inset
        std::vector<MathIter> path_;
 
-       ///  
-       void push(MathInset * par, bool first);
+       /// reference to the last item of the path
+       MathIter anchor_;
+       ///
+       MathIter cursor_;
        ///
-       void pop();
+       int path_idx_;
+
+
        ///  
        int last() const;
        ///
@@ -202,31 +215,15 @@ private:
        ///
        bool nextIsInset() const;
        ///
-       bool nextIsActive() const;
-       ///
        bool prevIsInset() const;
        ///
-       bool prevIsActive() const;
-       ///
-       bool IsFont() const;
-       ///
-       bool IsScript() const;
-       ///
        void merge(MathArray const & arr);
        ///
        MathInset * nextInset() const;
        ///
-       MathInset * nextActiveInset() const;
-       ///
        MathInset * prevInset() const;
        ///
-       MathInset * prevActiveInset() const;
-       ///
-       MathScriptInset * prevScriptInset() const;
-       ///
-       int col() const;
-       ///
-       int row() const;
+       MathUpDownInset * nearbyUpDownInset() const;
 
        ///
        MathFuncInset * imacro;