class LyXParagraph;
class LColor;
class LyXText;
+class LyXScreen;
/**
* A text inset is like a TeX box to write full text
///
enum { TEXT_TO_INSET_OFFSET = 2 };
///
+ enum UpdateCodes {
+ NONE = 0,
+ INIT,
+ FULL,
+ CURSOR_PAR
+ };
+ ///
explicit
InsetText();
///
///
int width(Painter &, LyXFont const & f) const;
///
- void draw(Painter & pain, LyXFont const &, int , float &) const;
+ void draw(BufferView *, LyXFont const &, int , float &) const;
///
- void update(BufferView *, LyXFont const &) const;
+ void update(BufferView *, LyXFont const &, bool =false);
///
char const * EditMessage() const;
///
void Edit(BufferView *, int, int, unsigned int);
///
+ bool IsTextInset() const { return true; }
+ ///
+ bool doClearArea() const { return !locked; }
+ ///
void InsetUnlock(BufferView *);
///
bool LockInsetInInset(BufferView *, UpdatableInset *);
///
Inset::Code LyxCode() const { return Inset::TEXT_CODE; }
///
- void GetCursorPos(int & x, int & y) const;
+ void GetCursorPos(BufferView *, int & x, int & y) const;
///
int InsetInInsetY();
///
///
void SetFrameColor(LColor::color);
///
- LyXFont GetDrawFont(Buffer const *, LyXParagraph *, int pos) const;
+ LyXFont GetDrawFont(BufferView *, LyXParagraph *, int pos) const;
///
+ LyXText * getLyXText(BufferView *) const;
+ void deleteLyXText(BufferView *);
+
LyXParagraph * par;
- ///
protected:
///
- void UpdateLocal(BufferView *, bool what, bool mark_dirty);
+ void UpdateLocal(BufferView *, UpdateCodes, bool mark_dirty);
///
void WriteParagraphData(Buffer const *, std::ostream &) const;
///
virtual int getMaxTextWidth(Painter &, UpdatableInset const *) const;
- LyXText * text;
- ///
mutable int drawTextXOffset;
mutable int drawTextYOffset;
///
LColor::color frame_color;
private:
+ ///
+ typedef std::map<BufferView *, LyXText *> Cache;
+ ///
+ typedef Cache::value_type value_type;
///
int BeginningOfMainBody(Buffer const *, LyXParagraph * par) const;
///
///
UpdatableInset::RESULT moveDown(BufferView *);
///
- bool Delete();
- ///
void SetCharFont(Buffer const *, int pos, LyXFont const & font);
///
string getText(int);
///
bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0,
int button = 0);
- int cx() const;
- int cy() const;
- int cpos() const;
- LyXParagraph * cpar() const;
- Row * crow() const;
+ ///
+ int cx(BufferView *) const;
+ int cy(BufferView *) const;
+ int cpos(BufferView *) const;
+ LyXParagraph * cpar(BufferView *) const;
+ Row * crow(BufferView *) const;
/* Private structures and variables */
///
bool locked;
///
+ int insetAscent;
+ int insetDescent;
+ int insetWidth;
+ ///
int inset_pos;
///
mutable int inset_x;
///
mutable float xpos;
///
- mutable bool init_inset;
+ mutable UpdateCodes need_update;
///
UpdatableInset * the_locking_inset;
///
LyXParagraph * old_par;
+ /// The cache.
+ mutable Cache cache;
};
#endif