2001-08-25 21:04:29 +00:00
|
|
|
|
2002-11-02 16:09:05 +00:00
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "../config.h"
|
2001-12-18 20:01:10 +00:00
|
|
|
#include "../mp_msg.h"
|
|
|
|
#include "../help_mp.h"
|
|
|
|
|
|
|
|
#include "app.h"
|
2001-08-25 21:04:29 +00:00
|
|
|
#include "wm/wskeys.h"
|
|
|
|
#include "skin/skin.h"
|
|
|
|
#include "mplayer/mplayer.h"
|
2002-03-07 15:06:02 +00:00
|
|
|
#include "interface.h"
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2002-11-02 16:09:05 +00:00
|
|
|
evName evNames[] =
|
|
|
|
{
|
|
|
|
{ evNone, "evNone" },
|
|
|
|
{ evPlay, "evPlay" },
|
|
|
|
{ evStop, "evStop" },
|
|
|
|
{ evPause, "evPause" },
|
|
|
|
{ evPrev, "evPrev" },
|
|
|
|
{ evNext, "evNext" },
|
|
|
|
{ evLoad, "evLoad" },
|
|
|
|
{ evEqualizer, "evEqualizer" },
|
|
|
|
{ evEqualizer, "evEqualeaser" },
|
|
|
|
{ evPlayList, "evPlaylist" },
|
|
|
|
{ evExit, "evExit" },
|
|
|
|
{ evIconify, "evIconify" },
|
|
|
|
{ evIncBalance, "evIncBalance" },
|
|
|
|
{ evDecBalance, "evDecBalance" },
|
|
|
|
{ evFullScreen, "evFullScreen" },
|
|
|
|
{ evFName, "evFName" },
|
|
|
|
{ evMovieTime, "evMovieTime" },
|
|
|
|
{ evAbout, "evAbout" },
|
|
|
|
{ evLoadPlay, "evLoadPlay" },
|
|
|
|
{ evPreferences, "evPreferences" },
|
|
|
|
{ evSkinBrowser, "evSkinBrowser" },
|
|
|
|
{ evBackward10sec, "evBackward10sec" },
|
|
|
|
{ evForward10sec, "evForward10sec" },
|
|
|
|
{ evBackward1min, "evBackward1min" },
|
|
|
|
{ evForward1min, "evForward1min" },
|
|
|
|
{ evBackward10min, "evBackward10min" },
|
|
|
|
{ evForward10min, "evForward10min" },
|
|
|
|
{ evIncVolume, "evIncVolume" },
|
|
|
|
{ evDecVolume, "evDecVolume" },
|
|
|
|
{ evMute, "evMute" },
|
|
|
|
{ evIncAudioBufDelay, "evIncAudioBufDelay" },
|
|
|
|
{ evDecAudioBufDelay, "evDecAudioBufDelay" },
|
|
|
|
{ evPlaySwitchToPause, "evPlaySwitchToPause" },
|
|
|
|
{ evPauseSwitchToPlay, "evPauseSwitchToPlay" },
|
2005-01-25 12:44:38 +00:00
|
|
|
{ evNormalSize, "evHalfSize" },
|
2002-11-02 16:09:05 +00:00
|
|
|
{ evNormalSize, "evNormalSize" },
|
|
|
|
{ evDoubleSize, "evDoubleSize" },
|
|
|
|
{ evSetMoviePosition, "evSetMoviePosition" },
|
|
|
|
{ evSetVolume, "evSetVolume" },
|
|
|
|
{ evSetBalance, "evSetBalance" },
|
|
|
|
{ evHelp, "evHelp" },
|
|
|
|
{ evLoadSubtitle, "evLoadSubtitle" },
|
|
|
|
{ evPlayDVD, "evPlayDVD" },
|
|
|
|
{ evPlayVCD, "evPlayVCD" },
|
|
|
|
{ evSetURL, "evSetURL" },
|
|
|
|
{ evLoadAudioFile, "evLoadAudioFile" },
|
|
|
|
{ evDropSubtitle, "evDropSubtitle" },
|
2003-01-19 22:46:39 +00:00
|
|
|
{ evSetAspect, "evSetAspect" }
|
2002-11-02 16:09:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int evBoxs = sizeof( evNames ) / sizeof( evName );
|
|
|
|
|
|
|
|
// ---
|
|
|
|
|
2002-08-26 22:20:58 +00:00
|
|
|
extern char *get_path(char *);
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
listItems appMPlayer;
|
|
|
|
|
|
|
|
char * skinDirInHome=NULL;
|
|
|
|
char * skinMPlayerDir=NULL;
|
2001-09-07 21:04:14 +00:00
|
|
|
char * skinName = NULL;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
void appClearItem( wItem * item )
|
|
|
|
{
|
|
|
|
item->type=0;
|
|
|
|
// ---
|
|
|
|
item->x=0; item->y=0; item->width=0; item->height=0;
|
|
|
|
// ---
|
|
|
|
item->px=0; item->py=0; item->psx=0; item->psy=0;
|
|
|
|
// ---
|
|
|
|
item->msg=0; item->msg2=0;
|
2002-03-07 15:06:02 +00:00
|
|
|
item->pressed=btnReleased;
|
2001-08-25 21:04:29 +00:00
|
|
|
item->tmp=0;
|
|
|
|
item->key=0; item->key2=0;
|
|
|
|
item->Bitmap.Width=0; item->Bitmap.Height=0; item->Bitmap.BPP=0; item->Bitmap.ImageSize=0;
|
2002-03-07 15:06:02 +00:00
|
|
|
if ( item->Bitmap.Image ) free( item->Bitmap.Image );
|
|
|
|
item->Bitmap.Image=NULL;
|
2001-08-25 21:04:29 +00:00
|
|
|
// ---
|
|
|
|
item->fontid=0;
|
|
|
|
if ( item->label ) free( item->label ); item->label=NULL;
|
|
|
|
item->event=0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void appCopy( listItems * dest,listItems * source )
|
|
|
|
{
|
|
|
|
dest->NumberOfItems=source->NumberOfItems;
|
|
|
|
memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) );
|
|
|
|
|
|
|
|
dest->NumberOfMenuItems=source->NumberOfMenuItems;
|
|
|
|
memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) );
|
|
|
|
|
|
|
|
memcpy( &dest->main,&source->main,sizeof( wItem ) );
|
|
|
|
memcpy( &dest->sub,&source->sub,sizeof( wItem ) );
|
|
|
|
memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) );
|
|
|
|
memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void appInitStruct( listItems * item )
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for ( i=0;i<item->NumberOfItems;i++ )
|
|
|
|
appClearItem( &item->Items[i] );
|
|
|
|
for ( i=0;i<item->NumberOfMenuItems;i++ )
|
|
|
|
appClearItem( &item->MenuItems[i] );
|
2003-03-20 12:42:16 +00:00
|
|
|
for ( i=0;i<item->NumberOfBarItems;i++ )
|
|
|
|
appClearItem( &item->barItems[i] );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
item->NumberOfItems=-1;
|
2003-03-20 12:42:16 +00:00
|
|
|
memset( item->Items,0,256 * sizeof( wItem ) );
|
2001-08-25 21:04:29 +00:00
|
|
|
item->NumberOfMenuItems=-1;
|
2003-03-20 12:42:16 +00:00
|
|
|
memset( item->MenuItems,0,64 * sizeof( wItem ) );
|
|
|
|
item->NumberOfBarItems=-1;
|
|
|
|
memset( item->barItems,0,256 * sizeof( wItem ) );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
appClearItem( &item->main );
|
2001-09-07 21:04:14 +00:00
|
|
|
item->mainDecoration=0;
|
2001-08-25 21:04:29 +00:00
|
|
|
appClearItem( &item->sub );
|
2003-03-20 12:42:16 +00:00
|
|
|
item->sub.width=0; item->sub.height=0;
|
2001-09-01 17:53:07 +00:00
|
|
|
item->sub.x=-1; item->sub.y=-1;
|
2001-08-25 21:04:29 +00:00
|
|
|
appClearItem( &item->menuBase );
|
|
|
|
appClearItem( &item->menuSelected );
|
2003-01-17 22:39:43 +00:00
|
|
|
item->sub.R=item->sub.G=item->sub.B=0;
|
|
|
|
item->bar.R=item->bar.G=item->bar.B=0;
|
|
|
|
item->main.R=item->main.G=item->main.B=0;
|
2003-01-13 23:38:49 +00:00
|
|
|
item->barIsPresent=0;
|
|
|
|
item->menuIsPresent=0;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int appFindKey( unsigned char * name )
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for ( i=0;i<wsKeyNumber;i++ )
|
|
|
|
if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int appFindMessage( unsigned char * str )
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for ( i=0;i<evBoxs;i++ )
|
|
|
|
if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg;
|
|
|
|
return -1;
|
|
|
|
}
|
2002-11-25 17:33:30 +00:00
|
|
|
|
|
|
|
void btnModify( int event,float state )
|
|
|
|
{
|
|
|
|
int j;
|
2003-01-17 22:39:43 +00:00
|
|
|
for ( j=0;j < appMPlayer.NumberOfItems + 1;j++ )
|
2002-11-25 17:33:30 +00:00
|
|
|
if ( appMPlayer.Items[j].msg == event )
|
|
|
|
{
|
|
|
|
switch ( appMPlayer.Items[j].type )
|
|
|
|
{
|
|
|
|
case itButton:
|
|
|
|
appMPlayer.Items[j].pressed=(int)state;
|
|
|
|
appMPlayer.Items[j].tmp=(int)state;
|
|
|
|
break;
|
|
|
|
case itPotmeter:
|
2003-01-17 22:39:43 +00:00
|
|
|
case itVPotmeter:
|
2002-11-25 17:33:30 +00:00
|
|
|
case itHPotmeter:
|
|
|
|
if ( state < 0.0f ) state=0.0f;
|
|
|
|
if ( state > 100.f ) state=100.0f;
|
|
|
|
appMPlayer.Items[j].value=state;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-01-17 22:39:43 +00:00
|
|
|
|
|
|
|
for ( j=0;j < appMPlayer.NumberOfBarItems + 1;j++ )
|
|
|
|
if ( appMPlayer.barItems[j].msg == event )
|
|
|
|
{
|
|
|
|
switch ( appMPlayer.barItems[j].type )
|
|
|
|
{
|
|
|
|
case itButton:
|
|
|
|
appMPlayer.barItems[j].pressed=(int)state;
|
|
|
|
appMPlayer.barItems[j].tmp=(int)state;
|
|
|
|
break;
|
|
|
|
case itPotmeter:
|
|
|
|
case itVPotmeter:
|
|
|
|
case itHPotmeter:
|
|
|
|
if ( state < 0.0f ) state=0.0f;
|
|
|
|
if ( state > 100.f ) state=100.0f;
|
|
|
|
appMPlayer.barItems[j].value=state;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2002-11-25 17:33:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
float btnGetValue( int event )
|
|
|
|
{
|
|
|
|
int j;
|
|
|
|
for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
|
|
|
|
if ( appMPlayer.Items[j].msg == event ) return appMPlayer.Items[j].value;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void btnSet( int event,int set )
|
|
|
|
{
|
|
|
|
int j;
|
|
|
|
for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
|
2003-02-01 16:42:02 +00:00
|
|
|
if ( appMPlayer.Items[j].msg == event )
|
|
|
|
{ appMPlayer.Items[j].pressed=set; appMPlayer.barItems[j].tmp=0; }
|
|
|
|
for ( j=0;j<appMPlayer.NumberOfBarItems + 1;j++ )
|
|
|
|
if ( appMPlayer.barItems[j].msg == event )
|
|
|
|
{ appMPlayer.barItems[j].pressed=set; appMPlayer.barItems[j].tmp=0; }
|
2002-11-25 17:33:30 +00:00
|
|
|
}
|