# HG changeset patch # User ib # Date 1299150402 0 # Node ID 8661ae44ef39f8b1bb44e8cf17a1db95b48a3ec5 # Parent 933e784fb5986d4578e6c6b375017bb3c9feca8e 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.) diff -r 933e784fb598 -r 8661ae44ef39 gui/app.h --- 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; diff -r 933e784fb598 -r 8661ae44ef39 gui/mplayer/gui_common.c --- 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 );