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
00055 KateDocument *document();
00056
00062 uint undoCount () const;
00063
00069 uint redoCount () const;
00070
00074 void undoSafePoint();
00075
00076 bool undoDontMerge() const;
00077
00083 void setUndoDontMerge(bool dontMerge);
00084
00093 void setAllowComplexMerge(bool allow);
00094
00095 bool allowComplexMerge() const;
00096
00097 bool isUndoTrackingEnabled() const { return m_isUndoTrackingEnabled; }
00098
00099 void setModified( bool m );
00100 void updateConfig ();
00101
00102 public Q_SLOTS:
00108 void undo ();
00109
00115 void redo ();
00116
00117 void clearUndo ();
00118 void clearRedo ();
00119
00123 void editStart();
00124
00128 void editEnd();
00129
00130 void undoStart();
00131 void undoEnd();
00132
00133 void inputMethodStart();
00134 void inputMethodEnd();
00135
00139 void slotTextInserted(int line, int col, const QString &s);
00140
00144 void slotTextRemoved(int line, int col, const QString &s);
00145
00149 void slotMarkLineAutoWrapped(int line, bool autowrapped);
00150
00154 void slotLineWrapped(int line, int col, int pos, bool newLine);
00155
00159 void slotLineUnWrapped(int line, int col, int length, bool lineRemoved);
00160
00164 void slotLineInserted(int line, const QString &s);
00165
00169 void slotLineRemoved(int line, const QString &s);
00170
00171 Q_SIGNALS:
00172 void undoChanged ();
00173 void undoTrackingEnabledChanged(bool enabled);
00174
00175 private:
00181 void addUndoItem(KateUndo *undo);
00182
00183 void setUndoTrackingEnabled(bool enabled);
00184
00185 void updateModified();
00186
00187 private Q_SLOTS:
00188 void undoCancel();
00189 void viewCreated (KTextEditor::Document *, KTextEditor::View *newView);
00190
00191 private:
00192 KateDocument *m_document;
00193 bool m_undoComplexMerge;
00194 bool m_isUndoTrackingEnabled;
00195 KateUndoGroup* m_editCurrentUndo;
00196 QList<KateUndoGroup*> undoItems;
00197 QList<KateUndoGroup*> redoItems;
00198 bool m_undoDontMerge;
00199
00200
00201 KateUndoGroup* lastUndoGroupWhenSaved;
00202 KateUndoGroup* lastRedoGroupWhenSaved;
00203 bool docWasSavedWhenUndoWasEmpty;
00204 bool docWasSavedWhenRedoWasEmpty;
00205 };
00206
00207 #endif
00208
00209