home *** CD-ROM | disk | FTP | other *** search
/ Minami 79 / MINAMI79.iso / Extra / MPSetup.exe / 1033 / RCDATA / CABINET / wmploc.DLL / 256 / WMPDXM.JS < prev    next >
Text File  |  2002-12-14  |  6KB  |  195 lines

  1. var g_kTrackerHeight = 19;
  2. var g_kControlsHeight= 26;
  3. var g_kGotoBarHeight = 29;
  4. var g_kDisplayHeight = 74;
  5. var g_kStatusHeight  = 24;
  6. var g_kCaptioningHeight = 89;
  7.  
  8. var g_kTotalHeight = g_kTrackerHeight+g_kControlsHeight+g_kGotoBarHeight+g_kDisplayHeight+g_kStatusHeight+g_kCaptioningHeight;
  9.  
  10. var g_kMinVolumeWidth_NoPositionControls = 91;
  11. var g_kMinVolumeWidth_PositionControls = 222;
  12.  
  13. function DetermineAudioVisible()
  14. {
  15.     if (!ScriptObjects.wmpdxm.ShowAudioControls) return false;
  16.     if (ScriptObjects.wmpdxm.ShowPositionControls)
  17.     {
  18.         return (view.width >= g_kMinVolumeWidth_PositionControls);
  19.     }
  20.     else
  21.     {
  22.         return (view.width >= g_kMinVolumeWidth_NoPositionControls);
  23.     }
  24. }
  25.  
  26. function CalculateAudioLeft()
  27. {
  28.     if (PositionControls.visible)
  29.     {
  30.         return Math.max (PositionControls.left + PositionControls.width + 1, view.width-AudioControls.width);
  31.     }
  32.     else
  33.     {
  34.         return Math.max (TransportControls.width + 1, view.width-AudioControls.width);
  35.     }
  36. }
  37.  
  38. function UpdateUI()
  39. {
  40.     var dxm = ScriptObjects.wmpdxm;
  41.     var hideVideo           = ( dxm.TransparentAtStart && ((player.playState==psStopped)||(player.playState==psUndefined)));
  42.     vid.visible             = !hideVideo;
  43.     view.backgroundColor    = hideVideo ? "none" : "#000000";
  44.     Tracker.visible         = dxm.ShowControls && dxm.ShowTracker;
  45.     seek.enabled            = dxm.EnableTracker;
  46.     ControlsParent.visible  = dxm.ShowControls;
  47.     GotoBar.visible         = dxm.ShowGotoBar;
  48.     Display.visible         = dxm.ShowDisplay;
  49.     Status.visible          = dxm.ShowStatusBar;
  50.     PositionControls.visible= dxm.ShowPositionControls;
  51.     AudioControls.visible   = DetermineAudioVisible();
  52.     AudioControls.left      = CalculateAudioLeft();
  53.     Captioning.visible      = dxm.ShowCaptioning;
  54.     
  55.     var originalVideoHeight = view.height - AllControls.height;
  56.     AllControls.visible = false;
  57.     AllControls.height  = g_kTotalHeight;
  58.     var accumulatedHeight = 0;
  59.     
  60.     if (Captioning.visible) accumulatedHeight   += g_kCaptioningHeight;
  61.     
  62.     Tracker.top = accumulatedHeight;
  63.     if (Tracker.visible) accumulatedHeight      += g_kTrackerHeight;
  64.  
  65.     ControlsParent.top        = accumulatedHeight;
  66.     if (ControlsParent.visible) accumulatedHeight   += g_kControlsHeight;
  67.  
  68.     GotoBar.top        = accumulatedHeight;
  69.     if (GotoBar.visible) accumulatedHeight      += g_kGotoBarHeight;
  70.  
  71.     Display.top        = accumulatedHeight;
  72.     if (Display.visible) accumulatedHeight      += g_kDisplayHeight;
  73.  
  74.     Status.top         = accumulatedHeight;
  75.     if (Status.visible) accumulatedHeight       += g_kStatusHeight;
  76.     
  77.     AllControls.height=accumulatedHeight;
  78.     VideoSubview.height = Math.max( 0, (view.height-accumulatedHeight));
  79.     AllControls.top = (view.height-accumulatedHeight);
  80.     AllControls.visible=true;
  81.     
  82.     view.height = originalVideoHeight + AllControls.height;
  83. }
  84. function OnWMPDXMOpenStateChange(NewState)
  85. {
  86.     if (NewState==osMediaOpen)
  87.     {
  88.         UpdateDisplay();
  89.  
  90.         if (player.currentMedia.ImageSourceWidth > 0)
  91.         {
  92.             // Resize layout to match the video size
  93.             view.height = player.currentMedia.ImageSourceHeight + AllControls.height;
  94.             
  95.             // clip to the transport controls width
  96.             if ((0 == AllControls.width) || (player.currentMedia.ImageSourceWidth > view.width))
  97.             {
  98.                 view.width = player.currentMedia.ImageSourceWidth;
  99.             }
  100.         }
  101.         else
  102.         {
  103.             view.height = AllControls.height;
  104.             view.width = AllControls.width;
  105.         }
  106.     }
  107. }
  108.  
  109. function UpdateDisplay()
  110. {
  111.     show.value=player.currentPlaylist.name;
  112.     title.value=player.currentMedia.getItemInfo("Title");
  113.     author.value=player.currentMedia.getItemInfo("Author");
  114.     copyright.value=player.currentMedia.getItemInfo("Copyright");
  115. }
  116.  
  117. //BUGBUGBUG -- DEBUG DEBUG DEBUG REMOVE REMOVE REMOVE-------//|
  118. if (theme.loadPreference("debug")=="RockOn")                //|
  119. {                                                           //|
  120.     freak();                                                //|
  121.     var f=0;                                                //|
  122. }                                                           //|
  123. else                                                        //|
  124. {                                                           //|
  125.     theme.savePreference("debug","Not Rocking Onward");     //|
  126. }                                                           //|
  127. //DEBUG DEBUG DEBUG REMOVE REMOVE REMOVE BEFORE SHIPPING----//|
  128.  
  129.  
  130.  
  131. function PlayButtonClick(event)
  132. {
  133.     if( (player.playState==psPaused) && (event.ctrlKey) && player.controls.isAvailable('step') )
  134.     {
  135.         if (event.shiftKey)
  136.         {
  137.             player.controls.step(-1);
  138.         }
  139.         else
  140.         {
  141.             player.controls.step(1);
  142.         }
  143.     }
  144.     else
  145.     {
  146.         g_SetPlayPauseFocus=true;
  147.         player.controls.play();
  148.     }
  149. }
  150.  
  151. var g_lastVolume=0;
  152.  
  153. function Init()
  154. {
  155.     ScriptObjects.OnUpdateUI = UpdateUI;
  156.     UpdateUI();
  157.     OnOpenStateChangeTransport(player.openState);
  158.     OnPlayStateChangeTransport(player.playState);
  159.     OnStatusChangeTransport(player.status);
  160.     OnWMPDXMOpenStateChange(player.openState);
  161.     g_lastVolume = player.settings.volume;
  162. }
  163.  
  164. function GetOffsetPositionText()
  165. {
  166.     if (player.controls.currentPositionString=="") return "";
  167.     
  168.     var offset = ScriptObjects.StartTime;
  169.     var ps = ScriptObjects.getTimeString(offset + player.controls.currentPosition);
  170.     
  171.     var ds = "";
  172.     
  173.     if (player.openState==osMediaOpen)
  174.     {
  175.         var dur = player.currentMedia.duration + offset;
  176.         if (dur>0)
  177.         {
  178.            ds = ScriptObjects.getTimeString(dur); 
  179.         }
  180.     }
  181.  
  182.     var newvalue;
  183.     if (ds != "")
  184.     {
  185.         var args = new Array(ps,ds);
  186.         newvalue = g_kPositionFormatString.sprintf(g_kPositionFormatString,args);
  187.     }
  188.     else
  189.     {
  190.         newvalue = ps;
  191.     }
  192.     return newvalue;
  193. }
  194.  
  195.