Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3853 lines
116 KiB

  1. /*************************************************************************/
  2. /* File: dvdlayouyt.js */
  3. /* Description: Script for DVD Player. */
  4. /*************************************************************************/
  5. // we should have a way to find out the current locale and reading direction
  6. // set these variables accordingly
  7. var g_LocaleEnglish = true;
  8. var g_LTRReading = true;
  9. //
  10. // error messages for the end user. these strings should be localized.
  11. //
  12. var L_ERRORUnexpectedFatal_TEXT = "A fatal error has occurred. Application is terminating.";
  13. var L_ERRORCopyProtectFail_TEXT = "Unable to play this disc because of copyright protection.";
  14. var L_ERRORInvalidDVD10Disc_TEXT = "Unable to play this DVD disc. DVD-Video is authored incorrectly for specification 1.0. Please check if the disc is damaged.";
  15. var L_ERRORInvalidDiscRegion_TEXT= "The region number of this disc is different from the current system setting, but DVD Player is unable to launch the DVD regionalization control to change the system region number, please reinstall the dvd player in order to play this disc.";
  16. var L_ERRORLowParentalLevel_TEXT= "The rating of this title exceeds your permission level.\nChange your permission level to view this title.";
  17. // Close app when the following errors occur
  18. var L_ERRORMacrovisionFail_TEXT= "Analog copy protection violation: Windows cannot play this copy-protected disc because it cannot verify that the video outputs on your DVD and/or VGA cards support copy protection.\n\nPossible causes:\n\n(1) One of the drivers (DVD or VGA) does not fully support the adapter's capabilities, in which case installing an updated driver may help;\n\n(2) The hardware does not support copy protection. You may be able to get around the problem by unplugging any cables connected to the video outputs on your computer. Otherwise please contact your system manufacturer.";
  19. var L_ERRORIncompatibleSystemAndDecoderRegions_TEXT = "The region number of your decoder is different from the current system setting. You must change the current region setting of your DVD driver from the Device Manager in order to play DVD.";
  20. var L_ERRORIncompatibleDiscAndDecoderRegions_TEXT = "The disc cannot be played because the disc is not authored to be played in the decoder's region.";
  21. var L_ERROREject_TEXT = "There is an error ejecting the disc. Please wait until the player is terminated and then eject the disc manually.";
  22. var L_ERRORFailCreatingObject_TEXT = "Unable to create necessary components for DVD player. Application has to terminate. Please ensure that the DVD player software is properly installed.";
  23. var L_ERRORUnexpectedError_TEXT = "There is an unexpected error while operating DVD controls. Please try restarting the player if the problem persists.";
  24. var L_ERRORResize_TEXT = "The DVD player has encountered an error while resizing the window. If you observe a problem with the displayed picture, please shut down the player and restart.";
  25. var L_ERRORHelp_TEXT = "There is a error while launching Help.";
  26. var L_ERRORTime_TEXT = "There is an error displaying the progress. Try starting the DVD player again.";
  27. var L_ERRORToolTip_TEXT = "There is an error displaying the tool tip. Try starting the DVD player again.";
  28. var L_ERRORCapture_TEXT = "DVD player is unable to capture image because the decoder on your system does not support it.";
  29. // captions on buttons
  30. var L_ButtonTextMenu_TEXT = "Menu";
  31. var L_ButtonTextResume_TEXT = "Resume";
  32. var L_ButtonTextEnCC_TEXT = "CC";
  33. var L_ButtonTextDiCC_TEXT = "CC";
  34. var L_ButtonTextSubtitle_TEXT = "Subtitle";
  35. var L_ButtonTextAudio_TEXT = "Audio";
  36. var L_ButtonTextAngle_TEXT = "Angle";
  37. var L_ButtonTextOptions_TEXT = "Options";
  38. var L_ButtonFontSize_NUMBER = 8;
  39. var L_ButtonFontFace_TEXT = "Tahoma";
  40. var L_TextBoxFontSize_NUMBER = 11;
  41. var L_TextBoxFontFace_TEXT = "Tahoma";
  42. var L_TitleFontSize_NUMBER = 10;
  43. var L_TitleFontFace_TEXT = "Tahoma";
  44. var L_Error_TEXT = "Error";
  45. var L_DVDPlayer_TEXT = "DVD Player";
  46. var L_DVDPlayerTitleChapter_TEXT = "DVD Player Title: %1 Chapter: %2";
  47. var L_HHMMSS_TEXT = "%1:%2:%3";
  48. var L_CCDisabled_TEXT = "CC Disabled";
  49. var L_CCEnabled_TEXT = "CC Enabled";
  50. var L_NoSubtitles_TEXT = "No subtitles";
  51. var L_SubtitlesAreLanguageClickToDisable_TEXT = "Subtitles are %1, click to disable";
  52. var L_SubtitlesAreDisabledClickForLanguage_TEXT = "Subtitles are disabled, click for %1";
  53. var L_SubtitlesAreLanguageClickForLanguage_TEXT = "Subtitles are %1, click for %2";
  54. var L_NoAudioTracks_TEXT = "No audio tracks";
  55. var L_AudioLanguageIsXNoMoreAudioTracks_TEXT = "Audio language is %1, no more audio tracks";
  56. var L_AudioLanguageIsXClickForY_TEXT = "Audio language is %1, click for %2";
  57. var L_ViewingAngleIs1NoMoreViewingAngles_TEXT = "Viewing angle is #1, no more viewing angles";
  58. var L_ViewingAngleIsXClickForY_TEXT = "Viewing angle is #%1, click for #%2";
  59. // Button positions and if visible initially
  60. var g_bTimeUpdate = true;
  61. var g_nNumButs = 34;
  62. var g_bFirstPlaying = true;
  63. var g_PlayBackRate = 10000;
  64. var cgVOLUME_MIN = -10000;
  65. var cgVOLUME_MAX = 0;
  66. var g_ConWidth = 700;
  67. var g_ConHeight = 500;
  68. var g_DVDWidth = 540;
  69. var g_DVDHeight = 380;
  70. var g_DVDLeft = (g_ConWidth - g_DVDWidth) /2;
  71. var g_DVDTop = 40;
  72. var g_MinWidth = 425;
  73. var g_MinHeight = 350;
  74. var g_ButWidth = 620;
  75. var g_ButHeight = 31;
  76. var g_strButID;
  77. var g_InitializationState = 1; // 0 Creating Objects 1 Init 2 Run, 3 done
  78. var g_bFullScreen = false;
  79. var g_bActivityDeclined = false;
  80. var g_bExpanded = false;
  81. var g_bRestoreNeeded = false;
  82. var g_bStillOn = false;
  83. var g_strFocusObj = "Pause";
  84. var DVDMSGTIMER = 999;
  85. var FOCUSTIMER = 998;
  86. // index to the array of objects
  87. var g_nIndexPause = 0;
  88. var g_nIndexPlay = 1;
  89. var g_nIndexFF = 2;
  90. var g_nIndexRW = 3;
  91. var g_nIndexPrev = 4;
  92. var g_nIndexNext = 5;
  93. var g_nIndexMenu = 6;
  94. var g_nIndexResume = 7;
  95. var g_nIndexEnCC = 8;
  96. var g_nIndexDiCC = 9;
  97. var g_nIndexStepFw = 10;
  98. var g_nIndexStepBk = 11;
  99. var g_nIndexSubtitle = 12;
  100. var g_nIndexAudio = 13;
  101. var g_nIndexAngle = 14;
  102. var g_nIndexZoomIn = 15;
  103. var g_nIndexZoomOut = 16;
  104. var g_nIndexCapture = 17;
  105. var g_nIndexMute = 18;
  106. var g_nIndexSound = 19;
  107. var g_nIndexOptions = 20;
  108. var g_nIndexRight = 21;
  109. var g_nIndexLeft = 22;
  110. var g_nIndexUp = 23;
  111. var g_nIndexDown = 24;
  112. var g_nIndexEnter = 25;
  113. var g_nIndexHelp = 26;
  114. var g_nIndexMaximize = 27;
  115. var g_nIndexRestore = 28;
  116. var g_nIndexMinimize = 29;
  117. var g_nIndexClose = 30;
  118. var g_nIndexExpand = 31;
  119. var g_nIndexShrink = 32;
  120. var g_nIndexEject = 33;
  121. var g_nIndexStop = 34;
  122. var g_nIndexTimeline = 35;
  123. var g_nIndexSpeed = 36;
  124. var g_nIndexFrame = 37;
  125. var g_nIndexVolume = 38;
  126. var g_nIndexTextbox = 39
  127. var g_nIndexTitle = 40;
  128. var g_nIndexMessage = 41;
  129. var g_TextColorActive = 0x2a3fff;
  130. var g_TextColorHover = 0xf45c47;
  131. var g_TextColorDown = 0xff3f2a;
  132. var g_TextColorDisabled = 0xa6917a;
  133. var g_TextColorStatic = 0x2d2824;
  134. // Button postions for windowed mode
  135. var g_nButPos = new Array(
  136. new Array(60, 10, 19, 19, true, 1, 1), //pause 0
  137. new Array(30, 8, 24, 25, true, 1, 1), //play 1
  138. new Array(118,10, 26, 19, true, 1, 1), //ff 2
  139. new Array( 90,10, 26, 19, true, 1, 1), //rw 3
  140. new Array(155,10, 26, 19, true, 1, 1), //prev 4
  141. new Array(183,10, 26, 19, true, 1, 1), //next 5
  142. new Array(490,10, 47, 19, true, 1, 1), //menu 6
  143. new Array(490,10, 47, 19, false,1, 1), //resume 7
  144. new Array(435,10, 47, 19, true, 1, 1), //enable CC 8
  145. new Array(435,10, 47, 19, false,1, 1), //disable CC 9
  146. new Array(185,42, 23, 21, true, 2, 1), //stepfwd 10
  147. new Array(115,42, 23, 21, true, 1, 1), //stepbak 11
  148. new Array(220,44, 46, 15, true, 1, 1), //sp 12
  149. new Array(270,44, 46, 15, true, 1, 1), //audio 13
  150. new Array(320,44, 46, 15, true, 1, 1), //angle 14
  151. new Array(380,44, 18, 18, true, 1, 1), //zoomin 15
  152. new Array(400,44, 18, 18, true, 1, 1), //zoomout 16
  153. new Array(420,44, 19, 19, true, 1, 1), //capture 17
  154. new Array(520,44, 17, 15, true, 1, 1), //mute 18
  155. new Array(520,44, 17, 15, false,1, 1), //sound 19
  156. new Array(550,44, 45, 15, true, 1, 1), //options 20
  157. new Array(570,15, 9, 14, true, 2, 1), //right 21
  158. new Array(545,15, 9, 14, true, 1, 1), //left 22
  159. new Array(555,5, 14, 9, true, 1, 1), //up 23
  160. new Array(555,28, 14, 9, true, 2, 1), //down 24
  161. new Array(555,14, 14, 14, true,1, 1), //enter 25
  162. new Array(63,8, 16, 14, true, 0, 0), //help 26
  163. new Array(29,8, 16, 14, true, 0, 0), //maximize 27
  164. new Array(29,8, 16, 14, false,0, 0), //restore 28
  165. new Array(45,8, 16, 14, true, 0, 0), //minimize 29
  166. new Array(11,8, 16, 14, true, 0, 0), //close 30
  167. new Array(585,10, 14,14, true, 1, 1), //expand 31
  168. new Array(585,10, 14,14, false,1, 1), //shrink 32
  169. new Array(220,10, 19,19, true, 1, 1), //eject 33
  170. new Array(60, 10, 19,19, false,1, 1), //stop 34
  171. new Array(333,10, 83,17, true, 1, 1), // 35 Timeline
  172. new Array(30, 40, 80,18, true, 1, 1), // 36 Playspeed
  173. new Array(138,44, 47,16, true, 1, 1), // 37 Frameslider
  174. new Array(452,45, 65,15, true, 1, 1), // 38 Volslider
  175. new Array(252,8, 70, 22, true, 1, 1), // 39 TextBox
  176. new Array(20, 5, 0,20, true, 1, -1), // 40 Title bar Textbox
  177. new Array(35, 5, 0,20, true, 1, -1) // 41 DVD Message Textbox
  178. );
  179. // Button postions for full screen mode
  180. var g_nButPosFull = new Array(
  181. new Array(60, 10, 17, 17, true, 5, 1), //pause 0
  182. new Array(30, 8, 23, 23, true, 5, 1), //play 1
  183. new Array(118,10, 25, 18, true, 5, 1), //ff 2
  184. new Array( 90,10, 25, 18, true, 5, 1), //rw 3
  185. new Array(155,10, 25, 18, true, 5, 1), //prev 4
  186. new Array(183,10, 25, 18, true, 5, 1), //next 5
  187. new Array(490,10, 43, 17, true, 5, 1), //menu 6
  188. new Array(490,10, 43, 17, false,5, 1), //resume 7
  189. new Array(435,10, 43, 17, true, 5, 1), //enable CC 8
  190. new Array(435,10, 43, 17, false,5, 1), //disable CC 9
  191. new Array(185,42, 21, 19, true, 6, 1), //stepfwd 10
  192. new Array(117,42, 21, 19, true, 5, 1), //stepbak 11
  193. new Array(220,44, 46, 15, true, 5, 1), //sp 12
  194. new Array(270,44, 46, 15, true, 5, 1), //audio 13
  195. new Array(320,44, 46, 15, true, 5, 1), //angle 14
  196. new Array(380,44, 16, 16, true, 5, 1), //zoomin 15
  197. new Array(400,44, 16, 16, true, 5, 1), //zoomout 16
  198. new Array(420,44, 17, 17, true, 5, 1), //capture 17
  199. new Array(520,44, 15, 14, true, 5, 1), //mute 18
  200. new Array(520,44, 15, 14, false,5, 1), //sound 19
  201. new Array(550,44, 45, 15, true, 5, 1), //options 20
  202. new Array(570,15, 9, 14, true, 6, 1), //right 21
  203. new Array(545,15, 9, 14, true, 5, 1), //left 22
  204. new Array(555,5, 14, 9, true, 5, 1), //up 23
  205. new Array(555,28, 14, 9, true, 6, 1), //down 24
  206. new Array(555,14, 14, 14,true, 5, 1), //enter 25
  207. new Array(63,8, 16, 14, true, 0, 0), //help 26
  208. new Array(29,8, 16, 14, true, 0, 0), //maximize 27
  209. new Array(29,8, 16, 14, false,0, 0), //restore 28
  210. new Array(45,8, 16, 14, true, 0, 0), //minimize 29
  211. new Array(11,8, 16, 14, true, 0, 0), //close 30
  212. new Array(585,10, 14,14, true, 5, 1), //expand 31
  213. new Array(585,10, 14,14, false,5, 1), //shrink 32
  214. new Array(220,10, 17,17, true, 5, 1), //eject 33
  215. new Array(60, 10, 17,17, false,5, 1), //stop 34
  216. new Array(333,10, 83,17, true, 5, 1), // 35 Timeline
  217. new Array(30, 40, 80,18, true, 5, 1), // 36 Playspeed
  218. new Array(138,44, 47,16, true, 5, 1), // 37 Frameslider
  219. new Array(452,45, 65,15, true, 5, 1), // 38 Volslider
  220. new Array(252,8, 70, 22, true, 5, 1), // 39 TextBox
  221. new Array(20, 5, 0,20, true, 5, -1), // 40 Title bar Textbox
  222. new Array(35, 5, 0,20, true, 5, -1) // 41 DVD Message Textbox
  223. );
  224. var g_FlexLayoutRow1 = new Array (
  225. // ButtonIndex, mingap, maxgap (in front of button)
  226. new Array(g_nIndexPlay, 0, 0), // play
  227. new Array(g_nIndexPause, 4, 8), // pause
  228. new Array(g_nIndexRW, 6, 12), // rw
  229. new Array(g_nIndexFF, 1, 3), // ff
  230. new Array(g_nIndexPrev, 6, 12), // prev track
  231. new Array(g_nIndexNext, 1, 3), // next track
  232. new Array(g_nIndexEject, 6, 14), // eject
  233. new Array(g_nIndexTextbox, 8, 20), // text of time
  234. new Array(g_nIndexTimeline, 8, 20), // timeline
  235. new Array(g_nIndexEnCC, 8, 24), // en CC
  236. new Array(g_nIndexMenu, 5, 12), // menu
  237. new Array(g_nIndexLeft, 6, 12), // left
  238. new Array(g_nIndexEnter, 1, 1), // enter
  239. new Array(g_nIndexRight, 1, 1), // right
  240. new Array(g_nIndexExpand, 6, 12) // expand
  241. );
  242. var g_FlexLayoutRow2 = new Array (
  243. // ButtonIndex, mingap, maxgap (in front of button)
  244. new Array(g_nIndexSpeed, 0, 0), // speed
  245. new Array(g_nIndexStepBk, 4, 12), // stepbak
  246. new Array(g_nIndexFrame, 0, 0), // frameslider
  247. new Array(g_nIndexStepFw, 0, 0), // stepfwd
  248. new Array(g_nIndexSubtitle, 6, 18), // subtitle
  249. new Array(g_nIndexAudio, 4, 12), // audio
  250. new Array(g_nIndexAngle, 4, 12), // angle
  251. new Array(g_nIndexZoomIn, 6, 18), // zoom in
  252. new Array(g_nIndexZoomOut, 4, 12), // zoom out
  253. new Array(g_nIndexCapture, 4, 12), // capture
  254. new Array(g_nIndexVolume, 6, 18), // volume
  255. new Array(g_nIndexMute, 4, 12), // mute
  256. new Array(g_nIndexOptions, 6, 18) // options
  257. );
  258. var g_nButtonsOnRow1 = 15;
  259. var g_nButtonsOnRow2 = 13;
  260. var g_nMinMargin = 30;
  261. var g_nMaxControlAreaWidth = 600;
  262. var g_nMinControlAreaWidth = 500;
  263. // this function dynamically reposition the two rows of buttons by adjusting
  264. // the spacing
  265. function PositionButtons(nContainerWidth, nContainerHeight, bFullScreen)
  266. {
  267. var nTotalMaxGaps1 = 0;
  268. var nTotalMinGaps1 = 0;
  269. var nTotalButtonWidth1 = 0;
  270. for (i=0; i<g_nButtonsOnRow1; i++)
  271. {
  272. nIndex = g_FlexLayoutRow1[i][0];
  273. nTotalButtonWidth1 += bFullScreen?g_nButPosFull[nIndex][2]:g_nButPos[nIndex][2];
  274. nTotalMinGaps1 += g_FlexLayoutRow1[i][1];
  275. nTotalMaxGaps1 += g_FlexLayoutRow1[i][2];
  276. }
  277. var nTotalMinGaps2 = 0;
  278. var nTotalMaxGaps2 = 0;
  279. var nTotalButtonWidth2 = 0;
  280. for (i=0; i<g_nButtonsOnRow2; i++)
  281. {
  282. nIndex = g_FlexLayoutRow2[i][0];
  283. nTotalButtonWidth2 += bFullScreen?g_nButPosFull[nIndex][2]:g_nButPos[nIndex][2];
  284. nTotalMinGaps2 += g_FlexLayoutRow2[i][1];
  285. nTotalMaxGaps2 += g_FlexLayoutRow2[i][2];
  286. }
  287. // the control area includes the buttons and the spaces in between,
  288. // but not include the margin of the container on the two sides.
  289. // the maximum control area width is pre-defined, but it should not be
  290. // wider than the maximum stretched size of the control area
  291. var nMaxControlAreaWidth = Math.min(nTotalButtonWidth1 + nTotalMaxGaps1,
  292. nTotalButtonWidth2 + nTotalMaxGaps2);
  293. if (nMaxControlAreaWidth > g_nMaxControlAreaWidth)
  294. {
  295. nMaxControlAreaWidth > g_nMaxControlAreaWidth;
  296. }
  297. // the minimum control area width is pre-defined, but it should not be
  298. // narrower than the minimum compressed size of the control area
  299. var nMinControlAreaWidth = Math.max(nTotalButtonWidth1 + nTotalMinGaps1,
  300. nTotalButtonWidth2 + nTotalMinGaps2);
  301. if (nMinControlAreaWidth < g_nMaxControlAreaWidth)
  302. {
  303. nMinControlAreaWidth = g_nMinControlAreaWidth;
  304. }
  305. var nMargin = g_nMinMargin;
  306. var nControlAreaWidth = nContainerWidth - nMargin*2;
  307. if (nControlAreaWidth < nMinControlAreaWidth)
  308. {
  309. // not enough room for control area, we will keep the default margin on
  310. // the left side as well as the control spacing, but allow the controls
  311. // to go beyond the right-side edge
  312. nControlAreaWidth = nMinControlAreaWidth;
  313. }
  314. else if(nControlAreaWidth > nMaxControlAreaWidth)
  315. {
  316. // two much room for the control area, we will fix the control spacing
  317. // at the maximum, but make the margin wider
  318. nControlAreaWidth = nMaxControlAreaWidth;
  319. nMargin = (nContainerWidth - nControlAreaWidth)/2;
  320. }
  321. // the control area width is within the flexible range of spacing,
  322. // we will distribute the space between the controls.
  323. // first row
  324. var nVariableWidth = nControlAreaWidth - nTotalButtonWidth1 - nTotalMinGaps1;
  325. var nTotalDelta = nTotalMaxGaps1 - nTotalMinGaps1;
  326. var xOffset = nMargin;
  327. for (i=0; i<g_nButtonsOnRow1; i++)
  328. {
  329. nDelta = g_FlexLayoutRow1[i][2] - g_FlexLayoutRow1[i][1];
  330. nGap = g_FlexLayoutRow1[i][1] + Math.round(nVariableWidth*nDelta*1.0/nTotalDelta);
  331. xOffset += nGap; // advance by the gap width in front of control
  332. nIndex = g_FlexLayoutRow1[i][0];
  333. g_nButPos[nIndex][0] = xOffset;
  334. xOffset += bFullScreen?g_nButPosFull[nIndex][2]:g_nButPos[nIndex][2]; // advance by the control width
  335. }
  336. // same thing for second row
  337. nVariableWidth = nControlAreaWidth - nTotalButtonWidth2 - nTotalMinGaps2;
  338. nTotalDelta = nTotalMaxGaps2 - nTotalMinGaps2;
  339. xOffset = nMargin;
  340. for (i=0; i<g_nButtonsOnRow2; i++)
  341. {
  342. nDelta = g_FlexLayoutRow2[i][2] - g_FlexLayoutRow2[i][1];
  343. nGap = g_FlexLayoutRow2[i][1] + Math.round(nVariableWidth*nDelta*1.0/nTotalDelta);
  344. xOffset += nGap; // advance by the gap width in front of control
  345. nIndex = g_FlexLayoutRow2[i][0];
  346. g_nButPos[nIndex][0] = xOffset;
  347. xOffset += bFullScreen?g_nButPosFull[nIndex][2]:g_nButPos[nIndex][2]; // advance by the control width
  348. }
  349. // move other overlaping controls
  350. g_nButPos[g_nIndexStop][0] = g_nButPos[g_nIndexPause][0];
  351. g_nButPos[g_nIndexDiCC][0] = g_nButPos[g_nIndexEnCC][0];
  352. g_nButPos[g_nIndexResume][0] = g_nButPos[g_nIndexMenu][0];
  353. g_nButPos[g_nIndexUp][0] = g_nButPos[g_nIndexEnter][0];
  354. g_nButPos[g_nIndexDown][0] = g_nButPos[g_nIndexEnter][0];
  355. g_nButPos[g_nIndexShrink][0] = g_nButPos[g_nIndexExpand][0];
  356. g_nButPos[g_nIndexSound][0] = g_nButPos[g_nIndexMute][0];
  357. }
  358. // Button ID's for windowed mode
  359. var g_strButID = new Array(
  360. "Pause",
  361. "Play",
  362. "FastForward",
  363. "Rewind",
  364. "SkipBackward",
  365. "SkipForward",
  366. "Menu",
  367. "Resume",
  368. "EnCC",
  369. "DiCC",
  370. "StepFwd",
  371. "StepBak",
  372. "Subtitles",
  373. "Audio",
  374. "Angles",
  375. "ZoomIn",
  376. "ZoomOut",
  377. "Capture",
  378. "Mute",
  379. "Sound",
  380. "Options",
  381. "HLRight",
  382. "HLLeft",
  383. "HLUp",
  384. "HLDown",
  385. "Enter",
  386. "Help",
  387. "Maximize",
  388. "Restore",
  389. "Minimize",
  390. "Close",
  391. "Expand",
  392. "Shrink",
  393. "Eject",
  394. "Stop",
  395. "TimeSlider",
  396. "PlaySpeed",
  397. "FrameSlider",
  398. "VolSlider",
  399. "TextBox",
  400. "Title",
  401. "Message"
  402. );
  403. // Order in which there is an focus order
  404. var g_strFocusID = new Array(
  405. "Play",
  406. "Stop",
  407. "Pause",
  408. "Rewind",
  409. "FastForward",
  410. "SkipBackward",
  411. "SkipForward",
  412. "Eject",
  413. "TimeSlider",
  414. "EnCC",
  415. "DiCC",
  416. "Menu",
  417. "Resume",
  418. "Expand",
  419. "Shrink",
  420. "Help",
  421. "Minimize",
  422. "Maximize",
  423. "Restore",
  424. "Close"
  425. );
  426. var g_strFocusExpandedID = new Array(
  427. "Play",
  428. "Stop",
  429. "Pause",
  430. "Rewind",
  431. "FastForward",
  432. "SkipBackward",
  433. "SkipForward",
  434. "Eject",
  435. "TimeSlider",
  436. "EnCC",
  437. "DiCC",
  438. "Menu",
  439. "Resume",
  440. "Expand",
  441. "Shrink",
  442. "PlaySpeed",
  443. "StepBak",
  444. "FrameSlider",
  445. "StepFwd",
  446. "Subtitles",
  447. "Audio",
  448. "Angles",
  449. "ZoomIn",
  450. "ZoomOut",
  451. "Capture",
  452. "VolSlider",
  453. "Mute",
  454. "Sound",
  455. "Options",
  456. "Help",
  457. "Minimize",
  458. "Maximize",
  459. "Restore",
  460. "Close"
  461. );
  462. /************************************************************************/
  463. /* Virtual keys used for keyboard handeling. */
  464. /************************************************************************/
  465. var VK_ESCAPE =0x1B;
  466. var VK_LEFT =0x25;
  467. var VK_UP =0x26;
  468. var VK_RIGHT =0x27;
  469. var VK_DOWN =0x28;
  470. var VK_SELECT =0x29;
  471. var VK_SPACE =0x20;
  472. var VK_RETURN =0x0D;
  473. var VK_F4 =0x73;
  474. // Button tooltips
  475. // these strings should be localized
  476. var L_Pause_TEXT = "Pause";
  477. var L_Play_TEXT = "Play";
  478. var L_FastForward_TEXT = "FastForward";
  479. var L_Rewind_TEXT = "Rewind";
  480. var L_PreviousChapter_TEXT = "Previous Chapter";
  481. var L_NextChapter_TEXT = "Next Chapter";
  482. var L_Menu_TEXT = "Menu";
  483. var L_Resume_TEXT = "Resume";
  484. var L_EnableCC_TEXT = "Enable CC";
  485. var L_DisableCC_TEXT = "Disable CC";
  486. var L_StepForward_TEXT = "Step Forward";
  487. var L_StepBack_TEXT = "Step Back";
  488. var L_Subtitle_TEXT = "Subtitle";
  489. var L_Audio_TEXT = "Audio";
  490. var L_Angle1_TEXT = "Angle #1";
  491. var L_ZoomIn_TEXT = "Zoom In";
  492. var L_ZoomOut_TEXT = "Zoom Out";
  493. var L_Capture_TEXT = "Capture";
  494. var L_Mute_TEXT = "Mute";
  495. var L_Sound_TEXT = "Sound";
  496. var L_Options_TEXT = "Options";
  497. var L_ContextHelp_TEXT = "Context Help";
  498. var L_Right_TEXT = "Right";
  499. var L_Left_TEXT = "Left";
  500. var L_Up_TEXT = "Up";
  501. var L_Down_TEXT = "Down";
  502. var L_Enter_TEXT = "Enter";
  503. var L_Maximize_TEXT = "Maximize";
  504. var L_Restore_TEXT = "Restore";
  505. var L_Minimize_TEXT = "Minimize";
  506. var L_Close_TEXT = "Close";
  507. var L_ExpandControlPanel_TEXT = "Expand Control Panel";
  508. var L_ShrinkControlPanel_TEXT = "Shrink Control Panel";
  509. var L_EjectDVD_TEXT = "Eject DVD";
  510. var L_StopPlayback_TEXT = "Stop Playback";
  511. var L_TimeLine_TEXT = "Time Line";
  512. var L_PlaySpeed_TEXT = "Play Speed";
  513. var L_FrameScrubSlider_TEXT = "Frame Scrub Slider";
  514. var L_Volume_TEXT = "Volume";
  515. var L_TextBox_TEXT = "TextBox";
  516. var L_TitleBar_TEXT = "Title Bar";
  517. var L_DVDMessage_TEXT = "DVD Message";
  518. // Button tooltips
  519. var g_strButTT = new Array(
  520. L_Pause_TEXT,
  521. L_Play_TEXT,
  522. L_FastForward_TEXT,
  523. L_Rewind_TEXT,
  524. L_PreviousChapter_TEXT,
  525. L_NextChapter_TEXT,
  526. L_Menu_TEXT,
  527. L_Resume_TEXT,
  528. L_EnableCC_TEXT,
  529. L_DisableCC_TEXT,
  530. L_StepForward_TEXT,
  531. L_StepBack_TEXT,
  532. L_Subtitle_TEXT,
  533. L_Audio_TEXT,
  534. L_Angle1_TEXT,
  535. L_ZoomIn_TEXT,
  536. L_ZoomOut_TEXT,
  537. L_Capture_TEXT,
  538. L_Mute_TEXT,
  539. L_Sound_TEXT,
  540. L_Options_TEXT,
  541. L_Right_TEXT,
  542. L_Left_TEXT,
  543. L_Up_TEXT,
  544. L_Down_TEXT,
  545. L_Enter_TEXT,
  546. L_ContextHelp_TEXT,
  547. L_Maximize_TEXT,
  548. L_Restore_TEXT,
  549. L_Minimize_TEXT,
  550. L_Close_TEXT,
  551. L_ExpandControlPanel_TEXT,
  552. L_ShrinkControlPanel_TEXT,
  553. L_EjectDVD_TEXT,
  554. L_StopPlayback_TEXT,
  555. L_TimeLine_TEXT,
  556. L_PlaySpeed_TEXT,
  557. L_FrameScrubSlider_TEXT,
  558. L_Volume_TEXT,
  559. L_TextBox_TEXT,
  560. L_TitleBar_TEXT,
  561. L_DVDMessage_TEXT
  562. );
  563. // Button bitmap images for windowed mode
  564. var g_strButImage = new Array(
  565. new Array ("\"IDR_STATIC_PAUSE\"","\"IDR_HOVER_PAUSE\"","\"IDR_DOWN_PAUSE\"","\"IDR_DISABLED_PAUSE\"","\"IDR_ACTIVE_PAUSE\""),
  566. new Array ("\"IDR_STATIC_PLAY\"","\"IDR_HOVER_PLAY\"","\"IDR_DOWN_PLAY\"","\"IDR_DISABLED_PLAY\"","\"IDR_ACTIVE_PLAY\""),
  567. new Array ("\"IDR_STATIC_FF\"", "\"IDR_HOVER_FF\"", "\"IDR_DOWN_FF\"","\"IDR_DISABLED_FF\"","\"IDR_ACTIVE_FF\""),
  568. new Array ("\"IDR_STATIC_RW\"", "\"IDR_HOVER_RW\"", "\"IDR_DOWN_RW\"","\"IDR_DISABLED_RW\"","\"IDR_ACTIVE_RW\""),
  569. new Array ("\"IDR_STATIC_PREV\"","\"IDR_HOVER_PREV\"","\"IDR_DOWN_PREV\"","\"IDR_DISABLED_PREV\"","\"IDR_ACTIVE_PREV\""),
  570. new Array ("\"IDR_STATIC_NEXT\"","\"IDR_HOVER_NEXT\"","\"IDR_DOWN_NEXT\"","\"IDR_DISABLED_NEXT\"","\"IDR_ACTIVE_NEXT\""),
  571. new Array ("\"IDR_STATIC_MENU\"","\"IDR_HOVER_MENU\"","\"IDR_DOWN_MENU\"","\"IDR_DISABLED_MENU\"","\"IDR_ACTIVE_MENU\""),
  572. new Array ("\"IDR_STATIC_RESUME\"","\"IDR_HOVER_RESUME\"","\"IDR_DOWN_RESUME\"","\"IDR_DISABLED_RESUME\"","\"IDR_ACTIVE_RESUME\""),
  573. new Array ("\"IDR_STATIC_ENCC\"","\"IDR_HOVER_ENCC\"","\"IDR_DOWN_ENCC\"","\"IDR_DISABLED_ENCC\"","\"IDR_ACTIVE_ENCC\""),
  574. new Array ("\"IDR_STATIC_DICC\"","\"IDR_HOVER_DICC\"","\"IDR_DOWN_DICC\"","\"IDR_DISABLED_DICC\"","\"IDR_ACTIVE_DICC\""),
  575. new Array ("\"IDR_STATIC_NEXTFRAME\"", "\"IDR_HOVER_NEXTFRAME\"", "\"IDR_DOWN_NEXTFRAME\"","\"IDR_DISABLED_NEXTFRAME\"","\"IDR_ACTIVE_NEXTFRAME\""),
  576. new Array ("\"IDR_STATIC_PREVFRAME\"", "\"IDR_HOVER_PREVFRAME\"", "\"IDR_DOWN_PREVFRAME\"","\"IDR_DISABLED_PREVFRAME\"","\"IDR_ACTIVE_PREVFRAME\""),
  577. new Array ("\"IDR_STATIC_SP\"", "\"IDR_HOVER_SP\"", "\"IDR_DOWN_SP\"","\"IDR_DISABLED_SP\"","\"IDR_ACTIVE_SP\""),
  578. new Array ("\"IDR_STATIC_LAN\"", "\"IDR_HOVER_LAN\"", "\"IDR_DOWN_LAN\"","\"IDR_DISABLED_LAN\"","\"IDR_ACTIVE_LAN\""),
  579. new Array ("\"IDR_STATIC_ANGLE\"", "\"IDR_HOVER_ANGLE\"", "\"IDR_DOWN_ANGLE\"","\"IDR_DISABLED_ANGLE\"","\"IDR_ACTIVE_ANGLE\""),
  580. new Array ("\"IDR_STATIC_ZOOMIN\"", "\"IDR_HOVER_ZOOMIN\"", "\"IDR_DOWN_ZOOMIN\"","\"IDR_DISABLED_ZOOMIN\"","\"IDR_ACTIVE_ZOOMIN\""),
  581. new Array ("\"IDR_STATIC_ZOOMOUT\"", "\"IDR_HOVER_ZOOMOUT\"", "\"IDR_DOWN_ZOOMOUT\"","\"IDR_DISABLED_ZOOMOUT\"","\"IDR_ACTIVE_ZOOMOUT\""),
  582. new Array ("\"IDR_STATIC_CAPTURE\"", "\"IDR_HOVER_CAPTURE\"", "\"IDR_DOWN_CAPTURE\"","\"IDR_DISABLED_CAPTURE\"","\"IDR_ACTIVE_CAPTURE\""),
  583. new Array ("\"IDR_STATIC_MUTE\"", "\"IDR_HOVER_MUTE\"", "\"IDR_DOWN_MUTE\"","\"IDR_DISABLED_MUTE\"","\"IDR_ACTIVE_MUTE\""),
  584. new Array ("\"IDR_STATIC_SOUND\"", "\"IDR_HOVER_SOUND\"", "\"IDR_DOWN_SOUND\"","\"IDR_DISABLED_SOUND\"","\"IDR_ACTIVE_SOUND\""),
  585. new Array ("\"IDR_STATIC_OPT\"", "\"IDR_HOVER_OPT\"", "\"IDR_DOWN_OPT\"","\"IDR_DISABLED_OPT\"","\"IDR_ACTIVE_OPT\""),
  586. new Array ("\"IDR_STATIC_RIGHT\"","\"IDR_HOVER_RIGHT\"","\"IDR_DOWN_RIGHT\"","\"IDR_DISABLED_RIGHT\"","\"IDR_ACTIVE_RIGHT\""),
  587. new Array ("\"IDR_STATIC_LEFT\"","\"IDR_HOVER_LEFT\"","\"IDR_DOWN_LEFT\"","\"IDR_DISABLED_LEFT\"","\"IDR_ACTIVE_LEFT\""),
  588. new Array ("\"IDR_STATIC_UP\"", "\"IDR_HOVER_UP\"", "\"IDR_DOWN_UP\"","\"IDR_DISABLED_UP\"","\"IDR_ACTIVE_UP\""),
  589. new Array ("\"IDR_STATIC_DOWN\"","\"IDR_HOVER_DOWN\"","\"IDR_DOWN_DOWN\"","\"IDR_DISABLED_DOWN\"","\"IDR_ACTIVE_DOWN\""),
  590. new Array ("\"IDR_STATIC_ENTER\"","\"IDR_HOVER_ENTER\"","\"IDR_DOWN_ENTER\"","\"IDR_DISABLED_ENTER\"","\"IDR_ACTIVE_ENTER\""),
  591. new Array ("\"IDR_STATIC_HELP\"", "\"IDR_HOVER_HELP\"", "\"IDR_DOWN_HELP\"","\"IDR_DISABLED_HELP\"","\"IDR_ACTIVE_HELP\""),
  592. new Array ("\"IDR_STATIC_MAX\"", "\"IDR_HOVER_MAX\"", "\"IDR_DOWN_MAX\"","\"IDR_DISABLED_MAX\"","\"IDR_ACTIVE_MAX\""),
  593. new Array ("\"IDR_STATIC_RESTORE\"", "\"IDR_HOVER_RESTORE\"", "\"IDR_DOWN_RESTORE\"","\"IDR_DISABLED_RESTORE\"","\"IDR_ACTIVE_RESTORE\""),
  594. new Array ("\"IDR_STATIC_MIN\"", "\"IDR_HOVER_MIN\"", "\"IDR_DOWN_MIN\"","\"IDR_DISABLED_MIN\"","\"IDR_ACTIVE_MIN\""),
  595. new Array ("\"IDR_STATIC_CLOSE\"", "\"IDR_HOVER_CLOSE\"", "\"IDR_DOWN_CLOSE\"","\"IDR_DISABLED_CLOSE\"","\"IDR_ACTIVE_CLOSE\""),
  596. new Array ("\"IDR_STATIC_EXPAND\"", "\"IDR_HOVER_EXPAND\"", "\"IDR_DOWN_EXPAND\"","\"IDR_DISABLED_EXPAND\"","\"IDR_ACTIVE_EXPAND\""),
  597. new Array ("\"IDR_STATIC_SHRINK\"", "\"IDR_HOVER_SHRINK\"", "\"IDR_DOWN_SHRINK\"","\"IDR_DISABLED_SHRINK\"","\"IDR_ACTIVE_SHRINK\""),
  598. new Array ("\"IDR_STATIC_EJECT\"", "\"IDR_HOVER_EJECT\"", "\"IDR_DOWN_EJECT\"","\"IDR_DISABLED_EJECT\"","\"IDR_ACTIVE_EJECT\""),
  599. new Array ("\"IDR_STATIC_STOP\"", "\"IDR_HOVER_STOP\"", "\"IDR_DOWN_STOP\"","\"IDR_DISABLED_STOP\"","\"IDR_ACTIVE_STOP\"")
  600. );
  601. // Button bitmap images for full screen mode
  602. var g_strButImageFull = new Array(
  603. new Array ("\"IDR_FULLSTATIC_PAUSE\"","\"IDR_FULLHOVER_PAUSE\"","\"IDR_FULLDOWN_PAUSE\"","\"IDR_FULLDISABLED_PAUSE\"","\"IDR_FULLACTIVE_PAUSE\""),
  604. new Array ("\"IDR_FULLSTATIC_PLAY\"","\"IDR_FULLHOVER_PLAY\"","\"IDR_FULLDOWN_PLAY\"","\"IDR_FULLDISABLED_PLAY\"","\"IDR_FULLACTIVE_PLAY\""),
  605. new Array ("\"IDR_FULLSTATIC_FF\"", "\"IDR_FULLHOVER_FF\"", "\"IDR_FULLDOWN_FF\"","\"IDR_FULLDISABLED_FF\"","\"IDR_FULLACTIVE_FF\""),
  606. new Array ("\"IDR_FULLSTATIC_RW\"", "\"IDR_FULLHOVER_RW\"", "\"IDR_FULLDOWN_RW\"","\"IDR_FULLDISABLED_RW\"","\"IDR_FULLACTIVE_RW\""),
  607. new Array ("\"IDR_FULLSTATIC_PREV\"","\"IDR_FULLHOVER_PREV\"","\"IDR_FULLDOWN_PREV\"","\"IDR_FULLDISABLED_PREV\"","\"IDR_FULLACTIVE_PREV\""),
  608. new Array ("\"IDR_FULLSTATIC_NEXT\"","\"IDR_FULLHOVER_NEXT\"","\"IDR_FULLDOWN_NEXT\"","\"IDR_FULLDISABLED_NEXT\"","\"IDR_FULLACTIVE_NEXT\""),
  609. new Array ("\"IDR_FULLSTATIC_MENU\"","\"IDR_FULLHOVER_MENU\"","\"IDR_FULLDOWN_MENU\"","\"IDR_FULLDISABLED_MENU\"","\"IDR_FULLACTIVE_MENU\""),
  610. new Array ("\"IDR_FULLSTATIC_RESUME\"","\"IDR_FULLHOVER_RESUME\"","\"IDR_FULLDOWN_RESUME\"","\"IDR_FULLDISABLED_RESUME\"","\"IDR_FULLACTIVE_RESUME\""),
  611. new Array ("\"IDR_FULLSTATIC_ENCC\"","\"IDR_FULLHOVER_ENCC\"","\"IDR_FULLDOWN_ENCC\"","\"IDR_FULLDISABLED_ENCC\"","\"IDR_FULLACTIVE_ENCC\""),
  612. new Array ("\"IDR_FULLSTATIC_DICC\"","\"IDR_FULLHOVER_DICC\"","\"IDR_FULLDOWN_DICC\"","\"IDR_FULLDISABLED_DICC\"","\"IDR_FULLACTIVE_DICC\""),
  613. new Array ("\"IDR_FULLSTATIC_NEXTFRAME\"", "\"IDR_FULLHOVER_NEXTFRAME\"", "\"IDR_FULLDOWN_NEXTFRAME\"","\"IDR_FULLDISABLED_NEXTFRAME\"","\"IDR_FULLACTIVE_NEXTFRAME\""),
  614. new Array ("\"IDR_FULLSTATIC_PREVFRAME\"", "\"IDR_FULLHOVER_PREVFRAME\"", "\"IDR_FULLDOWN_PREVFRAME\"","\"IDR_FULLDISABLED_PREVFRAME\"","\"IDR_FULLACTIVE_PREVFRAME\""),
  615. new Array ("\"IDR_STATIC_SP\"", "\"IDR_HOVER_SP\"", "\"IDR_DOWN_SP\"","\"IDR_DISABLED_SP\"","\"IDR_ACTIVE_SP\""),
  616. new Array ("\"IDR_STATIC_LAN\"", "\"IDR_HOVER_LAN\"", "\"IDR_DOWN_LAN\"","\"IDR_DISABLED_LAN\"","\"IDR_ACTIVE_LAN\""),
  617. new Array ("\"IDR_STATIC_ANGLE\"", "\"IDR_HOVER_ANGLE\"", "\"IDR_DOWN_ANGLE\"","\"IDR_DISABLED_ANGLE\"","\"IDR_ACTIVE_ANGLE\""),
  618. new Array ("\"IDR_FULLSTATIC_ZOOMIN\"", "\"IDR_FULLHOVER_ZOOMIN\"", "\"IDR_FULLDOWN_ZOOMIN\"","\"IDR_FULLDISABLED_ZOOMIN\"","\"IDR_FULLACTIVE_ZOOMIN\""),
  619. new Array ("\"IDR_FULLSTATIC_ZOOMOUT\"", "\"IDR_FULLHOVER_ZOOMOUT\"", "\"IDR_FULLDOWN_ZOOMOUT\"","\"IDR_FULLDISABLED_ZOOMOUT\"","\"IDR_FULLACTIVE_ZOOMOUT\""),
  620. new Array ("\"IDR_FULLSTATIC_CAPTURE\"", "\"IDR_FULLHOVER_CAPTURE\"", "\"IDR_FULLDOWN_CAPTURE\"","\"IDR_FULLDISABLED_CAPTURE\"","\"IDR_FULLACTIVE_CAPTURE\""),
  621. new Array ("\"IDR_FULLSTATIC_MUTE\"", "\"IDR_FULLHOVER_MUTE\"", "\"IDR_FULLDOWN_MUTE\"","\"IDR_FULLDISABLED_MUTE\"","\"IDR_FULLACTIVE_MUTE\""),
  622. new Array ("\"IDR_FULLSTATIC_SOUND\"", "\"IDR_FULLHOVER_SOUND\"", "\"IDR_FULLDOWN_SOUND\"","\"IDR_FULLDISABLED_SOUND\"","\"IDR_FULLACTIVE_SOUND\""),
  623. new Array ("\"IDR_STATIC_OPT\"", "\"IDR_HOVER_OPT\"", "\"IDR_DOWN_OPT\"","\"IDR_DISABLED_OPT\"","\"IDR_ACTIVE_OPT\""),
  624. new Array ("\"IDR_STATIC_RIGHT\"","\"IDR_HOVER_RIGHT\"","\"IDR_DOWN_RIGHT\"","\"IDR_DISABLED_RIGHT\"","\"IDR_ACTIVE_RIGHT\""),
  625. new Array ("\"IDR_STATIC_LEFT\"","\"IDR_HOVER_LEFT\"","\"IDR_DOWN_LEFT\"","\"IDR_DISABLED_LEFT\"","\"IDR_ACTIVE_LEFT\""),
  626. new Array ("\"IDR_STATIC_UP\"", "\"IDR_HOVER_UP\"", "\"IDR_DOWN_UP\"","\"IDR_DISABLED_UP\"","\"IDR_ACTIVE_UP\""),
  627. new Array ("\"IDR_STATIC_DOWN\"","\"IDR_HOVER_DOWN\"","\"IDR_DOWN_DOWN\"","\"IDR_DISABLED_DOWN\"","\"IDR_ACTIVE_DOWN\""),
  628. new Array ("\"IDR_FULLSTATIC_ENTER\"","\"IDR_FULLHOVER_ENTER\"","\"IDR_FULLDOWN_ENTER\"","\"IDR_FULLDISABLED_ENTER\"","\"IDR_FULLACTIVE_ENTER\""),
  629. new Array ("\"IDR_STATIC_HELP\"", "\"IDR_HOVER_HELP\"", "\"IDR_DOWN_HELP\"","\"IDR_DISABLED_HELP\"","\"IDR_ACTIVE_HELP\""),
  630. new Array ("\"IDR_STATIC_MAX\"", "\"IDR_HOVER_MAX\"", "\"IDR_DOWN_MAX\"","\"IDR_DISABLED_MAX\"","\"IDR_ACTIVE_MAX\""),
  631. new Array ("\"IDR_STATIC_RESTORE\"", "\"IDR_HOVER_RESTORE\"", "\"IDR_DOWN_RESTORE\"","\"IDR_DISABLED_RESTORE\"","\"IDR_ACTIVE_RESTORE\""),
  632. new Array ("\"IDR_STATIC_MIN\"", "\"IDR_HOVER_MIN\"", "\"IDR_DOWN_MIN\"","\"IDR_DISABLED_MIN\"","\"IDR_ACTIVE_MIN\""),
  633. new Array ("\"IDR_STATIC_CLOSE\"", "\"IDR_HOVER_CLOSE\"", "\"IDR_DOWN_CLOSE\"","\"IDR_DISABLED_CLOSE\"","\"IDR_ACTIVE_CLOSE\""),
  634. new Array ("\"IDR_STATIC_EXPAND\"", "\"IDR_HOVER_EXPAND\"", "\"IDR_DOWN_EXPAND\"","\"IDR_DISABLED_EXPAND\"","\"IDR_ACTIVE_EXPAND\""),
  635. new Array ("\"IDR_STATIC_SHRINK\"", "\"IDR_HOVER_SHRINK\"", "\"IDR_DOWN_SHRINK\"","\"IDR_DISABLED_SHRINK\"","\"IDR_ACTIVE_SHRINK\""),
  636. new Array ("\"IDR_FULLSTATIC_EJECT\"", "\"IDR_FULLHOVER_EJECT\"", "\"IDR_FULLDOWN_EJECT\"","\"IDR_FULLDISABLED_EJECT\"","\"IDR_FULLACTIVE_EJECT\""),
  637. new Array ("\"IDR_FULLSTATIC_STOP\"", "\"IDR_FULLHOVER_STOP\"", "\"IDR_FULLDOWN_STOP\"","\"IDR_FULLDISABLED_STOP\"","\"IDR_FULLACTIVE_STOP\"")
  638. );
  639. // use the button bitmaps without text, for any language other than English
  640. if (!g_LocaleEnglish)
  641. {
  642. // Button bitmap images for windowed mode
  643. g_strButImage[g_nIndexMenu] = new Array ("\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_DOWN_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"");
  644. g_strButImage[g_nIndexResume] = new Array ("\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_DOWN_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"");
  645. g_strButImage[g_nIndexEnCC] = new Array ("\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_DOWN_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"");
  646. g_strButImage[g_nIndexDiCC] = new Array ("\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_DOWN_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"");
  647. g_strButImage[g_nIndexSubtitle] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  648. g_strButImage[g_nIndexAudio] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  649. g_strButImage[g_nIndexAngle] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  650. g_strButImage[g_nIndexOptions] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  651. // Button bitmap images for full screen mode
  652. g_strButImageFull[g_nIndexMenu] = new Array ("\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLDOWN_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"");
  653. g_strButImageFull[g_nIndexResume] = new Array ("\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLDOWN_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"");
  654. g_strButImageFull[g_nIndexEnCC] = new Array ("\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLDOWN_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"");
  655. g_strButImageFull[g_nIndexDiCC] = new Array ("\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLDOWN_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"");
  656. g_strButImageFull[g_nIndexSubtitle] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  657. g_strButImageFull[g_nIndexAudio] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  658. g_strButImageFull[g_nIndexAngle] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  659. g_strButImageFull[g_nIndexOptions] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  660. }
  661. // Slider images
  662. var g_strSldrImage = new Array(
  663. new Array ("\"IDR_STATIC_TIMESLIDER\"","\"IDR_STATIC_TIMETHUMB\""),
  664. new Array ("\"IDR_STATIC_SPEEDSLIDER\"","\"IDR_STATIC_SPEEDTHUMB\""),
  665. new Array ("\"IDR_STATIC_FRAMESLIDER\"","\"IDR_STATIC_FRAMETHUMB\""),
  666. new Array ("\"IDR_STATIC_VOLSLIDER\"","\"IDR_STATIC_VOLTHUMB\"")
  667. );
  668. // Button OnClick callbacks
  669. var g_pButCallbacks = new Array(
  670. "pause_OnClick()",
  671. "play_OnClick()",
  672. "fwd_OnClick()",
  673. "rew_OnClick()",
  674. "prev_OnClick()",
  675. "next_OnClick()",
  676. "menu_OnClick()",
  677. "menu_OnClick()",
  678. "cc_OnClick()",
  679. "cc_OnClick()",
  680. "stepfwd_OnClick()",
  681. "stepbak_OnClick()",
  682. "sp_OnClick()",
  683. "lan_OnClick()",
  684. "angle_OnClick()",
  685. "zoomin_OnClick()",
  686. "zoomout_OnClick()",
  687. "capture_OnClick()",
  688. "mute_OnClick()",
  689. "sound_OnClick()",
  690. "options_OnClick()",
  691. "right_OnClick()",
  692. "left_OnClick()",
  693. "up_OnClick()",
  694. "down_OnClick()",
  695. "enter_OnClick()",
  696. "help_OnClick()",
  697. "max_OnClick()",
  698. "restore_OnClick()",
  699. "min_OnClick()",
  700. "close_OnClick()",
  701. "expand_OnClick()",
  702. "shrink_OnClick()",
  703. "eject_OnClick()",
  704. "stop_OnClick()"
  705. );
  706. // DVD event codes
  707. var EC_DVDBASE = 256;
  708. var EC_DVD_DOMAIN_CHANGE = EC_DVDBASE + 1;
  709. var EC_DVD_TITLE_CHANGE = EC_DVDBASE + 2;
  710. var EC_DVD_CHAPTER_START = EC_DVDBASE + 3;
  711. var EC_DVD_AUDIO_STREAM_CHANGE = EC_DVDBASE + 4;
  712. var EC_DVD_SUBPICTURE_STREAM_CHANGE = EC_DVDBASE + 5;
  713. var EC_DVD_ANGLE_CHANGE = EC_DVDBASE + 6;
  714. var EC_DVD_BUTTON_CHANGE = EC_DVDBASE + 7;
  715. var EC_DVD_VALID_UOPS_CHANGE = EC_DVDBASE + 8;
  716. var EC_DVD_STILL_ON = EC_DVDBASE + 9;
  717. var EC_DVD_STILL_OFF = EC_DVDBASE + 10;
  718. var EC_DVD_CURRENT_TIME = EC_DVDBASE + 11;
  719. var EC_DVD_ERROR = EC_DVDBASE + 12;
  720. var EC_DVD_WARNING = EC_DVDBASE + 13;
  721. var EC_DVD_CHAPTER_AUTOSTOP = EC_DVDBASE + 14;
  722. var EC_DVD_NO_FP_PGC = EC_DVDBASE + 15;
  723. var EC_DVD_PLAYBACK_RATE_CHANGE = EC_DVDBASE + 16;
  724. var EC_DVD_PARENTAL_LEVEL_CHANGE = EC_DVDBASE + 17;
  725. var EC_DVD_PLAYBACK_STOPPED = EC_DVDBASE + 18;
  726. var EC_DVD_ANGLES_AVAILABLE = EC_DVDBASE + 19;
  727. var EC_DVD_PLAYING = EC_DVDBASE + 254;
  728. var EC_DVD_DISC_EJECTED = EC_DVDBASE + 24;
  729. var EC_DVD_DISC_INSERTED = EC_DVDBASE + 25;
  730. var EC_PAUSED = 14;
  731. var DVD_ERROR_Unexpected= 1;
  732. var DVD_ERROR_CopyProtectFail= 2;
  733. var DVD_ERROR_InvalidDVD1_0Disc= 3;
  734. var DVD_ERROR_InvalidDiscRegion= 4;
  735. var DVD_ERROR_LowParentalLevel= 5;
  736. var DVD_ERROR_MacrovisionFail= 6;
  737. var DVD_ERROR_IncompatibleSystemAndDecoderRegions=7;
  738. var DVD_ERROR_IncompatibleDiscAndDecoderRegions=8;
  739. /*************************************************************/
  740. /* Name: CreateObjects
  741. /* Description: Create all objects hosted by the container
  742. /*************************************************************/
  743. function CreateObjects(){
  744. try {
  745. MFBar.SetupSelfSite(10, 10, g_ConWidth, g_ConHeight, "<PARAM NAME=\"Caption\" VALUE=\"DVDPlay\">", true, true, true);
  746. MFBar.BackColor = 0xff;
  747. // Auto loading now
  748. //MFBar.ResourceDll = "ImageRes.dll";
  749. MFBar.BackGroundImage = "IDR_BACKIMG_SIMPLE";
  750. MFBar.ActivityTimeout = 3000;
  751. // Set up splash screen
  752. MFBar.CreateObject("Splash", "MSMFCnt.MSMFImg", 0, 0, 100, 100, "");
  753. Splash.ResourceDll = MFBar.ResourceDll;
  754. Splash.Image = "IDR_IMG_SPLASH";
  755. MFBar.CreateObject("DVDOpt", "Msdvdopt.dvdopt.1",
  756. 0, 0, 100, 100, "", true, "HookDVDOptEv");
  757. param = "<PARAM NAME=\"ColorKey\" VALUE=\"1048592\">";
  758. param += "<PARAM NAME=\"WindowlessActivation\" VALUE=\"-1\">";
  759. MFBar.CreateObject("DVD", "MSWebDVD.MSWebDVD.1",
  760. g_DVDLeft, g_DVDTop, g_DVDWidth, g_DVDHeight, param, true, "HookDVDEv");
  761. PositionButtons(g_ConWidth, g_ConHeight, false);
  762. yOffset = g_ConHeight-g_ButHeight;
  763. for (i=0; i<=g_nNumButs; i++) {
  764. param1 = "<PARAM NAME=\"ResourceDLL\" VALUE=\"" + MFBar.ResourceDll + "\">";
  765. param1 = param1 + "<PARAM NAME=\"ImageStatic\" VALUE=";
  766. param1 = param1 + g_strButImage[i][0] + ">";
  767. param1 = param1 + "<PARAM NAME=\"ImageHover\" VALUE=";
  768. param1 = param1 + g_strButImage[i][1] + ">";
  769. param1 = param1 + "<PARAM NAME=\"ImagePush\" VALUE=";
  770. param1 = param1 + g_strButImage[i][2] + ">";
  771. param1 = param1 + "<PARAM NAME=\"ImageDisabled\" VALUE=";
  772. param1 = param1 + g_strButImage[i][3] + ">";
  773. param1 = param1 + "<PARAM NAME=\"ToolTip\" VALUE=\"";
  774. param1 = param1 + g_strButTT[i] + "\">";
  775. param1 = param1 + "<PARAM NAME=\"ToolTipMaxWidth\" VALUE=\"130\">";
  776. param1 = param1 + "<PARAM NAME=\"BackColor\" VALUE=\"1048592\">";
  777. param = param1 + "<PARAM NAME=\"Windowless\" VALUE=\"-1\">";
  778. param += "<PARAM NAME=\"TransparentBlitType\" VALUE=\"" +
  779. g_nButPos[i][5] + "\">";
  780. if (g_nButPos[i][6] != 0)
  781. {
  782. xPos = g_nButPos[i][0];
  783. yPos = g_nButPos[i][1] + yOffset;
  784. }
  785. else if (g_LTRReading)
  786. {
  787. xPos = g_ConWidth - g_nButPos[i][0] - g_nButPos[i][2];
  788. yPos = g_nButPos[i][1];
  789. }
  790. else
  791. {
  792. xPos = g_nButPos[i][0];
  793. yPos = g_nButPos[i][1];
  794. }
  795. MFBar.CreateObject(g_strButID[i], "MSMFCnt.MSMFBBtn", xPos, yPos,
  796. g_nButPos[i][2], g_nButPos[i][3], param, !g_nButPos[i][4]);
  797. param1 = "<PARAM NAME=\"ResourceDLL\" VALUE=\"" + MFBar.ResourceDll + "\">";
  798. param1 = param1 + "<PARAM NAME=\"ImageStatic\" VALUE=";
  799. param1 = param1 + g_strButImageFull[i][0] + ">";
  800. param1 = param1 + "<PARAM NAME=\"ImageHover\" VALUE=";
  801. param1 = param1 + g_strButImageFull[i][1] + ">";
  802. param1 = param1 + "<PARAM NAME=\"ImagePush\" VALUE=";
  803. param1 = param1 + g_strButImageFull[i][2] + ">";
  804. param1 = param1 + "<PARAM NAME=\"ImageDisabled\" VALUE=";
  805. param1 = param1 + g_strButImageFull[i][3] + ">";
  806. param1 = param1 + "<PARAM NAME=\"ToolTip\" VALUE=\"";
  807. param1 = param1 + g_strButTT[i] + "\">";
  808. param1 = param1 + "<PARAM NAME=\"ToolTipMaxWidth\" VALUE=\"130\">";
  809. param1 = param1 + "<PARAM NAME=\"BackColor\" VALUE=\"1048592\">";
  810. param = param1 + "<PARAM NAME=\"Windowless\" VALUE=\"0\">";
  811. param += "<PARAM NAME=\"TransparentBlitType\" VALUE=\"" +
  812. g_nButPosFull[i][5] + "\">";
  813. // Create another set of buttons for the full screen mode
  814. // objects need to be created before loading the script
  815. MFBar.CreateObject(g_strButID[i]+"Full", "MSMFCnt.MSMFBBtn", xPos, yPos - 1000,
  816. g_nButPos[i][2], g_nButPos[i][3], param, !g_nButPosFull[i][4]);
  817. }/* end of for loop */
  818. for (i=0; i<=g_nNumButs; i++) {
  819. // add scriptlet creates the engine
  820. // and all the objects need to be loaded before creating the engine
  821. MFBar.HookScriptlet(g_strButID[i], "OnClick", g_pButCallbacks[i]);
  822. MFBar.HookScriptlet(g_strButID[i]+"Full", "OnClick", g_pButCallbacks[i]);
  823. }/* end of if statement */
  824. for (i = 5; i<=7; i++)
  825. {
  826. // Create the text box for windowed mode
  827. param1 = "<PARAM NAME=\"BackColor\" VALUE=\"1048592\">";
  828. param1 += "<PARAM NAME=\"Windowless\" VALUE=\"-1\">";
  829. MFBar.CreateObject(g_strButID[g_nNumButs+i], "MSMFCnt.MSMFText",
  830. g_nButPos[g_nNumButs+i][0], g_nButPos[g_nNumButs+i][1]+yOffset,
  831. g_nButPos[g_nNumButs+i][2], g_nButPos[g_nNumButs+i][3], param1, false);
  832. // Create the text box for full screen mode
  833. param1 = "<PARAM NAME=\"BackColor\" VALUE=\"1048592\">";
  834. param1 += "<PARAM NAME=\"Windowless\" VALUE=\"0\">";
  835. MFBar.CreateObject(g_strButID[g_nNumButs+i]+"Full", "MSMFCnt.MSMFText",
  836. g_nButPos[g_nNumButs+i][0], g_nButPos[g_nNumButs+i][1] - 1000,
  837. g_nButPosFull[g_nNumButs+i][2], g_nButPosFull[g_nNumButs+i][3], param1, false);
  838. }
  839. MFBar.HookScriptlet("MFBar", "TimeOut(id)", "OnMessageTimeOut(id)");
  840. for (i=1; i<=4; i++) {
  841. param1 = "<PARAM NAME=\"ResourceDLL\" VALUE=\"" + MFBar.ResourceDll + "\">";
  842. param1 += "<PARAM NAME=\"BackStatic\" VALUE=";
  843. param1 += g_strSldrImage[i-1][0] + ">";
  844. param1 += "<PARAM NAME=\"BackHover\" VALUE=";
  845. param1 += g_strSldrImage[i-1][0] + ">";
  846. param1 += "<PARAM NAME=\"BackPush\" VALUE=";
  847. param1 += g_strSldrImage[i-1][0] + ">";
  848. param1 += "<PARAM NAME=\"ThumbStatic\" VALUE=";
  849. param1 += g_strSldrImage[i-1][1] + ">";
  850. param1 += "<PARAM NAME=\"ThumbHover\" VALUE=";
  851. param1 += g_strSldrImage[i-1][1] + ">";
  852. param1 += "<PARAM NAME=\"ThumbPush\" VALUE=";
  853. param1 += g_strSldrImage[i-1][1] + ">";
  854. param1 += "<PARAM NAME=\"BackColor\" VALUE=\"1048592\">";
  855. // Create the slider bars for windowed mode
  856. param = param1 + "<PARAM NAME=\"Windowless\" VALUE=\"-1\">";
  857. MFBar.CreateObject(g_strButID[g_nNumButs+i], "MSMFCnt.MSMFSldr",
  858. g_nButPos[g_nNumButs+i][0], g_nButPos[g_nNumButs+i][1]+yOffset,
  859. g_nButPos[g_nNumButs+i][2], g_nButPos[g_nNumButs+i][3], param);
  860. // Create the slider bars for full screen mode
  861. param = param1 + "<PARAM NAME=\"Windowless\" VALUE=\"0\">";
  862. MFBar.CreateObject(g_strButID[g_nNumButs+i]+"Full", "MSMFCnt.MSMFSldr",
  863. g_nButPos[g_nNumButs+i][0], g_nButPos[g_nNumButs+i][1] - 1000,
  864. g_nButPosFull[g_nNumButs+i][2], g_nButPosFull[g_nNumButs+i][3], param);
  865. }
  866. MFBar.HookScriptlet("TimeSlider", "OnValueChange(x)", "OnTimeSliderUpdate(x)");
  867. MFBar.HookScriptlet("TimeSlider", "OnClick()", "OnTimeSliderClick()");
  868. MFBar.HookScriptlet("TimeSlider", "OnMouseUp()", "OnTimeMouseUp()");
  869. MFBar.HookScriptlet("TimeSlider", "OnMouseDown()", "OnTimeMouseDown()");
  870. MFBar.HookScriptlet("TimeSliderFull", "OnValueChange(x)", "OnTimeSliderUpdate(x)");
  871. MFBar.HookScriptlet("TimeSliderFull", "OnClick()", "OnTimeSliderClick()");
  872. MFBar.HookScriptlet("TimeSliderFull", "OnMouseUp()", "OnTimeMouseUp()");
  873. MFBar.HookScriptlet("TimeSliderFull", "OnMouseDown()", "OnTimeMouseDown()");
  874. MFBar.HookScriptlet("PlaySpeed", "OnValueChange(x)", "OnSpeedSliderUpdate(x)");
  875. MFBar.HookScriptlet("PlaySpeed", "OnMouseUp()", "OnSpeedSliderMouseUp()");
  876. MFBar.HookScriptlet("PlaySpeedFull", "OnValueChange(x)", "OnSpeedSliderUpdate(x)");
  877. MFBar.HookScriptlet("PlaySpeedFull", "OnMouseUp()", "OnSpeedSliderMouseUp()");
  878. MFBar.HookScriptlet("VolSlider", "OnValueChange(x)", "OnVolUpdate(x)");
  879. MFBar.HookScriptlet("VolSliderFull", "OnValueChange(x)", "OnVolUpdate(x)");
  880. // set the size beyond which we do not extend
  881. MFBar.MinWidth = g_MinWidth;
  882. MFBar.MinHeight = g_MinHeight;
  883. g_InitializationState = 1;
  884. Init();
  885. }
  886. catch(e) {
  887. e.description = L_ERRORFailCreatingObject_TEXT;
  888. HandleError(e, true);
  889. return;
  890. }
  891. }/* end of function CreateObjects */
  892. /*************************************************************************/
  893. /* Function: HookDVDOptEv */
  894. /* Description: Hooks events at the time when the object is being created*/
  895. /*************************************************************************/
  896. function HookDVDOptEv(){
  897. try {
  898. MFBar.HookScriptlet("DVDOpt", "OnOpen()", "OnOptOpen()");
  899. MFBar.HookScriptlet("DVDOpt", "OnClose()", "OnOptClose()");
  900. MFBar.HookScriptlet("DVDOpt", "OnHelp(strObjectID)", "OnOptHelp(strObjectID)");
  901. }
  902. catch(e) {
  903. e.description = L_ERRORUnexpectedError_TEXT;
  904. HandleError(e);
  905. return;
  906. }
  907. }/* end of function HookDVDOptEv */
  908. /*************************************************************************/
  909. /* Function: HookDVDEv */
  910. /*************************************************************************/
  911. function HookDVDEv(){
  912. try {
  913. MFBar.HookScriptlet("DVD", "ReadyStateChange(state)", "OnReadyStateChange(state)");
  914. MFBar.HookScriptlet("DVD", "DVDNotify(event, param1, param2)", "ProcessDVDEvent(event, param1, param2)");
  915. MFBar.HookScriptlet("DVD", "PlayForwards(bEnabled)", "ProcessPFEvent(bEnabled)");
  916. MFBar.HookScriptlet("DVD", "PlayBackwards(bEnabled)", "ProcessPBEvent(bEnabled)");
  917. MFBar.HookScriptlet("DVD", "ShowMenu(bEnabled)", "ProcessShowMenuEvent(bEnabled)");
  918. MFBar.HookScriptlet("DVD", "Resume(bEnabled)", "ProcessResumeEvent(bEnabled)");
  919. MFBar.HookScriptlet("DVD", "ChangeCurrentAudioStream(bEnabled)", "ProcessAudEvent(bEnabled)");
  920. MFBar.HookScriptlet("DVD", "ChangeCurrentSubpictureStream(bEnabled)", "ProcessSPEvent(bEnabled)");
  921. MFBar.HookScriptlet("DVD", "ChangeCurrentAngle(bEnabled)", "ProcessAngleEvent(bEnabled)");
  922. MFBar.HookScriptlet("DVD", "PlayAtTimeInTitle(bEnabled)", "ProcessTimePlayEvent(bEnabled)");
  923. MFBar.HookScriptlet("DVD", "PlayAtTime(bEnabled)", "ProcessTimePlayEvent(bEnabled)");
  924. MFBar.HookScriptlet("DVD", "PlayChapterInTitle(bEnabled)", "ProcessChapterPlayEvent(bEnabled)");
  925. MFBar.HookScriptlet("DVD", "PlayChapter(bEnabled)", "ProcessChapterSearchEvent(bEnabled)");
  926. MFBar.HookScriptlet("DVD", "StillOff(bEnabled)", "ProcessStillOff(bEnabled)");
  927. MFBar.HookScriptlet("MFBar", "OnResize(lWidth, lHeight, lCode)", "OnResize(lWidth, lHeight, lCode)");
  928. MFBar.HookScriptlet("MFBar", "OnHelp(strObjectID)", "OnBarHelp(strObjectID)");
  929. MFBar.HookScriptlet("MFBar", "ActivityStarted()", "ActivityStarted()");
  930. MFBar.HookScriptlet("MFBar", "ActivityDeclined()", "ActivityDeclined()");
  931. // hook up maximize when double clicking
  932. MFBar.HookScriptlet("MFBar", "OnDblClick()", "max_OnClick()");
  933. MFBar.HookScriptlet("MFBar", "OnKeyDown(lVirtKey, lKeyData)", "OnKeyDown(lVirtKey, lKeyData)");
  934. MFBar.HookScriptlet("MFBar", "OnKeyUp(lVirtKey, lKeyData)", "OnKeyUp(lVirtKey, lKeyData)");
  935. MFBar.HookScriptlet("MFBar", "OnSysKeyUp(lVirtKey, lKeyData)", "OnSysKeyUp(lVirtKey, lKeyData)");
  936. }
  937. catch(e) {
  938. e.description = L_ERRORUnexpectedError_TEXT;
  939. HandleError(e);
  940. return;
  941. }
  942. }/* end of function HookDVDEv */
  943. /*************************************************************************/
  944. /* Function: Init */
  945. /* Description: Calls the DVD direct show interfaces to set a certain */
  946. /* chapter. */
  947. /*************************************************************************/
  948. function Init(){
  949. try {
  950. if(1 != g_InitializationState){
  951. return; // already we have initialized
  952. }/* end of if statement */
  953. if(4 != DVD.ReadyState){ // READYSTATE_COMPLETE = 4
  954. // DVD is not initialized yet wait..
  955. DVD.About();
  956. return;
  957. }/* end of if statement */
  958. // Hack for full screen windowed buttons tooltips
  959. for (i=0; i<=g_nNumButs; i++) {
  960. btn = MFBar.GetObjectUnknown(g_strButID[i]+"Full");
  961. btn.ToolTip = g_strButTT[i];
  962. }
  963. PlaySpeed.Min = -16;
  964. PlaySpeed.Max = 16;
  965. PlaySpeed.Value = 1;
  966. PlaySpeedFull.Min = -16;
  967. PlaySpeedFull.Max = 16;
  968. PlaySpeedFull.Value = 1;
  969. VolSlider.Min = 0;
  970. VolSlider.Max = 1;
  971. VolSlider.Value = 1;
  972. VolSliderFull.Min = 0;
  973. VolSliderFull.Max = 1;
  974. VolSliderFull.Value = 1;
  975. if (!g_LocaleEnglish)
  976. {
  977. Menu.Text = L_ButtonTextMenu_TEXT;
  978. Menu.FontFace = L_ButtonFontFace_TEXT;
  979. Menu.FontSize = L_ButtonFontSize_NUMBER;
  980. Menu.ColorActive = g_TextColorActive;
  981. Menu.ColorHover = g_TextColorHover;
  982. Menu.ColorPush = g_TextColorDown;
  983. Menu.ColorDisable = g_TextColorDisabled;
  984. Menu.ColorStatic = g_TextColorStatic;
  985. Resume.Text = L_ButtonTextResume_TEXT;
  986. Resume.FontFace = L_ButtonFontFace_TEXT;
  987. Resume.FontSize = L_ButtonFontSize_NUMBER;
  988. Resume.ColorActive = g_TextColorActive;
  989. Resume.ColorHover = g_TextColorHover;
  990. Resume.ColorPush = g_TextColorDown;
  991. Resume.ColorDisable = g_TextColorDisabled;
  992. Resume.ColorStatic = g_TextColorStatic;
  993. EnCC.Text = L_ButtonTextEnCC_TEXT;
  994. EnCC.FontFace = L_ButtonFontFace_TEXT;
  995. EnCC.FontSize = L_ButtonFontSize_NUMBER;
  996. EnCC.ColorActive = g_TextColorActive;
  997. EnCC.ColorHover = g_TextColorHover;
  998. EnCC.ColorPush = g_TextColorDown;
  999. EnCC.ColorDisable = g_TextColorDisabled;
  1000. EnCC.ColorStatic = g_TextColorStatic;
  1001. DiCC.Text = L_ButtonTextDiCC_TEXT;
  1002. DiCC.FontFace = L_ButtonFontFace_TEXT;
  1003. DiCC.FontSize = L_ButtonFontSize_NUMBER;
  1004. DiCC.ColorActive = g_TextColorActive;
  1005. DiCC.ColorHover = g_TextColorHover;
  1006. DiCC.ColorPush = g_TextColorDown;
  1007. DiCC.ColorDisable = g_TextColorDisabled;
  1008. DiCC.ColorStatic = g_TextColorStatic;
  1009. Subtitles.Text = L_ButtonTextSubtitle_TEXT;
  1010. Subtitles.FontFace = L_ButtonFontFace_TEXT;
  1011. Subtitles.FontSize = L_ButtonFontSize_NUMBER;
  1012. Subtitles.ColorActive = g_TextColorActive;
  1013. Subtitles.ColorHover = g_TextColorHover;
  1014. Subtitles.ColorPush = g_TextColorDown;
  1015. Subtitles.ColorDisable = g_TextColorDisabled;
  1016. Subtitles.ColorStatic = g_TextColorStatic;
  1017. Audio.Text = L_ButtonTextAudio_TEXT;
  1018. Audio.FontFace = L_ButtonFontFace_TEXT;
  1019. Audio.FontSize = L_ButtonFontSize_NUMBER;
  1020. Audio.ColorActive = g_TextColorActive;
  1021. Audio.ColorHover = g_TextColorHover;
  1022. Audio.ColorPush = g_TextColorDown;
  1023. Audio.ColorDisable = g_TextColorDisabled;
  1024. Audio.ColorStatic = g_TextColorStatic;
  1025. Angles.Text = L_ButtonTextAngle_TEXT;
  1026. Angles.FontFace = L_ButtonFontFace_TEXT;
  1027. Angles.FontSize = L_ButtonFontSize_NUMBER;
  1028. Angles.ColorActive = g_TextColorActive;
  1029. Angles.ColorHover = g_TextColorHover;
  1030. Angles.ColorPush = g_TextColorDown;
  1031. Angles.ColorDisable = g_TextColorDisabled;
  1032. Angles.ColorStatic = g_TextColorStatic;
  1033. Options.Text = L_ButtonTextOptions_TEXT;
  1034. Options.FontFace = L_ButtonFontFace_TEXT;
  1035. Options.FontSize = L_ButtonFontSize_NUMBER;
  1036. Options.ColorActive = g_TextColorActive;
  1037. Options.ColorHover = g_TextColorHover;
  1038. Options.ColorPush = g_TextColorDown;
  1039. Options.ColorDisable = g_TextColorDisabled;
  1040. Options.ColorStatic = g_TextColorStatic;
  1041. // full screen version
  1042. MenuFull.Text = L_ButtonTextMenu_TEXT;
  1043. MenuFull.FontFace = L_ButtonFontFace_TEXT;
  1044. MenuFull.FontSize = L_ButtonFontSize_NUMBER;
  1045. MenuFull.ColorActive = g_TextColorActive;
  1046. MenuFull.ColorHover = g_TextColorHover;
  1047. MenuFull.ColorPush = g_TextColorDown;
  1048. MenuFull.ColorDisable = g_TextColorDisabled;
  1049. MenuFull.ColorStatic = g_TextColorStatic;
  1050. ResumeFull.Text = L_ButtonTextResume_TEXT;
  1051. ResumeFull.FontFace = L_ButtonFontFace_TEXT;
  1052. ResumeFull.FontSize = L_ButtonFontSize_NUMBER;
  1053. ResumeFull.ColorActive = g_TextColorActive;
  1054. ResumeFull.ColorHover = g_TextColorHover;
  1055. ResumeFull.ColorPush = g_TextColorDown;
  1056. ResumeFull.ColorDisable = g_TextColorDisabled;
  1057. ResumeFull.ColorStatic = g_TextColorStatic;
  1058. EnCCFull.Text = L_ButtonTextEnCC_TEXT;
  1059. EnCCFull.FontFace = L_ButtonFontFace_TEXT;
  1060. EnCCFull.FontSize = L_ButtonFontSize_NUMBER;
  1061. EnCCFull.ColorActive = g_TextColorActive;
  1062. EnCCFull.ColorHover = g_TextColorHover;
  1063. EnCCFull.ColorPush = g_TextColorDown;
  1064. EnCCFull.ColorDisable = g_TextColorDisabled;
  1065. EnCCFull.ColorStatic = g_TextColorStatic;
  1066. DiCCFull.Text = L_ButtonTextDiCC_TEXT;
  1067. DiCCFull.FontFace = L_ButtonFontFace_TEXT;
  1068. DiCCFull.FontSize = L_ButtonFontSize_NUMBER;
  1069. DiCCFull.ColorActive = g_TextColorActive;
  1070. DiCCFull.ColorHover = g_TextColorHover;
  1071. DiCCFull.ColorPush = g_TextColorDown;
  1072. DiCCFull.ColorDisable = g_TextColorDisabled;
  1073. DiCCFull.ColorStatic = g_TextColorStatic;
  1074. SubtitlesFull.Text = L_ButtonTextSubtitle_TEXT;
  1075. SubtitlesFull.FontFace = L_ButtonFontFace_TEXT;
  1076. SubtitlesFull.FontSize = L_ButtonFontSize_NUMBER;
  1077. SubtitlesFull.ColorActive = g_TextColorActive;
  1078. SubtitlesFull.ColorHover = g_TextColorHover;
  1079. SubtitlesFull.ColorPush = g_TextColorDown;
  1080. SubtitlesFull.ColorDisable = g_TextColorDisabled;
  1081. SubtitlesFull.ColorStatic = g_TextColorStatic;
  1082. AudioFull.Text = L_ButtonTextAudio_TEXT;
  1083. AudioFull.FontFace = L_ButtonFontFace_TEXT;
  1084. AudioFull.FontSize = L_ButtonFontSize_NUMBER;
  1085. AudioFull.ColorActive = g_TextColorActive;
  1086. AudioFull.ColorHover = g_TextColorHover;
  1087. AudioFull.ColorPush = g_TextColorDown;
  1088. AudioFull.ColorDisable = g_TextColorDisabled;
  1089. AudioFull.ColorStatic = g_TextColorStatic;
  1090. AnglesFull.Text = L_ButtonTextAngle_TEXT;
  1091. AnglesFull.FontFace = L_ButtonFontFace_TEXT;
  1092. AnglesFull.FontSize = L_ButtonFontSize_NUMBER;
  1093. AnglesFull.ColorActive = g_TextColorActive;
  1094. AnglesFull.ColorHover = g_TextColorHover;
  1095. AnglesFull.ColorPush = g_TextColorDown;
  1096. AnglesFull.ColorDisable = g_TextColorDisabled;
  1097. AnglesFull.ColorStatic = g_TextColorStatic;
  1098. OptionsFull.Text = L_ButtonTextOptions_TEXT;
  1099. OptionsFull.FontFace = L_ButtonFontFace_TEXT;
  1100. OptionsFull.FontSize = L_ButtonFontSize_NUMBER;
  1101. OptionsFull.ColorActive = g_TextColorActive;
  1102. OptionsFull.ColorHover = g_TextColorHover;
  1103. OptionsFull.ColorPush = g_TextColorDown;
  1104. OptionsFull.ColorDisable = g_TextColorDisabled;
  1105. OptionsFull.ColorStatic = g_TextColorStatic;
  1106. // stretch button size to fit text
  1107. if (Subtitles.TextWidth > g_nButPos[g_nIndexSubtitle][2])
  1108. {
  1109. g_nButPos[g_nIndexSubtitle][2] = Subtitles.TextWidth;
  1110. }
  1111. if (SubtitlesFull.TextWidth > g_nButPosFull[g_nIndexSubtitle][2])
  1112. {
  1113. g_nButPosFull[g_nIndexSubtitle][2] = SubtitlesFull.TextWidth;
  1114. }
  1115. if (Audio.TextWidth > g_nButPos[g_nIndexAudio][2])
  1116. {
  1117. g_nButPos[g_nIndexAudio][2] = Audio.TextWidth;
  1118. }
  1119. if (AudioFull.TextWidth > g_nButPosFull[g_nIndexAudio][2])
  1120. {
  1121. g_nButPosFull[g_nIndexAudio][2] = AudioFull.TextWidth;
  1122. }
  1123. if (Angles.TextWidth > g_nButPos[g_nIndexAngle][2])
  1124. {
  1125. g_nButPos[g_nIndexAngle][2] = Angles.TextWidth;
  1126. }
  1127. if (AnglesFull.TextWidth > g_nButPosFull[g_nIndexAngle][2])
  1128. {
  1129. g_nButPosFull[g_nIndexAngle][2] = AnglesFull.TextWidth;
  1130. }
  1131. if (Options.TextWidth > g_nButPos[g_nIndexOptions][2])
  1132. {
  1133. g_nButPos[g_nIndexOptions][2] = Options.TextWidth;
  1134. }
  1135. if (OptionsFull.TextWidth > g_nButPosFull[g_nIndexOptions][2])
  1136. {
  1137. g_nButPosFull[g_nIndexOptions][2] = OptionsFull.TextWidth;
  1138. }
  1139. // oval buttons need a bit more margin
  1140. var nOvalMargin = 10;
  1141. var nCCTextWidth = Math.max(EnCC.TextWidth, DiCC.TextWidth) + nOvalMargin;
  1142. if (nCCTextWidth > g_nButPos[g_nIndexEnCC][2])
  1143. {
  1144. g_nButPos[g_nIndexEnCC][2] = nCCTextWidth;
  1145. g_nButPos[g_nIndexDiCC][2] = nCCTextWidth;
  1146. }
  1147. if (nCCTextWidth > g_nButPosFull[g_nIndexEnCC][2])
  1148. {
  1149. g_nButPosFull[g_nIndexEnCC][2] = nCCTextWidth;
  1150. g_nButPosFull[g_nIndexDiCC][2] = nCCTextWidth;
  1151. }
  1152. var nMenuTextWidth = Math.max(Menu.TextWidth, Resume.TextWidth) + nOvalMargin;
  1153. if (nMenuTextWidth > g_nButPos[g_nIndexMenu][2])
  1154. {
  1155. g_nButPos[g_nIndexMenu][2] = nMenuTextWidth;
  1156. g_nButPos[g_nIndexResume][2] = nMenuTextWidth;
  1157. }
  1158. if (nMenuTextWidth > g_nButPosFull[g_nIndexMenu][2])
  1159. {
  1160. g_nButPosFull[g_nIndexMenu][2] = nMenuTextWidth;
  1161. g_nButPosFull[g_nIndexResume][2] = nMenuTextWidth;
  1162. }
  1163. }
  1164. TextBox.EdgeStyle = "Sunken";
  1165. TextBox.FontFace = L_TextBoxFontFace_TEXT;
  1166. TextBox.FontSize = L_TextBoxFontSize_NUMBER;
  1167. TextBox.Text = L_HHMMSS_TEXT.replace(/%1/i, "00").replace(/%2/i, "00").replace(/%3/i, "00");
  1168. TextBox.BackColor = 0xc9ad98;
  1169. TextBox.ColorStatic = 0x0f0f0f;
  1170. TextBox.ColorHover = 0x0f0f0f;
  1171. TextBoxFull.EdgeStyle = "Sunken";
  1172. TextBoxFull.FontFace = L_TextBoxFontFace_TEXT;
  1173. TextBoxFull.FontSize = L_TextBoxFontSize_NUMBER;
  1174. TextBoxFull.Text = L_HHMMSS_TEXT.replace(/%1/i, "00").replace(/%2/i, "00").replace(/%3/i, "00");
  1175. TextBoxFull.BackColor = 0xc9ad98;
  1176. TextBoxFull.ColorStatic = 0x0f0f0f;
  1177. TextBoxFull.ColorHover = 0x0f0f0f;
  1178. Title.FontSize = L_TitleFontSize_NUMBER;
  1179. Title.FontFace = L_TitleFontFace_TEXT;
  1180. Title.Text = L_DVDPlayer_TEXT;
  1181. Title.BackColor = 0xc9ad98;
  1182. Title.ColorStatic = 0x0f0f0f;
  1183. Title.ColorHover = 0x0f0f0f;
  1184. TitleFull.FontSize = L_TitleFontSize_NUMBER;
  1185. TitleFull.FontFace = L_TitleFontFace_TEXT;
  1186. TitleFull.Text = L_DVDPlayer_TEXT;
  1187. TitleFull.BackColor = 0x100010;
  1188. TitleFull.ColorStatic = 0xf0f0f0;
  1189. TitleFull.ColorHover = 0xf0f0f0;
  1190. Message.FontSize = L_TitleFontSize_NUMBER;
  1191. Message.FontFace = L_TitleFontFace_TEXT;
  1192. Message.BackColor = 0xc9ad98;
  1193. Message.ColorStatic = 0x0f0f0f;
  1194. Message.ColorHover = 0x0f0f0f;
  1195. MessageFull.FontSize = L_TitleFontSize_NUMBER;
  1196. MessageFull.FontFace = L_TitleFontFace_TEXT;
  1197. MessageFull.BackColor = 0x100010;
  1198. MessageFull.ColorStatic = 0xf0f0f0;
  1199. MessageFull.ColorHover = 0xf0f0f0;
  1200. OnMessageTimeOut(DVDMSGTIMER);
  1201. DVD.BackColor = 0x100010;
  1202. MFBar.EnableObject("MFBar", true);
  1203. MFBar.SetObjectExtent("MFBar", g_ConWidth + 2, g_ConHeight +2);
  1204. try {
  1205. DVD.Render();
  1206. }
  1207. catch(e) {
  1208. // use the error description from Render
  1209. HandleError(e);
  1210. return;
  1211. }
  1212. if("" != MFBar.CmdLine){
  1213. DVD.DVDDirectory = MFBar.CmdLine + "VIDEO_TS";
  1214. }/* end of if statement */
  1215. DVD.NotifyParentalLevelChange(true);
  1216. DVDOpt.WebDVD = DVD;
  1217. DVDOpt.ParentWindow = MFBar.Window;
  1218. if(false){
  1219. var rect = new ActiveXObject("MSWebDVD.DVDRect.1");
  1220. rect = DVD.GetVideoSize();
  1221. g_ConWidth = rect.Width+24;
  1222. g_ConHeight = rect.Height+g_ButHeight+30;
  1223. }/* end of if statement */
  1224. // update the initial volume position on the slider
  1225. try {
  1226. VolSlider.Value = ConvertFromDB(DVD.Volume);
  1227. VolSliderFull.Value = ConvertFromDB(DVD.Volume);
  1228. }
  1229. catch(e){
  1230. VolSlider.Disable = true;
  1231. VolSliderFull.Disable = true;
  1232. Mute.Disable = true;
  1233. MuteFull.Disable = true;
  1234. Sound.Disable = true;
  1235. SoundFull.Disable = true;
  1236. }
  1237. g_InitializationState = 2;
  1238. MFBar.EnableObject("DVD", true);
  1239. Run();
  1240. }
  1241. catch(e) {
  1242. e.description = L_ERROR_UnexpectedError_TEXT;
  1243. HandleError(e);
  1244. return;
  1245. }
  1246. }/* end of function Init */
  1247. /*************************************************************/
  1248. /* Function: Run */
  1249. /*************************************************************/
  1250. function Run(){
  1251. try {
  1252. if(3 == g_InitializationState){
  1253. return; // already we have initialized
  1254. }/* end of if statement */
  1255. DVD.Play();
  1256. MFBar.EnableObject("Splash", false);
  1257. try {
  1258. // restores the DVD state
  1259. if (DVD.DVDAdm.BookmarkOnClose)
  1260. DVD.RestoreState();
  1261. }
  1262. catch(e) {
  1263. }
  1264. g_InitializationState = 3; // already done the run
  1265. }
  1266. catch(e) {
  1267. e.description = L_ERRORUnexpectedError_TEXT;
  1268. HandleError(e);
  1269. return;
  1270. }
  1271. }/* end of function Run */
  1272. /*************************************************************/
  1273. /* Name: OnReadyStateChange */
  1274. /* Description: Handles ready state changes of the control. */
  1275. /*************************************************************/
  1276. function OnReadyStateChange(state){
  1277. try {
  1278. return;
  1279. // READYSTATE_COMPLETE = 4
  1280. if (4 == state){
  1281. Init();
  1282. Run();
  1283. }/* end of if statement */
  1284. }
  1285. catch(e) {
  1286. e.description = L_ERRORUnexpectedError_TEXT;
  1287. HandleError(e);
  1288. return;
  1289. }
  1290. }/* end of function OnReadyStateChange */
  1291. /*************************************************************/
  1292. /* Name: OnResize */
  1293. /* Description: Handles resizing of the control. */
  1294. /*************************************************************/
  1295. function OnResize(lWidth, lHeight, lCode){
  1296. try {
  1297. // if minimized
  1298. if (lCode == 1)
  1299. return;
  1300. var bFullScreen = (lCode==2)? true:false;
  1301. yOffset = lHeight - g_ButHeight - 8;
  1302. PositionButtons(lWidth, lHeight, bFullScreen);
  1303. for (i = 0; i <= g_nNumButs+5; i++) {
  1304. if (g_nButPos[i][6] != 0)
  1305. {
  1306. xPos = g_nButPos[i][0];
  1307. yPos = g_nButPos[i][1] + yOffset;
  1308. }
  1309. else if (g_LTRReading)
  1310. {
  1311. xPos = lWidth - g_nButPos[i][0] - g_nButPos[i][2];
  1312. yPos = g_nButPos[i][1];
  1313. }
  1314. else
  1315. {
  1316. xPos = g_nButPos[i][0];
  1317. yPos = g_nButPos[i][1];
  1318. }
  1319. if (bFullScreen) {
  1320. MFBar.SetObjectPosition(g_strButID[i]+"Full", xPos, yPos,
  1321. g_nButPosFull[i][2], g_nButPosFull[i][3]);
  1322. // if previously windowed
  1323. if (g_bFullScreen == false || g_bFirstPlaying)
  1324. MFBar.SetObjectPosition(g_strButID[i], xPos, yPos - 1000,
  1325. g_nButPos[i][2], g_nButPos[i][3]);
  1326. }
  1327. else {
  1328. MFBar.SetObjectPosition(g_strButID[i], xPos, yPos,
  1329. g_nButPos[i][2], g_nButPos[i][3]);
  1330. // if previously full screen
  1331. if (g_bFullScreen == true || g_bFirstPlaying)
  1332. MFBar.SetObjectPosition(g_strButID[i]+"Full", xPos, yPos - 1000,
  1333. g_nButPosFull[i][2], g_nButPosFull[i][3]);
  1334. }
  1335. }
  1336. if (g_ConWidth == lWidth && g_ConHeight == lHeight)
  1337. return;
  1338. if (bFullScreen) {
  1339. MFBar.EnableObject("MaximizeFull", false);
  1340. MFBar.EnableObject("RestoreFull", true);
  1341. MFBar.SetObjectPosition("DVD", 0, 0, lWidth, lHeight);
  1342. MFBar.SetObjectPosition("Splash", 0, 0, lWidth, lHeight);
  1343. MFBar.SetRectRgn(0, 0, lWidth, lHeight);
  1344. // if previously windowed
  1345. if (g_bFullScreen == false || g_bFirstPlaying) {
  1346. g_bFullScreen = true;
  1347. SetupFocus();
  1348. SetFocus("Restore");
  1349. }
  1350. }
  1351. else {
  1352. MFBar.EnableObject("Maximize", true);
  1353. MFBar.EnableObject("Restore", false);
  1354. MFBar.SetObjectPosition("DVD", 12, 30, lWidth-24, yOffset-30);
  1355. MFBar.SetObjectPosition("Splash", 12, 30, lWidth-24, yOffset-30);
  1356. MFBar.SetRoundRectRgn(0, 0, lWidth, lHeight, 16, 16);
  1357. // if previously full screen
  1358. if (g_bFullScreen == true || g_bFirstPlaying) {
  1359. g_bFullScreen = false;
  1360. SetupFocus();
  1361. SetFocus("Maximize");
  1362. }
  1363. }
  1364. g_ConWidth = lWidth;
  1365. g_ConHeight = lHeight;
  1366. g_bFullScreen = bFullScreen;
  1367. UpdateDVDTitle();
  1368. }
  1369. catch(e) {
  1370. e.description = L_ERRORResize_TEXT;
  1371. HandleError(e);
  1372. return;
  1373. }
  1374. }/* end of function OnResize */
  1375. /*************************************************************/
  1376. /* Name: OnBarHelp */
  1377. /* Description: Handles */
  1378. /*************************************************************/
  1379. function OnBarHelp(strObjectID)
  1380. {
  1381. try {
  1382. TextBox.Text = strObjectID;
  1383. MFBar.WinHelp(8, 131375, "dvdplay.hlp");
  1384. }
  1385. catch(e) {
  1386. e.description = L_ERRORHelp_TEXT;
  1387. HandleError(e);
  1388. return;
  1389. }
  1390. }/* end of function OnBarHelp */
  1391. /*************************************************************/
  1392. /* Name: OnOptHelp */
  1393. /* Description: Handles */
  1394. /*************************************************************/
  1395. function OnOptHelp(strObjectID)
  1396. {
  1397. try {
  1398. TextBox.Text = strObjectID;
  1399. MFBar.WinHelp(8, 131375, "dvdplay.hlp");
  1400. }
  1401. catch(e) {
  1402. e.description = L_ERRORHelp_TEXT;
  1403. HandleError(e);
  1404. return;
  1405. }
  1406. }/* end of function OnOptHelp */
  1407. /*************************************************************/
  1408. /* Name: GetTimeSliderBstr
  1409. /* Description:
  1410. /*************************************************************/
  1411. function GetTimeSliderBstr()
  1412. {
  1413. try {
  1414. nDomain = DVD.CurrentDomain;
  1415. if (nDomain == 2 || nDomain == 3)
  1416. return;
  1417. if (g_bFullScreen)
  1418. percent = TimeSliderFull.Value;
  1419. else
  1420. percent = TimeSlider.Value;
  1421. totalTime = DVD.TotalTitleTime;
  1422. totalTimeInSec =
  1423. (new Number(totalTime.charAt(0)))*36000 +
  1424. (new Number(totalTime.charAt(1)))*3600 +
  1425. (new Number(totalTime.charAt(3)))*600 +
  1426. (new Number(totalTime.charAt(4)))*60 +
  1427. (new Number(totalTime.charAt(6)))*10 +
  1428. (new Number(totalTime.charAt(7)));
  1429. seekTimeInSec = totalTimeInSec*percent/100;
  1430. hours10 = Math.floor(seekTimeInSec/36000);
  1431. seekTimeInSec = seekTimeInSec%36000;
  1432. hours1 = Math.floor(seekTimeInSec/3600);
  1433. seekTimeInSec = seekTimeInSec%3600;
  1434. minutes10 = Math.floor(seekTimeInSec/600);
  1435. seekTimeInSec = seekTimeInSec%600;
  1436. minutes1 = Math.floor(seekTimeInSec/60)
  1437. seekTimeInSec = seekTimeInSec%60;
  1438. seconds10 = Math.floor(seekTimeInSec/10);
  1439. seconds1 = Math.floor(seekTimeInSec%10);
  1440. HH = "" + hours10 + hours1;
  1441. MM = "" + minutes10 + minutes1;
  1442. SS = "" + seconds10 + seconds1;
  1443. timeStr = L_HHMMSS_TEXT.replace(/%1/i, HH).replace(/%2/i, MM).replace(/%3/i, SS);
  1444. return timeStr;
  1445. }
  1446. catch(e) {
  1447. e.description = L_ERRORTime_TEXT;
  1448. HandleError(e);
  1449. return;
  1450. }
  1451. }/* end of function GetTimeSliderBstr */
  1452. /*************************************************************/
  1453. /* Name: OnTimeSliderMove */
  1454. /* Description: Update the position info. */
  1455. /*************************************************************/
  1456. function OnTimeSliderUpdate(x)
  1457. {
  1458. //if (g_bTimeUpdate == false) {
  1459. timeStr = GetTimeSliderBstr();
  1460. TextBox.Text = timeStr;
  1461. TextBoxFull.Text = timeStr;
  1462. //}
  1463. }
  1464. /*************************************************************/
  1465. /* Description: Turn on the display updating on */
  1466. /*************************************************************/
  1467. function OnTimeMouseUp(){
  1468. g_bTimeUpdate = true;
  1469. }/* end of function OnTimeMouseUp */
  1470. /*************************************************************/
  1471. /* Description: Turn on the display updating off */
  1472. /*************************************************************/
  1473. function OnTimeMouseDown(){
  1474. g_bTimeUpdate = false;
  1475. }/* end of function OnTimeMouseDown */
  1476. /*************************************************************/
  1477. /* Name: OnTimeSliderClick */
  1478. /* Description: When the mous is release last one takase */
  1479. /*************************************************************/
  1480. function OnTimeSliderClick()
  1481. {
  1482. nDomain = DVD.CurrentDomain;
  1483. if (nDomain == 2 || nDomain == 3)
  1484. return;
  1485. lTitle = DVD.CurrentTitle;
  1486. timeStr = GetTimeSliderBstr();
  1487. DVD.PlayAtTimeInTitle(lTitle, timeStr);
  1488. DVD.PlayForwards(DVDOpt.PlaySpeed);
  1489. }
  1490. /*************************************************************/
  1491. /* Name: cc_Update
  1492. /* Description:
  1493. /*************************************************************/
  1494. function cc_Update() {
  1495. var CCActive = true;
  1496. try {
  1497. CCActive = DVD.CCActive;
  1498. }
  1499. catch(e){
  1500. DisableCCButton();
  1501. return;
  1502. }
  1503. try {
  1504. if (!CCActive) {
  1505. fHadFocus = HasFocus("DiCC");
  1506. MFBar.EnableObject("DiCC", false);
  1507. MFBar.EnableObject("DiCCFull", false);
  1508. MFBar.EnableObject("EnCC", true);
  1509. MFBar.EnableObject("EnCCFull", true);
  1510. EnCC.Disable = false;
  1511. EnCCFull.Disable = false;
  1512. if (fHadFocus)
  1513. SetFocus("EnCC");
  1514. Message.Text = L_CCDisabled_TEXT;
  1515. MessageFull.Text = L_CCDisabled_TEXT;
  1516. }
  1517. else{
  1518. fHadFocus = HasFocus("EnCC");
  1519. MFBar.EnableObject("EnCC", false);
  1520. MFBar.EnableObject("EnCCFull", false);
  1521. MFBar.EnableObject("DiCC", true);
  1522. MFBar.EnableObject("DiCCFull", true);
  1523. DiCC.Disable = false;
  1524. DiCCFull.Disable = false;
  1525. if (fHadFocus)
  1526. SetFocus("DiCC");
  1527. Message.Text = L_CCEnabled_TEXT;
  1528. MessageFull.Text = L_CCEnabled_TEXT;
  1529. }
  1530. MFBar.SetTimeOut(2000, DVDMSGTIMER);
  1531. }
  1532. catch(e) {
  1533. //e.description = L_ERRORUnexpectedError_TEXT;
  1534. //HandleError(e);
  1535. return;
  1536. }
  1537. }/* end of function cc_Update */
  1538. /*************************************************************************/
  1539. /* Function: DisableCCButton */
  1540. /* Description: Disables the CC button if the CC is not working, which */
  1541. /* is case on some decoders. */
  1542. /*************************************************************************/
  1543. function DisableCCButton(){
  1544. EnCC.Disable = true;
  1545. EnCCFull.Disable = true;
  1546. DiCC.Disable = true;
  1547. DiCCFull.Disable = true;
  1548. }/* end of function DisableCCButton */
  1549. /*************************************************************/
  1550. /* Name: pause_OnClick */
  1551. /* Description: OnClick callback for play/pause button */
  1552. /*************************************************************/
  1553. function pause_OnClick()
  1554. {
  1555. try {
  1556. DVD.Pause();
  1557. }
  1558. catch(e) {
  1559. e.description = L_ERRORUnexpectedError_TEXT;
  1560. HandleError(e);
  1561. return;
  1562. }
  1563. }/* end of function pause_OnClick */
  1564. /*************************************************************/
  1565. /* Name: play_OnClick */
  1566. /* Description: OnClick callback for play/pause button */
  1567. /*************************************************************/
  1568. function play_OnClick()
  1569. {
  1570. try {
  1571. nDomain = DVD.CurrentDomain;
  1572. if (nDomain == 5) {
  1573. // Enable all DVD UI
  1574. DisableDVDUI(false);
  1575. }
  1576. if (g_bRestoreNeeded) {
  1577. MFBar.EnableObject("Splash", false);
  1578. MFBar.EnableObject("DVD", true);
  1579. }
  1580. DVD.Play();
  1581. if (g_bStillOn) {
  1582. try {
  1583. DVD.StillOff();
  1584. }
  1585. catch(e) {
  1586. }
  1587. }
  1588. try {
  1589. // restores the DVD state
  1590. if (g_bRestoreNeeded) {
  1591. if (DVD.DVDAdm.BookmarkOnStop)
  1592. DVD.RestoreState();
  1593. }
  1594. DVD.PlayForwards(DVDOpt.PlaySpeed);
  1595. }
  1596. catch(e) {
  1597. }
  1598. }
  1599. catch(e) {
  1600. e.description = L_ERRORUnexpectedError_TEXT;
  1601. HandleError(e);
  1602. return;
  1603. }
  1604. }/* end of function play_OnClick */
  1605. /*************************************************************/
  1606. /* Name: fwd_OnClick */
  1607. /* Description: OnClick callback for forward button */
  1608. /*************************************************************/
  1609. function fwd_OnClick()
  1610. {
  1611. try {
  1612. DVD.PlayForwards(DVDOpt.ForwardScanSpeed);
  1613. }
  1614. catch(e) {
  1615. e.description = L_ERRORUnexpectedError_TEXT;
  1616. HandleError(e);
  1617. return;
  1618. }
  1619. }/* end of function fwd_OnClick */
  1620. /*************************************************************/
  1621. /* Name: rew_OnClick */
  1622. /* Description: OnClick callback for rewind button */
  1623. /*************************************************************/
  1624. function rew_OnClick()
  1625. {
  1626. try {
  1627. DVD.PlayBackwards(DVDOpt.BackwardScanSpeed);
  1628. }
  1629. catch(e) {
  1630. e.description = L_ERRORUnexpectedError_TEXT;
  1631. HandleError(e);
  1632. return;
  1633. }
  1634. }/* end of function rew_OnClick */
  1635. /*************************************************************/
  1636. /* Name: mute_OnClick */
  1637. /* Description: OnClick callback for rewind button */
  1638. /*************************************************************/
  1639. function mute_OnClick()
  1640. {
  1641. try {
  1642. DVD.Mute = true;
  1643. }
  1644. catch(e) {
  1645. //HandleError(e);
  1646. Mute.Disable = true;
  1647. MuteFull.Disable = true;
  1648. Sound.Disable = true;
  1649. SoundFull.Disable = true;
  1650. return;
  1651. }
  1652. try {
  1653. MFBar.EnableObject("Mute", false);
  1654. MFBar.EnableObject("MuteFull", false);
  1655. MFBar.EnableObject("Sound", true);
  1656. MFBar.EnableObject("SoundFull", true);
  1657. SetFocus("Sound");
  1658. }
  1659. catch (e) {
  1660. e.description = L_ERRORUnexpectedError_TEXT;
  1661. HandleError(e);
  1662. return;
  1663. }
  1664. }/* end of function mute_OnClick */
  1665. /*************************************************************/
  1666. /* Name: sound_OnClick */
  1667. /* Description: OnClick callback for rewind button */
  1668. /*************************************************************/
  1669. function sound_OnClick()
  1670. {
  1671. try {
  1672. DVD.Mute = false;
  1673. }
  1674. catch(e) {
  1675. //HandleError(e);
  1676. Mute.Disable = true;
  1677. MuteFull.Disable = true;
  1678. Sound.Disable = true;
  1679. SoundFull.Disable = true;
  1680. return;
  1681. }
  1682. try {
  1683. MFBar.EnableObject("Mute", true);
  1684. MFBar.EnableObject("MuteFull", true);
  1685. MFBar.EnableObject("Sound", false);
  1686. MFBar.EnableObject("SoundFull", false);
  1687. SetFocus("Mute");
  1688. }
  1689. catch (e) {
  1690. e.description = L_ERRORUnexpectedError_TEXT;
  1691. HandleError(e);
  1692. return;
  1693. }
  1694. }/* end of function sound_OnClick */
  1695. /*************************************************************/
  1696. /* Name: menu_OnClick */
  1697. /* Description: OnClick callback for menu button */
  1698. /*************************************************************/
  1699. function menu_OnClick()
  1700. {
  1701. try {
  1702. domain = DVD.CurrentDomain;
  1703. if (domain==4) {
  1704. DVD.ShowMenu(3);
  1705. //SetFocus("Resume");
  1706. }
  1707. else if (domain==3 || domain==2) {
  1708. DVD.Resume();
  1709. //SetFocus("Menu");
  1710. }
  1711. }
  1712. catch(e) {
  1713. e.description = L_ERRORUnexpectedError_TEXT;
  1714. HandleError(e);
  1715. return;
  1716. }
  1717. }/* end of function menu_OnClick */
  1718. /*************************************************************/
  1719. /* Name: cc_OnClick */
  1720. /* Description: OnClick callback for closed caption button */
  1721. /*************************************************************/
  1722. function cc_OnClick()
  1723. {
  1724. CCActive = true;
  1725. try {
  1726. CCActive = DVD.CCActive;
  1727. }
  1728. catch(e){
  1729. DisableCCButton();
  1730. return;
  1731. }
  1732. try {
  1733. DVD.CCActive = (!CCActive);
  1734. cc_Update();
  1735. }
  1736. catch(e) {
  1737. //e.description = L_ERRORUnexpectedError_TEXT;
  1738. //HandleError(e);
  1739. return;
  1740. }
  1741. }/* end of function cc_OnClick */
  1742. /*************************************************************/
  1743. /* Name: sp_OnClick
  1744. /* Description: OnClick callback for subpicture button
  1745. /*************************************************************/
  1746. function sp_OnClick()
  1747. {
  1748. try {
  1749. nSubpics = DVD.SubpictureStreamsAvailable;
  1750. // return if there are no subtitles
  1751. if (nSubpics <= 0) return;
  1752. var nCurrentSP = DVD.CurrentSubpictureStream;
  1753. var bSPDisplay = DVD.SubpictureOn;
  1754. // if sp is off, turn it on and select the first sp stream
  1755. if (!bSPDisplay) {
  1756. DVD.CurrentSubpictureStream = 0;
  1757. DVD.SubpictureOn = -1;
  1758. }
  1759. // if the current sp is the last sp stream, turn sp off
  1760. else if (nCurrentSP == nSubpics -1)
  1761. DVD.SubpictureOn = 0;
  1762. else {
  1763. DVD.CurrentSubpictureStream = (++nCurrentSP);
  1764. DVD.SubpictureOn = -1;
  1765. }
  1766. sp_ToolTip();
  1767. }
  1768. catch(e) {
  1769. e.description = L_ERRORUnexpectedError_TEXT;
  1770. HandleError(e);
  1771. return;
  1772. }
  1773. }/* end of function sp_OnClick */
  1774. /*************************************************************/
  1775. /* Name: lan_OnClick
  1776. /* Description: OnClick callback for language button
  1777. /*************************************************************/
  1778. function lan_OnClick()
  1779. {
  1780. try {
  1781. nLangs = DVD.AudioStreamsAvailable;
  1782. // return if there is only 1 audio track
  1783. if (nLangs <= 1) return;
  1784. nCurrentLang = DVD.CurrentAudioStream;
  1785. DVD.CurrentAudioStream = ((++nCurrentLang)%nLangs);
  1786. lan_ToolTip();
  1787. }
  1788. catch(e) {
  1789. e.description = L_ERRORUnexpectedError_TEXT;
  1790. HandleError(e);
  1791. return;
  1792. }
  1793. }/* end of function lan_OnClick */
  1794. /*************************************************************/
  1795. /* Name: angle_OnClick
  1796. /* Description: OnClick callback for parental guide button
  1797. /*************************************************************/
  1798. function angle_OnClick()
  1799. {
  1800. try {
  1801. nAngles = DVD.AnglesAvailable;
  1802. // return if there is only 1 viewing angle
  1803. if (nAngles <= 1) return;
  1804. nCurrentAngle = DVD.CurrentAngle + 1;
  1805. if (nCurrentAngle > nAngles)
  1806. nCurrentAngle = 1;
  1807. DVD.CurrentAngle = nCurrentAngle;
  1808. angle_ToolTip();
  1809. }
  1810. catch(e) {
  1811. e.description = L_ERRORUnexpectedError_TEXT;
  1812. HandleError(e);
  1813. return;
  1814. }
  1815. }/* end of function angle_OnClick */
  1816. /*************************************************************/
  1817. /* Name: prev_OnClick
  1818. /* Description: OnClick callback for previous chapter button
  1819. /*************************************************************/
  1820. function prev_OnClick()
  1821. {
  1822. try {
  1823. DVD.PlayPrevChapter();
  1824. DVD.PlayForwards(DVDOpt.PlaySpeed);
  1825. }
  1826. catch(e) {
  1827. e.description = L_ERRORUnexpectedError_TEXT;
  1828. HandleError(e);
  1829. return;
  1830. }
  1831. }/* end of function prev_OnClick */
  1832. /*************************************************************/
  1833. /* Name: next_OnClick
  1834. /* Description: OnClick button for next chapter button
  1835. /*************************************************************/
  1836. function next_OnClick()
  1837. {
  1838. try {
  1839. DVD.PlayNextChapter();
  1840. DVD.PlayForwards(DVDOpt.PlaySpeed);
  1841. }
  1842. catch(e) {
  1843. e.description = L_ERRORUnexpectedError_TEXT;
  1844. HandleError(e);
  1845. return;
  1846. }
  1847. }/* end of function next_OnClick */
  1848. function OnOptOpen()
  1849. {
  1850. //MFBar.MessageBox("OnOptOpen", "");
  1851. MFBar.ActivityTimeout = 0;
  1852. return;
  1853. }
  1854. function OnOptClose()
  1855. {
  1856. //MFBar.MessageBox("OnOptClose", "");
  1857. MFBar.ActivityTimeout = 3000;
  1858. return;
  1859. }
  1860. /*************************************************************/
  1861. /* Name: options_OnClick
  1862. /* Description: OnClick callback for option button
  1863. /*************************************************************/
  1864. function options_OnClick()
  1865. {
  1866. try {
  1867. DVDOpt.Show();
  1868. }
  1869. catch(e) {
  1870. e.description = L_ERRORUnexpectedError_TEXT;
  1871. HandleError(e);
  1872. return;
  1873. }
  1874. }/* end of function options_OnClick */
  1875. /*************************************************************/
  1876. /* Name: right_OnClick
  1877. /* Description: OnClick callback for right button
  1878. /*************************************************************/
  1879. function right_OnClick()
  1880. {
  1881. try {
  1882. DVD.SelectRightButton();
  1883. }
  1884. catch(e) {
  1885. //e.description = L_ERRORUnexpectedError_TEXT;
  1886. //HandleError(e);
  1887. return;
  1888. }
  1889. }/* end of function right_OnClick */
  1890. /*************************************************************/
  1891. /* Name: left_OnClick
  1892. /* Description: OnClick callback for left button
  1893. /*************************************************************/
  1894. function left_OnClick()
  1895. {
  1896. try {
  1897. DVD.SelectLeftButton();
  1898. }
  1899. catch(e) {
  1900. //e.description = L_ERRORUnexpectedError_TEXT;
  1901. //HandleError(e);
  1902. return;
  1903. }
  1904. }/* end of function left_OnClick */
  1905. /*************************************************************/
  1906. /* Name: up_OnClick
  1907. /* Description: OnClick callback for up button
  1908. /*************************************************************/
  1909. function up_OnClick()
  1910. {
  1911. try {
  1912. DVD.SelectUpperButton();
  1913. }
  1914. catch(e) {
  1915. //e.description = L_ERRORUnexpectedError_TEXT;
  1916. //HandleError(e);
  1917. return;
  1918. }
  1919. }/* end of function up_Onclick */
  1920. /*************************************************************/
  1921. /* Name: down_OnClick
  1922. /* Description: OnClick callback for up button
  1923. /*************************************************************/
  1924. function down_OnClick()
  1925. {
  1926. try {
  1927. DVD.SelectLowerButton();
  1928. }
  1929. catch(e) {
  1930. //e.description = L_ERRORUnexpectedError_TEXT;
  1931. //HandleError(e);
  1932. return;
  1933. }
  1934. }/* end of function down_Onclick */
  1935. /*************************************************************/
  1936. /* Name: enter_OnClick
  1937. /* Description:
  1938. /*************************************************************/
  1939. function enter_OnClick()
  1940. {
  1941. try {
  1942. DVD.ActivateButton();
  1943. }
  1944. catch(e) {
  1945. //e.description = L_ERRORUnexpectedError_TEXT;
  1946. //HandleError(e);
  1947. return;
  1948. }
  1949. }/* end of function enter_Onclick */
  1950. /*************************************************************/
  1951. /* Name: ProcessXXXEvent
  1952. /* Description:
  1953. /*************************************************************/
  1954. function ProcessPFEvent(param1)
  1955. {
  1956. try {
  1957. if (param1 == 0) {
  1958. FastForward.Disable = true;
  1959. FastForwardFull.Disable = true;
  1960. PlaySpeed.Disable = true;
  1961. PlaySpeedFull.Disable = true;
  1962. }
  1963. else {
  1964. FastForward.Disable = false;
  1965. FastForwardFull.Disable = false;
  1966. PlaySpeed.Disable = false;
  1967. PlaySpeedFull.Disable = false;
  1968. }
  1969. }
  1970. catch(e) {
  1971. //e.description = L_ERRORUnexpectedError_TEXT;
  1972. //HandleError(e);
  1973. return;
  1974. }
  1975. }
  1976. function ProcessPBEvent(param1)
  1977. {
  1978. try {
  1979. if (param1 == 0) {
  1980. Rewind.Disable = true;
  1981. RewindFull.Disable = true;
  1982. PlaySpeed.Disable = true;
  1983. PlaySpeedFull.Disable = true;
  1984. }
  1985. else {
  1986. Rewind.Disable = false;
  1987. RewindFull.Disable = false;
  1988. PlaySpeed.Disable = false;
  1989. PlaySpeedFull.Disable = false;
  1990. }
  1991. }
  1992. catch(e) {
  1993. //e.description = L_ERRORUnexpectedError_TEXT;
  1994. //HandleError(e);
  1995. return;
  1996. }
  1997. }
  1998. function ProcessShowMenuEvent(param1)
  1999. {
  2000. try {
  2001. if (param1 == 0) {
  2002. Menu.Disable = true;
  2003. MenuFull.Disable = true;
  2004. }
  2005. else {
  2006. Menu.Disable = false;
  2007. MenuFull.Disable = false;
  2008. }
  2009. }
  2010. catch(e) {
  2011. //e.description = L_ERRORUnexpectedError_TEXT;
  2012. //HandleError(e);
  2013. return;
  2014. }
  2015. }
  2016. function ProcessResumeEvent(param1)
  2017. {
  2018. try {
  2019. if (param1 == 0) {
  2020. Resume.Disable = true;
  2021. ResumeFull.Disable = true;
  2022. }
  2023. else {
  2024. Resume.Disable = false;
  2025. ResumeFull.Disable = false;
  2026. }
  2027. }
  2028. catch(e) {
  2029. //e.description = L_ERRORUnexpectedError_TEXT;
  2030. //HandleError(e);
  2031. return;
  2032. }
  2033. }
  2034. function ProcessAudEvent(param1)
  2035. {
  2036. try {
  2037. if (param1 == 0) {
  2038. Audio.Disable = true;
  2039. AudioFull.Disable = true;
  2040. }
  2041. else {
  2042. Audio.Disable = false;
  2043. AudioFull.Disable = false;
  2044. lan_ToolTip();
  2045. }
  2046. }
  2047. catch(e) {
  2048. //e.description = L_ERRORUnexpectedError_TEXT;
  2049. //HandleError(e);
  2050. return;
  2051. }
  2052. }
  2053. function ProcessSPEvent(param1)
  2054. {
  2055. try {
  2056. if (param1 == 0) {
  2057. Subtitles.Disable = true;
  2058. SubtitlesFull.Disable = true;
  2059. }
  2060. else {
  2061. Subtitles.Disable = false;
  2062. SubtitlesFull.Disable = false;
  2063. sp_ToolTip();
  2064. }
  2065. }
  2066. catch(e) {
  2067. //e.description = L_ERRORUnexpectedError_TEXT;
  2068. //HandleError(e);
  2069. return;
  2070. }
  2071. }
  2072. function ProcessAngleEvent(param1)
  2073. {
  2074. try {
  2075. if (param1 == 0) {
  2076. Angles.Disable = true;
  2077. AnglesFull.Disable = true;
  2078. }
  2079. else {
  2080. Angles.Disable = false;
  2081. AnglesFull.Disable = false;
  2082. angle_ToolTip();
  2083. }
  2084. }
  2085. catch(e) {
  2086. //e.description = L_ERRORUnexpectedError_TEXT;
  2087. //HandleError(e);
  2088. return;
  2089. }
  2090. }
  2091. function ProcessChapterSearchEvent(param1)
  2092. {
  2093. try {
  2094. if (param1 == 0) {
  2095. SkipForward.Disable = true;
  2096. SkipBackward.Disable = true;
  2097. SkipForwardFull.Disable = true;
  2098. SkipBackwardFull.Disable = true;
  2099. }
  2100. else {
  2101. SkipForward.Disable = false;
  2102. SkipBackward.Disable = false;
  2103. SkipForwardFull.Disable = false;
  2104. SkipBackwardFull.Disable = false;
  2105. }
  2106. }
  2107. catch(e) {
  2108. //e.description = L_ERRORUnexpectedError_TEXT;
  2109. //HandleError(e);
  2110. return;
  2111. }
  2112. }
  2113. function ProcessChapterPlayEvent(param1)
  2114. {
  2115. try {
  2116. if (param1 == 0) {
  2117. SkipForward.Disable = true;
  2118. SkipBackward.Disable = true;
  2119. SkipForwardFull.Disable = true;
  2120. SkipBackwardFull.Disable = true;
  2121. }
  2122. else {
  2123. SkipForward.Disable = false;
  2124. SkipBackward.Disable = false;
  2125. SkipForwardFull.Disable = false;
  2126. SkipBackwardFull.Disable = false;
  2127. }
  2128. }
  2129. catch(e) {
  2130. //e.description = L_ERRORUnexpectedError_TEXT;
  2131. //HandleError(e);
  2132. return;
  2133. }
  2134. }
  2135. function ProcessTimePlayEvent(param1)
  2136. {
  2137. try {
  2138. if (param1 == 0) {
  2139. TimeSlider.Disable = true;
  2140. TimeSliderFull.Disable = true;
  2141. }
  2142. else {
  2143. TimeSlider.Disable = false;
  2144. TimeSliderFull.Disable = false;
  2145. }
  2146. }
  2147. catch(e) {
  2148. //e.description = L_ERRORUnexpectedError_TEXT;
  2149. //HandleError(e);
  2150. return;
  2151. }
  2152. }
  2153. function ProcessTimeSearchEvent(param1)
  2154. {
  2155. try {
  2156. if (param1 == 0) {
  2157. TimeSlider.Disable = true;
  2158. TimeSliderFull.Disable = true;
  2159. }
  2160. else {
  2161. TimeSlider.Disable = false;
  2162. TimeSliderFull.Disable = false;
  2163. }
  2164. }
  2165. catch(e) {
  2166. //e.description = L_ERRORUnexpectedError_TEXT;
  2167. //HandleError(e);
  2168. return;
  2169. }
  2170. }
  2171. function ProcessStillOff(param1)
  2172. {
  2173. try {
  2174. if (param1 == 0) {
  2175. g_bStillOn = false;
  2176. }
  2177. else {
  2178. g_bStillOn = true;
  2179. }
  2180. }
  2181. catch(e) {
  2182. //e.description = L_ERRORUnexpectedError_TEXT;
  2183. //HandleError(e);
  2184. return;
  2185. }
  2186. }
  2187. function ProcessDVDErrorEvent(ErrorCode)
  2188. {
  2189. var ShallClose = false;
  2190. switch (ErrorCode)
  2191. {
  2192. case DVD_ERROR_Unexpected:
  2193. message = L_ERRORUnexpectedError_TEXT;
  2194. break;
  2195. case DVD_ERROR_CopyProtectFail:
  2196. message = L_ERRORCopyProtectFail_TEXT;
  2197. break;
  2198. case DVD_ERROR_InvalidDVD1_0Disc:
  2199. message = L_ERRORInvalidDVD10Disc_TEXT;
  2200. break;
  2201. case DVD_ERROR_InvalidDiscRegion:
  2202. message = L_ERRORInvalidDiscRegion_TEXT;
  2203. break;
  2204. case DVD_ERROR_LowParentalLevel:
  2205. message = L_ERRORLowParentalLevel_TEXT;
  2206. break;
  2207. case DVD_ERROR_MacrovisionFail:
  2208. message = L_ERRORMacrovisionFail_TEXT;
  2209. ShallClose = true;
  2210. break;
  2211. case DVD_ERROR_IncompatibleSystemAndDecoderRegions:
  2212. message = L_ERRORIncompatibleSystemAndDecoderRegions_TEXT;
  2213. ShallClose = true;
  2214. break;
  2215. case DVD_ERROR_IncompatibleDiscAndDecoderRegions:
  2216. message = L_ERRORIncompatibleDiscAndDecoderRegions_TEXT;
  2217. ShallClose = true;
  2218. break;
  2219. default:
  2220. message = L_ERRORUnexpectedError_TEXT;
  2221. break;
  2222. }
  2223. var e = new Error (-1, message);
  2224. HandleError(e, ShallClose);
  2225. }
  2226. function ProcessDVDEvent(event, param1, param2)
  2227. {
  2228. lEventCode = event;
  2229. if (lEventCode == EC_DVD_STILL_ON) {
  2230. nDomain = DVD.CurrentDomain;
  2231. if (nDomain == 1 || nDomain == 4) {
  2232. g_bStillOn = true;
  2233. Play.Disable = false;
  2234. PlayFull.Disable = false;
  2235. Pause.Disable = true;
  2236. PauseFull.Disable = true;
  2237. }
  2238. }
  2239. else if (lEventCode == EC_DVD_STILL_OFF) {
  2240. g_bStillOn = false;
  2241. Play.Disable = true;
  2242. PlayFull.Disable = true;
  2243. Pause.Disable = false;
  2244. PauseFull.Disable = false;
  2245. }
  2246. else if (lEventCode == EC_DVD_DOMAIN_CHANGE) {
  2247. // If in manager menu or title set menu
  2248. ProcessTimePlayEvent(param1 == 4);
  2249. // If we are in stop domain
  2250. if (param1 == 5) {
  2251. // Disable all DVD UI except for play button
  2252. DisableDVDUI(true);
  2253. Play.Disable = false;
  2254. PlayFull.Disable = false;
  2255. SetFocus("Play");
  2256. }
  2257. // If we are in root menu or title menu domain
  2258. if (param1==3 || param1==2) {
  2259. try {
  2260. DVD.Zoom(0, 0, 0.0); // Zoom out
  2261. }
  2262. catch(e){
  2263. }
  2264. // hide extended ui buttons
  2265. //for (i=10; i<13; i++) {
  2266. // MFBar.EnableObject(g_strButID[i], false);
  2267. //}
  2268. // show nav buttons
  2269. //for (i=15; i<20; i++) {
  2270. // MFBar.EnableObject(g_strButID[i], true);
  2271. //}
  2272. // Enable nav buttons
  2273. HLUp.Disable = false;
  2274. HLDown.Disable = false;
  2275. HLLeft.Disable = false;
  2276. HLRight.Disable = false;
  2277. Enter.Disable = false;
  2278. HLUpFull.Disable = false;
  2279. HLDownFull.Disable = false;
  2280. HLLeftFull.Disable = false;
  2281. HLRightFull.Disable = false;
  2282. EnterFull.Disable = false;
  2283. fHadFocus = HasFocus("Menu");
  2284. MFBar.EnableObject("Menu", false);
  2285. MFBar.EnableObject("MenuFull", false);
  2286. MFBar.EnableObject("Resume", true);
  2287. MFBar.EnableObject("ResumeFull", true);
  2288. if (fHadFocus)
  2289. SetFocus("Resume");
  2290. }
  2291. else {
  2292. // Show extended ui buttons
  2293. //for (i=10; i<13; i++) {
  2294. // MFBar.EnableObject(g_strButID[i], true);
  2295. //}
  2296. // hide navigation buttons
  2297. //for (i=15; i<20; i++) {
  2298. // MFBar.EnableObject(g_strButID[i], false);
  2299. //}
  2300. // Disable nav buttons
  2301. HLUp.Disable = true;
  2302. HLDown.Disable = true;
  2303. HLLeft.Disable = true;
  2304. HLRight.Disable = true;
  2305. Enter.Disable = true;
  2306. HLUpFull.Disable = true;
  2307. HLDownFull.Disable = true;
  2308. HLLeftFull.Disable = true;
  2309. HLRightFull.Disable = true;
  2310. EnterFull.Disable = true;
  2311. fHadFocus = HasFocus("Resume");
  2312. MFBar.EnableObject("Menu", true);
  2313. MFBar.EnableObject("MenuFull", true);
  2314. MFBar.EnableObject("Resume", false);
  2315. MFBar.EnableObject("ResumeFull", false);
  2316. if (fHadFocus)
  2317. SetFocus("Menu");
  2318. }
  2319. }
  2320. else if (lEventCode == EC_DVD_TITLE_CHANGE) {
  2321. cc_Update();
  2322. }
  2323. else if (lEventCode == EC_DVD_CHAPTER_START) {
  2324. }
  2325. else if (lEventCode == EC_DVD_AUDIO_STREAM_CHANGE) {
  2326. lan_ToolTip();
  2327. }
  2328. else if (lEventCode == EC_DVD_SUBPICTURE_STREAM_CHANGE) {
  2329. sp_ToolTip();
  2330. }
  2331. else if (lEventCode == EC_DVD_ANGLE_CHANGE) {
  2332. angle_ToolTip();
  2333. }
  2334. else if (lEventCode == EC_DVD_BUTTON_CHANGE) {
  2335. }
  2336. else if (lEventCode == EC_DVD_VALID_UOPS_CHANGE) {
  2337. }
  2338. else if (lEventCode == EC_DVD_STILL_ON) {
  2339. }
  2340. else if (lEventCode == EC_DVD_STILL_OFF) {
  2341. }
  2342. else if (lEventCode == EC_DVD_CURRENT_TIME) {
  2343. g_bFirstPlaying = false;
  2344. UpdateDVDTitle();
  2345. try {
  2346. nDomain = DVD.CurrentDomain;
  2347. if (g_bTimeUpdate && nDomain != 2 && nDomain != 3) {
  2348. currentTime = DVD.CurrentTime;
  2349. TextBox.Text = currentTime.substr(0, 8);
  2350. TextBoxFull.Text = currentTime.substr(0, 8);
  2351. currentTimeInSec =
  2352. (new Number(currentTime.charAt(0)))*36000 +
  2353. (new Number(currentTime.charAt(1)))*3600 +
  2354. (new Number(currentTime.charAt(3)))*600 +
  2355. (new Number(currentTime.charAt(4)))*60 +
  2356. (new Number(currentTime.charAt(6)))*10 +
  2357. (new Number(currentTime.charAt(7)));
  2358. totalTime = DVD.TotalTitleTime;
  2359. totalTimeInSec =
  2360. (new Number(totalTime.charAt(0)))*36000 +
  2361. (new Number(totalTime.charAt(1)))*3600 +
  2362. (new Number(totalTime.charAt(3)))*600 +
  2363. (new Number(totalTime.charAt(4)))*60 +
  2364. (new Number(totalTime.charAt(6)))*10 +
  2365. (new Number(totalTime.charAt(7)));
  2366. percent = Math.floor(currentTimeInSec/totalTimeInSec*100);
  2367. if (percent>=TimeSlider.Min && percent<=TimeSlider.Max) {
  2368. TimeSlider.Value = percent;
  2369. TimeSliderFull.Value = percent;
  2370. }
  2371. }
  2372. }
  2373. catch(e){
  2374. TextBox.Text = L_HHMMSS_TEXT.replace(/%1/i, "00").replace(/%2/i, "00").replace(/%3/i, "00");
  2375. TextBoxFull.Text = L_HHMMSS_TEXT.replace(/%1/i, "00").replace(/%2/i, "00").replace(/%3/i, "00");
  2376. TimeSlider.Value = TimeSlider.Min;
  2377. TimeSliderFull.Value = TimeSliderFull.Min;
  2378. }
  2379. }
  2380. else if (event == EC_PAUSED ) {
  2381. //MFBar.EnableObject(g_strButID[0], false);
  2382. //MFBar.EnableObject(g_strButID[1], true);
  2383. MFBar.EnableObject("Pause", false);
  2384. MFBar.EnableObject("PauseFull", false);
  2385. MFBar.EnableObject("Stop", true);
  2386. MFBar.EnableObject("StopFull", true);
  2387. Play.Disable = false;
  2388. PlayFull.Disable = false;
  2389. SetFocus("Play");
  2390. Stop.Disable = false;
  2391. StopFull.Disable = false;
  2392. }
  2393. else if (lEventCode == EC_DVD_PLAYING) {
  2394. //MFBar.EnableObject(g_strButID[0], true);
  2395. //MFBar.EnableObject(g_strButID[1], false);
  2396. MFBar.EnableObject("Pause", true);
  2397. MFBar.EnableObject("PauseFull", true);
  2398. MFBar.EnableObject("Stop", false);
  2399. MFBar.EnableObject("StopFull", false);
  2400. Play.Disable = true;
  2401. PlayFull.Disable = true;
  2402. Pause.Disable = false;
  2403. PauseFull.Disable = false;
  2404. SetFocus("Pause");
  2405. if (g_bFirstPlaying == true) {
  2406. //lan_ToolTip();
  2407. //sp_ToolTip();
  2408. //angle_ToolTip();
  2409. //cc_Update();
  2410. }
  2411. }
  2412. else if (lEventCode == EC_DVD_PLAYBACK_RATE_CHANGE) {
  2413. playing = (param1 == 10000);
  2414. g_PlayBackRate = param1;
  2415. Play.Disable = false;
  2416. PlayFull.Disable = false;
  2417. //Pause.Disable = false;
  2418. //PauseFull.Disable = false;
  2419. if (playing) {
  2420. Play.Disable = true;
  2421. PlayFull.Disable = true;
  2422. }
  2423. //MFBar.EnableObject(g_strButID[0], playing);
  2424. //MFBar.EnableObject(g_strButID[1], !playing);
  2425. }
  2426. else if (lEventCode == EC_DVD_ERROR) {
  2427. if (param1 == DVD_ERROR_LowParentalLevel) {
  2428. DVDOpt.ParentalLevelOverride(1);
  2429. }
  2430. else {
  2431. ProcessDVDErrorEvent(param1);
  2432. }
  2433. }
  2434. else if (lEventCode == EC_DVD_PARENTAL_LEVEL_CHANGE) {
  2435. DVDOpt.ParentalLevelOverride(0);
  2436. }
  2437. else if (lEventCode == EC_DVD_PLAYBACK_STOPPED) {
  2438. }
  2439. else if (lEventCode == EC_DVD_ANGLES_AVAILABLE) {
  2440. }
  2441. else if (lEventCode == EC_DVD_DISC_EJECTED) {
  2442. for (i=0; i<=g_nNumButs+7; i++) {
  2443. MFBar.EnableObject(g_strButID[i], false);
  2444. MFBar.EnableObject(g_strButID[i]+"Full", false);
  2445. }
  2446. }
  2447. else if (lEventCode == EC_DVD_DISC_INSERTED) {
  2448. for (i=0; i<=g_nNumButs+7; i++) {
  2449. MFBar.EnableObject(g_strButID[i], true);
  2450. MFBar.EnableObject(g_strButID[i]+"Full", true);
  2451. }
  2452. }
  2453. }/* end of function ProcessXXXEvent */
  2454. /*************************************************************/
  2455. /* Name: sp_ToolTip
  2456. /* Description: Change the subpicture tool tip to the next language
  2457. /*************************************************************/
  2458. function sp_ToolTip()
  2459. {
  2460. try {
  2461. nDomain = DVD.CurrentDomain;
  2462. if (nDomain != 4) return;
  2463. nSubpics = DVD.SubpictureStreamsAvailable;
  2464. if (nSubpics == 0) {
  2465. Audio.ToolTip = L_NoSubtitles_TEXT;
  2466. AudioFull.ToolTip = L_NoSubtitles_TEXT;
  2467. return;
  2468. }
  2469. nCurrentSP = DVD.CurrentSubpictureStream;
  2470. bSPDisplay = DVD.SubpictureOn;
  2471. if (nCurrentSP<0 || nCurrentSP>=32) return;
  2472. strCurrentLang = DVD.GetSubpictureLanguage(nCurrentSP);
  2473. // Next click will disable subpicture
  2474. if (bSPDisplay && nCurrentSP+1 == nSubpics) {
  2475. tempStr = L_SubtitlesAreLanguageClickToDisable_TEXT.replace(/%1/i, strCurrentLang);
  2476. Subtitles.ToolTip = tempStr;
  2477. SubtitlesFull.ToolTip = tempStr;
  2478. }
  2479. else {
  2480. // Next click will enable subpicture to the first stream
  2481. if (!bSPDisplay) {
  2482. nCurrentSP = 0;
  2483. strNextLang = DVD.GetSubpictureLanguage(nCurrentSP);
  2484. tempStr = L_SubtitlesAreDisabledClickForLanguage_TEXT.replace(/%1/i, strNextLang);
  2485. Subtitles.ToolTip = tempStr;
  2486. SubtitlesFull.ToolTip = tempStr;
  2487. }
  2488. else {
  2489. nCurrentSP++;
  2490. strNextLang = DVD.GetSubpictureLanguage(nCurrentSP);
  2491. tempStr = L_SubtitlesAreLanguageClickForLanguage_TEXT.replace(/%1/i, strCurrentLang).replace(/%2/i, strNextLang);
  2492. Subtitles.ToolTip = tempStr;
  2493. SubtitlesFull.ToolTip = tempStr;
  2494. }
  2495. }
  2496. Message.Text = Subtitles.ToolTip;
  2497. MessageFull.Text = Subtitles.ToolTip;
  2498. MFBar.SetTimeOut(2000, DVDMSGTIMER);
  2499. }
  2500. catch(e) {
  2501. //e.description = L_ERRORToolTip_TEXT;
  2502. //HandleError(e);
  2503. return;
  2504. }
  2505. }/* end of function sp_ToolTip */
  2506. /*************************************************************/
  2507. /* Name: lan_ToolTip
  2508. /* Description: Change the audio tool tip to the next language
  2509. /*************************************************************/
  2510. function lan_ToolTip()
  2511. {
  2512. try {
  2513. nDomain = DVD.CurrentDomain;
  2514. if (nDomain != 4) return;
  2515. nLangs = DVD.AudioStreamsAvailable;
  2516. // return if there are no audio tracks available at this time
  2517. if (nLangs == 0) {
  2518. Audio.ToolTip = L_NoAudioTracks_TEXT;
  2519. AudioFull.ToolTip = L_NoAudioTracks_TEXT;
  2520. return;
  2521. }
  2522. nCurrentLang = DVD.CurrentAudioStream;
  2523. strCurrentLang = DVD.GetAudioLanguage(nCurrentLang);
  2524. if (nLangs == 1) {
  2525. tempStr = L_AudioLanguageIsXNoMoreAudioTracks_TEXT.replace(/%1/i, strCurrentLang);
  2526. Audio.ToolTip = tempStr;
  2527. AudioFull.ToolTip = tempStr;
  2528. return;
  2529. }
  2530. nCurrentLang++;
  2531. if (nCurrentLang == nLangs)
  2532. nCurrentLang = 0;
  2533. strNextLang = DVD.GetAudioLanguage(nCurrentLang);
  2534. tempStr = L_AudioLanguageIsXClickForY_TEXT.replace(/%1/i, strCurrentLang).replace(/%2/i, strNextLang);
  2535. Audio.ToolTip = tempStr;
  2536. AudioFull.ToolTip = tempStr;
  2537. Message.Text = Audio.ToolTip;
  2538. MessageFull.Text = Audio.ToolTip;
  2539. MFBar.SetTimeOut(2000, DVDMSGTIMER);
  2540. }
  2541. catch(e) {
  2542. //e.description = L_ERRORToolTip_TEXT;
  2543. //HandleError(e);
  2544. return;
  2545. }
  2546. }/* end of function lan_Tooltip */
  2547. /*************************************************************/
  2548. /* Name: angle_ToolTip
  2549. /* Description:
  2550. /*************************************************************/
  2551. function angle_ToolTip()
  2552. {
  2553. try {
  2554. nDomain = DVD.CurrentDomain;
  2555. if (nDomain != 4) return;
  2556. nAngles = DVD.AnglesAvailable;
  2557. // return if there is only 1 viewing angle
  2558. if (nAngles <= 1) {
  2559. Angles.ToolTip = L_ViewingAngleIs1NoMoreViewingAngles_TEXT;
  2560. AnglesFull.ToolTip = L_ViewingAngleIs1NoMoreViewingAngles_TEXT;
  2561. return;
  2562. }
  2563. nCurrentAngle = DVD.CurrentAngle;
  2564. if (nCurrentAngle == nAngles) nNextAngle = 1;
  2565. else nNextAngle = nCurrentAngle + 1;
  2566. tempStr = L_ViewingAngleIsXClickForY_TEXT.replace(/%1/i, nCurrentAngle).replace(/%2/i, nNextAngle);
  2567. Angles.ToolTip = tempStr;
  2568. AnglesFull.ToolTip = tempStr;
  2569. Message.Text = Angles.ToolTip;
  2570. MessageFull.Text = Angles.ToolTip;
  2571. MFBar.SetTimeOut(2000, DVDMSGTIMER);
  2572. }
  2573. catch(e) {
  2574. //e.description = L_ERRORToolTip_TEXT;
  2575. //HandleError(e);
  2576. return;
  2577. }
  2578. }/* end of function angle_Tooltip */
  2579. /*************************************************************/
  2580. /* Name: help_OnClick()
  2581. /* Description:
  2582. /*************************************************************/
  2583. function help_OnClick()
  2584. {
  2585. try {
  2586. DVDOpt.ActivateHelp();
  2587. }
  2588. catch(e) {
  2589. //e.description = L_ERRORHelp_TEXT;
  2590. //HandleError(e);
  2591. return;
  2592. }
  2593. }/* end of function help_Onclick */
  2594. /*************************************************************/
  2595. /* Name: max_OnClick, restore_OnClick, min_OnClick
  2596. /* Description:
  2597. /*************************************************************/
  2598. function max_OnClick()
  2599. {
  2600. try {
  2601. MFBar.ShowSelfSite(3);
  2602. //MessageBox("Maximazing", "test");
  2603. }
  2604. catch(e) {
  2605. e.description = L_ERRORResize_TEXT;
  2606. HandleError(e);
  2607. return;
  2608. }
  2609. }/* end of function max_Onclick */
  2610. /*************************************************************/
  2611. /* Function: restore_OnClick */
  2612. /*************************************************************/
  2613. function restore_OnClick(){
  2614. try {
  2615. MFBar.ShowSelfSite(9);
  2616. }
  2617. catch(e) {
  2618. e.description = L_ERRORResize_TEXT;
  2619. HandleError(e);
  2620. return;
  2621. }/* end of function restore_Onclick */
  2622. }/* end of function restore_OnClick */
  2623. /*************************************************************/
  2624. /* Description: OnKeyDown */
  2625. /*************************************************************/
  2626. function OnKeyDown(lVirtKey, lKeyData){
  2627. switch(lVirtKey){
  2628. case VK_LEFT : MenuKey("HLLeft"); break;
  2629. case VK_UP : MenuKey("HLUp"); break;
  2630. case VK_RIGHT : MenuKey("HLRight"); break;
  2631. case VK_DOWN : MenuKey("HLDown"); break;
  2632. case VK_SELECT:
  2633. case VK_SPACE :
  2634. case VK_RETURN: MenuKey("Enter"); break;
  2635. }/* end of switch statement */
  2636. }/* end of function OnKeyDown */
  2637. /*************************************************************/
  2638. /* Description: OnKeyUp */
  2639. /*************************************************************/
  2640. function OnKeyUp(lVirtKey, lKeyData){
  2641. switch(lVirtKey){
  2642. case VK_ESCAPE: Key_ESC(); break;
  2643. case VK_LEFT : MenuKey("HLLeft"); break;
  2644. case VK_UP : MenuKey("HLUp"); break;
  2645. case VK_RIGHT : MenuKey("HLRight"); break;
  2646. case VK_DOWN : MenuKey("HLDown"); break;
  2647. case VK_SELECT:
  2648. case VK_SPACE :
  2649. case VK_RETURN: MenuKey("Enter"); break;
  2650. }/* end of switch statement */
  2651. }/* end of function OnKeyUp */
  2652. /*************************************************************/
  2653. /* Function: OnSyskeyUp */
  2654. /*************************************************************/
  2655. function OnSysKeyUp(lVirtKey, lKeyData){
  2656. switch(lVirtKey){
  2657. case VK_F4 : close_OnClick();
  2658. }/* end of switch statement */
  2659. }/* end of function OnSyskeyUp */
  2660. /*************************************************************/
  2661. /* Function: Key_ESC */
  2662. /*************************************************************/
  2663. function Key_ESC(){
  2664. try {
  2665. if(g_bFullScreen){
  2666. restore_OnClick();
  2667. }/* end of if statement */
  2668. }
  2669. catch(e) {
  2670. e.description = L_ERRORResize_TEXT;
  2671. HandleError(e);
  2672. return;
  2673. }/* end of function restore_Onclick */
  2674. }/* end of function Key_ESC */
  2675. /*************************************************************/
  2676. /* Function: MenuKey */
  2677. /* Description: Simulates the key input. */
  2678. /*************************************************************/
  2679. function MenuKey(ButtonObjectName){
  2680. try {
  2681. domain = DVD.CurrentDomain;
  2682. if(domain==3 || domain==2){
  2683. if(g_bFullScreen){
  2684. ButtonObjectName += "Full";
  2685. }/* end of if statement */
  2686. pObj = MFBar.SetObjectFocus(ButtonObjectName, true);
  2687. MFBar.ForceKey(VK_RETURN, 0);
  2688. }/* end of if statement */
  2689. }
  2690. catch(e) {
  2691. }/* end of function restore_Onclick */
  2692. }/* end of function MenuKey */
  2693. function min_OnClick(){
  2694. try {
  2695. MFBar.ShowSelfSite(6);
  2696. }
  2697. catch(e) {
  2698. e.description = L_ERRORResize_TEXT;
  2699. HandleError(e);
  2700. return;
  2701. }/* end of function min_Onclick */
  2702. }
  2703. /*************************************************************/
  2704. /* Function: close_OnClick
  2705. /* Description:
  2706. /*************************************************************/
  2707. function close_OnClick()
  2708. {
  2709. try {
  2710. try {
  2711. if (DVD.DVDAdm.BookmarkOnClose)
  2712. DVD.SaveState();
  2713. }
  2714. catch(e) {
  2715. // we do not care if we cannot save the state
  2716. }
  2717. try {
  2718. DVD.Stop();
  2719. }
  2720. catch(e) {
  2721. // we do not care if we cannot save the state
  2722. }
  2723. MFBar.Close();
  2724. }
  2725. catch(e) {
  2726. e.description = L_ERRORUnexpectedError_TEXT;
  2727. HandleError(e);
  2728. return;
  2729. }
  2730. }/* end of function close_OnClick */
  2731. /*************************************************************/
  2732. /* Name: eject_OnClick */
  2733. /* Description: Ejects the disk and resets the bookmark. */
  2734. /*************************************************************/
  2735. function eject_OnClick()
  2736. {
  2737. try {
  2738. DVD.Stop();
  2739. DVD.Eject();
  2740. DVD.ResetState();
  2741. }
  2742. catch(e) {
  2743. e.description = L_ERROREject_TEXT;
  2744. HandleError(e, true);
  2745. return;
  2746. }/* end of function eject_Onclick */
  2747. }/* end of function eject_OnClick */
  2748. /*************************************************************/
  2749. /* Function: stop_OnClick
  2750. /* Description:
  2751. /*************************************************************/
  2752. function stop_OnClick()
  2753. {
  2754. try {
  2755. try {
  2756. if (DVD.DVDAdm.BookmarkOnStop)
  2757. DVD.SaveState();
  2758. g_bRestoreNeeded = true;
  2759. MFBar.EnableObject("DVD", false);
  2760. MFBar.EnableObject("Splash", true);
  2761. }
  2762. catch(e) {
  2763. // we do not care if we cannot save the state
  2764. }
  2765. DVD.Stop();
  2766. }
  2767. catch(e) {
  2768. e.description = L_ERRORUnexpectedError_TEXT;
  2769. HandleError(e);
  2770. return;
  2771. }
  2772. }/* end of function stop_OnClick */
  2773. /*************************************************************/
  2774. /* Name: expand_OnClick
  2775. /* Description:
  2776. /*************************************************************/
  2777. function expand_OnClick()
  2778. {
  2779. g_ButHeight = 62;
  2780. MFBar.BackGroundImage = "IDR_BACKIMG_EXPANDED";
  2781. if (!g_bFullScreen) {
  2782. MFBar.SetObjectExtent("MFBar", g_ConWidth, g_ConHeight+31);
  2783. OnResize(g_ConWidth, g_ConHeight, 0);
  2784. }
  2785. else
  2786. OnResize(g_ConWidth, g_ConHeight, 2);
  2787. MFBar.EnableObject("Expand", false);
  2788. MFBar.EnableObject("ExpandFull", false);
  2789. MFBar.EnableObject("Shrink", true);
  2790. MFBar.EnableObject("ShrinkFull", true);
  2791. g_bExpanded = true;
  2792. SetupFocus(); // switch the focus array if needs to be switched
  2793. SetFocus("Shrink");
  2794. }/* end of function expand_OnClick */
  2795. /*************************************************************/
  2796. /* Name: shrink_OnClick
  2797. /* Description:
  2798. /*************************************************************/
  2799. function shrink_OnClick()
  2800. {
  2801. g_ButHeight = 31;
  2802. MFBar.BackGroundImage = "IDR_BACKIMG_SIMPLE";
  2803. if (!g_bFullScreen) {
  2804. MFBar.SetObjectExtent("MFBar", g_ConWidth, g_ConHeight-31);
  2805. OnResize(g_ConWidth, g_ConHeight, 0);
  2806. }
  2807. else
  2808. OnResize(g_ConWidth, g_ConHeight, 2);
  2809. MFBar.EnableObject("Expand", true);
  2810. MFBar.EnableObject("ExpandFull", true);
  2811. MFBar.EnableObject("Shrink", false);
  2812. MFBar.EnableObject("ShrinkFull", false);
  2813. g_bExpanded = false;
  2814. SetupFocus(); // switch the focus array if needs to be switched
  2815. SetFocus("Expand");
  2816. }/* end of function shrink_OnClick */
  2817. /*************************************************************/
  2818. /* Name: zoomin_OnClick
  2819. /* Description:
  2820. /*************************************************************/
  2821. function zoomin_OnClick()
  2822. {
  2823. try {
  2824. DVD.CursorType = 1;
  2825. }
  2826. catch(e) {
  2827. e.description = L_ERRORUnexpectedError_TEXT;
  2828. HandleError(e);
  2829. return;
  2830. }
  2831. }/* end of function zoomin_OnClick */
  2832. /*************************************************************/
  2833. /* Name: zoomout_OnClick
  2834. /* Description:
  2835. /*************************************************************/
  2836. function zoomout_OnClick()
  2837. {
  2838. try {
  2839. DVD.CursorType = 2;
  2840. }
  2841. catch(e) {
  2842. e.description = L_ERRORUnexpectedError_TEXT;
  2843. HandleError(e);
  2844. return;
  2845. }
  2846. }/* end of function zoomout_OnClick */
  2847. /*************************************************************/
  2848. /* Name: OnSpeedSliderUpdate
  2849. /* Description: Speed scrub bar on value change
  2850. /*************************************************************/
  2851. function OnSpeedSliderUpdate(x)
  2852. {
  2853. try {
  2854. if (x>0)
  2855. DVD.PlayForwards(x);
  2856. else if (x<0) {
  2857. DVD.PlayBackwards(-x);
  2858. }
  2859. }
  2860. catch(e) {
  2861. e.description = L_ERRORUnexpectedError_TEXT;
  2862. HandleError(e);
  2863. return;
  2864. }
  2865. }/* end of function OnSpeedSliderUpdate */
  2866. /*************************************************************/
  2867. /* Name: OnSpeedSliderMouseUp
  2868. /* Description:
  2869. /*************************************************************/
  2870. function OnSpeedSliderMouseUp()
  2871. {
  2872. PlaySpeed.Value = 1;
  2873. PlaySpeedFull.Value = 1;
  2874. try {
  2875. DVD.PlayForwards(1);
  2876. }
  2877. catch(e) {
  2878. e.description = L_ERRORUnexpectedError_TEXT;
  2879. HandleError(e);
  2880. return;
  2881. }
  2882. }
  2883. /*************************************************************/
  2884. /* Function: ConvertToDB */
  2885. /* Description: Converts slider value to DBs */
  2886. /*************************************************************/
  2887. function ConvertToDB(x){
  2888. val = Math.log(x) / Math.LOG10E;
  2889. val = val * (1000);
  2890. if (val < cgVOLUME_MIN)
  2891. val = cgVOLUME_MIN;
  2892. if (val > cgVOLUME_MAX)
  2893. val = cgVOLUME_MAX;
  2894. return(val);
  2895. }/* end of function ConvertToDB */
  2896. /*************************************************************/
  2897. /* Function: ConvertFromDB */
  2898. /* Description: Converts slider value to DBs */
  2899. /*************************************************************/
  2900. function ConvertFromDB(x){
  2901. if (x < cgVOLUME_MIN)
  2902. x = cgVOLUME_MIN;
  2903. if (x > cgVOLUME_MAX)
  2904. x = cgVOLUME_MAX;
  2905. val = Math.exp(x/ 1000 * Math.LOG10E);
  2906. return(val);
  2907. }/* end of function ConvertFromDB */
  2908. /*************************************************************/
  2909. /* Name: OnVolUpdate
  2910. /* Description: volume slider on value change
  2911. /*************************************************************/
  2912. function OnVolUpdate(x)
  2913. {
  2914. try {
  2915. val = ConvertToDB(x);
  2916. DVD.Volume = val;
  2917. // update the other slider
  2918. if(true == g_bFullScreen){
  2919. VolSlider.Value = x;
  2920. }
  2921. else {
  2922. VolSliderFull.Value = x;
  2923. }/* end of if statement */
  2924. // we adjusted the volume so lets unmute
  2925. MFBar.EnableObject("Mute", true);
  2926. MFBar.EnableObject("MuteFull", true);
  2927. MFBar.EnableObject("Sound", false);
  2928. MFBar.EnableObject("SoundFull", false);
  2929. }
  2930. catch(e) {
  2931. VolSlider.Disable = true;
  2932. VolSliderFull.Disable = true;
  2933. Mute.Disable = true;
  2934. MuteFull.Disable = true;
  2935. Sound.Disable = true;
  2936. SoundFull.Disable = true;
  2937. return;
  2938. }
  2939. }/* end of function OnSpeedSliderUpdate */
  2940. /*************************************************************/
  2941. /* Name: capture_OnClick
  2942. /* Description:
  2943. /*************************************************************/
  2944. function capture_OnClick(){
  2945. try {
  2946. DVD.Capture();
  2947. }
  2948. catch(e) {
  2949. e.description = L_ERRORCapture_TEXT;
  2950. HandleError(e);
  2951. return;
  2952. }
  2953. } /* end of function capture_OnClick */
  2954. /*************************************************************/
  2955. /* Name: ActivityStarted
  2956. /* Description:
  2957. /*************************************************************/
  2958. function ActivityStarted(){
  2959. if (g_bFullScreen) {
  2960. OnResize(g_ConWidth, g_ConHeight, 2);
  2961. DVD.CursorType = 0;
  2962. }
  2963. g_bActivityDeclined = false;
  2964. UpdateDVDTitle();
  2965. //MFBar.MessageBox("Activity Started", "Status");
  2966. }/* end of function ActivityStarted */
  2967. /*************************************************************/
  2968. /* Name: ActivityDeclined
  2969. /* Description:
  2970. /*************************************************************/
  2971. function ActivityDeclined(){
  2972. if (g_bFullScreen) {
  2973. for (i=0; i<=g_nNumButs+7; i++) {
  2974. MFBar.SetObjectPosition(g_strButID[i]+"Full",
  2975. g_nButPos[i][0], g_nButPos[i][1] -1000,
  2976. g_nButPos[i][2], g_nButPos[i][3]);
  2977. }
  2978. DVD.CursorType = -1;
  2979. }
  2980. g_bActivityDeclined = true;
  2981. //MFBar.MessageBox("Activity Declined", "Status");
  2982. }/* end of function ActivityStarted */
  2983. /*************************************************************/
  2984. /* Name: OnMessageTimeOut
  2985. /* Description:
  2986. /*************************************************************/
  2987. function OnMessageTimeOut(id) {
  2988. if (id == DVDMSGTIMER) {
  2989. Message.Text = "";
  2990. MessageFull.Text = "";
  2991. if (g_LTRReading)
  2992. {
  2993. xCoord = TitleFull.TextWidth;
  2994. }
  2995. else
  2996. {
  2997. xCoord = g_ConWidth - TitleFull.TextWidth - MessageFull.TextWidth - g_nButPosFull[g_nIndexMessage][0];
  2998. }
  2999. yCoord = g_nButPos[g_nIndexMessage][1] - 1000;
  3000. MFBar.SetObjectPosition("MessageFull", xCoord, yCoord,
  3001. MessageFull.TextWidth, g_nButPosFull[g_nIndexMessage][3]);
  3002. if (g_LTRReading)
  3003. {
  3004. xCoord = Title.TextWidth;
  3005. }
  3006. else
  3007. {
  3008. xCoord = g_ConWidth - Title.TextWidth - Message.TextWidth - g_nButPos[g_nIndexMessage][0];
  3009. }
  3010. yCoord = g_nButPos[g_nIndexMessage][1];
  3011. MFBar.SetObjectPosition("Message", xCoord, yCoord,
  3012. Message.TextWidth, g_nButPos[g_nIndexMessage][3]);
  3013. }
  3014. else if (id == FOCUSTIMER) {
  3015. if (MFBar.ObjectEnabled(g_strFocusObj)) {
  3016. btn = MFBar.GetObjectUnknown(g_strFocusObj);
  3017. if (!btn.Disable)
  3018. MFBar.SetObjectFocus(g_strFocusObj, true);
  3019. }
  3020. else {
  3021. }
  3022. }
  3023. }
  3024. /*************************************************************/
  3025. /* Name: UpdateDVDMessage
  3026. /* Description:
  3027. /*************************************************************/
  3028. function UpdateDVDMessage() {
  3029. if (g_bFirstPlaying)
  3030. return;
  3031. if (g_bFullScreen && !g_bActivityDeclined)
  3032. {
  3033. if (g_LTRReading)
  3034. {
  3035. xCoord = TitleFull.TextWidth + g_nButPosFull[g_nIndexMessage][0];
  3036. }
  3037. else
  3038. {
  3039. xCoord = g_ConWidth - TitleFull.TextWidth - MessageFull.TextWidth - g_nButPosFull[g_nIndexMessage][0];
  3040. }
  3041. yCoord = g_nButPosFull[g_nIndexMessage][1];
  3042. MFBar.SetObjectPosition("MessageFull", xCoord, yCoord,
  3043. MessageFull.TextWidth, g_nButPosFull[g_nIndexMessage][3]);
  3044. MFBar.SetObjectPosition("Message", xCoord, yCoord - 1000,
  3045. Message.TextWidth, g_nButPos[g_nIndexMessage][3]);
  3046. }
  3047. else if (!g_bFullScreen)
  3048. {
  3049. if (g_LTRReading)
  3050. {
  3051. xCoord = Title.TextWidth + g_nButPos[g_nIndexMessage][0];
  3052. }
  3053. else
  3054. {
  3055. xCoord = g_ConWidth - Title.TextWidth - Message.TextWidth - g_nButPos[g_nIndexMessage][0];
  3056. }
  3057. yCoord = g_nButPos[g_nIndexMessage][1];
  3058. MFBar.SetObjectPosition("Message", xCoord, yCoord,
  3059. Message.TextWidth, g_nButPos[g_nIndexMessage][3]);
  3060. MFBar.SetObjectPosition("MessageFull", xCoord, yCoord - 1000,
  3061. MessageFull.TextWidth, g_nButPosFull[g_nIndexMessage][3]);
  3062. }
  3063. }
  3064. /*************************************************************/
  3065. /* Name: UpdateDVDTitle
  3066. /* Description:
  3067. /*************************************************************/
  3068. function UpdateDVDTitle() {
  3069. if (g_bFirstPlaying) {
  3070. TitleFull.Text = L_DVDPlayer_TEXT;
  3071. Title.Text = L_DVDPlayer_TEXT;
  3072. }
  3073. else {
  3074. try {
  3075. nTitle = DVD.CurrentTitle;
  3076. nChap = DVD.CurrentChapter;
  3077. var tempstr = L_DVDPlayerTitleChapter_TEXT.replace(/%1/i, nTitle).replace(/%2/i, nChap);
  3078. TitleFull.Text = tempstr;
  3079. Title.Text = tempstr;
  3080. }
  3081. catch(e) {
  3082. TitleFull.Text = L_DVDPlayer_TEXT;
  3083. Title.Text = L_DVDPlayer_TEXT;
  3084. }
  3085. }
  3086. if (g_bFullScreen && !g_bActivityDeclined)
  3087. {
  3088. if (g_LTRReading)
  3089. {
  3090. xCoord = g_nButPosFull[g_nIndexTitle][0];
  3091. }
  3092. else
  3093. {
  3094. xCoord = g_ConWidth - g_nButPosFull[g_nIndexTitle][0] - TitleFull.TextWidth;
  3095. }
  3096. yCoord = g_nButPosFull[g_nIndexTitle][1];
  3097. MFBar.SetObjectPosition("TitleFull", xCoord, yCoord,
  3098. TitleFull.TextWidth, g_nButPos[g_nIndexTitle][3]);
  3099. MFBar.SetObjectPosition("Title", xCoord, yCoord - 1000,
  3100. Title.TextWidth, g_nButPos[g_nIndexTitle][3]);
  3101. }
  3102. else if (!g_bFullScreen)
  3103. {
  3104. if (g_LTRReading)
  3105. {
  3106. xCoord = g_nButPos[g_nIndexTitle][0];
  3107. }
  3108. else
  3109. {
  3110. xCoord = g_ConWidth - g_nButPos[g_nIndexTitle][0] - Title.TextWidth;
  3111. }
  3112. yCoord = g_nButPos[g_nIndexTitle][1];
  3113. MFBar.SetObjectPosition("Title", xCoord, yCoord,
  3114. Title.TextWidth, g_nButPos[g_nIndexTitle][3]);
  3115. MFBar.SetObjectPosition("TitleFull", xCoord, yCoord - 1000,
  3116. TitleFull.TextWidth, g_nButPos[g_nIndexTitle][3]);
  3117. }
  3118. UpdateDVDMessage();
  3119. }
  3120. /*************************************************************/
  3121. /* Name: DisableDVDUI
  3122. /* Description: Disable DVD related UI
  3123. /*************************************************************/
  3124. function DisableDVDUI(fDisable)
  3125. {
  3126. // Disable the buttons
  3127. for (i=0; i<=g_nIndexEnter; i++) {
  3128. btn = MFBar.GetObjectUnknown(g_strButID[i]);
  3129. btn.Disable = fDisable;
  3130. btn = MFBar.GetObjectUnknown(g_strButID[i]+"Full");
  3131. btn.Disable = fDisable;
  3132. }
  3133. Stop.Disable = fDisable;
  3134. StopFull.Disable = fDisable;
  3135. // Disable the sliders and time
  3136. for (i=g_nNumButs+1; i<=g_nNumButs+7; i++) {
  3137. btn = MFBar.GetObjectUnknown(g_strButID[i]);
  3138. btn.Disable = fDisable;
  3139. btn = MFBar.GetObjectUnknown(g_strButID[i]+"Full");
  3140. btn.Disable = fDisable;
  3141. }
  3142. }
  3143. /*************************************************************/
  3144. /* Function: SetupFocus */
  3145. /* Description: Sets up the focus array. */
  3146. /*************************************************************/
  3147. function SetupFocus(){
  3148. //MFBar.MessageBox("SetupFocus", "");
  3149. try {
  3150. MFBar.ResetFocusArray();
  3151. if(!g_bExpanded){
  3152. strArray = g_strFocusID
  3153. }
  3154. else {
  3155. strArray = g_strFocusExpandedID
  3156. }/* end of if statement */
  3157. if(!g_bFullScreen){
  3158. for(i = 0; i < strArray.length; i++){
  3159. MFBar.AddFocusObject(strArray[i]);
  3160. }/* end of for loop */
  3161. }
  3162. else {
  3163. for(i = 0; i < strArray.length; i++){
  3164. MFBar.AddFocusObject(strArray[i]+"Full");
  3165. }/* end of for loop */
  3166. }
  3167. }
  3168. catch(e){
  3169. // we really do not care much
  3170. }
  3171. }/* end of function SetupFocus */
  3172. /*************************************************************/
  3173. /* Name: SetFocus
  3174. /* Description: Give focus to object with strID
  3175. /*************************************************************/
  3176. function SetFocus(strID) {
  3177. if (!g_bFullScreen) {
  3178. //MFBar.SetObjectFocus(strID, true);
  3179. g_strFocusObj = strID;
  3180. MFBar.SetTimeOut(2, FOCUSTIMER);
  3181. }
  3182. else {
  3183. //MFBar.SetObjectFocus(strID+"Full", true);
  3184. g_strFocusObj = strID+"Full";
  3185. MFBar.SetTimeOut(2, FOCUSTIMER);
  3186. }
  3187. }
  3188. /*************************************************************/
  3189. /* Name: HasFocus
  3190. /* Description: Give focus to object with strID
  3191. /*************************************************************/
  3192. function HasFocus(strID) {
  3193. if (!g_bFullScreen) {
  3194. return MFBar.HasObjectFocus(strID);
  3195. }
  3196. else {
  3197. return MFBar.HasObjectFocus(strID+"Full");
  3198. }
  3199. }
  3200. /*************************************************************/
  3201. /* Name: HandleError
  3202. /* Description: Handles errors
  3203. /*************************************************************/
  3204. function HandleError(error, ShallClose){
  3205. MFBar.MessageBox(error.description, L_Error_TEXT);
  3206. if (ShallClose)
  3207. {
  3208. close_OnClick();
  3209. }
  3210. //TextBox.Text = r;
  3211. }/* end of function HandleError */
  3212. ""