[MPlayer-cvslog] r32960 - in trunk/gui/skin: skin.c skin.h

ib subversion at mplayerhq.hu
Thu Feb 24 16:00:29 CET 2011


Author: ib
Date: Thu Feb 24 16:00:29 2011
New Revision: 32960

Log:
Cosmetic: Format to MPlayer coding style.

Modified:
   trunk/gui/skin/skin.c
   trunk/gui/skin/skin.h

Modified: trunk/gui/skin/skin.c
==============================================================================
--- trunk/gui/skin/skin.c	Thu Feb 24 14:39:48 2011	(r32959)
+++ trunk/gui/skin/skin.c	Thu Feb 24 16:00:29 2011	(r32960)
@@ -17,705 +17,903 @@
  */
 
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 
+#include "skin.h"
 #include "cut.h"
 #include "font.h"
-#include "skin.h"
-#include "gui/app.h"
+#include "gui/mplayer/widgets.h"
 
 #include "config.h"
-#include "mp_msg.h"
 #include "help_mp.h"
-#include "gui/mplayer/widgets.h"
 #include "libavutil/avstring.h"
+#include "mp_msg.h"
 
-//#define MSGL_DBG2 MSGL_STATUS
+typedef struct {
+    const char *name;
+    int (*func)(char *in);
+} _item;
 
-listItems     * skinAppMPlayer = &appMPlayer;
+listItems *skinAppMPlayer = &appMPlayer;
+static listItems *defList = NULL;
 
-// ---
+static int linenumber;
+static unsigned char path[512];
+static unsigned char window_name[32] = "";
 
-static int             linenumber;
+static wItem *currSection  = NULL;
+static int *currSubItem    = NULL;
+static wItem *currSubItems = NULL;
 
-static unsigned char   path[512];
+static void ERRORMESSAGE(const char *format, ...)
+{
+    char p[512];
+    char tmp[512];
+    va_list ap;
 
-static listItems     * defList = NULL;
-static unsigned char   window_name[32] = "";
+    va_start(ap, format);
+    vsnprintf(p, sizeof(p), format, ap);
+    va_end(ap);
 
-static wItem         * currSection = NULL;
-static int           * currSubItem = NULL;
-static wItem         * currSubItems = NULL;
+    mp_msg(MSGT_GPLAYER, MSGL_STATUS, MSGTR_SKIN_ERRORMESSAGE, linenumber, p);
+    snprintf(tmp, sizeof(tmp), MSGTR_SKIN_ERRORMESSAGE, linenumber, p);
+    gtkMessageBox(GTK_MB_FATAL, tmp);
+}
 
-#include <stdarg.h>
+#define CHECKDEFLIST(str) \
+    { \
+        if (defList == NULL) \
+        { \
+            mp_msg(MSGT_GPLAYER, MSGL_STATUS, MSGTR_SKIN_WARNING1, linenumber, str); \
+            return 1; \
+        } \
+    }
 
-static void ERRORMESSAGE( const char * format, ... )
+#define CHECKWINLIST(str) \
+    { \
+        if (!window_name[0]) \
+        { \
+            mp_msg(MSGT_GPLAYER, MSGL_STATUS, MSGTR_SKIN_WARNING2, linenumber, str); \
+            return 1; \
+        } \
+    }
+
+#define CHECK(name) \
+    { \
+        if (!strcmp(window_name, name)) \
+        { \
+            mp_msg(MSGT_GPLAYER, MSGL_STATUS, MSGTR_SKIN_WARNING3, linenumber, name); \
+            return 1; \
+        } \
+    }
+
+static char *strlower(char *in)
 {
- char      p[512];
- char      tmp[512];
- va_list   ap;
- va_start( ap,format );
- vsnprintf( p,sizeof(p),format,ap );
- va_end( ap );
- mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_ERRORMESSAGE,linenumber,p );
- snprintf( tmp,sizeof(tmp),MSGTR_SKIN_ERRORMESSAGE,linenumber,p );
- gtkMessageBox( GTK_MB_FATAL,tmp );
-}
+    char *p = in;
 
-#define CHECKDEFLIST( str ) \
-{ \
- if ( defList == NULL ) \
-  { \
-   mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING1,linenumber,str ); \
-   return 1; \
-  } \
-}
+    while (*p) {
+        if (*p >= 'A' && *p <= 'Z')
+            *p += ' ';
 
-#define CHECKWINLIST( str ) \
-{ \
- if ( !window_name[0] ) \
-  { \
-   mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING2,linenumber,str ); \
-   return 1; \
-  } \
-}
+        p++;
+    }
 
-#define CHECK( name ) \
-{ \
- if ( !strcmp( window_name,name ) ) \
-  { \
-   mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING3,linenumber,name ); \
-   return 1; \
-  } \
+    return in;
 }
 
-static char * strlower( char * in )
+int skinBPRead(char *fname, txSample *bf)
 {
- char *p = in;
- while (*p)
-  {
-   if (*p >= 'A' && *p <= 'Z') *p += ' ';
-   p++;
-  }
- return in;
-}
+    int i = bpRead(fname, bf);
 
-int skinBPRead( char * fname, txSample * bf )
-{
- int i=bpRead( fname,bf );
- switch ( i )
-  {
-   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;
-   case -8: ERRORMESSAGE( MSGTR_SKIN_BITMAP_ConversionError,fname ); break;
-  }
- return i;
+    switch (i) {
+    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;
+
+    case -8:
+        ERRORMESSAGE(MSGTR_SKIN_BITMAP_ConversionError, fname);
+        break;
+    }
+
+    return i;
 }
 
