*/
class InsetText : public UpdatableInset {
public:
- ///
- enum { TEXT_TO_INSET_OFFSET = 2 };
///
enum UpdateCodes {
NONE = 0,
INIT,
FULL,
CURSOR_PAR,
- SELECTION
+ CURSOR,
+ SELECTION,
+ DRAW_FRAME,
+ CLEAR_FRAME
+ };
+ ///
+ enum DrawFrame {
+ NEVER = 0,
+ LOCKED,
+ ALWAYS
};
///
explicit
///
int width(Painter &, LyXFont const & f) const;
///
- void draw(BufferView *, LyXFont const &, int , float &) const;
+ int textWidth(Painter &) const;
+ ///
+ void draw(BufferView *, LyXFont const &, int , float &, bool) const;
///
void update(BufferView *, LyXFont const &, bool =false);
///
///
void SetFont(BufferView *, LyXFont const &, bool toggleall = false);
///
+ int getMaxWidth(Painter &, UpdatableInset const *) const;
+ ///
void init(InsetText const * ins = 0);
///
+ void WriteParagraphData(Buffer const *, std::ostream &) const;
+ ///
void SetParagraphData(LyXParagraph *);
///
void SetAutoBreakRows(bool);
///
- void SetDrawLockedFrame(bool);
+ void SetDrawFrame(BufferView *, DrawFrame);
///
- void SetFrameColor(LColor::color);
+ void SetFrameColor(BufferView *, LColor::color);
///
- LyXFont GetDrawFont(BufferView *, LyXParagraph *, int pos) const;
+// LyXFont GetDrawFont(BufferView *, LyXParagraph *, int pos) const;
///
LyXText * getLyXText(BufferView *) const;
void deleteLyXText(BufferView *);
LyXParagraph * par;
+ ///
+ mutable UpdateCodes need_update;
protected:
///
void UpdateLocal(BufferView *, UpdateCodes, bool mark_dirty);
- ///
- void WriteParagraphData(Buffer const *, std::ostream &) const;
- ///
- virtual int getMaxTextWidth(Painter &, UpdatableInset const *) const;
mutable int drawTextXOffset;
mutable int drawTextYOffset;
///
bool autoBreakRows;
- bool drawLockedFrame;
+ DrawFrame drawFrame;
///
LColor::color frame_color;
///
string getText(int);
///
+ bool checkAndActivateInset(BufferView * bv, bool behind);
bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0,
int button = 0);
///
int cpos(BufferView *) const;
LyXParagraph * cpar(BufferView *) const;
Row * crow(BufferView *) const;
+
+ /// This instead of a macro
+ LyXText * TEXT(BufferView * bv) const {
+ return getLyXText(bv);
+ }
/* Private structures and variables */
///
int insetAscent;
int insetDescent;
int insetWidth;
+ mutable int last_width;
+ mutable int last_height;
+ mutable int top_y;
+ ///
+ LyXParagraph * inset_par;
///
int inset_pos;
///
///
mutable float xpos;
///
- mutable UpdateCodes need_update;
- ///
UpdatableInset * the_locking_inset;
///
LyXParagraph * old_par;