summaryrefslogtreecommitdiffstats
path: root/commands/command_event.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-03-04 21:10:05 +0100
committerGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-07 00:13:35 +0200
commit0bd821183d715f709d378e8ac1a75aa0c3d0f2cc (patch)
treee6d182e6922d7c06bf09b17c9c953f8b5dc78e85 /commands/command_event.h
parentc585fd9f8ee0c1f27f997b4e19984b50d150f6cb (diff)
downloadsubsurface-0bd821183d715f709d378e8ac1a75aa0c3d0f2cc.tar.gz
undo: implement gas switch
This is a bit hairy as - in theory - one gas switch can remove other gas switch(es) at the same timestamp. However, I did not find a way to test it. Moreover, it is not clear whether the dive-tabs are properly updated on undo/redo. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'commands/command_event.h')
-rw-r--r--commands/command_event.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/commands/command_event.h b/commands/command_event.h
index eec5cb262..8e75dee6c 100644
--- a/commands/command_event.h
+++ b/commands/command_event.h
@@ -82,6 +82,19 @@ private:
event *eventToRemove; // for redo
};
+class AddGasSwitch : public EventBase {
+public:
+ AddGasSwitch(struct dive *d, int dcNr, int seconds, int tank);
+private:
+ bool workToBeDone() override;
+ void undoit() override;
+ void redoit() override;
+
+ std::vector<int> cylinders; // cylinders that are modified
+ std::vector<OwningEventPtr> eventsToAdd;
+ std::vector<event *> eventsToRemove;
+};
+
} // namespace Command
#endif // COMMAND_EVENT_H