summaryrefslogtreecommitdiffstats
path: root/commands/command_edit.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-02-23 11:43:50 +0100
committerGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-07 00:13:34 +0200
commitaa7b0cadb2f737e65d490f4ad026f5df09a394f0 (patch)
tree8dae2a4a9a002e2e3e7d82e420de62e84d0c8020 /commands/command_edit.h
parent36754d3399dab9155fac50e9451dcd325c7c73c0 (diff)
downloadsubsurface-aa7b0cadb2f737e65d490f4ad026f5df09a394f0.tar.gz
undo: add cylinder undo commands by copy & paste
Do a simple copy & paste followed by a simple search & replace to generate cylinder undo commands from weight undo commands. Obviously, this is still missing the necessary code to keep the dive-data consistent after cylinder editing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'commands/command_edit.h')
-rw-r--r--commands/command_edit.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/commands/command_edit.h b/commands/command_edit.h
index e99ce2407..88f359fba 100644
--- a/commands/command_edit.h
+++ b/commands/command_edit.h
@@ -377,6 +377,45 @@ private:
void redo() override;
};
+class AddCylinder : public EditDivesBase {
+public:
+ AddCylinder(bool currentDiveOnly);
+ ~AddCylinder();
+private:
+ cylinder_t cyl;
+ void undo() override;
+ void redo() override;
+ bool workToBeDone() override;
+};
+
+class EditCylinderBase : public EditDivesBase {
+protected:
+ EditCylinderBase(int index, bool currentDiveOnly);
+ ~EditCylinderBase();
+
+ cylinder_t cyl;
+ std::vector<int> indexes; // An index for each dive in the dives vector.
+ bool workToBeDone() override;
+};
+
+class RemoveCylinder : public EditCylinderBase {
+public:
+ RemoveCylinder(int index, bool currentDiveOnly);
+private:
+ void undo() override;
+ void redo() override;
+};
+
+class EditCylinder : public EditCylinderBase {
+public:
+ EditCylinder(int index, cylinder_t cyl, bool currentDiveOnly); // Clones cylinder
+ ~EditCylinder();
+private:
+ cylinder_t new_cyl;
+ void undo() override;
+ void redo() override;
+};
+
#ifdef SUBSURFACE_MOBILE
// Edit a full dive. This is used on mobile where we don't have per-field granularity.
// It may add or edit a dive site.
@@ -406,5 +445,4 @@ private:
#endif // SUBSURFACE_MOBILE
} // namespace Command
-
#endif