-static int cmd_section( char * in )
+// section=movieplayer
+static int cmd_section(char *in)
 {
- strlower( in );
- defList=NULL;
- if ( !strcmp( in,"movieplayer" ) ) defList=skinAppMPlayer;
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] sectionname: %s\n",in );
- return 0;
+    strlower(in);
+    defList = NULL;
+
+    if (!strcmp(in, "movieplayer"))
+        defList = skinAppMPlayer;
+
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] sectionname: %s\n", in);
+
+    return 0;
 }
 
-static int cmd_end( char * in )
+// end
+static int cmd_end(char *in)
 {
- if ( strlen( window_name ) ) { window_name[0]=0; currSection=NULL; currSubItem=NULL; currSubItems=NULL; }
-  else defList=NULL;
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] end section\n" );
- return 0;
+    (void)in;
+
+    if (strlen(window_name)) {
+        window_name[0] = 0;
+        currSection    = NULL;
+        currSubItem    = NULL;
+        currSubItems   = NULL;
+    } else
+        defList = NULL;
+
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] end section\n");
+
+    return 0;
 }
 
-static int cmd_window( char * in )
+// window=main|sub|playbar|menu
+static int cmd_window(char *in)
 {
- CHECKDEFLIST( "window" );
+    CHECKDEFLIST("window");
 
- av_strlcpy( window_name,strlower( in ),sizeof( window_name ) );
- 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; }
-     else ERRORMESSAGE( MSGTR_UNKNOWNWINDOWTYPE );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window: %s\n",window_name );
- return 0;
+    av_strlcpy(window_name, strlower(in), sizeof(window_name));
+
+    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;
+    } else
+        ERRORMESSAGE(MSGTR_UNKNOWNWINDOWTYPE);
+
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] window: %s\n", window_name);
+
+    return 0;
 }
 
-static int cmd_base( char * in )
+// base=image,x,y[,width,height]
+static int cmd_base(char *in)
 {
- unsigned char fname[512];
- unsigned char tmp[512];
- int           x,y;
- int           sx=0,sy=0;
+    unsigned char fname[512];
+    unsigned char tmp[512];
+    int x, y;
+    int sx = 0, sy = 0;
 
- CHECKDEFLIST( "base" );
- CHECKWINLIST( "base" );
+    CHECKDEFLIST("base");
+    CHECKWINLIST("base");
+
+    cutItem(in, fname, ',', 0);
+    x  = cutItemToInt(in, ',', 1);
+    y  = cutItemToInt(in, ',', 2);
+    sx = cutItemToInt(in, ',', 3);
+    sy = cutItemToInt(in, ',', 4);
+
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] base: %s x: %d y: %d ( %dx%d )\n", fname, x, y, sx, sy);
+
+    if (!strcmp(window_name, "main")) {
+        defList->main.x    = x;
+        defList->main.y    = y;
+        defList->main.type = itBase;
+
+        av_strlcpy(tmp, path, sizeof(tmp));
+        av_strlcat(tmp, fname, sizeof(tmp));
+
+        if (skinBPRead(tmp, &defList->main.Bitmap) != 0)
+            return 1;
+
+        defList->main.width  = defList->main.Bitmap.Width;
+        defList->main.height = defList->main.Bitmap.Height;
 
- cutItem( in,fname,',',0 );
- x=cutItemToInt( in,',',1 );
- y=cutItemToInt( in,',',2 );
- sx=cutItemToInt( in,',',3 );
- sy=cutItemToInt( in,',',4 );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] base: %s x: %d y: %d ( %dx%d )\n",fname,x,y,sx,sy );
- if ( !strcmp( window_name,"main" ) )
-  {
-   defList->main.x=x;
-   defList->main.y=y;
-   defList->main.type=itBase;
-   av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
-   if ( skinBPRead( tmp,&defList->main.Bitmap ) != 0 ) return 1;
-   defList->main.width=defList->main.Bitmap.Width;
-   defList->main.height=defList->main.Bitmap.Height;
 #ifdef CONFIG_XSHAPE
-    Convert32to1( &defList->main.Bitmap,&defList->main.Mask,0x00ff00ff );
-    mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin]  mask: %dx%d\n",defList->main.Mask.Width,defList->main.Mask.Height );
+        Convert32to1(&defList->main.Bitmap, &defList->main.Mask, 0x00ff00ff);
+        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  mask: %dx%d\n", defList->main.Mask.Width, defList->main.Mask.Height);
 #else
