mcvcore.m 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. /*---------------------------------------------------
  2. -----------------------------------------------------
  3. Filename: mcvcore.m
  4. Version: 4.5
  5. Type: maki
  6. Date: 13. Aug. 2007 - 11:22
  7. Author: Martin Poehlmann aka Deimos
  8. E-Mail: [email protected]
  9. Internet: www.skinconsortium.com
  10. www.martin.deimos.de.vu
  11. Note: This script is based on drawer.m
  12. from Winamp Modern, but extended to
  13. 5 components presets!
  14. Like in drawer.m I warn everybody not
  15. to modify this script, cause it can be
  16. harmed very fast! And you don't want
  17. a buggy winamp skin, want you?
  18. Since script version 3.1
  19. (onesie build #022)
  20. the script is devided into subscripts
  21. for better debugging.
  22. -----------------------------------------------------
  23. ---------------------------------------------------*/
  24. #include <lib/std.mi>
  25. #include attribs/init_windowpage.m
  26. #include attribs/init_vis.m
  27. #include attribs/init_appearance.m
  28. //define DEBUG
  29. #define FILE_NAME "infocompcore.m"
  30. #include <lib/com/debug.m>
  31. #define VIS_GUID "{0000000A-000C-0010-FF7B-01014263450C}"
  32. #ifndef DOHIDEMCV
  33. #define updateSaving //
  34. #endif
  35. //define FIT_W2_COMP fit(sui_fi, 159, 0, 2, 0, -162, 1, 76, 0)
  36. #define FIT_W2_COMP fit(sui_fi, 234, 0, 2, 0, -236, 1, 117, 0)
  37. //define FIT_W_COMP fit(sui_fi, 81, 0, 2, 0, -84, 1, 76, 0)
  38. #define FIT_W_COMP fit(sui_fi, 119, 0, 2, 0, -121, 1, 117, 0)
  39. #define FIT_WO_COMP fit(sui_fi, 4, 0, 2, 0, -6, 1, 117, 0)
  40. Global Boolean bypasscancel;
  41. Global Timer callbackTimer, tempDisable;
  42. #define CURR_COMP plsc
  43. #include mcvcore/defs.m
  44. #ifdef IC_COVERFLOW
  45. #undef CURR_COMP
  46. #define CURR_COMP cflow
  47. #include mcvcore/defs.m
  48. #endif
  49. Function fit (group g, int x, int rx, int y, int ry, int w, int rw, int h, int rh);
  50. Function switchToIcOnly();
  51. Function switchToCover();
  52. Function switchToVisCover();
  53. Function switchToVis();
  54. Function switchToEQ();
  55. Function switchToCfg();
  56. Function switchToVis_Full();
  57. Function updateFileInfo();
  58. Function hideFi();
  59. Function showFi();
  60. Function hideCover();
  61. Function showCover();
  62. Function hideVis();
  63. Function showVis();
  64. Function hideVis_Full();
  65. Function showVis_Full();
  66. Function hideEq();
  67. Function showEq();
  68. Function hideCfg();
  69. Function showCfg();
  70. Function openIC();
  71. Function closeIC();
  72. Function openLC();
  73. Function closeLC();
  74. #ifdef DOHIDEMCV
  75. Function hideMCV();
  76. #endif
  77. Function onHideFi();
  78. Function onShowFi();
  79. Function onHideCover();
  80. Function onShowCover();
  81. Function onHideVis();
  82. Function onShowVis();
  83. Function onHideVis_Full();
  84. Function onShowVis_Full();
  85. Function onHideEq();
  86. Function onShowEq();
  87. Function onHideCfg();
  88. Function onShowCfg();
  89. Function onCloseIC();
  90. Function onOpenIC();
  91. Function onhideMCV();
  92. Function dc_hideFi();
  93. Function dc_showFi();
  94. Function dc_showEq();
  95. Function dc_hideEq();
  96. Function dc_showCfg();
  97. Function dc_hideCfg();
  98. Function dc_hideCover();
  99. Function dc_showCover();
  100. Function dc_hideVis();
  101. Function dc_showVis();
  102. Function dc_hideVis_Full();
  103. Function dc_showVis_Full();
  104. Function updateFooter();
  105. Function ProcessMenuResult (int a);
  106. #ifdef DOHIDEMCV
  107. function updateSaving (int l);
  108. #endif
  109. Global Group sg, sui_cover, sui_vis_full, sui_vis, sui_fi, sui_eq, sui_cfg, g_footer, g_visbtns;
  110. Global WindowHolder sui_vis_wdh, sui_vis_full_wdh;
  111. Global Layout main;
  112. Global Boolean callback_showing_vis, callback_hiding_vis, callback_showing_vis_full, callback_hiding_vis_full, callback_showing_cover, callback_hiding_cover, callback_showing_fi, callback_hiding_fi, callback_hiding_eq, callback_showing_eq, callback_hiding_cfg, callback_showing_cfg;
  113. Global Boolean showing_vis, hiding_vis, showing_vis_full, hiding_vis_full, showing_cover, hiding_cover, hiding_fi, showing_fi, showing_eq, hiding_eq, showing_cfg, hiding_cfg;
  114. Global Boolean Mychange;
  115. Global Boolean prevent_vis = 1;
  116. Global Frame dualwnd, mainframe;
  117. Global GuiObject footerGrid, sendToBtn;
  118. Global Popupmenu compMenu;
  119. // Global Button compChoose, nowPlayingBtn, webSearchBtn;
  120. Global Button compChoose;
  121. Global Boolean startup_done;
  122. Global Int substract = 0;
  123. #ifdef DOHIDEMCV
  124. Global Int last_menu_sel;
  125. #endif
  126. // script loading/unloading goes here
  127. #include mcvcore/load_handles.m
  128. // open / hiding components not caused by button clicks
  129. #include mcvcore/external_handles.m
  130. // showing and hiding the components
  131. #include mcvcore/show_hide.m
  132. /* Switching menu */
  133. compChoose.onRightButtonUp(int x, int y)
  134. {
  135. complete;
  136. }
  137. compChoose.onRightClick () {
  138. compChoose.onLeftClick ();
  139. }
  140. compChoose.onLeftClick ()
  141. {
  142. compMenu = new Popupmenu;
  143. popupmenu fiSub = new Popupmenu;
  144. compMenu.addCommand("File Info", 1, ic_fileinfo.getData() == "1", 0);
  145. #ifdef IC_COVERFLOW
  146. compMenu.addCommand("Cover Flow", 7, _cflow_ic_attrib.getData() == "1", 0);
  147. #endif
  148. // System.isSafeMode() is not recognized by mc.exe
  149. // if(!System.isSafeMode())
  150. // {
  151. compMenu.addCommand("Visualization", 2, ic_vis.getData() == "1", 0);
  152. // }
  153. compMenu.addCommand("Stored Playlists", 3, _plsc_ic_attrib.getData() == "1", 0);
  154. compMenu.addCommand("Equalizer", 4, ic_eq.getData() == "1", 0);
  155. compMenu.addCommand("Skin Settings", 5, ic_config.getData() == "1", 0);
  156. #ifdef DOHIDEMCV
  157. compMenu.addCommand("Hide Multi Content View", 6, ic_hidden.getData() == "1", 0);
  158. #endif
  159. compMenu.addSeparator();
  160. compMenu.addSubmenu(fiSub, "File Info Components");
  161. // System.isSafeMode() is not recognized by mc.exe
  162. // if(!System.isSafeMode())
  163. // {
  164. fiSub.addCommand("Visualization", 12, ic_vis_fileinfo.getData() == "1", 0);
  165. // }
  166. fiSub.addCommand("Album Art", 11, ic_cover_fileinfo.getData() == "1", 0);
  167. fiSub.addSeparator();
  168. fiSub.addCommand("Show Track #", 24, infocomp_show_track.getData() == "1", 0);
  169. fiSub.addCommand("Show Year", 21, infocomp_show_year.getData() == "1", 0);
  170. fiSub.addCommand("Show Genre", 22, infocomp_show_genre.getData() == "1", 0);
  171. fiSub.addCommand("Show Disc", 28, infocomp_show_disc.getData() == "1", 0);
  172. fiSub.addCommand("Show Album Artist", 25, infocomp_show_albumartist.getData() == "1", 0);
  173. fiSub.addCommand("Show Composer", 26, infocomp_show_composer.getData() == "1", 0);
  174. fiSub.addCommand("Show Publisher", 23, infocomp_show_publisher.getData() == "1", 0);
  175. fiSub.addCommand("Show Decoder", 27, infocomp_show_format.getData() == "1", 0);
  176. fiSub.addCommand("Show Song Rating", 20, infocomp_show_rating.getData() == "1", 0);
  177. fiSub.addSeparator();
  178. fiSub.addCommand("Cycle File Info", 30, infocomp_cycle.getData() == "1", 0);
  179. fiSub.addSeparator();
  180. //fiSub.addCommand("Open Links in Now Playing", 40, infocomp_nowplaying.getData() == "1", 0);
  181. //fiSub.addCommand("Open Links in Browser", 41, infocomp_browser.getData() == "1", 0);
  182. ProcessMenuResult (compMenu.popAtXY(clientToScreenX(compChoose.getLeft()), clientToScreenY(compChoose.getTop() + compChoose.getHeight())));
  183. delete compMenu;
  184. delete fiSub;
  185. complete;
  186. }
  187. ProcessMenuResult (int a)
  188. {
  189. if (a < 1) return;
  190. if (a == 1)
  191. {
  192. ic_fileinfo.setData("1");
  193. }
  194. else if (a == 2)
  195. {
  196. ic_vis.setData("1");
  197. }
  198. else if (a == 3)
  199. {
  200. _plsc_ic_attrib.setData("1");
  201. }
  202. #ifdef IC_COVERFLOW
  203. else if (a == 7)
  204. {
  205. _cflow_ic_attrib.setData("1");
  206. }
  207. #endif
  208. else if (a == 4)
  209. {
  210. ic_eq.setData("1");
  211. }
  212. else if (a == 5)
  213. {
  214. ic_config.setData("1");
  215. }
  216. #ifdef DOHIDEMCV
  217. else if (a == 6)
  218. {
  219. ic_hidden.setData("1");
  220. }
  221. #endif
  222. else if (a == 11)
  223. {
  224. toggleAttrib(ic_cover_fileinfo);
  225. }
  226. else if (a == 12)
  227. {
  228. toggleAttrib(ic_vis_fileinfo);
  229. }
  230. else if (a == 20)
  231. {
  232. toggleAttrib(infocomp_show_rating);
  233. }
  234. else if (a == 21)
  235. {
  236. toggleAttrib(infocomp_show_year);
  237. }
  238. else if (a == 22)
  239. {
  240. toggleAttrib(infocomp_show_genre);
  241. }
  242. else if (a == 23)
  243. {
  244. toggleAttrib(infocomp_show_publisher);
  245. }
  246. else if (a == 24)
  247. {
  248. toggleAttrib(infocomp_show_track);
  249. }
  250. else if (a == 25)
  251. {
  252. toggleAttrib(infocomp_show_albumartist);
  253. }
  254. else if (a == 26)
  255. {
  256. toggleAttrib(infocomp_show_composer);
  257. }
  258. else if (a == 27)
  259. {
  260. toggleAttrib(infocomp_show_format);
  261. }
  262. else if (a == 28)
  263. {
  264. toggleAttrib(infocomp_show_disc);
  265. }
  266. else if (a == 30)
  267. {
  268. toggleAttrib(infocomp_cycle);
  269. }
  270. /* else if (a == 40)
  271. {
  272. toggleAttrib(infocomp_nowplaying);
  273. }
  274. else if (a == 41)
  275. {
  276. toggleAttrib(infocomp_browser);
  277. }
  278. */
  279. }
  280. // Hiding footer buttons (for file info view)
  281. /* artist_info_buttons_attrib.onDataChanged ()
  282. {
  283. updateFooter ();
  284. }
  285. */
  286. g_footer.onResize (int x, int y, int w, int h)
  287. {
  288. if (substract == 1)
  289. w += stringToInteger(dualwnd.getXmlParam("maxwidth")) + 78;
  290. else if (substract == 2)
  291. w += stringToInteger(dualwnd.getXmlParam("maxwidth")) + 102;
  292. /* if (artist_info_buttons_attrib.getData() == "1")
  293. {
  294. if (w < 132) footerGrid.hide();
  295. else footerGrid.show();
  296. if (w < 125) nowPlayingBtn.hide();
  297. else nowPlayingBtn.show();
  298. if (w < 94) webSearchBtn.hide();
  299. else webSearchBtn.show();
  300. }
  301. else
  302. {
  303. if (w < 70) footerGrid.hide();
  304. else footerGrid.show();
  305. nowPlayingBtn.hide();
  306. webSearchBtn.hide();
  307. }
  308. */
  309. if (w < 63) sendToBtn.hide();
  310. else sendToBtn.show();
  311. if (w < 32) compChoose.hide();
  312. else compChoose.show();
  313. }
  314. updateFooter ()
  315. {
  316. g_footer.onResize (0, 0, g_footer.getWidth(), 0);
  317. }
  318. #ifdef DOHIDEMCV
  319. // Switching back from no comp
  320. sg.onResize (int x, int y, int w, int h)
  321. {
  322. if (ic_hidden.getData() == "0" || last_menu_sel == 0 || w == 0)// && dualwnd.getXmlParam("from") == "left")
  323. {
  324. return;
  325. }
  326. ProcessMenuResult (getPrivateInt(getSkinName(), "MCV last sel", 1));
  327. }
  328. // save last pos
  329. updateSaving (int l)
  330. {
  331. if (last_menu_sel == l)
  332. {
  333. return;
  334. }
  335. if (last_menu_sel != 0) setPrivateInt(getSkinName(), "MCV last sel", last_menu_sel);
  336. last_menu_sel = l;
  337. }
  338. #endif
  339. /** OSD */
  340. /*
  341. Global boolean mouse_is_over = FALSE;
  342. osd_trigger.onEnterArea ()
  343. {
  344. //setXmlParam("ghost", "1");
  345. }
  346. osd_trigger.onMouseMove (int x, int y)
  347. {
  348. if (!isMouseOverRect() && mouse_is_over)
  349. {
  350. mouse_is_over = 0;
  351. component c = sui_vis_full.findObject("vis");
  352. c.sendAction("setregion", "vis.normal.region", 0, 0, 0, 0);
  353. c = sui_vis.findObject("vis");
  354. c.sendAction("setregion", "vis.normal.region", 0, 0, 0, 0);
  355. }
  356. else if (isMouseOverRect() && !mouse_is_over)
  357. {
  358. mouse_is_over = 1;
  359. component c = sui_vis_full.findObject("vis");
  360. c.sendAction("setregion", "vis.button.region", 0, 0, 0, 0);
  361. c = sui_vis.findObject("vis");
  362. c.sendAction("setregion", "vis.button.region", 0, 0, 0, 0);
  363. }
  364. }
  365. osd_trigger.onLeaveArea ()
  366. {
  367. component c = sui_vis_full.findObject("vis");
  368. c.sendAction("setregion", "vis.normal.region", 0, 0, 0, 0);
  369. }*/
  370. /** Calls after comp is shown */
  371. onCloseIC() {}
  372. onOpenIC() {}
  373. onShowCover() {}
  374. onHideCover() {}
  375. onShowFi() {}
  376. onHideFi() {}
  377. onShowEq() {}
  378. onHideEq() {}
  379. onShowCfg() {}
  380. onHideCfg() {}
  381. onShowVis()
  382. {
  383. g_visbtns.show();
  384. }
  385. onHideVis()
  386. {
  387. g_visbtns.hide();
  388. }
  389. onShowVis_Full() {}
  390. onHideVis_Full() {}
  391. #ifdef DOHIDEMCV
  392. onhideMCV() {}
  393. #endif
  394. fit (group g, int x, int rx, int y, int ry, int w, int rw, int h, int rh)
  395. {
  396. if (!g) return;
  397. g.setXmlParam("x", integerToString(x));
  398. g.setXmlParam("y", integerToString(y));
  399. g.setXmlParam("w", integerToString(w));
  400. g.setXmlParam("h", integerToString(h));
  401. g.setXmlParam("relatx", integerToString(rx));
  402. g.setXmlParam("relaty", integerToString(ry));
  403. g.setXmlParam("relatw", integerToString(rw));
  404. g.setXmlParam("relath", integerToString(rh));
  405. }