[MPlayer-cvslog] r33007 - in trunk/gui: app.h mplayer/gui_common.c

ib subversion at mplayerhq.hu
Thu Mar 3 12:06:42 CET 2011


Author: ib
Date: Thu Mar  3 12:06:42 2011
New Revision: 33007

Log:
Redefine button states.

This allows a button state initialized all-bits-zero to automatically
be disabled.

(It was intended to be a purely cosmetic patch, but it turned out
that there was a direct dependency between the value of the #defines
and the layout of the skin images. This dependency is now eliminated.)

Modified:
   trunk/gui/app.h
   trunk/gui/mplayer/gui_common.c

Modified: trunk/gui/app.h
==============================================================================
--- trunk/gui/app.h	Thu Mar  3 10:34:27 2011	(r33006)
+++ trunk/gui/app.h	Thu Mar  3 12:06:42 2011	(r33007)
@@ -126,9 +126,9 @@ typedef struct {
 
 // Button states
 
-#define btnPressed  0
+#define btnDisabled 0
 #define btnReleased 1
-#define btnDisabled 2
+#define btnPressed  2
 
 typedef struct {
     int type;

Modified: trunk/gui/mplayer/gui_common.c
==============================================================================
--- trunk/gui/mplayer/gui_common.c	Thu Mar  3 10:34:27 2011	(r33006)
+++ trunk/gui/mplayer/gui_common.c	Thu Mar  3 12:06:42 2011	(r33007)
@@ -262,7 +262,7 @@ void Render( wsTWindow * window,wItem * 
 {
  wItem    * item;
  txSample * image = NULL;
- int        i;
+ int        i, ofs;
 
  image_buffer=db;
  image_width=window->Width;
@@ -270,10 +270,11 @@ void Render( wsTWindow * window,wItem * 
  for( i=0;i < nrItems + 1;i++ )
   {
    item=&Items[i];
+   ofs = (item->pressed == btnPressed ? 0 : (item->pressed == btnReleased ? 1 : 2));
    switch( item->type )
     {
      case itButton:
-          PutImage( &item->Bitmap,item->x,item->y,3,item->pressed );
+          PutImage( &item->Bitmap,item->x,item->y,3,ofs );
           break;
      case itPotmeter:
           if (item->numphases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f );
@@ -282,7 +283,7 @@ void Render( wsTWindow * window,wItem * 
      case itHPotmeter:
           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 );
+          PutImage( &item->Mask,item->x + (int)( ( item->width - item->pwidth ) * item->value / 100.0f ),item->y,3,ofs );
           break;
      case itVPotmeter:
           PutImage( &item->Bitmap,
@@ -291,7 +292,7 @@ void Render( wsTWindow * window,wItem * 
 	    item->numphases * ( 1. - item->value / 100.0f ) );
           PutImage( &item->Mask,
 	    item->x,item->y + (int)( ( item->height - item->pheight ) * ( 1. - item->value / 100.0f ) ),
-	    3,item->pressed );
+	    3,ofs );
           break;
      case itSLabel:
           image=fntRender( item,0,item->label );


More information about the MPlayer-cvslog mailing list