#endif
#include "lyxfont.h"
-#include "undo.h"
#include "lyxcursor.h"
#include "paragraph.h"
#include "layout.h"
///
enum text_status {
///
- UNCHANGED,
+ UNCHANGED = 0,
///
- NEED_MORE_REFRESH,
+ CHANGED_IN_DRAW = 1,
///
- NEED_VERY_LITTLE_REFRESH,
+ NEED_VERY_LITTLE_REFRESH = 2,
///
- CHANGED_IN_DRAW
+ NEED_MORE_REFRESH = 3
+ };
+ ///
+ enum word_location {
+ /// the word around the cursor
+ WHOLE_WORD,
+ /// the word begining from the cursor position
+ PARTIAL_WORD,
+ /// the next word (not yet used)
+ NEXT_WORD
};
/// Constructor
mutable Row * refresh_row;
///
int refresh_pos;
-
+
+ /// give and set the LyXText status
+ text_status status() const;
+ void status(BufferView *, text_status) const;
+
+private:
/** wether the screen needs a refresh,
starting with refresh_y
*/
- mutable text_status status;
+ mutable text_status status_;
+public:
/** returns a pointer to the row near the specified y-coordinate
(relative to the whole text). y is set to the real beginning
of this row
*/
mutable LyXCursor cursor;
-#if 0
- /* the selection cursor */
- ///
- mutable bool selection;
- ///
- mutable bool mark_set;
-
- ///
- mutable LyXCursor sel_cursor;
- ///
- mutable LyXCursor sel_start_cursor;
- ///
- mutable LyXCursor sel_end_cursor;
-#else
/** The structrue that keeps track of the selections set. */
struct Selection {
+ Selection()
+ : set_(false), mark_(false)
+ {}
bool set() const {
return set_;
}
};
mutable Selection selection;
-#endif
+
/// needed for the toggling
LyXCursor last_sel_cursor;
///
///
string const selectionAsString(Buffer const *) const;
+ /// select the word we need depending on word_location
+ void getWord(LyXCursor & from, LyXCursor & to, word_location) const;
/// just selects the word the cursor is in
void selectWord(BufferView *);
+ /// returns the inset at cursor (if it exists), 0 otherwise
+ Inset * getInset() const;
/** 'selects" the next word, where the cursor is not in
and returns this word as string. THe cursor will be moved
///
void cursorLeftOneWord(BufferView *) const;
///
+ void cursorLeftOneWord(LyXCursor &) const;
+ ///
void cursorRightOneWord(BufferView *) const;
///
void cursorUpParagraph(BufferView *) const;
text_uppercase = 2
};
/// Change the case of the word at cursor position.
- void changeWordCase(BufferView *, TextCase action);
+ void changeCase(BufferView *, TextCase action);
+ ///
+ void changeRegionCase(BufferView * bview,
+ LyXCursor const & from,
+ LyXCursor const & to,
+ LyXText::TextCase action);
///
- void transposeChars(BufferView const &);
+ void transposeChars(BufferView &);
/** returns a printed row in a pixmap. The y value is needed to
decide, wether it is selected text or not. This is a strange
void getVisibleRow(BufferView *, int y_offset, int x_offset,
Row * row_ptr, int y, bool cleared=false);
+ ///
+ void toggleInset(BufferView *);
///
void cutSelection(BufferView *, bool = true);
///
int numberOfCell(Paragraph * par,
Paragraph::size_type pos) const;
///
- Paragraph * getParFromID(int id);
-
- // undo functions
- /// returns false if no undo possible
- bool textUndo(BufferView *);
- /// returns false if no redo possible
- bool textRedo(BufferView *);
- /// used by TextUndo/TextRedo
- bool textHandleUndo(BufferView *, Undo * undo);
- /// makes sure the next operation will be stored
- void finishUndo();
- /// this is dangerous and for internal use only
- void freezeUndo();
- /// this is dangerous and for internal use only
- void unFreezeUndo();
- /// the flag used by FinishUndo();
- mutable bool undo_finished;
- /// a flag
- bool undo_frozen;
- ///
- void setUndo(Buffer *, Undo::undo_kind kind,
- Paragraph const * before,
- Paragraph const * end) const;
- ///
- void setRedo(Buffer *, Undo::undo_kind kind,
- Paragraph const * before,
- Paragraph const * end);
- ///
- Undo * createUndo(Buffer *, Undo::undo_kind kind,
- Paragraph const * before,
- Paragraph const * end) const;
- /// for external use in lyx_cb.C
- void setCursorParUndo(Buffer *);
- ///
void removeTableRow(LyXCursor & cursor) const;
///
bool isEmptyTableCell() const;
(bidi_start <= pos && pos <= bidi_end);
}
private:
- ///
- void init();
///
mutable Row * firstrow;
///
void deleteEmptyParagraphMechanism(BufferView *,
LyXCursor const & old_cursor) const;
+public:
/** Updates all counters starting BEHIND the row. Changed paragraphs
* with a dynamic left margin will be rebroken. */
void updateCounters(BufferView *, Row * row) const;
+private:
///
void setCounter(Buffer const *, Paragraph * par) const;
///
void charInserted();
+public:
//
// special owner functions
///
Paragraph * ownerParagraph() const;
//
Paragraph * ownerParagraph(Paragraph *) const;
+ // set it searching first for the right owner using the paragraph id
+ Paragraph * ownerParagraph(int id, Paragraph *) const;
};