mcvcore.m 11 KB

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