blob: d3bce58987712613043f288cee9dae3dd2e87520 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
#ifndef __MENU_DVDSWITCH_H
#define __MENU_DVDSWITCH_H
#include <vdr/osdbase.h>
#include "menu-item.h"
#include "dvdlist.h"
enum eMainMenuState
{
mmsNone,
mmsReInit,
mmsReInitCur,
mmsImgRename,
};
class cCMDImage;
class cMainMenu : public cOsdMenu
{
private:
int FirstSelectable;
eMainMenuState State;
cCMDImage *CMDImg;
cImageList &ImageList;
void Init(void);
void SetMenuTitle(void);
void Build(const char *dir);
void BuildDisp0(const char *dir);
void BuildDisp1(const char *dir);
void BuildDisp2(const char *dir);
eOSState MenuMove(eKeys Key);
eOSState SelectItem(void);
eOSState Commands(eKeys Key);
public:
cMainMenu(cImageList &ImageList);
~cMainMenu(void);
void SetHelp(void);
virtual eOSState ProcessKey(eKeys Key);
static char *CreateOSDName(eMainMenuItem itype, cImageList &ImageList, const char *file = NULL);
void SetState(eMainMenuState state);
eMainMenuState GetState(void) { return State; };
};
class cDirHandlingOpt
{
char *IDir;
char *CDir;
char *PDir;
char *LSDir;
char *LSItemName;
eMainMenuItem LSItemType;
public:
cDirHandlingOpt(void)
{
IDir = NULL;
CDir = NULL;
PDir = NULL;
LSDir = NULL;
LSItemName = NULL;
LSItemType = iCat;
}
~cDirHandlingOpt(void)
{
free(IDir);
free(CDir);
free(PDir);
free(LSDir);
free(LSItemName);
}
char *ImageDir(const char *dir = NULL)
{
if(dir)
{
FREENULL(IDir);
IDir = strdup(dir);
}
return IDir;
}
char *CurrentDir(const char *dir = NULL)
{
if(dir)
{
FREENULL(CDir);
CDir = strdup(dir);
}
return CDir;
}
char *ParentDir(const char *dir = NULL)
{
if(dir)
{
FREENULL(PDir);
PDir = strdup(dir);
}
return PDir;
}
char *LastSelDir(const char *dir = NULL)
{
if(dir)
{
FREENULL(LSDir);
LSDir = strdup(dir);
}
return LSDir;
}
bool isParent(const char *dir)
{
if(dir && PDir && strcasecmp(dir, PDir))
return true;
return false;
}
bool isLastSel(const char *dir)
{
if(dir && LSDir && !strcasecmp(dir, LSDir))
return true;
return false;
}
void setLastSelectItemName(const char *filename = NULL)
{
FREENULL(LSItemName);
if(filename)
LSItemName = strdup(filename);
};
char *getLastSelectItemName(void) { return LSItemName; }
eMainMenuItem LastSelectItemType(eMainMenuItem type = iCat)
{
if(type != iCat)
LSItemType = type;
return LSItemType;
}
};
class cDirHandling
{
private:
cOsdMenu *OsdObject;
cDirHandlingOpt *DirObject;
public:
cDirHandling(cOsdMenu *osdobject, cDirHandlingOpt *dirobject);
int Build(const char *dir, bool emptydirs, cImageList &ImageList);
void ProcessKey(cMainMenuItem *mItem);
};
extern cDirHandlingOpt MainMenuOptions;
#endif // __MENU_DVDSWITCH_H
|