-    defList->main.Mask.Image=NULL;
+        defList->main.Mask.Image = NULL;
 #endif
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin]  width: %d height: %d\n",defList->main.width,defList->main.height );
-  }
- if ( !strcmp( window_name,"sub" ) )
-  {
-   defList->sub.type=itBase;
-   av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
-   if ( skinBPRead( tmp,&defList->sub.Bitmap ) != 0 ) return 1;
-   defList->sub.x=x;
-   defList->sub.y=y;
-   defList->sub.width=defList->sub.Bitmap.Width;
-   defList->sub.height=defList->sub.Bitmap.Height;
-   if ( sx && sy )
-    {
-     defList->sub.width=sx;
-     defList->sub.height=sy;
+
+        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  width: %d height: %d\n", defList->main.width, defList->main.height);
     }
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin]  %d,%d %dx%d\n",defList->sub.x,defList->sub.y,defList->sub.width,defList->sub.height );
-  }
- if ( !strcmp( window_name,"menu" ) )
-  {
-   defList->menuIsPresent=1;
-   defList->menuBase.type=itBase;
-   av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
-   if ( skinBPRead( tmp,&defList->menuBase.Bitmap ) != 0 ) return 1;
-   defList->menuBase.width=defList->menuBase.Bitmap.Width;
-   defList->menuBase.height=defList->menuBase.Bitmap.Height;
+
+    if (!strcmp(window_name, "sub")) {
+        defList->sub.type = itBase;
+
+        av_strlcpy(tmp, path, sizeof(tmp));
+        av_strlcat(tmp, fname, sizeof(tmp));
+
+        if (skinBPRead(tmp, &defList->sub.Bitmap) != 0)
+            return 1;
+
+        defList->sub.x      = x;
+        defList->sub.y      = y;
+        defList->sub.width  = defList->sub.Bitmap.Width;
+        defList->sub.height = defList->sub.Bitmap.Height;
+
+        if (sx && sy) {
+            defList->sub.width  = sx;
+            defList->sub.height = sy;
+        }
+
+        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  %d,%d %dx%d\n", defList->sub.x, defList->sub.y, defList->sub.width, defList->sub.height);
+    }
+
+    if (!strcmp(window_name, "menu")) {
+        defList->menuIsPresent = 1;
+        defList->menuBase.type = itBase;
+
+        av_strlcpy(tmp, path, sizeof(tmp));
+        av_strlcat(tmp, fname, sizeof(tmp));
+
+        if (skinBPRead(tmp, &defList->menuBase.Bitmap) != 0)
+            return 1;
+
+        defList->menuBase.width  = defList->menuBase.Bitmap.Width;
+        defList->menuBase.height = defList->menuBase.Bitmap.Height;
+
 #ifdef CONFIG_XSHAPE
-    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 );
+        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);
 #else
-    defList->menuBase.Mask.Image=NULL;
+        defList->menuBase.Mask.Image = NULL;
 #endif
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin]  width: %d height: %d\n",defList->menuBase.width,defList->menuBase.height );
-  }
- if ( !strcmp( window_name,"playbar" ) )
-  {
-   defList->barIsPresent=1;
-   defList->bar.x=x;
-   defList->bar.y=y;
-   defList->bar.type=itBase;
-   av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
-   if ( skinBPRead( tmp,&defList->bar.Bitmap ) != 0 ) return 1;
-   defList->bar.width=defList->bar.Bitmap.Width;
-   defList->bar.height=defList->bar.Bitmap.Height;
+
+        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  width: %d height: %d\n", defList->menuBase.width, defList->menuBase.height);
+    }
+
+    if (!strcmp(window_name, "playbar")) {
+        defList->barIsPresent = 1;
+        defList->bar.x    = x;
+        defList->bar.y    = y;
+        defList->bar.type = itBase;
+
+        av_strlcpy(tmp, path, sizeof(tmp));
+        av_strlcat(tmp, fname, sizeof(tmp));
+
+        if (skinBPRead(tmp, &defList->bar.Bitmap) != 0)
+            return 1;
+
+        defList->bar.width  = defList->bar.Bitmap.Width;
+        defList->bar.height = defList->bar.Bitmap.Height;
+
 #ifdef CONFIG_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 );
+        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;
+        defList->bar.Mask.Image = NULL;
 #endif
-   mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin]  width: %d height: %d\n",defList->bar.width,defList->bar.height );
-  }
- return 0;
+
+        mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  width: %d height: %d\n", defList->bar.width, defList->bar.height);
+    }
+
+    return 0;
 }
 
-static int cmd_background( char * in )
+// background=R,G,B
+static int cmd_background(char *in)
 {
- CHECKDEFLIST( "background" );
- CHECKWINLIST( "background" );
+    CHECKDEFLIST("background");
+    CHECKWINLIST("background");
 
- CHECK( "menu" );
- CHECK( "main" );
+    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 );
+    currSection->R = cutItemToInt(in, ',', 0);
+    currSection->G = cutItemToInt(in, ',', 1);
+    currSection->B = cutItemToInt(in, ',', 2);
 
- return 0;
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin]  background color is #%x%x%x.\n", currSection->R, currSection->G, currSection->B);
+
+    return 0;
 }
 
-static int cmd_button( char * in )
+// button=image,x,y,width,height,message
+static int cmd_button(char *in)
 {
- unsigned char   fname[512];
- unsigned char   tmp[512];
- int             x,y,sx,sy;
- char            msg[32];
+    unsigned char fname[512];
+    unsigned char tmp[512];
+    int x, y, sx, sy;
+    char msg[32];
 
- CHECKDEFLIST( "button" );
- CHECKWINLIST( "button" );
+    CHECKDEFLIST("button");
+    CHECKWINLIST("button");
 
- CHECK( "sub" );
- CHECK( "menu" );
+    CHECK("sub");
+    CHECK("menu");
 
- cutItem( in,fname,',',0 );
- x=cutItemToInt( in,',',1 );
- y=cutItemToInt( in,',',2 );
- sx=cutItemToInt( in,',',3 );
- sy=cutItemToInt( in,',',4 );
- cutItem( in,msg,',',5 );
+    cutItem(in, fname, ',', 0);
+    x  = cutItemToInt(in, ',', 1);
+    y  = cutItemToInt(in, ',', 2);
+    sx = cutItemToInt(in, ',', 3);
+    sy = cutItemToInt(in, ',', 4);
+    cutItem(in, msg, ',', 5);
 
- (*currSubItem)++;
- currSubItems[ *currSubItem ].type=itButton;
- currSubItems[ *currSubItem ].x=x;
- currSubItems[ *currSubItem ].y=y;
- currSubItems[ *currSubItem ].width=sx;
- currSubItems[ *currSubItem ].height=sy;
- 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 );
+    (*currSubItem)++;
+    currSubItems[*currSubItem].type   = itButton;
+    currSubItems[*currSubItem].x      = x;
+    currSubItems[*currSubItem].y      = y;
+    currSubItems[*currSubItem].width  = sx;
+    currSubItems[*currSubItem].height = sy;
 
