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;
|
|
|
|
|
|
|
|
/*** 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);
|
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.
|
|
|
|
// Set the current dive to "currentDive". "currentDive" must be an element of "selection" (or
|
2019-11-24 12:26:29 +00:00
|
|
|
// null if "seletion" is empty).
|
2019-06-23 10:13:25 +00:00
|
|
|
void setSelection(const std::vector<dive *> &selection, dive *currentDive);
|
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
|