Kate
kateundomanager.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 #ifndef KATEUNDOMANAGER_H
00020 #define KATEUNDOMANAGER_H
00021
00022 #include <QtCore/QObject>
00023 #include <QtCore/QList>
00024
00025 class KateDocument;
00026 class KateUndo;
00027 class KateUndoGroup;
00028
00029 namespace KTextEditor {
00030 class Document;
00031 class View;
00032 }
00033
00041 class KateUndoManager : public QObject
00042 {
00043 Q_OBJECT
00044
00045 public:
00051 KateUndoManager (KateDocument *doc);
00052
00053 ~KateUndoManager();
00054
00060 uint undoCount () const;
00061
00067 uint redoCount () const;
00068
00072 void undoSafePoint();
00073
00074 bool undoDontMerge() const;
00075
00081 void setUndoDontMerge(bool dontMerge);
00082
00083 bool allowComplexMerge() const;
00084
00093 void setAllowComplexMerge(bool allow);
00094
00095 void setModified( bool m );
00096 void updateConfig ();
00097
00098 public Q_SLOTS:
00104 void undo ();
00105
00111 void redo ();
00112
00113 void clearUndo ();
00114 void clearRedo ();
00115
00119 void editStart();
00120
00124 void editEnd();
00125
00129 void slotTextInserted(int line, int col, const QString &s);
00130
00134 void slotTextRemoved(int line, int col, const QString &s);
00135
00139 void slotMarkLineAutoWrapped(int line, bool autowrapped);
00140
00144 void slotLineWrapped(int line, int col, int pos, bool newLine);
00145
00149 void slotLineUnWrapped(int line, int col, int length, bool lineRemoved);
00150
00154 void slotLineInserted(int line, const QString &s);
00155
00159 void slotLineRemoved(int line, const QString &s);
00160
00161 Q_SIGNALS:
00162 void undoChanged ();
00163
00164 private:
00170 void addUndoItem(KateUndo *undo);
00171
00172 void updateModified();
00173
00174 private Q_SLOTS:
00175 void undoCancel();
00176 void viewCreated (KTextEditor::Document *, KTextEditor::View *newView);
00177
00178 private:
00179 KateDocument *m_document;
00180 bool m_undoComplexMerge;
00181 KateUndoGroup* m_editCurrentUndo;
00182 QList<KateUndoGroup*> undoItems;
00183 QList<KateUndoGroup*> redoItems;
00184 bool m_undoDontMerge;
00185
00186
00187 KateUndoGroup* lastUndoGroupWhenSaved;
00188 KateUndoGroup* lastRedoGroupWhenSaved;
00189 bool docWasSavedWhenUndoWasEmpty;
00190 bool docWasSavedWhenRedoWasEmpty;
00191 };
00192
00193 #endif
00194
00195