summaryrefslogtreecommitdiffstats
path: root/commands/command_edit.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-11-03 15:04:48 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-05 10:14:25 -0800
commitb3f530bfb9d099414d833e7b0eb8c71cb3780eca (patch)
tree879112df23e236e93e80cf4a726504fb7dccf09c /commands/command_edit.h
parentb3253304a59b85c76f8a70f20ada4139e715a5b3 (diff)
downloadsubsurface-b3f530bfb9d099414d833e7b0eb8c71cb3780eca.tar.gz
Undo: make weight-deletion an undoable action
This one is a bit more complicated than weight adding, because the multiple-dive case is not well defined. If multiple dives are selected, this implementation will search for weights that are identical to the weight deleted in the currently shown dive. The position of the weight in the list is ignored. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'commands/command_edit.h')
-rw-r--r--commands/command_edit.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/commands/command_edit.h b/commands/command_edit.h
index ecf745070..c23f06094 100644
--- a/commands/command_edit.h
+++ b/commands/command_edit.h
@@ -339,6 +339,18 @@ private:
bool workToBeDone() override;
};
+class RemoveWeight : public EditDivesBase {
+public:
+ RemoveWeight(int index, bool currentDiveOnly);
+ ~RemoveWeight();
+private:
+ weightsystem_t ws;
+ std::vector<int> indexes; // An index for each dive in the dives vector.
+ void undo() override;
+ void redo() override;
+ bool workToBeDone() override;
+};
+
} // namespace Command
#endif