home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 September (Special) / Chip-Special_2002-09_Digitalni-Video.bin / servis / wm9 / mpsetupXP.exe / RCDATA / CABINET / wmpdxm.wmz / wmpdxm.js < prev    next >
Text File  |  2002-08-15  |  6KB  |  184 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_Values = new Array();
  11. var g_kUpdateSpeed = 333;
  12. var g_nUpdate = 0;
  13. var g_kMetadataMultiplier = Math.round(4000 / g_kUpdateSpeed);
  14.  
  15. function PropWrapper(prop,height)
  16. {
  17.     this.prop = prop;
  18.     this.height = height;
  19. }
  20.  
  21. g_Values["ShowPositionControls"]= new PropWrapper (wmpdxm.ShowPositionControls, 0);
  22. g_Values["ShowTracker"]         = new PropWrapper (wmpdxm.ShowTracker, g_kTrackerHeight);
  23. g_Values["EnableTracker"]       = new PropWrapper (wmpdxm.EnableTracker, 0);
  24. g_Values["ShowControls"]        = new PropWrapper (wmpdxm.ShowControls, g_kControlsHeight);
  25. g_Values["ShowGotoBar"]         = new PropWrapper (wmpdxm.ShowGotoBar, g_kGotoBarHeight);
  26. g_Values["ShowDisplay"]         = new PropWrapper (wmpdxm.ShowDisplay, g_kDisplayHeight);
  27. g_Values["ShowStatusBar"]       = new PropWrapper (wmpdxm.ShowStatusBar, g_kStatusHeight);
  28. g_Values["ShowAudioControls"]   = new PropWrapper (wmpdxm.ShowAudioControls, 0);
  29. g_Values["ShowCaptioning"]      = new PropWrapper (wmpdxm.ShowCaptioning, g_kCaptioningHeight);
  30.  
  31. function UpdateValues()
  32. {
  33.     var fChange = false;
  34.     var HeightDelta = 0;
  35.     for (var prop in g_Values)
  36.     {
  37.         var val = eval("wmpdxm."+prop);
  38.         if (g_Values[prop].prop != val)
  39.         {
  40.             fChange=true;
  41.             g_Values[prop].prop = val;
  42.             HeightDelta += val ? g_Values[prop].height : -g_Values[prop].height;
  43.         }
  44.     }
  45.     if (fChange)
  46.     {
  47.         view.height+=HeightDelta;
  48.         UpdateUI(wmpdxm);
  49.     }
  50. }
  51.  
  52. function Init()
  53. {
  54.     UpdateUI(wmpdxm);
  55.     OnOpenStateChangeTransport(player.openState);
  56.     OnPlayStateChangeTransport(player.playState);
  57.     OnStatusChangeTransport(player.status);
  58.     OnWMPDXMOpenStateChange(player.openState);
  59. }
  60.  
  61. var g_kMinVolumeWidth_NoPositionControls = 91;
  62. var g_kMinVolumeWidth_PositionControls = 222;
  63.  
  64. function DetermineAudioVisible()
  65. {
  66.     if (!wmpdxm.ShowAudioControls) return false;
  67.     if (wmpdxm.ShowPositionControls)
  68.     {
  69.         return (view.width >= g_kMinVolumeWidth_PositionControls);
  70.     }
  71.     else
  72.     {
  73.         return (view.width >= g_kMinVolumeWidth_NoPositionControls);
  74.     }
  75. }
  76.  
  77. function CalculateAudioLeft()
  78. {
  79.     if (PositionControls.visible)
  80.     {
  81.         return Math.max (PositionControls.left + PositionControls.width + 1, view.width-AudioControls.width);
  82.     }
  83.     else
  84.     {
  85.         return Math.max (TransportControls.width + 1, view.width-AudioControls.width);
  86.     }
  87. }
  88.  
  89. function UpdateUI()
  90. {
  91.     Tracker.visible         = wmpdxm.ShowControls && wmpdxm.ShowTracker;
  92.     seek.enabled            = wmpdxm.EnableTracker;
  93.     ControlsParent.visible  = wmpdxm.ShowControls;
  94.     GotoBar.visible         = wmpdxm.ShowGotoBar;
  95.     Display.visible         = wmpdxm.ShowDisplay;
  96.     Status.visible          = wmpdxm.ShowStatusBar;
  97.     PositionControls.visible= wmpdxm.ShowPositionControls;
  98.     AudioControls.visible   = DetermineAudioVisible();
  99.     AudioControls.left      = CalculateAudioLeft();
  100.     Captioning.visible      = wmpdxm.ShowCaptioning;
  101.     
  102.     AllControls.visible = false;
  103.     AllControls.height  = g_kTotalHeight;
  104.     var accumulatedHeight = 0;
  105.     
  106.     if (Captioning.visible) accumulatedHeight   += g_kCaptioningHeight;
  107.     
  108.     Tracker.top = accumulatedHeight;
  109.     if (Tracker.visible) accumulatedHeight      += g_kTrackerHeight;
  110.  
  111.     ControlsParent.top        = accumulatedHeight;
  112.     if (ControlsParent.visible) accumulatedHeight   += g_kControlsHeight;
  113.  
  114.     GotoBar.top        = accumulatedHeight;
  115.     if (GotoBar.visible) accumulatedHeight      += g_kGotoBarHeight;
  116.  
  117.     Display.top        = accumulatedHeight;
  118.     if (Display.visible) accumulatedHeight      += g_kDisplayHeight;
  119.  
  120.     Status.top         = accumulatedHeight;
  121.     if (Status.visible) accumulatedHeight       += g_kStatusHeight;
  122.     
  123.     AllControls.height=accumulatedHeight;
  124.     VideoSubview.height = Math.max( 0, (view.height-accumulatedHeight));
  125.     AllControls.top = (view.height-accumulatedHeight);
  126.     AllControls.visible=true;
  127. }
  128. function OnWMPDXMOpenStateChange(NewState)
  129. {
  130.     if (NewState==osMediaOpen)
  131.     {
  132.         UpdateDisplay();
  133.     }
  134. }
  135.  
  136. function UpdateDisplay()
  137. {
  138.     show.value=player.currentPlaylist.name;
  139.     title.value=player.currentMedia.getItemInfo("Title");
  140.     author.value=player.currentMedia.getItemInfo("Author");
  141.     copyright.value=player.currentMedia.getItemInfo("Copyright");
  142. }
  143.  
  144. //BUGBUGBUG -- DEBUG DEBUG DEBUG REMOVE REMOVE REMOVE !!!!!
  145. //BUGBUGBUG -- DEBUG DEBUG DEBUG REMOVE REMOVE REMOVE !!!!!
  146. //BUGBUGBUG -- DEBUG DEBUG DEBUG REMOVE REMOVE REMOVE !!!!!
  147. //BUGBUGBUG -- DEBUG DEBUG DEBUG REMOVE REMOVE REMOVE !!!!!
  148. //BUGBUGBUG -- DEBUG DEBUG DEBUG REMOVE REMOVE REMOVE !!!!!
  149.  
  150. if (theme.loadPreference("debug")=="RockOn")
  151. {
  152.     freak();
  153.     var f=0;
  154. }
  155. else
  156. {
  157.     theme.savePreference("debug","Not Rocking Onward");
  158. }
  159.  
  160. function PlayButtonClick(event)
  161. {
  162.     if( (player.playState==psPaused) && (event.ctrlKey) && player.controls.isAvailable('step') )
  163.     {
  164.         if (event.shiftKey)
  165.         {
  166.             player.controls.step(-1);
  167.         }
  168.         else
  169.         {
  170.             player.controls.step(1);
  171.         }
  172.     }
  173.     else
  174.     {
  175.         g_SetPlayPauseFocus=true;
  176.         player.controls.play();
  177.     }
  178. }
  179.  
  180. //BUGBUGBUG -- DEBUG DEBUG DEBUG REMOVE REMOVE REMOVE !!!!!
  181. //BUGBUGBUG -- DEBUG DEBUG DEBUG REMOVE REMOVE REMOVE !!!!!
  182. //BUGBUGBUG -- DEBUG DEBUG DEBUG REMOVE REMOVE REMOVE !!!!!
  183. //BUGBUGBUG -- DEBUG DEBUG DEBUG REMOVE REMOVE REMOVE !!!!!
  184.