Kate
kateundo.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef kate_undo_h
00022 #define kate_undo_h
00023
00024 #include <QtCore/QList>
00025
00026 #include "ktexteditor/range.h"
00027
00028
00029 class KateDocument;
00030 class KateUndo;
00031
00035 class KateUndoGroup
00036 {
00037 public:
00042 explicit KateUndoGroup (KateDocument *doc);
00043
00047 ~KateUndoGroup ();
00048
00049 public:
00053 void undo ();
00054
00058 void redo ();
00059
00060 public:
00064 enum UndoType
00065 {
00066 editInsertText,
00067 editRemoveText,
00068 editWrapLine,
00069 editUnWrapLine,
00070 editInsertLine,
00071 editRemoveLine,
00072 editMarkLineAutoWrapped,
00073 editInvalid
00074 };
00075
00084 void addItem (KateUndoGroup::UndoType type, uint line, uint col, uint len, const QString &text);
00085
00090 void setUndoSelection (const KTextEditor::Range &selection);
00091
00096 void setRedoSelection (const KTextEditor::Range &selection);
00097
00102 void setUndoCursor(const KTextEditor::Cursor &cursor);
00103
00108 void setRedoCursor(const KTextEditor::Cursor &cursor);
00109
00116 bool merge(KateUndoGroup* newGroup,bool complex);
00117
00121 void safePoint (bool safePoint=true);
00122
00126 bool isEmpty () const { return m_items.isEmpty(); }
00127
00128 private:
00133 KateUndoGroup::UndoType singleType() const;
00134
00140 bool isOnlyType(KateUndoGroup::UndoType type) const;
00141
00146 void addItem (KateUndo *u);
00147
00148 private:
00152 KateDocument *m_doc;
00153
00157 QList<KateUndo*> m_items;
00158
00162 bool m_safePoint;
00163
00167 KTextEditor::Range m_undoSelection;
00168
00172 KTextEditor::Range m_redoSelection;
00173
00177 KTextEditor::Cursor m_undoCursor;
00178
00182 KTextEditor::Cursor m_redoCursor;
00183 };
00184
00185 #endif
00186
00187