[MPlayer-cvslog] r34175 - in trunk/gui/win32: dialogs.h preferences.c

ib subversion at mplayerhq.hu
Mon Oct 3 19:27:45 CEST 2011


Author: ib
Date: Mon Oct  3 19:27:44 2011
New Revision: 34175

Log:
Add idle option to Win32 GUI preferences dialog.

Patch by Stephen Sheldon, sfsheldo gmail com.

Modified:
   trunk/gui/win32/dialogs.h
   trunk/gui/win32/preferences.c

Modified: trunk/gui/win32/dialogs.h
==============================================================================
--- trunk/gui/win32/dialogs.h	Sun Oct  2 23:32:45 2011	(r34174)
+++ trunk/gui/win32/dialogs.h	Mon Oct  3 19:27:44 2011	(r34175)
@@ -122,6 +122,7 @@
 #define ID_TIMER             88
 #define ID_MUTE              89
 #define ID_FULLSCREEN        90
+#define ID_IDLE              91
 
 /* gtk emulation */
 #define GTK_MB_FATAL         0x1

Modified: trunk/gui/win32/preferences.c
==============================================================================
--- trunk/gui/win32/preferences.c	Sun Oct  2 23:32:45 2011	(r34174)
+++ trunk/gui/win32/preferences.c	Mon Oct  3 19:27:44 2011	(r34175)
@@ -56,6 +56,7 @@ static void set_defaults(void)
     gtkCacheSize = 2048;
     gtkAutoSyncOn = 0;
     gtkAutoSync = 0;
+    player_idle_mode = 1;
 }
 
 static LRESULT CALLBACK PrefsWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
@@ -91,42 +92,42 @@ static LRESULT CALLBACK PrefsWndProc(HWN
 
             label = CreateWindow("static", "Extra stereo coefficient:",
                                  WS_CHILD | WS_VISIBLE,
-                                 10, 126, 115, 15, hwnd,
+                                 10, 148, 115, 15, hwnd,
                                  NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
                                  NULL);
             SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
 
             label = CreateWindow("static", "Audio delay:",
                                  WS_CHILD | WS_VISIBLE,
-                                 36, 165, 115, 15, hwnd,
+                                 36, 187, 115, 15, hwnd,
                                  NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
                                  NULL);
             SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
 
             label = CreateWindow("static", "OSD level:",
                                  WS_CHILD | WS_VISIBLE,
-                                 10, 264, 115, 15, hwnd,
+                                 10, 286, 115, 15, hwnd,
                                  NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
                                  NULL);
             SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
 
             label = CreateWindow("static", "DVD device:",
                                  WS_CHILD | WS_VISIBLE,
-                                 80, 363, 115, 15, hwnd,
+                                 80, 385, 115, 15, hwnd,
                                  NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
                                  NULL);
             SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
 
             label = CreateWindow("static", "CD device:",
                                  WS_CHILD | WS_VISIBLE,
-                                 202, 363, 115, 15, hwnd,
+                                 202, 385, 115, 15, hwnd,
                                  NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
                                  NULL);
             SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
 
             label = CreateWindow("static", "Priority:",
                                  WS_CHILD | WS_VISIBLE,
-                                 217, 264, 115, 15, hwnd,
+                                 217, 286, 115, 15, hwnd,
                                  NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
                                  NULL);
             SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
@@ -156,7 +157,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
                                 CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS |
                                 WS_CHILD | WS_VISIBLE |
                                 WS_VSCROLL | WS_TABSTOP,
-                                260, 260, 100, 160, hwnd,
+                                260, 282, 100, 160, hwnd,
                                 (HMENU) ID_PRIO,
                                 ((LPCREATESTRUCT) lParam) -> hInstance,
                                 NULL);
@@ -186,6 +187,14 @@ static LRESULT CALLBACK PrefsWndProc(HWN
                                NULL);
             SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
 
