#ifndef INSETTEXT_H
#define INSETTEXT_H
-
#include "updatableinset.h"
#include "LString.h"
#include "LColor.h"
#include "ParagraphList.h"
+#include "RowList.h"
+#include "frontends/mouse_state.h"
#include "support/types.h"
#include <boost/shared_ptr.hpp>
+#include <map>
class Painter;
class BufferView;
///
CURSOR = 1,
///
- CLEAR_FRAME = 2,
- ///
- DRAW_FRAME = 4,
+ DRAW_FRAME = 2,
///
- SELECTION = 8,
+ SELECTION = 4,
///
- CURSOR_PAR = 16,
+ CURSOR_PAR = 8,
///
- FULL = 32,
+ FULL = 16,
///
- INIT = 64
+ INIT = 32
};
///
enum DrawFrame {
///
int textWidth(BufferView *, bool fordraw = false) const;
///
- void draw(BufferView *, LyXFont const &, int , float &, bool) const;
+ void draw(BufferView *, LyXFont const &, int , float &) const;
///
- void update(BufferView *, LyXFont const &, bool = false);
+ void update(BufferView *, bool = false);
///
void setUpdateStatus(BufferView *, int what) const;
///
string const editMessage() const;
///
- void edit(BufferView *, int, int, mouse_button::state);
- ///
- void edit(BufferView *, bool front = true);
- ///
bool isTextInset() const { return true; }
///
- bool doClearArea() const;
- ///
void insetUnlock(BufferView *);
///
bool lockInsetInInset(BufferView *, UpdatableInset *);
void validate(LaTeXFeatures & features) const;
///
Inset::Code lyxCode() const { return Inset::TEXT_CODE; }
- ///
+ /// FIXME, document
void getCursorPos(BufferView *, int & x, int & y) const;
+ /// Get the absolute document x,y of the cursor
+ virtual void getCursor(BufferView &, int &, int &) const;
///
int insetInInsetY() const;
///
- void toggleInsetCursor(BufferView *);
- ///
- void showInsetCursor(BufferView *, bool show = true);
- ///
- void hideInsetCursor(BufferView *);
- ///
void fitInsetCursor(BufferView *) const;
///
bool insertInset(BufferView *, Inset *);
///
void writeParagraphData(Buffer const *, std::ostream &) const;
///
- void setParagraphData(Paragraph *, bool same_id = false);
+ void setParagraphData(ParagraphList const &, bool same_id = false);
///
void setText(string const &, LyXFont const &);
///
///
Inset * getInsetFromID(int id) const;
///
- Paragraph * firstParagraph() const;
- ///
- Paragraph * getFirstParagraph(int) const;
+ ParagraphList * getParagraphs(int) const;
///
LyXCursor const & cursor(BufferView *) const;
///
- Paragraph * paragraph() const;
- ///
void paragraph(Paragraph *);
///
bool allowSpellcheck() const { return true; }
///
void getDrawFont(LyXFont &) const;
/// append text onto the existing text
- void appendParagraphs(Buffer * bp, Paragraph *);
+ void appendParagraphs(Buffer * bp, ParagraphList &);
///
void addPreview(grfx::PreviewLoader &) const;
///
mutable int need_update;
+ bool haveParagraphs() const {
+ return true;
+ }
///
ParagraphList paragraphs;
protected:
///
lyx::pos_type cpos(BufferView *) const;
///
- Paragraph * cpar(BufferView *) const;
+ ParagraphList::iterator cpar(BufferView *) const;
///
bool cboundary(BufferView *) const;
///
- Row * crow(BufferView *) const;
- ///
- void drawFrame(Painter &, bool cleared) const;
+ RowList::iterator crow(BufferView *) const;
///
- void clearFrame(Painter &, bool cleared) const;
+ void drawFrame(Painter &, int x) const;
///
- void clearInset(BufferView *, int baseline, bool & cleared) const;
+ void clearInset(BufferView *, int start_x, int baseline) const;
///
void saveLyXTextState(LyXText *) const;
///
- void restoreLyXTextState(BufferView *, LyXText *) const;
+ void restoreLyXTextState(LyXText *) const;
///
void reinitLyXText() const;
///
///
mutable int top_y;
///
- Paragraph * inset_par;
+ ParagraphList::iterator inset_par;
///
lyx::pos_type inset_pos;
///
///
UpdatableInset * the_locking_inset;
///
- mutable Paragraph * old_par;
+ mutable ParagraphList::iterator old_par;
/// The cache.
mutable Cache cache;
///
mutable int last_drawn_width;
///
- mutable bool frame_is_visible;
- ///
mutable BufferView * cached_bview;
///
mutable boost::shared_ptr<LyXText> cached_text;
bool selendboundary;
bool selection;
bool mark_set;
- bool refresh;
};
///
mutable save_state sstate;