2002-02-23 15:12:55 +00:00
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "cut.h"
|
|
|
|
#include "font.h"
|
2005-12-08 22:12:57 +00:00
|
|
|
#include "app.h"
|
2001-12-18 20:01:10 +00:00
|
|
|
|
2005-12-08 22:12:57 +00:00
|
|
|
#include "../config.h"
|
|
|
|
#include "../mp_msg.h"
|
|
|
|
#include "../help_mp.h"
|
|
|
|
#include "mplayer/widgets.h"
|
2007-07-05 22:01:07 +00:00
|
|
|
#include "libavutil/avstring.h"
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
//#define MSGL_DBG2 MSGL_STATUS
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
listItems * skinAppMPlayer = &appMPlayer;
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
// ---
|
|
|
|
|
|
|
|
static int linenumber;
|
|
|
|
|
|
|
|
static unsigned char path[512],fn[512];
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
static listItems * defList = NULL;
|
|
|
|
static unsigned char window_name[32] = "";
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
static wItem * currSection = NULL;
|
|
|
|
static int * currSubItem = NULL;
|
|
|
|
static wItem * currSubItems = NULL;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
void ERRORMESSAGE( const char * format, ... )
|
|
|
|
{
|
|
|
|
char p[512];
|
2002-11-28 19:01:50 +00:00
|
|
|
char tmp[512];
|
2001-08-25 21:04:29 +00:00
|
|
|
va_list ap;
|
|
|
|
va_start( ap,format );
|
|
|
|
vsnprintf( p,512,format,ap );
|
|
|
|
va_end( ap );
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_ERRORMESSAGE,linenumber,p );
|
2002-11-28 19:01:50 +00:00
|
|
|
snprintf( tmp,512,MSGTR_SKIN_ERRORMESSAGE,linenumber,p );
|
|
|
|
gtkMessageBox( GTK_MB_FATAL,tmp );
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
|
2001-09-12 15:08:53 +00:00
|
|
|
#define CHECKDEFLIST( str ) \
|
|
|
|
{ \
|
|
|
|
if ( defList == NULL ) \
|
|
|
|
{ \
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING1,linenumber,str ); \
|
2001-09-12 15:08:53 +00:00
|
|
|
return 1; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define CHECKWINLIST( str ) \
|
|
|
|
{ \
|
2003-01-17 22:39:43 +00:00
|
|
|
if ( !window_name[0] ) \
|
2001-09-12 15:08:53 +00:00
|
|
|
{ \
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING2,linenumber,str ); \
|
2001-09-12 15:08:53 +00:00
|
|
|
return 1; \
|
|
|
|
} \
|
|
|
|
}
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
#define CHECK( name ) \
|
|
|
|
{ \
|
|
|
|
if ( !strcmp( window_name,name ) ) \
|
|
|
|
{ \
|
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING3,linenumber,name ); \
|
|
|
|
return 1; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2003-06-03 17:36:25 +00:00
|
|
|
static char * strlower( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
int i;
|
2002-02-23 15:12:55 +00:00
|
|
|
for( i=0;i<(int)strlen( in );i++ ) in[i]=( in[i] >= 'A' ? ( in[i] <= 'Z' ? in[i]+='A' : in[i] ) : in[i] );
|
2001-08-25 21:04:29 +00:00
|
|
|
return in;
|
|
|
|
}
|
|
|
|
|
|
|
|
int skinBPRead( char * fname, txSample * bf )
|
|
|
|
{
|
|
|
|
int i=bpRead( fname,bf );
|
|
|
|
switch ( i )
|
|
|
|
{
|
2001-09-12 15:08:53 +00:00
|
|
|
case -1: ERRORMESSAGE( MSGTR_SKIN_BITMAP_16bit,fname ); break;
|
|
|
|
case -2: ERRORMESSAGE( MSGTR_SKIN_BITMAP_FileNotFound,fname ); break;
|
|
|
|
case -3: ERRORMESSAGE( MSGTR_SKIN_BITMAP_BMPReadError,fname ); break;
|
|
|
|
case -4: ERRORMESSAGE( MSGTR_SKIN_BITMAP_TGAReadError,fname ); break;
|
|
|
|
case -5: ERRORMESSAGE( MSGTR_SKIN_BITMAP_PNGReadError,fname ); break;
|
|
|
|
case -6: ERRORMESSAGE( MSGTR_SKIN_BITMAP_RLENotSupported,fname ); break;
|
|
|
|
case -7: ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownFileType,fname ); break;
|
2006-04-28 23:06:42 +00:00
|
|
|
case -8: ERRORMESSAGE( MSGTR_SKIN_BITMAP_ConversionError,fname ); break;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2002-07-03 08:55:26 +00:00
|
|
|
int cmd_section( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
strlower( in );
|
|
|
|
defList=NULL;
|
|
|
|
if ( !strcmp( in,"movieplayer" ) ) defList=skinAppMPlayer;
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] sectionname: %s\n",in );
|
2001-08-25 21:04:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-03 08:55:26 +00:00
|
|
|
int cmd_end( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
2003-01-17 22:39:43 +00:00
|
|
|
if ( strlen( window_name ) ) { window_name[0]=0; currSection=NULL; currSubItem=NULL; currSubItems=NULL; }
|
2001-08-25 21:04:29 +00:00
|
|
|
else defList=NULL;
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] end section\n" );
|
2001-08-25 21:04:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-03 08:55:26 +00:00
|
|
|
int cmd_window( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
CHECKDEFLIST( "window" );
|
|
|
|
|
2007-07-05 22:01:07 +00:00
|
|
|
av_strlcpy( window_name,strlower( in ),sizeof( window_name ) );
|
2003-01-17 22:39:43 +00:00
|
|
|
if ( !strncmp( in,"main",4 ) ) { currSection=&skinAppMPlayer->main; currSubItem=&skinAppMPlayer->NumberOfItems; currSubItems=skinAppMPlayer->Items; }
|
|
|
|
else if ( !strncmp( in,"sub",3 ) ) currSection=&skinAppMPlayer->sub;
|
|
|
|
else if ( !strncmp( in,"playbar",7 ) ) { currSection=&skinAppMPlayer->bar; currSubItem=&skinAppMPlayer->NumberOfBarItems; currSubItems=skinAppMPlayer->barItems; }
|
|
|
|
else if ( !strncmp( in,"menu",4 ) ) { currSection=&skinAppMPlayer->menuBase; currSubItem=&skinAppMPlayer->NumberOfMenuItems; currSubItems=skinAppMPlayer->MenuItems; }
|
2004-12-15 01:22:24 +00:00
|
|
|
else ERRORMESSAGE( MSGTR_UNKNOWNWINDOWTYPE );
|
2003-01-17 22:39:43 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window: %s\n",window_name );
|
2001-08-25 21:04:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-03 08:55:26 +00:00
|
|
|
int cmd_base( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
unsigned char fname[512];
|
|
|
|
unsigned char tmp[512];
|
|
|
|
int x,y;
|
2002-02-23 15:12:55 +00:00
|
|
|
int sx=0,sy=0;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
CHECKDEFLIST( "base" );
|
|
|
|
CHECKWINLIST( "base" );
|
|
|
|
|
|
|
|
cutItem( in,fname,',',0 );
|
2001-09-04 15:21:00 +00:00
|
|
|
x=cutItemToInt( in,',',1 );
|
|
|
|
y=cutItemToInt( in,',',2 );
|
2001-11-23 01:41:45 +00:00
|
|
|
sx=cutItemToInt( in,',',3 );
|
|
|
|
sy=cutItemToInt( in,',',4 );
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] base: %s x: %d y: %d ( %dx%d )\n",fname,x,y,sx,sy );
|
2003-01-17 22:39:43 +00:00
|
|
|
if ( !strcmp( window_name,"main" ) )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
defList->main.x=x;
|
|
|
|
defList->main.y=y;
|
|
|
|
defList->main.type=itBase;
|
2007-07-05 22:01:07 +00:00
|
|
|
av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
|
2001-08-25 21:04:29 +00:00
|
|
|
if ( skinBPRead( tmp,&defList->main.Bitmap ) ) return 1;
|
|
|
|
defList->main.width=defList->main.Bitmap.Width;
|
|
|
|
defList->main.height=defList->main.Bitmap.Height;
|
2003-01-17 22:39:43 +00:00
|
|
|
#ifdef HAVE_XSHAPE
|
2001-11-05 17:00:42 +00:00
|
|
|
Convert32to1( &defList->main.Bitmap,&defList->main.Mask,0x00ff00ff );
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->main.Mask.Width,defList->main.Mask.Height );
|
2003-01-17 22:39:43 +00:00
|
|
|
#else
|
2001-08-25 21:04:29 +00:00
|
|
|
defList->main.Mask.Image=NULL;
|
2003-01-17 22:39:43 +00:00
|
|
|
#endif
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->main.width,defList->main.height );
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
2003-01-17 22:39:43 +00:00
|
|
|
if ( !strcmp( window_name,"sub" ) )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
defList->sub.type=itBase;
|
2007-07-05 22:01:07 +00:00
|
|
|
av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
|
2001-08-25 21:04:29 +00:00
|
|
|
if ( skinBPRead( tmp,&defList->sub.Bitmap ) ) return 1;
|
2001-10-01 09:30:46 +00:00
|
|
|
defList->sub.x=x;
|
|
|
|
defList->sub.y=y;
|
2001-08-25 21:04:29 +00:00
|
|
|
defList->sub.width=defList->sub.Bitmap.Width;
|
|
|
|
defList->sub.height=defList->sub.Bitmap.Height;
|
2001-11-23 01:41:45 +00:00
|
|
|
if ( sx && sy )
|
|
|
|
{
|
|
|
|
defList->sub.width=sx;
|
|
|
|
defList->sub.height=sy;
|
|
|
|
}
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] %d,%d %dx%d\n",defList->sub.x,defList->sub.y,defList->sub.width,defList->sub.height );
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
2003-01-17 22:39:43 +00:00
|
|
|
if ( !strcmp( window_name,"menu" ) )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
2003-01-17 22:39:43 +00:00
|
|
|
defList->menuIsPresent=1;
|
2001-08-25 21:04:29 +00:00
|
|
|
defList->menuBase.type=itBase;
|
2007-07-05 22:01:07 +00:00
|
|
|
av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
|
2001-08-25 21:04:29 +00:00
|
|
|
if ( skinBPRead( tmp,&defList->menuBase.Bitmap ) ) return 1;
|
|
|
|
defList->menuBase.width=defList->menuBase.Bitmap.Width;
|
|
|
|
defList->menuBase.height=defList->menuBase.Bitmap.Height;
|
2003-01-17 22:39:43 +00:00
|
|
|
#ifdef HAVE_XSHAPE
|
2002-05-28 14:12:33 +00:00
|
|
|
Convert32to1( &defList->menuBase.Bitmap,&defList->menuBase.Mask,0x00ff00ff );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->menuBase.Mask.Width,defList->menuBase.Mask.Height );
|
2003-01-17 22:39:43 +00:00
|
|
|
#else
|
2002-05-28 14:12:33 +00:00
|
|
|
defList->menuBase.Mask.Image=NULL;
|
2003-01-17 22:39:43 +00:00
|
|
|
#endif
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuBase.width,defList->menuBase.height );
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
2003-01-17 22:39:43 +00:00
|
|
|
if ( !strcmp( window_name,"playbar" ) )
|
|
|
|
{
|
|
|
|
defList->barIsPresent=1;
|
|
|
|
defList->bar.x=x;
|
|
|
|
defList->bar.y=y;
|
|
|
|
defList->bar.type=itBase;
|
2007-07-05 22:01:07 +00:00
|
|
|
av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
|
2003-01-17 22:39:43 +00:00
|
|
|
if ( skinBPRead( tmp,&defList->bar.Bitmap ) ) return 1;
|
|
|
|
defList->bar.width=defList->bar.Bitmap.Width;
|
|
|
|
defList->bar.height=defList->bar.Bitmap.Height;
|
|
|
|
#ifdef HAVE_XSHAPE
|
|
|
|
Convert32to1( &defList->bar.Bitmap,&defList->bar.Mask,0x00ff00ff );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->bar.Mask.Width,defList->bar.Mask.Height );
|
|
|
|
#else
|
|
|
|
defList->bar.Mask.Image=NULL;
|
|
|
|
#endif
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->bar.width,defList->bar.height );
|
|
|
|
}
|
2001-08-25 21:04:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-03 08:55:26 +00:00
|
|
|
int cmd_background( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
CHECKDEFLIST( "background" );
|
|
|
|
CHECKWINLIST( "background" );
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
CHECK( "menu" );
|
|
|
|
CHECK( "main" );
|
|
|
|
|
|
|
|
currSection->R=cutItemToInt( in,',',0 );
|
|
|
|
currSection->G=cutItemToInt( in,',',1 );
|
|
|
|
currSection->B=cutItemToInt( in,',',2 );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] background color is #%x%x%x.\n",currSection->R,currSection->G,currSection->B );
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-03 08:55:26 +00:00
|
|
|
int cmd_button( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
unsigned char fname[512];
|
|
|
|
unsigned char tmp[512];
|
|
|
|
int x,y,sx,sy;
|
2002-02-23 15:12:55 +00:00
|
|
|
char msg[32];
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
CHECKDEFLIST( "button" );
|
|
|
|
CHECKWINLIST( "button" );
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
CHECK( "sub" );
|
|
|
|
CHECK( "menu" );
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
cutItem( in,fname,',',0 );
|
2001-09-04 15:21:00 +00:00
|
|
|
x=cutItemToInt( in,',',1 );
|
|
|
|
y=cutItemToInt( in,',',2 );
|
|
|
|
sx=cutItemToInt( in,',',3 );
|
|
|
|
sy=cutItemToInt( in,',',4 );
|
2001-08-25 21:04:29 +00:00
|
|
|
cutItem( in,msg,',',5 );
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
(*currSubItem)++;
|
|
|
|
currSubItems[ *currSubItem ].type=itButton;
|
|
|
|
currSubItems[ *currSubItem ].x=x;
|
|
|
|
currSubItems[ *currSubItem ].y=y;
|
|
|
|
currSubItems[ *currSubItem ].width=sx;
|
|
|
|
currSubItems[ *currSubItem ].height=sy;
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] button: fname: %s\n",fname );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
if ( ( currSubItems[ *currSubItem ].msg=appFindMessage( msg ) ) == -1 )
|
2002-12-11 01:21:12 +00:00
|
|
|
{ ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 0; }
|
2003-01-17 22:39:43 +00:00
|
|
|
currSubItems[ *currSubItem ].pressed=btnReleased;
|
|
|
|
if ( currSubItems[ *currSubItem ].msg == evPauseSwitchToPlay ) currSubItems[ *currSubItem ].pressed=btnDisabled;
|
|
|
|
currSubItems[ *currSubItem ].tmp=1;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",currSubItems[ *currSubItem ].msg );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
currSubItems[ *currSubItem ].Bitmap.Image=NULL;
|
2001-08-25 21:04:29 +00:00
|
|
|
if ( strcmp( fname,"NULL" ) )
|
|
|
|
{
|
2007-07-05 22:01:07 +00:00
|
|
|
av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
|
2003-01-17 22:39:43 +00:00
|
|
|
if ( skinBPRead( tmp,&currSubItems[ *currSubItem ].Bitmap ) ) return 1;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
2003-01-17 22:39:43 +00:00
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-03 08:55:26 +00:00
|
|
|
int cmd_selected( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
unsigned char fname[512];
|
|
|
|
unsigned char tmp[512];
|
|
|
|
|
|
|
|
CHECKDEFLIST( "selected" );
|
|
|
|
CHECKWINLIST( "selected" );
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
CHECK( "main" );
|
|
|
|
CHECK( "sub" );
|
|
|
|
CHECK( "playbar" );
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
cutItem( in,fname,',',0 );
|
|
|
|
defList->menuSelected.type=itBase;
|
2007-07-05 22:01:07 +00:00
|
|
|
av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] selected: %s\n",fname );
|
2001-08-25 21:04:29 +00:00
|
|
|
if ( skinBPRead( tmp,&defList->menuSelected.Bitmap ) ) return 1;
|
|
|
|
defList->menuSelected.width=defList->menuSelected.Bitmap.Width;
|
|
|
|
defList->menuSelected.height=defList->menuSelected.Bitmap.Height;
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuSelected.width,defList->menuSelected.height );
|
2001-08-25 21:04:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-03 08:55:26 +00:00
|
|
|
int cmd_menu( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{ // menu = number,x,y,sx,sy,msg
|
|
|
|
int x,y,sx,sy,msg;
|
|
|
|
unsigned char tmp[64];
|
|
|
|
|
|
|
|
CHECKDEFLIST( "menu" );
|
|
|
|
CHECKWINLIST( "menu" );
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
CHECK( "main" );
|
|
|
|
CHECK( "sub" );
|
|
|
|
CHECK( "playbar" );
|
|
|
|
|
2001-09-04 15:21:00 +00:00
|
|
|
x=cutItemToInt( in,',',0 );
|
|
|
|
y=cutItemToInt( in,',',1 );
|
|
|
|
sx=cutItemToInt( in,',',2 );
|
|
|
|
sy=cutItemToInt( in,',',3 );
|
2001-08-25 21:04:29 +00:00
|
|
|
cutItem( in,tmp,',',4 ); msg=appFindMessage( tmp );
|
|
|
|
|
|
|
|
defList->NumberOfMenuItems++;
|
|
|
|
defList->MenuItems[ defList->NumberOfMenuItems ].x=x;
|
|
|
|
defList->MenuItems[ defList->NumberOfMenuItems ].y=y;
|
|
|
|
defList->MenuItems[ defList->NumberOfMenuItems ].width=sx;
|
|
|
|
defList->MenuItems[ defList->NumberOfMenuItems ].height=sy;
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] menuitem: %d\n",defList->NumberOfMenuItems );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
if ( ( defList->MenuItems[ defList->NumberOfMenuItems ].msg=msg ) == -1 )
|
2001-09-12 15:08:53 +00:00
|
|
|
ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,tmp );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
defList->MenuItems[ defList->NumberOfMenuItems ].Bitmap.Image=NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-03 08:55:26 +00:00
|
|
|
int cmd_hpotmeter( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{ // hpotmeter=buttonbitmaps,sx,sy,phasebitmaps,phases,default value,x,y,sx,sy,msg
|
|
|
|
int x,y,psx,psy,ph,sx,sy,msg,d;
|
|
|
|
unsigned char tmp[512];
|
|
|
|
unsigned char pfname[512];
|
|
|
|
unsigned char phfname[512];
|
|
|
|
wItem * item;
|
|
|
|
|
|
|
|
CHECKDEFLIST( "hpotmeter" );
|
|
|
|
CHECKWINLIST( "hpotmeter" );
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
CHECK( "sub" );
|
|
|
|
CHECK( "menu" );
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
cutItem( in,pfname,',',0 );
|
2001-09-04 15:21:00 +00:00
|
|
|
psx=cutItemToInt( in,',',1 );
|
|
|
|
psy=cutItemToInt( in,',',2 );
|
2001-08-25 21:04:29 +00:00
|
|
|
cutItem( in,phfname,',',3 );
|
2001-09-04 15:21:00 +00:00
|
|
|
ph=cutItemToInt( in,',',4 );
|
|
|
|
d=cutItemToInt( in,',',5 );
|
|
|
|
x=cutItemToInt( in,',',6 );
|
|
|
|
y=cutItemToInt( in,',',7 );
|
|
|
|
sx=cutItemToInt( in,',',8 );
|
|
|
|
sy=cutItemToInt( in,',',9 );
|
2001-08-25 21:04:29 +00:00
|
|
|
cutItem( in,tmp,',',10 ); msg=appFindMessage( tmp );
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] h/v potmeter: pointer filename: '%s'\n",pfname );
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pointer size is %dx%d\n",psx,psy );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phasebitmaps filename: '%s'\n",phfname );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
(*currSubItem)++;
|
|
|
|
item=&currSubItems[ *currSubItem ];
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
item->type=itHPotmeter;
|
|
|
|
item->x=x; item->y=y; item->width=sx; item->height=sy;
|
|
|
|
item->phases=ph;
|
|
|
|
item->psx=psx; item->psy=psy;
|
|
|
|
item->msg=msg;
|
|
|
|
item->value=(float)d;
|
|
|
|
item->pressed=btnReleased;
|
|
|
|
|
|
|
|
item->Bitmap.Image=NULL;
|
|
|
|
if ( strcmp( phfname,"NULL" ) )
|
|
|
|
{
|
2007-07-05 22:01:07 +00:00
|
|
|
av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, phfname, sizeof( tmp ));
|
2001-08-25 21:04:29 +00:00
|
|
|
if ( skinBPRead( tmp,&item->Bitmap ) ) return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
item->Mask.Image=NULL;
|
|
|
|
if ( strcmp( pfname,"NULL" ) )
|
|
|
|
{
|
2007-07-05 22:01:07 +00:00
|
|
|
av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, pfname, sizeof( tmp ));
|
2001-08-25 21:04:29 +00:00
|
|
|
if ( skinBPRead( tmp,&item->Mask ) ) return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
int cmd_vpotmeter( char * in )
|
|
|
|
{
|
|
|
|
int r = cmd_hpotmeter( in );
|
|
|
|
wItem * item;
|
|
|
|
|
|
|
|
item=&currSubItems[ *currSubItem ];
|
|
|
|
item->type=itVPotmeter;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2002-07-03 08:55:26 +00:00
|
|
|
int cmd_potmeter( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{ // potmeter=phasebitmaps,phases,default value,x,y,sx,sy,msg
|
|
|
|
int x,y,ph,sx,sy,msg,d;
|
|
|
|
unsigned char tmp[512];
|
|
|
|
unsigned char phfname[512];
|
|
|
|
wItem * item;
|
|
|
|
|
|
|
|
CHECKDEFLIST( "potmeter" );
|
|
|
|
CHECKWINLIST( "potmeter" );
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
CHECK( "sub" );
|
|
|
|
CHECK( "menu" );
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
cutItem( in,phfname,',',0 );
|
2001-09-04 15:21:00 +00:00
|
|
|
ph=cutItemToInt( in,',',1 );
|
|
|
|
d=cutItemToInt( in,',',2 );
|
|
|
|
x=cutItemToInt( in,',',3 );
|
|
|
|
y=cutItemToInt( in,',',4 );
|
|
|
|
sx=cutItemToInt( in,',',5 );
|
|
|
|
sy=cutItemToInt( in,',',6 );
|
2001-08-25 21:04:29 +00:00
|
|
|
cutItem( in,tmp,',',7 ); msg=appFindMessage( tmp );
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] potmeter: phases filename: '%s'\n",phfname );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phases: %d\n",ph );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
(*currSubItem)++;
|
|
|
|
item=&currSubItems[ *currSubItem ];
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
item->type=itPotmeter;
|
|
|
|
item->x=x; item->y=y;
|
|
|
|
item->width=sx; item->height=sy;
|
|
|
|
item->phases=ph;
|
|
|
|
item->msg=msg;
|
|
|
|
item->value=(float)d;
|
|
|
|
|
|
|
|
item->Bitmap.Image=NULL;
|
|
|
|
if ( strcmp( phfname,"NULL" ) )
|
|
|
|
{
|
2007-07-05 22:01:07 +00:00
|
|
|
av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, phfname, sizeof( tmp ));
|
2001-08-25 21:04:29 +00:00
|
|
|
if ( skinBPRead( tmp,&item->Bitmap ) ) return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-03 08:55:26 +00:00
|
|
|
int cmd_font( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{ // font=fontname,fontid
|
|
|
|
char name[512];
|
|
|
|
char id[512];
|
|
|
|
wItem * item;
|
|
|
|
|
|
|
|
CHECKDEFLIST( "font" );
|
|
|
|
CHECKWINLIST( "font" );
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
CHECK( "sub" );
|
|
|
|
CHECK( "menu" );
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
cutItem( in,name,',',0 );
|
|
|
|
cutItem( in,id,',',1 );
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] font\n" );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] name: %s\n",name );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
(*currSubItem)++;
|
|
|
|
item=&currSubItems[ *currSubItem ];
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
item->type=itFont;
|
2002-05-28 11:55:17 +00:00
|
|
|
item->fontid=fntRead( path,name );
|
2001-08-25 21:04:29 +00:00
|
|
|
switch ( item->fontid )
|
|
|
|
{
|
2001-09-12 15:08:53 +00:00
|
|
|
case -1: ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1;
|
|
|
|
case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_TooManyFontsDeclared ); return 1;
|
2002-05-28 11:55:17 +00:00
|
|
|
case -3: ERRORMESSAGE( MSGTR_SKIN_FONT_FontFileNotFound ); return 1;
|
|
|
|
case -4: ERRORMESSAGE( MSGTR_SKIN_FONT_FontImageNotFound ); return 1;
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-03 08:55:26 +00:00
|
|
|
int cmd_slabel( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
char tmp[512];
|
|
|
|
char sid[63];
|
|
|
|
int x,y,id;
|
|
|
|
wItem * item;
|
|
|
|
|
|
|
|
CHECKDEFLIST( "slabel" );
|
|
|
|
CHECKWINLIST( "slabel" );
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
CHECK( "sub" );
|
|
|
|
CHECK( "menu" );
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] slabel\n" );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2001-09-04 15:21:00 +00:00
|
|
|
x=cutItemToInt( in,',',0 );
|
|
|
|
y=cutItemToInt( in,',',1 );
|
2001-08-25 21:04:29 +00:00
|
|
|
cutItem( in,sid,',',2 ); id=fntFindID( sid );
|
2001-09-12 15:08:53 +00:00
|
|
|
if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; }
|
2001-08-25 21:04:29 +00:00
|
|
|
cutItem( in,tmp,',',3 ); cutItem( tmp,tmp,'"',1 );
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d\n",x,y );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
(*currSubItem)++;
|
|
|
|
item=&currSubItems[ *currSubItem ];
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
item->type=itSLabel;
|
|
|
|
item->fontid=id;
|
|
|
|
item->x=x; item->y=y;
|
|
|
|
item->width=-1; item->height=-1;
|
2001-09-12 15:08:53 +00:00
|
|
|
if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; }
|
2001-08-25 21:04:29 +00:00
|
|
|
strcpy( item->label,tmp );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-03 08:55:26 +00:00
|
|
|
int cmd_dlabel( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{ // dlabel=x,y,sx,align,fontid,string ...
|
|
|
|
char tmp[512];
|
|
|
|
char sid[63];
|
|
|
|
int x,y,sx,id,a;
|
|
|
|
wItem * item;
|
|
|
|
|
|
|
|
CHECKDEFLIST( "dlabel" );
|
|
|
|
CHECKWINLIST( "dlabel" );
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
CHECK( "sub" );
|
|
|
|
CHECK( "menu" );
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] dlabel\n" );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2001-09-04 15:21:00 +00:00
|
|
|
x=cutItemToInt( in,',',0 );
|
|
|
|
y=cutItemToInt( in,',',1 );
|
|
|
|
sx=cutItemToInt( in,',',2 );
|
2002-02-23 15:12:55 +00:00
|
|
|
a=cutItemToInt( in,',',3 );
|
2001-08-25 21:04:29 +00:00
|
|
|
cutItem( in,sid,',',4 ); id=fntFindID( sid );
|
2001-09-12 15:08:53 +00:00
|
|
|
if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; }
|
2001-08-25 21:04:29 +00:00
|
|
|
cutItem( in,tmp,',',5 ); cutItem( tmp,tmp,'"',1 );
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d width: %d align: %d\n",x,y,sx,a );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id );
|
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
(*currSubItem)++;
|
|
|
|
item=&currSubItems[ *currSubItem ];
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
item->type=itDLabel;
|
|
|
|
item->fontid=id; item->align=a;
|
|
|
|
item->x=x; item->y=y;
|
|
|
|
item->width=sx; item->height=-1;
|
2001-09-12 15:08:53 +00:00
|
|
|
if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; }
|
2001-08-25 21:04:29 +00:00
|
|
|
strcpy( item->label,tmp );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-07-03 08:55:26 +00:00
|
|
|
int cmd_decoration( char * in )
|
2001-09-07 21:04:14 +00:00
|
|
|
{
|
|
|
|
char tmp[512];
|
|
|
|
|
|
|
|
CHECKDEFLIST( "decoration" );
|
|
|
|
CHECKWINLIST( "decoration" );
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
CHECK( "sub" );
|
|
|
|
CHECK( "menu" );
|
|
|
|
CHECK( "playbar" );
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",in );
|
2003-01-17 22:39:43 +00:00
|
|
|
strlower( in );
|
2001-09-07 21:04:14 +00:00
|
|
|
cutItem( in,tmp,',',0 );
|
2001-09-12 15:08:53 +00:00
|
|
|
if ( strcmp( tmp,"enable" )&&strcmp( tmp,"disable" ) ) { ERRORMESSAGE( MSGTR_SKIN_UnknownParameter,tmp ); return 1; }
|
2001-09-07 21:04:14 +00:00
|
|
|
if ( strcmp( tmp,"enable" ) ) defList->mainDecoration=0;
|
|
|
|
else defList->mainDecoration=1;
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",(defList->mainDecoration?"enabled":"disabled") );
|
2001-09-07 21:04:14 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2001-08-25 21:04:29 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2006-07-16 01:40:24 +00:00
|
|
|
const char * name;
|
2001-08-25 21:04:29 +00:00
|
|
|
int (*func)( char * in );
|
|
|
|
} _item;
|
|
|
|
|
|
|
|
_item skinItem[] =
|
|
|
|
{
|
2002-07-03 08:55:26 +00:00
|
|
|
{ "section", cmd_section },
|
|
|
|
{ "end", cmd_end },
|
|
|
|
{ "window", cmd_window },
|
|
|
|
{ "base", cmd_base },
|
|
|
|
{ "button", cmd_button },
|
|
|
|
{ "selected", cmd_selected },
|
|
|
|
{ "background", cmd_background },
|
2003-01-17 22:39:43 +00:00
|
|
|
{ "vpotmeter", cmd_vpotmeter },
|
2002-07-03 08:55:26 +00:00
|
|
|
{ "hpotmeter", cmd_hpotmeter },
|
|
|
|
{ "potmeter", cmd_potmeter },
|
|
|
|
{ "font", cmd_font },
|
|
|
|
{ "slabel", cmd_slabel },
|
|
|
|
{ "dlabel", cmd_dlabel },
|
|
|
|
{ "decoration", cmd_decoration },
|
|
|
|
{ "menu", cmd_menu }
|
2001-08-25 21:04:29 +00:00
|
|
|
};
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
#define ITEMS (int)( sizeof( skinItem )/sizeof( _item ) )
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
char * trimleft( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
int c = 0;
|
|
|
|
char * out;
|
|
|
|
if ( strlen( in ) == 0 ) return NULL;
|
|
|
|
while ( in[c] == ' ' ) c++;
|
|
|
|
if ( c != 0 )
|
|
|
|
{
|
|
|
|
out=malloc( strlen( in ) - c + 1 );
|
|
|
|
memcpy( out,&in[c],strlen( in ) - c + 1 );
|
|
|
|
}
|
|
|
|
else out=in;
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
char * strswap( char * in,char what,char whereof )
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
if ( strlen( in ) == 0 ) return NULL;
|
2002-02-23 15:12:55 +00:00
|
|
|
for ( i=0;i<(int)strlen( in );i++ )
|
2001-08-25 21:04:29 +00:00
|
|
|
if ( in[i] == what ) in[i]=whereof;
|
|
|
|
return in;
|
|
|
|
}
|
|
|
|
|
2003-01-17 22:39:43 +00:00
|
|
|
char * trim( char * in )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
int c = 0,i = 0,id = 0;
|
|
|
|
if ( strlen( in ) == 0 ) return NULL;
|
2002-02-23 15:12:55 +00:00
|
|
|
while ( c != (int)strlen( in ) )
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
|
|
|
if ( in[c] == '"' ) id=!id;
|
|
|
|
if ( ( in[c] == ' ' )&&( !id ) )
|
|
|
|
{
|
2002-02-23 15:12:55 +00:00
|
|
|
for ( i=0;i<(int)strlen( in ) - c; i++ ) in[c+i]=in[c+i+1];
|
2001-08-25 21:04:29 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
c++;
|
|
|
|
}
|
|
|
|
return in;
|
|
|
|
}
|
|
|
|
|
|
|
|
FILE * skinFile;
|
|
|
|
|
|
|
|
void setname( char * item1, char * item2 )
|
2004-06-25 16:49:53 +00:00
|
|
|
{
|
2007-07-05 22:01:07 +00:00
|
|
|
av_strlcpy(fn, item1, sizeof( fn ));
|
|
|
|
av_strlcat(fn, "/", sizeof( fn )); av_strlcat(fn, item2, sizeof( fn ));
|
|
|
|
av_strlcpy(path, fn, sizeof( path )); av_strlcat(path, "/", sizeof( path ));
|
|
|
|
av_strlcat(fn, "/skin", sizeof( fn ));
|
2004-06-25 16:49:53 +00:00
|
|
|
}
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
int skinRead( char * dname )
|
|
|
|
{
|
|
|
|
unsigned char tmp[255];
|
|
|
|
unsigned char * ptmp;
|
|
|
|
unsigned char command[32];
|
|
|
|
unsigned char param[256];
|
|
|
|
int c,i;
|
|
|
|
|
2002-06-25 23:27:14 +00:00
|
|
|
setname( skinDirInHome,dname );
|
2001-08-25 21:04:29 +00:00
|
|
|
if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
|
|
|
|
{
|
2002-06-25 23:27:14 +00:00
|
|
|
setname( skinMPlayerDir,dname );
|
2001-08-25 21:04:29 +00:00
|
|
|
if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
|
|
|
|
{
|
2006-03-27 11:39:27 +00:00
|
|
|
setname( skinDirInHome_obsolete,dname );
|
|
|
|
if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
|
|
|
|
{
|
|
|
|
setname( skinMPlayerDir_obsolete,dname );
|
|
|
|
if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
|
|
|
|
{
|
2006-08-07 17:46:20 +00:00
|
|
|
setname( skinMPlayerDir,dname );
|
2006-03-27 11:39:27 +00:00
|
|
|
mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_SkinFileNotFound,fn );
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2001-08-25 21:04:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-23 15:12:55 +00:00
|
|
|
mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] file: %s\n",fn );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
2002-04-18 21:24:42 +00:00
|
|
|
appInitStruct( skinAppMPlayer );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
linenumber=0;
|
2005-05-28 21:12:11 +00:00
|
|
|
while (fgets(tmp, 255, skinFile))
|
2001-08-25 21:04:29 +00:00
|
|
|
{
|
2005-05-23 20:12:47 +00:00
|
|
|
linenumber++;
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
|
|
|
|
c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
|
2002-02-23 15:12:55 +00:00
|
|
|
for ( c=0;c<(int)strlen( tmp );c++ )
|
2001-08-25 21:04:29 +00:00
|
|
|
if ( tmp[c] == ';' )
|
|
|
|
{
|
|
|
|
tmp[c]=0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ( strlen( tmp ) == 0 ) continue;
|
2003-01-17 22:39:43 +00:00
|
|
|
ptmp=trimleft( tmp );
|
2001-08-25 21:04:29 +00:00
|
|
|
if ( strlen( ptmp ) == 0 ) continue;
|
|
|
|
ptmp=strswap( ptmp,'\t',' ' );
|
2003-01-17 22:39:43 +00:00
|
|
|
ptmp=trim( ptmp );
|
2001-08-25 21:04:29 +00:00
|
|
|
|
|
|
|
cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 );
|
|
|
|
strlower( command );
|
|
|
|
for( i=0;i<ITEMS;i++ )
|
|
|
|
if ( !strcmp( command,skinItem[i].name ) )
|
|
|
|
if ( skinItem[i].func( param ) ) return -2;
|
|
|
|
}
|
2005-05-28 21:12:11 +00:00
|
|
|
if (linenumber == 0) {
|
|
|
|
mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SkinFileNotReadable, fn);
|
|
|
|
return -1;
|
|
|
|
}
|
2001-08-25 21:04:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|