changeset 37151:c63629427fde

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.
author ib
date Wed, 06 Aug 2014 16:35:38 +0000
parents 67efc9d84be2
children 3dca2acb98ac
files gui/win32/gui.c gui/win32/gui.h gui/win32/interface.c
diffstat 3 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gui/win32/gui.c	Wed Aug 06 13:03:22 2014 +0000
+++ b/gui/win32/gui.c	Wed Aug 06 16:35:38 2014 +0000
@@ -237,6 +237,20 @@
     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 @@
     /* 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 */
--- a/gui/win32/gui.h	Wed Aug 06 13:03:22 2014 +0000
+++ b/gui/win32/gui.h	Wed Aug 06 16:35:38 2014 +0000
@@ -85,6 +85,9 @@
     int playlistwindow;
     int aboutwindow;
 
+    float default_volume;
+    float default_balance;
+
     skin_t *skin;
     playlist_t *playlist;
 
--- a/gui/win32/interface.c	Wed Aug 06 13:03:22 2014 +0000
+++ b/gui/win32/interface.c	Wed Aug 06 16:35:38 2014 +0000
@@ -537,6 +537,9 @@
     /* 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 @@
                 guiInfo.AudioChannels = 0;
                 guiInfo.AudioPassthrough = FALSE;
             }
+            guiSetEvent(evSetVolume);
+            guiSetEvent(evSetBalance);
             if(IsWindowVisible(mygui->videowindow) && !guiInfo.VideoWindow)
                 ShowWindow(mygui->videowindow, SW_HIDE);
             break;