changeset 32911:e06fbdd8eb46

Clean up the wItem structure. Rearrange and group members, remove unused members and rename some members to be more informative and precise.
author ib
date Wed, 02 Mar 2011 15:37:50 +0000
parents f34e21c5dc2f
children ca4d3fa55e43
files gui/app.c gui/app.h gui/mplayer/gui_common.c gui/mplayer/menu.c gui/mplayer/mw.c gui/mplayer/pb.c gui/skin/skin.c
diffstat 7 files changed, 70 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/gui/app.c	Wed Mar 02 13:30:44 2011 +0000
+++ b/gui/app.c	Wed Mar 02 15:37:50 2011 +0000
@@ -83,16 +83,11 @@
     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 @@
     item->textwidth = 0;
     item->starttime = 0;
     item->last_x    = 0;
-    item->event     = 0;
 }
 
 void appInitStruct(listItems *item)
@@ -155,7 +149,7 @@
 
     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 @@
     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 @@
     }
 
     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 @@
     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;
         }
--- a/gui/app.h	Wed Mar 02 13:30:44 2011 +0000
+++ b/gui/app.h	Wed Mar 02 15:37:50 2011 +0000
@@ -105,7 +105,7 @@
 #define evFirstLoad       7005
 
 typedef struct {
-    int msg;
+    int message;
     const char *name;
 } evName;
 
@@ -133,14 +133,6 @@
     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 @@
     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 {
--- a/gui/mplayer/gui_common.c	Wed Mar 02 13:30:44 2011 +0000
+++ b/gui/mplayer/gui_common.c	Wed Mar 02 15:37:50 2011 +0000
@@ -276,21 +276,21 @@
           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:
--- a/gui/mplayer/menu.c	Wed Mar 02 13:30:44 2011 +0000
+++ b/gui/mplayer/menu.c	Wed Mar 02 15:37:50 2011 +0000
@@ -136,7 +136,7 @@
         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 );
    }
 }
 
--- a/gui/mplayer/mw.c	Wed Mar 02 13:30:44 2011 +0000
+++ b/gui/mplayer/mw.c	Wed Mar 02 15:37:50 2011 +0000
@@ -435,8 +435,8 @@
            {
             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 @@
            {
             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 @@
           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 @@
 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;
--- a/gui/mplayer/pb.c	Wed Mar 02 13:30:44 2011 +0000
+++ b/gui/mplayer/pb.c	Wed Mar 02 15:37:50 2011 +0000
@@ -155,8 +155,8 @@
 	 {
 	  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 @@
 	 {
 	  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 @@
         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 @@
 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;
--- a/gui/skin/skin.c	Wed Mar 02 13:30:44 2011 +0000
+++ b/gui/skin/skin.c	Wed Mar 02 15:37:50 2011 +0000
@@ -371,19 +371,19 @@
     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 @@
 // 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 @@
     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 @@
     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 @@
 // 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 @@
     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 @@
     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 @@
     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 @@
 // 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 @@
     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 @@
     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;