home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Minami 40
/
MINAMI40.ISO
/
Extra
/
MPSetup.exe
/
1033
/
RCDATA
/
CABINET
/
9SeriesDefault.wmz
/
Corona.js
< prev
next >
Wrap
Text File
|
2002-10-15
|
6KB
|
219 lines
// globals
var g_paneCurrent = 0;
var g_vidIsRunning = false;
var g_playlistIsVisible = false;
var g_equalizerIsVisible = false;
// constants
var PANE_VIS = 0;
var PANE_VID = 1;
var VIDEO_WIDTH = 320; // pixels
var VIDEO_HEIGHT = 240; // pixels
var PANEL_VELOCITY = 200; // milliseconds
var EQ_PANEL_TRAVEL_Y = 124; // pixels
var THEME_SAVE_VAR_EQ = "EqualizerPanel";
var THEME_SAVE_VAR_PLAYLIST = "PlaylistPanel";
var THEME_SAVE_VAR_WIDTH = "PlayerWidth";
var THEME_SAVE_VAR_HEIGHT = "PlayerHeight";
function OnLoad() {
ipl.setColumnResizeMode( 0, "Stretches" );
ipl.setColumnResizeMode( 1, "AutoSizeData" );
player.settings.autoStart = true;
/* load the preset popups */
for (i = 0; i < eq.presetCount; i++) {
popupPreset.appendItem(eq.presetTitle(i));
}
/* set pane environment */
SetPane(PANE_VIS);
g_vidIsRunning = player.openState == osMediaOpen && player.currentMedia.ImageSourceWidth > 0;
g_vidIsRunning ? StartVideo() : EndVideo();
/* set view to previous saved state */
// assign height and width registry values to temp vars
// as they will not exist the first time the skin is applied.
var tWidth = theme.loadPreference(THEME_SAVE_VAR_WIDTH),
tHeight = theme.loadPreference(THEME_SAVE_VAR_HEIGHT);
// assign the height and width values to the view
vPlayer.width = (tWidth && (tWidth > vPlayer.minWidth))
? tWidth
: vPlayer.minWidth;
vPlayer.height = (tHeight && (tHeight > vPlayer.minHeight))
? tHeight
: vPlayer.minHeight;
if (theme.loadPreference(THEME_SAVE_VAR_EQ) == "True")
ToggleEqualizer();
if (theme.loadPreference(THEME_SAVE_VAR_PLAYLIST) == "True")
TogglePlaylist();
OnOpenStateChangeTransport(player.openState);
OnPlayStateChangeTransport(player.playState);
OnStatusChangeTransport(player.status);
OnPlayStateChange();
OnOpenStateChange();
}
function OnClose() {
// save view state
theme.savePreference(THEME_SAVE_VAR_EQ, g_equalizerIsVisible);
theme.savePreference(THEME_SAVE_VAR_PLAYLIST, g_playlistIsVisible);
theme.savePreference(THEME_SAVE_VAR_WIDTH, vPlayer.width);
theme.savePreference(THEME_SAVE_VAR_HEIGHT, vPlayer.height);
}
function StartVideo() {
g_vidIsRunning = true;
SetPane(PANE_VID);
var vidWidth = player.currentMedia.imageSourceWidth;
var vidHeight = player.currentMedia.imageSourceHeight;
if (vidWidth > VIDEO_WIDTH && vidHeight > VIDEO_HEIGHT) {
vPlayer.width = vPlayer.minWidth + (vidWidth - VIDEO_WIDTH);
vPlayer.height = vPlayer.minHeight + (vidHeight - VIDEO_HEIGHT);
}
}
function EndVideo() {
g_vidIsRunning = false;
vPlayer.width = vPlayer.minWidth;
vPlayer.height = vPlayer.minHeight;
if (g_paneCurrent == PANE_VID) {
SetPane(PANE_VIS);
}
}
function SetPane(pane) {
switch (pane) {
case PANE_VIS:
vid.visible = false;
vis.visible = true;
vPlayer.width = vPlayer.minWidth;
vPlayer.height = vPlayer.minHeight;
break;
case PANE_VID:
vid.visible = true;
vis.visible = false;
break;
}
g_paneCurrent = pane;
}
function TogglePlaylist() {
if (!g_playlistIsVisible) {
svPlaylist.moveTo(0, 33, PANEL_VELOCITY);
} else {
ddpl.visible = ipl.visible = false;
svPlaylist.moveTo(250, 33, PANEL_VELOCITY);
}
bPlaylist.down = g_playlistIsVisible = !g_playlistIsVisible;
}
function ToggleEqualizer() {
if (!g_equalizerIsVisible) {
svEqualizer.moveTo(262, svEqualizer.top + EQ_PANEL_TRAVEL_Y, PANEL_VELOCITY);
} else {
svEqualizer.moveTo(262, svEqualizer.top - EQ_PANEL_TRAVEL_Y, PANEL_VELOCITY);
}
bEq.down = g_equalizerIsVisible = !g_equalizerIsVisible;
}
function ToggleSuperCompact() {
if (g_equalizerIsVisible) {
ToggleEqualizer();
g_equalizerIsVisible = true;
}
if (g_playlistIsVisible) {
TogglePlaylist();
g_playlistIsVisible = true;
}
theme.currentViewID = "viewTiny";
}
function UpdateMetadata(status) {
if(player.openState==osMediaOpen)
{
update = status ? true : !update;
metadata.value = (update ? player.status : player.currentMedia.name);
}
}
function EqResize() {
for (i = 1; i <= 10; i++) {
eval("eq" + i + ".left = " + Math.floor(GetEqSliderLeft(i)) + ";");
eval("tEq" + i + ".left = eq" + i + ".left - 6;");
}
}
function GetEqSliderLeft(eqNum) {
var eqSlideImgWidth = 18; // pixel width of the eq slider image
var eqTotalSlideArea = 180; // eqSlideWidth * 10 (total number of eq sliders)
var nEqSlideSpacing = 11; // number of gutters between sliders; nSliders + 1
return (((svEqualizerTopMiddle.width - eqTotalSlideArea) / nEqSlideSpacing) * eqNum) + (eqSlideImgWidth * (eqNum - 1));
}
function OpenMedia() {
newFile = theme.openDialog('FILE_OPEN', 'FILES_ALLMEDIA');
if (newFile) {
player.URL = newFile;
player.controls.play();
}
}
function OnOpenStateChange() {
if (player.openState == osMediaOpen) {
g_vidIsRunning = player.currentMedia.ImageSourceWidth > 0;
g_vidIsRunning ? StartVideo() : EndVideo();
}
}
function OnPlayStateChange() {
switch (player.playState) {
case psStopped:
vis.visible = false;
break;
case psPaused:
vis.visible = false;
break;
case psPlaying:
default:
vis.visible = !g_vidIsRunning;
}
}
function OnModeChange(NewMode, NewValue) {
if (NewMode == 'shuffle')
bShuffle.down = NewValue;
}