mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
undo: make adding of pictures undoable
This one is a bit hairy, because two things might happen if the picture has a geo location: - A dive gets a newly generated dive site set. - The dive site of a dive is edited. Therefore the undo command has to store keep track of that. Oh my. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
6ae2d36e38
commit
4374605c12
7 changed files with 129 additions and 22 deletions
14
core/dive.c
14
core/dive.c
|
|
@ -3497,20 +3497,6 @@ void set_git_prefs(const char *prefs)
|
|||
git_prefs.pp_graphs.po2 = 1;
|
||||
}
|
||||
|
||||
void dive_set_geodata_from_picture(struct dive *dive, struct picture *picture, struct dive_site_table *table)
|
||||
{
|
||||
struct dive_site *ds = dive->dive_site;
|
||||
if (!dive_site_has_gps_location(ds) && has_location(&picture->location)) {
|
||||
if (ds) {
|
||||
ds->location = picture->location;
|
||||
} else {
|
||||
ds = create_dive_site_with_gps("", &picture->location, table);
|
||||
add_dive_to_dive_site(dive, ds);
|
||||
invalidate_dive_cache(dive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* clones a dive and moves given dive computer to front */
|
||||
struct dive *make_first_dc(const struct dive *d, int dc_number)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue