source: titan/plugins/tmc/tmc.h @ 15743

Last change on this file since 15743 was 15743, checked in by nit, 11 years ago

[titan] update tmc

File size: 6.7 KB
Line 
1#ifndef TMC_H
2#define TMC_H
3
4int menu0pos = 0;
5char* menu0[] = {"skin/tmcsettings.png", "skin/tmcpicture.png", "skin/tmcvideo.png", "skin/tmcaudio.png", "skin/tmcbtn.png"};
6char* menu0txt[] = {"Settings", "Picture", "Video", "Audio", ""};
7
8int menu1pos = 0;
9char* menu1[] = {"skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png"};
10char* menu1txt[] = {"S1", "S2", "S3", "S4", "S5"};
11
12int menu2pos = 0;
13char* menu2[] = {"skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png"};
14char* menu2txt[] = {"P1", "P2", "P3", "P4", "P5"};
15
16int menu3pos = 0;
17char* menu3[] = {"skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png"};
18char* menu3txt[] = {"V1", "V2", "V3", "V4", "V5"};
19
20int menu4pos = 0;
21char* menu4[] = {"skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png"};
22char* menu4txt[] = {"A1", "A2", "A3", "A4", "A5"};
23
24//flag 0: draw only
25//flag 1: left
26//flag 2: right
27void tmcpicscroll(struct skin* tmcpic1, struct skin* tmcpic2, struct skin* tmcpic3, struct skin* tmcpic4, struct skin* tmcpic5, int flag)
28{
29/*
30        int id = 0, max = 0;
31        char** menu = NULL, **menutxt = NULL;
32        int *menupos;
33
34        if(menuid == 0)
35        {
36                menu = menu0;
37                menutxt = menu0txt;
38                max = (sizeof(menu0) / sizeof(char*)) - 1;
39                menupos = &menu0pos;
40        }
41        else if(menuid == 1)
42        {
43                menu = menu1;
44                menutxt = menu1txt;
45                max = (sizeof(menu1) / sizeof(char*)) - 1;
46                menupos = &menu1pos;
47        }
48        else if(menuid == 2)
49        {
50                menu = menu2;
51                menutxt = menu2txt;
52                max = (sizeof(menu2) / sizeof(char*)) - 1;
53                menupos = &menu2pos;
54        }
55        else if(menuid == 3)
56        {
57                menu = menu3;
58                menutxt = menu3txt;
59                max = (sizeof(menu3) / sizeof(char*)) - 1;
60                menupos = &menu3pos;
61        }
62        else if(menuid == 4)
63        {
64                menu = menu4;
65                menutxt = menu4txt;
66                max = (sizeof(menu4) / sizeof(char*)) - 1;
67                menupos = &menu4pos;
68        }
69
70        if(flag == 1) (*menupos)++;
71        if(flag == 2) (*menupos)--;
72
73        if(*menupos < 0) *menupos = max;
74        if(*menupos > max) *menupos = 0;
75
76        id = *menupos;
77
78        if(id > max) id = 0;
79        changepic(tmcpic1, menu[id]);
80        id++;
81
82        if(id > max) id = 0;
83        changepic(tmcpic2, menu[id]);
84        id++;
85
86        if(id > max) id = 0;
87        changepic(tmcpic3, menu[id]);
88        id++;
89
90        if(id > max) id = 0;
91        changepic(tmcpic4, menu[id]);
92        id++;
93
94        if(id > max) id = 0;
95        changepic(tmcpic5, menu[id]);
96
97        drawscreen(tmcpic1, 1);
98        drawscreen(tmcpic2, 1);
99        drawscreen(tmcpic3, 1);
100        drawscreen(tmcpic4, 1);
101        drawscreen(tmcpic5, 0);
102*/
103}
104
105//flag 0: draw only
106//flag 1: left
107//flag 2: right
108void tmcmenuscroll(int menuid, int active, struct skin* tmcmenutxt, struct skin* tmcmenu1, struct skin* tmcmenu2, struct skin* tmcmenu3, struct skin* tmcmenu4, struct skin* tmcmenu5, int flag)
109{
110        int id = 0, max = 0;
111        char** menu = NULL, **menutxt = NULL;
112        int *menupos = 0;
113
114        if(menuid == 0)
115        {
116                menu = menu0;
117                menutxt = menu0txt;
118                max = (sizeof(menu0) / sizeof(char*)) - 1;
119                menupos = &menu0pos;
120        }
121        else if(menuid == 1)
122        {
123                menu = menu1;
124                menutxt = menu1txt;
125                max = (sizeof(menu1) / sizeof(char*)) - 1;
126                menupos = &menu1pos;
127        }
128        else if(menuid == 2)
129        {
130                menu = menu2;
131                menutxt = menu2txt;
132                max = (sizeof(menu2) / sizeof(char*)) - 1;
133                menupos = &menu2pos;
134        }
135        else if(menuid == 3)
136        {
137                menu = menu3;
138                menutxt = menu3txt;
139                max = (sizeof(menu3) / sizeof(char*)) - 1;
140                menupos = &menu3pos;
141        }
142        else if(menuid == 4)
143        {
144                menu = menu4;
145                menutxt = menu4txt;
146                max = (sizeof(menu4) / sizeof(char*)) - 1;
147                menupos = &menu4pos;
148        }
149
150        if(flag == 1) (*menupos)++;
151        if(flag == 2) (*menupos)--;
152
153        if(*menupos < 0) *menupos = max;
154        if(*menupos > max) *menupos = 0;
155
156        id = *menupos;
157
158        if(id > max) id = 0;
159        changepic(tmcmenu1, menu[id]);
160        id++;
161
162        if(id > max) id = 0;
163        changepic(tmcmenu2, menu[id]);
164        id++;
165
166        if(id > max) id = 0;
167        changepic(tmcmenu3, menu[id]);
168        changetext(tmcmenutxt, _(menutxt[id]));
169        changename(tmcmenutxt, menutxt[id]);
170        id++;
171
172        if(id > max) id = 0;
173        changepic(tmcmenu4, menu[id]);
174        id++;
175
176        if(id > max) id = 0;
177        changepic(tmcmenu5, menu[id]);
178
179        if(active == 1)
180        {
181                changetext(tmcmenu1, NULL);
182                changetext(tmcmenu2, NULL);
183                changetext(tmcmenu3, NULL);
184                changetext(tmcmenu4, NULL);
185                changetext(tmcmenu5, NULL);
186        }
187        else
188        {
189                changetext(tmcmenu1, "X");
190                changetext(tmcmenu2, "X");
191                changetext(tmcmenu3, "X");
192                changetext(tmcmenu4, "X");
193                changetext(tmcmenu5, "X");
194        }
195
196        drawscreen(tmcmenutxt, 1);
197        drawscreen(tmcmenu1, 1);
198        drawscreen(tmcmenu2, 1);
199        drawscreen(tmcmenu3, 1);
200        drawscreen(tmcmenu4, 1);
201        drawscreen(tmcmenu5, 0);
202}
203
204void screentmcmenu()
205{
206        int rcret = 0, menuid = 0, active = 1;
207        struct skin* tmcbg = getscreen("tmcbg");
208        struct skin* tmcmenutxt = getscreen("tmcmenutxt");
209        struct skin* tmcmenu1 = getscreen("tmcmenu1");
210        struct skin* tmcmenu2 = getscreen("tmcmenu2");
211        struct skin* tmcmenu3 = getscreen("tmcmenu3");
212        struct skin* tmcmenu4 = getscreen("tmcmenu4");
213        struct skin* tmcmenu5 = getscreen("tmcmenu5");
214        struct skin* tmcpic1 = getscreen("tmcpic1");
215        struct skin* tmcpic2 = getscreen("tmcpic2");
216        struct skin* tmcpic3 = getscreen("tmcpic3");
217        struct skin* tmcpic4 = getscreen("tmcpic4");
218        struct skin* tmcpic5 = getscreen("tmcpic5");
219
220        drawscreen(tmcbg, 1);
221        drawscreen(tmcpic1, 1);
222        drawscreen(tmcpic2, 1);
223        drawscreen(tmcpic3, 1);
224        drawscreen(tmcpic4, 1);
225        drawscreen(tmcpic5, 1);
226        tmcmenuscroll(menuid, active, tmcmenutxt, tmcmenu1, tmcmenu2, tmcmenu3, tmcmenu4, tmcmenu5, 0);
227
228        while(1)
229        {
230                rcret = waitrc(NULL, 0, 0);
231
232                if(rcret == getrcconfigint("rcmenu", NULL))
233                {
234                        if(active == 1)
235                                active = 0;
236                        else
237                                active = 1;
238
239                        tmcmenuscroll(menuid, active, tmcmenutxt, tmcmenu1, tmcmenu2, tmcmenu3, tmcmenu4, tmcmenu5, 0);
240                        continue;
241                }
242
243                if(rcret == getrcconfigint("rcexit", NULL))
244                {
245                        if(active == 1)
246                        {
247                                if(menuid == 0) break;
248                                else menuid = 0;
249
250                                tmcmenuscroll(menuid, active, tmcmenutxt, tmcmenu1, tmcmenu2, tmcmenu3, tmcmenu4, tmcmenu5, 0);
251                                continue;
252                        }
253                }
254
255                if(rcret == getrcconfigint("rcleft", NULL))
256                {
257                        if(active == 1)
258                                tmcmenuscroll(menuid, active, tmcmenutxt, tmcmenu1, tmcmenu2, tmcmenu3, tmcmenu4, tmcmenu5, 1);
259                        else
260                                tmcpicscroll(tmcpic1, tmcpic2, tmcpic3, tmcpic4, tmcpic5, 0);
261                        continue;
262                }
263
264                if(rcret == getrcconfigint("rcright", NULL))
265                {
266                        if(active == 1)
267                                tmcmenuscroll(menuid, active, tmcmenutxt, tmcmenu1, tmcmenu2, tmcmenu3, tmcmenu4, tmcmenu5, 2);
268                        else
269                                tmcpicscroll(tmcpic1, tmcpic2, tmcpic3, tmcpic4, tmcpic5, 0);
270                        continue;
271                }
272
273                if(rcret == getrcconfigint("rcok", NULL))
274                {
275                        if(active == 1)
276                        {
277                                if(ostrcmp("Settings", tmcmenutxt->name) == 0) menuid = 1;
278                                else if(ostrcmp("Picture", tmcmenutxt->name) == 0) menuid = 2;
279                                else if(ostrcmp("Video", tmcmenutxt->name) == 0) menuid = 3;
280                                else if(ostrcmp("Audio", tmcmenutxt->name) == 0) menuid = 4;
281       
282                                tmcmenuscroll(menuid, active, tmcmenutxt, tmcmenu1, tmcmenu2, tmcmenu3, tmcmenu4, tmcmenu5, 0);
283                                continue;
284                        }
285                }
286        }
287
288        clearscreen(tmcbg);
289}
290
291#endif
Note: See TracBrowser for help on using the repository browser.