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

ib subversion at mplayerhq.hu
Thu Mar 3 15:37:47 CET 2011


Author: ib
Date: Thu Mar  3 15:37:47 2011
New Revision: 33018

Log:
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.

Modified:
   trunk/gui/app.c
   trunk/gui/app.h
   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	Thu Mar  3 15:13:41 2011	(r33017)
+++ trunk/gui/app.c	Thu Mar  3 15:37:47 2011	(r33018)
@@ -106,9 +106,9 @@ static void appClearItem(wItem *item)
 
 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 @@ void appInitStruct(void)
     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 @@ void btnModify(int event, float state)
 {
     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 @@ void btnModify(int event, float state)
         }
     }
 
-    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 @@ void btnSet(int event, int set)
 {
     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;

Modified: trunk/gui/app.h
==============================================================================
--- trunk/gui/app.h	Thu Mar  3 15:13:41 2011	(r33017)
+++ trunk/gui/app.h	Thu Mar  3 15:37:47 2011	(r33018)
@@ -176,13 +176,13 @@ typedef struct {
     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;
 

Modified: trunk/gui/mplayer/menu.c
==============================================================================
--- trunk/gui/mplayer/menu.c	Thu Mar  3 15:13:41 2011	(r33017)
+++ trunk/gui/mplayer/menu.c	Thu Mar  3 15:37:47 2011	(r33018)
@@ -82,7 +82,7 @@ void mplMenuMouseHandle( int X,int Y,int
    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,

Modified: trunk/gui/mplayer/mw.c
==============================================================================
--- trunk/gui/mplayer/mw.c	Thu Mar  3 15:13:41 2011	(r33017)
+++ trunk/gui/mplayer/mw.c	Thu Mar  3 15:37:47 2011	(r33018)
@@ -88,7 +88,7 @@ void mplMainDraw( void )
    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 @@ void mplMainMouseHandle( int Button,int 
  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; }

Modified: trunk/gui/mplayer/pb.c
==============================================================================
--- trunk/gui/mplayer/pb.c	Thu Mar  3 15:13:41 2011	(r33017)
+++ trunk/gui/mplayer/pb.c	Thu Mar  3 15:37:47 2011	(r33018)
@@ -106,7 +106,7 @@ static void mplPBDraw( void )
    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 void mplPBMouseHandle( int Button
  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; }

Modified: trunk/gui/skin/skin.c
==============================================================================
--- trunk/gui/skin/skin.c	Thu Mar  3 15:13:41 2011	(r33017)
+++ trunk/gui/skin/skin.c	Thu Mar  3 15:37:47 2011	(r33018)
@@ -186,17 +186,17 @@ static int cmd_window(char *in)
 
     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 @@ static int cmd_menu(char *in)
 
     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;
 }
 


More information about the MPlayer-cvslog mailing list