mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Use the Left and Right keys to switch between divecomputers
The existing code had the somewhat retarded Ctrl-C binding for displaying the next divecomputer and no way to go back to the previous one. With this commit we use our keyboard grab to map Left and Right to previous and next divecomputer. Much nicer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
91ca0d2cf6
commit
8f364d0094
2 changed files with 29 additions and 1 deletions
13
profile.c
13
profile.c
|
@ -1800,11 +1800,24 @@ static void plot_set_scale(scale_mode_t scale)
|
|||
}
|
||||
}
|
||||
|
||||
/* make sure you pass this the FIRST dc - it just walks the list */
|
||||
static int nr_dcs(struct divecomputer *main)
|
||||
{
|
||||
int i = 1;
|
||||
struct divecomputer *dc = main;
|
||||
|
||||
while ((dc = dc->next) != NULL)
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
static struct divecomputer *select_dc(struct divecomputer *main)
|
||||
{
|
||||
int i = dc_number;
|
||||
struct divecomputer *dc = main;
|
||||
|
||||
while (i < 0)
|
||||
i += nr_dcs(main);
|
||||
do {
|
||||
if (--i < 0)
|
||||
return dc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue