changeset 32920:8661ae44ef39

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.)
author ib
date Thu, 03 Mar 2011 11:06:42 +0000
parents 933e784fb598
children 448517f556a5
files gui/app.h gui/mplayer/gui_common.c
diffstat 2 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/gui/app.h	Thu Mar 03 09:34:27 2011 +0000
+++ b/gui/app.h	Thu Mar 03 11:06:42 2011 +0000
@@ -126,9 +126,9 @@
 
 // Button states
 
-#define btnPressed  0
+#define btnDisabled 0
 #define btnReleased 1
-#define btnDisabled 2
+#define btnPressed  2
 
 typedef struct {
     int type;
--- a/gui/mplayer/gui_common.c	Thu Mar 03 09:34:27 2011 +0000
+++ b/gui/mplayer/gui_common.c	Thu Mar 03 11:06:42 2011 +0000
@@ -262,7 +262,7 @@
 {
  wItem    * item;
  txSample * image = NULL;
- int        i;
+ int        i, ofs;
 
  image_buffer=db;
  image_width=window->Width;
@@ -270,10 +270,11 @@
  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 @@
      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 @@
 	    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 );