mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
When deleting a cylinder, adapt gas changes
When we delete a cylinder the gas changes in that dive may have to be adjusted. We didn't do this at all in the past. With this commit we should be doing this right for a single dive that is being edited. This does NOT handle multiple dives being edited at the same time (or more specifically - if you have multiple dives selected and delete a cylinder, the dives that had the same set of cylinders (other than the displayed dive) will get that particular cylinder deleted, but won't have their gas change events (and sensor data in the samples) adapted. Possibly we should simply prohibit deleting cylinders when more than one dive are selected. See #834 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
bbfa2b655b
commit
415abeea66
4 changed files with 29 additions and 2 deletions
|
@ -813,6 +813,16 @@ void MainTab::acceptChanges()
|
|||
cd->cylinder[i] = displayed_dive.cylinder[i];
|
||||
cd->cylinder[i].type.description = copy_string(displayed_dive.cylinder[i].type.description);
|
||||
}
|
||||
/* if cylinders changed we may have changed gas change events
|
||||
* - so far this is ONLY supported for a single selected dive */
|
||||
struct divecomputer *tdc = ¤t_dive->dc;
|
||||
struct divecomputer *sdc = &displayed_dive.dc;
|
||||
while(tdc && sdc) {
|
||||
free_events(tdc->events);
|
||||
copy_events(sdc, tdc);
|
||||
tdc = tdc->next;
|
||||
sdc = sdc->next;
|
||||
}
|
||||
do_replot = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue