2019-02-11 14:34:43 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2019-11-24 12:26:29 +00:00
|
|
|
// Selection related functions
|
2019-02-11 14:34:43 +00:00
|
|
|
|
2019-11-24 12:26:29 +00:00
|
|
|
#ifndef SELECTION_H
|
|
|
|
#define SELECTION_H
|
2019-02-11 14:34:43 +00:00
|
|
|
|
2019-11-24 14:02:34 +00:00
|
|
|
struct dive;
|
|
|
|
|
|
|
|
extern int amount_selected;
|
2022-04-04 16:57:28 +00:00
|
|
|
extern unsigned int dc_number;
|
|
|
|
extern struct dive *current_dive;
|
2019-11-24 14:02:34 +00:00
|
|
|
|
|
|
|
/*** C and C++ functions ***/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#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 *last_selected_dive(void);
|
|
|
|
extern bool consecutive_selected(void);
|
2019-11-25 18:00:38 +00:00
|
|
|
extern void select_newest_visible_dive();
|
2019-12-06 08:47:59 +00:00
|
|
|
extern void select_single_dive(struct dive *d); // wrapper for setSelection() with a single dive. NULL clears the selection.
|
2020-05-02 12:34:40 +00:00
|
|
|
extern void select_trip(struct dive_trip *trip);
|
|
|
|
extern void deselect_trip(struct dive_trip *trip);
|
2020-05-02 16:14:44 +00:00
|
|
|
extern struct dive_trip *single_selected_trip(); // returns trip if exactly one trip is selected, NULL otherwise.
|
2020-05-02 12:41:52 +00:00
|
|
|
extern void clear_selection(void);
|
2019-11-24 14:02:34 +00:00
|
|
|
|
|
|
|
#if DEBUG_SELECTION_TRACKING
|
|
|
|
extern void dump_selection(void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-11-24 12:26:29 +00:00
|
|
|
/*** C++-only functions ***/
|
2019-02-17 09:18:00 +00:00
|
|
|
|
2019-11-24 12:26:29 +00:00
|
|
|
#ifdef __cplusplus
|
2019-02-11 14:34:43 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2019-02-17 09:18:00 +00:00
|
|
|
// Reset the selection to the dives of the "selection" vector and send the appropriate signals.
|
2022-04-04 16:57:28 +00:00
|
|
|
// Set the current dive to "currentDive" and the current dive computer to "currentDc".
|
|
|
|
// "currentDive" must be an element of "selection" (or null if "seletion" is empty).
|
|
|
|
// If "currentDc" is negative, an attempt will be made to keep the current computer number.
|
|
|
|
void setSelection(const std::vector<dive *> &selection, dive *currentDive, int currentDc);
|
2019-02-17 09:18:00 +00:00
|
|
|
|
|
|
|
// Get currently selectd dives
|
|
|
|
std::vector<dive *> getDiveSelection();
|
|
|
|
|
2019-11-24 12:26:29 +00:00
|
|
|
#endif // __cplusplus
|
2019-02-11 14:34:43 +00:00
|
|
|
|
2019-11-24 12:26:29 +00:00
|
|
|
#endif // SELECTION_H
|