[MPlayer-cvslog] r37016 - in trunk: Changelog DOCS/xml/cs/skin.xml DOCS/xml/de/skin.xml DOCS/xml/en/skin.xml DOCS/xml/es/skin.xml DOCS/xml/fr/skin.xml DOCS/xml/hu/skin.xml DOCS/xml/pl/skin.xml DOCS/xml/ru/skin.xml ...

ib subversion at mplayerhq.hu
Mon Mar 17 13:29:47 CET 2014


Author: ib
Date: Mon Mar 17 13:29:46 2014
New Revision: 37016

Log:
Replace old item 'potmeter' by new item 'pimage'.

Recent versions of the X11/GTK GUI didn't allow to control a potmeter,
because that didn't seem to make any sense.

In order to get rid of the confusing potmeter that doesn't distinguish
from a hpotmeter and in order to allow the more useful behaviour recent
versions of the X11/GTK GUI have been utilized (and because we're still
supporting item 'potmeter' for reasons of compatibility with old skins),
introduce new item 'pimage' that reuses most of the current potmeter
code.

Additionally, remove remaining code and documentation of 'potmeter'.

Modified:
   trunk/Changelog
   trunk/gui/app/app.h
   trunk/gui/app/gui.h
   trunk/gui/skin/skin.c
   trunk/gui/ui/main.c
   trunk/gui/ui/playbar.c
   trunk/gui/ui/render.c
   trunk/gui/win32/gui.c
   trunk/gui/win32/skinload.c
   trunk/gui/win32/skinload.h
   trunk/gui/win32/widgetrender.c

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/xml/cs/skin.xml
   trunk/DOCS/xml/de/skin.xml
   trunk/DOCS/xml/en/skin.xml
   trunk/DOCS/xml/es/skin.xml
   trunk/DOCS/xml/fr/skin.xml
   trunk/DOCS/xml/hu/skin.xml
   trunk/DOCS/xml/pl/skin.xml
   trunk/DOCS/xml/ru/skin.xml

Modified: trunk/Changelog
==============================================================================
--- trunk/Changelog	Sun Mar 16 14:30:18 2014	(r37015)
+++ trunk/Changelog	Mon Mar 17 13:29:46 2014	(r37016)
@@ -40,6 +40,7 @@ MPlayer
     * Console message with information on deprecated (but still supported)
       entries in the skin configuration file
     * New symbol character (r) and new dynamic label variables ($D, $U, $P)
+    * New item: pimage
 
   1.1: "We gave up on 1.0"
 

