#ifndef MATH_CURSOR
#define MATH_CURSOR
-
+#include "cursor_slice.h"
#include "math_inset.h"
-#include "math_iterator.h"
+#include "math_data.h"
#include <string>
[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.
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);
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
/// 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
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();
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