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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
#include "skindesignerosdbase.h"
/**********************************************************************
* cSkindesignerOsdObject
**********************************************************************/
skindesignerapi::cSkindesignerOsdObject::cSkindesignerOsdObject(void) {
pluginName = "";
}
skindesignerapi::cSkindesignerOsdObject::~cSkindesignerOsdObject() {
}
bool skindesignerapi::cSkindesignerOsdObject::InitSkindesignerInterface(string pluginName) {
this->pluginName = pluginName;
return true;
}
skindesignerapi::cOsdView *skindesignerapi::cSkindesignerOsdObject::GetOsdView(int viewID, int subViewID) {
ISkinDisplayPlugin *displayPlugin = SkindesignerAPI::GetDisplayPlugin(pluginName, viewID, subViewID);
if (!displayPlugin)
return NULL;
cOsdView *view = new cOsdView(displayPlugin);
return view;
}
/**********************************************************************
* cSkindesignerOsdItem
**********************************************************************/
skindesignerapi::cSkindesignerOsdItem::cSkindesignerOsdItem(eOSState State) : cOsdItem(State) {
sdDisplayMenu = NULL;
}
skindesignerapi::cSkindesignerOsdItem::cSkindesignerOsdItem(const char *Text, eOSState State, bool Selectable) : cOsdItem(Text, State, Selectable) {
sdDisplayMenu = NULL;
}
skindesignerapi::cSkindesignerOsdItem::~cSkindesignerOsdItem() {
}
void skindesignerapi::cSkindesignerOsdItem::SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index, bool Current, bool Selectable) {
if (sdDisplayMenu) {
if (!sdDisplayMenu->SetItemPlugin(&stringTokens, &intTokens, &loopTokens, Index, Current, Selectable)) {
DisplayMenu->SetItem(Text(), Index, Current, Selectable);
}
} else {
DisplayMenu->SetItem(Text(), Index, Current, Selectable);
}
}
void skindesignerapi::cSkindesignerOsdItem::AddStringToken(string key, string value) {
stringTokens.insert(pair<string,string>(key, value));
}
void skindesignerapi::cSkindesignerOsdItem::AddIntToken(string key, int value) {
intTokens.insert(pair<string,int>(key, value));
}
void skindesignerapi::cSkindesignerOsdItem::AddLoopToken(string loopName, map<string, string> &tokens) {
map<string, vector<map<string, string> > >::iterator hitLoop = loopTokens.find(loopName);
if (hitLoop == loopTokens.end()) {
vector<map<string, string> > tokenVector;
tokenVector.push_back(tokens);
loopTokens.insert(pair<string, vector<map<string, string> > >(loopName, tokenVector));
} else {
vector<map<string, string> > *tokenVector = &hitLoop->second;
tokenVector->push_back(tokens);
}
}
/**********************************************************************
* cSkindesignerOsdMenu
**********************************************************************/
skindesignerapi::cSkindesignerOsdMenu::cSkindesignerOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4) : cOsdMenu(Title, c0, c1, c2, c3, c4) {
init = true;
firstCallCleared = false;
secondCall = false;
firstMenu = -1;
firstType = mtList;
displayText = false;
sdDisplayMenu = NULL;
pluginName = "";
SetMenuCategory(mcPlugin);
SetSkinDesignerDisplayMenu();
}
skindesignerapi::cSkindesignerOsdMenu::~cSkindesignerOsdMenu() {
}
void skindesignerapi::cSkindesignerOsdMenu::SetPluginMenu(int menu, eMenuType type) {
if (firstCallCleared) {
firstMenu = menu;
firstType = type;
}
if (type == mtList)
displayText = false;
else if (type == mtText)
displayText = true;
if (sdDisplayMenu) {
sdDisplayMenu->SetPluginMenu(pluginName, menu, type, init);
}
init = false;
}
bool skindesignerapi::cSkindesignerOsdMenu::SetSkinDesignerDisplayMenu(void) {
sdDisplayMenu = SkindesignerAPI::GetDisplayMenu();
return (sdDisplayMenu != NULL);
}
void skindesignerapi::cSkindesignerOsdMenu::ClearTokens(void) {
text = "";
stringTokens.clear();
intTokens.clear();
loopTokens.clear();
}
void skindesignerapi::cSkindesignerOsdMenu::AddStringToken(string key, string value) {
stringTokens.insert(pair<string,string>(key, value));
}
void skindesignerapi::cSkindesignerOsdMenu::AddIntToken(string key, int value) {
intTokens.insert(pair<string,int>(key, value));
}
void skindesignerapi::cSkindesignerOsdMenu::AddLoopToken(string loopName, map<string, string> &tokens) {
map<string, vector<map<string, string> > >::iterator hitLoop = loopTokens.find(loopName);
if (hitLoop == loopTokens.end()) {
vector<map<string, string> > tokenVector;
tokenVector.push_back(tokens);
loopTokens.insert(pair<string, vector<map<string, string> > >(loopName, tokenVector));
} else {
vector<map<string, string> > *tokenVector = &hitLoop->second;
tokenVector->push_back(tokens);
}
}
void skindesignerapi::cSkindesignerOsdMenu::TextKeyLeft(void) {
if (!displayText)
return;
DisplayMenu()->Scroll(true, true);
}
void skindesignerapi::cSkindesignerOsdMenu::TextKeyRight(void) {
if (!displayText)
return;
DisplayMenu()->Scroll(false, true);
}
void skindesignerapi::cSkindesignerOsdMenu::TextKeyUp(void) {
if (!displayText)
return;
DisplayMenu()->Scroll(true, false);
}
void skindesignerapi::cSkindesignerOsdMenu::TextKeyDown(void) {
if (!displayText)
return;
DisplayMenu()->Scroll(false, false);
}
void skindesignerapi::cSkindesignerOsdMenu::Display(void) {
if (firstCallCleared) {
firstCallCleared = false;
secondCall = true;
return;
}
if (secondCall) {
SetSkinDesignerDisplayMenu();
SetPluginMenu(firstMenu, firstType);
}
if (displayText) {
if (sdDisplayMenu) {
sdDisplayMenu->SetTitle(Title());
if (sdDisplayMenu->SetPluginText(&stringTokens, &intTokens, &loopTokens)) {
sdDisplayMenu->Flush();
} else {
DisplayMenu()->Clear();
DisplayMenu()->SetTitle(Title());
DisplayMenu()->SetText(text.c_str(), false);
DisplayMenu()->Flush();
}
} else {
DisplayMenu()->Clear();
DisplayMenu()->SetTitle(Title());
DisplayMenu()->SetText(text.c_str(), false);
DisplayMenu()->Flush();
}
return;
}
if (sdDisplayMenu) {
sdDisplayMenu->SetTitle(Title());
for (cOsdItem *item = First(); item; item = Next(item)) {
cSkindesignerOsdItem *sdItem = dynamic_cast<cSkindesignerOsdItem*>(item);
if (sdItem) {
sdItem->SetDisplayMenu(sdDisplayMenu);
}
}
}
cOsdMenu::Display();
}
|