FireBirdLib - Topfield TMS PVR TAP Programming Library
OSDCalcIndices.c
Go to the documentation of this file.
1
#include <string.h>
2
#include "
FBLib_TMSOSDMenu.h
"
3
4
void
OSDCalcIndices
(
void
)
5
{
6
TRACEENTER
();
7
8
tMenu
*pMenu;
9
10
pMenu = &
Menu
[
CurrentMenuLevel
];
11
12
//if TopIndex or SelectionIndex has changed, make list dirty
13
if
(pMenu->
OSDMenuDisplayMode
==
OMDM_Memo
|| pMenu->
OSDMenuDisplayMode
==
OMDM_Text
)
14
{
15
pMenu->
CurrentTopIndex
= pMenu->
CurrentSelection
;
16
17
if
(pMenu->
OSDMenuDisplayMode
==
OMDM_Text
)
18
{
19
if
(pMenu->
CurrentTopIndex
+ pMenu->
NrLines
> pMenu->
NrItems
)
20
{
21
pMenu->
CurrentTopIndex
= pMenu->
NrItems
- pMenu->
NrLines
;
22
23
if
(pMenu->
CurrentTopIndex
< 0) pMenu->
CurrentTopIndex
= 0;
24
25
pMenu->
CurrentSelection
= pMenu->
CurrentTopIndex
;
26
}
27
}
28
}
29
else
30
{
31
if
(pMenu->
CurrentSelection
< pMenu->
CurrentTopIndex
)
32
{
33
if
(pMenu->
CurrentSelection
> 0)
34
{
35
//Check if there are selectable items above the current selection
36
bool
Selectable;
37
int
i;
38
39
Selectable = FALSE;
40
for
(i = pMenu->
CurrentSelection
- 1; i >= 0; i--)
41
{
42
if
(pMenu->
Item
[i].
Selectable
)
43
{
44
Selectable = TRUE;
45
break
;
46
}
47
}
48
if
(Selectable)
49
pMenu->
CurrentTopIndex
= pMenu->
CurrentSelection
;
50
else
51
pMenu->
CurrentTopIndex
= 0;
52
}
53
else
54
{
55
pMenu->
CurrentTopIndex
= pMenu->
CurrentSelection
;
56
}
57
}
58
59
60
if
(pMenu->
CurrentSelection
> (pMenu->
CurrentTopIndex
+ pMenu->
NrLines
- 1))
61
{
62
if
(pMenu->
CurrentSelection
< pMenu->
NrItems
- 1)
63
{
64
//Check if there are selectable items above the current selection
65
bool
Selectable;
66
int
i;
67
68
Selectable = FALSE;
69
for
(i = pMenu->
CurrentSelection
+ 1; i < pMenu->NrItems; i++)
70
{
71
if
(pMenu->
Item
[i].
Selectable
)
72
{
73
Selectable = TRUE;
74
break
;
75
}
76
}
77
if
(Selectable)
78
pMenu->
CurrentTopIndex
= pMenu->
CurrentSelection
- pMenu->
NrLines
+ 1;
79
else
80
pMenu->
CurrentTopIndex
= pMenu->
NrItems
- pMenu->
NrLines
;
81
82
if
((pMenu->
CurrentSelection
- pMenu->
CurrentTopIndex
) > pMenu->
NrLines
)
83
pMenu->
CurrentTopIndex
= pMenu->
CurrentSelection
- pMenu->
NrLines
;
84
}
85
else
86
{
87
pMenu->
CurrentTopIndex
= pMenu->
CurrentSelection
- pMenu->
NrLines
+ 1;
88
}
89
}
90
}
91
92
TRACEEXIT
();
93
}
FBLib_TMSOSDMenu.h
Menu
tMenu Menu[NRMENULEVELS]
Definition:
OSDMenuInit.c:6
OMDM_Text
@ OMDM_Text
Definition:
FBLib_TMSOSDMenu.h:63
OMDM_Memo
@ OMDM_Memo
Definition:
FBLib_TMSOSDMenu.h:62
CurrentMenuLevel
dword CurrentMenuLevel
Definition:
OSDMenuInit.c:7
OSDCalcIndices
void OSDCalcIndices(void)
Definition:
OSDCalcIndices.c:4
TRACEEXIT
#define TRACEEXIT()
Definition:
libFireBird.h:1244
TRACEENTER
#define TRACEENTER()
Definition:
libFireBird.h:1243
tItem::Selectable
bool Selectable
Definition:
FBLib_TMSOSDMenu.h:40
tMenu
Definition:
FBLib_TMSOSDMenu.h:67
tMenu::CurrentSelection
int CurrentSelection
Definition:
FBLib_TMSOSDMenu.h:74
tMenu::NrLines
int NrLines
Definition:
FBLib_TMSOSDMenu.h:70
tMenu::CurrentTopIndex
int CurrentTopIndex
Definition:
FBLib_TMSOSDMenu.h:75
tMenu::Item
tItem * Item
Definition:
FBLib_TMSOSDMenu.h:71
tMenu::OSDMenuDisplayMode
tOSDMenuDisplayMode OSDMenuDisplayMode
Definition:
FBLib_TMSOSDMenu.h:96
tMenu::NrItems
int NrItems
Definition:
FBLib_TMSOSDMenu.h:72
TMSOSDMenu
OSDCalcIndices.c
Generated on Fri Apr 29 2022 13:34:01 for FireBirdLib - Topfield TMS PVR TAP Programming Library by
1.9.3