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.

5001 lines
148 KiB

  1. /*************************************************************************/
  2. /* File: dvdlayouyt.js */
  3. /* Description: Script for DVD Player. */
  4. /*************************************************************************/
  5. // Initialize with english locale. We will set these variables based on current system locale
  6. var g_LocaleEnglish = true;
  7. var g_LTRReading = true;
  8. function SetLocaleInfo()
  9. {
  10. var Locale = MFBar.GetUserLCID();
  11. switch (Locale)
  12. {
  13. case 0x0409: // English locales
  14. case 0x0809:
  15. case 0x1009:
  16. case 0x1409:
  17. case 0x0c09:
  18. case 0x1809:
  19. case 0x1c09:
  20. g_LocaleEnglish = true;
  21. g_LTRReading = true;
  22. break;
  23. case 0x040d: // Hebrew
  24. case 0x0401: // different versions of Arabic
  25. case 0x0801:
  26. case 0x0c01:
  27. case 0x1001:
  28. case 0x1401:
  29. case 0x1801:
  30. case 0x1c01:
  31. case 0x2001:
  32. case 0x2401:
  33. case 0x2801:
  34. case 0x2c01:
  35. case 0x3001:
  36. case 0x3401:
  37. case 0x3801:
  38. case 0x3c01:
  39. case 0x4001:
  40. g_LocaleEnglish = false;
  41. g_LTRReading = false;
  42. break;
  43. default:
  44. g_LocaleEnglish = false;
  45. g_LTRReading = true;
  46. break;
  47. }
  48. }
  49. //
  50. // error messages for the end user. these strings should be localized.
  51. //
  52. var L_ERRORNoSubpictureStream_TEXT = "The DVD player is unable to display subtitles or highlights in menus. Try reinstalling the decoder, or contact your device manufacturer to get an updated decoder.";
  53. var L_ERRORCopyProtectFail_TEXT = "DVD player is unable to play this disc because the disc is copyright protected.";
  54. var L_ERRORInvalidDVD10Disc_TEXT = "Unable to play this DVD disc. The disc is incompatible with this player.";
  55. var L_ERRORInvalidDiscRegion_TEXT= "You cannot play the current disc in your region of the world. Each DVD is authored to play in certain geographic regions. You need to obtain a disc that is intended for your region.";
  56. var L_ERRORLowParentalLevel_TEXT= "The rating of this title exceeds your permission level. To change your permission level, click Help.";
  57. // Close app when the following errors occur
  58. var L_ERRORMacrovisionFail_TEXT= "Windows cannot play this copy-protected DVD disc. To fix this, click Help.";
  59. var L_ERRORIncompatibleSystemAndDecoderRegions_TEXT = "This DVD disc cannot be played. The system region of %1 does not match the decoder region of %2. For more information about region settings, click Help.";
  60. var L_ERRORIncompatibleDiscAndDecoderRegions_TEXT = "You cannot play the current disc authored for region(s) %1. Each DVD is authored to play in certain geographic regions. You need to obtain a disc that is intended for your region of %2.";
  61. var L_ERROREject_TEXT = "The DVD player cannot eject the disc. Close DVD player, and then eject the disc manually.";
  62. var L_ERRORFailCreatingObject_TEXT = "DVD player cannot run. Restart the computer, and then try again. If the problem persists, try System Restore. To run System Restore, click Start, point to Program Files, System Tools, and then click System Restore.";
  63. var L_ERRORUnexpectedError_TEXT = "There is an unexpected error while operating DVD controls. Please try restarting the player if the problem persists.";
  64. 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.";
  65. var L_ERRORHelp_TEXT = "There is a error while launching Help.";
  66. var L_ERRORTime_TEXT = "There is an error displaying the progress. Try starting the DVD player again.";
  67. var L_ERRORToolTip_TEXT = "There is an error displaying the tool tip. Try starting the DVD player again.";
  68. var L_ERRORCapture_TEXT = "DVD player is unable to capture image because the decoder on your system does not support it.";
  69. var L_ERRORVideoStream_TEXT = "Unable to play DVD video. Close some programs, and then try again. If the problem persists, click Help.";
  70. var gcEVideoStream = -2147217418;
  71. var L_ERRORDVDGraphBuilding_TEXT = "Unable to play DVD video. Close some files or programs, and then try again. If this doesn't work, restart the computer.";
  72. var gcEDVDGraphBuilding = -2147220870;
  73. var L_ERRORAudioStream_TEXT = "DVD audio isn't working. Make sure your sound card is setup correctly. For help about setting up your sound card, click Help.";
  74. var gcEAudioStream = -2147217419;
  75. var L_ERRORNoDecoder_TEXT = "To use the DVD player, you need to install either a software DVD decoder, or a hardware DVD decoder. For more information, click Help.";
  76. var gcENoDecoder = -2147217415;
  77. var L_ERRORNoOverlay_TEXT = "Your video card doesn't support DVD playback. For information about updating your videocard, click Help.";
  78. var gcENoOverlay = -2147217417;
  79. // captions on buttons
  80. var L_ButtonTextMenu_TEXT = "Menu";
  81. var L_ButtonTextTitleMenu_TEXT = "Title";
  82. var L_ButtonTextResume_TEXT = "Resume";
  83. var L_ButtonTextEnCC_TEXT = "Caption";
  84. var L_ButtonTextDiCC_TEXT = "Caption";
  85. var L_ButtonTextSubtitle_TEXT = "Subtitle";
  86. var L_ButtonTextAudio_TEXT = "Audio";
  87. var L_ButtonTextAngle_TEXT = "Angle";
  88. var L_ButtonTextHelp_TEXT = "Help";
  89. var L_ButtonTextOptions_TEXT = "Options";
  90. var L_ButtonFontSize_NUMBER = 8;
  91. var L_ButtonFontFace_TEXT = "Tahoma";
  92. var L_TitleFontSize_NUMBER = 8;
  93. var L_TitleFontFace_TEXT = "Tahoma";
  94. var L_Error_TEXT = "Error";
  95. var L_DVDPlayer_TEXT = "DVD Player";
  96. var L_TitleChapter_TEXT = "Title: %1 Chapter: %2";
  97. var L_HHMMSS_TEXT = "%1";
  98. var L_ProgressHHMMSS_TEXT = "Time Elapsed: %1";
  99. var L_CCDisabled_TEXT = "Closed Captions Disabled";
  100. var L_CCEnabled_TEXT = "Closed Captions Enabled";
  101. var L_NoSubtitles_TEXT = "No subtitles";
  102. var L_SubtitlesAreLanguageClickToDisable_TEXT = "Subtitles are %1, click to disable";
  103. var L_SubtitlesAreDisabledClickForLanguage_TEXT = "Subtitles are disabled, click for %1";
  104. var L_SubtitlesAreLanguageClickForLanguage_TEXT = "Subtitles are %1, click for %2";
  105. var L_NoAudioTracks_TEXT = "No audio tracks";
  106. var L_AudioLanguageIsXNoMoreAudioTracks_TEXT = "Audio language is %1, no more audio tracks";
  107. var L_AudioLanguageIsXClickForY_TEXT = "Audio language is %1, click for %2";
  108. var L_ViewingAngleIs1NoMoreViewingAngles_TEXT = "Viewing angle is #1, no more viewing angles";
  109. var L_ViewingAngleIsXClickForY_TEXT = "Viewing angle is #%1, click for #%2";
  110. var L_REVERSE_TEXT = "Reverse %1x";
  111. var L_FORWARD_TEXT = "Forward %1x";
  112. var L_ClosedCaption_TEXT = "Closed Captions";
  113. // Button positions and if visible initially
  114. var g_bTimeSliderUpdate = true;
  115. var g_nVariableSpeedOffset = 2;
  116. var g_nNumButs = 39;
  117. var g_nNumTexts = 4;
  118. var g_nNumSliders = 3;
  119. var g_bFirstPlaying = true;
  120. var g_PlayBackRate = 10000;
  121. var cgVOLUME_MIN = -10000;
  122. var cgVOLUME_MAX = 0;
  123. var g_ConWidth = 620;
  124. var g_ConHeight = 420;
  125. var g_DVDWidth = 540;
  126. var g_DVDHeight = 350;
  127. var g_DVDLeft = (g_ConWidth - g_DVDWidth) /2;
  128. var g_DVDTop = 40;
  129. var g_DVDAspectRatio = 0;
  130. var g_MinWidth = 420;
  131. var g_MinHeight = 300;
  132. var g_ButOneLineHeight = 31;
  133. var g_ButHeight = g_ButOneLineHeight;
  134. var g_strButID;
  135. var g_InitializationState = 1; // 0 Creating Objects 1 Init 2 Run, 3 done
  136. var g_bFullScreen = false;
  137. var g_bActivityDeclined = false;
  138. var g_bExpanded = false;
  139. var g_bRestoreNeeded = false;
  140. var g_bStillOn = false;
  141. var g_bStillOffValid = false;
  142. var g_bMenuOn = false;
  143. var g_bDVDUIDisabled = false;
  144. var g_strFocusObj = "Pause";
  145. var g_nYOutOfScreen = -5000;
  146. var g_clrFrame = 0xc9ad98;
  147. var g_clrFrameTitleBar = 0x9c8c73;
  148. var g_clrSplashBackBg = 0x0;
  149. var g_bEnableTimeOut = true;
  150. var g_bNoSubpictureStream = false;
  151. var DVDMSGTIMER = 999;
  152. var g_bDVDMessageActive = false;
  153. var NO_HELP = 0;
  154. var MB_HELP = 0x00004000; // Help Button on MessageBox
  155. var HELP_CONTEXTPOPUP = 0x0008; // Help context popup
  156. var HH_DISPLAY_TOPIC = 0x0000; // flag used with HTML help
  157. var HH_DISPLAY_INDEX = 0x0002; // not currently implemented
  158. var HH_HELP_CONTEXT = 0x000F; // display mapped numeric value in dwData
  159. // index to the array of objects
  160. var g_nIndexPause = 0;
  161. var g_nIndexPlay = 1;
  162. var g_nIndexFF = 2;
  163. var g_nIndexRW = 3;
  164. var g_nIndexPrev = 4;
  165. var g_nIndexNext = 5;
  166. var g_nIndexMenu = 6;
  167. var g_nIndexResume = 7;
  168. var g_nIndexEnCC = 8;
  169. var g_nIndexDiCC = 9;
  170. var g_nIndexStepFw = 10;
  171. var g_nIndexStepBk = 11;
  172. var g_nIndexSubtitle = 12;
  173. var g_nIndexAudio = 13;
  174. var g_nIndexAngle = 14;
  175. var g_nIndexZoomIn = 15;
  176. var g_nIndexZoomOut = 16;
  177. var g_nIndexCapture = 17;
  178. var g_nIndexMute = 18;
  179. var g_nIndexSound = 19;
  180. var g_nIndexRight = 20;
  181. var g_nIndexLeft = 21;
  182. var g_nIndexUp = 22;
  183. var g_nIndexDown = 23;
  184. var g_nIndexEnter = 24;
  185. var g_nIndexHelp = 25;
  186. var g_nIndexOptions = 26;
  187. var g_nIndexContextHelp = 27;
  188. var g_nIndexMaximize = 28;
  189. var g_nIndexRestore = 29;
  190. var g_nIndexMinimize = 30;
  191. var g_nIndexClose = 31;
  192. var g_nIndexExpand = 32;
  193. var g_nIndexShrink = 33;
  194. var g_nIndexEject = 34;
  195. var g_nIndexStop = 35;
  196. var g_nIndexTitleMenu = 36;
  197. var g_nIndexTitleResume = 37;
  198. var g_nIndexIcon = 38;
  199. var g_nIndexTimeline = 39;
  200. var g_nIndexSpeed = 40;
  201. var g_nIndexVolume = 41;
  202. var g_nIndexTextbox = 42;
  203. var g_nIndexTitle = 43;
  204. var g_nIndexChapter = 44;
  205. var g_nIndexMessage = 45;
  206. var g_TextColorActive = 0x2a3fff;
  207. var g_TextColorHover = 0xf45c47;
  208. var g_TextColorDown = 0xff3f2a;
  209. var g_TextColorDisabled = 0xa6917a;
  210. var g_TextColorStatic = 0x2d2824;
  211. // Button postions for windowed mode
  212. var g_nButPos = new Array(
  213. new Array(60, 10, 19, 19, true, 1, 1), //pause 0
  214. new Array(30, 8, 24, 25, true, 1, 1), //play 1
  215. new Array(118,10, 26, 19, true, 1, 1), //ff 2
  216. new Array( 90,10, 26, 19, true, 1, 1), //rw 3
  217. new Array(155,10, 26, 19, true, 1, 1), //prev 4
  218. new Array(183,10, 26, 19, true, 1, 1), //next 5
  219. new Array(490,10, 47, 19, true, 1, 1), //menu 6
  220. new Array(490,10, 47, 19, false,1, 1), //resume 7
  221. new Array(220,-5000, 46, 15, true, 1, 1), //enable CC 8
  222. new Array(220,-5000, 46, 15, false,1, 1), //disable CC 9
  223. new Array(185,42, 26, 19, true, 2, 1), //stepfwd 10
  224. new Array(115,42, 26, 19, true, 1, 1), //stepbak 11
  225. new Array(270,44, 46, 15, true, 1, 1), //sp 12
  226. new Array(320,44, 46, 15, true, 1, 1), //audio 13
  227. new Array(370,44, 46, 15, true, 1, 1), //angle 14
  228. new Array(430,44, 18, 18, true, 1, 1), //zoomin 15
  229. new Array(450,44, 18, 18, true, 1, 1), //zoomout 16
  230. new Array(470,44, 19, 19, true, 1, 1), //capture 17
  231. new Array(520,10, 17, 15, true, 1, 1), //mute 18
  232. new Array(520,10, 17, 15, false,1, 1), //sound 19
  233. new Array(570,15, 9, 14, false, 2, 1), //right 20
  234. new Array(545,15, 9, 14, false, 1, 1), //left 21
  235. new Array(555,5, 14, 9, false, 1, 1), //up 22
  236. new Array(555,28, 14, 9, false, 2, 1), //down 23
  237. new Array(555,14, 14, 14, false,1, 1), //enter 24
  238. new Array(520,44, 46, 15, true, 1, 1), //help 25
  239. new Array(550,44, 45, 15, true, 1, 1), //options 26
  240. new Array(63,8, 16, 14, false, 0, 0), //contexthelp 27
  241. new Array(29,8, 16, 14, true, 0, 0), //maximize 28
  242. new Array(29,8, 16, 14, false,0, 0), //restore 29
  243. new Array(45,8, 16, 14, true, 0, 0), //minimize 30
  244. new Array(11,8, 16, 14, true, 0, 0), //close 31
  245. new Array(585,10, 14,15, true, 1, 1), //expand 32
  246. new Array(585,10, 14,15, false,1, 1), //shrink 33
  247. new Array(220,10, 19,19, true, 1, 1), //eject 34
  248. new Array(60, 10, 19,19, false,1, 1), //stop 35
  249. new Array(490,10, 47, 19, true, 1, 1), //TitleMenu 36
  250. new Array(490,10, 47, 19, false,1, 1), //TitleResume 37
  251. new Array(6, 6, 16, 16, true,1, 0), //TitleIcon 38
  252. new Array(333,10, 83,20, true, 1, 1), //39 Timeline
  253. new Array(30, 40, 111,20, true, 1, 1), //40 Playspeed
  254. new Array(452,10, 66,19, true, 1, 1), //41 Volslider
  255. new Array(45, 5, 0,18, true, 1, -1), //42 TextBox
  256. new Array(25, 5, 0,18, true, 1, -1), //43 DVD Player
  257. new Array(35, 5, 0,18, true, 1, -1), //44 Title Chapter No
  258. new Array(45, 5, 0,18, true, 1, -1) //45 DVD Message Textbox
  259. );
  260. // Button postions for full screen mode
  261. var g_nButPosFull = new Array(
  262. new Array(60, 10, 17, 17, true, 5, 1), //pause 0
  263. new Array(30, 8, 23, 23, true, 5, 1), //play 1
  264. new Array(118,10, 25, 18, true, 5, 1), //ff 2
  265. new Array( 90,10, 25, 18, true, 5, 1), //rw 3
  266. new Array(155,10, 25, 18, true, 5, 1), //prev 4
  267. new Array(183,10, 25, 18, true, 5, 1), //next 5
  268. new Array(490,10, 43, 17, true, 5, 1), //menu 6
  269. new Array(490,10, 43, 17, false,5, 1), //resume 7
  270. new Array(220,-5000, 46, 15, true, 5, 1), //enable CC 8
  271. new Array(220,-5000, 46, 15, false,5, 1), //disable CC 9
  272. new Array(185,42, 25, 18, true, 6, 1), //stepfwd 10
  273. new Array(117,42, 25, 18, true, 5, 1), //stepbak 11
  274. new Array(270,44, 46, 15, true, 5, 1), //sp 12
  275. new Array(320,44, 46, 15, true, 5, 1), //audio 13
  276. new Array(370,44, 46, 15, true, 5, 1), //angle 14
  277. new Array(430,44, 16, 16, true, 5, 1), //zoomin 15
  278. new Array(450,44, 16, 16, true, 5, 1), //zoomout 16
  279. new Array(470,44, 17, 17, true, 5, 1), //capture 17
  280. new Array(520,10, 15, 14, true, 5, 1), //mute 18
  281. new Array(520,10, 15, 14, false,5, 1), //sound 19
  282. new Array(570,15, 9, 14, false, 6, 1), //right 20
  283. new Array(545,15, 9, 14, false, 5, 1), //left 21
  284. new Array(555,5, 14, 9, false, 5, 1), //up 22
  285. new Array(555,28, 14, 9, false, 6, 1), //down 23
  286. new Array(555,14, 14, 14,false, 5, 1), //enter 24
  287. new Array(520,44, 46, 15, true, 5, 1), //help 25
  288. new Array(550,44, 45, 15, true, 5, 1), //options 26
  289. new Array(63,8, 16, 14, false, 0, 0), //contextHelp 27
  290. new Array(29,8, 16, 14, true, 0, 0), //maximize 28
  291. new Array(29,8, 16, 14, false,0, 0), //restore 29
  292. new Array(45,8, 16, 14, true, 0, 0), //minimize 30
  293. new Array(11,8, 16, 14, true, 0, 0), //close 31
  294. new Array(585,10, 14,15, true, 5, 1), //expand 32
  295. new Array(585,10, 14,15, false,5, 1), //shrink 33
  296. new Array(220,10, 17,17, true, 5, 1), //eject 34
  297. new Array(60, 10, 17,17, false,5, 1), //stop 35
  298. new Array(490,10, 43,17, true, 5, 1), //TitleMenu 36
  299. new Array(490,10, 43,17, false,5, 1), //TitleResume 37
  300. new Array(6, 6, 16, 16, true, 5, 0), //TitleIcon 38
  301. new Array(333,44, 83,20, true, 5, 1), // 39 Timeline
  302. new Array(30, 40, 111,20, true, 5, 1), // 40 Playspeed
  303. new Array(452,12, 66,19, true, 5, 1), // 41 Volslider
  304. new Array(45, 5, 0,18, true, 5, -1), // 42 TextBox
  305. new Array(25, 5, 0,18, true, 5, -1), // 43 DVD Player
  306. new Array(35, 5, 0,18, true, 5, -1), // 44 Title Chapter No
  307. new Array(45, 5, 0,18, true, 5, -1) // 45 DVD Message Textbox
  308. );
  309. var g_FlexLayoutRow1 = new Array (
  310. // ButtonIndex, mingap, maxgap (in front of button)
  311. new Array(g_nIndexPlay, 0, 0), // play
  312. new Array(g_nIndexPause, 4, 8), // pause
  313. new Array(g_nIndexRW, 4, 12), // rw
  314. new Array(g_nIndexFF, 1, 3), // ff
  315. new Array(g_nIndexPrev, 4, 12), // prev track
  316. new Array(g_nIndexNext, 1, 3), // next track
  317. new Array(g_nIndexEject, 4, 12), // eject
  318. new Array(g_nIndexTimeline, 4,12), // timeline
  319. new Array(g_nIndexLeft, 4, 12), // left
  320. new Array(g_nIndexEnter, 1, 1), // enter
  321. new Array(g_nIndexRight, 1, 1), // right
  322. new Array(g_nIndexMenu, 4, 12), // menu
  323. new Array(g_nIndexTitleMenu,4,12), // title menu
  324. new Array(g_nIndexVolume, 6, 18), // volume
  325. new Array(g_nIndexMute, 3, 3), // mute
  326. new Array(g_nIndexExpand, 10, 18) // expand
  327. );
  328. var g_FlexLayoutRow2 = new Array (
  329. // ButtonIndex, mingap, maxgap (in front of button)
  330. new Array(g_nIndexSpeed, 0, 0), // speed
  331. new Array(g_nIndexStepBk, 4, 12), // stepbak
  332. new Array(g_nIndexStepFw, 1, 3), // stepfwd
  333. new Array(g_nIndexAudio, 6, 18), // audio
  334. new Array(g_nIndexSubtitle,3, 9), // subtitle
  335. new Array(g_nIndexAngle, 3, 9), // angle
  336. new Array(g_nIndexZoomIn, 6, 18), // zoom in
  337. new Array(g_nIndexZoomOut, 3, 9), // zoom out
  338. new Array(g_nIndexCapture, 3, 9), // capture
  339. new Array(g_nIndexHelp, 6, 18), // options
  340. new Array(g_nIndexOptions, 6, 18) // options
  341. );
  342. var g_nButtonsOnRow1 = 16;
  343. var g_nButtonsOnRow2 = 11;
  344. var g_nMinMargin = 40; // margin from container
  345. var g_nExtraMargin = 0; // extra space for the second row
  346. var g_nMaxControlAreaWidth = 600; // 600
  347. var g_nMinControlAreaWidth = 450; // 450
  348. // this function dynamically reposition the two rows of buttons by adjusting
  349. // the spacing
  350. function PositionButtons(nContainerWidth, nContainerHeight, bFullScreen)
  351. {
  352. var nTotalMaxGaps1 = 0;
  353. var nTotalMinGaps1 = 0;
  354. var nTotalButtonWidth1 = 0;
  355. for (i=0; i<g_nButtonsOnRow1; i++)
  356. {
  357. nIndex = g_FlexLayoutRow1[i][0];
  358. nTotalButtonWidth1 += bFullScreen?g_nButPosFull[nIndex][2]:g_nButPos[nIndex][2];
  359. nTotalMinGaps1 += g_FlexLayoutRow1[i][1];
  360. nTotalMaxGaps1 += g_FlexLayoutRow1[i][2];
  361. }
  362. var nTotalMinGaps2 = 0;
  363. var nTotalMaxGaps2 = 0;
  364. var nTotalButtonWidth2 = 0;
  365. for (i=0; i<g_nButtonsOnRow2; i++)
  366. {
  367. nIndex = g_FlexLayoutRow2[i][0];
  368. nTotalButtonWidth2 += bFullScreen?g_nButPosFull[nIndex][2]:g_nButPos[nIndex][2];
  369. nTotalMinGaps2 += g_FlexLayoutRow2[i][1];
  370. nTotalMaxGaps2 += g_FlexLayoutRow2[i][2];
  371. }
  372. // the control area includes the buttons and the spaces in between,
  373. // but not include the margin of the container on the two sides.
  374. // the maximum control area width is pre-defined, but it should not be
  375. // wider than the maximum stretched size of the control area
  376. var nMaxControlAreaWidth = Math.max(nTotalButtonWidth1 + nTotalMaxGaps1,
  377. g_nExtraMargin*2 + nTotalButtonWidth2 + nTotalMaxGaps2);
  378. if (nMaxControlAreaWidth > g_nMaxControlAreaWidth)
  379. {
  380. nMaxControlAreaWidth = g_nMaxControlAreaWidth;
  381. }
  382. // the minimum control area width is pre-defined, but it should not be
  383. // narrower than the minimum compressed size of the control area
  384. var nMinControlAreaWidth = Math.max(nTotalButtonWidth1 + nTotalMinGaps1,
  385. g_nExtraMargin*2 + nTotalButtonWidth2 + nTotalMinGaps2);
  386. var nMargin = g_nMinMargin;
  387. var nControlAreaWidth = nContainerWidth - nMargin*2;
  388. var bClipControl = false;
  389. if (nControlAreaWidth < nMinControlAreaWidth)
  390. {
  391. // not enough room for control area, we will keep the default margin on
  392. // the left side as well as the control spacing, but allow the controls
  393. // to go beyond the right-side edge
  394. nControlAreaWidth = nMinControlAreaWidth;
  395. bClipControl = true;
  396. }
  397. else if(nControlAreaWidth > nMaxControlAreaWidth)
  398. {
  399. // two much room for the control area, we will fix the control spacing
  400. // at the maximum, but make the margin wider
  401. nControlAreaWidth = nMaxControlAreaWidth;
  402. nMargin = (nContainerWidth - nControlAreaWidth)/2;
  403. }
  404. // the control area width is within the flexible range of spacing,
  405. // we will distribute the space between the controls.
  406. // first row
  407. var nVariableWidth = nControlAreaWidth - nTotalButtonWidth1 - nTotalMinGaps1;
  408. var nTotalDelta = nTotalMaxGaps1 - nTotalMinGaps1;
  409. var xOffset = nMargin;
  410. var nExpandButtonWidth = bFullScreen?g_nButPosFull[g_nIndexExpand][2]:g_nButPos[g_nIndexExpand][2];
  411. for (i=0; i<g_nButtonsOnRow1; i++)
  412. {
  413. nIndex = g_FlexLayoutRow1[i][0];
  414. nDelta = g_FlexLayoutRow1[i][2] - g_FlexLayoutRow1[i][1];
  415. nGap = g_FlexLayoutRow1[i][1] + Math.round(nVariableWidth*nDelta*1.0/nTotalDelta);
  416. xOffset += nGap; // advance by the gap width in front of control
  417. nWidth = bFullScreen?g_nButPosFull[nIndex][2]:g_nButPos[nIndex][2];
  418. if (!bClipControl ||
  419. xOffset + nWidth <= nContainerWidth - nMargin - (8+nExpandButtonWidth))
  420. {
  421. g_nButPos[nIndex][0] = xOffset;
  422. }
  423. else
  424. {
  425. // button steps outside of control area, make it go away
  426. g_nButPos[nIndex][0] = g_nYOutOfScreen;
  427. }
  428. xOffset += nWidth; // advance by the control width
  429. }
  430. g_nButPos[g_nIndexExpand][0] = nContainerWidth - nMargin - nExpandButtonWidth;
  431. // same thing for second row
  432. nVariableWidth = nControlAreaWidth - nTotalButtonWidth2 - nTotalMinGaps2 - g_nExtraMargin*2;
  433. nTotalDelta = nTotalMaxGaps2 - nTotalMinGaps2;
  434. xOffset = nMargin + g_nExtraMargin - 2;
  435. for (i=0; i<g_nButtonsOnRow2; i++)
  436. {
  437. nDelta = g_FlexLayoutRow2[i][2] - g_FlexLayoutRow2[i][1];
  438. nGap = g_FlexLayoutRow2[i][1] + Math.round(nVariableWidth*nDelta*1.0/nTotalDelta);
  439. xOffset += nGap; // advance by the gap width in front of control
  440. nIndex = g_FlexLayoutRow2[i][0];
  441. nWidth = bFullScreen?g_nButPosFull[nIndex][2]:g_nButPos[nIndex][2];
  442. if (!bClipControl ||
  443. xOffset + nWidth <= nContainerWidth - nMargin - g_nExtraMargin)
  444. {
  445. g_nButPos[nIndex][0] = xOffset;
  446. }
  447. else
  448. {
  449. // button steps outside of control area, make it go away
  450. g_nButPos[nIndex][0] = g_nYOutOfScreen;
  451. }
  452. xOffset += nWidth; // advance by the control width
  453. }
  454. // move other overlaping controls
  455. g_nButPos[g_nIndexStop][0] = g_nButPos[g_nIndexPause][0];
  456. g_nButPos[g_nIndexDiCC][0] = g_nButPos[g_nIndexEnCC][0];
  457. g_nButPos[g_nIndexResume][0] = g_nButPos[g_nIndexMenu][0];
  458. g_nButPos[g_nIndexUp][0] = g_nButPos[g_nIndexEnter][0];
  459. g_nButPos[g_nIndexDown][0] = g_nButPos[g_nIndexEnter][0];
  460. g_nButPos[g_nIndexShrink][0] = g_nButPos[g_nIndexExpand][0];
  461. g_nButPos[g_nIndexSound][0] = g_nButPos[g_nIndexMute][0];
  462. g_nButPos[g_nIndexTitleResume][0] = g_nButPos[g_nIndexTitleMenu][0];
  463. // the direction controls are a group. If one disappears, all should disappear
  464. if (g_nButPos[g_nIndexRight][0] < 0)
  465. {
  466. g_nButPos[g_nIndexEnter][0] = g_nYOutOfScreen;
  467. g_nButPos[g_nIndexLeft][0] = g_nYOutOfScreen;
  468. g_nButPos[g_nIndexUp][0] = g_nYOutOfScreen;
  469. g_nButPos[g_nIndexDown][0] = g_nYOutOfScreen;
  470. }
  471. }
  472. // Button ID's for windowed mode
  473. var g_strButID = new Array(
  474. "Pause",
  475. "Play",
  476. "FastForward",
  477. "Rewind",
  478. "SkipBackward",
  479. "SkipForward",
  480. "Menu",
  481. "Resume",
  482. "EnCC",
  483. "DiCC",
  484. "StepFwd",
  485. "StepBak",
  486. "Subtitles",
  487. "Audio",
  488. "Angles",
  489. "ZoomIn",
  490. "ZoomOut",
  491. "Capture",
  492. "Mute",
  493. "Sound",
  494. "HLRight",
  495. "HLLeft",
  496. "HLUp",
  497. "HLDown",
  498. "Enter",
  499. "Help",
  500. "Options",
  501. "ContextHelp",
  502. "Maximize",
  503. "Restore",
  504. "Minimize",
  505. "Close",
  506. "Expand",
  507. "Shrink",
  508. "Eject",
  509. "Stop",
  510. "TitleMenu",
  511. "TitleResume",
  512. "TitleIcon",
  513. "TimeSlider",
  514. "PlaySpeed",
  515. "VolSlider",
  516. "TextBox",
  517. "Title",
  518. "Chapter",
  519. "Message"
  520. );
  521. // Order in which there is an focus order
  522. var g_strFocusID = new Array(
  523. "Play",
  524. "Stop",
  525. "Pause",
  526. "Rewind",
  527. "FastForward",
  528. "SkipBackward",
  529. "SkipForward",
  530. "Eject",
  531. "TimeSlider",
  532. "Menu",
  533. "Resume",
  534. "TitleMenu",
  535. "TitleResume",
  536. "VolSlider",
  537. "Mute",
  538. "Sound",
  539. "Expand",
  540. "Shrink"
  541. );
  542. var g_strFocusExpandedID = new Array(
  543. "Play",
  544. "Stop",
  545. "Pause",
  546. "Rewind",
  547. "FastForward",
  548. "SkipBackward",
  549. "SkipForward",
  550. "Eject",
  551. "TimeSlider",
  552. "Menu",
  553. "Resume",
  554. "TitleMenu",
  555. "TitleResume",
  556. "VolSlider",
  557. "Mute",
  558. "Sound",
  559. "Expand",
  560. "Shrink",
  561. "PlaySpeed",
  562. "StepBak",
  563. "StepFwd",
  564. "Audio",
  565. "Subtitles",
  566. "Angles",
  567. "ZoomIn",
  568. "ZoomOut",
  569. "Capture",
  570. "Help",
  571. "Options"
  572. );
  573. /************************************************************************/
  574. /* Virtual keys used for keyboard handeling. */
  575. /************************************************************************/
  576. var VK_ESCAPE =0x1B;
  577. var VK_LEFT =0x25;
  578. var VK_UP =0x26;
  579. var VK_RIGHT =0x27;
  580. var VK_DOWN =0x28;
  581. var VK_SELECT =0x29;
  582. var VK_SPACE =0x20;
  583. var VK_RETURN =0x0D;
  584. var VK_F4 =0x73;
  585. var VK_PLAYPAUSE =0xB3;
  586. var VK_STOP =0xB2;
  587. var VK_PREVCHP =0xB1;
  588. var VK_NEXTCHP =0xB0;
  589. var VK_MUTE =0xAD;
  590. var VK_ISOUND =0xAF;
  591. var VK_DSOUND =0xAE;
  592. var VK_EXTEND =0xFF;
  593. /************************************************************************/
  594. /* Scan codes. */
  595. /************************************************************************/
  596. var SC_PLAYPAUSE =0x22;
  597. var SC_STOP =0x24;
  598. var SC_PREVCHP =0x10;
  599. var SC_NEXTCHP =0x19;
  600. var SC_MUTE =0x20;
  601. var SC_ISOUND =0x2E;
  602. var SC_DSOUND =0x30;
  603. var SC_EJECT =0x18;
  604. // Button tooltips
  605. // these strings should be localized
  606. var L_Pause_TEXT = "Pause";
  607. var L_Play_TEXT = "Play";
  608. var L_FastForward_TEXT = "Fast Forward";
  609. var L_Rewind_TEXT = "Rewind";
  610. var L_PreviousChapter_TEXT = "Previous Chapter";
  611. var L_NextChapter_TEXT = "Next Chapter";
  612. var L_Menu_TEXT = "Root Menu";
  613. var L_Resume_TEXT = "Resume Playback from Root Menu";
  614. var L_EnableCC_TEXT = "Enable Closed Captions";
  615. var L_DisableCC_TEXT = "Disable Closed Captions";
  616. var L_StepForward_TEXT = "Step Forward";
  617. var L_StepBack_TEXT = "Step Back";
  618. var L_Subtitle_TEXT = "Subtitle";
  619. var L_Audio_TEXT = "Audio";
  620. var L_Angle1_TEXT = "Angle #1";
  621. var L_ZoomIn_TEXT = "Zoom In";
  622. var L_ZoomOut_TEXT = "Zoom Out";
  623. var L_Capture_TEXT = "Capture Image";
  624. var L_Mute_TEXT = "Mute";
  625. var L_Sound_TEXT = "Sound";
  626. var L_Help_TEXT = "Help";
  627. var L_Options_TEXT = "Options";
  628. var L_ContextHelp_TEXT = "Context Help";
  629. var L_Right_TEXT = "Right";
  630. var L_Left_TEXT = "Left";
  631. var L_Up_TEXT = "Up";
  632. var L_Down_TEXT = "Down";
  633. var L_Enter_TEXT = "Enter";
  634. var L_Maximize_TEXT = "Maximize";
  635. var L_Restore_TEXT = "Restore";
  636. var L_Minimize_TEXT = "Minimize";
  637. var L_Close_TEXT = "Close";
  638. var L_ExpandControlPanel_TEXT = "Expand Control Panel";
  639. var L_ShrinkControlPanel_TEXT = "Shrink Control Panel";
  640. var L_EjectDVD_TEXT = "Eject DVD";
  641. var L_CloseDVD_TEXT = "Close DVD";
  642. var L_StopPlayback_TEXT = "Stop Playback";
  643. var L_TimeLine_TEXT = "Progress Bar";
  644. var L_PlaySpeed_TEXT = "Variable Play Speed";
  645. var L_Volume_TEXT = "Volume";
  646. var L_TextBox_TEXT = "Text Box";
  647. var L_TitleBar_TEXT = "Title Bar";
  648. var L_DVDMessage_TEXT = "DVD Message";
  649. var L_COLORMODE_TEXT = "This program can run only on displays with 256 colors or higher.\n Please change your Display Settings to support 256 colors or more, and then restart this program.";
  650. var L_TitleMenu_TEXT = "Title Menu";
  651. var L_TitleResume_TEXT = "Resume Playback from Title Menu";
  652. var L_TitleIcon_TEXT = "";
  653. // Button tooltips
  654. var g_strButTT = new Array(
  655. L_Pause_TEXT,
  656. L_Play_TEXT,
  657. L_FastForward_TEXT,
  658. L_Rewind_TEXT,
  659. L_PreviousChapter_TEXT,
  660. L_NextChapter_TEXT,
  661. L_Menu_TEXT,
  662. L_Resume_TEXT,
  663. L_EnableCC_TEXT,
  664. L_DisableCC_TEXT,
  665. L_StepForward_TEXT,
  666. L_StepBack_TEXT,
  667. L_Subtitle_TEXT,
  668. L_Audio_TEXT,
  669. L_Angle1_TEXT,
  670. L_ZoomIn_TEXT,
  671. L_ZoomOut_TEXT,
  672. L_Capture_TEXT,
  673. L_Mute_TEXT,
  674. L_Sound_TEXT,
  675. L_Right_TEXT,
  676. L_Left_TEXT,
  677. L_Up_TEXT,
  678. L_Down_TEXT,
  679. L_Enter_TEXT,
  680. L_Help_TEXT,
  681. L_Options_TEXT,
  682. L_ContextHelp_TEXT,
  683. L_Maximize_TEXT,
  684. L_Restore_TEXT,
  685. L_Minimize_TEXT,
  686. L_Close_TEXT,
  687. L_ExpandControlPanel_TEXT,
  688. L_ShrinkControlPanel_TEXT,
  689. L_EjectDVD_TEXT,
  690. L_StopPlayback_TEXT,
  691. L_TitleMenu_TEXT,
  692. L_TitleResume_TEXT,
  693. L_TitleIcon_TEXT,
  694. L_TimeLine_TEXT,
  695. L_PlaySpeed_TEXT,
  696. L_Volume_TEXT,
  697. L_TextBox_TEXT,
  698. L_TitleBar_TEXT,
  699. L_DVDMessage_TEXT
  700. );
  701. // Button bitmap images for windowed mode
  702. var g_strButImage = new Array(
  703. new Array ("\"IDR_STATIC_PAUSE\"","\"IDR_HOVER_PAUSE\"","\"IDR_DOWN_PAUSE\"","\"IDR_DISABLED_PAUSE\"","\"IDR_ACTIVE_PAUSE\""),
  704. new Array ("\"IDR_STATIC_PLAY\"","\"IDR_HOVER_PLAY\"","\"IDR_DOWN_PLAY\"","\"IDR_DISABLED_PLAY\"","\"IDR_ACTIVE_PLAY\""),
  705. new Array ("\"IDR_STATIC_FF\"", "\"IDR_HOVER_FF\"", "\"IDR_DOWN_FF\"","\"IDR_DISABLED_FF\"","\"IDR_ACTIVE_FF\""),
  706. new Array ("\"IDR_STATIC_RW\"", "\"IDR_HOVER_RW\"", "\"IDR_DOWN_RW\"","\"IDR_DISABLED_RW\"","\"IDR_ACTIVE_RW\""),
  707. new Array ("\"IDR_STATIC_PREV\"","\"IDR_HOVER_PREV\"","\"IDR_DOWN_PREV\"","\"IDR_DISABLED_PREV\"","\"IDR_ACTIVE_PREV\""),
  708. new Array ("\"IDR_STATIC_NEXT\"","\"IDR_HOVER_NEXT\"","\"IDR_DOWN_NEXT\"","\"IDR_DISABLED_NEXT\"","\"IDR_ACTIVE_NEXT\""),
  709. new Array ("\"IDR_STATIC_MENU\"","\"IDR_HOVER_MENU\"","\"IDR_DOWN_MENU\"","\"IDR_DISABLED_MENU\"","\"IDR_ACTIVE_MENU\""),
  710. new Array ("\"IDR_STATIC_RESUME\"","\"IDR_HOVER_RESUME\"","\"IDR_DOWN_RESUME\"","\"IDR_DISABLED_RESUME\"","\"IDR_ACTIVE_RESUME\""),
  711. new Array ("\"IDR_STATIC_ENCC\"","\"IDR_HOVER_ENCC\"","\"IDR_DOWN_ENCC\"","\"IDR_DISABLED_ENCC\"","\"IDR_ACTIVE_ENCC\""),
  712. new Array ("\"IDR_STATIC_DICC\"","\"IDR_HOVER_DICC\"","\"IDR_DOWN_DICC\"","\"IDR_DISABLED_DICC\"","\"IDR_ACTIVE_DICC\""),
  713. new Array ("\"IDR_STATIC_NEXTFRAME\"", "\"IDR_HOVER_NEXTFRAME\"", "\"IDR_DOWN_NEXTFRAME\"","\"IDR_DISABLED_NEXTFRAME\"","\"IDR_ACTIVE_NEXTFRAME\""),
  714. new Array ("\"IDR_STATIC_PREVFRAME\"", "\"IDR_HOVER_PREVFRAME\"", "\"IDR_DOWN_PREVFRAME\"","\"IDR_DISABLED_PREVFRAME\"","\"IDR_ACTIVE_PREVFRAME\""),
  715. new Array ("\"IDR_STATIC_SP\"", "\"IDR_HOVER_SP\"", "\"IDR_DOWN_SP\"","\"IDR_DISABLED_SP\"","\"IDR_ACTIVE_SP\""),
  716. new Array ("\"IDR_STATIC_LAN\"", "\"IDR_HOVER_LAN\"", "\"IDR_DOWN_LAN\"","\"IDR_DISABLED_LAN\"","\"IDR_ACTIVE_LAN\""),
  717. new Array ("\"IDR_STATIC_ANGLE\"", "\"IDR_HOVER_ANGLE\"", "\"IDR_DOWN_ANGLE\"","\"IDR_DISABLED_ANGLE\"","\"IDR_ACTIVE_ANGLE\""),
  718. new Array ("\"IDR_STATIC_ZOOMIN\"", "\"IDR_HOVER_ZOOMIN\"", "\"IDR_DOWN_ZOOMIN\"","\"IDR_DISABLED_ZOOMIN\"","\"IDR_ACTIVE_ZOOMIN\""),
  719. new Array ("\"IDR_STATIC_ZOOMOUT\"", "\"IDR_HOVER_ZOOMOUT\"", "\"IDR_DOWN_ZOOMOUT\"","\"IDR_DISABLED_ZOOMOUT\"","\"IDR_ACTIVE_ZOOMOUT\""),
  720. new Array ("\"IDR_STATIC_CAPTURE\"", "\"IDR_HOVER_CAPTURE\"", "\"IDR_DOWN_CAPTURE\"","\"IDR_DISABLED_CAPTURE\"","\"IDR_ACTIVE_CAPTURE\""),
  721. new Array ("\"IDR_STATIC_MUTE\"", "\"IDR_HOVER_MUTE\"", "\"IDR_DOWN_MUTE\"","\"IDR_DISABLED_MUTE\"","\"IDR_ACTIVE_MUTE\""),
  722. new Array ("\"IDR_STATIC_SOUND\"", "\"IDR_HOVER_SOUND\"", "\"IDR_DOWN_SOUND\"","\"IDR_DISABLED_SOUND\"","\"IDR_ACTIVE_SOUND\""),
  723. new Array ("\"IDR_STATIC_RIGHT\"","\"IDR_HOVER_RIGHT\"","\"IDR_DOWN_RIGHT\"","\"IDR_DISABLED_RIGHT\"","\"IDR_ACTIVE_RIGHT\""),
  724. new Array ("\"IDR_STATIC_LEFT\"","\"IDR_HOVER_LEFT\"","\"IDR_DOWN_LEFT\"","\"IDR_DISABLED_LEFT\"","\"IDR_ACTIVE_LEFT\""),
  725. new Array ("\"IDR_STATIC_UP\"", "\"IDR_HOVER_UP\"", "\"IDR_DOWN_UP\"","\"IDR_DISABLED_UP\"","\"IDR_ACTIVE_UP\""),
  726. new Array ("\"IDR_STATIC_DOWN\"","\"IDR_HOVER_DOWN\"","\"IDR_DOWN_DOWN\"","\"IDR_DISABLED_DOWN\"","\"IDR_ACTIVE_DOWN\""),
  727. new Array ("\"IDR_STATIC_ENTER\"","\"IDR_HOVER_ENTER\"","\"IDR_DOWN_ENTER\"","\"IDR_DISABLED_ENTER\"","\"IDR_ACTIVE_ENTER\""),
  728. new Array ("\"IDR_STATIC_HELPB\"", "\"IDR_HOVER_HELPB\"", "\"IDR_DOWN_HELPB\"","\"IDR_DISABLED_HELPB\"","\"IDR_ACTIVE_HELPB\""),
  729. new Array ("\"IDR_STATIC_OPT\"", "\"IDR_HOVER_OPT\"", "\"IDR_DOWN_OPT\"","\"IDR_DISABLED_OPT\"","\"IDR_ACTIVE_OPT\""),
  730. new Array ("\"IDR_STATIC_HELP\"", "\"IDR_HOVER_HELP\"", "\"IDR_DOWN_HELP\"","\"IDR_DISABLED_HELP\"","\"IDR_ACTIVE_HELP\""),
  731. new Array ("\"IDR_STATIC_MAX\"", "\"IDR_HOVER_MAX\"", "\"IDR_DOWN_MAX\"","\"IDR_DISABLED_MAX\"","\"IDR_ACTIVE_MAX\""),
  732. new Array ("\"IDR_STATIC_RESTORE\"", "\"IDR_HOVER_RESTORE\"", "\"IDR_DOWN_RESTORE\"","\"IDR_DISABLED_RESTORE\"","\"IDR_ACTIVE_RESTORE\""),
  733. new Array ("\"IDR_STATIC_MIN\"", "\"IDR_HOVER_MIN\"", "\"IDR_DOWN_MIN\"","\"IDR_DISABLED_MIN\"","\"IDR_ACTIVE_MIN\""),
  734. new Array ("\"IDR_STATIC_CLOSE\"", "\"IDR_HOVER_CLOSE\"", "\"IDR_DOWN_CLOSE\"","\"IDR_DISABLED_CLOSE\"","\"IDR_ACTIVE_CLOSE\""),
  735. new Array ("\"IDR_STATIC_EXPAND\"", "\"IDR_HOVER_EXPAND\"", "\"IDR_DOWN_EXPAND\"","\"IDR_DISABLED_EXPAND\"","\"IDR_ACTIVE_EXPAND\""),
  736. new Array ("\"IDR_STATIC_SHRINK\"", "\"IDR_HOVER_SHRINK\"", "\"IDR_DOWN_SHRINK\"","\"IDR_DISABLED_SHRINK\"","\"IDR_ACTIVE_SHRINK\""),
  737. new Array ("\"IDR_STATIC_EJECT\"", "\"IDR_HOVER_EJECT\"", "\"IDR_DOWN_EJECT\"","\"IDR_DISABLED_EJECT\"","\"IDR_ACTIVE_EJECT\""),
  738. new Array ("\"IDR_STATIC_STOP\"", "\"IDR_HOVER_STOP\"", "\"IDR_DOWN_STOP\"","\"IDR_DISABLED_STOP\"","\"IDR_ACTIVE_STOP\""),
  739. new Array ("\"IDR_STATIC_TITLEMENU\"","\"IDR_HOVER_TITLEMENU\"","\"IDR_DOWN_TITLEMENU\"","\"IDR_DISABLED_TITLEMENU\"","\"IDR_ACTIVE_TITLEMENU\""),
  740. new Array ("\"IDR_STATIC_RESUME\"","\"IDR_HOVER_RESUME\"","\"IDR_DOWN_RESUME\"","\"IDR_DISABLED_RESUME\"","\"IDR_ACTIVE_RESUME\""),
  741. new Array ("\"IDR_IMG_DVDPLAY\"","\"IDR_IMG_DVDPLAY\"","\"IDR_IMG_DVDPLAY\"","\"IDR_IMG_DVDPLAY\"","\"IDR_IMG_DVDPLAY\"")
  742. );
  743. // Button bitmap images for full screen mode
  744. var g_strButImageFull = new Array(
  745. new Array ("\"IDR_FULLSTATIC_PAUSE\"","\"IDR_FULLHOVER_PAUSE\"","\"IDR_FULLDOWN_PAUSE\"","\"IDR_FULLDISABLED_PAUSE\"","\"IDR_FULLACTIVE_PAUSE\""),
  746. new Array ("\"IDR_FULLSTATIC_PLAY\"","\"IDR_FULLHOVER_PLAY\"","\"IDR_FULLDOWN_PLAY\"","\"IDR_FULLDISABLED_PLAY\"","\"IDR_FULLACTIVE_PLAY\""),
  747. new Array ("\"IDR_FULLSTATIC_FF\"", "\"IDR_FULLHOVER_FF\"", "\"IDR_FULLDOWN_FF\"","\"IDR_FULLDISABLED_FF\"","\"IDR_FULLACTIVE_FF\""),
  748. new Array ("\"IDR_FULLSTATIC_RW\"", "\"IDR_FULLHOVER_RW\"", "\"IDR_FULLDOWN_RW\"","\"IDR_FULLDISABLED_RW\"","\"IDR_FULLACTIVE_RW\""),
  749. new Array ("\"IDR_FULLSTATIC_PREV\"","\"IDR_FULLHOVER_PREV\"","\"IDR_FULLDOWN_PREV\"","\"IDR_FULLDISABLED_PREV\"","\"IDR_FULLACTIVE_PREV\""),
  750. new Array ("\"IDR_FULLSTATIC_NEXT\"","\"IDR_FULLHOVER_NEXT\"","\"IDR_FULLDOWN_NEXT\"","\"IDR_FULLDISABLED_NEXT\"","\"IDR_FULLACTIVE_NEXT\""),
  751. new Array ("\"IDR_FULLSTATIC_MENU\"","\"IDR_FULLHOVER_MENU\"","\"IDR_FULLDOWN_MENU\"","\"IDR_FULLDISABLED_MENU\"","\"IDR_FULLACTIVE_MENU\""),
  752. new Array ("\"IDR_FULLSTATIC_RESUME\"","\"IDR_FULLHOVER_RESUME\"","\"IDR_FULLDOWN_RESUME\"","\"IDR_FULLDISABLED_RESUME\"","\"IDR_FULLACTIVE_RESUME\""),
  753. new Array ("\"IDR_STATIC_ENCC\"","\"IDR_HOVER_ENCC\"","\"IDR_DOWN_ENCC\"","\"IDR_DISABLED_ENCC\"","\"IDR_ACTIVE_ENCC\""),
  754. new Array ("\"IDR_STATIC_DICC\"","\"IDR_HOVER_DICC\"","\"IDR_DOWN_DICC\"","\"IDR_DISABLED_DICC\"","\"IDR_ACTIVE_DICC\""),
  755. new Array ("\"IDR_FULLSTATIC_NEXTFRAME\"", "\"IDR_FULLHOVER_NEXTFRAME\"", "\"IDR_FULLDOWN_NEXTFRAME\"","\"IDR_FULLDISABLED_NEXTFRAME\"","\"IDR_FULLACTIVE_NEXTFRAME\""),
  756. new Array ("\"IDR_FULLSTATIC_PREVFRAME\"", "\"IDR_FULLHOVER_PREVFRAME\"", "\"IDR_FULLDOWN_PREVFRAME\"","\"IDR_FULLDISABLED_PREVFRAME\"","\"IDR_FULLACTIVE_PREVFRAME\""),
  757. new Array ("\"IDR_STATIC_SP\"", "\"IDR_HOVER_SP\"", "\"IDR_DOWN_SP\"","\"IDR_DISABLED_SP\"","\"IDR_ACTIVE_SP\""),
  758. new Array ("\"IDR_STATIC_LAN\"", "\"IDR_HOVER_LAN\"", "\"IDR_DOWN_LAN\"","\"IDR_DISABLED_LAN\"","\"IDR_ACTIVE_LAN\""),
  759. new Array ("\"IDR_STATIC_ANGLE\"", "\"IDR_HOVER_ANGLE\"", "\"IDR_DOWN_ANGLE\"","\"IDR_DISABLED_ANGLE\"","\"IDR_ACTIVE_ANGLE\""),
  760. new Array ("\"IDR_FULLSTATIC_ZOOMIN\"", "\"IDR_FULLHOVER_ZOOMIN\"", "\"IDR_FULLDOWN_ZOOMIN\"","\"IDR_FULLDISABLED_ZOOMIN\"","\"IDR_FULLACTIVE_ZOOMIN\""),
  761. new Array ("\"IDR_FULLSTATIC_ZOOMOUT\"", "\"IDR_FULLHOVER_ZOOMOUT\"", "\"IDR_FULLDOWN_ZOOMOUT\"","\"IDR_FULLDISABLED_ZOOMOUT\"","\"IDR_FULLACTIVE_ZOOMOUT\""),
  762. new Array ("\"IDR_FULLSTATIC_CAPTURE\"", "\"IDR_FULLHOVER_CAPTURE\"", "\"IDR_FULLDOWN_CAPTURE\"","\"IDR_FULLDISABLED_CAPTURE\"","\"IDR_FULLACTIVE_CAPTURE\""),
  763. new Array ("\"IDR_FULLSTATIC_MUTE\"", "\"IDR_FULLHOVER_MUTE\"", "\"IDR_FULLDOWN_MUTE\"","\"IDR_FULLDISABLED_MUTE\"","\"IDR_FULLACTIVE_MUTE\""),
  764. new Array ("\"IDR_FULLSTATIC_SOUND\"", "\"IDR_FULLHOVER_SOUND\"", "\"IDR_FULLDOWN_SOUND\"","\"IDR_FULLDISABLED_SOUND\"","\"IDR_FULLACTIVE_SOUND\""),
  765. new Array ("\"IDR_FULLSTATIC_RIGHT\"","\"IDR_HOVER_RIGHT\"","\"IDR_DOWN_RIGHT\"","\"IDR_DISABLED_RIGHT\"","\"IDR_ACTIVE_RIGHT\""),
  766. new Array ("\"IDR_FULLSTATIC_LEFT\"","\"IDR_HOVER_LEFT\"","\"IDR_DOWN_LEFT\"","\"IDR_DISABLED_LEFT\"","\"IDR_ACTIVE_LEFT\""),
  767. new Array ("\"IDR_FULLSTATIC_UP\"", "\"IDR_HOVER_UP\"", "\"IDR_DOWN_UP\"","\"IDR_DISABLED_UP\"","\"IDR_ACTIVE_UP\""),
  768. new Array ("\"IDR_FULLSTATIC_DOWN\"","\"IDR_HOVER_DOWN\"","\"IDR_DOWN_DOWN\"","\"IDR_DISABLED_DOWN\"","\"IDR_ACTIVE_DOWN\""),
  769. new Array ("\"IDR_FULLSTATIC_ENTER\"","\"IDR_FULLHOVER_ENTER\"","\"IDR_FULLDOWN_ENTER\"","\"IDR_FULLDISABLED_ENTER\"","\"IDR_FULLACTIVE_ENTER\""),
  770. new Array ("\"IDR_STATIC_HELPB\"", "\"IDR_HOVER_HELPB\"", "\"IDR_DOWN_HELPB\"","\"IDR_DISABLED_HELPB\"","\"IDR_ACTIVE_HELPB\""),
  771. new Array ("\"IDR_STATIC_OPT\"", "\"IDR_HOVER_OPT\"", "\"IDR_DOWN_OPT\"","\"IDR_DISABLED_OPT\"","\"IDR_ACTIVE_OPT\""),
  772. new Array ("\"IDR_STATIC_HELP\"", "\"IDR_HOVER_HELP\"", "\"IDR_DOWN_HELP\"","\"IDR_DISABLED_HELP\"","\"IDR_ACTIVE_HELP\""),
  773. new Array ("\"IDR_STATIC_MAX\"", "\"IDR_HOVER_MAX\"", "\"IDR_DOWN_MAX\"","\"IDR_DISABLED_MAX\"","\"IDR_ACTIVE_MAX\""),
  774. new Array ("\"IDR_STATIC_RESTORE\"", "\"IDR_HOVER_RESTORE\"", "\"IDR_DOWN_RESTORE\"","\"IDR_DISABLED_RESTORE\"","\"IDR_ACTIVE_RESTORE\""),
  775. new Array ("\"IDR_STATIC_MIN\"", "\"IDR_HOVER_MIN\"", "\"IDR_DOWN_MIN\"","\"IDR_DISABLED_MIN\"","\"IDR_ACTIVE_MIN\""),
  776. new Array ("\"IDR_STATIC_CLOSE\"", "\"IDR_HOVER_CLOSE\"", "\"IDR_DOWN_CLOSE\"","\"IDR_DISABLED_CLOSE\"","\"IDR_ACTIVE_CLOSE\""),
  777. new Array ("\"IDR_STATIC_EXPAND\"", "\"IDR_HOVER_EXPAND\"", "\"IDR_DOWN_EXPAND\"","\"IDR_DISABLED_EXPAND\"","\"IDR_ACTIVE_EXPAND\""),
  778. new Array ("\"IDR_STATIC_SHRINK\"", "\"IDR_HOVER_SHRINK\"", "\"IDR_DOWN_SHRINK\"","\"IDR_DISABLED_SHRINK\"","\"IDR_ACTIVE_SHRINK\""),
  779. new Array ("\"IDR_FULLSTATIC_EJECT\"", "\"IDR_FULLHOVER_EJECT\"", "\"IDR_FULLDOWN_EJECT\"","\"IDR_FULLDISABLED_EJECT\"","\"IDR_FULLACTIVE_EJECT\""),
  780. new Array ("\"IDR_FULLSTATIC_STOP\"", "\"IDR_FULLHOVER_STOP\"", "\"IDR_FULLDOWN_STOP\"","\"IDR_FULLDISABLED_STOP\"","\"IDR_FULLACTIVE_STOP\""),
  781. new Array ("\"IDR_FULLSTATIC_TITLEMENU\"","\"IDR_FULLHOVER_TITLEMENU\"","\"IDR_FULLDOWN_TITLEMENU\"","\"IDR_FULLDISABLED_TITLEMENU\"","\"IDR_FULLACTIVE_TITLEMENU\""),
  782. new Array ("\"IDR_FULLSTATIC_RESUME\"","\"IDR_FULLHOVER_RESUME\"","\"IDR_FULLDOWN_RESUME\"","\"IDR_FULLDISABLED_RESUME\"","\"IDR_FULLACTIVE_RESUME\""),
  783. new Array ("\"IDR_IMG_DVDPLAY\"","\"IDR_IMG_DVDPLAY\"","\"IDR_IMG_DVDPLAY\"","\"IDR_IMG_DVDPLAY\"","\"IDR_IMG_DVDPLAY\"")
  784. );
  785. function BitmapsForNonEnglish()
  786. {
  787. // use the button bitmaps without text, for any language other than English
  788. // Note: should call this function after the locale information is set (in CreateObjects)
  789. // Title Menu stuff
  790. g_strButImage[g_nIndexTitleMenu] = new Array ("\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_DOWN_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"");
  791. g_strButImage[g_nIndexTitleResume] = new Array ("\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_DOWN_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"");
  792. g_strButImageFull[g_nIndexTitleMenu] = new Array ("\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLDOWN_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"");
  793. g_strButImageFull[g_nIndexTitleResume] = new Array ("\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLDOWN_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"");
  794. // Button bitmap images for windowed mode
  795. g_strButImage[g_nIndexMenu] = new Array ("\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_DOWN_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"");
  796. g_strButImage[g_nIndexResume] = new Array ("\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_DOWN_OVAL\"","\"IDR_STATIC_OVAL\"","\"IDR_STATIC_OVAL\"");
  797. g_strButImage[g_nIndexEnCC] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  798. g_strButImage[g_nIndexDiCC] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  799. g_strButImage[g_nIndexSubtitle] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  800. g_strButImage[g_nIndexAudio] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  801. g_strButImage[g_nIndexAngle] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  802. g_strButImage[g_nIndexHelp] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  803. g_strButImage[g_nIndexOptions] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  804. // Button bitmap images for full screen mode
  805. g_strButImageFull[g_nIndexMenu] = new Array ("\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLDOWN_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"");
  806. g_strButImageFull[g_nIndexResume] = new Array ("\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLDOWN_OVAL\"","\"IDR_FULLSTATIC_OVAL\"","\"IDR_FULLSTATIC_OVAL\"");
  807. g_strButImageFull[g_nIndexEnCC] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  808. g_strButImageFull[g_nIndexDiCC] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  809. g_strButImageFull[g_nIndexSubtitle] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  810. g_strButImageFull[g_nIndexAudio] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  811. g_strButImageFull[g_nIndexAngle] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  812. g_strButImageFull[g_nIndexHelp] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  813. g_strButImageFull[g_nIndexOptions] = new Array ("\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_DOWN_RECT\"","\"IDR_STATIC_RECT\"","\"IDR_STATIC_RECT\"");
  814. };
  815. // Slider images
  816. var g_strSldrImage = new Array(
  817. new Array ("\"IDR_STATIC_TIMESLIDER\"","\"IDR_STATIC_TIMETHUMB\"","\"IDR_DISABLED_TIMESLIDER\"","\"IDR_DISABLED_TIMETHUMB\"", "\"8\"", "\"0\""),
  818. new Array ("\"IDR_STATIC_SPEEDSLIDER\"","\"IDR_STATIC_SPEEDTHUMB\"","\"IDR_DISABLED_SPEEDSLIDER\"","\"IDR_DISABLED_SPEEDTHUMB\"", "\"7\"", "\"2\""),
  819. new Array ("\"IDR_STATIC_VOLSLIDER\"","\"IDR_STATIC_VOLTHUMB\"","\"IDR_DISABLED_VOLSLIDER\"","\"IDR_DISABLED_VOLTHUMB\"", "\"9\"", "\"2\"")
  820. );
  821. // Slider images for full screen
  822. var g_strSldrImageFull = new Array(
  823. new Array ("\"IDR_STATIC_TIMESLIDER\"","\"IDR_FULLSTATIC_TIMETHUMB\"","\"IDR_DISABLED_TIMESLIDER\"","\"IDR_DISABLED_TIMETHUMB\"", "\"8\"", "\"0\""),
  824. new Array ("\"IDR_FULLSTATIC_SPEEDSLIDER\"","\"IDR_FULLSTATIC_SPEEDTHUMB\"","\"IDR_FULLDISABLED_SPEEDSLIDER\"","\"IDR_FULLDISABLED_SPEEDTHUMB\"", "\"7\"","\"2\""),
  825. new Array ("\"IDR_FULLSTATIC_VOLSLIDER\"","\"IDR_FULLSTATIC_VOLTHUMB\"","\"IDR_FULLDISABLED_VOLSLIDER\"","\"IDR_FULLDISABLED_VOLTHUMB\"", "\"9\"","\"2\"")
  826. );
  827. // Button OnClick callbacks
  828. var g_pButCallbacks = new Array(
  829. "pause_OnClick()",
  830. "play_OnClick()",
  831. "fwd_OnClick()",
  832. "rew_OnClick()",
  833. "prev_OnClick()",
  834. "next_OnClick()",
  835. "menu_OnClick()",
  836. "resume_OnClick()",
  837. "cc_OnClick()",
  838. "cc_OnClick()",
  839. "stepfwd_OnClick()",
  840. "stepbak_OnClick()",
  841. "sp_OnClick()",
  842. "lan_OnClick()",
  843. "angle_OnClick()",
  844. "zoomin_OnClick()",
  845. "zoomout_OnClick()",
  846. "capture_OnClick()",
  847. "mute_OnClick()",
  848. "sound_OnClick()",
  849. "right_OnClick()",
  850. "left_OnClick()",
  851. "up_OnClick()",
  852. "down_OnClick()",
  853. "enter_OnClick()",
  854. "help_OnClick()",
  855. "options_OnClick()",
  856. "contextHelp_OnClick()",
  857. "max_OnClick()",
  858. "restore_OnClick()",
  859. "min_OnClick()",
  860. "close_OnClick()",
  861. "expand_OnClick()",
  862. "shrink_OnClick()",
  863. "eject_OnClick()",
  864. "stop_OnClick()",
  865. "titleMenu_OnClick()",
  866. "resume_OnClick()",
  867. "titleIcon_OnClick()"
  868. );
  869. // DVD event codes
  870. var EC_DVDBASE = 256;
  871. var EC_DVD_DOMAIN_CHANGE = EC_DVDBASE + 1;
  872. var EC_DVD_TITLE_CHANGE = EC_DVDBASE + 2;
  873. var EC_DVD_CHAPTER_START = EC_DVDBASE + 3;
  874. var EC_DVD_AUDIO_STREAM_CHANGE = EC_DVDBASE + 4;
  875. var EC_DVD_SUBPICTURE_STREAM_CHANGE = EC_DVDBASE + 5;
  876. var EC_DVD_ANGLE_CHANGE = EC_DVDBASE + 6;
  877. var EC_DVD_BUTTON_CHANGE = EC_DVDBASE + 7;
  878. var EC_DVD_VALID_UOPS_CHANGE = EC_DVDBASE + 8;
  879. var EC_DVD_STILL_ON = EC_DVDBASE + 9;
  880. var EC_DVD_STILL_OFF = EC_DVDBASE + 10;
  881. var EC_DVD_CURRENT_TIME = EC_DVDBASE + 11;
  882. var EC_DVD_ERROR = EC_DVDBASE + 12;
  883. var EC_DVD_WARNING = EC_DVDBASE + 13;
  884. var EC_DVD_CHAPTER_AUTOSTOP = EC_DVDBASE + 14;
  885. var EC_DVD_NO_FP_PGC = EC_DVDBASE + 15;
  886. var EC_DVD_PLAYBACK_RATE_CHANGE = EC_DVDBASE + 16;
  887. var EC_DVD_PARENTAL_LEVEL_CHANGE = EC_DVDBASE + 17;
  888. var EC_DVD_PLAYBACK_STOPPED = EC_DVDBASE + 18;
  889. var EC_DVD_ANGLES_AVAILABLE = EC_DVDBASE + 19;
  890. var EC_DVD_PLAYING = EC_DVDBASE + 254;
  891. var EC_DVD_PAUSED = EC_DVDBASE + 255;
  892. var EC_DVD_DISC_EJECTED = EC_DVDBASE + 24;
  893. var EC_DVD_DISC_INSERTED = EC_DVDBASE + 25;
  894. var EC_DVD_CURRENT_HMSF_TIME = EC_DVDBASE + 26;
  895. var EC_PAUSED = 14;
  896. var DVD_ERROR_Unexpected= 1;
  897. var DVD_ERROR_CopyProtectFail= 2;
  898. var DVD_ERROR_InvalidDVD1_0Disc= 3;
  899. var DVD_ERROR_InvalidDiscRegion= 4;
  900. var DVD_ERROR_LowParentalLevel= 5;
  901. var DVD_ERROR_MacrovisionFail= 6;
  902. var DVD_ERROR_IncompatibleSystemAndDecoderRegions=7;
  903. var DVD_ERROR_IncompatibleDiscAndDecoderRegions=8;
  904. var DVD_ERROR_NoSubpictureStream= 99;
  905. /*************************************************************/
  906. /* Name: CreateObjects
  907. /* Description: Create all objects hosted by the container
  908. /*************************************************************/
  909. function CreateObjects(){
  910. try {
  911. MFBar.SetupSelfSite(10, 10, g_ConWidth, g_ConHeight, "<PARAM NAME=\"Caption\" VALUE=\"DVDPlay\">", true, true, true);
  912. MFBar.BackColor = 0xff;
  913. if(MFBar.BitsPerPixel() < 8){
  914. HandleFatalInitProblem(L_COLORMODE_TEXT );
  915. return;
  916. }/* end of if statement */
  917. // set the size beyond which we do not extend
  918. MFBar.MinWidth = g_MinWidth;
  919. try {
  920. iExpanded = MFBar.GetSelfHostUserData("DVDPlay");
  921. if (iExpanded != 0) {
  922. g_bExpanded = true;
  923. g_ButHeight = g_ButOneLineHeight*2;
  924. MFBar.BackGroundImage = "IDR_BACKIMG_EXPANDED";
  925. MFBar.MinHeight = g_MinHeight+g_ButOneLineHeight;
  926. }
  927. else {
  928. MFBar.BackGroundImage = "IDR_BACKIMG_SIMPLE";
  929. MFBar.MinHeight = g_MinHeight;
  930. }
  931. }
  932. catch (e) {
  933. MFBar.BackGroundImage = "IDR_BACKIMG_SIMPLE";
  934. MFBar.MinHeight = g_MinHeight;
  935. }
  936. SetLocaleInfo();
  937. if (!g_LocaleEnglish)
  938. {
  939. BitmapsForNonEnglish();
  940. }
  941. // have to create the DVDOpt ahead of the DVD Object since it holds and extra count for it
  942. MFBar.CreateObject("DVDOpt", "Msdvdopt.dvdopt.1",
  943. 0, 0, 1, 1, "", true);
  944. param = "<PARAM NAME=\"WindowlessActivation\" VALUE=\"-1\">";
  945. MFBar.CreateObject("DVD", "MSWebDVD.MSWebDVD.1",
  946. g_DVDLeft, g_DVDTop, g_DVDWidth, g_DVDHeight, param, true, "HookDVDEv");
  947. // Set up splash screen
  948. MFBar.CreateObject("Splash", "MSMFCnt.MSMFImg", 10, 10, g_ConWidth, g_ConHeight, "");
  949. Splash.ResourceDll = MFBar.ResourceDll;
  950. Splash.Image = "IDR_IMG_SPLASH";
  951. PositionButtons(g_ConWidth, g_ConHeight, false);
  952. yOffset = g_ConHeight-g_ButHeight;
  953. for (i=0; i<g_nNumButs; i++) {
  954. param1 = "<PARAM NAME=\"ResourceDLL\" VALUE=\"" + MFBar.ResourceDll + "\">";
  955. param1 = param1 + "<PARAM NAME=\"ImageStatic\" VALUE=";
  956. param1 = param1 + g_strButImage[i][0] + ">";
  957. param1 = param1 + "<PARAM NAME=\"ImageHover\" VALUE=";
  958. param1 = param1 + g_strButImage[i][1] + ">";
  959. param1 = param1 + "<PARAM NAME=\"ImagePush\" VALUE=";
  960. param1 = param1 + g_strButImage[i][2] + ">";
  961. param1 = param1 + "<PARAM NAME=\"ImageDisabled\" VALUE=";
  962. param1 = param1 + g_strButImage[i][3] + ">";
  963. param1 = param1 + "<PARAM NAME=\"ToolTip\" VALUE=\"";
  964. param1 = param1 + g_strButTT[i] + "\">";
  965. param1 = param1 + "<PARAM NAME=\"ToolTipMaxWidth\" VALUE=\"130\">";
  966. param1 = param1 + "<PARAM NAME=\"BackColor\" VALUE=\"" +
  967. g_clrFrame + "\">";
  968. param = param1 + "<PARAM NAME=\"Windowless\" VALUE=\"-1\">";
  969. param += "<PARAM NAME=\"TransparentBlitType\" VALUE=\"" +
  970. g_nButPos[i][5] + "\">";
  971. if (g_nButPos[i][6] != 0)
  972. {
  973. xPos = g_nButPos[i][0];
  974. yPos = g_nButPos[i][1] + yOffset;
  975. }
  976. else if (g_LTRReading)
  977. {
  978. xPos = g_ConWidth - g_nButPos[i][0] - g_nButPos[i][2];
  979. yPos = g_nButPos[i][1];
  980. }
  981. else
  982. {
  983. xPos = g_nButPos[i][0];
  984. yPos = g_nButPos[i][1];
  985. }
  986. MFBar.CreateObject(g_strButID[i], "MSMFCnt.MSMFBBtn", xPos, yPos,
  987. g_nButPos[i][2], g_nButPos[i][3], param, !g_nButPos[i][4]);
  988. param1 = "<PARAM NAME=\"ResourceDLL\" VALUE=\"" + MFBar.ResourceDll + "\">";
  989. param1 = param1 + "<PARAM NAME=\"ImageStatic\" VALUE=";
  990. param1 = param1 + g_strButImageFull[i][0] + ">";
  991. param1 = param1 + "<PARAM NAME=\"ImageHover\" VALUE=";
  992. param1 = param1 + g_strButImageFull[i][1] + ">";
  993. param1 = param1 + "<PARAM NAME=\"ImagePush\" VALUE=";
  994. param1 = param1 + g_strButImageFull[i][2] + ">";
  995. param1 = param1 + "<PARAM NAME=\"ImageDisabled\" VALUE=";
  996. param1 = param1 + g_strButImageFull[i][3] + ">";
  997. param1 = param1 + "<PARAM NAME=\"ToolTip\" VALUE=\"";
  998. param1 = param1 + g_strButTT[i] + "\">";
  999. param1 = param1 + "<PARAM NAME=\"ToolTipMaxWidth\" VALUE=\"130\">";
  1000. param1 = param1 + "<PARAM NAME=\"BackColor\" VALUE=\"" +
  1001. g_clrSplashBackBg + "\">";
  1002. param = param1 + "<PARAM NAME=\"Windowless\" VALUE=\"0\">";
  1003. param += "<PARAM NAME=\"TransparentBlitType\" VALUE=\"" +
  1004. g_nButPosFull[i][5] + "\">";
  1005. // Create another set of buttons for the full screen mode
  1006. // objects need to be created before loading the script
  1007. MFBar.CreateObject(g_strButID[i]+"Full", "MSMFCnt.MSMFBBtn", xPos, g_nYOutOfScreen,
  1008. g_nButPos[i][2], g_nButPos[i][3], param, !g_nButPosFull[i][4]);
  1009. }/* end of for loop */
  1010. for (i=0; i<g_nNumButs; i++) {
  1011. // add scriptlet creates the engine
  1012. // and all the objects need to be loaded before creating the engine
  1013. MFBar.HookScriptlet(g_strButID[i], "OnClick", g_pButCallbacks[i]);
  1014. MFBar.HookScriptlet(g_strButID[i]+"Full", "OnClick", g_pButCallbacks[i]);
  1015. MFBar.HookScriptlet(g_strButID[i]+"Full", "OnMouseDown", "EnableActivityTimeOut(false)");
  1016. MFBar.HookScriptlet(g_strButID[i]+"Full", "OnMouseUp", "EnableActivityTimeOut(true)");
  1017. }/* end of if statement */
  1018. MFBar.HookScriptlet("TitleIcon", "OnDblClick", "close_OnClick()");
  1019. MFBar.HookScriptlet("TitleIconFull", "OnDblClick", "close_OnClick()");
  1020. for (i = 0; i<g_nNumTexts; i++) {
  1021. // Create the text box for windowed mode
  1022. param1 = "<PARAM NAME=\"BackColor\" VALUE=\"" + g_clrFrame + "\">";
  1023. param1 += "<PARAM NAME=\"Windowless\" VALUE=\"-1\">";
  1024. MFBar.CreateObject(g_strButID[g_nNumButs+g_nNumSliders+i], "MSMFCnt.MSMFText",
  1025. g_nButPos[g_nNumButs+g_nNumSliders+i][0], g_nButPos[g_nNumButs+g_nNumSliders+i][1]+yOffset,
  1026. g_nButPos[g_nNumButs+g_nNumSliders+i][2], g_nButPos[g_nNumButs+g_nNumSliders+i][3], param1, false);
  1027. // Create the text box for full screen mode
  1028. param1 = "<PARAM NAME=\"BackColor\" VALUE=\"" + g_clrSplashBackBg + "\">";
  1029. param1 += "<PARAM NAME=\"Windowless\" VALUE=\"0\">";
  1030. MFBar.CreateObject(g_strButID[g_nNumButs+g_nNumSliders+i]+"Full", "MSMFCnt.MSMFText",
  1031. g_nButPosFull[g_nNumButs+g_nNumSliders+i][0], g_nYOutOfScreen,
  1032. g_nButPosFull[g_nNumButs+g_nNumSliders+i][2], g_nButPosFull[g_nNumButs+g_nNumSliders+i][3], param1, false);
  1033. }
  1034. MFBar.HookScriptlet("MFBar", "TimeOut(id)", "OnMessageTimeOut(id)");
  1035. for (i=0; i<g_nNumSliders; i++) {
  1036. // Create the slider bars for windowed mode
  1037. param1 = "<PARAM NAME=\"ResourceDLL\" VALUE=\"" + MFBar.ResourceDll + "\">";
  1038. param1 += "<PARAM NAME=\"BackStatic\" VALUE=";
  1039. param1 += g_strSldrImage[i][0] + ">";
  1040. param1 += "<PARAM NAME=\"BackHover\" VALUE=";
  1041. param1 += g_strSldrImage[i][0] + ">";
  1042. param1 += "<PARAM NAME=\"BackPush\" VALUE=";
  1043. param1 += g_strSldrImage[i][0] + ">";
  1044. param1 += "<PARAM NAME=\"ThumbStatic\" VALUE=";
  1045. param1 += g_strSldrImage[i][1] + ">";
  1046. param1 += "<PARAM NAME=\"ThumbHover\" VALUE=";
  1047. param1 += g_strSldrImage[i][1] + ">";
  1048. param1 += "<PARAM NAME=\"ThumbPush\" VALUE=";
  1049. param1 += g_strSldrImage[i][1] + ">";
  1050. param1 += "<PARAM NAME=\"BackDisabled\" VALUE=";
  1051. param1 += g_strSldrImage[i][2] + ">";
  1052. param1 += "<PARAM NAME=\"ThumbDisabled\" VALUE=";
  1053. param1 += g_strSldrImage[i][3] + ">";
  1054. param1 += "<PARAM NAME=\"ThumbWidth\" VALUE=";
  1055. param1 += g_strSldrImage[i][4] + ">";
  1056. param1 += "<PARAM NAME=\"YOffset\" VALUE=";
  1057. param1 += g_strSldrImage[i][5] + ">";
  1058. param1 += "<PARAM NAME=\"Windowless\" VALUE=\"-1\">";
  1059. param1 = param1 + "<PARAM NAME=\"ToolTip\" VALUE=\"";
  1060. param1 = param1 + g_strButTT[g_nNumButs+i] + "\">";
  1061. param1 = param1 + "<PARAM NAME=\"ToolTipMaxWidth\" VALUE=\"130\">";
  1062. param1 = param1 + "<PARAM NAME=\"BackColor\" VALUE=\"" + g_clrFrame + "\">";
  1063. MFBar.CreateObject(g_strButID[g_nNumButs+i], "MSMFCnt.MSMFSldr",
  1064. g_nButPos[g_nNumButs+i][0], g_nButPos[g_nNumButs+i][1]+yOffset,
  1065. g_nButPos[g_nNumButs+i][2], g_nButPos[g_nNumButs+i][3], param1);
  1066. // Create the slider bars for full screen mode
  1067. param1 = "<PARAM NAME=\"ResourceDLL\" VALUE=\"" + MFBar.ResourceDll + "\">";
  1068. param1 += "<PARAM NAME=\"BackStatic\" VALUE=";
  1069. param1 += g_strSldrImageFull[i][0] + ">";
  1070. param1 += "<PARAM NAME=\"BackHover\" VALUE=";
  1071. param1 += g_strSldrImageFull[i][0] + ">";
  1072. param1 += "<PARAM NAME=\"BackPush\" VALUE=";
  1073. param1 += g_strSldrImageFull[i][0] + ">";
  1074. param1 += "<PARAM NAME=\"ThumbStatic\" VALUE=";
  1075. param1 += g_strSldrImageFull[i][1] + ">";
  1076. param1 += "<PARAM NAME=\"ThumbHover\" VALUE=";
  1077. param1 += g_strSldrImageFull[i][1] + ">";
  1078. param1 += "<PARAM NAME=\"ThumbPush\" VALUE=";
  1079. param1 += g_strSldrImageFull[i][1] + ">";
  1080. param1 += "<PARAM NAME=\"BackDisabled\" VALUE=";
  1081. param1 += g_strSldrImageFull[i][2] + ">";
  1082. param1 += "<PARAM NAME=\"ThumbDisabled\" VALUE=";
  1083. param1 += g_strSldrImageFull[i][3] + ">";
  1084. param1 += "<PARAM NAME=\"ThumbWidth\" VALUE=";
  1085. param1 += g_strSldrImageFull[i][4] + ">";
  1086. param1 += "<PARAM NAME=\"YOffset\" VALUE=";
  1087. param1 += g_strSldrImageFull[i][5] + ">";
  1088. param1 += "<PARAM NAME=\"Windowless\" VALUE=\"0\">";
  1089. param1 = param1 + "<PARAM NAME=\"ToolTip\" VALUE=\"";
  1090. param1 = param1 + g_strButTT[g_nNumButs+i] + "\">";
  1091. param1 = param1 + "<PARAM NAME=\"ToolTipMaxWidth\" VALUE=\"130\">";
  1092. param1 = param1 + "<PARAM NAME=\"BackColor\" VALUE=\"" + g_clrSplashBackBg + "\">";
  1093. MFBar.CreateObject(g_strButID[g_nNumButs+i]+"Full", "MSMFCnt.MSMFSldr",
  1094. g_nButPosFull[g_nNumButs+i][0], g_nYOutOfScreen,
  1095. g_nButPosFull[g_nNumButs+i][2], g_nButPosFull[g_nNumButs+i][3], param1);
  1096. }
  1097. if (g_bExpanded) {
  1098. ShowObject("Expand", false);
  1099. ShowObject("Shrink", true);
  1100. }
  1101. MFBar.HookScriptlet("TimeSlider", "OnValueChange(x)", "OnTimeSliderUpdate(TimeSlider, x)");
  1102. MFBar.HookScriptlet("TimeSlider", "OnClick()", "OnTimeSliderClick()");
  1103. MFBar.HookScriptlet("TimeSlider", "OnMouseUp()", "OnTimeSliderMouseUp(TimeSlider)");
  1104. MFBar.HookScriptlet("TimeSlider", "OnMouseDown()", "OnTimeSliderMouseDown(TimeSlider)");
  1105. MFBar.HookScriptlet("TimeSliderFull", "OnValueChange(x)", "OnTimeSliderUpdate(TimeSliderFull, x)");
  1106. MFBar.HookScriptlet("TimeSliderFull", "OnClick()", "OnTimeSliderClick()");
  1107. MFBar.HookScriptlet("TimeSliderFull", "OnMouseUp()", "OnTimeSliderMouseUp(TimeSliderFull)");
  1108. MFBar.HookScriptlet("TimeSliderFull", "OnMouseDown()", "OnTimeSliderMouseDown(TimeSliderFull)");
  1109. MFBar.HookScriptlet("PlaySpeed", "OnValueChange(x)", "OnSpeedSliderUpdate(PlaySpeed, x)");
  1110. MFBar.HookScriptlet("PlaySpeed", "OnMouseUp()", "OnSpeedSliderMouseUp(PlaySpeed)");
  1111. MFBar.HookScriptlet("PlaySpeed", "OnMouseDown()", "OnSliderMouseDown(PlaySpeed)");
  1112. MFBar.HookScriptlet("PlaySpeed", "OnClick()", "OnSpeedSliderClick(PlaySpeed)");
  1113. MFBar.HookScriptlet("PlaySpeedFull", "OnValueChange(x)", "OnSpeedSliderUpdate(PlaySpeedFull, x)");
  1114. MFBar.HookScriptlet("PlaySpeedFull", "OnMouseUp()", "OnSpeedSliderMouseUp(PlaySpeedFull)");
  1115. MFBar.HookScriptlet("PlaySpeedFull", "OnMouseDown()", "OnSliderMouseDown(PlaySpeedFull)");
  1116. MFBar.HookScriptlet("PlaySpeedFull", "OnClick()", "OnSpeedSliderClick(PlaySpeedFull)");
  1117. MFBar.HookScriptlet("VolSlider", "OnValueChange(x)", "OnVolUpdate(VolSlider, x)");
  1118. MFBar.HookScriptlet("VolSlider", "OnMouseUp()", "OnSliderMouseUp(VolSlider, g_nIndexVolume)");
  1119. MFBar.HookScriptlet("VolSlider", "OnMouseDown()", "OnSliderMouseDown(VolSlider)");
  1120. MFBar.HookScriptlet("VolSliderFull", "OnValueChange(x)", "OnVolUpdate(VolSliderFull, x)");
  1121. MFBar.HookScriptlet("VolSliderFull", "OnMouseUp()", "OnSliderMouseUp(VolSliderFull, g_nIndexVolume)");
  1122. MFBar.HookScriptlet("VolSliderFull", "OnMouseDown()", "OnSliderMouseDown(VolSliderFull)");
  1123. g_InitializationState = 1;
  1124. Init();
  1125. }
  1126. catch(e) {
  1127. e.description = L_ERRORFailCreatingObject_TEXT;
  1128. HandleError(e, true);
  1129. return;
  1130. }
  1131. }/* end of function CreateObjects */
  1132. /*************************************************************************/
  1133. /* Function: HookDVDEv */
  1134. /*************************************************************************/
  1135. function HookDVDEv(){
  1136. try {
  1137. MFBar.HookScriptlet("DVD", "UpdateOverlay", "OnUpdateOverlay()");
  1138. MFBar.HookScriptlet("DVD", "ReadyStateChange(state)", "OnReadyStateChange(state)");
  1139. MFBar.HookScriptlet("DVD", "DVDNotify(event, param1, param2)", "ProcessDVDEvent(event, param1, param2)");
  1140. MFBar.HookScriptlet("DVD", "PlayForwards(bEnabled)", "ProcessPFEvent(bEnabled)");
  1141. MFBar.HookScriptlet("DVD", "PlayBackwards(bEnabled)", "ProcessPBEvent(bEnabled)");
  1142. MFBar.HookScriptlet("DVD", "ShowMenu(nMenu, bEnabled)", "ProcessShowMenuEvent(nMenu, bEnabled)");
  1143. MFBar.HookScriptlet("DVD", "Resume(bEnabled)", "ProcessResumeEvent(bEnabled)");
  1144. MFBar.HookScriptlet("DVD", "SelectOrActivatButton(bEnabled)", "ProcessSelectOrActivatButtonEvent(bEnabled)");
  1145. MFBar.HookScriptlet("DVD", "ChangeCurrentAudioStream(bEnabled)", "ProcessAudEvent(bEnabled)");
  1146. MFBar.HookScriptlet("DVD", "ChangeCurrentSubpictureStream(bEnabled)", "ProcessSPEvent(bEnabled)");
  1147. MFBar.HookScriptlet("DVD", "ChangeCurrentAngle(bEnabled)", "ProcessAngleEvent(bEnabled)");
  1148. MFBar.HookScriptlet("DVD", "PlayAtTimeInTitle(bEnabled)", "ProcessTimePlayEvent(bEnabled)");
  1149. MFBar.HookScriptlet("DVD", "PlayAtTime(bEnabled)", "ProcessTimePlayEvent(bEnabled)");
  1150. MFBar.HookScriptlet("DVD", "PlayNextChapter(bEnabled)", "ProcessChapterPlayEvent(\"SkipForward\", bEnabled)");
  1151. MFBar.HookScriptlet("DVD", "PlayPrevChapter(bEnabled)", "ProcessChapterPlayEvent(\"SkipBackward\", bEnabled)");
  1152. MFBar.HookScriptlet("DVD", "StillOff(bEnabled)", "ProcessStillOff(bEnabled)");
  1153. MFBar.HookScriptlet("MFBar", "OnResize(lWidth, lHeight, lCode)", "OnResize(lWidth, lHeight, lCode)");
  1154. MFBar.HookScriptlet("MFBar", "OnHelp(strObjectID, strExtraInfo)", "OnBarHelp(strObjectID, strExtraInfo)");
  1155. MFBar.HookScriptlet("MFBar", "ActivityStarted()", "ActivityStarted()");
  1156. MFBar.HookScriptlet("MFBar", "ActivityDeclined()", "ActivityDeclined()");
  1157. // hook up maximize when double clicking
  1158. MFBar.HookScriptlet("MFBar", "OnDblClick()", "max_OnClick()");
  1159. MFBar.HookScriptlet("MFBar", "OnKeyDown(lVirtKey, lKeyData)", "OnKeyDown(lVirtKey, lKeyData)");
  1160. MFBar.HookScriptlet("MFBar", "OnKeyUp(lVirtKey, lKeyData)", "OnKeyUp(lVirtKey, lKeyData)");
  1161. MFBar.HookScriptlet("MFBar", "OnSysKeyUp(lVirtKey, lKeyData)", "OnSysKeyUp(lVirtKey, lKeyData)");
  1162. MFBar.HookScriptlet("MFBar", "OnActivate(fActivated)", "OnActivate(fActivated)");
  1163. }
  1164. catch(e) {
  1165. e.description = L_ERRORUnexpectedError_TEXT;
  1166. HandleError(e);
  1167. return;
  1168. }
  1169. }/* end of function HookDVDEv */
  1170. /*************************************************************************/
  1171. /* Function: Init */
  1172. /* Description: Calls the DVD direct show interfaces to set a certain */
  1173. /* chapter. */
  1174. /*************************************************************************/
  1175. function Init(){
  1176. try {
  1177. PlaySpeed.Min = -6;
  1178. PlaySpeed.Max = 6.5;
  1179. PlaySpeed.Value = 2.25;
  1180. PlaySpeedFull.Min = -6;
  1181. PlaySpeedFull.Max = 6.5;
  1182. PlaySpeedFull.Value = 2.25;
  1183. VolSlider.Min = 0;
  1184. VolSlider.Max = 1;
  1185. VolSlider.Value = 1;
  1186. VolSlider.ArrowKeyIncrement = .1;
  1187. VolSlider.ArrowKeyDecrement = .1;
  1188. VolSliderFull.Min = 0;
  1189. VolSliderFull.Max = 1;
  1190. VolSliderFull.Value = 1;
  1191. VolSliderFull.ArrowKeyIncrement = .1;
  1192. VolSliderFull.ArrowKeyDecrement = .1;
  1193. TimeSlider.ArrowKeyIncrement = 2;
  1194. TimeSliderFull.ArrowKeyIncrement = 2;
  1195. if (!g_LocaleEnglish)
  1196. {
  1197. InitTextControl ("TitleMenu", L_ButtonTextTitleMenu_TEXT);
  1198. InitTextControl ("TitleResume", L_ButtonTextResume_TEXT);
  1199. InitTextControl ("Menu", L_ButtonTextMenu_TEXT);
  1200. InitTextControl ("Resume", L_ButtonTextResume_TEXT);
  1201. InitTextControl ("EnCC", L_ButtonTextEnCC_TEXT);
  1202. InitTextControl ("DiCC", L_ButtonTextDiCC_TEXT);
  1203. InitTextControl ("Subtitles", L_ButtonTextSubtitle_TEXT);
  1204. InitTextControl ("Audio", L_ButtonTextAudio_TEXT);
  1205. InitTextControl ("Angles", L_ButtonTextAngle_TEXT);
  1206. InitTextControl ("Help", L_ButtonTextHelp_TEXT);
  1207. InitTextControl ("Options", L_ButtonTextOptions_TEXT);
  1208. // stretch button size to fit text
  1209. if (Subtitles.TextWidth > g_nButPos[g_nIndexSubtitle][2])
  1210. {
  1211. g_nButPos[g_nIndexSubtitle][2] = Subtitles.TextWidth;
  1212. }
  1213. if (SubtitlesFull.TextWidth > g_nButPosFull[g_nIndexSubtitle][2])
  1214. {
  1215. g_nButPosFull[g_nIndexSubtitle][2] = SubtitlesFull.TextWidth;
  1216. }
  1217. if (Audio.TextWidth > g_nButPos[g_nIndexAudio][2])
  1218. {
  1219. g_nButPos[g_nIndexAudio][2] = Audio.TextWidth;
  1220. }
  1221. if (AudioFull.TextWidth > g_nButPosFull[g_nIndexAudio][2])
  1222. {
  1223. g_nButPosFull[g_nIndexAudio][2] = AudioFull.TextWidth;
  1224. }
  1225. var nCCTextWidth = Math.max(EnCC.TextWidth, DiCC.TextWidth);
  1226. if (nCCTextWidth > g_nButPos[g_nIndexEnCC][2])
  1227. {
  1228. g_nButPos[g_nIndexEnCC][2] = nCCTextWidth;
  1229. g_nButPos[g_nIndexDiCC][2] = nCCTextWidth;
  1230. }
  1231. if (nCCTextWidth > g_nButPosFull[g_nIndexEnCC][2])
  1232. {
  1233. g_nButPosFull[g_nIndexEnCC][2] = nCCTextWidth;
  1234. g_nButPosFull[g_nIndexDiCC][2] = nCCTextWidth;
  1235. }
  1236. if (Angles.TextWidth > g_nButPos[g_nIndexAngle][2])
  1237. {
  1238. g_nButPos[g_nIndexAngle][2] = Angles.TextWidth;
  1239. }
  1240. if (AnglesFull.TextWidth > g_nButPosFull[g_nIndexAngle][2])
  1241. {
  1242. g_nButPosFull[g_nIndexAngle][2] = AnglesFull.TextWidth;
  1243. }
  1244. if (Options.TextWidth > g_nButPos[g_nIndexOptions][2])
  1245. {
  1246. g_nButPos[g_nIndexOptions][2] = Options.TextWidth;
  1247. }
  1248. if (OptionsFull.TextWidth > g_nButPosFull[g_nIndexOptions][2])
  1249. {
  1250. g_nButPosFull[g_nIndexOptions][2] = OptionsFull.TextWidth;
  1251. }
  1252. // oval buttons need a bit more margin
  1253. var nOvalMargin = 10;
  1254. var nMenuTextWidth = Math.max(Menu.TextWidth, Resume.TextWidth) + nOvalMargin;
  1255. if (nMenuTextWidth > g_nButPos[g_nIndexMenu][2])
  1256. {
  1257. g_nButPos[g_nIndexMenu][2] = nMenuTextWidth;
  1258. g_nButPos[g_nIndexResume][2] = nMenuTextWidth;
  1259. }
  1260. if (nMenuTextWidth > g_nButPosFull[g_nIndexMenu][2])
  1261. {
  1262. g_nButPosFull[g_nIndexMenu][2] = nMenuTextWidth;
  1263. g_nButPosFull[g_nIndexResume][2] = nMenuTextWidth;
  1264. }
  1265. }
  1266. InitTitleTextControl("Title", L_DVDPlayer_TEXT);
  1267. Title.FontStyle = "Bold";
  1268. TitleFull.FontStyle = "Bold";
  1269. InitTitleTextControl("Chapter", "");
  1270. InitTitleTextControl("Message", "");
  1271. InitTitleTextControl("TextBox", L_ProgressHHMMSS_TEXT.replace(/%1/i, "00:00:00"));
  1272. MFBar.EnableObject("MFBar", true);
  1273. try {
  1274. MFBar.RestoreSelfHostState("DVDPlay");
  1275. }
  1276. catch (e) {
  1277. MFBar.SetObjectExtent("MFBar", g_ConWidth+2, g_ConHeight+2);
  1278. }
  1279. if(1 != g_InitializationState){
  1280. return; // already we have initialized
  1281. }/* end of if statement */
  1282. if(4 != DVD.ReadyState){ // READYSTATE_COMPLETE = 4
  1283. // DVD is not initialized yet wait..
  1284. // DVD.About();
  1285. return;
  1286. }/* end of if statement */
  1287. lRender = 0x3; // look for path if we do not find any
  1288. if("" != MFBar.CmdLine){
  1289. lRender = 0x1; // do not look for missing drive we will try to set it later
  1290. }/* end of if statement */
  1291. try {
  1292. DVD.Render(lRender);
  1293. }
  1294. catch(e) {
  1295. // use the error description from Render
  1296. HandleFatalInitError(e, true);
  1297. return;
  1298. }
  1299. DVD.ColorKey = 0x0100010;
  1300. DVD.BackColor = 0;
  1301. // here we should wait and process all the messagess
  1302. MFBar.ProcessMessages();
  1303. if("" != MFBar.CmdLine){
  1304. try {
  1305. DVD.DVDDirectory = MFBar.CmdLine + "VIDEO_TS";
  1306. }
  1307. catch(e) {
  1308. // use the error description from Render
  1309. HandleFatalInitError(e, true);
  1310. return;
  1311. }
  1312. }/* end of if statement */
  1313. DVD.NotifyParentalLevelChange(true);
  1314. DVDOpt.WebDVD = DVD;
  1315. DVDOpt.ParentWindow = MFBar.Window;
  1316. if(false){
  1317. var rect = new ActiveXObject("MSWebDVD.DVDRect.1");
  1318. rect = DVD.GetVideoSize();
  1319. g_ConWidth = rect.Width+24;
  1320. g_ConHeight = rect.Height+g_ButHeight+30;
  1321. }/* end of if statement */
  1322. // update the initial volume position on the slider
  1323. try {
  1324. VolSlider.Value = ConvertFromDB(DVD.Volume);
  1325. VolSliderFull.Value = ConvertFromDB(DVD.Volume);
  1326. }
  1327. catch(e){
  1328. DisableObject("VolSlider", true);
  1329. DisableObject("Mute", true);
  1330. DisableObject("Sound", true);
  1331. }
  1332. g_InitializationState = 2;
  1333. SetupFocus();
  1334. //MFBar.EnableObject("DVD", true);
  1335. Run();
  1336. }
  1337. catch(e) {
  1338. e.description = L_ERROR_UnexpectedError_TEXT;
  1339. HandleError(e);
  1340. return;
  1341. }
  1342. }/* end of function Init */
  1343. /*************************************************************/
  1344. /* Function: Run */
  1345. /*************************************************************/
  1346. function Run(){
  1347. try {
  1348. if(3 == g_InitializationState){
  1349. return; // already we have initialized
  1350. }/* end of if statement */
  1351. DVD.Play();
  1352. // Select default audio stream
  1353. // UOP might be prohibiting it, need betten machanism to fix it
  1354. // DVD.CurrentAudioStream = 15;
  1355. // Enable splash screen
  1356. MFBar.EnableObject("Splash", false);
  1357. MFBar.EnableObject("DVD", true);
  1358. // Start activity timeout
  1359. EnableActivityTimeOut(true);
  1360. MFBar.ProcessMessages();
  1361. try {
  1362. // restores the DVD state
  1363. if (DVD.DVDAdm.BookmarkOnClose){
  1364. DVD.RestoreBookmark();
  1365. MFBar.ProcessMessages();
  1366. }/* end of if statement */
  1367. }
  1368. catch(e) {
  1369. DVD.DeleteBookmark();
  1370. }
  1371. // should do it after play a limitation in underlying API
  1372. DisableStep(); // disable frame stepping if not available
  1373. g_InitializationState = 3; // already done the run
  1374. }
  1375. catch(e) {
  1376. e.description = L_ERRORUnexpectedError_TEXT;
  1377. HandleError(e);
  1378. return;
  1379. }
  1380. }/* end of function Run */
  1381. /*************************************************************/
  1382. /* Name: OnReadyStateChange */
  1383. /* Description: Handles ready state changes of the control. */
  1384. /*************************************************************/
  1385. function OnReadyStateChange(state){
  1386. try {
  1387. return;
  1388. // READYSTATE_COMPLETE = 4
  1389. if (4 == state){
  1390. Init();
  1391. Run();
  1392. }/* end of if statement */
  1393. }
  1394. catch(e) {
  1395. e.description = L_ERRORUnexpectedError_TEXT;
  1396. HandleError(e);
  1397. return;
  1398. }
  1399. }/* end of function OnReadyStateChange */
  1400. /*************************************************************/
  1401. /* Name: OnResize */
  1402. /* Description: Handles resizing of the control. */
  1403. /*************************************************************/
  1404. function OnResize(lWidth, lHeight, lCode){
  1405. try {
  1406. // if minimized
  1407. if (lCode == 1)
  1408. return;
  1409. bFullScreen = (lCode==2)? true:false;
  1410. yOffset = lHeight - g_ButHeight - 8;
  1411. PositionButtons(lWidth, lHeight, bFullScreen);
  1412. if (bFullScreen && g_bActivityDeclined)
  1413. return;
  1414. for (i = 0; i < g_nNumButs+g_nNumSliders; i++) {
  1415. if (g_nButPos[i][6] != 0)
  1416. {
  1417. xPos = g_nButPos[i][0];
  1418. yPos = g_nButPos[i][1] + yOffset;
  1419. }
  1420. else if (g_LTRReading)
  1421. {
  1422. xPos = lWidth - g_nButPos[i][0] - g_nButPos[i][2];
  1423. yPos = g_nButPos[i][1];
  1424. }
  1425. else
  1426. {
  1427. xPos = g_nButPos[i][0];
  1428. yPos = g_nButPos[i][1];
  1429. }
  1430. if (bFullScreen && i!=g_nIndexIcon) {
  1431. MFBar.SetObjectPosition(g_strButID[i]+"Full", xPos, yPos,
  1432. g_nButPosFull[i][2], g_nButPosFull[i][3]);
  1433. // if previously windowed
  1434. if (g_bFullScreen == false || g_bFirstPlaying)
  1435. MFBar.SetObjectPosition(g_strButID[i], xPos, g_nYOutOfScreen,
  1436. g_nButPos[i][2], g_nButPos[i][3]);
  1437. }
  1438. else if (i!=g_nIndexIcon) {
  1439. MFBar.SetObjectPosition(g_strButID[i], xPos, yPos,
  1440. g_nButPos[i][2], g_nButPos[i][3]);
  1441. // if previously full screen
  1442. if (g_bFullScreen == true || g_bFirstPlaying)
  1443. MFBar.SetObjectPosition(g_strButID[i]+"Full", xPos, g_nYOutOfScreen,
  1444. g_nButPosFull[i][2], g_nButPosFull[i][3]);
  1445. }
  1446. }
  1447. if (g_ConWidth == lWidth && g_ConHeight == lHeight && bFullScreen == g_bFullScreen) {
  1448. UpdateDVDTitle();
  1449. return;
  1450. }
  1451. //MFBar.MessageBox("resizing begin", "");
  1452. if (bFullScreen) {
  1453. MFBar.EnableObject("MaximizeFull", false);
  1454. MFBar.EnableObject("RestoreFull", true);
  1455. MFBar.SetObjectPosition("DVD", 0, 0, lWidth, lHeight);
  1456. MFBar.SetObjectPosition("Splash", 0, 0, lWidth, lHeight);
  1457. MFBar.SetRectRgn(0, 0, lWidth, lHeight);
  1458. // if previously windowed
  1459. if (g_bFullScreen == false) {
  1460. g_bFullScreen = true;
  1461. SetupFocus();
  1462. SetFocus("Restore");
  1463. }
  1464. }
  1465. else {
  1466. MFBar.EnableObject("Maximize", true);
  1467. MFBar.EnableObject("Restore", false);
  1468. MFBar.SetObjectPosition("DVD", 12, 30, lWidth-24, yOffset-30);
  1469. MFBar.SetObjectPosition("Splash", 12, 30, lWidth-24, yOffset-30);
  1470. MFBar.SetRoundRectRgn(0, 0, lWidth, lHeight, 16, 16);
  1471. // if previously full screen
  1472. if (g_bFullScreen == true) {
  1473. g_bFullScreen = false;
  1474. SetupFocus();
  1475. SetFocus("Maximize");
  1476. }
  1477. }
  1478. g_ConWidth = lWidth;
  1479. g_ConHeight = lHeight;
  1480. g_bFullScreen = bFullScreen;
  1481. UpdateDVDTitle();
  1482. }
  1483. catch(e) {
  1484. e.description = L_ERRORResize_TEXT;
  1485. HandleError(e);
  1486. return;
  1487. }
  1488. }/* end of function OnResize */
  1489. /*************************************************************/
  1490. /* Name: OnBarHelp */
  1491. /* Description: Handles */
  1492. /*************************************************************/
  1493. function OnBarHelp(strObjectID, strExtraInfo)
  1494. {
  1495. try {
  1496. // need to associate help ID with the object
  1497. //TextBox.Text = strObjectID;
  1498. if(strObjectID == "MFBar"){
  1499. // we are dealing with the error messsage box, try to display troubleshooter
  1500. if(L_ERRORVideoStream_TEXT == strExtraInfo){
  1501. MFBar.HTMLHelp("hcp:", HH_DISPLAY_TOPIC, "tshoot00/DVDVideoStream.htm");
  1502. }
  1503. else if(L_ERRORAudioStream_TEXT == strExtraInfo){
  1504. MFBar.HTMLHelp("hcp:", HH_DISPLAY_TOPIC, "tshoot00/DVDAudio2.htm");
  1505. }
  1506. else if(L_ERRORIncompatibleSystemAndDecoderRegions_TEXT == strExtraInfo){
  1507. MFBar.HTMLHelp("hcp:", HH_DISPLAY_TOPIC, "tshoot00/DVDRegion.htm");
  1508. }
  1509. else if(L_ERRORCopyProtectFail_TEXT == strExtraInfo){
  1510. MFBar.HTMLHelp("hcp:", HH_DISPLAY_TOPIC, "tshoot00/DVDCopyProtection.htm");
  1511. }
  1512. else if(L_ERRORNoDecoder_TEXT == strExtraInfo){
  1513. MFBar.HTMLHelp("hcp:", HH_DISPLAY_TOPIC, "tshoot00/DVDDecoder.htm");
  1514. }
  1515. else if(L_ERRORNoOverlay_TEXT == strExtraInfo){
  1516. MFBar.HTMLHelp("hcp:", HH_DISPLAY_TOPIC, "tshoot00/DVDOverlay.htm");
  1517. }
  1518. else if(L_ERRORLowParentalLevel_TEXT == strExtraInfo){
  1519. MFBar.HTMLHelp("dvdplay.chm", HH_DISPLAY_TOPIC, "dvd_ratings.htm");
  1520. }
  1521. else if(L_ERRORMacrovisionFail_TEXT == strExtraInfo){
  1522. MFBar.HTMLHelp("hcp:", HH_DISPLAY_TOPIC, "tshoot00/DVDCopyProtection.htm");
  1523. }
  1524. else {
  1525. help_OnClick();
  1526. }/* end of if statement */
  1527. }
  1528. else {
  1529. help_OnClick();
  1530. }/* end of if statement */
  1531. }
  1532. catch(e) {
  1533. e.description = L_ERRORHelp_TEXT;
  1534. HandleError(e);
  1535. return;
  1536. }
  1537. }/* end of function OnBarHelp */
  1538. /*************************************************************/
  1539. /* Name: GetTimeSliderBstr
  1540. /* Description:
  1541. /*************************************************************/
  1542. function GetTimeSliderBstr()
  1543. {
  1544. try {
  1545. nDomain = DVD.CurrentDomain;
  1546. if (nDomain == 2 || nDomain == 3)
  1547. return;
  1548. if (g_bFullScreen)
  1549. percent = TimeSliderFull.Value;
  1550. else
  1551. percent = TimeSlider.Value;
  1552. totalTime = DVD.TotalTitleTime;
  1553. totalTimeInSec =
  1554. (new Number(totalTime.charAt(0)))*36000 +
  1555. (new Number(totalTime.charAt(1)))*3600 +
  1556. (new Number(totalTime.charAt(3)))*600 +
  1557. (new Number(totalTime.charAt(4)))*60 +
  1558. (new Number(totalTime.charAt(6)))*10 +
  1559. (new Number(totalTime.charAt(7)));
  1560. seekTimeInSec = totalTimeInSec*percent/100;
  1561. hours10 = Math.floor(seekTimeInSec/36000);
  1562. seekTimeInSec = seekTimeInSec%36000;
  1563. hours1 = Math.floor(seekTimeInSec/3600);
  1564. seekTimeInSec = seekTimeInSec%3600;
  1565. minutes10 = Math.floor(seekTimeInSec/600);
  1566. seekTimeInSec = seekTimeInSec%600;
  1567. minutes1 = Math.floor(seekTimeInSec/60)
  1568. seekTimeInSec = seekTimeInSec%60;
  1569. seconds10 = Math.floor(seekTimeInSec/10);
  1570. seconds1 = Math.floor(seekTimeInSec%10);
  1571. HH = "" + hours10 + hours1;
  1572. MM = "" + minutes10 + minutes1;
  1573. SS = "" + seconds10 + seconds1;
  1574. timeStr = L_HHMMSS_TEXT.replace(/%1/i, HH+":"+MM+":"+SS);
  1575. return timeStr;
  1576. }
  1577. catch(e) {
  1578. e.description = L_ERRORTime_TEXT;
  1579. HandleError(e);
  1580. return;
  1581. }
  1582. }/* end of function GetTimeSliderBstr */
  1583. /*************************************************************/
  1584. /* Name: OnTimeSliderMove */
  1585. /* Description: Update the position info. */
  1586. /*************************************************************/
  1587. function OnTimeSliderUpdate(btn, x)
  1588. {
  1589. timeStr = GetTimeSliderBstr();
  1590. btn.Tooltip = timeStr;
  1591. }
  1592. /*************************************************************/
  1593. /* Description: Turn on tooltip tracking */
  1594. /*************************************************************/
  1595. function OnSliderMouseUp(btn, butIndex){
  1596. btn.TooltipTracking = false;
  1597. if (butIndex >= 0)
  1598. btn.Tooltip = g_strButTT[butIndex];
  1599. EnableActivityTimeOut(true);
  1600. }/* end of function OnSliderMouseUp */
  1601. /*************************************************************/
  1602. /* Description: Turn off tooltip tracking */
  1603. /*************************************************************/
  1604. function OnSliderMouseDown(btn){
  1605. btn.TooltipTracking = true;
  1606. EnableActivityTimeOut(false);
  1607. }/* end of function OnSliderMouseDown */
  1608. /*************************************************************/
  1609. /* Name: OnTimeSliderMouseDown
  1610. /* Description:
  1611. /*************************************************************/
  1612. function OnTimeSliderMouseDown(btn){
  1613. g_bTimeSliderUpdate = false;
  1614. OnSliderMouseDown(btn);
  1615. }/* end of function OnTimeSliderMouseDown */
  1616. /*************************************************************/
  1617. /* Name: OnTimeSliderMouseUp
  1618. /* Description:
  1619. /*************************************************************/
  1620. function OnTimeSliderMouseUp(btn){
  1621. g_bTimeSliderUpdate = true;
  1622. OnSliderMouseUp(btn, g_nIndexTimeline);
  1623. }/* end of function OnTimeSliderMouseUp */
  1624. /*************************************************************/
  1625. /* Name: OnTimeSliderClick */
  1626. /* Description: When the mous is release last one takase */
  1627. /*************************************************************/
  1628. function OnTimeSliderClick()
  1629. {
  1630. try {
  1631. nDomain = DVD.CurrentDomain;
  1632. if (nDomain == 2 || nDomain == 3)
  1633. return;
  1634. timeStr = GetTimeSliderBstr();
  1635. DVD.PlayAtTime(timeStr);
  1636. DVD.PlayForwards(DVDOpt.PlaySpeed);
  1637. }
  1638. catch(e){
  1639. }
  1640. }
  1641. /*************************************************************/
  1642. /* Name: cc_Update
  1643. /* Description:
  1644. /*************************************************************/
  1645. function cc_Update() {
  1646. CCActive = false;
  1647. try {
  1648. CCActive = DVD.CCActive;
  1649. }
  1650. catch(e){
  1651. DisableCCButton();
  1652. return;
  1653. }
  1654. try {
  1655. if (!CCActive) {
  1656. fHadFocus = HasFocus("DiCC");
  1657. ShowObject("DiCC", false);
  1658. ShowObject("EnCC", true);
  1659. if (fHadFocus)
  1660. SetFocus("EnCC");
  1661. Message.Text = L_CCDisabled_TEXT;
  1662. MessageFull.Text = L_CCDisabled_TEXT;
  1663. }
  1664. else{
  1665. fHadFocus = HasFocus("EnCC");
  1666. ShowObject("DiCC", true);
  1667. ShowObject("EnCC", false);
  1668. if (fHadFocus)
  1669. SetFocus("DiCC");
  1670. Message.Text = L_CCEnabled_TEXT;
  1671. MessageFull.Text = L_CCEnabled_TEXT;
  1672. }
  1673. SetDVDMessageTimer();
  1674. }
  1675. catch(e) {
  1676. //e.description = L_ERRORUnexpectedError_TEXT;
  1677. //HandleError(e);
  1678. return;
  1679. }
  1680. }/* end of function cc_Update */
  1681. /*************************************************************************/
  1682. /* Function: DisableCCButton */
  1683. /* Description: Disables the CC button if the CC is not working, which */
  1684. /* is case on some decoders. */
  1685. /*************************************************************************/
  1686. function DisableCCButton(){
  1687. DisableObject("EnCC", true);
  1688. DisableObject("DiCC", true);
  1689. }/* end of function DisableCCButton */
  1690. /*************************************************************/
  1691. /* Name: pause_OnClick */
  1692. /* Description: OnClick callback for play/pause button */
  1693. /*************************************************************/
  1694. function pause_OnClick()
  1695. {
  1696. try {
  1697. DVD.Pause();
  1698. }
  1699. catch(e) {
  1700. e.description = L_ERRORUnexpectedError_TEXT;
  1701. HandleError(e);
  1702. return;
  1703. }
  1704. }/* end of function pause_OnClick */
  1705. /*************************************************************/
  1706. /* Name: play_OnClick */
  1707. /* Description: OnClick callback for play/pause button */
  1708. /*************************************************************/
  1709. function play_OnClick()
  1710. {
  1711. try {
  1712. DVD.Play();
  1713. try {
  1714. // restores the DVD state
  1715. if (g_bRestoreNeeded) {
  1716. g_bRestoreNeeded = false;
  1717. if (DVD.DVDAdm.BookmarkOnStop)
  1718. DVD.RestoreBookmark();
  1719. }
  1720. // if menu on and movie is playing
  1721. if (g_bMenuOn && g_PlayBackRate!=0)
  1722. DVD.Resume();
  1723. }
  1724. catch(e) {
  1725. if (DVD.DVDAdm.BookmarkOnStop)
  1726. DVD.DeleteBookmark();
  1727. }
  1728. }
  1729. catch(e) {
  1730. e.description = L_ERRORUnexpectedError_TEXT;
  1731. HandleError(e);
  1732. return;
  1733. }
  1734. }/* end of function play_OnClick */
  1735. /*************************************************************/
  1736. /* Name: fwd_OnClick */
  1737. /* Description: OnClick callback for forward button */
  1738. /*************************************************************/
  1739. function fwd_OnClick()
  1740. {
  1741. try {
  1742. DVD.PlayForwards(DVDOpt.ForwardScanSpeed);
  1743. }
  1744. catch(e) {
  1745. e.description = L_ERRORUnexpectedError_TEXT;
  1746. HandleError(e);
  1747. return;
  1748. }
  1749. }/* end of function fwd_OnClick */
  1750. /*************************************************************/
  1751. /* Name: rew_OnClick */
  1752. /* Description: OnClick callback for rewind button */
  1753. /*************************************************************/
  1754. function rew_OnClick()
  1755. {
  1756. try {
  1757. DVD.PlayBackwards(DVDOpt.BackwardScanSpeed);
  1758. }
  1759. catch(e) {
  1760. e.description = L_ERRORUnexpectedError_TEXT;
  1761. HandleError(e);
  1762. return;
  1763. }
  1764. }/* end of function rew_OnClick */
  1765. /*************************************************************/
  1766. /* Name: mute_OnClick */
  1767. /* Description: OnClick callback for rewind button */
  1768. /*************************************************************/
  1769. function mute_OnClick()
  1770. {
  1771. try {
  1772. DVD.Mute = true;
  1773. }
  1774. catch(e) {
  1775. //HandleError(e);
  1776. DisableObject("Mute", true);
  1777. DisableObject("Sound", true);
  1778. return;
  1779. }
  1780. try {
  1781. ShowObject("Mute", false);
  1782. ShowObject("Sound", true);
  1783. SetFocus("Sound");
  1784. }
  1785. catch (e) {
  1786. e.description = L_ERRORUnexpectedError_TEXT;
  1787. HandleError(e);
  1788. return;
  1789. }
  1790. }/* end of function mute_OnClick */
  1791. /*************************************************************/
  1792. /* Name: sound_OnClick */
  1793. /* Description: OnClick callback for rewind button */
  1794. /*************************************************************/
  1795. function sound_OnClick()
  1796. {
  1797. try {
  1798. DVD.Mute = false;
  1799. }
  1800. catch(e) {
  1801. //HandleError(e);
  1802. DisableObject("Mute", true);
  1803. DisableObject("Sound", true);
  1804. return;
  1805. }
  1806. try {
  1807. ShowObject("Mute", true);
  1808. ShowObject("Sound", false);
  1809. SetFocus("Mute");
  1810. }
  1811. catch (e) {
  1812. e.description = L_ERRORUnexpectedError_TEXT;
  1813. HandleError(e);
  1814. return;
  1815. }
  1816. }/* end of function sound_OnClick */
  1817. /*************************************************************/
  1818. /* Name: resume_OnClick */
  1819. /* Description: OnClick callback for menu button */
  1820. /*************************************************************/
  1821. function resume_OnClick()
  1822. {
  1823. try {
  1824. if (g_bMenuOn) {
  1825. DVD.Resume();
  1826. }
  1827. }
  1828. catch(e) {
  1829. return;
  1830. }
  1831. }
  1832. /*************************************************************/
  1833. /* Name: menu_OnClick */
  1834. /* Description: OnClick callback for menu button */
  1835. /*************************************************************/
  1836. function menu_OnClick()
  1837. {
  1838. try {
  1839. DVD.ShowMenu(3);
  1840. }
  1841. catch(e) {
  1842. e.description = L_ERRORUnexpectedError_TEXT;
  1843. HandleError(e);
  1844. return;
  1845. }
  1846. }/* end of function menu_OnClick */
  1847. /*************************************************************/
  1848. /* Name: titleMenu_OnClick */
  1849. /* Description: OnClick callback for menu button */
  1850. /*************************************************************/
  1851. function titleMenu_OnClick()
  1852. {
  1853. try {
  1854. DVD.ShowMenu(2);
  1855. }
  1856. catch(e) {
  1857. e.description = L_ERRORUnexpectedError_TEXT;
  1858. HandleError(e);
  1859. return;
  1860. }
  1861. }/* end of function titleMenu_OnClick */
  1862. /*************************************************************/
  1863. /* Name: cc_OnClick */
  1864. /* Description: OnClick callback for closed caption button */
  1865. /*************************************************************/
  1866. function cc_OnClick()
  1867. {
  1868. CCActive = false;
  1869. try {
  1870. CCActive = DVD.CCActive;
  1871. }
  1872. catch(e){
  1873. DisableCCButton();
  1874. return;
  1875. }
  1876. try {
  1877. DVD.CCActive = (!CCActive);
  1878. cc_Update();
  1879. }
  1880. catch(e) {
  1881. //e.description = L_ERRORUnexpectedError_TEXT;
  1882. //HandleError(e);
  1883. return;
  1884. }
  1885. }/* end of function cc_OnClick */
  1886. /*************************************************************/
  1887. /* Name: NextSPStream
  1888. /* Description:
  1889. /*************************************************************/
  1890. function NextSPStream()
  1891. {
  1892. try {
  1893. // return -1 if subpicture stream cannot be rendered
  1894. if (g_bNoSubpictureStream)
  1895. return -1;
  1896. nSubpics = DVD.SubpictureStreamsAvailable;
  1897. // return if there are no subtitles
  1898. if (nSubpics <= 0) return -1;
  1899. nCurrentSP = DVD.CurrentSubpictureStream;
  1900. nNextSP = (nCurrentSP+1)%nSubpics;
  1901. nCount = 0;
  1902. while (DVD.IsSubpictureStreamEnabled(nNextSP) != true) {
  1903. nNextSP = (nNextSP+1)%nSubpics;
  1904. if (nNextSP == nCurrentSP)
  1905. break;
  1906. nCount++;
  1907. if (nCount >= nSubpics)
  1908. break;
  1909. }
  1910. if (DVD.IsSubpictureStreamEnabled(nNextSP) != true)
  1911. return -1;
  1912. return nNextSP;
  1913. }
  1914. catch(e) {
  1915. return -1;
  1916. }
  1917. }
  1918. /*************************************************************/
  1919. /* Name: sp_OnClick
  1920. /* Description: OnClick callback for subpicture button
  1921. /*************************************************************/
  1922. function sp_OnClick()
  1923. {
  1924. try {
  1925. nSubpics = DVD.SubpictureStreamsAvailable;
  1926. nPreferredSP = DVD.PreferredSubpictureStream;
  1927. nCurrentSP = DVD.CurrentSubpictureStream;
  1928. bSPDisplay = DVD.SubpictureOn;
  1929. nNextSP = NextSPStream();
  1930. if (nNextSP < 0) {
  1931. // try to turn on/off CC, might not be supported
  1932. try {
  1933. CCActive = DVD.CCActive
  1934. DVD.CCActive = !CCActive;
  1935. }
  1936. catch (e) {
  1937. }
  1938. sp_ToolTip();
  1939. return;
  1940. }
  1941. // Next click will disable subpicture and enable CC
  1942. if (bSPDisplay && nNextSP == nPreferredSP) {
  1943. DVD.SubpictureOn = false;
  1944. // try to turn on CC, might not be supported
  1945. try {
  1946. DVD.CCActive = true;
  1947. }
  1948. catch (e) {
  1949. }
  1950. }
  1951. else {
  1952. // Next click will enable subpicture to the preferred stream
  1953. if (!bSPDisplay) {
  1954. // try to find out if CC is active
  1955. CCActive = false;
  1956. try {
  1957. CCActive = DVD.CCActive;
  1958. }
  1959. catch (e) {
  1960. }
  1961. if (!CCActive) {
  1962. DVD.SubpictureOn = true;
  1963. DVD.CurrentSubpictureStream = nPreferredSP;
  1964. }
  1965. else {
  1966. DVD.CCActive = false;
  1967. }
  1968. }
  1969. else {
  1970. DVD.CurrentSubpictureStream = nNextSP;
  1971. }
  1972. }
  1973. sp_ToolTip();
  1974. }
  1975. catch(e) {
  1976. e.description = L_ERRORUnexpectedError_TEXT;
  1977. HandleError(e);
  1978. return;
  1979. }
  1980. }/* end of function sp_OnClick */
  1981. /*************************************************************/
  1982. /* Name: NextAudioStream
  1983. /* Description:
  1984. /*************************************************************/
  1985. function NextAudioStream()
  1986. {
  1987. try {
  1988. nLangs = DVD.AudioStreamsAvailable;
  1989. nCurrentLang = DVD.CurrentAudioStream;
  1990. nNextLang = (nCurrentLang+1)%nLangs;
  1991. nCount = 0;
  1992. while (DVD.IsAudioStreamEnabled(nNextLang) != true) {
  1993. nNextLang = (nNextLang+1)%nLangs;
  1994. if (nNextLang == nCurrentLang)
  1995. break;
  1996. nCount++;
  1997. if (nCount >= nLangs)
  1998. break;
  1999. }
  2000. if (DVD.IsAudioStreamEnabled(nNextLang) != true)
  2001. return -1;
  2002. return nNextLang;
  2003. }
  2004. catch(e) {
  2005. return -1;
  2006. }
  2007. }
  2008. /*************************************************************/
  2009. /* Name: lan_OnClick
  2010. /* Description: OnClick callback for language button
  2011. /*************************************************************/
  2012. function lan_OnClick()
  2013. {
  2014. try {
  2015. nLangs = DVD.AudioStreamsAvailable;
  2016. // return if there is only 1 audio track
  2017. if (nLangs <= 1) return;
  2018. nCurrentLang = DVD.CurrentAudioStream;
  2019. nNextLang = NextAudioStream();
  2020. if (nNextLang >=0 && nCurrentLang != nNextLang)
  2021. DVD.CurrentAudioStream = nNextLang;
  2022. lan_ToolTip();
  2023. }
  2024. catch(e) {
  2025. e.description = L_ERRORUnexpectedError_TEXT;
  2026. HandleError(e);
  2027. return;
  2028. }
  2029. }/* end of function lan_OnClick */
  2030. /*************************************************************/
  2031. /* Name: angle_OnClick
  2032. /* Description: OnClick callback for parental guide button
  2033. /*************************************************************/
  2034. function angle_OnClick()
  2035. {
  2036. try {
  2037. nAngles = DVD.AnglesAvailable;
  2038. // return if there is only 1 viewing angle
  2039. if (nAngles <= 1) return;
  2040. nCurrentAngle = DVD.CurrentAngle + 1;
  2041. if (nCurrentAngle > nAngles)
  2042. nCurrentAngle = 1;
  2043. DVD.CurrentAngle = nCurrentAngle;
  2044. angle_ToolTip();
  2045. }
  2046. catch(e) {
  2047. e.description = L_ERRORUnexpectedError_TEXT;
  2048. HandleError(e);
  2049. return;
  2050. }
  2051. }/* end of function angle_OnClick */
  2052. /*************************************************************/
  2053. /* Name: prev_OnClick
  2054. /* Description: OnClick callback for previous chapter button
  2055. /*************************************************************/
  2056. function prev_OnClick()
  2057. {
  2058. try {
  2059. DVD.PlayPrevChapter();
  2060. //DVD.PlayForwards(DVDOpt.PlaySpeed);
  2061. }
  2062. catch(e) {
  2063. e.description = L_ERRORUnexpectedError_TEXT;
  2064. HandleError(e);
  2065. return;
  2066. }
  2067. }/* end of function prev_OnClick */
  2068. /*************************************************************/
  2069. /* Name: next_OnClick
  2070. /* Description: OnClick button for next chapter button
  2071. /*************************************************************/
  2072. function next_OnClick()
  2073. {
  2074. try {
  2075. if (g_bStillOn) {
  2076. try {
  2077. DVD.StillOff();
  2078. }
  2079. catch (e) {
  2080. try {
  2081. DVD.PlayNextChapter();
  2082. }
  2083. catch(e) {
  2084. }
  2085. }
  2086. }
  2087. else {
  2088. DVD.PlayNextChapter();
  2089. //DVD.PlayForwards(DVDOpt.PlaySpeed);
  2090. }
  2091. }
  2092. catch(e) {
  2093. e.description = L_ERRORUnexpectedError_TEXT;
  2094. HandleError(e);
  2095. return;
  2096. }
  2097. }/* end of function next_OnClick */
  2098. /*************************************************************/
  2099. /* Name: options_OnClick
  2100. /* Description: OnClick callback for option button
  2101. /*************************************************************/
  2102. function options_OnClick()
  2103. {
  2104. try {
  2105. DVDOpt.Show();
  2106. }
  2107. catch(e) {
  2108. e.description = L_ERRORUnexpectedError_TEXT;
  2109. HandleError(e);
  2110. return;
  2111. }
  2112. }/* end of function options_OnClick */
  2113. /*************************************************************/
  2114. /* Name: right_OnClick
  2115. /* Description: OnClick callback for right button
  2116. /*************************************************************/
  2117. function right_OnClick()
  2118. {
  2119. try {
  2120. DVD.SelectRightButton();
  2121. }
  2122. catch(e) {
  2123. //e.description = L_ERRORUnexpectedError_TEXT;
  2124. //HandleError(e);
  2125. return;
  2126. }
  2127. }/* end of function right_OnClick */
  2128. /*************************************************************/
  2129. /* Name: left_OnClick
  2130. /* Description: OnClick callback for left button
  2131. /*************************************************************/
  2132. function left_OnClick()
  2133. {
  2134. try {
  2135. DVD.SelectLeftButton();
  2136. }
  2137. catch(e) {
  2138. //e.description = L_ERRORUnexpectedError_TEXT;
  2139. //HandleError(e);
  2140. return;
  2141. }
  2142. }/* end of function left_OnClick */
  2143. /*************************************************************/
  2144. /* Name: up_OnClick
  2145. /* Description: OnClick callback for up button
  2146. /*************************************************************/
  2147. function up_OnClick()
  2148. {
  2149. try {
  2150. DVD.SelectUpperButton();
  2151. }
  2152. catch(e) {
  2153. //e.description = L_ERRORUnexpectedError_TEXT;
  2154. //HandleError(e);
  2155. return;
  2156. }
  2157. }/* end of function up_Onclick */
  2158. /*************************************************************/
  2159. /* Name: down_OnClick
  2160. /* Description: OnClick callback for up button
  2161. /*************************************************************/
  2162. function down_OnClick()
  2163. {
  2164. try {
  2165. DVD.SelectLowerButton();
  2166. }
  2167. catch(e) {
  2168. //e.description = L_ERRORUnexpectedError_TEXT;
  2169. //HandleError(e);
  2170. return;
  2171. }
  2172. }/* end of function down_Onclick */
  2173. /*************************************************************/
  2174. /* Name: enter_OnClick
  2175. /* Description:
  2176. /*************************************************************/
  2177. function enter_OnClick()
  2178. {
  2179. try {
  2180. DVD.ActivateButton();
  2181. }
  2182. catch(e) {
  2183. //e.description = L_ERRORUnexpectedError_TEXT;
  2184. //HandleError(e);
  2185. return;
  2186. }
  2187. }/* end of function enter_Onclick */
  2188. /*************************************************************/
  2189. /* Name: ProcessXXXEvent
  2190. /* Description:
  2191. /*************************************************************/
  2192. function ProcessPFEvent(param1)
  2193. {
  2194. try {
  2195. fDisable = (param1 == 0);
  2196. if (g_bStillOn)
  2197. fDisable = true;
  2198. DisableObject("FastForward", fDisable);
  2199. DisableObject("PlaySpeed", fDisable);
  2200. }
  2201. catch(e) {
  2202. //e.description = L_ERRORUnexpectedError_TEXT;
  2203. //HandleError(e);
  2204. return;
  2205. }
  2206. }
  2207. function ProcessPBEvent(param1)
  2208. {
  2209. try {
  2210. fDisable = (param1 == 0);
  2211. if (g_bStillOn)
  2212. fDisable = true;
  2213. DisableObject("Rewind", fDisable);
  2214. DisableObject("PlaySpeed", fDisable);
  2215. }
  2216. catch(e) {
  2217. //e.description = L_ERRORUnexpectedError_TEXT;
  2218. //HandleError(e);
  2219. return;
  2220. }
  2221. }
  2222. function ProcessShowMenuEvent(nMenu, param1)
  2223. {
  2224. try {
  2225. fDisable = (param1 == 0);
  2226. if (nMenu==3)
  2227. DisableObject("Menu", fDisable);
  2228. else if (nMenu==2)
  2229. DisableObject("TitleMenu", fDisable);
  2230. }
  2231. catch(e) {
  2232. //e.description = L_ERRORUnexpectedError_TEXT;
  2233. //HandleError(e);
  2234. return;
  2235. }
  2236. }
  2237. function ProcessResumeEvent(param1)
  2238. {
  2239. try {
  2240. fDisable = (param1 == 0);
  2241. DisableObject("Resume", fDisable);
  2242. if (g_bMenuOn)
  2243. DisableObject("Play", fDisable);
  2244. }
  2245. catch(e) {
  2246. //e.description = L_ERRORUnexpectedError_TEXT;
  2247. //HandleError(e);
  2248. return;
  2249. }
  2250. }
  2251. function ProcessSelectOrActivatButtonEvent(param1)
  2252. {
  2253. try {
  2254. // Disable/enable nav buttons
  2255. fDisable = (param1 == 0);
  2256. DisableObject("HLUp", fDisable);
  2257. DisableObject("HLDown", fDisable);
  2258. DisableObject("HLLeft", fDisable);
  2259. DisableObject("HLRight", fDisable);
  2260. DisableObject("Enter", fDisable);
  2261. }
  2262. catch(e) {
  2263. //e.description = L_ERRORUnexpectedError_TEXT;
  2264. //HandleError(e);
  2265. return;
  2266. }
  2267. }
  2268. function ProcessAudEvent(param1)
  2269. {
  2270. try {
  2271. fDisable = (param1 == 0);
  2272. if (DVD.CurrentDomain == 4) {
  2273. DisableObject("Audio", fDisable);
  2274. lan_ToolTip();
  2275. }
  2276. }
  2277. catch(e) {
  2278. //e.description = L_ERRORUnexpectedError_TEXT;
  2279. //HandleError(e);
  2280. return;
  2281. }
  2282. }
  2283. function ProcessSPEvent(param1)
  2284. {
  2285. try {
  2286. fDisable = (param1 == 0);
  2287. if (DVD.CurrentDomain == 4) {
  2288. DisableObject("Subtitles", fDisable);
  2289. sp_ToolTip();
  2290. }
  2291. }
  2292. catch(e) {
  2293. //e.description = L_ERRORUnexpectedError_TEXT;
  2294. //HandleError(e);
  2295. return;
  2296. }
  2297. }
  2298. function ProcessAngleEvent(param1)
  2299. {
  2300. try {
  2301. fDisable = (param1 == 0);
  2302. if (DVD.CurrentDomain == 4) {
  2303. DisableObject("Angles", fDisable);
  2304. angle_ToolTip();
  2305. }
  2306. }
  2307. catch(e) {
  2308. //e.description = L_ERRORUnexpectedError_TEXT;
  2309. //HandleError(e);
  2310. return;
  2311. }
  2312. }
  2313. function ProcessChapterPlayEvent(strBtn, param1)
  2314. {
  2315. try {
  2316. fDisable = (param1 == 0);
  2317. nDomain = DVD.CurrentDomain;
  2318. if (nDomain!=4)
  2319. fDisable = true;
  2320. // If still is on and menu isn't on, don't disable next
  2321. if (g_bStillOn && !g_bMenuOn && fDisable && strBtn == "SkipForward")
  2322. return;
  2323. DisableObject(strBtn, fDisable);
  2324. }
  2325. catch(e) {
  2326. //e.description = L_ERRORUnexpectedError_TEXT;
  2327. //HandleError(e);
  2328. return;
  2329. }
  2330. }
  2331. function ProcessTimePlayEvent(param1)
  2332. {
  2333. try {
  2334. fDisable = (param1 == 0);
  2335. DisableObject("TimeSlider", fDisable);
  2336. }
  2337. catch(e) {
  2338. //e.description = L_ERRORUnexpectedError_TEXT;
  2339. //HandleError(e);
  2340. return;
  2341. }
  2342. }
  2343. function ProcessStillOff(param1)
  2344. {
  2345. try {
  2346. fValid = (param1 == 1);
  2347. g_bStillOffValid = fValid;
  2348. if (g_bStillOn)
  2349. DisableObject("SkipForward", !fValid);
  2350. }
  2351. catch(e) {
  2352. //e.description = L_ERRORUnexpectedError_TEXT;
  2353. //HandleError(e);
  2354. return;
  2355. }
  2356. }
  2357. function ProcessDVDErrorEvent(ErrorCode, ErrorData)
  2358. {
  2359. var ShallClose = false;
  2360. //MFBar.MessageBox(ErrorCode, "DEBUG REMOVE");
  2361. switch (ErrorCode)
  2362. {
  2363. case DVD_ERROR_NoSubpictureStream:
  2364. message = L_ERRORNoSubpictureStream_TEXT;
  2365. g_bNoSubpictureStream = true;
  2366. break;
  2367. case DVD_ERROR_Unexpected:
  2368. message = L_ERRORUnexpectedError_TEXT;
  2369. break;
  2370. case DVD_ERROR_CopyProtectFail:
  2371. message = L_ERRORCopyProtectFail_TEXT;
  2372. break;
  2373. case DVD_ERROR_InvalidDVD1_0Disc:
  2374. message = L_ERRORInvalidDVD10Disc_TEXT;
  2375. break;
  2376. case DVD_ERROR_InvalidDiscRegion:
  2377. return; // do not handle this error since we handle it in the dvd control
  2378. message = L_ERRORInvalidDiscRegion_TEXT;
  2379. break;
  2380. case DVD_ERROR_LowParentalLevel:
  2381. message = L_ERRORLowParentalLevel_TEXT;
  2382. break;
  2383. case DVD_ERROR_MacrovisionFail:
  2384. message = L_ERRORMacrovisionFail_TEXT;
  2385. ShallClose = true;
  2386. break;
  2387. case DVD_ERROR_IncompatibleSystemAndDecoderRegions:
  2388. system = ErrorData & 0xFFFF;
  2389. decoder= ErrorData >> 16;
  2390. message = L_ERRORIncompatibleSystemAndDecoderRegions_TEXT.replace(/%1/i, system).replace(/%2/i, decoder);
  2391. L_ERRORIncompatibleSystemAndDecoderRegions_TEXT = message;
  2392. ShallClose = true;
  2393. break;
  2394. case DVD_ERROR_IncompatibleDiscAndDecoderRegions:
  2395. disc = ErrorData & 0xFFFF;
  2396. decoder= ErrorData >> 16;
  2397. tempStr = "";
  2398. first = true;
  2399. for (i=0; i<8; i++) {
  2400. if (disc%2 == 0) {
  2401. if (!first)
  2402. tempStr += ", ";
  2403. else
  2404. first = false;
  2405. tempStr += i+1;
  2406. }
  2407. disc = disc >> 1;
  2408. }
  2409. message = L_ERRORIncompatibleDiscAndDecoderRegions_TEXT.replace(/%1/i, tempStr).replace(/%2/i, decoder);
  2410. L_ERRORIncompatibleDiscAndDecoderRegions_TEXT = message;
  2411. ShallClose = true;
  2412. break;
  2413. default:
  2414. message = L_ERRORUnexpectedError_TEXT;
  2415. break;
  2416. }
  2417. var e = new Error (-1, message);
  2418. HandleError(e, ShallClose);
  2419. }
  2420. function ProcessDVDEvent(event, param1, param2)
  2421. {
  2422. lEventCode = event;
  2423. if (lEventCode == EC_DVD_STILL_ON) {
  2424. g_bStillOn = true;
  2425. DisableStep();
  2426. if (!g_bMenuOn) {
  2427. DisableObject("SkipForward", false);
  2428. SetFocus("SkipForward");
  2429. }
  2430. ProcessPBEvent(false);
  2431. ProcessPFEvent(false);
  2432. }
  2433. else if (lEventCode == EC_DVD_STILL_OFF) {
  2434. g_bStillOn = false;
  2435. DisableStep();
  2436. ProcessPBEvent(DVD.UOPValid(8));
  2437. ProcessPFEvent(DVD.UOPValid(9));
  2438. }
  2439. else if (lEventCode == EC_DVD_BUTTON_CHANGE) {
  2440. nDomain = DVD.CurrentDomain;
  2441. //Enable Nav UI
  2442. if(param1 > 0 && nDomain == 4) {
  2443. ShowObject("TitleResume", false);
  2444. ShowObject("TitleMenu", true);
  2445. DisableObject("TitleMenu", !DVD.UOPValid(10));
  2446. DisableNavUI(false, "Menu", "Resume");
  2447. ShowObject("Resume", false);
  2448. ShowObject("Menu", true);
  2449. DisableObject("Menu", !DVD.UOPValid(11));
  2450. }
  2451. else if (param1 == 0 && param2 == 0 && nDomain == 4) {
  2452. // Disable nav buttons
  2453. ShowObject("TitleResume", false);
  2454. ShowObject("TitleMenu", true);
  2455. DisableObject("TitleMenu", !DVD.UOPValid(10));
  2456. DisableNavUI(true, "Menu", "Resume");
  2457. ShowObject("Resume", false);
  2458. ShowObject("Menu", true);
  2459. DisableObject("Menu", !DVD.UOPValid(11));
  2460. }
  2461. }
  2462. else if (lEventCode == EC_DVD_DOMAIN_CHANGE) {
  2463. // If in manager menu or title set menu
  2464. ProcessTimePlayEvent(param1 == 4);
  2465. ProcessChapterPlayEvent("SkipForward", param1 == 4);
  2466. ProcessChapterPlayEvent("SkipBackward", param1 == 4);
  2467. // If we are in stop domain
  2468. if (param1 == 5) {
  2469. TextBox.Text = "";
  2470. TextBoxFull.Text = "";
  2471. TimeSlider.Value = TimeSlider.Min;
  2472. TimeSliderFull.Value = TimeSliderFull.Min;
  2473. // Disable all DVD UI except for play button
  2474. DisableDVDUI(true);
  2475. DisableObject("Play", false);
  2476. SetFocus("Play");
  2477. }
  2478. // If we are in root menu or title menu domain
  2479. else if (param1==3 || param1==2) {
  2480. // Disable audio, sp and angle buttons
  2481. DisableObject("Audio", true);
  2482. DisableObject("Subtitles", true);
  2483. DisableObject("Angles", true);
  2484. TextBox.Text = "";
  2485. TextBoxFull.Text = "";
  2486. TimeSlider.Value = TimeSlider.Min;
  2487. TimeSliderFull.Value = TimeSliderFull.Min;
  2488. try {
  2489. DVD.Zoom(0, 0, 0.0); // Zoom out
  2490. }
  2491. catch(e){
  2492. }
  2493. // Enable nav buttons
  2494. if (param1==3) {
  2495. ShowObject("TitleResume", false);
  2496. ShowObject("TitleMenu", true);
  2497. DisableObject("TitleMenu", !DVD.UOPValid(10));
  2498. DisableNavUI(false, "Menu", "Resume");
  2499. }
  2500. else if (param1==2) {
  2501. ShowObject("Resume", false);
  2502. ShowObject("Menu", true);
  2503. DisableObject("Menu", !DVD.UOPValid(11));
  2504. DisableNavUI(false, "TitleMenu", "TitleResume");
  2505. }
  2506. }
  2507. // If we are in title domain
  2508. else {
  2509. // Update audio, sp, and angle buttons
  2510. lan_ToolTip();
  2511. sp_ToolTip();
  2512. angle_ToolTip();
  2513. // Disable nav buttons
  2514. ShowObject("TitleResume", false);
  2515. ShowObject("TitleMenu", true);
  2516. DisableObject("TitleMenu", !DVD.UOPValid(10));
  2517. DisableNavUI(true, "Menu", "Resume");
  2518. ShowObject("Resume", false);
  2519. ShowObject("Menu", true);
  2520. DisableObject("Menu", !DVD.UOPValid(11));
  2521. }
  2522. UpdateDVDTitle();
  2523. }
  2524. else if (lEventCode == EC_DVD_TITLE_CHANGE) {
  2525. lan_ToolTip();
  2526. sp_ToolTip();
  2527. angle_ToolTip();
  2528. }
  2529. else if (lEventCode == EC_DVD_CHAPTER_START) {
  2530. }
  2531. else if (lEventCode == EC_DVD_AUDIO_STREAM_CHANGE) {
  2532. lan_ToolTip();
  2533. }
  2534. else if (lEventCode == EC_DVD_SUBPICTURE_STREAM_CHANGE) {
  2535. sp_ToolTip();
  2536. }
  2537. else if (lEventCode == EC_DVD_ANGLE_CHANGE) {
  2538. angle_ToolTip();
  2539. }
  2540. else if (lEventCode == EC_DVD_VALID_UOPS_CHANGE) {
  2541. }
  2542. else if (lEventCode == EC_DVD_CURRENT_HMSF_TIME) {
  2543. try {
  2544. nDomain = DVD.CurrentDomain;
  2545. if (nDomain == 4) {
  2546. // currentTime = DVD.CurrentTime.substr(0, 8);
  2547. currentTime = DVD.DVDTimeCode2bstr(param1).substr(0, 8);
  2548. TextBox.Text = L_ProgressHHMMSS_TEXT.replace(/%1/i, currentTime);
  2549. TextBoxFull.Text = L_ProgressHHMMSS_TEXT.replace(/%1/i, currentTime);
  2550. currentTimeInSec =
  2551. (new Number(currentTime.charAt(0)))*36000 +
  2552. (new Number(currentTime.charAt(1)))*3600 +
  2553. (new Number(currentTime.charAt(3)))*600 +
  2554. (new Number(currentTime.charAt(4)))*60 +
  2555. (new Number(currentTime.charAt(6)))*10 +
  2556. (new Number(currentTime.charAt(7)));
  2557. totalTime = DVD.TotalTitleTime;
  2558. totalTimeInSec =
  2559. (new Number(totalTime.charAt(0)))*36000 +
  2560. (new Number(totalTime.charAt(1)))*3600 +
  2561. (new Number(totalTime.charAt(3)))*600 +
  2562. (new Number(totalTime.charAt(4)))*60 +
  2563. (new Number(totalTime.charAt(6)))*10 +
  2564. (new Number(totalTime.charAt(7)));
  2565. percent = Math.floor(currentTimeInSec/totalTimeInSec*100);
  2566. if (g_bTimeSliderUpdate && percent>=TimeSlider.Min && percent<=TimeSlider.Max) {
  2567. TimeSlider.Value = percent;
  2568. TimeSliderFull.Value = percent;
  2569. }
  2570. }
  2571. }
  2572. catch(e){
  2573. TextBox.Text = L_ProgressHHMMSS_TEXT.replace(/%1/i, "00:00:00");
  2574. TextBoxFull.Text = L_ProgressHHMMSS_TEXT.replace(/%1/i, "00:00:00");
  2575. TimeSlider.Value = TimeSlider.Min;
  2576. TimeSliderFull.Value = TimeSliderFull.Min;
  2577. }
  2578. UpdateDVDTitle();
  2579. }
  2580. else if (event == EC_DVD_PAUSED ) {
  2581. g_PlayBackRate = 0;
  2582. ResetPlaySpeed(g_PlayBackRate/10000);
  2583. DisableObject("Play", false);
  2584. if (HasFocus("Pause") || HasFocus("Stop"))
  2585. SetFocus("Play");
  2586. ShowObject("Pause", false);
  2587. ShowObject("Stop", true);
  2588. }
  2589. else if (lEventCode == EC_DVD_PLAYING) {
  2590. g_PlayBackRate = 10000;
  2591. ResetPlaySpeed(g_PlayBackRate/10000);
  2592. if (g_bDVDUIDisabled) {
  2593. DisableDVDUI(false);
  2594. }
  2595. bHadFocus = HasFocus("Play");
  2596. ShowObject("Pause", true);
  2597. ShowObject("Stop", false);
  2598. if (!g_bStillOn) {
  2599. DisableObject("Play", true);
  2600. if (bHadFocus || g_bFirstPlaying)
  2601. SetFocus("Pause");
  2602. }
  2603. g_bFirstPlaying = false;
  2604. }
  2605. else if (lEventCode == EC_DVD_PLAYBACK_RATE_CHANGE) {
  2606. playing = (param1 == 10000);
  2607. g_PlayBackRate = param1;
  2608. if (true != PlaySpeed.TooltipTracking &&
  2609. true != PlaySpeedFull.TooltipTracking) {
  2610. ResetPlaySpeed(g_PlayBackRate/10000);
  2611. }
  2612. if (playing) {
  2613. if (HasFocus("Play"))
  2614. SetFocus("Pause");
  2615. DisableObject("Play", true);
  2616. }
  2617. else {
  2618. DisableObject("Play", false);
  2619. }
  2620. }
  2621. else if (lEventCode == EC_DVD_ERROR) {
  2622. if (param1 == DVD_ERROR_LowParentalLevel) {
  2623. DVDOpt.ParentalLevelOverride(1);
  2624. }
  2625. else {
  2626. ProcessDVDErrorEvent(param1, param2);
  2627. }
  2628. }
  2629. else if (lEventCode == EC_DVD_PARENTAL_LEVEL_CHANGE) {
  2630. DVDOpt.ParentalLevelOverride(0);
  2631. }
  2632. else if (lEventCode == EC_DVD_PLAYBACK_STOPPED) {
  2633. g_PlayBackRate = 0;
  2634. }
  2635. else if (lEventCode == EC_DVD_ANGLES_AVAILABLE) {
  2636. }
  2637. else if (lEventCode == EC_DVD_DISC_EJECTED) {
  2638. ActivityStarted();
  2639. DisableDVDUI(true);
  2640. DisableObject("Eject", false);
  2641. Eject.ToolTip = L_CloseDVD_TEXT;
  2642. EjectFull.ToolTip = L_CloseDVD_TEXT;
  2643. }
  2644. else if (lEventCode == EC_DVD_DISC_INSERTED) {
  2645. ActivityStarted();
  2646. DisableDVDUI(false);
  2647. DisableObject("Eject", false);
  2648. Eject.ToolTip = L_EjectDVD_TEXT;
  2649. EjectFull.ToolTip = L_EjectDVD_TEXT;
  2650. // In case we didn't auto start
  2651. // which is for certain, since we call stop before eject
  2652. play_OnClick();
  2653. }
  2654. }/* end of function ProcessXXXEvent */
  2655. /*************************************************************/
  2656. /* Name: sp_ToolTip
  2657. /* Description: Change the subpicture tool tip to the next language
  2658. /*************************************************************/
  2659. function sp_ToolTip()
  2660. {
  2661. try {
  2662. DisableObject("Subtitles", !DVD.UOPValid(21));
  2663. nDomain = DVD.CurrentDomain;
  2664. if (nDomain != 4) return;
  2665. nSubpics = DVD.SubpictureStreamsAvailable;
  2666. nCurrentSP = DVD.CurrentSubpictureStream;
  2667. bSPDisplay = DVD.SubpictureOn;
  2668. nPreferredSP = DVD.PreferredSubpictureStream;
  2669. nNextSP = NextSPStream();
  2670. if (nSubpics == 0 || nNextSP < 0) {
  2671. try {
  2672. if (DVD.CCActive) {
  2673. if (Subtitles.ToolTip != L_DisableCC_TEXT) {
  2674. Subtitles.ToolTip = L_DisableCC_TEXT;
  2675. SubtitlesFull.ToolTip = L_DisableCC_TEXT;
  2676. Message.Text = L_CCEnabled_TEXT;
  2677. MessageFull.Text = L_CCEnabled_TEXT;
  2678. SetDVDMessageTimer();
  2679. }
  2680. }
  2681. else {
  2682. if (Subtitles.ToolTip != L_EnableCC_TEXT) {
  2683. Subtitles.ToolTip = L_EnableCC_TEXT;
  2684. SubtitlesFull.ToolTip = L_EnableCC_TEXT;
  2685. Message.Text = L_CCDisabled_TEXT;
  2686. MessageFull.Text = L_CCDisabled_TEXT;
  2687. SetDVDMessageTimer();
  2688. }
  2689. }
  2690. }
  2691. catch (e) {
  2692. DisableObject("Subtitles", true);
  2693. }
  2694. return;
  2695. }
  2696. strCurrentLang = DVD.GetSubpictureLanguage(nCurrentSP);
  2697. // Next click will disable subpicture and enable CC if supported
  2698. if (bSPDisplay && nNextSP == nPreferredSP) {
  2699. strNextLang = L_ClosedCaption_TEXT;
  2700. tempStr = L_SubtitlesAreLanguageClickForLanguage_TEXT.replace(/%1/i, strCurrentLang).replace(/%2/i, strNextLang);
  2701. // try to find out if CC is supported
  2702. try {
  2703. CCActive = DVD.CCActive;
  2704. }
  2705. catch (e) {
  2706. tempStr = L_SubtitlesAreLanguageClickToDisable_TEXT.replace(/%1/i, strCurrentLang);
  2707. }
  2708. }
  2709. else {
  2710. // Next click will enable subpicture to the preferred stream
  2711. if (!bSPDisplay) {
  2712. // try to find out if CC is active
  2713. CCActive = false;
  2714. try {
  2715. CCActive = DVD.CCActive;
  2716. }
  2717. catch (e) {
  2718. }
  2719. if (!CCActive) {
  2720. strNextLang = DVD.GetSubpictureLanguage(nPreferredSP);
  2721. tempStr = L_SubtitlesAreDisabledClickForLanguage_TEXT.replace(/%1/i, strNextLang);
  2722. }
  2723. else {
  2724. strCurrentLang = L_ClosedCaption_TEXT;
  2725. tempStr = L_SubtitlesAreLanguageClickToDisable_TEXT.replace(/%1/i, strCurrentLang);
  2726. }
  2727. }
  2728. else {
  2729. strNextLang = DVD.GetSubpictureLanguage(nNextSP);
  2730. tempStr = L_SubtitlesAreLanguageClickForLanguage_TEXT.replace(/%1/i, strCurrentLang).replace(/%2/i, strNextLang);
  2731. }
  2732. }
  2733. if (Subtitles.ToolTip != tempStr) {
  2734. Subtitles.ToolTip = tempStr;
  2735. SubtitlesFull.ToolTip = tempStr;
  2736. Message.Text = Subtitles.ToolTip;
  2737. MessageFull.Text = Subtitles.ToolTip;
  2738. SetDVDMessageTimer();
  2739. }
  2740. }
  2741. catch(e) {
  2742. //e.description = L_ERRORToolTip_TEXT;
  2743. //HandleError(e);
  2744. return;
  2745. }
  2746. }/* end of function sp_ToolTip */
  2747. /*************************************************************/
  2748. /* Name: lan_ToolTip
  2749. /* Description: Change the audio tool tip to the next language
  2750. /*************************************************************/
  2751. function lan_ToolTip()
  2752. {
  2753. try {
  2754. DisableObject("Audio", !DVD.UOPValid(20));
  2755. nDomain = DVD.CurrentDomain;
  2756. if (nDomain != 4) return;
  2757. nLangs = DVD.AudioStreamsAvailable;
  2758. nNextLang = NextAudioStream();
  2759. // return if there are no audio tracks available at this time
  2760. if (nLangs == 0 || nNextLang < 0) {
  2761. Audio.ToolTip = L_NoAudioTracks_TEXT;
  2762. AudioFull.ToolTip = L_NoAudioTracks_TEXT;
  2763. DisableObject("Audio", true);
  2764. return;
  2765. }
  2766. nCurrentLang = DVD.CurrentAudioStream;
  2767. strCurrentLang = DVD.GetAudioLanguage(nCurrentLang);
  2768. if (nLangs == 1 || nNextLang == nCurrentLang) {
  2769. tempStr = L_AudioLanguageIsXNoMoreAudioTracks_TEXT.replace(/%1/i, strCurrentLang);
  2770. Audio.ToolTip = tempStr;
  2771. AudioFull.ToolTip = tempStr;
  2772. DisableObject("Audio", true);
  2773. return;
  2774. }
  2775. strNextLang = DVD.GetAudioLanguage(nNextLang);
  2776. tempStr = L_AudioLanguageIsXClickForY_TEXT.replace(/%1/i, strCurrentLang).replace(/%2/i, strNextLang);
  2777. if (Audio.ToolTip != tempStr) {
  2778. Audio.ToolTip = tempStr;
  2779. AudioFull.ToolTip = tempStr;
  2780. Message.Text = Audio.ToolTip;
  2781. MessageFull.Text = Audio.ToolTip;
  2782. SetDVDMessageTimer();
  2783. }
  2784. }
  2785. catch(e) {
  2786. //e.description = L_ERRORToolTip_TEXT;
  2787. //HandleError(e);
  2788. return;
  2789. }
  2790. }/* end of function lan_Tooltip */
  2791. /*************************************************************/
  2792. /* Name: angle_ToolTip
  2793. /* Description:
  2794. /*************************************************************/
  2795. function angle_ToolTip()
  2796. {
  2797. try {
  2798. DisableObject("Angles", !DVD.UOPValid(22));
  2799. nDomain = DVD.CurrentDomain;
  2800. if (nDomain != 4) return;
  2801. nAngles = DVD.AnglesAvailable;
  2802. // return if there is only 1 viewing angle
  2803. if (nAngles <= 1) {
  2804. Angles.ToolTip = L_ViewingAngleIs1NoMoreViewingAngles_TEXT;
  2805. AnglesFull.ToolTip = L_ViewingAngleIs1NoMoreViewingAngles_TEXT;
  2806. DisableObject("Angles", true);
  2807. return;
  2808. }
  2809. nCurrentAngle = DVD.CurrentAngle;
  2810. if (nCurrentAngle == nAngles) nNextAngle = 1;
  2811. else nNextAngle = nCurrentAngle + 1;
  2812. tempStr = L_ViewingAngleIsXClickForY_TEXT.replace(/%1/i, nCurrentAngle).replace(/%2/i, nNextAngle);
  2813. if (Angles.ToolTip != tempStr) {
  2814. Angles.ToolTip = tempStr;
  2815. AnglesFull.ToolTip = tempStr;
  2816. Message.Text = Angles.ToolTip;
  2817. MessageFull.Text = Angles.ToolTip;
  2818. SetDVDMessageTimer();
  2819. }
  2820. }
  2821. catch(e) {
  2822. //e.description = L_ERRORToolTip_TEXT;
  2823. //HandleError(e);
  2824. return;
  2825. }
  2826. }/* end of function angle_Tooltip */
  2827. /*************************************************************/
  2828. /* Name: help_OnClick()
  2829. /* Description:
  2830. /*************************************************************/
  2831. function help_OnClick()
  2832. {
  2833. try {
  2834. MFBar.HTMLHelp("dvdplay.chm", HH_DISPLAY_TOPIC, 0);
  2835. }
  2836. catch(e) {
  2837. //e.description = L_ERRORHelp_TEXT;
  2838. //HandleError(e);
  2839. return;
  2840. }
  2841. }/* end of function help_OnClick */
  2842. /*************************************************************/
  2843. /* Name: contextHelp_OnClick()
  2844. /* Description:
  2845. /*************************************************************/
  2846. function contextHelp_OnClick()
  2847. {
  2848. try {
  2849. }
  2850. catch(e) {
  2851. //e.description = L_ERRORHelp_TEXT;
  2852. //HandleError(e);
  2853. return;
  2854. }
  2855. }/* end of function contextHelp_OnClick */
  2856. /*************************************************************/
  2857. /* Name: max_OnClick, restore_OnClick, min_OnClick
  2858. /* Description:
  2859. /*************************************************************/
  2860. function max_OnClick()
  2861. {
  2862. try {
  2863. MFBar.ShowSelfSite(3);
  2864. //MessageBox("Maximazing", "test");
  2865. }
  2866. catch(e) {
  2867. e.description = L_ERRORResize_TEXT;
  2868. HandleError(e);
  2869. return;
  2870. }
  2871. }/* end of function max_Onclick */
  2872. /*************************************************************/
  2873. /* Function: restore_OnClick */
  2874. /*************************************************************/
  2875. function restore_OnClick(){
  2876. try {
  2877. MFBar.ShowSelfSite(9);
  2878. }
  2879. catch(e) {
  2880. e.description = L_ERRORResize_TEXT;
  2881. HandleError(e);
  2882. return;
  2883. }/* end of function restore_Onclick */
  2884. }/* end of function restore_OnClick */
  2885. /*************************************************************/
  2886. /* Function: OnKey */
  2887. /* Description: Handles OnKeyDown and OnKeyUp */
  2888. /*************************************************************/
  2889. function OnKey(lVirtKey, lKeyData){
  2890. try {
  2891. //MFBar.MessageBox("VK_Code is " + lKeyData, "Debug");
  2892. if(VK_EXTEND == lVirtKey){
  2893. ScanCode = (lKeyData >> 16) & 0xFF
  2894. //MFBar.MessageBox("Scan Code is " + ScanCode,"Debug");
  2895. switch(ScanCode){
  2896. case SC_PLAYPAUSE: lVirtKey = VK_PLAYPAUSE; break;
  2897. case SC_STOP: lVirtKey = VK_STOP; break;
  2898. case SC_PREVCHP: lVirtKey = VK_PREVCHP; break;
  2899. case SC_NEXTCHP: lVirtKey = VK_NEXTCHP; break;
  2900. case SC_MUTE: lVirtKey = VK_MUTE; break;
  2901. case SC_ISOUND: lVirtKey = VK_ISOUND; break;
  2902. case SC_DSOUND: lVirtKey = VK_DSOUND; break;
  2903. // do not have VK_KEY under NT so just do it
  2904. case SC_EJECT: EmulateReturnKey("Eject"); return;
  2905. }/* end of switch statement */
  2906. // on WIN98 family I get the above key so have to use scan codes tp map it
  2907. }/* end of if statement */
  2908. switch(lVirtKey){
  2909. case VK_LEFT : EmulateMenuKey("HLLeft"); break;
  2910. case VK_UP : EmulateMenuKey("HLUp"); break;
  2911. case VK_RIGHT : EmulateMenuKey("HLRight"); break;
  2912. case VK_DOWN : EmulateMenuKey("HLDown"); break;
  2913. case VK_SELECT:
  2914. case VK_SPACE :
  2915. case VK_RETURN:
  2916. if (HasFocus("HLLeft") ||
  2917. HasFocus("HLRight") ||
  2918. HasFocus("HLDown") ||
  2919. HasFocus("HLUp") ||
  2920. HasFocus("Enter"))
  2921. EmulateMenuKey("Enter");
  2922. break;
  2923. case VK_PLAYPAUSE: if(2 == DVD.PlayState) {
  2924. EmulateReturnKey("Pause");
  2925. }
  2926. else {
  2927. EmulateReturnKey("Play");
  2928. }
  2929. break;
  2930. case VK_STOP: EmulateReturnKey("Stop"); break;
  2931. case VK_PREVCHP: EmulateReturnKey("SkipBackward"); break;
  2932. case VK_NEXTCHP: EmulateReturnKey("SkipForward"); break;
  2933. case VK_MUTE: if(DVD.Mute){
  2934. EmulateReturnKey("Sound");
  2935. }
  2936. else {
  2937. EmulateReturnKey("Mute");
  2938. }/* end of if statement */
  2939. break;
  2940. case VK_ISOUND:
  2941. btn = "VolSlider";
  2942. EmulateKey(btn, VK_RIGHT);
  2943. break;
  2944. case VK_DSOUND:
  2945. btn = "VolSlider";
  2946. EmulateKey(btn, VK_LEFT);
  2947. break;
  2948. }/* end of switch statement */
  2949. }
  2950. catch(e){
  2951. //!!REMOVE
  2952. //MFBar.MessageBox("Error in Keybord handeling ", "Error");
  2953. return;
  2954. }
  2955. }/* end of function OnKey */
  2956. /*************************************************************/
  2957. /* Function: OnKeyUp */
  2958. /*************************************************************/
  2959. function OnKeyUp(lVirtKey, lKeyData){
  2960. if(VK_ESCAPE == lVirtKey){
  2961. Key_ESC();
  2962. return;
  2963. }/* end of if statement */
  2964. OnKey(lVirtKey, lKeyData);
  2965. }/* end of function OnKeyUp */
  2966. /*************************************************************/
  2967. /* Function: OnKeyDown */
  2968. /*************************************************************/
  2969. function OnKeyDown(lVirtKey, lKeyData){
  2970. OnKey(lVirtKey, lKeyData)
  2971. }/* end of function OnKeyDown */
  2972. /*************************************************************/
  2973. /* Function: OnSyskeyUp */
  2974. /*************************************************************/
  2975. function OnSysKeyUp(lVirtKey, lKeyData){
  2976. switch(lVirtKey){
  2977. case VK_F4:
  2978. close_OnClick();
  2979. break;
  2980. case VK_SPACE:
  2981. titleIcon_OnClick();
  2982. break;
  2983. }/* end of switch statement */
  2984. }/* end of function OnSyskeyUp */
  2985. /*************************************************************/
  2986. /* Function: Key_ESC */
  2987. /*************************************************************/
  2988. function Key_ESC(){
  2989. try {
  2990. if(g_bFullScreen){
  2991. restore_OnClick();
  2992. }/* end of if statement */
  2993. }
  2994. catch(e) {
  2995. e.description = L_ERRORResize_TEXT;
  2996. HandleError(e);
  2997. return;
  2998. }/* end of function restore_Onclick */
  2999. }/* end of function Key_ESC */
  3000. /*************************************************************/
  3001. /* Function: EmulateMenuKey */
  3002. /* Description: Simulates the key input to a menu. */
  3003. /*************************************************************/
  3004. function EmulateMenuKey(ButtonObjectName){
  3005. try {
  3006. if(g_bMenuOn){
  3007. EmulateReturnKey(ButtonObjectName);
  3008. }/* end of if statement */
  3009. }
  3010. catch(e) {
  3011. }/* end of function restore_Onclick */
  3012. }/* end of function EmulateMenuKey */
  3013. /*************************************************************/
  3014. /* Function: EmulateReturnKey */
  3015. /* Description: Simulates the retrun key input. */
  3016. /*************************************************************/
  3017. function EmulateReturnKey(ButtonObjectName){
  3018. try {
  3019. EmulateKey(ButtonObjectName, VK_RETURN);
  3020. }
  3021. catch(e) {
  3022. }/* end of function restore_Onclick */
  3023. }/* end of function EmulateReturnKey */
  3024. /*************************************************************/
  3025. /* Function: EmulateKey */
  3026. /* Description: Simulates the key input. */
  3027. /*************************************************************/
  3028. function EmulateKey(ButtonObjectName, vk){
  3029. try {
  3030. if(g_bFullScreen){
  3031. ButtonObjectName += "Full";
  3032. }/* end of if statement */
  3033. pObj = MFBar.SetObjectFocus(ButtonObjectName, true);
  3034. MFBar.ForceKey(vk, 0);
  3035. }
  3036. catch(e) {
  3037. }/* end of function restore_Onclick */
  3038. }/* end of function EmulateKey */
  3039. /*************************************************************/
  3040. /* Function: min_OnClick */
  3041. /*************************************************************/
  3042. function min_OnClick(){
  3043. try {
  3044. MFBar.ShowSelfSite(6);
  3045. }
  3046. catch(e) {
  3047. e.description = L_ERRORResize_TEXT;
  3048. HandleError(e);
  3049. return;
  3050. }/* end of function min_Onclick */
  3051. }/* end of function min_OnClick */
  3052. /*************************************************************/
  3053. /* Function: close_OnClick
  3054. /* Description:
  3055. /*************************************************************/
  3056. function close_OnClick()
  3057. {
  3058. try {
  3059. try {
  3060. if (DVD.DVDAdm.BookmarkOnClose) {
  3061. // Only save bookmark when not in stop domain
  3062. if (DVD.CurrentDomain != 5) {
  3063. DVD.SaveBookmark();
  3064. }
  3065. }
  3066. DVD.Stop();
  3067. DVD.DVDAdm.RestoreScreenSaver();
  3068. }
  3069. catch(e) {
  3070. // we do not care if we cannot save the state
  3071. }
  3072. MFBar.SaveSelfHostState("DVDPlay");
  3073. MFBar.SaveSelfHostUserData("DVDPlay", g_bExpanded);
  3074. MFBar.Close();
  3075. }
  3076. catch(e) {
  3077. e.description = L_ERRORUnexpectedError_TEXT;
  3078. HandleError(e);
  3079. return;
  3080. }
  3081. }/* end of function close_OnClick */
  3082. /*************************************************************/
  3083. /* Name: eject_OnClick */
  3084. /* Description: Ejects the disc and resets the bookmark. */
  3085. /*************************************************************/
  3086. function eject_OnClick()
  3087. {
  3088. try {
  3089. DVD.Stop();
  3090. DVD.Eject();
  3091. DVD.DeleteBookmark();
  3092. }
  3093. catch(e) {
  3094. e.description = L_ERROREject_TEXT;
  3095. HandleError(e, true);
  3096. return;
  3097. }/* end of function eject_Onclick */
  3098. }/* end of function eject_OnClick */
  3099. /*************************************************************/
  3100. /* Function: stop_OnClick
  3101. /* Description:
  3102. /*************************************************************/
  3103. function stop_OnClick()
  3104. {
  3105. try {
  3106. try {
  3107. if (DVD.DVDAdm.BookmarkOnStop)
  3108. DVD.SaveBookmark();
  3109. g_bRestoreNeeded = true;
  3110. MFBar.EnableObject("DVD", false);
  3111. MFBar.EnableObject("Splash", true);
  3112. }
  3113. catch(e) {
  3114. // we do not care if we cannot save the state
  3115. }
  3116. DVD.Stop();
  3117. }
  3118. catch(e) {
  3119. e.description = L_ERRORUnexpectedError_TEXT;
  3120. HandleError(e);
  3121. return;
  3122. }
  3123. }/* end of function stop_OnClick */
  3124. /*************************************************************/
  3125. /* Name: expand_OnClick
  3126. /* Description:
  3127. /*************************************************************/
  3128. function expand_OnClick()
  3129. {
  3130. g_ButHeight = g_ButOneLineHeight*2;
  3131. MFBar.MinHeight = g_MinHeight+g_ButOneLineHeight;
  3132. MFBar.BackGroundImage = "IDR_BACKIMG_EXPANDED";
  3133. if (!g_bFullScreen) {
  3134. MFBar.SetObjectExtent("MFBar", g_ConWidth, g_ConHeight+g_ButOneLineHeight);
  3135. }
  3136. else
  3137. OnResize(g_ConWidth, g_ConHeight, 2);
  3138. ShowObject("Expand", false);
  3139. ShowObject("Shrink", true);
  3140. g_bExpanded = true;
  3141. SetupFocus(); // switch the focus array if needs to be switched
  3142. SetFocus("Shrink");
  3143. }/* end of function expand_OnClick */
  3144. /*************************************************************/
  3145. /* Name: shrink_OnClick
  3146. /* Description:
  3147. /*************************************************************/
  3148. function shrink_OnClick()
  3149. {
  3150. g_ButHeight = g_ButOneLineHeight;
  3151. MFBar.MinHeight = g_MinHeight;
  3152. MFBar.BackGroundImage = "IDR_BACKIMG_SIMPLE";
  3153. if (!g_bFullScreen) {
  3154. MFBar.SetObjectExtent("MFBar", g_ConWidth, g_ConHeight-g_ButOneLineHeight);
  3155. }
  3156. else
  3157. OnResize(g_ConWidth, g_ConHeight, 2);
  3158. ShowObject("Expand", true);
  3159. ShowObject("Shrink", false);
  3160. g_bExpanded = false;
  3161. SetupFocus(); // switch the focus array if needs to be switched
  3162. SetFocus("Expand");
  3163. }/* end of function shrink_OnClick */
  3164. /*************************************************************/
  3165. /* Name: zoomin_OnClick
  3166. /* Description:
  3167. /*************************************************************/
  3168. function zoomin_OnClick()
  3169. {
  3170. try {
  3171. var rect = new ActiveXObject("MSWebDVD.DVDRect.1");
  3172. rect = DVD.GetClipVideoRect();
  3173. DVD.Zoom(rect.x+rect.Width/2.0, rect.y+rect.Height/2.0, 2.0);
  3174. }
  3175. catch(e) {
  3176. e.description = L_ERRORUnexpectedError_TEXT;
  3177. HandleError(e);
  3178. return;
  3179. }
  3180. }/* end of function zoomin_OnClick */
  3181. /*************************************************************/
  3182. /* Name: zoomout_OnClick
  3183. /* Description:
  3184. /*************************************************************/
  3185. function zoomout_OnClick()
  3186. {
  3187. try {
  3188. var rect = new ActiveXObject("MSWebDVD.DVDRect.1");
  3189. rect = DVD.GetClipVideoRect();
  3190. DVD.Zoom(rect.x+rect.Width/2.0, rect.y+rect.Height/2.0, 0.5);
  3191. }
  3192. catch(e) {
  3193. e.description = L_ERRORUnexpectedError_TEXT;
  3194. HandleError(e);
  3195. return;
  3196. }
  3197. }/* end of function zoomout_OnClick */
  3198. /*************************************************************/
  3199. /* Name: OnSpeedSliderClick
  3200. /* Description: Speed scrub bar on click
  3201. /*************************************************************/
  3202. function OnSpeedSliderClick(btn)
  3203. {
  3204. try {
  3205. x = btn.Value;
  3206. val = AdjustSpeed(x);
  3207. val = Math.ceil(val*10)/10;
  3208. if (x>0){
  3209. DVD.PlayForwards(val, true);
  3210. }
  3211. else if (x<0) {
  3212. DVD.PlayBackwards(val, true);
  3213. }
  3214. else if (x==0) {
  3215. DVD.Pause();
  3216. }/* end of if statement */
  3217. UpdatePlaySpeedTooltip (x);
  3218. }
  3219. catch(e) {
  3220. e.description = L_ERRORUnexpectedError_TEXT;
  3221. HandleError(e);
  3222. return;
  3223. }
  3224. }/* end of function OnSpeedSliderClick */
  3225. /*************************************************************/
  3226. /* Name: OnSpeedSliderUpdate
  3227. /* Description: Speed scrub bar on value change
  3228. /*************************************************************/
  3229. function OnSpeedSliderUpdate(btn, x)
  3230. {
  3231. try {
  3232. UpdatePlaySpeedTooltip (x);
  3233. }
  3234. catch(e) {
  3235. e.description = L_ERRORUnexpectedError_TEXT;
  3236. HandleError(e);
  3237. return;
  3238. }
  3239. }/* end of function OnSpeedSliderUpdate */
  3240. /*************************************************************/
  3241. /* Name: OnSpeedSliderMouseUp
  3242. /* Description:
  3243. /*************************************************************/
  3244. function OnSpeedSliderMouseUp(btn)
  3245. {
  3246. try {
  3247. ResetPlaySpeed(g_PlayBackRate/10000);
  3248. if (g_PlayBackRate == 10000) {
  3249. OnSliderMouseUp(btn, g_nIndexSpeed);
  3250. }
  3251. else {
  3252. OnSliderMouseUp(btn, -1);
  3253. }
  3254. }
  3255. catch (e)
  3256. {
  3257. e.description = L_ERRORUnexpectedError_TEXT;
  3258. HandleError(e);
  3259. return;
  3260. }
  3261. }
  3262. /*************************************************************/
  3263. /* Function: ResetPlaySpeed */
  3264. /* Description: Changes the value of the play speed. */
  3265. /*************************************************************/
  3266. function ResetPlaySpeed(val){
  3267. try {
  3268. if (val > 0)
  3269. x = AdjustSpeedReverse(val, true);
  3270. else
  3271. x = AdjustSpeedReverse(-val, false);
  3272. PlaySpeed.Value = x;
  3273. PlaySpeedFull.Value = x;
  3274. UpdatePlaySpeedTooltip(x);
  3275. }
  3276. catch(e) {
  3277. e.description = L_ERRORUnexpectedError_TEXT;
  3278. HandleError(e);
  3279. return;
  3280. }
  3281. }/* end of function ResetPlaySpeed */
  3282. /*************************************************************/
  3283. /* Name: UpdatePlaySpeedTooltip
  3284. /* Description:
  3285. /*************************************************************/
  3286. function UpdatePlaySpeedTooltip(x)
  3287. {
  3288. try {
  3289. val = AdjustSpeed(x);
  3290. val = Math.ceil(val*10)/10;
  3291. if (x > 0) {
  3292. TooltipText = L_FORWARD_TEXT.replace(/%1/i, val);
  3293. }
  3294. else if (x < 0) {
  3295. TooltipText = L_REVERSE_TEXT.replace(/%1/i, val);
  3296. }/* end of if statement */
  3297. else {
  3298. TooltipText = L_Pause_TEXT;
  3299. }/* end of if statement */
  3300. PlaySpeed.Tooltip = TooltipText;
  3301. PlaySpeedFull.Tooltip = TooltipText;
  3302. if (val == 1.0 && x > 0) {
  3303. if (true != PlaySpeed.TooltipTracking)
  3304. PlaySpeed.Tooltip = g_strButTT[g_nIndexSpeed];
  3305. if (true != PlaySpeedFull.TooltipTracking)
  3306. PlaySpeedFull.Tooltip = g_strButTT[g_nIndexSpeed];
  3307. }
  3308. }
  3309. catch(e) {
  3310. e.description = L_ERRORUnexpectedError_TEXT;
  3311. HandleError(e);
  3312. return;
  3313. }
  3314. }
  3315. /*************************************************************/
  3316. /* Function: AdjustSpeed */
  3317. /*************************************************************/
  3318. function AdjustSpeed(x){
  3319. if (x == 0)
  3320. return 0;
  3321. if (x >= 2.0 && x <= 2.5)
  3322. x = 2;
  3323. else if (x > 2.5)
  3324. x = x - 0.5;
  3325. powerInc = 2;
  3326. val = Math.abs(x);
  3327. val = Math.pow(powerInc, val - g_nVariableSpeedOffset);
  3328. return(val);
  3329. }/* end of function AdjustSpeed */
  3330. /*************************************************************/
  3331. /* Function: AdjustSpeedReverse */
  3332. /* Description: Inverse function of AdjustSpeed */
  3333. /*************************************************************/
  3334. function AdjustSpeedReverse(y, fForwards){
  3335. if (y == 0)
  3336. return 0;
  3337. powerInc = 2;
  3338. val = (Math.log(y) / Math.log(powerInc)) +g_nVariableSpeedOffset;
  3339. val = Math.ceil(val*100)/100;
  3340. if (val == 2.0 && fForwards)
  3341. val = 2.25;
  3342. else if (val > 2.0 && fForwards)
  3343. val = val + 0.5;
  3344. if(!fForwards){
  3345. val = -val;
  3346. }/* end of if statement */
  3347. return(val);
  3348. }/* end of function AdjustSpeedReverse */
  3349. /*************************************************************/
  3350. /* Function: ConvertToDB */
  3351. /* Description: Converts slider value to DBs */
  3352. /*************************************************************/
  3353. function ConvertToDB(x){
  3354. val = Math.log(x) / Math.LOG10E;
  3355. val = val * (1000);
  3356. if (val < cgVOLUME_MIN)
  3357. val = cgVOLUME_MIN;
  3358. if (val > cgVOLUME_MAX)
  3359. val = cgVOLUME_MAX;
  3360. return(val);
  3361. }/* end of function ConvertToDB */
  3362. /*************************************************************/
  3363. /* Function: ConvertFromDB */
  3364. /* Description: Converts slider value to DBs */
  3365. /*************************************************************/
  3366. function ConvertFromDB(x){
  3367. if (x < cgVOLUME_MIN)
  3368. x = cgVOLUME_MIN;
  3369. if (x > cgVOLUME_MAX)
  3370. x = cgVOLUME_MAX;
  3371. val = Math.exp(x/ 1000 * Math.LOG10E);
  3372. return(val);
  3373. }/* end of function ConvertFromDB */
  3374. /*************************************************************/
  3375. /* Name: OnVolUpdate */
  3376. /* Description: volume slider on value change */
  3377. /*************************************************************/
  3378. function OnVolUpdate(btn, x)
  3379. {
  3380. try {
  3381. val = ConvertToDB(x);
  3382. btn.Tooltip = Math.ceil(x*10)/10;
  3383. DVD.Volume = val;
  3384. // update the other slider
  3385. if(true == g_bFullScreen){
  3386. VolSlider.Value = x;
  3387. }
  3388. else {
  3389. VolSliderFull.Value = x;
  3390. }/* end of if statement */
  3391. // we adjusted the volume so lets unmute
  3392. ShowObject("Mute", true);
  3393. ShowObject("Sound", false);
  3394. }
  3395. catch(e) {
  3396. DisableObject("VolSlider", true);
  3397. DisableObject("Mute", true);
  3398. DisableObject("Sound", true);
  3399. return;
  3400. }
  3401. }/* end of function OnVolUpdate */
  3402. /*************************************************************/
  3403. /* Name: capture_OnClick
  3404. /* Description:
  3405. /*************************************************************/
  3406. function capture_OnClick(){
  3407. try {
  3408. DVD.Capture();
  3409. }
  3410. catch(e) {
  3411. e.description = L_ERRORCapture_TEXT;
  3412. HandleError(e);
  3413. return;
  3414. }
  3415. } /* end of function capture_OnClick */
  3416. /*************************************************************/
  3417. /* Name: ActivityStarted
  3418. /* Description:
  3419. /*************************************************************/
  3420. function ActivityStarted(){
  3421. g_bActivityDeclined = false;
  3422. if (g_bFullScreen) {
  3423. OnResize(g_ConWidth, g_ConHeight, 2);
  3424. DVD.ShowCursor = true;
  3425. }
  3426. //MFBar.MessageBox("Activity Started", "Status");
  3427. }/* end of function ActivityStarted */
  3428. /*************************************************************/
  3429. /* Name: ActivityDeclined
  3430. /* Description:
  3431. /*************************************************************/
  3432. function ActivityDeclined(){
  3433. g_bActivityDeclined = true;
  3434. if (g_bFullScreen) {
  3435. for (i=0; i<g_nNumButs+g_nNumSliders+g_nNumTexts; i++) {
  3436. MFBar.SetObjectPosition(g_strButID[i]+"Full",
  3437. g_nButPos[i][0], g_nYOutOfScreen,
  3438. g_nButPos[i][2], g_nButPos[i][3]);
  3439. }
  3440. DVD.ShowCursor = false;
  3441. }
  3442. //MFBar.MessageBox("Activity Declined", "Status");
  3443. }/* end of function ActivityStarted */
  3444. /*************************************************************/
  3445. /* Name: OnMessageTimeOut
  3446. /* Description:
  3447. /*************************************************************/
  3448. function OnMessageTimeOut(id) {
  3449. if (id == DVDMSGTIMER) {
  3450. Message.Text = "";
  3451. MessageFull.Text = "";
  3452. xCoord = g_nYOutOfScreen;
  3453. yCoord = g_nYOutOfScreen;
  3454. MFBar.SetObjectPosition("MessageFull", xCoord, yCoord,
  3455. MessageFull.TextWidth, g_nButPosFull[g_nIndexMessage][3]);
  3456. MFBar.SetObjectPosition("Message", xCoord, yCoord,
  3457. Message.TextWidth, g_nButPos[g_nIndexMessage][3]);
  3458. g_bDVDMessageActive = false;
  3459. UpdateDVDTime();
  3460. }
  3461. }
  3462. /*************************************************************/
  3463. /* Name: SetDVDMessageTimer
  3464. /* Description:
  3465. /*************************************************************/
  3466. function SetDVDMessageTimer() {
  3467. MFBar.SetTimeOut(2000, DVDMSGTIMER);
  3468. g_bDVDMessageActive = true;
  3469. UpdateDVDTime();
  3470. }
  3471. /*************************************************************/
  3472. /* Name: UpdateDVDMessage
  3473. /* Description:
  3474. /*************************************************************/
  3475. function UpdateDVDMessage() {
  3476. if (g_bFirstPlaying || g_bDVDMessageActive == false)
  3477. return;
  3478. if (g_LTRReading)
  3479. {
  3480. xCoord = Title.TextWidth + Chapter.TextWidth + g_nButPos[g_nIndexMessage][0];
  3481. }
  3482. else
  3483. {
  3484. xCoord = g_ConWidth - Title.TextWidth - Chapter.TextWidth - Message.TextWidth - g_nButPos[g_nIndexMessage][0];
  3485. }
  3486. yCoord = g_nButPos[g_nIndexMessage][1];
  3487. if (g_bFullScreen && !g_bActivityDeclined)
  3488. {
  3489. MFBar.SetObjectPosition("MessageFull", xCoord, yCoord,
  3490. MessageFull.TextWidth, g_nButPosFull[g_nIndexMessage][3]);
  3491. MFBar.SetObjectPosition("Message", xCoord, g_nYOutOfScreen,
  3492. Message.TextWidth, g_nButPos[g_nIndexMessage][3]);
  3493. }
  3494. else if (!g_bFullScreen)
  3495. {
  3496. MFBar.SetObjectPosition("Message", xCoord, yCoord,
  3497. Message.TextWidth, g_nButPos[g_nIndexMessage][3]);
  3498. MFBar.SetObjectPosition("MessageFull", xCoord, g_nYOutOfScreen,
  3499. MessageFull.TextWidth, g_nButPosFull[g_nIndexMessage][3]);
  3500. }
  3501. }
  3502. /*************************************************************/
  3503. /* Name: UpdateDVDTime
  3504. /* Description:
  3505. /*************************************************************/
  3506. function UpdateDVDTime() {
  3507. if (g_bFirstPlaying)
  3508. return;
  3509. if (g_LTRReading)
  3510. {
  3511. xCoord = Title.TextWidth + Chapter.TextWidth + g_nButPos[g_nIndexTextbox][0];
  3512. }
  3513. else
  3514. {
  3515. xCoord = g_ConWidth - Title.TextWidth - Chapter.TextWidth - TextBox.TextWidth - g_nButPos[g_nIndexTextbox][0];
  3516. }
  3517. if (g_bDVDMessageActive)
  3518. yCoord = g_nYOutOfScreen;
  3519. else
  3520. yCoord = g_nButPos[g_nIndexTextbox][1];
  3521. if (g_bFullScreen && !g_bActivityDeclined)
  3522. {
  3523. MFBar.SetObjectPosition("TextBoxFull", xCoord, yCoord,
  3524. TextBoxFull.TextWidth, g_nButPosFull[g_nIndexTextbox][3]);
  3525. MFBar.SetObjectPosition("TextBox", xCoord, g_nYOutOfScreen,
  3526. TextBox.TextWidth, g_nButPos[g_nIndexTextbox][3]);
  3527. }
  3528. else if (!g_bFullScreen)
  3529. {
  3530. MFBar.SetObjectPosition("TextBox", xCoord, yCoord,
  3531. TextBox.TextWidth, g_nButPos[g_nIndexTextbox][3]);
  3532. MFBar.SetObjectPosition("TextBoxFull", xCoord, g_nYOutOfScreen,
  3533. TextBoxFull.TextWidth, g_nButPosFull[g_nIndexTextbox][3]);
  3534. }
  3535. }
  3536. /*************************************************************/
  3537. /* Name: UpdateDVDTitle
  3538. /* Description:
  3539. /*************************************************************/
  3540. function UpdateDVDTitle() {
  3541. if (g_bFirstPlaying) {
  3542. Chapter.Text = "";
  3543. ChapterFull.Text = "";
  3544. }
  3545. else {
  3546. try {
  3547. nTitle = DVD.CurrentTitle;
  3548. nChap = DVD.CurrentChapter;
  3549. var tempstr = L_TitleChapter_TEXT.replace(/%1/i, nTitle).replace(/%2/i, nChap);
  3550. ChapterFull.Text = tempstr;
  3551. Chapter.Text = tempstr;
  3552. }
  3553. catch(e) {
  3554. ChapterFull.Text = "";
  3555. Chapter.Text = "";
  3556. }
  3557. }
  3558. if (g_LTRReading)
  3559. {
  3560. xCoordIcon = g_nButPos[g_nIndexIcon][0];
  3561. xCoordTitle = g_nButPos[g_nIndexTitle][0];
  3562. xCoordChapter = Title.TextWidth + g_nButPos[g_nIndexChapter][0];
  3563. }
  3564. else
  3565. {
  3566. xCoordIcon = g_ConWidth - g_nButPos[g_nIndexIcon][2] - g_nButPos[g_nIndexIcon][0];
  3567. xCoordTitle = g_ConWidth - Title.TextWidth - g_nButPos[g_nIndexTitle][0];
  3568. xCoordChapter = g_ConWidth - Title.TextWidth - Chapter.TextWidth - g_nButPos[g_nIndexChapter][0]
  3569. }
  3570. yCoord = g_nButPos[g_nIndexChapter][1];
  3571. if (g_bFullScreen && !g_bActivityDeclined)
  3572. {
  3573. MFBar.SetObjectPosition("TitleIconFull", xCoordIcon, yCoord,
  3574. g_nButPos[g_nIndexIcon][2], g_nButPos[g_nIndexIcon][3]);
  3575. MFBar.SetObjectPosition("TitleIcon", xCoordIcon, g_nYOutOfScreen,
  3576. g_nButPos[g_nIndexIcon][2], g_nButPos[g_nIndexIcon][3]);
  3577. MFBar.SetObjectPosition("TitleFull", xCoordTitle, yCoord,
  3578. TitleFull.TextWidth, g_nButPos[g_nIndexChapter][3]);
  3579. MFBar.SetObjectPosition("Title", xCoordTitle, g_nYOutOfScreen,
  3580. Title.TextWidth, g_nButPos[g_nIndexChapter][3]);
  3581. MFBar.SetObjectPosition("ChapterFull", xCoordChapter, yCoord,
  3582. ChapterFull.TextWidth, g_nButPos[g_nIndexChapter][3]);
  3583. MFBar.SetObjectPosition("Chapter", xCoordChapter, g_nYOutOfScreen,
  3584. Chapter.TextWidth, g_nButPos[g_nIndexChapter][3]);
  3585. }
  3586. else if (!g_bFullScreen)
  3587. {
  3588. MFBar.SetObjectPosition("TitleIcon", xCoordIcon, yCoord,
  3589. g_nButPos[g_nIndexIcon][2], g_nButPos[g_nIndexIcon][3]);
  3590. MFBar.SetObjectPosition("TitleIconFull", xCoordIcon, g_nYOutOfScreen,
  3591. g_nButPos[g_nIndexIcon][2], g_nButPos[g_nIndexIcon][3]);
  3592. MFBar.SetObjectPosition("Title", xCoordTitle, yCoord,
  3593. Title.TextWidth, g_nButPos[g_nIndexChapter][3]);
  3594. MFBar.SetObjectPosition("TitleFull", xCoordTitle, g_nYOutOfScreen,
  3595. TitleFull.TextWidth, g_nButPos[g_nIndexChapter][3]);
  3596. MFBar.SetObjectPosition("Chapter", xCoordChapter, yCoord,
  3597. Chapter.TextWidth, g_nButPos[g_nIndexChapter][3]);
  3598. MFBar.SetObjectPosition("ChapterFull", xCoordChapter, g_nYOutOfScreen,
  3599. ChapterFull.TextWidth, g_nButPos[g_nIndexChapter][3]);
  3600. }
  3601. UpdateDVDTime();
  3602. UpdateDVDMessage();
  3603. }
  3604. /*************************************************************/
  3605. /* Name: DisableDVDUI
  3606. /* Description: Disable DVD related UI
  3607. /*************************************************************/
  3608. function DisableDVDUI(fDisable)
  3609. {
  3610. g_bDVDUIDisabled = fDisable;
  3611. if (fDisable) {
  3612. MFBar.EnableObject("DVD", false);
  3613. MFBar.EnableObject("Splash", true);
  3614. }
  3615. else {
  3616. MFBar.EnableObject("DVD", true);
  3617. MFBar.EnableObject("Splash", false);
  3618. }
  3619. var color = g_clrSplashBackBg;
  3620. // figure out what color we will be setting
  3621. try {
  3622. if(!fDisable){
  3623. // if enabeling UI set the color back to the color key in full screen controls
  3624. if (g_DVDAspectRatio < 1.5)
  3625. color = DVD.ColorKey;
  3626. else
  3627. color = DVD.BackColor;
  3628. }/* end of if statement */
  3629. }
  3630. catch(e){
  3631. }
  3632. // Disable the buttons
  3633. for (i=0; i<=g_nIndexEnter; i++) {
  3634. DisableObject(g_strButID[i], fDisable);
  3635. SetBackColor(g_strButID[i], color);
  3636. }/* end of for loop */
  3637. DisableObject("Stop", fDisable);
  3638. SetBackColor("Stop", color);
  3639. DisableObject("TitleMenu", fDisable);
  3640. SetBackColor("TitleMenu", color);
  3641. DisableObject("TitleResume", fDisable);
  3642. SetBackColor("TitleResume", color);
  3643. SetBackColor("Eject", color);
  3644. SetBackColor("TitleIcon", color);
  3645. if (!fDisable) {
  3646. DisableObject("TitleMenu", !DVD.UOPValid(10));
  3647. DisableObject("Menu", !DVD.UOPValid(11));
  3648. DisableObject("TitleResume", !DVD.UOPValid(16));
  3649. DisableObject("Resume", !DVD.UOPValid(16));
  3650. DisableObject("Audio", !DVD.UOPValid(20) || DVD.CurrentDomain!=4);
  3651. DisableObject("Subtitles", !DVD.UOPValid(21) || DVD.CurrentDomain!=4);
  3652. DisableObject("Angles", !DVD.UOPValid(22) || DVD.CurrentDomain!=4);
  3653. }
  3654. // Disable the sliders and time
  3655. for (i=g_nNumButs; i<g_nNumButs+g_nNumSliders+g_nNumTexts; i++) {
  3656. DisableObject(g_strButID[i], fDisable);
  3657. SetBackColor(g_strButID[i], color);
  3658. }/* end of for loop */
  3659. if (fDisable != true)
  3660. DisableStep(); // disable frame stepping if not available
  3661. }
  3662. /*************************************************************/
  3663. /* Name: DisableObject
  3664. /* Description:
  3665. /*************************************************************/
  3666. function DisableObject(strObj, fDisable)
  3667. {
  3668. try {
  3669. btn = MFBar.GetObjectUnknown(strObj);
  3670. if (btn.Disable != fDisable)
  3671. btn.Disable = fDisable;
  3672. btnFull = MFBar.GetObjectUnknown(strObj+"Full");
  3673. if (btnFull.Disable != fDisable)
  3674. btnFull.Disable = fDisable;
  3675. if (strObj == "TimeSlider") {
  3676. OnTimeSliderMouseUp(btn);
  3677. OnTimeSliderMouseUp(btnFull);
  3678. }
  3679. else if (strObj == "PlaySpeed") {
  3680. OnSpeedSliderMouseUp(btn);
  3681. OnSpeedSliderMouseUp(btnFull);
  3682. }
  3683. else if (strObj == "VolSlider") {
  3684. OnSliderMouseUp(btn, g_nIndexVolume);
  3685. OnSliderMouseUp(btnFull, g_nIndexVolume);
  3686. }
  3687. }
  3688. catch (e) {
  3689. }
  3690. }
  3691. /*************************************************************/
  3692. /* Function: SetBackColor */
  3693. /* Description: Sets the back color to the same color as */
  3694. /* splash screen. */
  3695. /*************************************************************/
  3696. function SetBackColor(strObj, color){
  3697. try {
  3698. btn = MFBar.GetObjectUnknown(strObj+"Full");
  3699. btn.BackColor= color;
  3700. }
  3701. catch(e) {
  3702. }
  3703. }/* end of function SetBackColor */
  3704. /*************************************************************/
  3705. /* Name: ShowObject
  3706. /* Description:
  3707. /*************************************************************/
  3708. function ShowObject(strObj, fShow)
  3709. {
  3710. try {
  3711. MFBar.EnableObject(strObj, fShow);
  3712. btn = MFBar.GetObjectUnknown(strObj);
  3713. btn.Disable = !fShow;
  3714. MFBar.EnableObject(strObj+"Full", fShow);
  3715. btn = MFBar.GetObjectUnknown(strObj+"Full");
  3716. btn.Disable = !fShow;
  3717. }
  3718. catch(e) {
  3719. }
  3720. }
  3721. /*************************************************************/
  3722. /* Name: DisableNavUI
  3723. /* Description: Disable Nav related UI
  3724. /*************************************************************/
  3725. function DisableNavUI(fDisable, strMenuBtn, strResumeBtn)
  3726. {
  3727. g_bMenuOn = !fDisable;
  3728. fHadFocus = HasFocus("Resume")|| HasFocus("Menu")|| HasFocus("TitleResume")|| HasFocus("TitleMenu");
  3729. ShowObject(strResumeBtn, !fDisable);
  3730. ShowObject(strMenuBtn, fDisable);
  3731. DisableObject("Play", fDisable);
  3732. nDomain = DVD.CurrentDomain;
  3733. if ((nDomain == 2 || nDomain == 3) && fHadFocus && !fDisable) {
  3734. SetFocus(strResumeBtn);
  3735. }
  3736. if (fHadFocus && fDisable)
  3737. SetFocus(strMenuBtn);
  3738. // Show/Hide nav buttons
  3739. ShowObject("HLUp", !fDisable);
  3740. ShowObject("HLDown", !fDisable);
  3741. ShowObject("HLLeft", !fDisable);
  3742. ShowObject("HLRight", !fDisable);
  3743. ShowObject("Enter", !fDisable);
  3744. if (!g_bFullScreen) {
  3745. OnResize(g_ConWidth, g_ConHeight, 0);
  3746. }
  3747. else
  3748. OnResize(g_ConWidth, g_ConHeight, 2);
  3749. }
  3750. /*************************************************************/
  3751. /* Function: SetupFocus */
  3752. /* Description: Sets up the focus array. */
  3753. /*************************************************************/
  3754. function SetupFocus(){
  3755. //MFBar.MessageBox("SetupFocus", "");
  3756. try {
  3757. MFBar.ResetFocusArray();
  3758. if(!g_bExpanded){
  3759. strArray = g_strFocusID
  3760. }
  3761. else {
  3762. strArray = g_strFocusExpandedID
  3763. }/* end of if statement */
  3764. if(!g_bFullScreen){
  3765. for(i = 0; i < strArray.length; i++){
  3766. MFBar.AddFocusObject(strArray[i]);
  3767. }/* end of for loop */
  3768. }
  3769. else {
  3770. for(i = 0; i < strArray.length; i++){
  3771. MFBar.AddFocusObject(strArray[i]+"Full");
  3772. }/* end of for loop */
  3773. }
  3774. }
  3775. catch(e){
  3776. // we really do not care much
  3777. }
  3778. }/* end of function SetupFocus */
  3779. /*************************************************************/
  3780. /* Name: SetFocus
  3781. /* Description: Give focus to object with strID
  3782. /*************************************************************/
  3783. function SetFocus(strID) {
  3784. if (!g_bFullScreen) {
  3785. MFBar.SetObjectFocus(strID, true);
  3786. MFBar.ProcessMessages();
  3787. }
  3788. else {
  3789. MFBar.SetObjectFocus(strID+"Full", true);
  3790. MFBar.ProcessMessages();
  3791. }
  3792. }
  3793. /*************************************************************/
  3794. /* Name: HasFocus
  3795. /* Description: Give focus to object with strID
  3796. /*************************************************************/
  3797. function HasFocus(strID) {
  3798. if (!g_bFullScreen) {
  3799. return MFBar.HasObjectFocus(strID);
  3800. }
  3801. else {
  3802. return MFBar.HasObjectFocus(strID+"Full");
  3803. }
  3804. }
  3805. /*************************************************************/
  3806. /* Function: stepfwd_OnClick */
  3807. /*************************************************************/
  3808. function stepfwd_OnClick(){
  3809. try {
  3810. Step(1);
  3811. }
  3812. catch(e){
  3813. }
  3814. }/* function stepfwd_OnClick */
  3815. /*************************************************************/
  3816. /* Function: stepbak_OnClick */
  3817. /*************************************************************/
  3818. function stepbak_OnClick(){
  3819. try {
  3820. Step(-1);
  3821. }
  3822. catch(e){
  3823. }
  3824. }/* end of function stepbak_OnClick */
  3825. /*************************************************************/
  3826. /* Function: Step */
  3827. /* Description: Steps a specified ammount of frames. */
  3828. /*************************************************************/
  3829. function Step(val){
  3830. try {
  3831. DisableStep();
  3832. if(DVD.CanStep(0 > val)){
  3833. // Pause the graph first
  3834. if (1 != DVD.PlayState)
  3835. DVD.Pause();
  3836. DVD.Step(val);
  3837. }/* end of if statement */
  3838. }
  3839. catch(e){
  3840. if(val > 0){
  3841. DisableObject("StepFwd", true);
  3842. }/* end of if statement */
  3843. DisableObject("StepBak", true);
  3844. }
  3845. }/* end of function Step */
  3846. /*************************************************************/
  3847. /* Function: DisableStep */
  3848. /* Description: Disables all the step buttons if we cannot */
  3849. /* step. */
  3850. /*************************************************************/
  3851. function DisableStep(){
  3852. DisableObject("StepFwd", g_bStillOn && g_bMenuOn);
  3853. DisableObject("StepBak", g_bStillOn && g_bMenuOn);
  3854. try {
  3855. if(!DVD.CanStep(false)){ // see if we can step forward
  3856. DisableObject("StepFwd", true);
  3857. }/* end of function CanStep */
  3858. }
  3859. catch(e){
  3860. DisableObject("StepFwd", true);
  3861. }
  3862. try {
  3863. if(!DVD.CanStep(true)){ // see if we can step backwards
  3864. DisableObject("StepBak", true);
  3865. }/* end of function CanStep */
  3866. }
  3867. catch(e){
  3868. DisableObject("StepBak", true);
  3869. }
  3870. return;
  3871. }/* end of function DisableStep */
  3872. /*************************************************************/
  3873. /* Name: EnableActivityTimeOut
  3874. /* Description: Disable or enable activity time out
  3875. /*************************************************************/
  3876. function EnableActivityTimeOut(fEnable)
  3877. {
  3878. if (fEnable && g_bEnableTimeOut) {
  3879. if (MFBar.ActivityTimeout == 0)
  3880. MFBar.ActivityTimeout = 3000;
  3881. }
  3882. else
  3883. MFBar.ActivityTimeout = 0;
  3884. }
  3885. /*************************************************************/
  3886. /* Name: InitTextControl
  3887. /* Description:
  3888. /*************************************************************/
  3889. function InitTextControl(strObj, text)
  3890. {
  3891. try {
  3892. btn = MFBar.GetObjectUnknown(strObj);
  3893. btn.Text = text;
  3894. btn.FontFace = L_ButtonFontFace_TEXT;
  3895. btn.FontSize = L_ButtonFontSize_NUMBER;
  3896. btn.ColorActive = g_TextColorActive;
  3897. btn.ColorHover = g_TextColorHover;
  3898. btn.ColorPush = g_TextColorDown;
  3899. btn.ColorDisable = g_TextColorDisabled;
  3900. btn.ColorStatic = g_TextColorStatic;
  3901. btn = MFBar.GetObjectUnknown(strObj + "Full");
  3902. btn.Text = text;
  3903. btn.FontFace = L_ButtonFontFace_TEXT;
  3904. btn.FontSize = L_ButtonFontSize_NUMBER;
  3905. btn.ColorActive = g_TextColorActive;
  3906. btn.ColorHover = g_TextColorHover;
  3907. btn.ColorPush = g_TextColorDown;
  3908. btn.ColorDisable = g_TextColorDisabled;
  3909. btn.ColorStatic = g_TextColorStatic;
  3910. }
  3911. catch (e)
  3912. {
  3913. }
  3914. }
  3915. /*************************************************************/
  3916. /* Name: InitTitleTextControl
  3917. /* Description:
  3918. /*************************************************************/
  3919. function InitTitleTextControl(strObj, text)
  3920. {
  3921. try {
  3922. InitTextControl(strObj, text);
  3923. btn = MFBar.GetObjectUnknown(strObj);
  3924. btn.Text = text;
  3925. btn.FontSize = L_TitleFontSize_NUMBER;
  3926. btn.BackColor = g_clrFrameTitleBar;
  3927. btn.ColorStatic = 0x0f0f0f;
  3928. btn.ColorHover = 0x0f0f0f;
  3929. btn.ColorDisable = 0x0f0f0f;
  3930. MFBar.EnableObjectInput(strObj, false); // enable dragging by the text
  3931. btn = MFBar.GetObjectUnknown(strObj + "Full");
  3932. btn.Text = text;
  3933. btn.FontSize = L_TitleFontSize_NUMBER;
  3934. btn.BackColor = DVD.ColorKey;
  3935. btn.ColorStatic = 0xf0f0f0;
  3936. btn.ColorHover = 0xf0f0f0;
  3937. btn.ColorDisable = 0xf0f0f0;
  3938. MFBar.EnableObjectInput(strObj + "Full", false); // enable dragging by the text
  3939. }
  3940. catch (e)
  3941. {
  3942. }
  3943. }
  3944. /*************************************************************/
  3945. /* Name: titleIcon_OnClick
  3946. /* Description:
  3947. /*************************************************************/
  3948. function titleIcon_OnClick() {
  3949. MFBar.PopupSystemMenu();
  3950. }
  3951. /*************************************************************/
  3952. /* Name: OnUpdateOverlay
  3953. /* Description:
  3954. /*************************************************************/
  3955. function OnUpdateOverlay() {
  3956. try {
  3957. // Do not update backcolor if we are in stop domain
  3958. nDomain = DVD.CurrentDomain;
  3959. if (nDomain == 5)
  3960. return;
  3961. if (g_DVDAspectRatio!= DVD.AspectRatio)
  3962. g_DVDAspectRatio = DVD.AspectRatio;
  3963. for (i=0; i<g_nNumButs+g_nNumSliders+g_nNumTexts; i++) {
  3964. btn = MFBar.GetObjectUnknown(g_strButID[i]+"Full");
  3965. if (g_DVDAspectRatio < 1.5)
  3966. btn.BackColor = DVD.ColorKey;
  3967. else
  3968. btn.BackColor = DVD.BackColor;
  3969. }
  3970. }
  3971. catch (e) {
  3972. }
  3973. }
  3974. /*************************************************************/
  3975. /* Name: OnActivate
  3976. /* Description:
  3977. /*************************************************************/
  3978. function OnActivate(fActivated) {
  3979. if (fActivated) {
  3980. g_bEnableTimeOut = true;
  3981. EnableActivityTimeOut(true);
  3982. }
  3983. else {
  3984. ActivityStarted();
  3985. EnableActivityTimeOut(false);
  3986. g_bEnableTimeOut = false;
  3987. }
  3988. }
  3989. /*************************************************************/
  3990. /* Name: HandleError
  3991. /* Description: Handles errors
  3992. /*************************************************************/
  3993. function HandleError(error, ShallClose){
  3994. if(L_ERRORIncompatibleSystemAndDecoderRegions_TEXT == error.description){
  3995. MFBar.MessageBox(L_ERRORIncompatibleSystemAndDecoderRegions_TEXT, L_Error_TEXT, MB_HELP);
  3996. }
  3997. else if(L_ERRORCopyProtectFail_TEXT == error.description){
  3998. MFBar.MessageBox(L_ERRORCopyProtectFail_TEXT, L_Error_TEXT, MB_HELP);
  3999. }
  4000. else if(L_ERRORLowParentalLevel_TEXT == error.description){
  4001. MFBar.MessageBox(L_ERRORLowParentalLevel_TEXT, L_Error_TEXT, MB_HELP);
  4002. }
  4003. else if(L_ERRORMacrovisionFail_TEXT == error.description){
  4004. MFBar.MessageBox(L_ERRORMacrovisionFail_TEXT, L_Error_TEXT, MB_HELP);
  4005. }
  4006. else {
  4007. MFBar.MessageBox(error.description, L_Error_TEXT);
  4008. }/* end of if statement */
  4009. if (ShallClose)
  4010. {
  4011. MFBar.Close();
  4012. }
  4013. //TextBox.Text = r;
  4014. }/* end of function HandleError */
  4015. /*************************************************************/
  4016. /* Name: HandleFatalInitError
  4017. /* Description: Just tries to bail out, since we did not
  4018. /* manage to get initialized right
  4019. /*************************************************************/
  4020. function HandleFatalInitError(error, ShallClose){
  4021. //MFBar.MessageBox(error.number, "DEBUG REMOVE");
  4022. //MFBar.MessageBox(error.description, "DEBUG REMOVE");
  4023. switch(error.number){
  4024. case gcEVideoStream:
  4025. MFBar.MessageBox(L_ERRORVideoStream_TEXT, L_Error_TEXT, MB_HELP);
  4026. break;
  4027. case gcEAudioStream:
  4028. MFBar.MessageBox(L_ERRORAudioStream_TEXT, L_Error_TEXT, MB_HELP);
  4029. break;
  4030. case gcEDVDGraphBuilding:
  4031. //MFBar.MessageBox(L_ERRORDVDGraphBuilding_TEXT, L_Error_TEXT, MB_HELP);
  4032. MFBar.MessageBox(L_ERRORDVDGraphBuilding_TEXT, L_Error_TEXT);
  4033. break;
  4034. case gcENoDecoder:
  4035. MFBar.MessageBox(L_ERRORNoDecoder_TEXT, L_Error_TEXT, MB_HELP);
  4036. break;
  4037. case gcENoOverlay:
  4038. MFBar.MessageBox(L_ERRORNoOverlay_TEXT, L_Error_TEXT, MB_HELP);
  4039. break;
  4040. default:
  4041. MFBar.MessageBox(error.description, L_Error_TEXT);
  4042. }/* end of switch statement */
  4043. if (ShallClose){
  4044. MFBar.Close();
  4045. }/* end of if statement */
  4046. }/* end of function HandleFatalInitError */
  4047. /*************************************************************/
  4048. /* Name: HandleFatalInitProblem
  4049. /* Description: Just tries to bail out, since we did not
  4050. /* manage to get initialized right
  4051. /*************************************************************/
  4052. function HandleFatalInitProblem(errorString){
  4053. MFBar.MessageBox(errorString, L_Error_TEXT);
  4054. MFBar.Close();
  4055. }/* end of function HandleFatalInitProblem */