[MPlayer-cvslog] r37247 - in trunk/gui/win32: gui.c gui.h interface.c

ib subversion at mplayerhq.hu
Wed Aug 6 18:35:39 CEST 2014


Author: ib
Date: Wed Aug  6 18:35:38 2014
New Revision: 37247

Log:
Apply skin defaults in Win32 GUI.

The starting defaults for volume, balance and movie position are defined
in the skin used by the GUI. So far, the Win32 GUI has completely ignored
these.

Based on a patch by Stephen Sheldon, sfsheldo gmail com.

Modified:
   trunk/gui/win32/gui.c
   trunk/gui/win32/gui.h
   trunk/gui/win32/interface.c

Modified: trunk/gui/win32/gui.c
==============================================================================
--- trunk/gui/win32/gui.c	Wed Aug  6 15:03:22 2014	(r37246)
+++ trunk/gui/win32/gui.c	Wed Aug  6 18:35:38 2014	(r37247)
@@ -237,6 +237,20 @@ static int get_windowtype(HWND hwnd)
     return -1;
 }
 
+static void get_widgetvalue(skin_t *skin, int event, float *value)
+{
+    unsigned int i;
+
+    if (!skin) return;
+
+    for (i=0; i<skin->widgetcount; i++)
+        if (skin->widgets[i]->msg == event)
+        {
+            *value = skin->widgets[i]->value;
+            return;
+        }
+}
+
 static void uninit(gui_t *gui)
 {
     if(gui->skin) destroy_window(gui);
@@ -1659,6 +1673,17 @@ int create_window(gui_t *gui, char *skin
     /* enable drag and drop support */
     DragAcceptFiles(gui->mainwindow, TRUE);
 
+    /* set defaults */
+    gui->default_volume = 50.0f;
+    gui->default_balance = 50.0f;
+
+    /* get defaults from skin */
+    get_widgetvalue(gui->skin, evSetVolume, &gui->default_volume);
+    get_widgetvalue(gui->skin, evSetBalance, &gui->default_balance);
+    get_widgetvalue(gui->skin, evSetMoviePosition, &guiInfo.Position);
+
+    if (guiInfo.Position) gui->playercontrol(evSetMoviePosition);
+
     updatedisplay(gui, gui->mainwindow);
 
     /* display */

Modified: trunk/gui/win32/gui.h
==============================================================================
--- trunk/gui/win32/gui.h	Wed Aug  6 15:03:22 2014	(r37246)
+++ trunk/gui/win32/gui.h	Wed Aug  6 18:35:38 2014	(r37247)
@@ -85,6 +85,9 @@ struct gui_t
     int playlistwindow;
     int aboutwindow;
 
+    float default_volume;
+    float default_balance;
+
     skin_t *skin;
     playlist_t *playlist;
 

Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c	Wed Aug  6 15:03:22 2014	(r37246)
+++ trunk/gui/win32/interface.c	Wed Aug  6 18:35:38 2014	(r37247)
@@ -537,6 +537,9 @@ void guiInit(void)
     /* Wait until the gui is created */
     while(!mygui) Sleep(100);
     mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] GUI thread started.\n");
+
+    guiInfo.Volume = mygui->default_volume;
+    guiInfo.Balance = mygui->default_balance;
 }
 
 void guiDone(void)
@@ -636,6 +639,8 @@ int gui(int what, void *data)
                 guiInfo.AudioChannels = 0;
                 guiInfo.AudioPassthrough = FALSE;
             }
+            guiSetEvent(evSetVolume);
+            guiSetEvent(evSetBalance);
             if(IsWindowVisible(mygui->videowindow) && !guiInfo.VideoWindow)
                 ShowWindow(mygui->videowindow, SW_HIDE);
             break;


More information about the MPlayer-cvslog mailing list