summaryrefslogtreecommitdiffstats
path: root/core/selection.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-05-02 14:41:52 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-03 15:02:21 -0700
commitf961ec7a8b399683b5b9aedc56827fa307511487 (patch)
tree5723cc305f2a6252dbc3b681af0643b32e0176e3 /core/selection.cpp
parent09b7fcbcf4e26d19529486ddd2a0e672e60dce32 (diff)
downloadsubsurface-f961ec7a8b399683b5b9aedc56827fa307511487.tar.gz
selection: introduce clear_selection() function
The DiveListView would touch the selection-innards directly. Let's encapsulate that. Moreover, take care to reset the trip selection when resetting the core data. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/selection.cpp')
-rw-r--r--core/selection.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/selection.cpp b/core/selection.cpp
index f763afcc6..48bb1a76f 100644
--- a/core/selection.cpp
+++ b/core/selection.cpp
@@ -253,3 +253,16 @@ extern "C" void deselect_trip(struct dive_trip *trip)
amount_trips_selected--;
}
}
+
+extern "C" void clear_selection(void)
+{
+ current_dive = nullptr;
+ amount_selected = 0;
+ amount_trips_selected = 0;
+ int i;
+ struct dive *dive;
+ for_each_dive (i, dive)
+ dive->selected = false;
+ for (int i = 0; i < trip_table.nr; ++i)
+ trip_table.trips[i]->selected = false;
+}