summaryrefslogtreecommitdiffstats
path: root/commands/command_event.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-03-04 18:13:02 +0100
committerGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-07 00:13:35 +0200
commitab8e317b28672cc19fd04e994b9adf9b63f0c603 (patch)
tree3e360e47ad55232fd85be094ef4b19bef7d2f976 /commands/command_event.h
parentf9fe6d759f33c36f1c0c0d20a591f6517fc9071f (diff)
downloadsubsurface-ab8e317b28672cc19fd04e994b9adf9b63f0c603.tar.gz
undo: implement renaming of events
There is a slight complexity here owing to the fact that the profile works on a copy of the current dive: We get a copy of the event and have to search for the original event in the current dive. This could be done in the undo command. Nevertheless, here we do it in the profile so that when in the future the profile can work on a non-copied dive we can simply remove this function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'commands/command_event.h')
-rw-r--r--commands/command_event.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/commands/command_event.h b/commands/command_event.h
index a674e258b..ddfe6f7d4 100644
--- a/commands/command_event.h
+++ b/commands/command_event.h
@@ -58,6 +58,18 @@ public:
AddEventSetpointChange(struct dive *d, int dcNr, int seconds, pressure_t pO2);
};
+class RenameEvent : public EventBase {
+public:
+ RenameEvent(struct dive *d, int dcNr, struct event *ev, const char *name);
+private:
+ bool workToBeDone() override;
+ void undoit() override;
+ void redoit() override;
+
+ OwningEventPtr eventToAdd; // for undo and redo
+ event *eventToRemove; // for undo and redo
+};
+
} // namespace Command
#endif // COMMAND_EVENT_H