changeset 32931:03b1051bed5c

Rename the 'NumberOf' members of the listItems structure. Since the NumberOfMainItems, NumberOfBarItems and NumberOfMenuItems members actually hold the last index used rather than the number of items, rename them 'IndexOf' to avoid further confusion. Besides, change their loop conditions to meet the new name.
author ib
date Thu, 03 Mar 2011 14:37:47 +0000
parents b52831437104
children e95ec1b2feea
files gui/app.c gui/app.h gui/mplayer/menu.c gui/mplayer/mw.c gui/mplayer/pb.c gui/skin/skin.c
diffstat 6 files changed, 30 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/gui/app.c	Thu Mar 03 14:13:41 2011 +0000
+++ b/gui/app.c	Thu Mar 03 14:37:47 2011 +0000
@@ -106,9 +106,9 @@
 
 void appResetStruct(void)
 {
-    appMPlayer.NumberOfMainItems = -1;
-    appMPlayer.NumberOfBarItems  = -1;
-    appMPlayer.NumberOfMenuItems = -1;
+    appMPlayer.IndexOfMainItems = -1;
+    appMPlayer.IndexOfBarItems  = -1;
+    appMPlayer.IndexOfMenuItems = -1;
 
     appMPlayer.sub.x = -1;   // NOTE TO MYSELF: is this really necessary?
     appMPlayer.sub.y = -1;   // NOTE TO MYSELF: is this really necessary?
@@ -130,11 +130,11 @@
     appClearItem(&appMPlayer.menuSelected);
     appMPlayer.menuIsPresent = 0;
 
-    for (i = 0; i < appMPlayer.NumberOfMainItems + 1; i++)
+    for (i = 0; i <= appMPlayer.IndexOfMainItems; i++)
         appClearItem(&appMPlayer.mainItems[i]);
-    for (i = 0; i < appMPlayer.NumberOfBarItems + 1; i++)
+    for (i = 0; i <= appMPlayer.IndexOfBarItems; i++)
         appClearItem(&appMPlayer.barItems[i]);
-    for (i = 0; i < appMPlayer.NumberOfMenuItems + 1; i++)
+    for (i = 0; i <= appMPlayer.IndexOfMenuItems; i++)
         appClearItem(&appMPlayer.menuItems[i]);
 
     appResetStruct();
@@ -155,7 +155,7 @@
 {
     int i;
 
-    for (i = 0; i < appMPlayer.NumberOfMainItems + 1; i++) {
+    for (i = 0; i <= appMPlayer.IndexOfMainItems; i++) {
         if (appMPlayer.mainItems[i].message == event) {
             switch (appMPlayer.mainItems[i].type) {
             case itButton:
@@ -176,7 +176,7 @@
         }
     }
 
-    for (i = 0; i < appMPlayer.NumberOfBarItems + 1; i++) {
+    for (i = 0; i <= appMPlayer.IndexOfBarItems; i++) {
         if (appMPlayer.barItems[i].message == event) {
             switch (appMPlayer.barItems[i].type) {
             case itButton:
@@ -202,14 +202,14 @@
 {
     int i;
 
-    for (i = 0; i < appMPlayer.NumberOfMainItems + 1; i++) {
+    for (i = 0; i <= appMPlayer.IndexOfMainItems; i++) {
         if (appMPlayer.mainItems[i].message == event) {
             appMPlayer.mainItems[i].pressed = set;
             appMPlayer.barItems[i].tmp      = 0;
         }
     }
 
-    for (i = 0; i < appMPlayer.NumberOfBarItems + 1; i++) {
+    for (i = 0; i <= appMPlayer.IndexOfBarItems; i++) {
         if (appMPlayer.barItems[i].message == event) {
             appMPlayer.barItems[i].pressed = set;
             appMPlayer.barItems[i].tmp     = 0;
--- a/gui/app.h	Thu Mar 03 14:13:41 2011 +0000
+++ b/gui/app.h	Thu Mar 03 14:37:47 2011 +0000
@@ -176,13 +176,13 @@
     wsTWindow menuWindow;
     int menuIsPresent;
 
-    int NumberOfMainItems;
+    int IndexOfMainItems;
     wItem mainItems[256];
 
-    int NumberOfBarItems;
+    int IndexOfBarItems;
     wItem barItems[256];
 
-    int NumberOfMenuItems;
+    int IndexOfMenuItems;
     wItem menuItems[64];
 } listItems;
 
--- a/gui/mplayer/menu.c	Thu Mar 03 14:13:41 2011 +0000
+++ b/gui/mplayer/menu.c	Thu Mar 03 14:37:47 2011 +0000
@@ -82,7 +82,7 @@
    return;
   }
 
- for( i=0;i<=appMPlayer.NumberOfMenuItems;i++ )
+ for( i=0;i<=appMPlayer.IndexOfMenuItems;i++ )
   {
    if ( wgIsRect( x,y,
          appMPlayer.menuItems[i].x,appMPlayer.menuItems[i].y,
--- a/gui/mplayer/mw.c	Thu Mar 03 14:13:41 2011 +0000
+++ b/gui/mplayer/mw.c	Thu Mar 03 14:37:47 2011 +0000
@@ -88,7 +88,7 @@
    btnModify( evSetVolume,guiIntfStruct.Volume );
 
    fast_memcpy( mplDrawBuffer,appMPlayer.main.Bitmap.Image,appMPlayer.main.Bitmap.ImageSize );
-   Render( &appMPlayer.mainWindow,appMPlayer.mainItems,appMPlayer.NumberOfMainItems,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize );
+   Render( &appMPlayer.mainWindow,appMPlayer.mainItems,appMPlayer.IndexOfMainItems,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize );
    mplMainRender=0;
   }
  wsPutImage( &appMPlayer.mainWindow );
@@ -403,7 +403,7 @@
  static int     SelectedItem = -1;
         int     currentselected = -1;
 
- for ( i=0;i < appMPlayer.NumberOfMainItems + 1;i++ )
+ for ( i=0;i <= appMPlayer.IndexOfMainItems;i++ )
   if ( ( appMPlayer.mainItems[i].pressed != btnDisabled )&&
        ( wgIsRect( X,Y,appMPlayer.mainItems[i].x,appMPlayer.mainItems[i].y,appMPlayer.mainItems[i].x+appMPlayer.mainItems[i].width,appMPlayer.mainItems[i].y+appMPlayer.mainItems[i].height ) ) )
    { currentselected=i; break; }
--- a/gui/mplayer/pb.c	Thu Mar 03 14:13:41 2011 +0000
+++ b/gui/mplayer/pb.c	Thu Mar 03 14:37:47 2011 +0000
@@ -106,7 +106,7 @@
    vo_mouse_autohide=0;
 
    fast_memcpy( mplPBDrawBuffer,appMPlayer.bar.Bitmap.Image,appMPlayer.bar.Bitmap.ImageSize );
-   Render( &appMPlayer.barWindow,appMPlayer.barItems,appMPlayer.NumberOfBarItems,mplPBDrawBuffer,appMPlayer.bar.Bitmap.ImageSize );
+   Render( &appMPlayer.barWindow,appMPlayer.barItems,appMPlayer.IndexOfBarItems,mplPBDrawBuffer,appMPlayer.bar.Bitmap.ImageSize );
    wsConvert( &appMPlayer.barWindow,mplPBDrawBuffer,appMPlayer.bar.Bitmap.ImageSize );
   }
  wsPutImage( &appMPlayer.barWindow );
@@ -122,7 +122,7 @@
  static int     SelectedItem = -1;
 	int     currentselected = -1;
 
- for ( i=0;i < appMPlayer.NumberOfBarItems + 1;i++ )
+ for ( i=0;i <= appMPlayer.IndexOfBarItems;i++ )
    if ( ( appMPlayer.barItems[i].pressed != btnDisabled )&&
       ( wgIsRect( X,Y,appMPlayer.barItems[i].x,appMPlayer.barItems[i].y,appMPlayer.barItems[i].x+appMPlayer.barItems[i].width,appMPlayer.barItems[i].y+appMPlayer.barItems[i].height ) ) )
     { currentselected=i; break; }
--- a/gui/skin/skin.c	Thu Mar 03 14:13:41 2011 +0000
+++ b/gui/skin/skin.c	Thu Mar 03 14:37:47 2011 +0000
@@ -186,17 +186,17 @@
 
     if (!strncmp(in, "main", 4)) {
         currSection  = &appMPlayer.main;
-        currSubItem  = &appMPlayer.NumberOfMainItems;
+        currSubItem  = &appMPlayer.IndexOfMainItems;
         currSubItems = appMPlayer.mainItems;
     } else if (!strncmp(in, "sub", 3))
         currSection = &appMPlayer.sub;
     else if (!strncmp(in, "playbar", 7)) {
         currSection  = &appMPlayer.bar;
-        currSubItem  = &appMPlayer.NumberOfBarItems;
+        currSubItem  = &appMPlayer.IndexOfBarItems;
         currSubItems = appMPlayer.barItems;
     } else if (!strncmp(in, "menu", 4)) {
         currSection  = &appMPlayer.menuBase;
-        currSubItem  = &appMPlayer.NumberOfMenuItems;
+        currSubItem  = &appMPlayer.IndexOfMenuItems;
         currSubItems = appMPlayer.menuItems;
     } else
         ERRORMESSAGE(MSGTR_UNKNOWNWINDOWTYPE);
@@ -452,21 +452,21 @@
 
     message = 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;
+    defList->IndexOfMenuItems++;
+    defList->menuItems[defList->IndexOfMenuItems].x      = x;
+    defList->menuItems[defList->IndexOfMenuItems].y      = y;
+    defList->menuItems[defList->IndexOfMenuItems].width  = sx;
+    defList->menuItems[defList->IndexOfMenuItems].height = sy;
 
-    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] menuitem: %d\n", defList->NumberOfMenuItems);
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "\n[skin] menuitem: %d\n", defList->IndexOfMenuItems);
     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].message = message) == -1)
+    if ((defList->menuItems[defList->IndexOfMenuItems].message = message) == -1)
         ERRORMESSAGE(MSGTR_SKIN_BITMAP_UnknownMessage, tmp);
 
-    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  message: %d\n", defList->mainItems[defList->NumberOfMainItems].message);
+    mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]  message: %d\n", defList->mainItems[defList->IndexOfMainItems].message);
 
-    defList->menuItems[defList->NumberOfMenuItems].Bitmap.Image = NULL;
+    defList->menuItems[defList->IndexOfMenuItems].Bitmap.Image = NULL;
     return 0;
 }