Modified: trunk/gui/app/app.h
==============================================================================
--- trunk/gui/app/app.h	Sun Mar 16 14:30:18 2014	(r37015)
+++ trunk/gui/app/app.h	Mon Mar 17 13:29:46 2014	(r37016)
@@ -100,7 +100,7 @@ enum {
     itDLabel,
     itHPotmeter,
     itVPotmeter,
-    itPotmeter,
+    itPimage,
     itMenu,
     itPLMButton = 100,
     itPRMButton

Modified: trunk/gui/app/gui.h
==============================================================================
--- trunk/gui/app/gui.h	Sun Mar 16 14:30:18 2014	(r37015)
+++ trunk/gui/app/gui.h	Mon Mar 17 13:29:46 2014	(r37016)
@@ -51,6 +51,6 @@
 #define hasButton(item) (item.type == itButton || item.type == itHPotmeter || item.type == itVPotmeter)
 
 /// Check whether #guiItem @a item utilizes member 'value'
-#define hasValue(item) (item.type == itHPotmeter || item.type == itVPotmeter || item.type == itPotmeter)
+#define hasValue(item) (item.type == itHPotmeter || item.type == itVPotmeter || item.type == itPimage)
 
 #endif /* MPLAYER_GUI_GUI_H */

Modified: trunk/gui/skin/skin.c
==============================================================================
--- trunk/gui/skin/skin.c	Sun Mar 16 14:30:18 2014	(r37015)
+++ trunk/gui/skin/skin.c	Mon Mar 17 13:29:46 2014	(r37016)
@@ -713,6 +713,8 @@ static int item_vpotmeter(char *in)
  *
  *        Syntax: potmeter=phases,numphases,default,x,y,width,height,message
  *
+ * @note THIS ITEM IS DEPRECATED.
+ *
  * @param in definition to be analyzed
  *
  * @return 0 (ok) or 1 (error)
@@ -727,13 +729,25 @@ static int item_potmeter(char *in)
     snprintf(param, sizeof(param), "NULL,0,0,%s", in);
 
     return item_hpotmeter(param);
-/*
+}
+
+/**
+ * @brief Parse a @a pimage definition.
+ *
+ *        Syntax: pimage=phases,numphases,default,x,y,width,height,message
+ *
+ * @param in definition to be analyzed
+ *
+ * @return 0 (ok) or 1 (error)
+ */
+static int item_pimage(char *in)
+{
     unsigned char phfname[256];
     unsigned char buf[512];
     int ph, d, x, y, w, h, message;
     guiItem *item;
 
-    if (!window_item("potmeter"))
+    if (!window_item("pimage"))
         return 1;
 
     if (in_window("video"))
@@ -760,7 +774,7 @@ static int item_potmeter(char *in)
     else
         skin_legacy("evSetURL", buf);
 
-    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    potmeter image: %s %d,%d %dx%d\n", phfname, x, y, w, h);
+    mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]    pimage image: %s %d,%d %dx%d\n", phfname, x, y, w, h);
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     numphases: %d, default: %d%%\n", ph, d);
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[skin]     message: %s (#%d)\n", buf, message);
 
@@ -769,7 +783,7 @@ static int item_potmeter(char *in)
     if (!item)
         return 1;
 
-    item->type      = itPotmeter;
+    item->type      = itPimage;
     item->x         = x;
     item->y         = y;
     item->width     = w;
@@ -791,7 +805,6 @@ static int item_potmeter(char *in)
     }
 
     return 0;
-*/
 }
 
 /**
@@ -1024,6 +1037,7 @@ static _item skinItem[] = {
     { "font",       item_font       },
     { "hpotmeter",  item_hpotmeter  },
     { "menu",       item_menu       },
+    { "pimage",     item_pimage     },
     { "potmeter",   item_potmeter   }, // legacy
     { "section",    item_section    },
     { "selected",   item_selected   },

Modified: trunk/gui/ui/main.c
==============================================================================
--- trunk/gui/ui/main.c	Sun Mar 16 14:30:18 2014	(r37015)
+++ trunk/gui/ui/main.c	Mon Mar 17 13:29:46 2014	(r37016)
@@ -146,7 +146,6 @@ static void uiMainMouse( int Button,int 
           value=0;
           switch( itemtype )
            {
-            case itPotmeter:
             case itHPotmeter:
                  btnModify( item->message,100.0 * ( X - item->x ) / item->width );
 		 uiEvent( item->message,item->value );
@@ -173,7 +172,7 @@ rollerhandled:
           if (currentselected != - 1)
            {
             item=&guiApp.mainItems[currentselected];
-            if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) )
+            if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter ) )
              {
               item->value+=value;
               btnModify( item->message,item->value );
@@ -196,7 +195,6 @@ rollerhandled:
             case itVPotmeter:
                  item->value=100.0 - 100.0 * ( Y - item->y ) / item->height;
                  goto potihandled;
-            case itPotmeter:
             case itHPotmeter:
                  item->value=100.0 * ( X - item->x ) / item->width;
 potihandled:

Modified: trunk/gui/ui/playbar.c
==============================================================================
--- trunk/gui/ui/playbar.c	Sun Mar 16 14:30:18 2014	(r37015)
+++ trunk/gui/ui/playbar.c	Mon Mar 17 13:29:46 2014	(r37016)
@@ -175,7 +175,6 @@ static void uiPlaybarMouse( int Button, 
 
 	switch( itemtype )
 	 {
-	  case itPotmeter:
 	  case itHPotmeter:
 	       btnModify( item->message,100.0 * ( X - item->x ) / item->width);
 	       uiEvent( item->message,item->value );
@@ -198,7 +197,7 @@ rollerhandled:
         if (currentselected != - 1)
          {
           item=&guiApp.playbarItems[currentselected];
-          if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) )
+          if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter ) )
            {
             item->value+=value;
             btnModify( item->message,item->value );
@@ -217,7 +216,6 @@ rollerhandled:
 	  case itVPotmeter:
 	       item->value=100.0 - 100.0 * ( Y - item->y ) / item->height;
 	       goto potihandled;
-	  case itPotmeter:
 	  case itHPotmeter:
 	       item->value=100.0 * ( X - item->x ) / item->width;
 potihandled:

Modified: trunk/gui/ui/render.c
==============================================================================
--- trunk/gui/ui/render.c	Sun Mar 16 14:30:18 2014	(r37015)
+++ trunk/gui/ui/render.c	Mon Mar 17 13:29:46 2014	(r37016)
@@ -358,7 +358,7 @@ void RenderAll(wsWindow *window, guiItem
             PutImage(&item->Bitmap, item->x, item->y, 3, ofs);
             break;
 
-        case itPotmeter:
+        case itPimage:
 
             if (item->numphases == 1)
                 SimplePotmeterPutImage(&item->Bitmap, item->x, item->y, item->value / 100.0);

Modified: trunk/gui/win32/gui.c
==============================================================================
--- trunk/gui/win32/gui.c	Sun Mar 16 14:30:18 2014	(r37015)
+++ trunk/gui/win32/gui.c	Mon Mar 17 13:29:46 2014	(r37016)
@@ -304,10 +304,10 @@ static void updatedisplay(gui_t *gui, HW
 
     if(!hwnd) return;
 
-    /* load all potmeters hpotmeters vpotmeters */
+    /* load all hpotmeters vpotmeters pimages */
     for(i=0; i<gui->skin->widgetcount; i++)
     {
-        if(gui->skin->widgets[i]->type == tyHpotmeter || gui->skin->widgets[i]->type == tyVpotmeter || gui->skin->widgets[i]->type == tyPotmeter)
+        if(gui->skin->widgets[i]->type == tyHpotmeter || gui->skin->widgets[i]->type == tyVpotmeter || gui->skin->widgets[i]->type == tyPimage)
         {
             if(gui->skin->widgets[i]->msg == evSetVolume)
                 gui->skin->widgets[i]->value = guiInfo.Volume;
@@ -825,7 +825,7 @@ static LRESULT CALLBACK EventProc(HWND h
             gui->mousey = GET_Y_LPARAM(lParam);
             /* inside a widget */
             gui->activewidget = clickedinsidewidget(gui, get_windowtype(hWnd), gui->mousex, gui->mousey);
-            if(gui->activewidget)
+            if(gui->activewidget && gui->activewidget->type != tyPimage)
             {
                 gui->activewidget->pressed = 1;
                 gui->mousewx = gui->mousex - gui->activewidget->x;
@@ -942,13 +942,8 @@ static LRESULT CALLBACK EventProc(HWND h
                         item->y = GET_Y_LPARAM(lParam) - gui->mousewy;
                         item->value = 100.0 - 100.0 * (item->y - item->wy) / (item->wheight - item->height);
                     }
-                    if(item->type == tyPotmeter)
-                    {
-                        gui->mousewx = GET_X_LPARAM(lParam) - gui->activewidget->x;
-                        item->value = 100.0 * gui->mousewx / item->wwidth;
-                    }
 
-                    if((item->type == tyPotmeter) || (item->type == tyHpotmeter) || (item->type == tyVpotmeter))
+                    if((item->type == tyHpotmeter) || (item->type == tyVpotmeter))
                     {
                         /* Bound checks */
                         if(item->value > 100.0f)

Modified: trunk/gui/win32/skinload.c
==============================================================================
--- trunk/gui/win32/skinload.c	Sun Mar 16 14:30:18 2014	(r37015)
+++ trunk/gui/win32/skinload.c	Mon Mar 17 13:29:46 2014	(r37016)
@@ -421,12 +421,12 @@ static void addwidget(skin_t *skin, wind
                 mywidget->wx, mywidget->wy, mywidget->wwidth, mywidget->wwidth,
                 mywidget->msg);
     }
-    else if(!strncmp(desc, "potmeter", 8))
+    else if(!strncmp(desc, "pimage", 6))
     {
         int base = counttonextchar(desc, '=') + 1;
         int i;
-        /* potmeter = phases, numphases, default, X, Y, width, height, message */
-        mywidget->type = tyPotmeter;
+        /* pimage = phases, numphases, default, X, Y, width, height, message */
+        mywidget->type = tyPimage;
         mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base));
         mywidget->phases = atoi(findnextstring(temp, desc, &base));
         mywidget->value = atof(findnextstring(temp, desc, &base));
@@ -447,7 +447,7 @@ static void addwidget(skin_t *skin, wind
                 break;
             }
         }
-        mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [POTMETER] %s %i %i %i %f %i %i msg %i\n",
+        mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[SKIN] [ITEM] [PIMAGE] %s %i %i %i %f %i %i msg %i\n",
                 (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL,
                 mywidget->width, mywidget->height,
                 mywidget->phases, mywidget->value,

Modified: trunk/gui/win32/skinload.h
==============================================================================
--- trunk/gui/win32/skinload.h	Sun Mar 16 14:30:18 2014	(r37015)
+++ trunk/gui/win32/skinload.h	Mon Mar 17 13:29:46 2014	(r37016)
@@ -117,7 +117,7 @@ skin_t *loadskin(char *skindir, int desk
 #define tyButton        2
 #define tyHpotmeter     3
 #define tyVpotmeter     4
-#define tyPotmeter      5
+#define tyPimage        5
 #define tyMenu          6
 #define tySlabel        7
 #define tyDlabel        8

Modified: trunk/gui/win32/widgetrender.c
==============================================================================
--- trunk/gui/win32/widgetrender.c	Sun Mar 16 14:30:18 2014	(r37015)
+++ trunk/gui/win32/widgetrender.c	Mon Mar 17 13:29:46 2014	(r37016)
@@ -318,13 +318,13 @@ void renderwidget(skin_t *skin, image *d
     int y;
 
     if(!dest) return;
-    if((item->type == tyButton) || (item->type == tyHpotmeter) || (item->type == tyVpotmeter) || (item->type == tyPotmeter))
+    if((item->type == tyButton) || (item->type == tyHpotmeter) || (item->type == tyVpotmeter) || (item->type == tyPimage))
         img = item->bitmap[0];
 
     if(!img) return;
 
     y = item->y;
-    if(/* item->type == tyPotmeter */ /* legacy (potmeter) */ item->type == tyHpotmeter && item->width == item->wwidth)
+    if(item->type == tyPimage || /* legacy (potmeter) */ (item->type == tyHpotmeter && item->width == item->wwidth))
     {
         height = img->height / item->phases;
         y =  height * (int)(item->value * item->phases / 100);
@@ -341,7 +341,7 @@ 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 == tyVpotmeter) || (item->type == tyPotmeter))
+    if((item->type == tyHpotmeter) || (item->type == tyVpotmeter) || (item->type == tyPimage))
     {
         if(item->type == tyVpotmeter)
         {


More information about the MPlayer-cvslog mailing list