[MPlayer-cvslog] r36994 - in trunk/gui/win32: gui.c widgetrender.c

ib subversion at mplayerhq.hu
Wed Mar 12 12:23:31 CET 2014


Author: ib
Date: Wed Mar 12 12:23:31 2014
New Revision: 36994

Log:
Implement missing vpotmeter for the Win32 GUI.

This item hasn't been rendered so far, and therefore
neither its value would be set nor was there a mouse control.

Modified:
   trunk/gui/win32/gui.c
   trunk/gui/win32/widgetrender.c

Modified: trunk/gui/win32/gui.c
==============================================================================
--- trunk/gui/win32/gui.c	Tue Mar 11 20:50:38 2014	(r36993)
+++ trunk/gui/win32/gui.c	Wed Mar 12 12:23:31 2014	(r36994)
@@ -304,10 +304,10 @@ static void updatedisplay(gui_t *gui, HW
 
     if(!hwnd) return;
 
-    /* load all potmeters hpotmeters */
+    /* load all potmeters hpotmeters vpotmeters */
     for(i=0; i<gui->skin->widgetcount; i++)
     {
-        if(gui->skin->widgets[i]->type == tyHpotmeter || gui->skin->widgets[i]->type == tyPotmeter)
+        if(gui->skin->widgets[i]->type == tyHpotmeter || gui->skin->widgets[i]->type == tyVpotmeter || gui->skin->widgets[i]->type == tyPotmeter)
         {
             if(gui->skin->widgets[i]->msg == evSetVolume)
                 gui->skin->widgets[i]->value = guiInfo.Volume;
@@ -937,6 +937,11 @@ static LRESULT CALLBACK EventProc(HWND h
 
                         item->value = ((item->x - item->wx) * 100.0f) / (float) wd;
                     }
+                    if(item->type == tyVpotmeter)
+                    {
+                        item->y = GET_Y_LPARAM(lParam) - gui->mousewy;
+                        item->value = 100.0f - ((item->y - item->wy)  * 100.0f) / (float) (item->wheight - item->height);
+                    }
                     if(item->type == tyPotmeter)
                     {
                         gui->mousewx = GET_X_LPARAM(lParam) - gui->activewidget->x;

Modified: trunk/gui/win32/widgetrender.c
==============================================================================
--- trunk/gui/win32/widgetrender.c	Tue Mar 11 20:50:38 2014	(r36993)
+++ trunk/gui/win32/widgetrender.c	Wed Mar 12 12:23:31 2014	(r36994)
@@ -304,7 +304,7 @@ void renderwidget(skin_t *skin, image *d
     int y;
 
     if(!dest) return;
-    if((item->type == tyButton) || (item->type == tyHpotmeter) || (item->type == tyPotmeter))
+    if((item->type == tyButton) || (item->type == tyHpotmeter) || (item->type == tyVpotmeter) || (item->type == tyPotmeter))
         img = item->bitmap[0];
 
     if(!img) return;
@@ -327,8 +327,20 @@ void renderwidget(skin_t *skin, image *d
     if(item->type == tyButton)
         render(skin->desktopbpp, dest, find_background(skin,item), item->x, item->y, item->x, item->y, img->width, height, 1);
 
-    if((item->type == tyHpotmeter) || (item->type == tyPotmeter))
+    if((item->type == tyHpotmeter) || (item->type == tyVpotmeter) || (item->type == tyPotmeter))
     {
+        if(item->type == tyVpotmeter)
+        {
+            /* repaint the area behind the slider */
+            render(skin->desktopbpp, dest, find_background(skin, item), item->wx, item->wy, item->wx, item->wy, item->width, item->wheight, 1);
+            item->y = (100 - item->value) * (item->wheight-item->height) / 100 + item->wy;
+            if((item->y + item->height) > (item->wy + item->wheight))
+                item->y = item->wy + item->wheight - item->height;
+            if(item->y < item->wy)
+                item->y = item->wy;
+        }
+        else
+        {
         /* repaint the area behind the slider */
         render(skin->desktopbpp, dest, find_background(skin, item), item->wx, item->wy, item->wx, item->wy, item->wwidth, item->height, 1);
         item->x = item->value * (item->wwidth-item->width) / 100 + item->wx;
@@ -336,6 +348,7 @@ void renderwidget(skin_t *skin, image *d
             item->x = item->wx + item->wwidth - item->width;
         if(item->x < item->wx)
             item->x = item->wx;
+        }
     }
     render(skin->desktopbpp, dest, img, item->x, item->y, 0, y, img->width, height, 1);
 }


More information about the MPlayer-cvslog mailing list