mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: make "delete dive computer" undoable
Simply reuse the code for "move dive computer" by creating a DiveComputerBase base class. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
eba6e76b96
commit
0bc96905bf
7 changed files with 60 additions and 25 deletions
18
core/dive.c
18
core/dive.c
|
|
@ -4234,10 +4234,22 @@ static void delete_divecomputer(struct dive *d, int num)
|
|||
invalidate_dive_cache(d);
|
||||
}
|
||||
|
||||
/* always acts on the current dive */
|
||||
void delete_current_divecomputer(void)
|
||||
/* Clone a dive and delete goven dive computer */
|
||||
struct dive *clone_delete_divecomputer(const struct dive *d, int dc_number)
|
||||
{
|
||||
delete_divecomputer(current_dive, dc_number);
|
||||
struct dive *res;
|
||||
|
||||
/* copy the dive */
|
||||
res = alloc_dive();
|
||||
copy_dive(d, res);
|
||||
|
||||
/* make a new unique id, since we still can't handle two equal ids */
|
||||
res->id = dive_getUniqID();
|
||||
invalidate_dive_cache(res);
|
||||
|
||||
delete_divecomputer(res, dc_number);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue