X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2Fmath_cursor.h;h=5f6721553df29d2dcd4706600660d1b36c947253;hb=b906c06db6ecd4b63bb5cdb5781ab05029303e25;hp=91e4e6125efeb29ac3c50ba9ff34d1b498ee4793;hpb=891bff2bfece699347ec8650478f3735db981d23;p=lyx.git diff --git a/src/mathed/math_cursor.h b/src/mathed/math_cursor.h index 91e4e6125e..5f6721553d 100644 --- a/src/mathed/math_cursor.h +++ b/src/mathed/math_cursor.h @@ -24,156 +24,161 @@ #endif #include "math_iter.h" -#include "math_inset.h" +//#include "math_inset.h" +#include "math_xiter.h" + +class MathFuncInset; /// This is the external interface of Mathed's subkernel class MathedCursor { - public: - /// - explicit - MathedCursor(MathParInset * p); - /// - void Insert(byte, MathedTextCodes t = LM_TC_MIN); - /// - void Insert(MathedInset *, int t = LM_TC_INSET); - /// - void Home(); - /// - void End(); - /// - bool Right(bool sel = false); - /// - bool Left(bool sel = false); - /// - bool Up(bool sel = false); - /// - bool Down(bool sel = false); - /// - bool Pop(); - /// - bool Push(); - /// Pull out an argument from its container inset - bool pullArg(); - /// - void draw(Painter &, int x, int y); - /// - void Redraw(Painter &); - /// - void Delete(); - /// - void DelLine(); - /// - void SetPos(int, int); - /// - void GetPos(int & x, int & y) { cursor->GetPos(x, y); } - /// - short GetFCode() { return cursor->FCode(); } - /// - MathParInset * GetPar() { return par; } - /// - MathParInset * getCurrentPar() const { return cursor->p; } - /// - void SetPar(MathParInset *); - /// - void Interpret(string const &); - /// - void SetSize(short); - /// - void setNumbered(); - /// - void setLabel(string const &); - /// - string const & getLabel() const { - return cursor->getLabel(); - } - /// - bool Limits(); - /// Set accent: if argument = 0 it's considered consumed - void setAccent(int ac = 0); - /// Returns last accent - int getAccent() const; - /// - bool IsEnd() const { return !cursor->OK(); } - // Macro mode methods - /// - void MacroModeOpen(); - /// - void MacroModeClose(); - /// - bool InMacroMode() { return macro_mode; } - - // Local selection methods - /// - bool Selection() { return selection; } - /// - void SelCopy(); - /// - void SelCut(); - /// - void SelDel(); - /// - void SelPaste(); - /// - void SelStart(); - /// - void SelClear(); - /// - void SelBalance(); - /// - void SelGetArea(int ** xp, int ** yp, int & n); - /// - void clearLastCode() { lastcode = LM_TC_MIN; } - /// - void setLastCode(MathedTextCodes t) { lastcode = t; } - /// - MathedTextCodes getLastCode() const { return lastcode; } - - protected: - /// - bool macro_mode; - /// - void MacroModeBack(); - /// - void MacroModeInsert(char); - - // Selection stuff - /// - bool selection; - /// - int selpos; - /// - MathedXIter cursel, * anchor; - /// -// LyxArrayBase *selarray; - /// - bool is_visible; - /// - long unsigned win; - /// - MathParInset * par; - /// - MathedXIter * cursor; - /// - int xc, yc; - /// - void doAccent(byte c, MathedTextCodes t); - /// - void doAccent(MathedInset * p); - /// - int accent; - /// - int nestaccent[8]; - /// - MathedTextCodes lastcode; - - private: - /// - MathFuncInset * imacro; +public: + /// + explicit + MathedCursor(MathParInset * p); + /// + void Insert(byte, MathedTextCodes t = LM_TC_MIN); + /// + void Insert(MathedInset *, int t = LM_TC_INSET); + /// + void Home(); + /// + void End(); + /// + bool Right(bool sel = false); + /// + bool Left(bool sel = false); + /// + bool Up(bool sel = false); + /// + bool Down(bool sel = false); + /// + bool Pop(); + /// + bool Push(); + /// Pull out an argument from its container inset + bool pullArg(); + /// + void draw(Painter &, int x, int y); + /// + void Redraw(Painter &); + /// + void Delete(); + /// + void DelLine(); + /// + void SetPos(int, int); + /// + void GetPos(int & x, int & y) { cursor->GetPos(x, y); } + /// + short GetFCode() { return cursor->FCode(); } + /// + MathParInset * GetPar() { return par; } + /// + MathParInset * getCurrentPar() const { return cursor->p; } + /// + void SetPar(MathParInset *); + /// + void Interpret(string const &); + /// + void SetSize(short); + /// + void setNumbered(); + /// + void setLabel(string const &); + /// + string const & getLabel() const { + return cursor->getLabel(); + } + /// + bool Limits(); + /// Set accent: if argument = 0 it's considered consumed + void setAccent(int ac = 0); + /// Returns last accent + int getAccent() const; + /// + bool IsEnd() const { return !cursor->OK(); } + // Macro mode methods + /// + void MacroModeOpen(); + /// + void MacroModeClose(); + /// + bool InMacroMode() { return macro_mode; } + + // Local selection methods + /// + bool Selection() { return selection; } + /// + void SelCopy(); + /// + void SelCut(); + /// + void SelDel(); + /// + void SelPaste(); + /// + void SelStart(); + /// + void SelClear(); + /// + void SelBalance(); + /// + void SelGetArea(int ** xp, int ** yp, int & n); + /// + void clearLastCode() { lastcode = LM_TC_MIN; } + /// + void setLastCode(MathedTextCodes t) { lastcode = t; } + /// + void toggleLastCode(MathedTextCodes t); + /// + MathedTextCodes getLastCode() const { return lastcode; } + +protected: + /// + bool macro_mode; + /// + void MacroModeBack(); + /// + void MacroModeInsert(char); + + // Selection stuff + /// + bool selection; + /// + int selpos; + /// + MathedXIter cursel; + /// + MathedXIter * anchor; + /// +// MathedArray *selarray; + /// + bool is_visible; + /// + long unsigned win; + /// + MathParInset * par; + /// + MathedXIter * cursor; + /// + int xc; + /// + int yc; + /// + void doAccent(byte c, MathedTextCodes t); + /// + void doAccent(MathedInset * p); + /// + int accent; + /// + int nestaccent[8]; + /// + MathedTextCodes lastcode; + +private: + /// + MathFuncInset * imacro; }; - -//-------------------- Inline Functions -------------------------// - - #endif