Mercurial > mplayer.hg
changeset 36898:049db0aeea85
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.
author | ib |
---|---|
date | Wed, 12 Mar 2014 11:23:31 +0000 |
parents | 38234a308fd3 |
children | a75d1fce0822 |
files | gui/win32/gui.c gui/win32/widgetrender.c |
diffstat | 2 files changed, 22 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/win32/gui.c Tue Mar 11 19:50:38 2014 +0000 +++ b/gui/win32/gui.c Wed Mar 12 11:23:31 2014 +0000 @@ -304,10 +304,10 @@ 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 @@ 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;
--- a/gui/win32/widgetrender.c Tue Mar 11 19:50:38 2014 +0000 +++ b/gui/win32/widgetrender.c Wed Mar 12 11:23:31 2014 +0000 @@ -304,7 +304,7 @@ 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 @@ 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 @@ 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); }