mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: make profile-editing undoable
Recently, undo of dive-replanning was introduced. Therefore, it appears logical to do the same thing for editing of the profile of manually added dives. For now, use the same undo-command, just change the displayed text from "replan dive" to "edit profile". Move the fixup dive call into the undo-command. Eventually, every action on the profile should be made undoable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
7c024f12d2
commit
a6fa6cdb41
5 changed files with 17 additions and 22 deletions
|
@ -887,7 +887,7 @@ void PasteDives::redo()
|
|||
}
|
||||
|
||||
// ***** Paste *****
|
||||
ReplanDive::ReplanDive(dive *source) : d(current_dive),
|
||||
ReplanDive::ReplanDive(dive *source, bool edit_profile) : d(current_dive),
|
||||
dc({ 0 }),
|
||||
notes(nullptr)
|
||||
{
|
||||
|
@ -895,6 +895,10 @@ ReplanDive::ReplanDive(dive *source) : d(current_dive),
|
|||
if (!d)
|
||||
return;
|
||||
|
||||
// Fix source. Things might be inconsistent after modifying the profile.
|
||||
source->maxdepth.mm = source->dc.maxdepth.mm = 0;
|
||||
fixup_dive(source);
|
||||
|
||||
when = source->when;
|
||||
maxdepth = source->maxdepth;
|
||||
meandepth = source->meandepth;
|
||||
|
@ -907,7 +911,7 @@ ReplanDive::ReplanDive(dive *source) : d(current_dive),
|
|||
std::swap(source->cylinders, cylinders);
|
||||
std::swap(source->dc, dc);
|
||||
|
||||
setText(tr("Replan dive"));
|
||||
setText(edit_profile ? tr("Replan dive") : tr("Edit profile"));
|
||||
}
|
||||
|
||||
ReplanDive::~ReplanDive()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue