home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 September (Special) / Chip-Special_2002-09_Digitalni-Video.bin / servis / wm9 / mpsetupXP.exe / RCDATA / CABINET / wmploc.DLL / 256 / MAINAPPSKIN.JS < prev    next >
Text File  |  2002-08-19  |  17KB  |  467 lines

  1. var g_kTaskBarWidth = 84;
  2.  
  3. var g_kTaskBtnNowPlayingCaption_offsetTop               = 5;   // left="20"
  4. var g_kTaskBtnMediaGuideCaption_offsetTop               = 45;  // left="30"
  5. var g_kTaskBtnCDAudioCaption_offsetTop                  = 85;  // left="11"
  6. var g_kTaskBtnMediaLibraryCaption_offsetTop             = 125; // left="23"
  7. var g_kTaskBtnRadioTunerCaption_offsetTop               = 165; // left="29"
  8. var g_kTaskBtnPortableDeviceCaption_offsetTop           = 205; // left="14"
  9. var g_kTaskBtnSubscriptionsCaption_offsetTop            = 245; // left="14"
  10. var g_kTaskBtnSkinChooserCaption_offsetTop              = 285; // left="15"
  11.  
  12. var g_previousContrastMode="";
  13. var g_tracktimeTextWidth=0;
  14.  
  15. var g_fGoingDown = true;
  16. var g_kAnimationSpeed = 25;
  17. var g_kBigButtonCover = 436;
  18. var g_kSmallButtonCover = g_kBigButtonCover - g_kTaskBarWidth;
  19. var g_ButtonCover = app.taskbarVisible ? g_kBigButtonCover : g_kSmallButtonCover;
  20.  
  21. function AnimateShift()
  22. {
  23.     var finalSat = mediacenter.backSaturation;
  24.     var currentSat = parseFloat(satDummy.value);
  25.     if (g_fGoingDown)
  26.     {
  27.         currentSat -= finalSat / g_kAnimationSpeed; 
  28.         if (currentSat <= 0)
  29.         {   
  30.             g_fGoingDown = false;
  31.             currentSat = 0;
  32.         }
  33.     }
  34.     else
  35.     {
  36.         currentSat += finalSat / g_kAnimationSpeed; 
  37.         if (currentSat >= finalSat)
  38.         {   
  39.             currentSat = finalSat;
  40.             satDummy.value = currentSat;
  41.             return false;
  42.         }    
  43.     }
  44.  
  45.     satDummy.value = currentSat;
  46.     return true;
  47. }
  48.  
  49. function CycleColors()
  50. {
  51.     var hueshift = mediacenter.backHueShift;
  52.     hueshift = (hueshift+30) % 360;
  53.     mediacenter.backHueShift = hueshift;
  54. }
  55.  
  56. function InitNewControls()
  57. {
  58.     var cm = mediacenter.contrastMode;
  59.                
  60.     if ( (cm=="WB") || (cm=="BW") )
  61.     {
  62.         var IDB_APPAUTOHIDEBTN_BW               =1902;
  63.         var IDB_APPEQBTN_BW                     =1904;
  64.         var IDB_APPPLAYLISTBTN_BW               =1906;
  65.         var IDB_APPSHUFFLEBTN_BW                =1908;
  66.         var IDB_BTNGROUP_BW                     =1910;
  67.         var IDB_FASTFORWARD_BTN_BW              =1912;
  68.         var IDB_REWIND_BTN_BW                   =1914;
  69.         var IDB_MINCLOSE_BTNGRP_BW              =1916;
  70.         var IDB_MUTE_BTN_BW                     =1918;
  71.         var IDB_PLAY_BTN_BW                     =1920;
  72.         var IDB_PLAY_PAUSE_BTN_BW               =1922;
  73.         var IDB_RESIZE_BW                       =1924;
  74.         var IDB_SEEK_SLDR_BKG_BW                =1926;
  75.         var IDB_SOUND_BTN_BW                    =1928;
  76.         var IDB_STOP_BTN_BW                     =1930;
  77.         var IDB_TASKBAR_HANDLE_CLOSE_BW         =1932;
  78.         var IDB_TASKBAR_HANDLE_OPEN_BW          =1934;
  79.         var IDB_TASKBTNSCROLLDOWN_BW            =1936;
  80.         var IDB_VOL_SLDR_FORE_BW                =1942;
  81.         var IDB_TASKBAR_BUTTONGROUP_HOVER_BW    =1944;
  82.         var IDB_TASKBAR_BUTTONGROUP_DOWN_BW     =1946;
  83.         var IDB_TASKBAR_BUTTONGROUP_UP_BW       =1948;
  84.         var IDB_SEEK_THUMB_BW                   =1683;
  85.         var IDB_OLDSTRBMP_VOL_THUMB_BW          =1978;
  86.         var IDB_RESTOREDOWN_BW                  =2054;
  87.         var IDB_OLDSTRBMP_PLAY_PAUSE_BTN_BW     =1922;
  88.  
  89.         // The resource IDs for the high contrast images are set up so that if the black on white
  90.         // version has an ID of N, the white on black has an ID of N+1
  91.         //
  92.         // "BW" means Black-on-White, which means we want to use the base resource ID (offset=0)
  93.         // "WB" means White-on-Black, which means we want to increment the BW resource ID by one (offset=1)
  94.         var offset = (cm=="BW") ? 0 : 1;
  95.         var inverseOffset = (offset==0) ? 1 : 0;
  96.         
  97.         if (""==g_previousContrastMode)
  98.         {
  99.             CacheImage("TaskBarButtons.image");
  100.             CacheImage("TaskBarButtons.downImage");
  101.             CacheImage("TaskBarButtons.hoverImage");
  102.             CacheImage("taskbar_handle.hoverDownImage");
  103.         }
  104.         
  105.         SetAllButtonImages("autohide",                  "res://wmploc/#" + (IDB_APPAUTOHIDEBTN_BW+offset));
  106.         SetAllButtonImages("shufflegroup",              "res://wmploc/#" + (IDB_APPSHUFFLEBTN_BW+inverseOffset));
  107.         shufflegroup.image=                             "res://wmploc/#" + (IDB_APPSHUFFLEBTN_BW+offset);
  108.         SetAllButtonImages("TransportButtongroup",      "res://wmploc/#" + (IDB_BTNGROUP_BW+inverseOffset));
  109.         TransportButtongroup.image=                     "res://wmploc/#" + (IDB_BTNGROUP_BW+offset);
  110.         TransportButtongroup.disabledImage=             "res://wmploc/#" + (IDB_BTNGROUP_BW+offset);
  111.         
  112.         SetAllButtonImages("PauseButtonGroup",          "res://wmploc/#" + (IDB_OLDSTRBMP_PLAY_PAUSE_BTN_BW+inverseOffset));
  113.         PauseButtonGroup.image=                         "res://wmploc/#" + (IDB_OLDSTRBMP_PLAY_PAUSE_BTN_BW+offset);
  114.         SetAllButtonImages("ffwdGroup",                 "res://wmploc/#" + (IDB_FASTFORWARD_BTN_BW+offset));
  115.         SetAllButtonImages("rewGroup",                  "res://wmploc/#" + (IDB_REWIND_BTN_BW+offset));
  116.         SetAllButtonImages("btngrpMinClose",            "res://wmploc/#" + (IDB_MINCLOSE_BTNGRP_BW+offset));
  117.         SetAllButtonImages("btngrpRestore",             "res://wmploc/#" + (IDB_RESTOREDOWN_BW+offset));
  118.         SetAllButtonImages("btnResizeHide",             "res://wmploc/#" + (IDB_RESIZE_BW+offset));
  119.         SetAllButtonImages("btnResizeShow",             "res://wmploc/#" + (IDB_RESIZE_BW+offset));
  120.         btnResizeShow.transparencyColor="#FF00ff";
  121.  
  122.         if(""==g_previousContrastMode)
  123.         {
  124.             CacheImage("seek.foregroundImage");
  125.             CacheImage("seek.backgroundImage");
  126.             CacheImage("seek.thumbImage");
  127.             CacheImage("seek.thumbHoverImage");
  128.             CacheImage("seek.thumbDownImage");
  129.             CacheImage("volume.foregroundImage");
  130.             CacheImage("volume.thumbImage");
  131.             CacheImage("volume.thumbHoverImage");
  132.             CacheImage("volume.thumbDownImage");
  133.         }
  134.         seek.foregroundImage    = "res://wmploc/#" + (IDB_SEEK_SLDR_BKG_BW+offset);
  135.         seek.backgroundImage    = "res://wmploc/#" + (IDB_SEEK_SLDR_BKG_BW+offset);
  136.         seek.thumbImage         = "res://wmploc/#" + (IDB_SEEK_THUMB_BW+offset);
  137.         seek.thumbHoverImage    = "res://wmploc/#" + (IDB_SEEK_THUMB_BW+offset);
  138.         seek.thumbDownImage     = "res://wmploc/#" + (IDB_SEEK_THUMB_BW+offset);
  139.         volume.foregroundImage  = "res://wmploc/#" + (IDB_VOL_SLDR_FORE_BW+offset);
  140.         volume.thumbImage       = "res://wmploc/#" + (IDB_OLDSTRBMP_VOL_THUMB_BW+offset);
  141.         volume.thumbHoverImage  = "res://wmploc/#" + (IDB_OLDSTRBMP_VOL_THUMB_BW+offset);
  142.         volume.thumbDownImage   = "res://wmploc/#" + (IDB_OLDSTRBMP_VOL_THUMB_BW+offset);
  143.         
  144.         SetAllButtonImages("taskbar_handle", "res://wmploc/#" + (IDB_TASKBAR_HANDLE_OPEN_BW+offset));
  145.         taskbar_handle.downImage =           "res://wmploc/#" + (IDB_TASKBAR_HANDLE_CLOSE_BW+offset);
  146.         taskbar_handle.hoverDownImage =      "res://wmploc/#" + (IDB_TASKBAR_HANDLE_CLOSE_BW+offset);
  147.         SetAllButtonImages("MoreButton",     "res://wmploc/#" + (IDB_TASKBTNSCROLLDOWN_BW+offset));
  148.  
  149.         
  150.         
  151.         TaskBarButtons.image                =   "res://wmploc/#" + (IDB_TASKBAR_BUTTONGROUP_UP_BW+offset);
  152.         TaskBarButtons.downImage            =   "res://wmploc/#" + (IDB_TASKBAR_BUTTONGROUP_DOWN_BW+offset);
  153.         TaskBarButtons.hoverImage           =   "res://wmploc/#" + (IDB_TASKBAR_BUTTONGROUP_HOVER_BW+offset);
  154.         SetAllButtonImages("RandomButtonsInTheCorner", "res://wmploc/#" + (2046+offset));
  155.     }
  156.  
  157.     else
  158.     {
  159.         if (g_previousContrastMode!="")
  160.         {
  161.             UnCacheAllImages();
  162.         }
  163.         btnResizeShow.transparencyColor="";
  164.     }
  165.     
  166.     
  167.     // Not sure about exposing this just yet leave it commented out until we get a ruling
  168.     // If enabled, verify app start up perf regressions before checking in the enabled code
  169.     
  170.     // If XP or better and DVD is available update the TaskButton
  171.     //
  172. /*    if(false &&  player.dvd.isAvailable("dvddecoder"))
  173.     {
  174.         taskBtnCDAudioCaption.value="res://wmploc/RT_STRING/#1279";
  175.         taskBtnCDAudio.accKeyboardShortcut="res://wmploc/RT_STRING/#2114";
  176.         taskBtnCDAudio.upToolTip="res://wmploc/RT_STRING/#1280";
  177.         taskBtnCDAudio.downToolTip="res://wmploc/RT_STRING/#1280";
  178.         taskBtnCDAudio.accName="res://wmploc/RT_STRING/#2162";
  179.     }
  180. */  
  181.     taskBtnNowPlayingCaption.foregroundColor = getDarkTextColor();
  182.     g_previousContrastMode=cm;
  183.     btnShuffle.down = player.settings.getMode( 'shuffle' );
  184.     g_bufferingProgress = player.network.bufferingProgress;
  185.     
  186.     if (app.titleBarVisible)
  187.     {
  188.         btngrpMinClose.alphablend       = 0;
  189.     }
  190.    
  191.     OnOpenStateChangeTransport(player.openState);
  192.     OnPlayStateChangeTransport(player.playState);
  193.     OnStatusChangeTransport(player.status);
  194.     player.settings.mute = (theme.loadPreference("mute")=="True");
  195. }
  196.  
  197. function LayoutMarquee()
  198. {
  199.     if (g_tracktimeTextWidth == tracktime.textwidth) return;
  200.     g_tracktimeTextWidth = tracktime.textwidth;
  201.     var marqueeSize = svMarquee.width - 2;
  202.  
  203.     var margin=parseInt(theme.loadString("res://wmploc/RT_STRING/#1272"));
  204.  
  205.     tracktime.horizontalAlignment='left'; 
  206.     tracktime.left = marqueeSize - tracktime.textwidth;
  207.     tracktime.horizontalAlignment='right';
  208.  
  209.     running_background_plugins.horizontalAlignment='left'; 
  210.     running_background_plugins.left = marqueeSize - tracktime.textwidth - margin - running_background_plugins.width;
  211.     running_background_plugins.horizontalAlignment='right'; 
  212.  
  213.     metadata.width = marqueeSize - tracktime.textwidth - margin - running_background_plugins.width - margin - metadata.left;
  214. }
  215.  
  216. function SetAllButtonImages(btn,imagename)
  217. {
  218.         try
  219.         {
  220.                 var actualButton = eval(btn);
  221.                 if (""==g_previousContrastMode)
  222.                 {
  223.                         CacheImage(btn + ".image");
  224.                         CacheImage(btn + ".downImage");
  225.                         CacheImage(btn + ".hoverImage");
  226.                         CacheImage(btn + ".disabledImage");
  227.                         CacheImage(btn + ".hoverDownImage");
  228.                 }
  229.                 actualButton.image=imagename;
  230.                 actualButton.downImage=imagename;
  231.                 actualButton.hoverImage=imagename;
  232.                 actualButton.disabledImage=imagename;
  233.                 actualButton.hoverDownImage=imagename;
  234.         }
  235.         catch(err){}
  236. }
  237. function SetAllSliderImages(sldr, bkg, thumb)
  238. {
  239.     var actualSlider = eval(sldr);
  240.     if (""==g_previousContrastMode)
  241.     {
  242.         CacheImage(sldr + ".backgroundImage");
  243.         CacheImage(sldr + ".foregroundImage");
  244.         CacheImage(sldr + ".thumbImage");
  245.         CacheImage(sldr + ".thumbHoverImage");
  246.         CacheImage(sldr + ".thumbDownImage");
  247.     }
  248.     actualSlider.backgroundImage = bkg;
  249.     actualSlider.foregroundImage = bkg;
  250.     actualSlider.thumbImage      = thumb;
  251.     actualSlider.thumbHoverImage = thumb;
  252.     actualSlider.thumbDownImage  = thumb;
  253. }
  254.  
  255. var g_ArrayOfAllImages = new Array();
  256.  
  257. function CacheImage(imageID)
  258. {
  259.     g_ArrayOfAllImages[imageID] = eval(imageID);
  260. }
  261.  
  262. function UnCacheAllImages()
  263. {
  264.     for (var img in g_ArrayOfAllImages)
  265.     {
  266.         eval(img + ' = g_ArrayOfAllImages[img]');
  267.     }
  268.     g_ArrayOfAllImages.length=0;
  269. }
  270.  
  271. function currentTaskChange()
  272. {
  273.     var btnDown = null;
  274.     switch(app.currentTask)
  275.     {
  276.         case 'NowPlaying':
  277.             btnDown = taskBtnNowPlaying;
  278.             break;
  279.         case 'MediaGuide':
  280.             ShowLoadingText();
  281.             btnDown = taskBtnMediaGuide;
  282.             break;
  283.         case 'CDAudio':
  284.             btnDown = taskBtnCDAudio;
  285.             break;
  286.         case 'MediaLibrary':
  287.             btnDown = taskBtnMediaLibrary;
  288.             break;
  289.         case 'RadioTuner':
  290.             ShowLoadingText();
  291.             btnDown = taskBtnRadioTuner;
  292.             break;
  293.         case 'PortableDevice':
  294.             btnDown = taskBtnPortableDevice;
  295.             break;
  296.         case 'Services':
  297.             btnDown = taskBtnSubscriptions;
  298.             break;
  299.         case 'SkinViewer':
  300.             btnDown = taskBtnSkinChooser;
  301.             break;
  302.     }
  303.     taskBtnNowPlaying.down      = false;
  304.     taskBtnMediaGuide.down      = false;
  305.     taskBtnCDAudio.down         = false;
  306.     taskBtnMediaLibrary.down    = false;
  307.     taskBtnRadioTuner.down      = false;
  308.     taskBtnPortableDevice.down  = false;
  309.     taskBtnSubscriptions.down   = false;
  310.     taskBtnSkinChooser.down     = false;
  311.  
  312.     if (btnDown)
  313.     {
  314.         btnDown.down = true;
  315.     }
  316. }
  317.  
  318. function ShowLoadingText()
  319. {
  320.     LoadingTxt.alphaBlend=0;
  321.     LoadingTxt.alphaBlendTo(0xff,4500);
  322. }
  323.  
  324. function SetTaskBarVisible(bVisible)
  325. {
  326.     var Sign        = bVisible ? -1 : 1;
  327.     var OldWidth    = view.width;
  328.  
  329.     svEntireApp.horizontalAlignment="right";
  330.     TaskBarVisibleMaster.visible = bVisible;
  331.     if(bVisible)
  332.     {
  333.         taskbar_handle.accName="res://wmploc.dll/RT_STRING/#2151";
  334.     }
  335.     else
  336.     {
  337.         taskbar_handle.accName="res://wmploc.dll/RT_STRING/#2152";
  338.     }
  339.  
  340.     g_ButtonCover = bVisible ? g_kBigButtonCover : g_kSmallButtonCover;
  341.  
  342.     app.adjustLeft( Sign * g_kTaskBarWidth );
  343.     var MoveDist = Sign * (OldWidth - view.width);
  344.     if (MoveDist < g_kTaskBarWidth)
  345.     {
  346.         svEntireApp.width += Sign * (g_kTaskBarWidth - MoveDist);
  347.     }
  348.  
  349.     svEntireApp.horizontalAlignment="stretch";
  350.     autohide2.tabStop=!bVisible;
  351.     autohide.tabStop=bVisible;
  352. }
  353.  
  354. function CheckShowCloseMinimizeButtons()
  355. {
  356.     return (!app.titleBarVisible);
  357. }
  358.  
  359. function UpdateTitleBarRelatedUI()
  360. {
  361.     var showMinCloseButtons = CheckShowCloseMinimizeButtons();
  362.     if (btnMinimize.enabled != showMinCloseButtons)
  363.     {
  364.         btnMinimize.enabled = showMinCloseButtons;
  365.         if (showMinCloseButtons) btngrpMinClose.visible = true;
  366.         btngrpMinClose.alphaBlendTo(showMinCloseButtons ? 0xff : 0, 330);
  367.     }
  368.     
  369.     if (app.titleBarVisible)
  370.     {
  371.         appautohidebtn.accName="res://wmploc.dll/RT_STRING/#2155";
  372.         
  373.     }
  374.     else
  375.     {
  376.         appautohidebtn.accName="res://wmploc.dll/RT_STRING/#2156";
  377.     }
  378. }
  379.  
  380. /*
  381. function InitNewBuyMe()
  382. {
  383.     var BuyBMP = mediacenter.getNamedString("BuyMusicButton");
  384.     var BuyURL = mediacenter.getNamedString("BuyMusicURL");
  385.  
  386.     if (BuyBMP != "" && BuyURL != "")
  387.     {
  388.         buyme.Image     = 'BuyMusicButton';
  389.         buyme.visible = true;
  390.     }
  391. }
  392. */
  393.  
  394. function ShowPlayMenu()
  395. {
  396.         mnuPlay.show("Play");
  397. }
  398.  
  399. function UpdateTextColors()
  400. {
  401.         metadata.foregroundColor=getHighlightTextColor();
  402.         taskBtnNowPlayingCaption.foregroundColor=getDarkTextColor();
  403. }
  404.  
  405.  
  406. function ShowTaskMenu(menu)
  407. {
  408.     menu.deleteAllItems();
  409.     menu.appendItem(0,"res://wmploc/RT_STRING/#2141");
  410.     menu.appendItem(1,"res://wmploc/RT_STRING/#2142");
  411.     menu.appendItem(2,"res://wmploc/RT_STRING/#2143");
  412.     menu.appendItem(3,"res://wmploc/RT_STRING/#2144");
  413.     menu.appendItem(4,"res://wmploc/RT_STRING/#2145");
  414.     menu.appendItem(5,"res://wmploc/RT_STRING/#2146");
  415.     menu.appendItem(6,"res://wmploc/RT_STRING/#2147");
  416.     menu.appendItem(7,"res://wmploc/RT_STRING/#2157");
  417.     var sel = menu.show();
  418.     switch (sel)
  419.     {
  420.         case 0:
  421.             app.currentTask = 'NowPlaying';
  422.             break;
  423.         case 1:
  424.             app.currentTask = 'MediaGuide';
  425.             break;
  426.         case 2:
  427.             app.currentTask = 'CDAudio';
  428.             break;
  429.         case 3:
  430.             app.currentTask = 'MediaLibrary';
  431.             break;
  432.         case 4:
  433.             app.currentTask = 'RadioTuner';
  434.             break;
  435.         case 5:
  436.             app.currentTask = 'PortableDevice';
  437.             break;
  438.         case 6:
  439.             app.currentTask = 'Services';
  440.             break;
  441.         case 7:
  442.             app.currentTask = 'SkinViewer';
  443.             break;
  444.         default:
  445.             break;
  446.     }
  447. }
  448.  
  449. function PlayButtonClick(event)
  450. {
  451.     if( (player.playState==psPaused) && (event.ctrlKey) && player.controls.isAvailable('step') )
  452.     {
  453.         if (event.shiftKey)
  454.         {
  455.             player.controls.step(-1);
  456.         }
  457.         else
  458.         {
  459.             player.controls.step(1);
  460.         }
  461.     }
  462.     else
  463.     {
  464.         g_SetPlayPauseFocus=true;
  465.         player.controls.play();
  466.     }
  467. }