- if ( ( currSubItems[ *currSubItem ].msg=appFindMessage( msg ) ) == -1 )
-   { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 0; }
- currSubItems[ *currSubItem ].pressed=btnReleased;
- if ( currSubItems[ *currSubItem ].msg == evPauseSwitchToPlay ) currSubItems[ *currSubItem ].pressed=btnDisabled;
- currSubItems[ *currSubItem ].tmp=1;
+    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);
 
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin]  message: %d\n",currSubItems[ *currSubItem ].msg );
+    if ((currSubItems[*currSubItem].msg = appFindMessage(msg)) == -1) {
+        ERRORMESSAGE(MSGTR_SKIN_BITMAP_UnknownMessage, msg);
+        return 0;
+    }
 
- currSubItems[ *currSubItem ].Bitmap.Image=NULL;
- if ( strcmp( fname,"NULL" ) != 0 )
-  {
-   av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
-   if ( skinBPRead( tmp,&currSubItems[ *currSubItem ].Bitmap ) != 0 ) return 1;
-  }
+    currSubItems[*currSubItem].pressed = btnReleased;
 
- return 0;
+    if (currSubItems[*currSubItem].msg == evPauseSwitchToPlay)
+        currSubItems[*currSubItem].pressed = btnDisabled;
+
+    currSubItems[*currSubItem].tmp = 1;
+
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  message: %d\n", currSubItems[*currSubItem].msg);
+
+    currSubItems[*currSubItem].Bitmap.Image = NULL;
+
+    if (strcmp(fname, "NULL") != 0) {
+        av_strlcpy(tmp, path, sizeof(tmp));
+        av_strlcat(tmp, fname, sizeof(tmp));
+
+        if (skinBPRead(tmp, &currSubItems[*currSubItem].Bitmap) != 0)
+            return 1;
+    }
+
+    return 0;
 }
 
-static int cmd_selected( char * in )
+// selected=image
+static int cmd_selected(char *in)
 {
- unsigned char   fname[512];
- unsigned char   tmp[512];
+    unsigned char fname[512];
+    unsigned char tmp[512];
 
- CHECKDEFLIST( "selected" );
- CHECKWINLIST( "selected" );
+    CHECKDEFLIST("selected");
+    CHECKWINLIST("selected");
 
- CHECK( "main" );
- CHECK( "sub" );
- CHECK( "playbar" );
+    CHECK("main");
+    CHECK("sub");
+    CHECK("playbar");
 
- cutItem( in,fname,',',0 );
- defList->menuSelected.type=itBase;
- av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] selected: %s\n",fname );
- if ( skinBPRead( tmp,&defList->menuSelected.Bitmap ) != 0 ) return 1;
- defList->menuSelected.width=defList->menuSelected.Bitmap.Width;
- defList->menuSelected.height=defList->menuSelected.Bitmap.Height;
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin]  width: %d height: %d\n",defList->menuSelected.width,defList->menuSelected.height );
- return 0;
+    cutItem(in, fname, ',', 0);
+
+    defList->menuSelected.type = itBase;
+
+    av_strlcpy(tmp, path, sizeof(tmp));
+    av_strlcat(tmp, fname, sizeof(tmp));
+
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] selected: %s\n", fname);
+
+    if (skinBPRead(tmp, &defList->menuSelected.Bitmap) != 0)
+        return 1;
+
+    defList->menuSelected.width  = defList->menuSelected.Bitmap.Width;
+    defList->menuSelected.height = defList->menuSelected.Bitmap.Height;
+
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  width: %d height: %d\n", defList->menuSelected.width, defList->menuSelected.height);
+
+    return 0;
 }
 
-static int cmd_menu( char * in )
-{ // menu = number,x,y,sx,sy,msg
- int             x,y,sx,sy,msg;
- unsigned char   tmp[64];
+// menu=x,y,width,height,message
+static int cmd_menu(char *in)
+{
+    int x, y, sx, sy, msg;
+    unsigned char tmp[64];
 
- CHECKDEFLIST( "menu" );
- CHECKWINLIST( "menu" );
+    CHECKDEFLIST("menu");
+    CHECKWINLIST("menu");
 
- CHECK( "main" );
- CHECK( "sub" );
- CHECK( "playbar" );
+    CHECK("main");
+    CHECK("sub");
+    CHECK("playbar");
 
- x=cutItemToInt( in,',',0 );
- y=cutItemToInt( in,',',1 );
- sx=cutItemToInt( in,',',2 );
- sy=cutItemToInt( in,',',3 );
- cutItem( in,tmp,',',4 ); msg=appFindMessage( tmp );
+    x  = cutItemToInt(in, ',', 0);
+    y  = cutItemToInt(in, ',', 1);
+    sx = cutItemToInt(in, ',', 2);
+    sy = cutItemToInt(in, ',', 3);
+    cutItem(in, tmp, ',', 4);
 
- 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;
+    msg = appFindMessage(tmp);
 
- 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 );
+    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;
 
- if ( ( defList->MenuItems[ defList->NumberOfMenuItems ].msg=msg ) == -1 )
-  ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,tmp );
+    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);
 
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin]  message: %d\n",defList->Items[ defList->NumberOfItems ].msg );
+    if ((defList->MenuItems[defList->NumberOfMenuItems].msg = msg) == -1)
+        ERRORMESSAGE(MSGTR_SKIN_BITMAP_UnknownMessage, tmp);
 
