[MPlayer-cvslog] r32998 - in trunk/gui: app.c app.h mplayer/gui_common.c mplayer/menu.c mplayer/mw.c mplayer/pb.c skin/skin.c

ib subversion at mplayerhq.hu
Wed Mar 2 16:37:50 CET 2011


Author: ib
Date: Wed Mar  2 16:37:50 2011
New Revision: 32998

Log:
Clean up the wItem structure.

Rearrange and group members, remove unused members and rename some members
to be more informative and precise.

Modified:
   trunk/gui/app.c
   trunk/gui/app.h
   trunk/gui/mplayer/gui_common.c
   trunk/gui/mplayer/menu.c
   trunk/gui/mplayer/mw.c
   trunk/gui/mplayer/pb.c
   trunk/gui/skin/skin.c

Modified: trunk/gui/app.c
==============================================================================
--- trunk/gui/app.c	Wed Mar  2 14:30:44 2011	(r32997)
+++ trunk/gui/app.c	Wed Mar  2 16:37:50 2011	(r32998)
@@ -83,16 +83,11 @@ static void appClearItem(wItem *item)
     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;
+    item->pwidth           = 0;
+    item->pheight          = 0;
+    item->message          = 0;
     item->pressed          = btnReleased;
     item->tmp              = 0;
-    item->key              = 0;
-    item->key2             = 0;
     item->Bitmap.Width     = 0;
     item->Bitmap.Height    = 0;
     item->Bitmap.BPP       = 0;
@@ -107,7 +102,6 @@ static void appClearItem(wItem *item)
     item->textwidth = 0;
     item->starttime = 0;
     item->last_x    = 0;
-    item->event     = 0;
 }
 
 void appInitStruct(listItems *item)
@@ -155,7 +149,7 @@ int appFindMessage(unsigned char *str)
 
     for (i = 0; i < evBoxs; i++)
         if (!strcmp(evNames[i].name, str))
-            return evNames[i].msg;
+            return evNames[i].message;
 
     return -1;
 }
