mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-11 03:21:29 +00:00
selection: remove select_dive() and deselect_dive() functions
These were not optimal, because they would recalculate the current dive and divecomputers for every invocation. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
1f453094a9
commit
996f85771a
2 changed files with 0 additions and 45 deletions
|
@ -24,49 +24,6 @@ static void fixup_current_dc()
|
||||||
dc_number = std::min(dc_number, number_of_computers(current_dive) - 1);
|
dc_number = std::min(dc_number, number_of_computers(current_dive) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void select_dive(struct dive *dive)
|
|
||||||
{
|
|
||||||
if (!dive)
|
|
||||||
return;
|
|
||||||
if (!dive->selected) {
|
|
||||||
dive->selected = 1;
|
|
||||||
amount_selected++;
|
|
||||||
}
|
|
||||||
current_dive = dive;
|
|
||||||
fixup_current_dc();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void deselect_dive(struct dive *dive)
|
|
||||||
{
|
|
||||||
int idx;
|
|
||||||
if (dive && dive->selected) {
|
|
||||||
dive->selected = 0;
|
|
||||||
if (amount_selected)
|
|
||||||
amount_selected--;
|
|
||||||
if (current_dive == dive && amount_selected > 0) {
|
|
||||||
/* pick a different dive as selected */
|
|
||||||
int selected_dive = idx = get_divenr(dive);
|
|
||||||
while (--selected_dive >= 0) {
|
|
||||||
dive = get_dive(selected_dive);
|
|
||||||
if (dive && dive->selected) {
|
|
||||||
current_dive = dive;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selected_dive = idx;
|
|
||||||
while (++selected_dive < divelog.dives->nr) {
|
|
||||||
dive = get_dive(selected_dive);
|
|
||||||
if (dive && dive->selected) {
|
|
||||||
current_dive = dive;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
current_dive = NULL;
|
|
||||||
}
|
|
||||||
fixup_current_dc();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" struct dive *first_selected_dive()
|
extern "C" struct dive *first_selected_dive()
|
||||||
{
|
{
|
||||||
int idx;
|
int idx;
|
||||||
|
|
|
@ -16,8 +16,6 @@ extern struct dive *current_dive;
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void select_dive(struct dive *dive);
|
|
||||||
extern void deselect_dive(struct dive *dive);
|
|
||||||
extern struct dive *first_selected_dive(void);
|
extern struct dive *first_selected_dive(void);
|
||||||
extern struct dive *last_selected_dive(void);
|
extern struct dive *last_selected_dive(void);
|
||||||
extern bool consecutive_selected(void);
|
extern bool consecutive_selected(void);
|
||||||
|
|
Loading…
Reference in a new issue