- defList->MenuItems[ defList->NumberOfMenuItems ].Bitmap.Image=NULL;
- return 0;
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  message: %d\n", defList->Items[defList->NumberOfItems].msg);
+
+    defList->MenuItems[defList->NumberOfMenuItems].Bitmap.Image = NULL;
+    return 0;
 }
 
-static int cmd_hpotmeter( char * in )
-{ // 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;
+// hpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
+static int cmd_hpotmeter(char *in)
+{
+    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" );
+    CHECKDEFLIST("hpotmeter");
+    CHECKWINLIST("hpotmeter");
 
- CHECK( "sub" );
- CHECK( "menu" );
+    CHECK("sub");
+    CHECK("menu");
 
- cutItem( in,pfname,',',0 );
- psx=cutItemToInt( in,',',1 );
- psy=cutItemToInt( in,',',2 );
- cutItem( in,phfname,',',3 );
- ph=cutItemToInt( in,',',4 );
- d=cutItemToInt( in,',',5 );
- x=cutItemToInt( in,',',6 );
- y=cutItemToInt( in,',',7 );
- sx=cutItemToInt( in,',',8 );
- sy=cutItemToInt( in,',',9 );
- cutItem( in,tmp,',',10 ); msg=appFindMessage( tmp );
+    cutItem(in, pfname, ',', 0);
+    psx = cutItemToInt(in, ',', 1);
+    psy = cutItemToInt(in, ',', 2);
+    cutItem(in, phfname, ',', 3);
+    ph = cutItemToInt(in, ',', 4);
+    d  = cutItemToInt(in, ',', 5);
+    x  = cutItemToInt(in, ',', 6);
+    y  = cutItemToInt(in, ',', 7);
+    sx = cutItemToInt(in, ',', 8);
+    sy = cutItemToInt(in, ',', 9);
+    cutItem(in, tmp, ',', 10);
 
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] h/v potmeter: pointer filename: '%s'\n",pfname );
- 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 );
+    msg = appFindMessage(tmp);
 
- (*currSubItem)++;
- item=&currSubItems[ *currSubItem ];
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] h/v potmeter: pointer filename: '%s'\n", pfname);
+    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);
 
- 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;
+    (*currSubItem)++;
+    item               = &currSubItems[*currSubItem];
+    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;
 
- item->Bitmap.Image=NULL;
- if ( strcmp( phfname,"NULL" ) != 0 )
-  {
-   av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, phfname, sizeof( tmp ));
-   if ( skinBPRead( tmp,&item->Bitmap ) != 0 ) return 1;
-  }
+    if (strcmp(phfname, "NULL") != 0) {
+        av_strlcpy(tmp, path, sizeof(tmp));
+        av_strlcat(tmp, phfname, sizeof(tmp));
 
- item->Mask.Image=NULL;
- if ( strcmp( pfname,"NULL" ) != 0 )
-  {
-   av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, pfname, sizeof( tmp ));
-   if ( skinBPRead( tmp,&item->Mask ) != 0 ) return 1;
-  }
- return 0;
+        if (skinBPRead(tmp, &item->Bitmap) != 0)
+            return 1;
+    }
+
+    item->Mask.Image = NULL;
+
+    if (strcmp(pfname, "NULL") != 0) {
+        av_strlcpy(tmp, path, sizeof(tmp));
+        av_strlcat(tmp, pfname, sizeof(tmp));
+
+        if (skinBPRead(tmp, &item->Mask) != 0)
+            return 1;
+    }
+
+    return 0;
 }
 
-static int cmd_vpotmeter( char * in )
+// vpotmeter=button,bwidth,bheight,phases,numphases,default,x,y,width,height,message
+static int cmd_vpotmeter(char *in)
 {
- int     r = cmd_hpotmeter( in );
- wItem * item;
+    int r = cmd_hpotmeter(in);
+    wItem *item;
 
- item=&currSubItems[ *currSubItem ];
- item->type=itVPotmeter;
- return r;
+    item       = &currSubItems[*currSubItem];
+    item->type = itVPotmeter;
+    return r;
 }
 
-static int cmd_potmeter( char * in )
-{ // 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;
+// potmeter=phases,numphases,default,x,y,width,height,message
+static int cmd_potmeter(char *in)
+{
+    int x, y, ph, sx, sy, msg, d;
+    unsigned char tmp[512];
+    unsigned char phfname[512];
+    wItem *item;
 
- CHECKDEFLIST( "potmeter" );
- CHECKWINLIST( "potmeter" );
+    CHECKDEFLIST("potmeter");
+    CHECKWINLIST("potmeter");
 
- CHECK( "sub" );
- CHECK( "menu" );
+    CHECK("sub");
+    CHECK("menu");
 
- cutItem( in,phfname,',',0 );
- ph=cutItemToInt( in,',',1 );
- d=cutItemToInt( in,',',2 );
- x=cutItemToInt( in,',',3 );
- y=cutItemToInt( in,',',4 );
- sx=cutItemToInt( in,',',5 );
- sy=cutItemToInt( in,',',6 );
- cutItem( in,tmp,',',7 ); msg=appFindMessage( tmp );
+    cutItem(in, phfname, ',', 0);
+    ph = cutItemToInt(in, ',', 1);
+    d  = cutItemToInt(in, ',', 2);
+    x  = cutItemToInt(in, ',', 3);
+    y  = cutItemToInt(in, ',', 4);
+    sx = cutItemToInt(in, ',', 5);
+    sy = cutItemToInt(in, ',', 6);
+    cutItem(in, tmp, ',', 7);
 
- 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 );
+    msg = appFindMessage(tmp);
 
- (*currSubItem)++;
- item=&currSubItems[ *currSubItem ];
+    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);
 