@@ -165,7 +159,7 @@ void btnModify(int event, float state)
     int i;
 
     for (i = 0; i < appMPlayer.NumberOfItems + 1; i++) {
-        if (appMPlayer.Items[i].msg == event) {
+        if (appMPlayer.Items[i].message == event) {
             switch (appMPlayer.Items[i].type) {
             case itButton:
                 appMPlayer.Items[i].pressed = (int)state;
@@ -186,7 +180,7 @@ void btnModify(int event, float state)
     }
 
     for (i = 0; i < appMPlayer.NumberOfBarItems + 1; i++) {
-        if (appMPlayer.barItems[i].msg == event) {
+        if (appMPlayer.barItems[i].message == event) {
             switch (appMPlayer.barItems[i].type) {
             case itButton:
                 appMPlayer.barItems[i].pressed = (int)state;
@@ -212,14 +206,14 @@ void btnSet(int event, int set)
     int i;
 
     for (i = 0; i < appMPlayer.NumberOfItems + 1; i++) {
-        if (appMPlayer.Items[i].msg == event) {
+        if (appMPlayer.Items[i].message == event) {
             appMPlayer.Items[i].pressed = set;
             appMPlayer.barItems[i].tmp  = 0;
         }
     }
 
     for (i = 0; i < appMPlayer.NumberOfBarItems + 1; i++) {
-        if (appMPlayer.barItems[i].msg == event) {
+        if (appMPlayer.barItems[i].message == event) {
             appMPlayer.barItems[i].pressed = set;
             appMPlayer.barItems[i].tmp     = 0;
         }

Modified: trunk/gui/app.h
==============================================================================
--- trunk/gui/app.h	Wed Mar  2 14:30:44 2011	(r32997)
+++ trunk/gui/app.h	Wed Mar  2 16:37:50 2011	(r32998)
@@ -105,7 +105,7 @@
 #define evFirstLoad       7005
 
 typedef struct {
-    int msg;
+    int message;
     const char *name;
 } evName;
 
@@ -133,14 +133,6 @@ typedef struct {
     int x, y;
     int width, height;
 
-    int px, py, psx, psy;
-
-    int msg, msg2;
-    int pressed, tmp;
-    int key, key2;
-    int phases;
-    float value;
-
     txSample Bitmap;
     txSample Mask;
 
@@ -148,14 +140,20 @@ typedef struct {
     int align;
     char *label;
 
+    int pwidth, pheight;
+    int numphases;
+    float value;
+
+    int message;
+
+    int R, G, B;
+
     char *text;
     int textwidth;
     unsigned int starttime;
     int last_x;
 
-    int event;
-
-    int R, G, B;
+    int pressed, tmp;
 } wItem;
 
 typedef struct {

Modified: trunk/gui/mplayer/gui_common.c
==============================================================================
--- trunk/gui/mplayer/gui_common.c	Wed Mar  2 14:30:44 2011	(r32997)
+++ trunk/gui/mplayer/gui_common.c	Wed Mar  2 16:37:50 2011	(r32998)
@@ -276,21 +276,21 @@ void Render( wsTWindow * window,wItem * 
           PutImage( &item->Bitmap,item->x,item->y,3,item->pressed );
           break;
      case itPotmeter:
-          if (item->phases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f );
-          else PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) );
+          if (item->numphases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f );
+          else PutImage( &item->Bitmap,item->x,item->y,item->numphases,( item->numphases - 1 ) * ( item->value / 100.0f ) );
           break;
      case itHPotmeter:
-          if (item->phases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f );
-          else PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) );
-          PutImage( &item->Mask,item->x + (int)( ( item->width - item->psx ) * item->value / 100.0f ),item->y,3,item->pressed );
+          if (item->numphases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f );
+          else PutImage( &item->Bitmap,item->x,item->y,item->numphases,( item->numphases - 1 ) * ( item->value / 100.0f ) );
+          PutImage( &item->Mask,item->x + (int)( ( item->width - item->pwidth ) * item->value / 100.0f ),item->y,3,item->pressed );
           break;
      case itVPotmeter:
           PutImage( &item->Bitmap,
 	    item->x,item->y,
-	    item->phases,
-	    item->phases * ( 1. - item->value / 100.0f ) );
+	    item->numphases,
+	    item->numphases * ( 1. - item->value / 100.0f ) );
           PutImage( &item->Mask,
-	    item->x,item->y + (int)( ( item->height - item->psy ) * ( 1. - item->value / 100.0f ) ),
+	    item->x,item->y + (int)( ( item->height - item->pheight ) * ( 1. - item->value / 100.0f ) ),
 	    3,item->pressed );
           break;
      case itSLabel:

Modified: trunk/gui/mplayer/menu.c
==============================================================================
--- trunk/gui/mplayer/menu.c	Wed Mar  2 14:30:44 2011	(r32997)
+++ trunk/gui/mplayer/menu.c	Wed Mar  2 16:37:50 2011	(r32998)
@@ -136,7 +136,7 @@ void mplHideMenu( int mx,int my,int w )
         appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width,
         appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) )
    {
-    mplEventHandling( appMPlayer.MenuItems[i].msg,(float)w );
+    mplEventHandling( appMPlayer.MenuItems[i].message,(float)w );
    }
 }
 

Modified: trunk/gui/mplayer/mw.c
==============================================================================
--- trunk/gui/mplayer/mw.c	Wed Mar  2 14:30:44 2011	(r32997)
+++ trunk/gui/mplayer/mw.c	Wed Mar  2 16:37:50 2011	(r32998)
@@ -435,8 +435,8 @@ void mplMainMouseHandle( int Button,int 
            {
             case itButton:
                  if ( ( SelectedItem > -1 ) &&
-                    ( ( ( item->msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) ||
-                      ( ( item->msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) )
+                    ( ( ( item->message == evPlaySwitchToPause && item->message == evPauseSwitchToPlay ) ) ||
+                      ( ( item->message == evPauseSwitchToPlay && item->message == evPlaySwitchToPause ) ) ) )
                   { item->pressed=btnDisabled; }
                  break;
            }
@@ -452,17 +452,17 @@ void mplMainMouseHandle( int Button,int 
            {
             case itPotmeter:
             case itHPotmeter:
-                 btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f );
-		 mplEventHandling( item->msg,item->value );
+                 btnModify( item->message,(float)( X - item->x ) / item->width * 100.0f );
+		 mplEventHandling( item->message,item->value );
                  value=item->value;
                  break;
 	    case itVPotmeter:
-                 btnModify( item->msg, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f );
-		 mplEventHandling( item->msg,item->value );
+                 btnModify( item->message, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f );
+		 mplEventHandling( item->message,item->value );
                  value=item->value;
                  break;
            }
-          mplEventHandling( item->msg,value );
+          mplEventHandling( item->message,value );
           itemtype=0;
           break;
 
@@ -478,8 +478,8 @@ rollerhandled:
           if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) )
            {
             item->value+=value;
-            btnModify( item->msg,item->value );
-            mplEventHandling( item->msg,item->value );
+            btnModify( item->message,item->value );
+            mplEventHandling( item->message,item->value );
            }
           break;
 
@@ -506,7 +506,7 @@ rollerhandled:
 potihandled:
                  if ( item->value > 100.0f ) item->value=100.0f;
                  if ( item->value < 0.0f ) item->value=0.0f;
-                 mplEventHandling( item->msg,item->value );
+                 mplEventHandling( item->message,item->value );
                  break;
            }
           break;

Modified: trunk/gui/mplayer/pb.c
==============================================================================
--- trunk/gui/mplayer/pb.c	Wed Mar  2 14:30:44 2011	(r32997)
+++ trunk/gui/mplayer/pb.c	Wed Mar  2 16:37:50 2011	(r32998)
@@ -155,8 +155,8 @@ static void mplPBMouseHandle( int Button
 	 {
 	  case itButton:
 	       if ( ( SelectedItem > -1 ) &&
-	         ( ( ( item->msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) ||
-		 ( ( item->msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) )
+	         ( ( ( item->message == evPlaySwitchToPause && item->message == evPauseSwitchToPlay ) ) ||
+		 ( ( item->message == evPauseSwitchToPlay && item->message == evPlaySwitchToPause ) ) ) )
 		 { item->pressed=btnDisabled; }
 	       break;
 	 }
@@ -173,17 +173,17 @@ static void mplPBMouseHandle( int Button
 	 {
 	  case itPotmeter:
 	  case itHPotmeter:
-	       btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f );
-	       mplEventHandling( item->msg,item->value );
+	       btnModify( item->message,(float)( X - item->x ) / item->width * 100.0f );
+	       mplEventHandling( item->message,item->value );
 	       value=item->value;
 	       break;
 	  case itVPotmeter:
-	       btnModify( item->msg, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f );
-	       mplEventHandling( item->msg,item->value );
+	       btnModify( item->message, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f );
+	       mplEventHandling( item->message,item->value );
 	       value=item->value;
 	       break;
 	 }
-	mplEventHandling( item->msg,value );
+	mplEventHandling( item->message,value );
 
 	itemtype=0;
 	break;
@@ -195,8 +195,8 @@ rollerhandled:
         if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) )
 	 {
 	  item->value+=value;
-	  btnModify( item->msg,item->value );
-	  mplEventHandling( item->msg,item->value );
+	  btnModify( item->message,item->value );
+	  mplEventHandling( item->message,item->value );
 	 }
 	break;
 // ---
@@ -218,7 +218,7 @@ rollerhandled:
 potihandled:
 	       if ( item->value > 100.0f ) item->value=100.0f;
 	       if ( item->value < 0.0f ) item->value=0.0f;
-	       mplEventHandling( item->msg,item->value );
+	       mplEventHandling( item->message,item->value );
 	       break;
 	 }
         break;

Modified: trunk/gui/skin/skin.c
==============================================================================
--- trunk/gui/skin/skin.c	Wed Mar  2 14:30:44 2011	(r32997)
+++ trunk/gui/skin/skin.c	Wed Mar  2 16:37:50 2011	(r32998)
@@ -371,19 +371,19 @@ static int cmd_button(char *in)
     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);
 
-    if ((currSubItems[*currSubItem].msg = appFindMessage(msg)) == -1) {
+    if ((currSubItems[*currSubItem].message = appFindMessage(msg)) == -1) {
         ERRORMESSAGE(MSGTR_SKIN_BITMAP_UnknownMessage, msg);
         return 0;
     }
 
     currSubItems[*currSubItem].pressed = btnReleased;
 
-    if (currSubItems[*currSubItem].msg == evPauseSwitchToPlay)
+    if (currSubItems[*currSubItem].message == evPauseSwitchToPlay)
         currSubItems[*currSubItem].pressed = btnDisabled;
 
     currSubItems[*currSubItem].tmp = 1;
 
-    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  message: %d\n", currSubItems[*currSubItem].msg);
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  message: %d\n", currSubItems[*currSubItem].message);
 
     currSubItems[*currSubItem].Bitmap.Image = NULL;
 
@@ -434,7 +434,7 @@ static int cmd_selected(char *in)
 // menu=x,y,width,height,message
 static int cmd_menu(char *in)
 {
-    int x, y, sx, sy, msg;
+    int x, y, sx, sy, message;
     unsigned char tmp[64];
 
     CHECKDEFLIST("menu");
@@ -450,7 +450,7 @@ static int cmd_menu(char *in)
     sy = cutItemToInt(in, ',', 3);
     cutItem(in, tmp, ',', 4);
 
-    msg = appFindMessage(tmp);
+    message = appFindMessage(tmp);
 
     defList->NumberOfMenuItems++;
     defList->MenuItems[defList->NumberOfMenuItems].x      = x;
@@ -461,10 +461,10 @@ static int cmd_menu(char *in)
     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);
 
-    if ((defList->MenuItems[defList->NumberOfMenuItems].msg = msg) == -1)
+    if ((defList->MenuItems[defList->NumberOfMenuItems].message = message) == -1)
         ERRORMESSAGE(MSGTR_SKIN_BITMAP_UnknownMessage, tmp);
 
-    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  message: %d\n", defList->Items[defList->NumberOfItems].msg);
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  message: %d\n", defList->Items[defList->NumberOfItems].message);
 
     defList->MenuItems[defList->NumberOfMenuItems].Bitmap.Image = NULL;
     return 0;
@@ -473,7 +473,7 @@ static int cmd_menu(char *in)
 // 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;
+    int x, y, pwidth, pheight, ph, sx, sy, message, d;
     unsigned char tmp[512];
     unsigned char pfname[512];
     unsigned char phfname[512];
@@ -486,8 +486,8 @@ static int cmd_hpotmeter(char *in)
     CHECK("menu");
 
     cutItem(in, pfname, ',', 0);
-    psx = cutItemToInt(in, ',', 1);
-    psy = cutItemToInt(in, ',', 2);
+    pwidth  = cutItemToInt(in, ',', 1);
+    pheight = cutItemToInt(in, ',', 2);
     cutItem(in, phfname, ',', 3);
     ph = cutItemToInt(in, ',', 4);
     d  = cutItemToInt(in, ',', 5);
@@ -497,14 +497,14 @@ static int cmd_hpotmeter(char *in)
     sy = cutItemToInt(in, ',', 9);
     cutItem(in, tmp, ',', 10);
 
-    msg = appFindMessage(tmp);
+    message = appFindMessage(tmp);
 
     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]  pointer size is %dx%d\n", pwidth, pheight);
     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);
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  message: %d\n", message);
 
     (*currSubItem)++;
     item               = &currSubItems[*currSubItem];
@@ -513,10 +513,10 @@ static int cmd_hpotmeter(char *in)
     item->y            = y;
     item->width        = sx;
     item->height       = sy;
-    item->phases       = ph;
-    item->psx          = psx;
-    item->psy          = psy;
-    item->msg          = msg;
+    item->numphases    = ph;
+    item->pwidth       = pwidth;
+    item->pheight      = pheight;
+    item->message      = message;
     item->value        = (float)d;
     item->pressed      = btnReleased;
     item->Bitmap.Image = NULL;
@@ -556,7 +556,7 @@ static int cmd_vpotmeter(char *in)
 // potmeter=phases,numphases,default,x,y,width,height,message
 static int cmd_potmeter(char *in)
 {
-    int x, y, ph, sx, sy, msg, d;
+    int x, y, ph, sx, sy, message, d;
     unsigned char tmp[512];
     unsigned char phfname[512];
     wItem *item;
@@ -576,13 +576,13 @@ static int cmd_potmeter(char *in)
     sy = cutItemToInt(in, ',', 6);
     cutItem(in, tmp, ',', 7);
 
-    msg = appFindMessage(tmp);
+    message = appFindMessage(tmp);
 
     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]  numphases: %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);
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  message: %d\n", message);
 
     (*currSubItem)++;
     item               = &currSubItems[*currSubItem];
@@ -591,8 +591,8 @@ static int cmd_potmeter(char *in)
     item->y            = y;
     item->width        = sx;
     item->height       = sy;
-    item->phases       = ph;
-    item->msg          = msg;
+    item->numphases    = ph;
+    item->message      = message;
     item->value        = (float)d;
     item->Bitmap.Image = NULL;
 


More information about the MPlayer-cvslog mailing list