]> git.lyx.org Git - lyx.git/blobdiff - src/cursor.h
some fitcursor work
[lyx.git] / src / cursor.h
index 2494217206f1350f4cc5df9060798cf9bcfc8259..a7f981b31e3a8a57fcf53b6163efd86364f9a8ba 100644 (file)
 
 #include "support/types.h"
 
+#include <iosfwd>
 #include <vector>
 
 class BufferView;
-class InsetOld;
+class UpdatableInset;
 class DispatchResult;
 class FuncRequest;
 class LyXText;
+class InsetTabular;
 
 
 /**
@@ -32,20 +34,18 @@ class LyXText;
 class CursorItem {
 public:
        ///
-       CursorItem() : inset_(0), text_(0), idx_(0), par_(0), pos_(0) {}
+       CursorItem() : inset_(0), par_(0), pos_(0) {}
        ///
-       CursorItem(InsetOld * inset, LyXText * text)
-               : inset_(inset), text_(text), idx_(0), par_(0), pos_(0)
+       explicit CursorItem(UpdatableInset * inset)
+               : inset_(inset), par_(0), pos_(0)
        {}
        ///
+       LyXText * text() const;
+       ///
        friend std::ostream & operator<<(std::ostream &, CursorItem const &);
 public:
        ///
-       InsetOld * inset_;
-       ///
-       LyXText * text_;
-       ///
-       int idx_;
+       UpdatableInset * inset_;
        ///
        int par_;
        ///
@@ -55,20 +55,26 @@ public:
 
 class LCursor {
 public:
-       ///
-       LCursor(BufferView * bv);
+       /// create 'empty' cursor
+       explicit LCursor(BufferView * bv);
        /// dispatch from innermost inset upwards
        DispatchResult dispatch(FuncRequest const & cmd);
-       /// adjust cursor acording to result
-       bool handleResult(DispatchResult const & res);
-       ///
-       void push(InsetOld *, LyXText *);
        ///
+       void push(UpdatableInset * inset);
+       /// restrict cursor nesting to given size
+       void pop(int depth);
+       /// pop one level off the cursor
        void pop();
        ///
-       InsetOld * innerInset() const;
+       UpdatableInset * innerInset() const;
+       ///
+       UpdatableInset * innerInsetOfType(int code) const;
+       ///
+       InsetTabular * innerInsetTabular() const;
        ///
        LyXText * innerText() const;
+       /// returns x,y position
+       void getPos(int & x, int & y) const;
        ///
        friend std::ostream & operator<<(std::ostream &, LCursor const &);
 public:
@@ -76,6 +82,9 @@ public:
        std::vector<CursorItem> data_;
        ///
        BufferView * bv_;
+private:
+       ///
+       int cached_y_;
 };
 
 #endif // LYXCURSOR_H