- 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;
+    (*currSubItem)++;
+    item               = &currSubItems[*currSubItem];
+    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;
 
- item->Bitmap.Image=NULL;
- if ( strcmp( phfname,"NULL" ) != 0 )
-  {
-   av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, phfname, sizeof( tmp ));
-   if ( skinBPRead( tmp,&item->Bitmap ) != 0 ) return 1;
-  }
- return 0;
+    if (strcmp(phfname, "NULL") != 0) {
+        av_strlcpy(tmp, path, sizeof(tmp));
+        av_strlcat(tmp, phfname, sizeof(tmp));
+
+        if (skinBPRead(tmp, &item->Bitmap) != 0)
+            return 1;
+    }
+
+    return 0;
 }
 
-static int cmd_font( char * in )
-{ // font=fontname
- char    name[512];
- wItem * item;
+// font=fontfile
+static int cmd_font(char *in)
+{
+    char name[512];
+    wItem *item;
 
- CHECKDEFLIST( "font" );
- CHECKWINLIST( "font" );
+    CHECKDEFLIST("font");
+    CHECKWINLIST("font");
 
- CHECK( "sub" );
- CHECK( "menu" );
+    CHECK("sub");
+    CHECK("menu");
 
- cutItem( in,name,',',0 );
+    cutItem(in, name, ',', 0);
 
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] font\n" );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin]  name: %s\n",name );
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] font\n");
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  name: %s\n", name);
 
- (*currSubItem)++;
- item=&currSubItems[ *currSubItem ];
+    (*currSubItem)++;
+    item         = &currSubItems[*currSubItem];
+    item->type   = itFont;
+    item->fontid = fntRead(path, name);
 
- item->type=itFont;
- item->fontid=fntRead( path,name );
- switch ( item->fontid )
-  {
-   case -1: ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1;
-   case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_TooManyFontsDeclared ); return 1;
-   case -3: ERRORMESSAGE( MSGTR_SKIN_FONT_FontFileNotFound ); return 1;
-   case -4: ERRORMESSAGE( MSGTR_SKIN_FONT_FontImageNotFound ); return 1;
-  }
- return 0;
+    switch (item->fontid) {
+    case -1:
+        ERRORMESSAGE(MSGTR_SKIN_FONT_NotEnoughtMemory);
+        return 1;
+
+    case -2:
+        ERRORMESSAGE(MSGTR_SKIN_FONT_TooManyFontsDeclared);
+        return 1;
+
+    case -3:
+        ERRORMESSAGE(MSGTR_SKIN_FONT_FontFileNotFound);
+        return 1;
+
+    case -4:
+        ERRORMESSAGE(MSGTR_SKIN_FONT_FontImageNotFound);
+        return 1;
+    }
+
+    return 0;
 }
 
-static int cmd_slabel( char * in )
+// slabel=x,y,fontfile,"text"
+static int cmd_slabel(char *in)
 {
- char    tmp[512];
- char    sid[64];
- int     x,y,id;
- wItem * item;
+    char tmp[512];
+    char sid[64];
+    int x, y, id;
+    wItem *item;
 
- CHECKDEFLIST( "slabel" );
- CHECKWINLIST( "slabel" );
+    CHECKDEFLIST("slabel");
+    CHECKWINLIST("slabel");
 
- CHECK( "sub" );
- CHECK( "menu" );
+    CHECK("sub");
+    CHECK("menu");
 
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] slabel\n" );
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] slabel\n");
 
- x=cutItemToInt( in,',',0 );
- y=cutItemToInt( in,',',1 );
- cutItem( in,sid,',',2 ); id=fntFindID( sid );
- if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; }
- cutItem( in,tmp,',',3 ); cutItem( tmp,tmp,'"',1 );
+    x = cutItemToInt(in, ',', 0);
+    y = cutItemToInt(in, ',', 1);
+    cutItem(in, sid, ',', 2);
 
- 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 );
+    id = fntFindID(sid);
 
- (*currSubItem)++;
- item=&currSubItems[ *currSubItem ];
+    if (id < 0) {
+        ERRORMESSAGE(MSGTR_SKIN_FONT_NonExistentFontID, sid);
+        return 1;
+    }
 
- item->type=itSLabel;
- item->fontid=id;
- item->x=x; item->y=y;
- item->width=-1; item->height=-1;
- if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; }
- strcpy( item->label,tmp );
+    cutItem(in, tmp, ',', 3);
+    cutItem(tmp, tmp, '"', 1);
 
- return 0;
+    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);
+
+    (*currSubItem)++;
+    item         = &currSubItems[*currSubItem];
+    item->type   = itSLabel;
+    item->fontid = id;
+    item->x      = x;
+    item->y      = y;
+    item->width  = -1;
+    item->height = -1;
+
+    if ((item->label = malloc(strlen(tmp) + 1)) == NULL) {
+        ERRORMESSAGE(MSGTR_SKIN_FONT_NotEnoughtMemory);
+        return 1;
+    }
+
+    strcpy(item->label, tmp);
+
+    return 0;
 }
 
-static int cmd_dlabel( char * in )
-{ // dlabel=x,y,sx,align,fontfile,string ...
- char    tmp[512];
- char    sid[64];
- int     x,y,sx,id,a;
- wItem * item;
+// dlabel=x,y,length,align,fontfile,"text"
+static int cmd_dlabel(char *in)
+{
+    char tmp[512];
+    char sid[64];
+    int x, y, sx, id, a;
+    wItem *item;
 
- CHECKDEFLIST( "dlabel" );
- CHECKWINLIST( "dlabel" );
+    CHECKDEFLIST("dlabel");
+    CHECKWINLIST("dlabel");
 
- CHECK( "sub" );
- CHECK( "menu" );
+    CHECK("sub");
+    CHECK("menu");
 
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] dlabel\n" );
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] dlabel\n");
 
