src/edithistory.cpp

Tue, 21 Sep 2021 19:58:06 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Tue, 21 Sep 2021 19:58:06 +0300
changeset 133
e39326ee48dc
child 136
e8444e0d7f1a
permissions
-rw-r--r--

Begin work on edit history

133
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #include "edithistory.h"
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 EditHistory::EditHistory()
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 {
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 }
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 void InsertHistoryEntry::undo(Model::EditContext &editContext)
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 {
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 editContext.remove(this->position);
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 }
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 void InsertHistoryEntry::redo(Model::EditContext &editContext)
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 {
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 }
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18 void DeleteHistoryEntry::undo(Model::EditContext &editContext)
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 {
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 static_cast<InsertHistoryEntry*>(this)->redo(editContext);
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 }
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 void DeleteHistoryEntry::redo(Model::EditContext &editContext)
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 {
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 static_cast<InsertHistoryEntry*>(this)->undo(editContext);
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 }
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 void EditHistoryEntry::undo(Model::EditContext &editContext)
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29 {
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 }
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
32
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
33 void EditHistoryEntry::redo(Model::EditContext &editContext)
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
34 {
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
35
e39326ee48dc Begin work on edit history
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
36 }

mercurial