2019-02-11 15:34:43 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2019-11-24 13:26:29 +01:00
|
|
|
// Selection related functions
|
2019-02-11 15:34:43 +01:00
|
|
|
|
2019-11-24 13:26:29 +01:00
|
|
|
#ifndef SELECTION_H
|
|
|
|
#define SELECTION_H
|
2019-02-11 15:34:43 +01:00
|
|
|
|
2019-11-24 15:02:34 +01: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 19:00:38 +01:00
|
|
|
extern void select_newest_visible_dive();
|
2019-12-06 09:47:59 +01:00
|
|
|
extern void select_single_dive(struct dive *d); // wrapper for setSelection() with a single dive. NULL clears the selection.
|
2019-11-24 15:02:34 +01:00
|
|
|
|
|
|
|
#if DEBUG_SELECTION_TRACKING
|
|
|
|
extern void dump_selection(void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-11-24 13:26:29 +01:00
|
|
|
/*** C++-only functions ***/
|
2019-02-17 10:18:00 +01:00
|
|
|
|
2019-11-24 13:26:29 +01:00
|
|
|
#ifdef __cplusplus
|
2019-02-11 15:34:43 +01:00
|
|
|
#include <vector>
|
|
|
|
|
2019-02-17 10:18:00 +01: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 13:26:29 +01:00
|
|
|
// null if "seletion" is empty).
|
2019-06-23 12:13:25 +02:00
|
|
|
void setSelection(const std::vector<dive *> &selection, dive *currentDive);
|
2019-02-17 10:18:00 +01:00
|
|
|
|
|
|
|
// Get currently selectd dives
|
|
|
|
std::vector<dive *> getDiveSelection();
|
|
|
|
|
2019-11-24 13:26:29 +01:00
|
|
|
#endif // __cplusplus
|
2019-02-11 15:34:43 +01:00
|
|
|
|
2019-11-24 13:26:29 +01:00
|
|
|
#endif // SELECTION_H
|