- x=cutItemToInt( in,',',0 );
- y=cutItemToInt( in,',',1 );
- sx=cutItemToInt( in,',',2 );
- a=cutItemToInt( in,',',3 );
- cutItem( in,sid,',',4 ); id=fntFindID( sid );
- if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; }
- cutItem( in,tmp,',',5 ); cutItem( tmp,tmp,'"',1 );
+    x  = cutItemToInt(in, ',', 0);
+    y  = cutItemToInt(in, ',', 1);
+    sx = cutItemToInt(in, ',', 2);
+    a  = cutItemToInt(in, ',', 3);
+    cutItem(in, sid, ',', 4);
 
- 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 );
+    id = fntFindID(sid);
 
- (*currSubItem)++;
- item=&currSubItems[ *currSubItem ];
+    if (id < 0) {
+        ERRORMESSAGE(MSGTR_SKIN_FONT_NonExistentFontID, sid);
+        return 1;
+    }
 
- item->type=itDLabel;
- item->fontid=id; item->align=a;
- item->x=x; item->y=y;
- item->width=sx; item->height=-1;
- if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; }
- strcpy( item->label,tmp );
+    cutItem(in, tmp, ',', 5);
+    cutItem(tmp, tmp, '"', 1);
 
- return 0;
+    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);
+
+    (*currSubItem)++;
+    item         = &currSubItems[*currSubItem];
+    item->type   = itDLabel;
+    item->fontid = id;
+    item->align  = a;
+    item->x      = x;
+    item->y      = y;
+    item->width  = sx;
+    item->height = -1;
+
+    if ((item->label = malloc(strlen(tmp) + 1)) == NULL) {
+        ERRORMESSAGE(MSGTR_SKIN_FONT_NotEnoughtMemory);
+        return 1;
+    }
+
+    strcpy(item->label, tmp);
+
+    return 0;
 }
 
-static int cmd_decoration( char * in )
+// decoration=enable|disable
+static int cmd_decoration(char *in)
 {
- char    tmp[512];
+    char tmp[512];
 
- CHECKDEFLIST( "decoration" );
- CHECKWINLIST( "decoration" );
+    CHECKDEFLIST("decoration");
+    CHECKWINLIST("decoration");
 
- CHECK( "sub" );
- CHECK( "menu" );
- CHECK( "playbar" );
+    CHECK("sub");
+    CHECK("menu");
+    CHECK("playbar");
 
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",in );
- strlower( in );
- cutItem( in,tmp,',',0 );
- if ( strcmp( tmp,"enable" ) != 0&&strcmp( tmp,"disable" ) != 0 ) { ERRORMESSAGE( MSGTR_SKIN_UnknownParameter,tmp ); return 1; }
- if ( strcmp( tmp,"enable" ) != 0 ) defList->mainDecoration=0;
-  else defList->mainDecoration=1;
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] window decoration is %s\n", in);
 
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",(defList->mainDecoration?"enabled":"disabled") );
- return 0;
+    strlower(in);
+    cutItem(in, tmp, ',', 0);
+
+    if (strcmp(tmp, "enable") != 0 && strcmp(tmp, "disable") != 0) {
+        ERRORMESSAGE(MSGTR_SKIN_UnknownParameter, tmp);
+        return 1;
+    }
+
+    if (strcmp(tmp, "enable") != 0)
+        defList->mainDecoration = 0;
+    else
+        defList->mainDecoration = 1;
+
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] window decoration is %s\n", (defList->mainDecoration ? "enabled" : "disabled"));
+
+    return 0;
 }
 
-typedef struct
+_item skinItem[] = {
+    { "section",    cmd_section    },
+    { "end",        cmd_end        },
+    { "window",     cmd_window     },
+    { "base",       cmd_base       },
+    { "button",     cmd_button     },
+    { "selected",   cmd_selected   },
+    { "background", cmd_background },
+    { "vpotmeter",  cmd_vpotmeter  },
+    { "hpotmeter",  cmd_hpotmeter  },
+    { "potmeter",   cmd_potmeter   },
+    { "font",       cmd_font       },
+    { "slabel",     cmd_slabel     },
+    { "dlabel",     cmd_dlabel     },
+    { "decoration", cmd_decoration },
+    { "menu",       cmd_menu       }
+};
+
+#define ITEMS (int)(sizeof(skinItem) / sizeof(_item))
+
+char *strswap(char *in, char what, char whereof)
 {
- const char * name;
- int  (*func)( char * in );
-} _item;
+    int i;
 
-_item skinItem[] =
- {
-  { "section",     cmd_section     },
-  { "end",         cmd_end         },
-  { "window",      cmd_window      },
-  { "base",        cmd_base        },
-  { "button",      cmd_button      },
-  { "selected",    cmd_selected    },
-  { "background",  cmd_background  },
-  { "vpotmeter",   cmd_vpotmeter   },
-  { "hpotmeter",   cmd_hpotmeter   },
-  { "potmeter",    cmd_potmeter    },
-  { "font",        cmd_font        },
-  { "slabel",      cmd_slabel      },
-  { "dlabel",      cmd_dlabel      },
-  { "decoration",  cmd_decoration  },
-  { "menu",        cmd_menu        }
- };
+    if (strlen(in) == 0)
+        return NULL;
 
