]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_cursor.h
more IU
[lyx.git] / src / mathed / math_cursor.h
index b43e1268c605fa852131318e58b752daa6c5769d..55efa1e017fb4adf7f02062d2b72516b4bc7e4f8 100644 (file)
@@ -13,9 +13,9 @@
 #ifndef MATH_CURSOR
 #define MATH_CURSOR
 
-
+#include "cursor_slice.h"
 #include "math_inset.h"
-#include "math_iterator.h"
+#include "math_data.h"
 
 #include <string>
 
@@ -30,7 +30,7 @@ class MathUnknownInset;
 [Have a look at math_inset.h first]
 
 The MathCursor is different from the kind of cursor used in the Outer
-World. It contains a stack of CursorPos, each of which is made
+World. It contains a stack of CursorSlice, each of which is made
 up of a inset pointer, an index and a position offset, marking a path from
 this formula's MathHullInset to the current position.
 
@@ -40,17 +40,17 @@ this formula's MathHullInset to the current position.
 class MathCursor {
 public:
        /// short of anything else reasonable
-       typedef MathInset::size_type       size_type;
+       typedef size_t             size_type;
        /// type for column numbers
-       typedef MathArray::difference_type difference_type;
+       typedef ptrdiff_t          difference_type;
        /// type for cursor positions within a cell
-       typedef MathInset::pos_type        pos_type;
+       typedef lyx::pos_type      pos_type;
        /// type for cell indices
-       typedef MathInset::idx_type        idx_type;
+       typedef size_t             idx_type;
        /// type for row numbers
-       typedef MathInset::row_type        row_type;
+       typedef size_t             row_type;
        /// type for column numbers
-       typedef MathInset::col_type        col_type;
+       typedef size_t             col_type;
 
        ///
        explicit MathCursor(InsetFormulaBase *, bool left);
@@ -207,19 +207,16 @@ public:
        MathAtom & nextAtom();
 
        /// returns the selection
-       void getSelection(CursorPos &, CursorPos &) const;
+       void getSelection(CursorSlice &, CursorSlice &) const;
        /// returns the normalized anchor of the selection
-       CursorPos normalAnchor() const;
+       CursorSlice normalAnchor() const;
 
        /// reference to the last item of the path, i.e. "The Cursor"
-       CursorPos & cursor();
+       CursorSlice & cursor();
        /// reference to the last item of the path, i.e. "The Cursor"
-       CursorPos const & cursor() const;
+       CursorSlice const & cursor() const;
        /// how deep are we nested?
        unsigned depth() const;
-
-       /// local dispatcher
-       dispatch_result dispatch(FuncRequest const & cmd);
        /// describe the situation
        std::string info() const;
        /// dump selection information for debugging
@@ -227,7 +224,7 @@ public:
        /// dump selection information for debugging
        void dump(char const * str) const;
        /// moves on
-       void setSelection(MathIterator const & where, size_type n);
+       void setSelection(CursorBase const & where, size_type n);
        /// grab selection marked by anchor and current cursor
        std::string grabSelection() const;
        /// guess what
@@ -246,7 +243,9 @@ public:
        void pullArg();
        /// split font inset etc
        void handleFont(std::string const & font);
-
+       ///
+       DispatchResult
+       dispatch(FuncRequest const & cmd);
 private:
        /// moves cursor index one cell to the left
        bool idxLeft();
@@ -282,9 +281,9 @@ private:
        idx_type & idx();
 
        /// path of positions the cursor had to go if it were leaving each inset
-       MathIterator Cursor_;
+       CursorBase Cursor_;
        /// path of positions the anchor had to go if it were leaving each inset
-       mutable MathIterator Anchor_;
+       mutable CursorBase Anchor_;
        /// pointer to enclsing LyX inset
        InsetFormulaBase * formula_;
        // Selection stuff