+            btn = CreateWindow("button", "Quit after playing",
+                               WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
+                               25, 101, 150, 25,
+                               hwnd, (HMENU) ID_IDLE,
+                               ((LPCREATESTRUCT) lParam) -> hInstance,
+                               NULL);
+            SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
+
             btn = CreateWindow("button", "Normalize sound",
                                WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
                                205, 35, 150, 25,
@@ -212,7 +221,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
 
             btn = CreateWindow("button", "Enable cache",
                                WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
-                               10, 200, 90, 25,
+                               10, 222, 90, 25,
                                hwnd, (HMENU) ID_CACHE,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
@@ -220,7 +229,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
 
             btn = CreateWindow("button", "Enable autosync",
                                WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
-                               192, 200, 100, 25, hwnd,
+                               192, 222, 100, 25, hwnd,
                                (HMENU) ID_AUTOSYNC,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
@@ -228,7 +237,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
 
             btn = CreateWindow("button", "Display videos in the sub window",
                                WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
-                               85, 227, 250, 25,
+                               85, 249, 250, 25,
                                hwnd, (HMENU) ID_SUBWINDOW,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
@@ -237,7 +246,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
             /* osd level */
             btn = CreateWindow("button", "None",
                                WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
-                               95, 260, 100, 25, hwnd,
+                               95, 282, 100, 25, hwnd,
                                (HMENU) ID_NONE,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
@@ -245,7 +254,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
 
             btn = CreateWindow("button", "Timer and indicators",
                                WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
-                               95, 280, 180, 25, hwnd,
+                               95, 302, 180, 25, hwnd,
                                (HMENU) ID_OSD1,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
@@ -253,7 +262,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
 
             btn = CreateWindow("button", "Progress bar only",
                                WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
-                               95, 300, 180, 25, hwnd,
+                               95, 322, 180, 25, hwnd,
                                (HMENU) ID_OSD2,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
@@ -261,7 +270,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
 
             btn = CreateWindow("button", "Timer, percentage, and total time",
                                WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
-                               95, 320, 180, 25, hwnd,
+                               95, 342, 180, 25, hwnd,
                                (HMENU) ID_OSD3,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
@@ -269,7 +278,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
 
             btn = CreateWindow("button", "Apply",
                                WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
-                               199, 395, 80, 25, hwnd,
+                               199, 417, 80, 25, hwnd,
                                (HMENU) ID_APPLY,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
@@ -277,7 +286,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
 
             btn = CreateWindow("button", "Cancel",
                                WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
-                               285, 395, 80, 25, hwnd,
+                               285, 417, 80, 25, hwnd,
                                (HMENU) ID_CANCEL,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
@@ -285,7 +294,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
 
             btn = CreateWindow("button", "Defaults",
                                WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
-                               4, 395, 80, 25, hwnd,
+                               4, 417, 80, 25, hwnd,
                                (HMENU) ID_DEFAULTS,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
@@ -296,7 +305,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
                                   WS_CHILD | WS_VISIBLE | WS_TABSTOP |
                                   WS_DISABLED | TBS_HORZ |
                                   TBS_BOTTOM | TBS_NOTICKS,
-                                  120, 120, 245, 35, hwnd,
+                                  120, 142, 245, 35, hwnd,
                                   (HMENU) ID_TRACKBAR1,
                                   ((LPCREATESTRUCT) lParam) -> hInstance,
                                   NULL);
@@ -307,7 +316,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
                                   WS_CHILD | WS_VISIBLE | WS_TABSTOP |
                                   WS_DISABLED | TBS_HORZ |
                                   TBS_BOTTOM | TBS_NOTICKS,
-                                  120, 160, 245, 35, hwnd,
+                                  120, 182, 245, 35, hwnd,
                                   (HMENU) ID_TRACKBAR2,
                                   ((LPCREATESTRUCT) lParam) -> hInstance,
                                   NULL);
@@ -317,7 +326,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
             edit1 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "cache",
                                    WS_CHILD | WS_VISIBLE | WS_DISABLED |
                                    ES_LEFT | ES_AUTOHSCROLL,
-                                   105, 203, 40, 20, hwnd,
+                                   105, 225, 40, 20, hwnd,
                                    (HMENU) ID_EDIT1,
                                    ((LPCREATESTRUCT) lParam) -> hInstance,
                                    NULL);
@@ -326,7 +335,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
             updown1 = CreateUpDownControl(WS_CHILD | WS_VISIBLE |
                                           WS_DISABLED | UDS_SETBUDDYINT |
                                           UDS_ARROWKEYS | UDS_NOTHOUSANDS,
-                                          145, 203, 20, 20, hwnd,
+                                          145, 225, 20, 20, hwnd,
                                           ID_UPDOWN1,
                                           ((LPCREATESTRUCT) lParam) -> hInstance,
                                           (HWND)edit1, 0, 0, 0);
@@ -336,7 +345,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
             edit2 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "autosync",
                                    WS_CHILD | WS_VISIBLE | WS_DISABLED |
                                    ES_LEFT | ES_AUTOHSCROLL,
-                                   300, 203, 40, 20, hwnd,
+                                   300, 225, 40, 20, hwnd,
                                    (HMENU) ID_EDIT2,
                                    ((LPCREATESTRUCT) lParam) -> hInstance,
                                    NULL);
@@ -345,7 +354,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
             updown2 = CreateUpDownControl(WS_CHILD | WS_VISIBLE |
                                           WS_DISABLED | UDS_SETBUDDYINT |
                                           UDS_ARROWKEYS | UDS_NOTHOUSANDS,
-                                          340, 203, 20, 20, hwnd,
+                                          340, 225, 20, 20, hwnd,
                                           ID_UPDOWN2,
                                           ((LPCREATESTRUCT) lParam) -> hInstance,
                                           (HWND)edit2, 0, 0, 0);
@@ -355,7 +364,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
             edit3 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", NULL,
                                    WS_CHILD | WS_VISIBLE |
                                    ES_LEFT | ES_AUTOHSCROLL,
-                                   145, 360, 20, 20, hwnd,
+                                   145, 382, 20, 20, hwnd,
                                    (HMENU) ID_DVDDEVICE,
                                    ((LPCREATESTRUCT) lParam) -> hInstance,
                                    NULL);
@@ -364,7 +373,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
             edit3 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", NULL,
                                    WS_CHILD | WS_VISIBLE |
                                    ES_LEFT| ES_AUTOHSCROLL,
-                                   260, 360, 20, 20, hwnd,
+                                   260, 382, 20, 20, hwnd,
                                    (HMENU) ID_CDDEVICE,
                                    ((LPCREATESTRUCT) lParam) -> hInstance,
                                    NULL);
@@ -416,6 +425,8 @@ static LRESULT CALLBACK PrefsWndProc(HWN
                 SendDlgItemMessage(hwnd, ID_DOUBLE, BM_SETCHECK, 1, 0);
             if(vo_directrendering)
                 SendDlgItemMessage(hwnd, ID_DIRECT, BM_SETCHECK, 1, 0);
+            if(!player_idle_mode)
+                SendDlgItemMessage(hwnd, ID_IDLE, BM_SETCHECK, 1, 0);
             if(frame_dropping)
                 SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_SETCHECK, 1, 0);
             if(gtkAONorm)
@@ -554,6 +565,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
                     SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETPOS32, 0, (LPARAM)gtkAutoSync);
                     SendDlgItemMessage(hwnd, ID_DOUBLE, BM_SETCHECK, 0, 0);
                     SendDlgItemMessage(hwnd, ID_DIRECT, BM_SETCHECK, 0, 0);
+                    SendDlgItemMessage(hwnd, ID_IDLE, BM_SETCHECK, 0, 0);
                     SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_SETCHECK, 0, 0);
                     SendDlgItemMessage(hwnd, ID_NORMALIZE, BM_SETCHECK, 0, 0);
                     SendDlgItemMessage(hwnd, ID_SOFTMIX, BM_SETCHECK, 0, 0);
@@ -606,6 +618,11 @@ static LRESULT CALLBACK PrefsWndProc(HWN
                         vo_directrendering = 1;
                     else vo_directrendering = 0;
 
+                    /* quit after playing */
+                    if(SendDlgItemMessage(hwnd, ID_IDLE, BM_GETCHECK, 0, 0) == BST_CHECKED)
+                        player_idle_mode = 0;
+                    else player_idle_mode = 1;
+
                     /* frame dropping */
                     if(SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_GETCHECK, 0, 0) == BST_CHECKED)
                         frame_dropping = 1;
@@ -696,14 +713,14 @@ void display_prefswindow(gui_t *gui)
     wc.lpszMenuName  = NULL;
     RegisterClass(&wc);
     x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (375 / 2);
-    y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (452 / 2);
+    y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (474 / 2);
     hWnd = CreateWindow("MPlayer - Preferences",
                         "MPlayer - Preferences",
                         WS_POPUPWINDOW | WS_CAPTION,
                         x,
                         y,
                         375,
-                        452,
+                        474,
                         NULL,
                         NULL,
                         hInstance,


More information about the MPlayer-cvslog mailing list