-#define ITEMS (int)( sizeof( skinItem )/sizeof( _item ) )
+    for (i = 0; i < (int)strlen(in); i++)
+        if (in[i] == what)
+            in[i] = whereof;
 
-char * strswap( char * in,char what,char whereof )
-{
- int    i;
- if ( strlen( in ) == 0 ) return NULL;
- for ( i=0;i<(int)strlen( in );i++ )
-   if ( in[i] == what ) in[i]=whereof;
- return in;
+    return in;
 }
 
-char * trim( char * in )
+char *trim(char *in)
 {
- int    c = 0,i = 0,id = 0;
- if ( strlen( in ) == 0 ) return NULL;
- while ( c != (int)strlen( in ) )
-  {
-   if ( in[c] == '"' ) id=!id;
-   if ( ( in[c] == ' ' )&&( !id ) )
-    {
-     for ( i=0;i<(int)strlen( in ) - c; i++ ) in[c+i]=in[c+i+1];
-     continue;
+    int c = 0, id = 0, i;
+
+    if (strlen(in) == 0)
+        return NULL;
+
+    while (c != (int)strlen(in)) {
+        if (in[c] == '"')
+            id = !id;
+
+        if ((in[c] == ' ') && (!id)) {
+            for (i = 0; i < (int)strlen(in) - c; i++)
+                in[c + i] = in[c + i + 1];
+            continue;
+        }
+
+        c++;
     }
-   c++;
-  }
- return in;
+
+    return in;
 }
 
-static char *setname( char * item1, char * item2 )
+static char *setname(char *item1, char *item2)
 {
-  static char fn[512];
+    static char fn[512];
 
-  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 ));
+    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));
 
-  return fn;
+    return fn;
 }
 
-int skinRead( char * dname )
+int skinRead(char *dname)
 {
- char          * fn;
- FILE          * skinFile;
- unsigned char   tmp[256];
- unsigned char * ptmp;
- unsigned char   command[32];
- unsigned char   param[256];
- int             i;
+    char *fn;
+    FILE *skinFile;
+    unsigned char tmp[256];
+    unsigned char *ptmp;
+    unsigned char command[32];
+    unsigned char param[256];
+    int i;
 
- fn = setname( skinDirInHome,dname );
- if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
-  {
-   fn = setname( skinMPlayerDir,dname );
-   if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
-    {
-     mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_SkinFileNotFound,fn );
-     return -1;
+    fn = setname(skinDirInHome, dname);
+
+    if ((skinFile = fopen(fn, "rt")) == NULL) {
+        fn = setname(skinMPlayerDir, dname);
+
+        if ((skinFile = fopen(fn, "rt")) == NULL) {
+            mp_msg(MSGT_GPLAYER, MSGL_STATUS, MSGTR_SKIN_SkinFileNotFound, fn);
+            return -1;
+        }
     }
-  }
 
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] file: %s\n",fn );
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin] file: %s\n", fn);
 
- appInitStruct( skinAppMPlayer );
+    appInitStruct(skinAppMPlayer);
 
- linenumber=0;
- while (fgets(tmp, sizeof(tmp), skinFile))
-  {
-   linenumber++;
+    linenumber = 0;
 
-   // remove any kind of newline, if any
-   tmp[strcspn(tmp, "\n\r")] = 0;
-   strswap( tmp,'\t',' ' );
-   trim( tmp );
-   ptmp = strchr(tmp, ';');
-   if (ptmp) *ptmp = 0;
-   if (!*tmp) continue;
-   cutItem( tmp,command,'=',0 ); cutItem( tmp,param,'=',1 );
-   strlower( command );
-   for( i=0;i<ITEMS;i++ )
-    if ( !strcmp( command,skinItem[i].name ) )
-     if ( skinItem[i].func( param ) != 0 ) return -2;
-  }
- if (linenumber == 0) {
-   mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SkinFileNotReadable, fn);
-   return -1;
- }
- return 0;
+    while (fgets(tmp, sizeof(tmp), skinFile)) {
+        linenumber++;
+
+        tmp[strcspn(tmp, "\n\r")] = 0; // remove any kind of newline, if any
+        strswap(tmp, '\t', ' ');
+        trim(tmp);
+        ptmp = strchr(tmp, ';');
+
+        if (ptmp)
+            *ptmp = 0;
+
+        if (!*tmp)
+            continue;
+
+        cutItem(tmp, command, '=', 0);
+        cutItem(tmp, param, '=', 1);
+        strlower(command);
+
+        for (i = 0; i < ITEMS; i++)
+            if (!strcmp(command, skinItem[i].name))
+                if (skinItem[i].func(param) != 0)
+                    return -2;
+    }
+
+    if (linenumber == 0) {
+        mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SkinFileNotReadable, fn);
+        return -1;
+    }
+
+    return 0;
 }

Modified: trunk/gui/skin/skin.h
==============================================================================
--- trunk/gui/skin/skin.h	Thu Feb 24 14:39:48 2011	(r32959)
+++ trunk/gui/skin/skin.h	Thu Feb 24 16:00:29 2011	(r32960)
@@ -21,14 +21,11 @@
 
 #include "gui/app.h"
 
-extern listItems     * skinAppMPlayer;
-
-int skinRead( char * dname  );
-int skinBPRead( char * fname, txSample * bf );
-
-// ---
+extern listItems *skinAppMPlayer;
 
-char * strswap( char * in, char what, char whereof );
-char * trim( char * in );
+int skinBPRead(char *, txSample *);
+int skinRead(char *);
+char *strswap(char *, char, char);
+char *trim(char *);
 
 #endif /* MPLAYER_GUI_SKIN_H */


More information about the MPlayer-cvslog mailing list