diff options
author | 2019-10-06 20:54:25 +0200 | |
---|---|---|
committer | 2019-10-26 11:36:23 -0700 | |
commit | 7b730602c6ac92c561c5ccb6a0dbf725a70fa963 (patch) | |
tree | 7f3f6e9b7f59d82db0ab56240b565918ba0d5cf5 /desktop-widgets/command_edit.h | |
parent | 6a6b992a7767c2ab4eee83a23d0c17caf979f66f (diff) | |
download | subsurface-7b730602c6ac92c561c5ccb6a0dbf725a70fa963.tar.gz |
Undo: implement ReplanDive command
Implement an undo command that overwrites the dive-computers and
cylinders of the current dive with a given dive. This will be used
when replanning a dive.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/command_edit.h')
-rw-r--r-- | desktop-widgets/command_edit.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/desktop-widgets/command_edit.h b/desktop-widgets/command_edit.h index 0ba3d1a14..ebce0bf1b 100644 --- a/desktop-widgets/command_edit.h +++ b/desktop-widgets/command_edit.h @@ -254,7 +254,7 @@ struct PasteState { void swap(dive_components what); // Exchange values here and in dive }; -class PasteDives : public Base { +class PasteDives : public Base { dive_components what; std::vector<PasteState> dives; std::vector<OwningDiveSitePtr> ownedDiveSites; @@ -267,6 +267,27 @@ private: bool workToBeDone() override; }; +class ReplanDive : public Base { + dive *d; + + // Exchange these data with current dive + timestamp_t when; + depth_t maxdepth, meandepth; + cylinder_t cylinders[MAX_CYLINDERS]; + struct divecomputer dc; + char *notes; + pressure_t surface_pressure; + duration_t duration; + int salinity; +public: + ReplanDive(dive *source); // Dive computer(s) and cylinders(s) of the source dive will be reset! + ~ReplanDive(); +private: + void undo() override; + void redo() override; + bool workToBeDone() override; +}; + } // namespace Command #endif |