FireBirdLib - Topfield TMS PVR TAP Programming Library
OSDMenuItemSortID.c
Go to the documentation of this file.
1
#include <string.h>
2
#include "
FBLib_TMSOSDMenu.h
"
3
4
void
OSDMenuItemSortID
(
bool
Ascending)
5
{
6
TRACEENTER
();
7
8
int
i, j, NrItems;
9
tItem
TempItem;
10
dword ID1, ID2;
11
bool
Swap;
12
13
NrItems =
Menu
[
CurrentMenuLevel
].
NrItems
;
14
15
for
(i = 0; i < NrItems - 1; i++)
16
{
17
for
(j = i + 1; j < NrItems; j++)
18
{
19
ID1 =
Menu
[
CurrentMenuLevel
].
Item
[i].
ID
;
20
ID2 =
Menu
[
CurrentMenuLevel
].
Item
[j].
ID
;
21
22
switch
(Ascending ? 1 : 0)
23
{
24
case
0: Swap = (ID1 < ID2);
break
;
25
case
1: Swap = (ID1 > ID2);
break
;
26
default
:
27
Swap = FALSE;
28
break
;
29
}
30
31
if
(Swap)
32
{
33
memcpy(&TempItem, &
Menu
[
CurrentMenuLevel
].Item[i],
sizeof
(
tItem
));
34
memcpy(&
Menu
[
CurrentMenuLevel
].Item[i], &
Menu
[
CurrentMenuLevel
].Item[j],
sizeof
(
tItem
));
35
memcpy(&
Menu
[
CurrentMenuLevel
].Item[j], &TempItem,
sizeof
(
tItem
));
36
}
37
}
38
}
39
40
ListDirty
= TRUE;
41
42
TRACEEXIT
();
43
}
FBLib_TMSOSDMenu.h
Menu
tMenu Menu[NRMENULEVELS]
Definition:
OSDMenuInit.c:6
CurrentMenuLevel
dword CurrentMenuLevel
Definition:
OSDMenuInit.c:7
ListDirty
bool ListDirty
Definition:
FBLib_TMSOSDMenu.h:223
OSDMenuItemSortID
void OSDMenuItemSortID(bool Ascending)
Definition:
OSDMenuItemSortID.c:4
TRACEEXIT
#define TRACEEXIT()
Definition:
libFireBird.h:1244
TRACEENTER
#define TRACEENTER()
Definition:
libFireBird.h:1243
tItem
Definition:
FBLib_TMSOSDMenu.h:32
tItem::ID
dword ID
Definition:
FBLib_TMSOSDMenu.h:45
tMenu::Item
tItem * Item
Definition:
FBLib_TMSOSDMenu.h:71
tMenu::NrItems
int NrItems
Definition:
FBLib_TMSOSDMenu.h:72
TMSOSDMenu
OSDMenuItemSortID.c
Generated on Fri Apr 29 2022 13:34:01 for FireBirdLib - Topfield TMS PVR TAP Programming Library by
1.9.3