Changeset 15743
- Timestamp:
- 05/17/12 11:19:15 (11 years ago)
- Location:
- titan/plugins/tmc
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/plugins/tmc/tmc.h
r15651 r15743 2 2 #define TMC_H 3 3 4 //flag 0: left 5 //flag 1: right 6 void tmcmenuscroll(int flag, struct skin* tmcmenu1, struct skin* tmcmenu2, struct skin* tmcmenu3, struct skin* tmcmenu4, struct skin* tmcmenu5) 4 int menu0pos = 0; 5 char* menu0[] = {"skin/tmcsettings.png", "skin/tmcpicture.png", "skin/tmcvideo.png", "skin/tmcaudio.png", "skin/tmcbtn.png"}; 6 char* menu0txt[] = {"Settings", "Picture", "Video", "Audio", ""}; 7 8 int menu1pos = 0; 9 char* menu1[] = {"skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png"}; 10 char* menu1txt[] = {"S1", "S2", "S3", "S4", "S5"}; 11 12 int menu2pos = 0; 13 char* menu2[] = {"skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png"}; 14 char* menu2txt[] = {"P1", "P2", "P3", "P4", "P5"}; 15 16 int menu3pos = 0; 17 char* menu3[] = {"skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png"}; 18 char* menu3txt[] = {"V1", "V2", "V3", "V4", "V5"}; 19 20 int menu4pos = 0; 21 char* menu4[] = {"skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png", "skin/tmcbtn.png"}; 22 char* menu4txt[] = {"A1", "A2", "A3", "A4", "A5"}; 23 24 //flag 0: draw only 25 //flag 1: left 26 //flag 2: right 27 void tmcpicscroll(struct skin* tmcpic1, struct skin* tmcpic2, struct skin* tmcpic3, struct skin* tmcpic4, struct skin* tmcpic5, int flag) 7 28 { 8 char* tmpstr = NULL; 9 10 if(flag == 0) 11 { 12 tmpstr = ostrcat(tmcmenu1->pic, NULL, 0, 0); 13 changepic(tmcmenu1, tmcmenu2->pic); 14 changepic(tmcmenu2, tmcmenu3->pic); 15 changepic(tmcmenu3, tmcmenu4->pic); 16 changepic(tmcmenu4, tmcmenu5->pic); 17 changepic(tmcmenu5, tmpstr); 18 free(tmpstr); tmpstr = NULL; 19 drawscreen(tmcmenu1, 1); 20 drawscreen(tmcmenu2, 1); 21 drawscreen(tmcmenu3, 1); 22 drawscreen(tmcmenu4, 1); 23 drawscreen(tmcmenu5, 0); 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 108 void 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); 24 186 } 25 187 else 26 188 { 27 tmpstr = ostrcat(tmcmenu5->pic, NULL, 0, 0);28 change pic(tmcmenu5, tmcmenu4->pic);29 change pic(tmcmenu4, tmcmenu3->pic);30 change pic(tmcmenu3, tmcmenu2->pic);31 change pic(tmcmenu2, tmcmenu1->pic);32 changepic(tmcmenu1, tmpstr);33 free(tmpstr); tmpstr = NULL; 34 drawscreen(tmcmenu1, 1);35 drawscreen(tmcmenu2, 1);36 drawscreen(tmcmenu3, 1);37 drawscreen(tmcmenu4, 1);38 drawscreen(tmcmenu5, 0);39 }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); 40 202 } 41 203 42 204 void screentmcmenu() 43 205 { 44 int rcret = 0 ;206 int rcret = 0, menuid = 0, active = 1; 45 207 struct skin* tmcbg = getscreen("tmcbg"); 208 struct skin* tmcmenutxt = getscreen("tmcmenutxt"); 46 209 struct skin* tmcmenu1 = getscreen("tmcmenu1"); 47 210 struct skin* tmcmenu2 = getscreen("tmcmenu2"); … … 49 212 struct skin* tmcmenu4 = getscreen("tmcmenu4"); 50 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"); 51 219 52 220 drawscreen(tmcbg, 1); 53 drawscreen(tmcmenu1, 1); 54 drawscreen(tmcmenu2, 1); 55 drawscreen(tmcmenu3, 1); 56 drawscreen(tmcmenu4, 1); 57 drawscreen(tmcmenu5, 0); 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); 58 227 59 228 while(1) … … 61 230 rcret = waitrc(NULL, 0, 0); 62 231 63 if(rcret == getrcconfigint("rcexit", NULL)) break; 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 } 64 254 65 255 if(rcret == getrcconfigint("rcleft", NULL)) 66 tmcmenuscroll(0, tmcmenu1, tmcmenu2, tmcmenu3, tmcmenu4, tmcmenu5); 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 67 264 if(rcret == getrcconfigint("rcright", NULL)) 68 tmcmenuscroll(1, tmcmenu1, tmcmenu2, tmcmenu3, tmcmenu4, tmcmenu5); 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 } 69 286 } 70 287
Note: See TracChangeset
for help on using the changeset viewer.