annotate gui/win32/gui.c @ 35501:7bb176fac55c

Use boolean symbolic constants in Win32 GUI. Use them wherever suitable and useful to make code easier to read.
author ib
date Tue, 04 Dec 2012 20:06:43 +0000
parents f42cc2361ee4
children baf53d200292
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1 /*
23079
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
2 * MPlayer GUI for Win32
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
3 * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
4 * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
5 * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
6 *
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
7 * This file is part of MPlayer.
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
8 *
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
9 * MPlayer is free software; you can redistribute it and/or modify
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
10 * it under the terms of the GNU General Public License as published by
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
12 * (at your option) any later version.
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
13 *
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
14 * MPlayer is distributed in the hope that it will be useful,
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
17 * GNU General Public License for more details.
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
18 *
26457
9ba6d4487292 Use standard GPL header.
diego
parents: 26372
diff changeset
19 * You should have received a copy of the GNU General Public License along
9ba6d4487292 Use standard GPL header.
diego
parents: 26372
diff changeset
20 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
9ba6d4487292 Use standard GPL header.
diego
parents: 26372
diff changeset
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23079
8e9b11648f40 Use proper GPL header.
diego
parents: 23078
diff changeset
22 */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
23
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
24 #include <stdio.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
25 #include <stdlib.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
26 #include <ctype.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
27 #include <fcntl.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
28 #include <windows.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
29 #include <windowsx.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
30 #include <shlobj.h>
23091
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
31
35450
31a5320909f7 Don't include config.h if not necessary.
ib
parents: 35002
diff changeset
32 #include "config.h"
31511
13ca93203358 Factorize MPlayer/MEncoder version string handling.
diego
parents: 30684
diff changeset
33 #include "mpcommon.h"
23091
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
34 #include "mplayer.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
35 #include "mp_fifo.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
36 #include "mp_msg.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
37 #include "help_mp.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
38 #include "input/input.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
39 #include "input/mouse.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
40 #include "osdep/keycodes.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
41 #include "stream/stream.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
42 #include "libvo/video_out.h"
30684
dc7ed18ea0df Include libmpcodecs/vd.h for declaration of "fullscreen".
zuxy
parents: 30558
diff changeset
43 #include "libmpcodecs/vd.h"
26372
76413880bfad Update include paths to account for build system changes.
diego
parents: 26193
diff changeset
44 #include "gui/interface.h"
33761
16286ee1fc71 Fix Win32 GUI compilation problems.
ib
parents: 33640
diff changeset
45 #include "gui/ui/actions.h"
33557
71ec25d1da10 Fix compilation after r33644.
ib
parents: 33555
diff changeset
46 #include "gui/ui/gmplayer.h"
33770
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
47 #include "gui/util/mem.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48 #include "gui.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
49 #include "dialogs.h"
33965
8a480da297e5 Add an about box to the Win32 GUI.
ib
parents: 33782
diff changeset
50 #include "version.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
51
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34454
diff changeset
52 /* HACK around bug in old mingw */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53 #undef INVALID_FILE_ATTRIBUTES
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
54 #define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
55
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56 #ifndef WM_XBUTTONDOWN
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
57 # define WM_XBUTTONDOWN 0x020B
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
58 # define WM_XBUTTONUP 0x020C
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
59 # define WM_XBUTTONDBLCLK 0x020D
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
61
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62 /* Globals / Externs */
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
63 float video_aspect;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
64
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65 DWORD oldtime;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
66 NOTIFYICONDATA nid;
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 35452
diff changeset
67 int console_state = FALSE;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
68 play_tree_t *playtree = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
69
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70 static HBRUSH colorbrush = NULL; //Handle to colorkey brush
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
71 static COLORREF windowcolor = RGB(255,0,255); //Windowcolor == colorkey
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
72
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
73 /**
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
74 * @brief Convert an UTF-8 encoded string into ANSI codepage encoding.
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
75 *
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
76 * @param utf8 UTF-8 encoded string
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
77 *
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
78 * @return string containing ANSI codepage encoding of @a utf8 (or, in case
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
79 * of error, a string containing the question mark character)
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
80 */
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
81 LPSTR acp (LPCSTR utf8)
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
82 {
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
83 static LPSTR acp_str = NULL;
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
84 int chars;
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
85 LPWSTR uc_str;
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
86
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
87 chars = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0);
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
88
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
89 if (chars)
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
90 {
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
91 uc_str = malloc(sizeof(*uc_str) * (chars + 1));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
92
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
93 if (uc_str)
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
94 {
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
95 MultiByteToWideChar(CP_UTF8, 0, utf8, -1, uc_str, chars);
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
96
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
97 chars = WideCharToMultiByte(CP_ACP, 0, uc_str, -1, NULL, 0, NULL, 0);
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
98
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
99 if (chars)
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
100 {
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
101 free(acp_str);
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
102 acp_str = malloc(sizeof(*acp_str) * (chars + 1));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
103
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
104 if (acp_str)
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
105 {
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
106 WideCharToMultiByte(CP_ACP, 0, uc_str, -1, acp_str, chars, NULL, 0);
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
107 free(uc_str);
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
108
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
109 return acp_str;
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
110 }
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
111 }
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
112
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
113 free(uc_str);
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
114 }
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
115 }
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
116
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
117 return "?";
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
118 }
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
119
35001
05d54ab2ba5c Add check-mark for menu item "Debug Console".
ib
parents: 34996
diff changeset
120 static void console_toggle(gui_t *gui)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
121 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
122 if (console_state)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
123 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
124 FreeConsole();
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 35452
diff changeset
125 console = FALSE;
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 35452
diff changeset
126 console_state = FALSE;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
127 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
128 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
129 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
130 /* This code comes from: http://dslweb.nwnexus.com/~ast/dload/guicon.htm */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
131 CONSOLE_SCREEN_BUFFER_INFO coninfo;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
132 FILE *fp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
133 HWND hwnd = NULL;
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 35452
diff changeset
134 console = TRUE;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
135 AllocConsole();
31511
13ca93203358 Factorize MPlayer/MEncoder version string handling.
diego
parents: 30684
diff changeset
136 SetConsoleTitle(mplayer_version);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
137
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
138 /* disable the close button for now */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
139 while (!hwnd)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
140 {
31511
13ca93203358 Factorize MPlayer/MEncoder version string handling.
diego
parents: 30684
diff changeset
141 hwnd = FindWindow(NULL, mplayer_version);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
142 Sleep(100);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
143 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
144 DeleteMenu(GetSystemMenu(hwnd, 0), SC_CLOSE, MF_BYCOMMAND);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
145
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
146 GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
147 coninfo.dwSize.Y = 1000;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148 SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coninfo.dwSize);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
149 fp = freopen("con", "w", stdout);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
150 *stdout = *fp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
151 setvbuf(stdout, NULL, _IONBF, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
152 fp = freopen("con", "r", stdin);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
153 *stdin = *fp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
154 setvbuf(stdin, NULL, _IONBF, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
155 fp = freopen("con", "w", stdout);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
156 *stderr = *fp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
157 setvbuf(stderr, NULL, _IONBF, 0);
31532
312e3b425f0f Fix win32 gui compilation.
reimar
parents: 31511
diff changeset
158 print_version("MPlayer");
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 35452
diff changeset
159 console_state = TRUE;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
160 }
35002
64d72a128ea8 Rewrite condition and use console_state instead of console.
ib
parents: 35001
diff changeset
161
64d72a128ea8 Rewrite condition and use console_state instead of console.
ib
parents: 35001
diff changeset
162 if (gui)
64d72a128ea8 Rewrite condition and use console_state instead of console.
ib
parents: 35001
diff changeset
163 {
64d72a128ea8 Rewrite condition and use console_state instead of console.
ib
parents: 35001
diff changeset
164 CheckMenuItem(gui->traymenu, ID_CONSOLE, MF_BYCOMMAND | (console_state ? MF_CHECKED : MF_UNCHECKED));
64d72a128ea8 Rewrite condition and use console_state instead of console.
ib
parents: 35001
diff changeset
165 CheckMenuItem(gui->menu, ID_CONSOLE, MF_BYCOMMAND | (console_state ? MF_CHECKED : MF_UNCHECKED));
64d72a128ea8 Rewrite condition and use console_state instead of console.
ib
parents: 35001
diff changeset
166 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
167 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
168
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
169 void capitalize(char *filename)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
170 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
172 BOOL cap = TRUE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
173 for (i=0; i < strlen(filename); i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
174 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
175 if (cap)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
176 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
177 cap = FALSE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
178 filename[i] = toupper(filename[i]);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
179 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
180 else if (filename[i] == ' ')
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
181 cap = TRUE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
182 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
183 filename[i] = tolower(filename[i]);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
184 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
185 }
33965
8a480da297e5 Add an about box to the Win32 GUI.
ib
parents: 33782
diff changeset
186 static void display_about_box(HWND hWnd)
8a480da297e5 Add an about box to the Win32 GUI.
ib
parents: 33782
diff changeset
187 {
8a480da297e5 Add an about box to the Win32 GUI.
ib
parents: 33782
diff changeset
188 char about_msg[512];
8a480da297e5 Add an about box to the Win32 GUI.
ib
parents: 33782
diff changeset
189 snprintf(about_msg, sizeof(about_msg), MP_TITLE "\n" COPYRIGHT, "MPlayer");
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
190 MessageBox(hWnd, about_msg, acp(MSGTR_About), MB_OK);
33965
8a480da297e5 Add an about box to the Win32 GUI.
ib
parents: 33782
diff changeset
191 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
192
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
193 static image *get_drawground(HWND hwnd)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
194 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
195 gui_t * gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
196 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
197 if(!gui) return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
198 for(i=0; i<gui->window_priv_count; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
199 if(gui->window_priv[i]->hwnd==hwnd)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
200 return &gui->window_priv[i]->img;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
201 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
202 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
203
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
204 static HBITMAP get_bitmap(HWND hwnd)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
205 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
206 gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
207 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
208 if(!gui) return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
209 for(i=0; i<gui->window_priv_count; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
210 if(gui->window_priv[i]->hwnd == hwnd)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
211 return gui->window_priv[i]->bitmap;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
212 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
213 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
214
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
215 static int get_windowtype(HWND hwnd)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
216 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
217 gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
218 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
219 if(!gui) return -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
220 for(i=0; i<gui->window_priv_count; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
221 if(gui->window_priv[i]->hwnd == hwnd)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222 return gui->window_priv[i]->type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
223 return -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
224 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
225
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
226 static void uninit(gui_t *gui)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
227 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
228 if(gui->skin) destroy_window(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
229 if(gui->playlist) gui->playlist->free_playlist(gui->playlist);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
230 gui->playlist = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
231 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
232
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
233 /*
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
234 the gui message handler
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
235 tries to handle the incoming messages
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
236 and passes them to the player's message handler if it can't handle them
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
237 */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
238 static void handlemsg(HWND hWnd, int msg)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
239 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
240 gui_t *gui = (gui_t *) GetWindowLongPtr(hWnd, GWLP_USERDATA);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
241 if(msg == evNone) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
242
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
243 switch(msg)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
244 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
245 case evLoadPlay:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
246 case evLoad:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
247 if(display_openfilewindow(gui, 0) && (msg == evLoadPlay))
34325
fc74085e2487 Fix bug in Win32 GUI introduced in r34403.
ib
parents: 34321
diff changeset
248 gui->playercontrol(evLoadPlay);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
249 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
250 case evLoadSubtitle:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
251 display_opensubtitlewindow(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
252 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
253 case evPreferences:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
254 display_prefswindow(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
255 return;
34321
daebf766dea6 Cosmetic: Synchronize evPlaylist event and message names.
ib
parents: 34315
diff changeset
256 case evPlaylist:
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
257 display_playlistwindow(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
258 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
259 case evSkinBrowser:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
260 display_skinbrowser(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
261 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
262 case evEqualizer:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
263 display_eqwindow(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
264 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
265 case evAbout:
33965
8a480da297e5 Add an about box to the Win32 GUI.
ib
parents: 33782
diff changeset
266 display_about_box(hWnd);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
267 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
268 case evIconify:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
269 ShowWindow(hWnd, SW_MINIMIZE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
270 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
271 case evIncVolume:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
272 mplayer_put_key(KEY_VOLUME_UP);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
273 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
274 case evDecVolume:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
275 mplayer_put_key(KEY_VOLUME_DOWN);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
276 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
277 default:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
278 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] received msg %s (%i)\n", gui->skin->geteventname(msg), msg);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
279 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
280 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
281 gui->playercontrol(msg);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
282 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
283
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
284 static widget *clickedinsidewidget(gui_t *gui, int window, int x, int y)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
285 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
286 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
287 widget *item;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
288 for(i=0; i<gui->skin->widgetcount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
289 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
290 item = gui->skin->widgets[i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
291 if((item->window == window) && (item->x <= x) && (item->x + item->width >= x) &&
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
292 (item->y <= y) && (item->y + item->height >= y))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
293 return item;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
294 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
295 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
296 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
297
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
298 /* updates sliders and the display */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
299 static void updatedisplay(gui_t *gui, HWND hwnd)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
300 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
301 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
302 window_priv_t *priv = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
303 DWORD time = timeGetTime();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
304
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
305 if(!hwnd) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
306
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
307 /* load all potmeters hpotmeters */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
308 for(i=0; i<gui->skin->widgetcount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
309 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
310 if(gui->skin->widgets[i]->type == tyHpotmeter || gui->skin->widgets[i]->type == tyPotmeter)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
311 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
312 if(gui->skin->widgets[i]->msg == evSetVolume)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
313 gui->skin->widgets[i]->value = guiInfo.Volume;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
314 else if(gui->skin->widgets[i]->msg == evSetMoviePosition)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
315 gui->skin->widgets[i]->value = guiInfo.Position;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
316 else if(gui->skin->widgets[i]->msg == evSetBalance)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
317 gui->skin->widgets[i]->value = guiInfo.Balance;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
318 if(gui->skin->widgets[i]->window == get_windowtype(hwnd))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
319 renderwidget(gui->skin, get_drawground(hwnd), gui->skin->widgets[i],
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
320 gui->skin->widgets[i]->pressed ? 0 : 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
321 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
322 /* update some buttons */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
323 if(gui->skin->widgets[i]->type == tyButton && gui->skin->widgets[i]->window == get_windowtype(hwnd))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
324 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
325 if(gui->skin->widgets[i]->msg == evPlaySwitchToPause)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
326 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
327 gui->skin->widgets[i]->value = guiInfo.Playing;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
328 renderwidget(gui->skin, get_drawground(hwnd), gui->skin->widgets[i],
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33580
diff changeset
329 guiInfo.Playing == GUI_PLAY ? 0 : 1);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
330 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
331 if(gui->skin->widgets[i]->msg == evMute)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
332 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
333 gui->skin->widgets[i]->value = guiInfo.Volume;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
334 renderwidget(gui->skin, get_drawground(hwnd), gui->skin->widgets[i],
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
335 guiInfo.Volume == 0.0f ? 0 : 1);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
336 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
337 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
338 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
339
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
340 /* updating the display once a 100.second is enough imo */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
341 if((time - oldtime) < 100) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
342 oldtime=time;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
343
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
344 for (i=0; i<gui->window_priv_count; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
345 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
346 if(gui->window_priv[i]->hwnd == hwnd)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
347 priv=gui->window_priv[i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
348 }// Sherpya
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
349 /* display the status msgs */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
350 renderinfobox(gui->skin, priv);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
351 RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
352 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
353
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
354 static LRESULT CALLBACK VideoProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
355 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
356 gui_t *gui = (gui_t *) GetWindowLongPtr(hWnd, GWLP_USERDATA);
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
357 if (gui && (gui->videowindow != hWnd)) return FALSE;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
358
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
359 switch (message)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
360 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
361 case WM_CLOSE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
362 handlemsg(hWnd, evExit);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
363 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
364 case WM_DESTROY:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
365 PostQuitMessage(0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
366 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
367 case WM_KEYDOWN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
368 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
369 switch(wParam)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
370 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
371 case VK_LEFT:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
372 mplayer_put_key(KEY_LEFT);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
373 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
374 case VK_UP:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
375 mplayer_put_key(KEY_UP);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
376 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
377 case VK_RIGHT:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
378 mplayer_put_key(KEY_RIGHT);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
379 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
380 case VK_DOWN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
381 mplayer_put_key(KEY_DOWN);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
382 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
383 case VK_TAB:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
384 mplayer_put_key(KEY_TAB);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
385 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
386 case VK_BACK:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
387 mplayer_put_key(KEY_BS);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
388 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
389 case VK_DELETE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
390 mplayer_put_key(KEY_DELETE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
391 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
392 case VK_INSERT:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
393 mplayer_put_key(KEY_INSERT);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
394 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
395 case VK_HOME:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
396 mplayer_put_key(KEY_HOME);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
397 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
398 case VK_END:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
399 mplayer_put_key(KEY_END);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
400 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
401 case VK_PRIOR:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
402 mplayer_put_key(KEY_PAGE_UP);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
403 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
404 case VK_NEXT:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
405 mplayer_put_key(KEY_PAGE_DOWN);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
406 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
407 case VK_ESCAPE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
408 mplayer_put_key(KEY_ESC);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
409 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
410 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
411 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
412 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
413 case WM_COMMAND:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
414 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
415 switch(LOWORD(wParam))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
416 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
417 case IDEXIT:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
418 PostQuitMessage(0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
419 handlemsg(hWnd, evExit);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
420 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
421 case IDFILE_OPEN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
422 handlemsg(hWnd, evLoadPlay);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
423 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
424 case IDURL_OPEN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
425 display_openurlwindow(gui, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
426 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
427 case IDDIR_OPEN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
428 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
429 static char path[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
430 BROWSEINFO bi;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
431 LPITEMIDLIST pidl;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
432 memset(&bi, 0, sizeof(BROWSEINFO));
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
433 bi.lpszTitle = acp(MSGTR_DirectorySelect);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
434 pidl = SHBrowseForFolder(&bi);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
435 if (SHGetPathFromIDList(pidl, path))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
436 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
437 gui->playlist->clear_playlist(gui->playlist);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
438 adddirtoplaylist(gui->playlist, path, TRUE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
439 gui->startplay(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
440 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
441 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
442 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
443 case ID_PTRACK:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
444 handlemsg(hWnd, evPrev);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
445 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
446 case ID_SEEKB:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
447 handlemsg(hWnd, evBackward10sec);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
448 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
449 case ID_PLAY:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
450 handlemsg(hWnd, evPlaySwitchToPause);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
451 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
452 case ID_STOP:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
453 handlemsg(hWnd, evStop);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
454 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
455 case ID_SEEKF:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
456 handlemsg(hWnd, evForward10sec);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
457 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
458 case ID_NTRACK:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
459 handlemsg(hWnd, evNext);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
460 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
461 case ID_CHAPTERSEL:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
462 display_chapterselwindow(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
463 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
464 case ID_FULLSCREEN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
465 mp_input_queue_cmd(mp_input_parse_cmd("vo_fullscreen"));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
466 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
467 case ID_MUTE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
468 mp_input_queue_cmd(mp_input_parse_cmd("mute"));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
469 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
470 case ID_ASPECT1:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
471 mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 1.777777"));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
472 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
473 case ID_ASPECT2:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
474 mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 1.333333"));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
475 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
476 case ID_ASPECT3:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
477 mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 2.35"));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
478 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
479 case ID_ASPECT4:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
480 mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 0"));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
481 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
482 case IDSUB_TOGGLE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
483 mp_input_queue_cmd(mp_input_parse_cmd("sub_visibility"));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
484 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
485 case IDSUB_CYCLE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
486 mp_input_queue_cmd(mp_input_parse_cmd("sub_select"));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
487 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
488 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
489 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
490 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
491 case WM_CHAR:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
492 mplayer_put_key(wParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
493 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
494 case WM_DROPFILES:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
495 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
496 if(!lParam)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
497 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
498 char file[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
499 int filecount = DragQueryFile((HDROP) wParam, -1, file, MAX_PATH);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
500 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
501 for(i=0; i<filecount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
502 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
503 DragQueryFile((HDROP) wParam, i, file, MAX_PATH);
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35450
diff changeset
504 uiSetFile(NULL, file, STREAMTYPE_FILE);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
505 if(!parse_filename(file, playtree, mconfig, 1))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
506 gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
507 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
508 DragFinish((HDROP) wParam);
34325
fc74085e2487 Fix bug in Win32 GUI introduced in r34403.
ib
parents: 34321
diff changeset
509 gui->playercontrol(evLoadPlay);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
510 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
511 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
512 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
513 gui->playlist->clear_playlist(gui->playlist);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
514 gui->playlist->add_track(gui->playlist, (const char *) wParam, NULL, NULL, 0);
34325
fc74085e2487 Fix bug in Win32 GUI introduced in r34403.
ib
parents: 34321
diff changeset
515 gui->playercontrol(evLoadPlay);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
516 }
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
517 SetForegroundWindow(gui->videowindow);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
518 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
519 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
520 case WM_LBUTTONDOWN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
521 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
522 if(!vo_nomouse_input)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
523 mplayer_put_key(MOUSE_BTN0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
524 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
525 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
526 case WM_MBUTTONDOWN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
527 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
528 if(!vo_nomouse_input)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
529 mplayer_put_key(MOUSE_BTN1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
530 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
531 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
532 case WM_RBUTTONDOWN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
533 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
534 POINT point;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
535 point.x = GET_X_LPARAM(lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
536 point.y = GET_Y_LPARAM(lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
537 ClientToScreen(hWnd, &point);
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
538 if(guiInfo.StreamType == STREAMTYPE_DVD)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
539 EnableMenuItem(gui->dvdmenu, ID_CHAPTERSEL, MF_BYCOMMAND | MF_ENABLED);
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
540 TrackPopupMenu(gui->videomenu, 0, point.x, point.y, 0, hWnd, NULL);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
541 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
542 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
543 case WM_LBUTTONDBLCLK:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
544 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
545 if(!vo_nomouse_input)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
546 mplayer_put_key(MOUSE_BTN0_DBL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
547 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
548 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
549 case WM_MBUTTONDBLCLK:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
550 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
551 if(!vo_nomouse_input)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
552 mplayer_put_key(MOUSE_BTN1_DBL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
553 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
554 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
555 case WM_RBUTTONDBLCLK:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
556 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
557 if(!vo_nomouse_input)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
558 mplayer_put_key(MOUSE_BTN2_DBL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
559 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
560 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
561 case WM_MOUSEWHEEL:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
562 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
563 int x = GET_WHEEL_DELTA_WPARAM(wParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
564 if(vo_nomouse_input)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
565 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
566 if (x > 0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
567 mplayer_put_key(MOUSE_BTN3);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
568 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
569 mplayer_put_key(MOUSE_BTN4);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
570 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
571 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
572 case WM_XBUTTONDOWN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
573 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
574 if(vo_nomouse_input)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
575 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
576 if(HIWORD(wParam) == 1)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
577 mplayer_put_key(MOUSE_BTN5);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
578 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
579 mplayer_put_key(MOUSE_BTN6);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
580 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
581 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
582 case WM_XBUTTONDBLCLK:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
583 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
584 if(vo_nomouse_input)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
585 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
586 if(HIWORD(wParam) == 1)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
587 mplayer_put_key(MOUSE_BTN5_DBL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
588 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
589 mplayer_put_key(MOUSE_BTN6_DBL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
590 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
591 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
592 case WM_TIMER:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
593 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
594 if(fullscreen) while(ShowCursor(FALSE) >= 0){}
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
595 KillTimer(hWnd, ID_TIMER);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
596 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
597 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
598 case WM_MOUSEMOVE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
599 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
600 ShowCursor(TRUE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
601 SetTimer(hWnd, ID_TIMER, 3000, (TIMERPROC) NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
602 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
603 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
604 case WM_WINDOWPOSCHANGED:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
605 {
34996
ebcc17a3c165 Fix compiler warnings (comparison between signed and unsigned).
ib
parents: 34995
diff changeset
606 uint32_t tmpheight=0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
607 static uint32_t rect_width;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
608 static uint32_t rect_height;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
609 RECT rd;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
610 POINT pt;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
611 pt.x = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
612 pt.y = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
613 GetClientRect(hWnd, &rd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
614 ClientToScreen(hWnd, &pt);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
615
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
616 rect_width = rd.right - rd.left;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
617 rect_height = rd.bottom - rd.top;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
618
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
619 /* maintain our aspect ratio */
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
620 tmpheight = ((float)rect_width/video_aspect);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
621 tmpheight += tmpheight % 2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
622 if(tmpheight > rect_height)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
623 {
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
624 rect_width = ((float)rect_height*video_aspect);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
625 rect_width += rect_width % 2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
626 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
627 else rect_height = tmpheight;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
628
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
629 rd.right = rd.left + rect_width;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
630 rd.bottom = rd.top + rect_height;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
631
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
632 AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
633 SetWindowPos(hWnd, 0, fullscreen?0:pt.x+rd.left, fullscreen?0:pt.y+rd.top,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
634 fullscreen?vo_screenwidth:rd.right-rd.left, fullscreen?vo_screenheight:rd.bottom-rd.top, SWP_NOOWNERZORDER);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
635 SetForegroundWindow(hWnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
636 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
637 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
638 case WM_SYSCOMMAND:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
639 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
640 switch(wParam)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
641 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
642 case SC_SCREENSAVE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
643 case SC_MONITORPOWER:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
644 mp_msg(MSGT_VO, MSGL_V ,"<vo_directx><INFO>killing screensaver\n" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
645 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
646 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
647 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
648 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
649 case WM_PAINT:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
650 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
651 PAINTSTRUCT ps;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
652 RECT rect;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
653 HDC hdc = BeginPaint(hWnd, &ps);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
654 HDC hMemDC = CreateCompatibleDC(hdc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
655 HBRUSH blackbrush = (HBRUSH)GetStockObject(BLACK_BRUSH);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
656 int width, height;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
657 GetClientRect(hWnd, &rect);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
658 width = rect.right - rect.left;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
659 height = rect.bottom - rect.top;
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33580
diff changeset
660 if(guiInfo.Playing == GUI_STOP)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
661 {
34996
ebcc17a3c165 Fix compiler warnings (comparison between signed and unsigned).
ib
parents: 34995
diff changeset
662 unsigned int i;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
663 window *desc = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
664
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
665 for (i=0; i<gui->skin->windowcount; i++)
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
666 if(gui->skin->windows[i]->type == wiVideo)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
667 desc = gui->skin->windows[i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
668
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
669 SelectObject(hMemDC, get_bitmap(hWnd));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
670 StretchBlt(hdc, 0, 0, width, height, hMemDC, 0, 0, desc->base->bitmap[0]->width,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
671 desc->base->bitmap[0]->height, SRCCOPY);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
672 } else {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
673 FillRect(GetDC(hWnd), &rect, fullscreen?blackbrush:colorbrush);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
674 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
675 DeleteDC(hMemDC);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
676 EndPaint(hWnd, &ps);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
677 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
678 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
679 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
680 return DefWindowProc(hWnd, message, wParam, lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
681 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
682
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
683 /* Window Proc for the gui Window */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
684 static LRESULT CALLBACK EventProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
685 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
686 gui_t *gui = (gui_t *) GetWindowLongPtr(hWnd, GWLP_USERDATA);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
687
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
688 /* Avoid processing when then window doesn't match gui mainwindow */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
689 if (gui && (gui->mainwindow != hWnd)) return FALSE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
690
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
691 switch (message)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
692 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
693 case WM_CLOSE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
694 handlemsg(hWnd, evExit);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
695 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
696 case WM_DESTROY:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
697 PostQuitMessage(0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
698 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
699 case WM_SYSTRAY:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
700 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
701 switch(lParam)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
702 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
703 POINT cursor;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
704 case WM_RBUTTONDOWN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
705 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
706 GetCursorPos(&cursor);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
707 SetForegroundWindow(hWnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
708 TrackPopupMenu(gui->traymenu, 0, cursor.x, cursor.y, 0, hWnd, NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
709 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
710 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
711 case WM_MBUTTONDBLCLK:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
712 case WM_LBUTTONDBLCLK:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
713 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
714 if(IsWindowVisible(hWnd)) ShowWindow(hWnd, SW_HIDE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
715 else { ShowWindow(hWnd, SW_SHOW); SetForegroundWindow(hWnd); }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
716 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
717 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
718 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
719 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
720 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
721 case WM_KEYDOWN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
722 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
723 switch(wParam)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
724 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
725 case VK_LEFT:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
726 mplayer_put_key(KEY_LEFT);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
727 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
728 case VK_UP:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
729 mplayer_put_key(KEY_UP);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
730 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
731 case VK_RIGHT:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
732 mplayer_put_key(KEY_RIGHT);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
733 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
734 case VK_DOWN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
735 mplayer_put_key(KEY_DOWN);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
736 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
737 case VK_TAB:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
738 mplayer_put_key(KEY_TAB);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
739 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
740 case VK_BACK:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
741 mplayer_put_key(KEY_BS);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
742 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
743 case VK_DELETE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
744 mplayer_put_key(KEY_DELETE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
745 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
746 case VK_INSERT:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
747 mplayer_put_key(KEY_INSERT);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
748 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
749 case VK_HOME:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
750 mplayer_put_key(KEY_HOME);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
751 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
752 case VK_END:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
753 mplayer_put_key(KEY_END);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
754 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
755 case VK_PRIOR:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
756 mplayer_put_key(KEY_PAGE_UP);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
757 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
758 case VK_NEXT:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
759 mplayer_put_key(KEY_PAGE_DOWN);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
760 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
761 case VK_ESCAPE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
762 mplayer_put_key(KEY_ESC);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
763 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
764 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
765 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
766 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
767 case WM_CHAR:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
768 mplayer_put_key(wParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
769 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
770 case WM_COPYDATA:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
771 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
772 if(lParam)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
773 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
774 PCOPYDATASTRUCT cdData;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
775 cdData = (PCOPYDATASTRUCT) lParam;
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35450
diff changeset
776 uiSetFile(NULL, cdData->lpData, STREAMTYPE_FILE);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
777 if(!parse_filename(cdData->lpData, playtree, mconfig, 1))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
778 gui->playlist->add_track(gui->playlist, cdData->lpData, NULL, NULL, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
779 gui->startplay(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
780 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
781 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
782 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
783 case WM_DROPFILES:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
784 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
785 if(!lParam)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
786 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
787 char file[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
788 int filecount = DragQueryFile((HDROP) wParam, -1, file, MAX_PATH);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
789 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
790 for(i=0; i<filecount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
791 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
792 DragQueryFile((HDROP) wParam, i, file, MAX_PATH);
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35450
diff changeset
793 uiSetFile(NULL, file, STREAMTYPE_FILE);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
794 if(!parse_filename(file, playtree, mconfig, 1))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
795 gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
796 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
797 DragFinish((HDROP) wParam);
34325
fc74085e2487 Fix bug in Win32 GUI introduced in r34403.
ib
parents: 34321
diff changeset
798 gui->playercontrol(evLoadPlay);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
799 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
800 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
801 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
802 gui->playlist->clear_playlist(gui->playlist);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
803 gui->playlist->add_track(gui->playlist, (const char *) wParam, NULL, NULL, 0);
34325
fc74085e2487 Fix bug in Win32 GUI introduced in r34403.
ib
parents: 34321
diff changeset
804 gui->playercontrol(evLoadPlay);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
805 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
806 SetForegroundWindow(gui->mainwindow);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
807 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
808 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
809 case WM_LBUTTONDOWN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
810 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
811 SetCapture(hWnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
812 gui->mousex = GET_X_LPARAM(lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
813 gui->mousey = GET_Y_LPARAM(lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
814 /* inside a widget */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
815 gui->activewidget = clickedinsidewidget(gui, get_windowtype(hWnd), gui->mousex, gui->mousey);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
816 if(gui->activewidget)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
817 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
818 gui->activewidget->pressed = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
819 gui->mousewx = gui->mousex - gui->activewidget->x;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
820 gui->mousewy = gui->mousey - gui->activewidget->y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
821 renderwidget(gui->skin, get_drawground(hWnd), gui->activewidget, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
822 RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
823 handlemsg(hWnd, gui->activewidget->msg);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
824 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
825 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
826 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
827 case WM_CAPTURECHANGED:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
828 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
829 if(gui->activewidget)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
830 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
831 gui->activewidget->pressed = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
832 renderwidget(gui->skin, get_drawground(hWnd), gui->activewidget, 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
833 RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
834 gui->activewidget = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
835 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
836 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
837 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
838 case WM_LBUTTONUP:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
839 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
840 ReleaseCapture();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
841 if(gui->activewidget)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
842 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
843 gui->activewidget->pressed = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
844 renderwidget(gui->skin, get_drawground(hWnd), gui->activewidget, 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
845 RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
846 gui->activewidget = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
847 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
848 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
849 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
850 case WM_RBUTTONDOWN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
851 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
852 POINT point;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
853 char device[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
854 char searchpath[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
855 int len, pos = 0, cdromdrive = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
856 UINT errmode;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
857 point.x = GET_X_LPARAM(lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
858 point.y = GET_Y_LPARAM(lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
859 ClientToScreen(hWnd, &point);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
860 errmode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
861 while (GetMenuItemCount(gui->diskmenu) > 0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
862 DeleteMenu(gui->diskmenu, 0, MF_BYPOSITION);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
863 len = GetLogicalDriveStrings(MAX_PATH, device);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
864 while(pos < len)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
865 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
866 if(GetDriveType(device + pos) == DRIVE_CDROM)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
867 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
868 char volname[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
869 char menuitem[MAX_PATH];
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 35452
diff changeset
870 int flags = MF_STRING, enable = FALSE;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
871 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] checking %s for CD/VCD/SVCD/DVDs\n", device + pos);
34454
5a45efc630b8 Remove all unnecessary #ifdefs from GUI code.
ib
parents: 34452
diff changeset
872 #ifdef CONFIG_DVDREAD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
873 sprintf(searchpath, "%sVIDEO_TS", device + pos);
34452
c3e63d8b6cf3 Reduce number and avoid conditional definition of searchpath variables.
ib
parents: 34405
diff changeset
874 if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 35452
diff changeset
875 enable = TRUE;
34454
5a45efc630b8 Remove all unnecessary #ifdefs from GUI code.
ib
parents: 34452
diff changeset
876 #endif
34452
c3e63d8b6cf3 Reduce number and avoid conditional definition of searchpath variables.
ib
parents: 34405
diff changeset
877 sprintf(searchpath, "%sMpegav", device + pos);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
878 if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 35452
diff changeset
879 enable = TRUE;
34405
35fd66684548 Use cdparanoia compatibility names for CD function calls.
ib
parents: 34391
diff changeset
880 #ifdef CONFIG_CDDA
34452
c3e63d8b6cf3 Reduce number and avoid conditional definition of searchpath variables.
ib
parents: 34405
diff changeset
881 sprintf(searchpath, "%sTrack01.cda", device + pos);
c3e63d8b6cf3 Reduce number and avoid conditional definition of searchpath variables.
ib
parents: 34405
diff changeset
882 if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
35501
7bb176fac55c Use boolean symbolic constants in Win32 GUI.
ib
parents: 35452
diff changeset
883 enable = TRUE;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
884 #endif
34452
c3e63d8b6cf3 Reduce number and avoid conditional definition of searchpath variables.
ib
parents: 34405
diff changeset
885 flags |= (enable ? MF_ENABLED : MF_GRAYED);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
886 volname[0] = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
887 strcpy(menuitem, device + pos);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
888 menuitem[strlen(menuitem) - 1]=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
889 GetVolumeInformation(device + pos, volname, MAX_PATH, NULL, NULL, NULL, NULL, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
890 if (strlen(volname))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
891 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
892 capitalize(volname);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
893 strcat(menuitem, " - ");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
894 strcat(menuitem, volname);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
895 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
896 AppendMenu(gui->diskmenu, flags, IDPLAYDISK + cdromdrive, menuitem);
34979
93a763f04563 Fix bug with definition of IDPLAYDISK in Win32 GUI.
ib
parents: 34697
diff changeset
897 if (++cdromdrive == IDPLAYDISK_LIMIT - IDPLAYDISK) break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
898 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
899 pos += strlen(device + pos) + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
900 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
901 SetErrorMode(errmode);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
902 TrackPopupMenu(gui->menu, 0, point.x, point.y, 0, hWnd, NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
903 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
904 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
905 case WM_MOUSEMOVE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
906 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
907 if(wParam & MK_LBUTTON)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
908 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
909 POINT point;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
910 RECT rect;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
911 if(gui->activewidget)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
912 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
913 widget *item = gui->activewidget;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
914
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
915 if(item->type == tyHpotmeter)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
916 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
917 item->x = GET_X_LPARAM(lParam) - gui->mousewx;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
918 item->value = (float)((float)((item->x - item->wx) * 100.0f) / (float)(item->wwidth - item->width));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
919 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
920 if(item->type == tyPotmeter)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
921 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
922 gui->mousewx = GET_X_LPARAM(lParam) - gui->activewidget->x;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
923 item->value = (float) (gui->mousewx * 100.0f) / (float) item->wwidth;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
924 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
925
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
926 if((item->type == tyPotmeter) || (item->type == tyHpotmeter) || (item->type == tyVpotmeter))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
927 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
928 /* Bound checks */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
929 if(item->value > 100.0f)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
930 item->value = 100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
931 else if(item->value < 0.0f)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
932 item->value = 0.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
933
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
934 if(item->msg == evSetVolume)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
935 guiInfo.Volume = (float) item->value;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
936 else if(item->msg == evSetMoviePosition)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
937 guiInfo.Position = (float) item->value;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
938 else if(item->msg == evSetBalance)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
939 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
940 /* make the range for 50% a bit bigger, because the sliders for balance usually suck */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
941 if((item->value - 50.0f < 1.5f) && (item->value - 50.0f > -1.5f))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
942 item->value = 50.0f;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
943 guiInfo.Balance = (float) item->value;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
944 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
945 updatedisplay(gui, hWnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
946 handlemsg(hWnd, item->msg);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
947 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
948 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
949 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
950 point.x = GET_X_LPARAM(lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
951 point.y = GET_Y_LPARAM(lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
952 ClientToScreen(hWnd, &point);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
953 GetWindowRect(hWnd, &rect);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
954 MoveWindow(hWnd, point.x - gui->mousex, point.y - gui->mousey,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
955 rect.right-rect.left,rect.bottom-rect.top,TRUE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
956 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
957 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
958 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
959 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
960 case WM_COMMAND:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
961 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
962 switch(LOWORD(wParam))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
963 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
964 case IDEXIT:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
965 PostQuitMessage(0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
966 handlemsg(hWnd, evExit);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
967 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
968 case IDFILE_OPEN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
969 handlemsg(hWnd, evLoadPlay);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
970 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
971 case IDDIR_OPEN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
972 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
973 static char path[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
974 BROWSEINFO bi;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
975 LPITEMIDLIST pidl;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
976 memset(&bi, 0, sizeof(BROWSEINFO));
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
977 bi.lpszTitle = acp(MSGTR_DirectorySelect);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
978 pidl = SHBrowseForFolder(&bi);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
979 if (SHGetPathFromIDList(pidl, path))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
980 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
981 gui->playlist->clear_playlist(gui->playlist);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
982 adddirtoplaylist(gui->playlist, path, TRUE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
983 gui->startplay(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
984 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
985 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
986 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
987 case ID_SKINBROWSER:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
988 handlemsg(hWnd, evSkinBrowser);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
989 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
990 case IDURL_OPEN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
991 display_openurlwindow(gui, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
992 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
993 case ID_MUTE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
994 mp_input_queue_cmd(mp_input_parse_cmd("mute"));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
995 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
996 case IDSUBTITLE_OPEN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
997 display_opensubtitlewindow(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
998 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
999 case ID_PTRACK:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1000 handlemsg(hWnd, evPrev);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1001 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1002 case ID_SEEKB:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1003 handlemsg(hWnd, evBackward10sec);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1004 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1005 case ID_PLAY:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1006 handlemsg(hWnd, evPlaySwitchToPause);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1007 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1008 case ID_STOP:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1009 handlemsg(hWnd, evStop);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1010 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1011 case ID_SEEKF:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1012 handlemsg(hWnd, evForward10sec);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1013 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1014 case ID_NTRACK:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1015 handlemsg(hWnd, evNext);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1016 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1017 case ID_SHOWHIDE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1018 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1019 if(IsWindowVisible(hWnd)) ShowWindow(hWnd, SW_HIDE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1020 else ShowWindow(hWnd, SW_SHOW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1021 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1022 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1023 case ID_PLAYLIST:
34321
daebf766dea6 Cosmetic: Synchronize evPlaylist event and message names.
ib
parents: 34315
diff changeset
1024 handlemsg(hWnd, evPlaylist);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1025 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1026 case ID_PREFS:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1027 handlemsg(hWnd, evPreferences);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1028 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1029 case ID_CONSOLE:
35001
05d54ab2ba5c Add check-mark for menu item "Debug Console".
ib
parents: 34996
diff changeset
1030 console_toggle(gui);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1031 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1032 case ID_ONLINEHELP:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1033 ShellExecute(NULL, "open", ONLINE_HELP_URL, NULL, NULL, SW_SHOWNORMAL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1034 break;
33965
8a480da297e5 Add an about box to the Win32 GUI.
ib
parents: 33782
diff changeset
1035 case IDHELP_ABOUT:
8a480da297e5 Add an about box to the Win32 GUI.
ib
parents: 33782
diff changeset
1036 handlemsg(hWnd, evAbout);
8a480da297e5 Add an about box to the Win32 GUI.
ib
parents: 33782
diff changeset
1037 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1038 }
34979
93a763f04563 Fix bug with definition of IDPLAYDISK in Win32 GUI.
ib
parents: 34697
diff changeset
1039 if(LOWORD(wParam) >= IDPLAYDISK && LOWORD(wParam) < IDPLAYDISK_LIMIT)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1040 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1041 char device[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1042 char searchpath[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1043 char filename[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1044 int len, pos = 0, cdromdrive = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1045 len = GetLogicalDriveStrings(MAX_PATH, device);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1046 while(pos < len)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1047 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1048 if(GetDriveType(device + pos)==DRIVE_CDROM)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1049 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1050 if(LOWORD(wParam) - IDPLAYDISK == cdromdrive)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1051 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1052 sprintf(searchpath, "%sVIDEO_TS", device + pos);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1053 if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1054 {
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 31532
diff changeset
1055 free(dvd_device);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1056 dvd_device = strdup(device + pos);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1057 handlemsg(hWnd, evPlayDVD);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1058 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1059 sprintf(searchpath, "%sTrack01.cda", device + pos);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1060 if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1061 {
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 31532
diff changeset
1062 free(cdrom_device);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1063 cdrom_device = strdup(device + pos);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1064 /* mplayer doesn't seem to like the trailing \ after the device name */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1065 cdrom_device[2]=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1066 handlemsg(hWnd, evPlayCD);
23147
21c35763b178 compilation fix for disabling dvd functionality, patch by <bangbangbear at gmail dot com>, slightly modified by me.
vayne
parents: 23091
diff changeset
1067 } else {
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1068 HANDLE searchhndl;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1069 WIN32_FIND_DATA finddata;
34092
dbf5042ab255 Don't use the Windows style path separator character in Win32 GUI.
ib
parents: 33965
diff changeset
1070 sprintf(searchpath, "%smpegav/*.dat", device + pos);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1071 if((searchhndl=FindFirstFile(searchpath, &finddata)) != INVALID_HANDLE_VALUE)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1072 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1073 mp_msg(MSGT_GPLAYER,MSGL_V, "Opening VCD/SVCD\n");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1074 gui->playlist->clear_playlist(gui->playlist);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1075 do
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1076 {
34092
dbf5042ab255 Don't use the Windows style path separator character in Win32 GUI.
ib
parents: 33965
diff changeset
1077 sprintf(filename, "%smpegav/%s", device + pos, finddata.cFileName);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1078 gui->playlist->add_track(gui->playlist, filename, NULL, NULL, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1079 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1080 while(FindNextFile(searchhndl, &finddata));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1081 FindClose(searchhndl);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1082 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1083 gui->startplay(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1084 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1085 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1086 cdromdrive++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1087 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1088 pos += strlen(device + pos) + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1089 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1090 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1091 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1092 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1093 case WM_PAINT:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1094 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1095 PAINTSTRUCT ps;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1096 RECT rd;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1097 HDC hdc = BeginPaint(hWnd, &ps);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1098 HDC hMemDC = CreateCompatibleDC(hdc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1099 int width, height;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1100 GetClientRect(hWnd, &rd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1101 width = rd.right - rd.left;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1102 height = rd.bottom - rd.top;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1103 SelectObject(hMemDC, get_bitmap(hWnd));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1104 BitBlt(hdc, 0, 0, width, height, hMemDC, 0, 0, SRCCOPY);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1105 DeleteDC(hMemDC);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1106 EndPaint(hWnd, &ps);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1107 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1108 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1109 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1110 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1111 return DefWindowProc(hWnd, message, wParam, lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1112 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1113
27292
80ee781f6528 Remove unnecessary and troublesome inline
zuxy
parents: 27274
diff changeset
1114 static void startplay(gui_t *gui)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1115 {
34325
fc74085e2487 Fix bug in Win32 GUI introduced in r34403.
ib
parents: 34321
diff changeset
1116 gui->playercontrol(evLoadPlay);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1117 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1118
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1119 /* returns the bits per pixel of the desktop */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1120 /* the format is always in BGR byte order */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1121 static int GetDesktopBitsPerPixel(void)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1122 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1123 HWND desktop=GetDesktopWindow();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1124 HDC dc=GetDC(desktop);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1125 int bpp=GetDeviceCaps(dc, BITSPIXEL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1126 ReleaseDC(desktop, dc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1127 return bpp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1128 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1129
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1130 /* unloads a skin and destroys its windows */
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27391
diff changeset
1131 int destroy_window(gui_t *gui)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1132 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1133 RECT rd;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1134 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1135
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1136 /* Save position: MSDN says don't pass workspace coordinates
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1137 * to CreateWindow() or SetWindowPos(), as both of which expect
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1138 * screen coordinates; resulting in the window appearing in the
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1139 * wrong location.
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1140 * -Erik
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1141 */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1142
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1143 /* main window position */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1144 if(IsIconic(gui->mainwindow))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1145 ShowWindow(gui->mainwindow, SW_SHOWNORMAL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1146 GetWindowRect(gui->mainwindow, &rd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1147 gui_main_pos_x = rd.left;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1148 gui_main_pos_y = rd.top;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1149
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1150 /* video window position */
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1151 if(IsIconic(gui->videowindow))
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1152 ShowWindow(gui->videowindow, SW_SHOWNORMAL);
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1153 GetWindowRect(gui->videowindow, &rd);
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1154 gui_video_pos_x = rd.left;
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1155 gui_video_pos_y = rd.top;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1156
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1157 for(i=0; i<gui->window_priv_count; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1158 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1159 if(gui->window_priv[i]->bitmap)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1160 DeleteObject(gui->window_priv[i]->bitmap);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1161 free(gui->window_priv[i]);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1162 }
33770
6134493605c6 Use macro nfree() in Win32 GUI code.
ib
parents: 33761
diff changeset
1163 nfree(gui->window_priv);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1164 gui->window_priv_count = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1165
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1166 /* destroy the main window */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1167 if(gui->mainwindow)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1168 DestroyWindow(gui->mainwindow);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1169 gui->mainwindow = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1170
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1171 /* destroy the video window */
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1172 if(gui->videowindow)
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1173 DestroyWindow(gui->videowindow);
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1174 gui->videowindow = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1175
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1176 UnregisterClass(gui->classname, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1177 DestroyIcon(gui->icon);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1178
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1179 gui->skin->freeskin(gui->skin);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1180 gui->skin = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1181 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1182 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1183
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1184 static void create_menu(gui_t *gui)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1185 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1186 gui->diskmenu = CreatePopupMenu();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1187 gui->menu=CreatePopupMenu();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1188 gui->trayplaymenu = CreatePopupMenu();
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1189 AppendMenu(gui->menu, MF_STRING | MF_POPUP, (UINT_PTR) gui->trayplaymenu, acp(MSGTR_MENU_Open));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1190 AppendMenu(gui->trayplaymenu, MF_STRING, IDFILE_OPEN, acp(MSGTR_MENU_PlayFile));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1191 AppendMenu(gui->trayplaymenu, MF_STRING, IDURL_OPEN, acp(MSGTR_MENU_PlayURL));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1192 AppendMenu(gui->trayplaymenu, MF_STRING, IDDIR_OPEN, acp(MSGTR_MENU_PlayDirectory));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1193 AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1194 AppendMenu(gui->menu, MF_STRING | MF_POPUP, (UINT_PTR) gui->diskmenu, acp(MSGTR_MENU_PlayDisc));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1195 AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1196 AppendMenu(gui->menu, MF_STRING, IDSUBTITLE_OPEN, acp(MSGTR_MENU_LoadSubtitle));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1197 AppendMenu(gui->menu, MF_STRING, ID_SKINBROWSER, acp(MSGTR_MENU_SkinBrowser));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1198 AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1199 AppendMenu(gui->menu, MF_STRING, ID_PREFS, acp(MSGTR_MENU_Preferences));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1200 AppendMenu(gui->menu, MF_STRING, ID_CONSOLE, acp(MSGTR_MENU_DebugConsole));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1201 AppendMenu(gui->menu, MF_STRING, ID_ONLINEHELP, acp(MSGTR_MENU_OnlineHelp));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1202 AppendMenu(gui->menu, MF_STRING, IDHELP_ABOUT, acp(MSGTR_MENU_AboutMPlayer));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1203 AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1204 AppendMenu(gui->menu, MF_STRING, IDEXIT, acp(MSGTR_MENU_Exit));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1205 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1206
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1207 static void create_traymenu(gui_t *gui)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1208 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1209 gui->traymenu = CreatePopupMenu();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1210 gui->trayplaybackmenu = CreatePopupMenu();
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1211 AppendMenu(gui->traymenu, MF_STRING | MF_POPUP, (UINT_PTR) gui->trayplaymenu, acp(MSGTR_MENU_Open));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1212 AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1213 AppendMenu(gui->traymenu, MF_STRING | MF_POPUP, (UINT_PTR) gui->trayplaybackmenu, acp(MSGTR_MENU_Playing));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1214 AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_SEEKB, acp(MSGTR_MENU_SeekBack));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1215 AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_PTRACK, acp(MSGTR_MENU_PrevStream));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1216 AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_PLAY, acp(MSGTR_MENU_Play "/" MSGTR_MENU_Pause));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1217 AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_STOP, acp(MSGTR_MENU_Stop));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1218 AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_NTRACK, acp(MSGTR_MENU_NextStream));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1219 AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_SEEKF, acp(MSGTR_MENU_SeekForw));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1220 AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1221 AppendMenu(gui->traymenu, MF_STRING, ID_MUTE, acp(MSGTR_MENU_Mute));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1222 AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1223 AppendMenu(gui->traymenu, MF_STRING, IDSUBTITLE_OPEN, acp(MSGTR_MENU_LoadSubtitle));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1224 AppendMenu(gui->traymenu, MF_STRING, ID_PLAYLIST, acp(MSGTR_MENU_PlayList));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1225 AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1226 AppendMenu(gui->traymenu, MF_STRING, ID_SHOWHIDE, acp(MSGTR_MENU_ShowHide));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1227 AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1228 AppendMenu(gui->traymenu, MF_STRING, ID_PREFS, acp(MSGTR_MENU_Preferences));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1229 AppendMenu(gui->traymenu, MF_STRING, ID_CONSOLE, acp(MSGTR_MENU_DebugConsole));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1230 AppendMenu(gui->traymenu, MF_STRING, ID_ONLINEHELP, acp(MSGTR_MENU_OnlineHelp));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1231 AppendMenu(gui->traymenu, MF_STRING, IDHELP_ABOUT, acp(MSGTR_MENU_AboutMPlayer));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1232 AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1233 AppendMenu(gui->traymenu, MF_STRING, IDEXIT, acp(MSGTR_MENU_Exit));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1234 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1235
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1236 static void create_videomenu(gui_t *gui)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1237 {
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1238 gui->videomenu = CreatePopupMenu();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1239 gui->dvdmenu = CreatePopupMenu();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1240 gui->aspectmenu = CreatePopupMenu();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1241 gui->subtitlemenu = CreatePopupMenu();
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1242 AppendMenu(gui->videomenu, MF_STRING | MF_POPUP, (UINT_PTR) gui->trayplaymenu, acp(MSGTR_MENU_Open));
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1243 AppendMenu(gui->videomenu, MF_SEPARATOR, 0, 0);
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1244 AppendMenu(gui->videomenu, MF_STRING, ID_SEEKB, acp(MSGTR_MENU_SeekBack));
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1245 AppendMenu(gui->videomenu, MF_STRING, ID_PTRACK, acp(MSGTR_MENU_PrevStream));
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1246 AppendMenu(gui->videomenu, MF_STRING, ID_PLAY, acp(MSGTR_MENU_Play "/" MSGTR_MENU_Pause));
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1247 AppendMenu(gui->videomenu, MF_STRING, ID_STOP, acp(MSGTR_MENU_Stop));
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1248 AppendMenu(gui->videomenu, MF_STRING, ID_NTRACK, acp(MSGTR_MENU_NextStream));
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1249 AppendMenu(gui->videomenu, MF_STRING, ID_SEEKF, acp(MSGTR_MENU_SeekForw));
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1250 AppendMenu(gui->videomenu, MF_SEPARATOR, 0, 0);
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1251 AppendMenu(gui->videomenu, MF_STRING, ID_FULLSCREEN, acp(MSGTR_MENU_FullScreen));
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1252 AppendMenu(gui->videomenu, MF_STRING, ID_MUTE, acp(MSGTR_MENU_Mute));
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1253 AppendMenu(gui->videomenu, MF_SEPARATOR, 0, 0);
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1254 AppendMenu(gui->videomenu, MF_STRING | MF_POPUP, (UINT_PTR) gui->aspectmenu, acp(MSGTR_MENU_AspectRatio));
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1255 AppendMenu(gui->videomenu, MF_STRING | MF_POPUP, (UINT_PTR) gui->subtitlemenu, acp(MSGTR_MENU_Subtitles));
34454
5a45efc630b8 Remove all unnecessary #ifdefs from GUI code.
ib
parents: 34452
diff changeset
1256 #ifdef CONFIG_DVDREAD
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1257 AppendMenu(gui->videomenu, MF_STRING | MF_POPUP, (UINT_PTR) gui->dvdmenu, acp(MSGTR_MENU_DVD));
34382
960c785cb6ef Rename MSGTR_SelectChapter MSGTR_SelectTitleChapter.
ib
parents: 34325
diff changeset
1258 AppendMenu(gui->dvdmenu, MF_STRING | MF_GRAYED, ID_CHAPTERSEL, acp(MSGTR_SelectTitleChapter));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1259 #endif
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1260 AppendMenu(gui->subtitlemenu, MF_STRING, IDSUB_TOGGLE, acp(MSGTR_MENU_SubtitlesOnOff));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1261 AppendMenu(gui->subtitlemenu, MF_STRING, IDSUB_CYCLE, acp(MSGTR_MENU_SubtitleLanguages));
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1262 AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT1, "16:9");
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1263 AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT2, "4:3");
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1264 AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT3, "2.35");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1265 AppendMenu(gui->aspectmenu, MF_SEPARATOR, 0, 0);
34163
95c396eb89ab Internationalize and localize the Win32 GUI.
ib
parents: 34162
diff changeset
1266 AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT4, acp(MSGTR_MENU_Original));
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1267 AppendMenu(gui->videomenu, MF_SEPARATOR, 0, 0);
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1268 AppendMenu(gui->videomenu, MF_STRING, IDEXIT, acp(MSGTR_MENU_Exit));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1269 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1270
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1271 static void maketransparent(HWND hwnd, COLORREF crTransparent)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1272 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1273 HDC mdc = GetDC(hwnd);
34133
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1274 RECT wrd, crd;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1275 HRGN crRgnres, crRgn, crRgnTmp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1276 int iX = 0, iY = 0, iLeftX = 0;
34133
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1277 int border, title;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1278 int width, height;
34133
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1279
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1280 GetWindowRect(hwnd, &wrd);
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1281 GetClientRect(hwnd, &crd);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1282
34133
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1283 border = (wrd.right - wrd.left - crd.right) / 2;
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1284 title = (wrd.bottom - wrd.top - crd.bottom) - border;
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1285
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1286 width = crd.right - crd.left;
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1287 height = crd.bottom - crd.top;
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1288
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1289 /* create the title bar region */
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1290 crRgn = CreateRectRgn(0, 0, width + border + border, title);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1291
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1292 /* Create a region from a bitmap with transparency colour of Purple */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1293 for (iY = -1; iY < height; iY++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1294 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1295 do
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1296 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1297 /* skip over transparent pixels at start of lines */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1298 while (iX <= width && GetPixel(mdc,iX, iY) == crTransparent) iX++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1299
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1300 /* remember this pixel */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1301 iLeftX = iX;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1302
34133
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1303 /* now find last non transparent pixel */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1304 while (iX <= width && GetPixel(mdc,iX, iY) != crTransparent) ++iX;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1305
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1306 /* create a temp region on this info */
34133
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1307 crRgnTmp = CreateRectRgn(iLeftX + border, iY + title, iX + border, iY + title + 1);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1308
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1309 /* combine into main region */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1310 crRgnres = crRgn;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1311 CombineRgn(crRgnres, crRgn, crRgnTmp, RGN_OR);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1312 crRgn = crRgnres;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1313
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1314 /* delete the temp region for next pass (otherwise you'll get an ASSERT) */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1315 DeleteObject(crRgnTmp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1316 } while (iX < width);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1317 iX = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1318 }
34133
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1319
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1320 /* left border region */
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1321 crRgnTmp = CreateRectRgn(0, title, border, title + height);
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1322 CombineRgn(crRgn, crRgn, crRgnTmp, RGN_OR);
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1323 DeleteObject(crRgnTmp);
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1324
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1325 /* right border region */
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1326 crRgnTmp = CreateRectRgn(width + border, title, width + border + border, title + height);
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1327 CombineRgn(crRgn, crRgn, crRgnTmp, RGN_OR);
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1328 DeleteObject(crRgnTmp);
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1329
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1330 /* bottom region */
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1331 crRgnTmp = CreateRectRgn(0, title + height, width + border + border, title + height + border);
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1332 CombineRgn(crRgn, crRgn, crRgnTmp, RGN_OR);
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1333 DeleteObject(crRgnTmp);
568f3a8e1b89 Support transparency in decorated windows in the Win32 GUI.
ib
parents: 34092
diff changeset
1334
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1335 SetWindowRgn(hwnd, crRgn, TRUE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1336 DeleteObject(crRgn);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1337 ReleaseDC(hwnd,mdc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1338 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1339
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1340 static int window_render(gui_t *gui, HWND hWnd, HDC hdc, window_priv_t *priv, window *desc, BITMAPINFO binfo)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1341 {
34996
ebcc17a3c165 Fix compiler warnings (comparison between signed and unsigned).
ib
parents: 34995
diff changeset
1342 unsigned int i;
33638
dbca6aa18b50 Cast new user data value in SetWindowLongPtr() to LONG_PTR.
ib
parents: 33615
diff changeset
1343 SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) gui);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1344 (gui->window_priv_count)++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1345 gui->window_priv = realloc(gui->window_priv, sizeof(window_priv_t *) * gui->window_priv_count);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1346 priv = gui->window_priv[gui->window_priv_count - 1] = calloc(1, sizeof(window_priv_t));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1347 priv->hwnd = hWnd;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1348 priv->type = desc->type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1349 priv->background = desc->base->bitmap[0];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1350 memcpy(&priv->img, desc->base->bitmap[0], sizeof(image));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1351 hdc = GetDC(hWnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1352 binfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1353 binfo.bmiHeader.biWidth = priv->img.width;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1354 binfo.bmiHeader.biHeight = -priv->img.height;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1355 binfo.bmiHeader.biPlanes = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1356 binfo.bmiHeader.biSizeImage = priv->img.width * priv->img.height * (gui->screenbpp / 8);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1357 binfo.bmiHeader.biXPelsPerMeter = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1358 binfo.bmiHeader.biYPelsPerMeter = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1359 binfo.bmiHeader.biClrUsed = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1360 binfo.bmiHeader.biClrImportant = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1361 binfo.bmiHeader.biBitCount = gui->screenbpp;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1362 binfo.bmiHeader.biCompression = BI_RGB;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1363 priv->bitmap = CreateDIBSection(hdc, &binfo, DIB_RGB_COLORS, (void **) &priv->img.data, NULL, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1364 if(!priv->bitmap)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1365 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1366 mp_msg(MSGT_GPLAYER, MSGL_FATAL, "[GUI] unable to create bitmap for skinned window\n");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1367 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1368 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1369 memcpy(priv->img.data, desc->base->bitmap[0]->data, binfo.bmiHeader.biSizeImage);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1370 ReleaseDC(hWnd,hdc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1371
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1372 for (i=0; i<gui->skin->widgetcount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1373 if(gui->skin->widgets[i]->window == desc->type)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1374 renderwidget(gui->skin, &priv->img, gui->skin->widgets[i], 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1375
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1376 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1377 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1378
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1379 /* creates the video window */
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1380 int create_videowindow(gui_t *gui)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1381 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1382 HINSTANCE instance = GetModuleHandle(NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1383 WNDCLASS wc;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1384 RECT rect;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1385 DWORD style = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1386 HDC hdc = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1387 BITMAPINFO binfo;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1388 window_priv_t *priv = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1389 window *desc = NULL;
34996
ebcc17a3c165 Fix compiler warnings (comparison between signed and unsigned).
ib
parents: 34995
diff changeset
1390 unsigned int i;
ebcc17a3c165 Fix compiler warnings (comparison between signed and unsigned).
ib
parents: 34995
diff changeset
1391 int x = -1, y = -1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1392 vo_colorkey = 0xff00ff;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1393
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1394 for (i=0; i<gui->skin->windowcount; i++)
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1395 if(gui->skin->windows[i]->type == wiVideo)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1396 desc = gui->skin->windows[i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1397
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1398 if(!desc)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1399 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1400 mp_msg(MSGT_GPLAYER, MSGL_FATAL, "[GUI] Invalid skin description\n");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1401 return 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1402 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1403
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1404 windowcolor = vo_colorkey;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1405 colorbrush = CreateSolidBrush(windowcolor);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1406 wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1407 wc.lpfnWndProc = VideoProc;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1408 wc.cbClsExtra = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1409 wc.cbWndExtra = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1410 wc.hInstance = instance;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1411 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1412 wc.hIcon = gui->icon;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1413 wc.hbrBackground = NULL; //WM_PAINT will handle background color switching;
34162
9b1b7d46b8d0 Change Win32 GUI window captions.
ib
parents: 34134
diff changeset
1414 wc.lpszClassName = "MPlayer - Video";
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1415 wc.lpszMenuName = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1416 RegisterClass(&wc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1417
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1418 /* create the video window menu */
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1419 create_videomenu(gui);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1420
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1421 rect.top = rect.left = 100;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1422 rect.bottom = rect.top+desc->base->bitmap[0]->height;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1423 rect.right = rect.left+desc->base->bitmap[0]->width;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1424
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1425 /* our window aspect */
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1426 video_aspect = (float)(rect.right-rect.left)/(rect.bottom-rect.top);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1427
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1428 style = fullscreen?WS_VISIBLE | WS_POPUP:WS_OVERLAPPEDWINDOW | WS_SYSMENU | WS_MINIMIZEBOX;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1429 AdjustWindowRect(&rect, style, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1430
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1431 if (gui_video_pos_x >= 0)
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1432 x = gui_video_pos_x;
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1433 if (gui_video_pos_y >= 0)
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1434 y = gui_video_pos_y;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1435
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1436 /* out of bounds check */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1437 if (x <= -1 || (x+(rect.right-rect.left) > GetSystemMetrics(SM_CXSCREEN)))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1438 x = CW_USEDEFAULT;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1439 if (y <= -1 || (y+(rect.bottom-rect.top) > GetSystemMetrics(SM_CYSCREEN)))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1440 y = x;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1441
34994
b6ac08b94fc3 Go without pointless variable hWnd/hwnd.
ib
parents: 34993
diff changeset
1442 gui->videowindow = CreateWindowEx(0, "MPlayer - Video", "MPlayer - Video", style,
34995
4c589a12ff6c Cosmetic: Adjust indent.
ib
parents: 34994
diff changeset
1443 x, y, rect.right-rect.left, rect.bottom-rect.top,
4c589a12ff6c Cosmetic: Adjust indent.
ib
parents: 34994
diff changeset
1444 NULL, NULL, instance, NULL);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1445
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1446 /* load all the window images */
34994
b6ac08b94fc3 Go without pointless variable hWnd/hwnd.
ib
parents: 34993
diff changeset
1447 window_render(gui, gui->videowindow, hdc, priv, desc, binfo);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1448
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1449 /* enable drag and drop support */
34994
b6ac08b94fc3 Go without pointless variable hWnd/hwnd.
ib
parents: 34993
diff changeset
1450 DragAcceptFiles(gui->videowindow, TRUE);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1451
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1452 if(video_window)
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1453 WinID = gui->videowindow;
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1454 ShowWindow(gui->videowindow, SW_SHOW);
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1455 UpdateWindow(gui->videowindow);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1456 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1457 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1458
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1459 /* loads/updates a skin and creates windows for it */
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27391
diff changeset
1460 int create_window(gui_t *gui, char *skindir)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1461 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1462 HINSTANCE instance = GetModuleHandle(NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1463 WNDCLASS wc;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1464 RECT rect;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1465 DWORD style = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1466 HDC hdc = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1467 BITMAPINFO binfo;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1468 window_priv_t *priv = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1469 window *desc = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1470 char dir[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1471 unsigned int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1472 int x = -1, y = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1473
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1474 /* destroy the current main window */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1475 if(gui->skin) destroy_window(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1476
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1477 /* get screenproperties */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1478 gui->screenbpp = GetDesktopBitsPerPixel();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1479 gui->screenw = GetSystemMetrics(SM_CXSCREEN);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1480 gui->screenh = GetSystemMetrics(SM_CYSCREEN);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1481
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1482 /* load the new skin */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1483 gui->skin = loadskin(skindir, gui->screenbpp);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1484 if(!gui->skin)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1485 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1486 mp_msg(MSGT_GPLAYER, MSGL_FATAL, "[GUI] fatal error during skinload\n");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1487 /* Set default Skin */
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 31532
diff changeset
1488 free(skinName);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1489 skinName = strdup("Blue");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1490 /* then force write conf */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1491 cfg_write();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1492 return 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1493 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1494
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1495 /* find the description of the mainwindow */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1496 for (i=0; i<gui->skin->windowcount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1497 if(gui->skin->windows[i]->type == wiMain)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1498 desc = gui->skin->windows[i];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1499
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1500 if(!desc)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1501 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1502 mp_msg(MSGT_GPLAYER, MSGL_FATAL, "[GUI] Invalid skin description\n");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1503 return 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1504 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1505
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1506 /* load the icon from the executable */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1507 GetModuleFileName(NULL, dir, MAX_PATH);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1508 gui->icon = ExtractIcon(instance, dir, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1509
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1510 /* create the window class */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1511 wc.style = CS_HREDRAW | CS_VREDRAW;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1512 wc.lpfnWndProc = EventProc;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1513 wc.cbClsExtra = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1514 wc.cbWndExtra = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1515 wc.hInstance = instance;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1516 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1517 wc.hIcon = gui->icon;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1518 wc.hbrBackground = CreateSolidBrush(RGB(0, 0, 0));
34162
9b1b7d46b8d0 Change Win32 GUI window captions.
ib
parents: 34134
diff changeset
1519 wc.lpszClassName = gui->classname = "MPlayer";
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1520 wc.lpszMenuName = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1521 RegisterClass(&wc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1522
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1523 /* create a context menu */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1524 create_menu(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1525 /* create the systray menu */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1526 create_traymenu(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1527
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1528 /* create the mainwindow */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1529 /* TODO implement aligning as described in skin.html */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1530 rect.top = rect.left = 100;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1531 rect.bottom = rect.top+desc->base->bitmap[0]->height;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1532 rect.right = rect.left+desc->base->bitmap[0]->width;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1533 if(desc->decoration) style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1534 else style = WS_POPUP | WS_SYSMENU;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1535
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1536 AdjustWindowRect(&rect, style, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1537
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1538 /* Check if out of screen */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1539 if (gui_main_pos_x >= 0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1540 x = gui_main_pos_x;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1541 if (gui_main_pos_y >= 0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1542 y = gui_main_pos_y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1543
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1544 if (x <= -1 || (x+(rect.right-rect.left) > GetSystemMetrics(SM_CXFULLSCREEN)))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1545 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1546 x = (GetSystemMetrics(SM_CXSCREEN) / 2) - ((rect.right-rect.left) / 2);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1547 gui_main_pos_x = x;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1548 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1549 if (y <= -1 || (y+(rect.bottom-rect.top) > GetSystemMetrics(SM_CYFULLSCREEN)))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1550 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1551 y = ((GetSystemMetrics(SM_CYSCREEN)-40) - (rect.bottom-rect.top));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1552 gui_main_pos_y = y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1553 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1554
34994
b6ac08b94fc3 Go without pointless variable hWnd/hwnd.
ib
parents: 34993
diff changeset
1555 gui->mainwindow = CreateWindowEx(0, gui->classname, "MPlayer", style,
34995
4c589a12ff6c Cosmetic: Adjust indent.
ib
parents: 34994
diff changeset
1556 x, y, rect.right-rect.left, rect.bottom-rect.top,
4c589a12ff6c Cosmetic: Adjust indent.
ib
parents: 34994
diff changeset
1557 NULL, NULL, instance, NULL);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1558
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1559 /* set the systray icon properties */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1560 nid.cbSize = sizeof(NOTIFYICONDATA);
34994
b6ac08b94fc3 Go without pointless variable hWnd/hwnd.
ib
parents: 34993
diff changeset
1561 nid.hWnd = gui->mainwindow;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1562 nid.uID = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1563 nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1564 nid.uCallbackMessage = WM_SYSTRAY;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1565 nid.hIcon = gui->icon;
34162
9b1b7d46b8d0 Change Win32 GUI window captions.
ib
parents: 34134
diff changeset
1566 strcpy(nid.szTip, "MPlayer");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1567
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1568 /* register the systray icon */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1569 Shell_NotifyIcon(NIM_ADD, &nid);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1570
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1571 /* load all the window images */
34994
b6ac08b94fc3 Go without pointless variable hWnd/hwnd.
ib
parents: 34993
diff changeset
1572 window_render(gui, gui->mainwindow, hdc, priv, desc, binfo);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1573
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1574 /* enable drag and drop support */
34994
b6ac08b94fc3 Go without pointless variable hWnd/hwnd.
ib
parents: 34993
diff changeset
1575 DragAcceptFiles(gui->mainwindow, TRUE);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1576
34994
b6ac08b94fc3 Go without pointless variable hWnd/hwnd.
ib
parents: 34993
diff changeset
1577 updatedisplay(gui, gui->mainwindow);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1578
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1579 /* display */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1580 ShowWindow(gui->mainwindow, SW_SHOW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1581 UpdateWindow(gui->mainwindow);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1582 maketransparent(gui->mainwindow, RGB(255, 0, 255));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1583 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1584 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1585
33781
cdd4fc0616b6 Fix memory leak in the Win32 GUI.
ib
parents: 33770
diff changeset
1586 gui_t *create_gui(char *skindir, void (*playercontrol)(int event))
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1587 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1588 gui_t *gui = calloc(1, sizeof(gui_t));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1589 char temp[MAX_PATH];
34162
9b1b7d46b8d0 Change Win32 GUI window captions.
ib
parents: 34134
diff changeset
1590 HWND runningmplayer = FindWindow("MPlayer", "MPlayer");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1591
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1592 if(runningmplayer)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1593 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1594 free(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1595 return NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1596 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1597
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1598 gui->startplay = startplay;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1599 gui->playercontrol = playercontrol;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1600 gui->uninit = uninit;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1601 gui->updatedisplay = updatedisplay;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1602
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1603 /* create playlist */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1604 gui->playlist = create_playlist();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1605
34092
dbf5042ab255 Don't use the Windows style path separator character in Win32 GUI.
ib
parents: 33965
diff changeset
1606 sprintf(temp, "%s/%s", skindir, skinName);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1607 if(create_window(gui, temp)) return NULL;
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
1608 if(create_videowindow(gui)) return NULL;
35001
05d54ab2ba5c Add check-mark for menu item "Debug Console".
ib
parents: 34996
diff changeset
1609 if(console) console_toggle(gui);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1610 return gui;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1611 }