[MPlayer-dev-eng] [PATCH] vpotmeter fix

Oded Shimon ods15 at ods15.dyndns.org
Sun Dec 25 18:45:36 CET 2005


Wow, the GUI code is really hairy and scary. Kinda fun though. Anyway, 
Diego, here's your fix, it works well for me, and it makes sense...

I'm giving you the honor/shame of committing this...

- ods15
-------------- next part --------------
Index: Gui/mplayer/mw.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mw.c,v
retrieving revision 1.117
diff -u -r1.117 mw.c
--- Gui/mplayer/mw.c	8 Dec 2005 22:12:56 -0000	1.117
+++ Gui/mplayer/mw.c	25 Dec 2005 17:41:33 -0000
@@ -432,12 +432,16 @@
           switch( itemtype )
            {
             case itPotmeter:
-	    case itVPotmeter:
             case itHPotmeter:
                  btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f );
 		 mplEventHandling( item->msg,item->value );
                  value=item->value;
                  break;
+	    case itVPotmeter:
+                 btnModify( item->msg, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f );
+		 mplEventHandling( item->msg,item->value );
+                 value=item->value;
+                 break;
            }
           mplEventHandling( item->msg,value );
           itemtype=0;
@@ -476,7 +480,7 @@
                  item->value=(float)( X - item->x ) / item->width * 100.0f;
                  goto potihandled;
             case itVPotmeter:
-                 item->value=(float)( Y - item->y ) / item->height * 100.0f;
+                 item->value=(1. - (float)( Y - item->y ) / item->height) * 100.0f;
                  goto potihandled;
             case itHPotmeter:
                  item->value=(float)( X - item->x ) / item->width * 100.0f;
Index: Gui/mplayer/common.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/common.c,v
retrieving revision 1.10
diff -u -r1.10 common.c
--- Gui/mplayer/common.c	8 Dec 2005 22:12:56 -0000	1.10
+++ Gui/mplayer/common.c	25 Dec 2005 17:41:33 -0000
@@ -268,9 +268,9 @@
           PutImage( &item->Bitmap,
 	    item->x,item->y,
 	    item->phases,
-	    item->phases * ( item->value / 100.0f ) );
+	    item->phases * ( 1. - item->value / 100.0f ) );
           PutImage( &item->Mask,
-	    item->x,item->y + (int)( ( item->height - item->psy ) * item->value / 100.0f ),
+	    item->x,item->y + (int)( ( item->height - item->psy ) * ( 1. - item->value / 100.0f ) ),
 	    3,item->pressed );
           break;
      case itSLabel:
Index: Gui/mplayer/pb.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/pb.c,v
retrieving revision 1.7
diff -u -r1.7 pb.c
--- Gui/mplayer/pb.c	8 Dec 2005 22:12:56 -0000	1.7
+++ Gui/mplayer/pb.c	25 Dec 2005 17:41:33 -0000
@@ -154,12 +154,16 @@
 	switch( itemtype )
 	 {
 	  case itPotmeter:
-	  case itVPotmeter:
 	  case itHPotmeter:
 	       btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f );
 	       mplEventHandling( item->msg,item->value );
 	       value=item->value;
 	       break;
+	  case itVPotmeter:
+	       btnModify( item->msg, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f );
+	       mplEventHandling( item->msg,item->value );
+	       value=item->value;
+	       break;
 	 }
 	mplEventHandling( item->msg,value );
 
@@ -188,6 +192,9 @@
 	  case itPotmeter:
 	       item->value=(float)( X - item->x ) / item->width * 100.0f;
 	       goto potihandled;
+	  case itVPotmeter:
+	       item->value=(1. - (float)( Y - item->y ) / item->height) * 100.0f;
+	       goto potihandled;
 	  case itHPotmeter:
 	       item->value=(float)( X - item->x ) / item->width * 100.0f;
 potihandled:


More information about the MPlayer-dev-eng mailing list