mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
undo: split replanDive and editProfile commands
These two actions were using the same command with a flag controlling the name of the command, which is shown in the undo menu. However, the replanDive does much more (such as changing the notes) and in the future we may want to be more fine-grained with respect to profile editing. Therefore, split these commands into two separate ones. Moreover, make the editProfile command more flexible. Pass an enum describing the action instead and also a counter indicating how many points have been moved or removed. Finally, don't consume the input dive in the editProfile command, because we will want to keep the original dive while editing the profile. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
2368a183e1
commit
ea0c030770
5 changed files with 102 additions and 10 deletions
|
@ -334,8 +334,7 @@ class ReplanDive : public Base {
|
|||
int salinity;
|
||||
public:
|
||||
// Dive computer(s) and cylinders(s) of the source dive will be reset!
|
||||
// If edit_profile is true, the text will be changed from "replan dive" to "edit profile".
|
||||
ReplanDive(dive *source, bool edit_profile);
|
||||
ReplanDive(dive *source);
|
||||
~ReplanDive();
|
||||
private:
|
||||
void undo() override;
|
||||
|
@ -343,6 +342,23 @@ private:
|
|||
bool workToBeDone() override;
|
||||
};
|
||||
|
||||
class EditProfile : public Base {
|
||||
dive *d;
|
||||
int dcNr;
|
||||
|
||||
depth_t maxdepth, meandepth, dcmaxdepth;
|
||||
duration_t duration;
|
||||
struct divecomputer dc;
|
||||
public:
|
||||
// Note: source must be clean (i.e. fixup_dive must have been called on it).
|
||||
EditProfile(const dive *source, EditProfileType type, int count);
|
||||
~EditProfile();
|
||||
private:
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
bool workToBeDone() override;
|
||||
};
|
||||
|
||||
class AddWeight : public EditDivesBase {
|
||||
public:
|
||||
AddWeight(bool currentDiveOnly);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue