annotate gui/win32/dialogs.c @ 33984:60449f4234f7

Add doxygen comments to bitmap.c and bitmap.h.
author ib
date Tue, 06 Sep 2011 15:10:01 +0000
parents 4789b8eed97e
children b9cab6c0992c
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 <windows.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
25 #include <commctrl.h>
30901
76a13038105e Rename get_path.[ch] --> path.[ch].
diego
parents: 30702
diff changeset
26 #include "path.h"
26372
76413880bfad Update include paths to account for build system changes.
diego
parents: 26193
diff changeset
27 #include "gui/interface.h"
33761
16286ee1fc71 Fix Win32 GUI compilation problems.
ib
parents: 33735
diff changeset
28 #include "gui/ui/actions.h"
23091
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
29 #include "mp_msg.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
30 #include "help_mp.h"
32032
52b0385d2d7a Move **sub_name extern declaration to mpcommon.h.
diego
parents: 32030
diff changeset
31 #include "mpcommon.h"
23091
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
32 #include "stream/stream.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
33 #include "libmpdemux/demuxer.h"
52488bb09d90 Consistently use quotes instead of angled brackets in #include
diego
parents: 23079
diff changeset
34 #include "libmpdemux/stheader.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
35 #include "gui.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
36 #include "dialogs.h"
32467
fbe5c829c69b Move libvo/sub.[ch] from libvo to sub.
cigaes
parents: 32038
diff changeset
37 #include "sub/sub.h"
32038
0fb2562cb130 Add appropriate #include instead of declaring vo_gamma_* extern.
diego
parents: 32032
diff changeset
38 #include "libvo/video_out.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
39
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
40 WNDPROC OldUrlWndProc;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
41 LRESULT CALLBACK SubUrlWndProc(HWND, UINT, WPARAM, LPARAM);
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27341
diff changeset
42 int set_video_colors(sh_video_t *sh_video, const char *item, int value);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27341
diff changeset
43 int get_video_colors(sh_video_t *sh_video, const char *item, int *value);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
44
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
45 guiInterface_t guiInfo;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
46 int addurl = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
47
33790
ab6d06f5b98b Add const to some string pointer arguments that will not be modified.
ib
parents: 33782
diff changeset
48 void mplayerLoadSubtitle(const char *name)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
49 {
33773
a3983d2c9106 Remove unused members from struct guiInterface_t.
ib
parents: 33763
diff changeset
50 if (!guiInfo.Playing) return;
a3983d2c9106 Remove unused members from struct guiInterface_t.
ib
parents: 33763
diff changeset
51
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52 if (subdata)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
54 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_DeletingSubtitles);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
55 sub_free(subdata);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56 subdata = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
57 vo_sub = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
58 if (vo_osd_list)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
59 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60 int len;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
61 mp_osd_obj_t *osd = vo_osd_list;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62 while (osd)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
63 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
64 if (osd->type == OSDTYPE_SUBTITLE) break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65 osd = osd->next;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
66 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
67 if (osd && osd->flags & OSDFLAG_VISIBLE)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
68 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
69 len = osd->stride * (osd->bbox.y2 - osd->bbox.y1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70 memset(osd->bitmap_buffer, 0, len);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
71 memset(osd->alpha_buffer, 0, len);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
72 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
73 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
75
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
76 if (name)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
77 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
78 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_LoadingSubtitles, name);
33775
b42abb9c7f2c Remove member FPS from struct guiInterface_t.
ib
parents: 33773
diff changeset
79 subdata = sub_read_file(strdup(name), (guiInfo.sh_video ? guiInfo.sh_video->fps : 0));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
80 if (!subdata) mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_CantLoadSub,name);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
81 sub_name = (malloc(2 * sizeof(char*))); /* when mplayer will be restarted */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
82 sub_name[0] = strdup(name); /* sub_name[0] will be read */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
83 sub_name[1] = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
84 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
85 update_set_of_subtitles();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
86 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
87
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88 int display_openfilewindow(gui_t *gui, int add)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
89 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
90 OPENFILENAME fileopen;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
91 int result = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92 char filelist[MAXFILE];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
93 char filename[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
94 char directory[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
95 char *filespec = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
96 char *filepart = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
97
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98 memset(&fileopen, 0, sizeof(OPENFILENAME));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99 memset(filelist, 0, sizeof(filelist));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
100
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101 fileopen.lStructSize = sizeof(OPENFILENAME);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 fileopen.hwndOwner = gui->mainwindow;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
103 fileopen.hInstance = GetModuleHandle(NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
104 fileopen.lpstrFilter = "All Files (*.*)\0*.*\0"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
105 "Media Files (*.avi;*.asf;*.wmv;*.mpg;*.mpeg;*.m2v;*.mov;\
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
106 *.rmvb;*.rm;*.ogm;*.mp3;*.wav;*.wma;*.ra;*.ogg)\0\
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
107 *.avi;*.asf;*.wmv;*.mpg;*.mpeg;*.m2v;*.mov;\
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
108 *.rmvb;*.rm;*.ogm;*.mp3;*.wav;*.wma;*.ra;*.ogg\0"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
109 "Video Files (*.avi;*.mpg;*.mpeg;*.mov)\0*.avi;*.mpg;*.mpeg;*.mov\0"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
110 "Avisynth Scripts (*.avs)\0*.avs\0"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
111 "Audio Files (*.mp3;*.wav;*.ra)\0*.mp3;*.wav;*.ra\000";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
112 fileopen.nFilterIndex = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
113 fileopen.lpstrTitle = "Add file(s)...";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
114 fileopen.Flags = OFN_ALLOWMULTISELECT | OFN_FILEMUSTEXIST| OFN_LONGNAMES | OFN_EXPLORER| OFN_READONLY | OFN_HIDEREADONLY;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
115 fileopen.lpstrFile = filelist;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
116 fileopen.lpstrCustomFilter = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
117 fileopen.nMaxFile = MAXFILE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
118
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
119 if(GetOpenFileName(&fileopen))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
120 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
121 /* clear playlist */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
122 if(!add) gui->playlist->clear_playlist(gui->playlist);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
123
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
124 memcpy(directory, fileopen.lpstrFile, fileopen.nFileOffset - 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
125 directory[fileopen.nFileOffset - 1] = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
126
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
127 do
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
128 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
129 filespec = &fileopen.lpstrFile[fileopen.nFileOffset];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
130 filename[0] = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
131 strcat(filename, directory);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
132 strcat(filename, "\\");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
133 strcat(filename, filespec);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
134
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
135 if (GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
136 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] %s is a directory, skipping...\n", filename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
137 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
138 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
139 if (GetFullPathName(filename, MAX_PATH, filename, &filepart))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
140 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
141 uiSetFileName(NULL, filename, STREAMTYPE_FILE);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
142 if(!parse_filename(filename, playtree, mconfig, 0))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
143 gui->playlist->add_track(gui->playlist, filename, NULL, filepart, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
144 mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding file: %s - path %s\n", filespec, filename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
145 result++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
146 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
147 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148 fileopen.nFileOffset += strlen(filespec) + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
149 } while (*filespec);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
150 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
151 return result;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
152 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
153
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
154 void display_opensubtitlewindow(gui_t *gui)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
155 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
156 OPENFILENAME subtitleopen;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
157 char subtitlefile[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
158
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
159 /* Safety check */
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
160 if (guiInfo.Playing == GUI_STOP || !guiInfo.sh_video) return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
161
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
162 memset(&subtitleopen, 0, sizeof(OPENFILENAME));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
163 memset(subtitlefile, 0, sizeof(subtitlefile));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
164
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
165 subtitleopen.lStructSize = sizeof(OPENFILENAME);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
166 subtitleopen.hwndOwner = gui->mainwindow;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
167 subtitleopen.hInstance = GetModuleHandle(NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
168 subtitleopen.lpstrFilter = "All Files (*.*)\0*.*\0"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
169 "Subtitle Files (*.srt;*.txt;*.vob)\0*.srt;*.txt;*.vob\0";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
170 subtitleopen.nFilterIndex = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171 subtitleopen.lpstrTitle = "Add Subtitle...";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
172 subtitleopen.Flags = OFN_FILEMUSTEXIST | OFN_LONGNAMES | OFN_EXPLORER | OFN_READONLY | OFN_HIDEREADONLY;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
173 subtitleopen.lpstrFile = subtitlefile;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
174 subtitleopen.lpstrCustomFilter = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
175 subtitleopen.nMaxFile = MAXFILE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
176
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
177 if(GetOpenFileName(&subtitleopen))
33763
03824cf8728d Cosmetic: Rename two functions that do MPlayer calls.
ib
parents: 33761
diff changeset
178 mplayerLoadSubtitle(subtitlefile);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
179 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
180
33579
cd855f2f1024 win32 gui: Mark some functions as static.
diego
parents: 33555
diff changeset
181 static void display_loadplaylistwindow(gui_t *gui)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
182 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
183 OPENFILENAME playlistopen;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
184 char playlistfile[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
185
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
186 memset(&playlistopen, 0, sizeof(OPENFILENAME));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
187 memset(playlistfile, 0, sizeof(playlistfile));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
188
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
189 playlistopen.lStructSize = sizeof(OPENFILENAME);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
190 playlistopen.hwndOwner = gui->mainwindow;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
191 playlistopen.hInstance = GetModuleHandle(NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
192 playlistopen.lpstrFilter = "All Files (*.*)\0*.*\0"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
193 "Playlist Files (*.m3u;*.pls;*.txt)\0*.m3u;*.pls;*.txt\0";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
194 playlistopen.nFilterIndex = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
195 playlistopen.lpstrTitle = "Load Playlist...";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
196 playlistopen.Flags = OFN_FILEMUSTEXIST | OFN_LONGNAMES | OFN_EXPLORER | OFN_READONLY | OFN_HIDEREADONLY;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
197 playlistopen.lpstrFile = playlistfile;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
198 playlistopen.lpstrCustomFilter = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
199 playlistopen.nMaxFile = MAXFILE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
200
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
201 if(GetOpenFileName(&playlistopen))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
202 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
203 if(parse_filename(playlistfile, playtree, mconfig, 1))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
204 gui->startplay(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
205 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
206 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
207
33579
cd855f2f1024 win32 gui: Mark some functions as static.
diego
parents: 33555
diff changeset
208 static void display_saveplaylistwindow(gui_t* gui)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
209 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
210 OPENFILENAME playlistsave;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
211 static FILE *playlist_file = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
212 char playlistname[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
213
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
214 memset(&playlistsave, 0, sizeof(OPENFILENAME));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
215 memset(playlistname, 0, sizeof(playlistname));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
216
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
217 playlistsave.lStructSize = sizeof(OPENFILENAME);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
218 playlistsave.hwndOwner = gui->mainwindow;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
219 playlistsave.hInstance = GetModuleHandle(NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
220 playlistsave.lpstrFilter = "Playlist Files (*.pls)\0*.pls\0";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
221 playlistsave.nFilterIndex = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222 playlistsave.lpstrTitle = "Save Playlist...";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
223 playlistsave.Flags = OFN_LONGNAMES | OFN_EXPLORER | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
224 playlistsave.lpstrFile = playlistname;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
225 playlistsave.lpstrCustomFilter = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
226 playlistsave.nMaxFile = MAXFILE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
227
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
228 if(GetSaveFileName(&playlistsave))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
229 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
230 int i=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
231 HANDLE my_playlist;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
232
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
233 if(!strstr(playlistname, ".pls")) strcat(playlistname, ".pls");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
234
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
235 my_playlist = CreateFile(playlistname,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
236 GENERIC_WRITE,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
237 0,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
238 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
239 CREATE_ALWAYS,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
240 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
241 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
242
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
243 if(my_playlist != INVALID_HANDLE_VALUE)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
244 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
245 CloseHandle(my_playlist); /* close the file first so we can write to it */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
246 playlist_file = fopen(playlistsave.lpstrFile, "w");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
247 fprintf(playlist_file, "[playlist]\n");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
248 fprintf(playlist_file, "numberofentries=%d\n", gui->playlist->trackcount);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
249
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
250 for(i=0; i<(gui->playlist->trackcount); i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
251 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
252 fprintf(playlist_file, "File%i=%s\n", i + 1, gui->playlist->tracks[i]->filename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
253 fprintf(playlist_file, "Length%i=-1\n", i + 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
254 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
255 fclose(playlist_file);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
256 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
257 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
258 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
259
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
260 static LRESULT CALLBACK OpenUrlWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
261 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
262 static HWND url;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
263 HWND wdg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
264 FILE *f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
265 char *history = get_path("gui.url");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
266 gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
267 switch (iMsg)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
268 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
269 case WM_CREATE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
270 wdg = CreateWindow("button", "Ok",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
271 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
272 4, 43, 80, 25, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
273 (HMENU) ID_OK,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
274 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
275 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
276 SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
277
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
278 wdg = CreateWindow("button", "Cancel",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
279 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
280 90, 43, 80, 25, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
281 (HMENU) ID_CANCEL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
282 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
283 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
284 SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
285
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
286 url = wdg = CreateWindowEx(WS_EX_CLIENTEDGE,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
287 "edit", NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
288 WS_CHILD | WS_VISIBLE | ES_LEFT | ES_AUTOHSCROLL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
289 4, 10, 300, 25, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
290 (HMENU) ID_URL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
291 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
292 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
293 SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
294 SendMessage(wdg, EM_SETLIMITTEXT, MAX_PATH, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
295
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
296 /*subclass the edit box to capture the VK_RETURN key*/
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
297 OldUrlWndProc = (WNDPROC)SetWindowLongPtr(url, GWLP_WNDPROC, (LONG_PTR)SubUrlWndProc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
298
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
299 if((f = fopen(history, "r")))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
300 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
301 char lasturl[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
302 fgets(lasturl, MAX_PATH, f);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
303 SendMessage(url, WM_SETTEXT, 0, (LPARAM) lasturl);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
304 SendMessage(url, EM_SETSEL, 0, -1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
305 fclose(f);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
306 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
307 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
308 case WM_KEYDOWN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
309 switch (LOWORD(wParam))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
310 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
311 case VK_RETURN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
312 SendMessage(hwnd, WM_COMMAND, (WPARAM) ID_OK, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
313 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
314 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
315 case WM_COMMAND:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
316 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
317 switch (LOWORD(wParam))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
318 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
319 case ID_CANCEL:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
320 DestroyWindow(hwnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
321 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
322 case ID_OK:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
323 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
324 char file[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
325 SendMessage(url, WM_GETTEXT, MAX_PATH, (LPARAM) file);
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
326 uiSetFileName(NULL, file, STREAMTYPE_STREAM);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
327 if((f = fopen(history, "wt+")))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
328 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
329 fprintf(f, file);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
330 fclose(f);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
331 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
332 if(!parse_filename(file, playtree, mconfig, addurl? 0 : 1))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
333 gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
334 if(!addurl)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
335 gui->startplay(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
336 else update_playlistwindow();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
337 DestroyWindow(hwnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
338 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
339 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
340 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
341 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
342 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
343 case WM_DESTROY:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
344 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
345 addurl = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
346 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
347 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
348 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
349 return DefWindowProc(hwnd, iMsg, wParam, lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
350 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
351
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
352 LRESULT CALLBACK SubUrlWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
353 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
354 switch(iMsg)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
355 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
356 case WM_KEYDOWN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
357 switch (LOWORD(wParam))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
358 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
359 case VK_RETURN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
360 SendMessage(FindWindow(NULL, "MPlayer - Open URL..."), WM_COMMAND, (WPARAM) ID_OK, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
361 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
362 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
363 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
364 return CallWindowProc(OldUrlWndProc, hwnd, iMsg, wParam, lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
365 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
366
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
367 void display_openurlwindow(gui_t *gui, int add)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
368 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
369 HWND hWnd;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
370 HINSTANCE hInstance = GetModuleHandle(NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
371 WNDCLASS wc;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
372 int x, y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
373
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
374 if(add) addurl = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
375 if(FindWindow(NULL, "MPlayer - Open URL...")) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
376 wc.style = CS_HREDRAW | CS_VREDRAW;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
377 wc.lpfnWndProc = OpenUrlWndProc;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
378 wc.cbClsExtra = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
379 wc.cbWndExtra = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
380 wc.hInstance = hInstance;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
381 wc.hCursor = LoadCursor(NULL,IDC_ARROW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
382 wc.hIcon = gui->icon;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
383 wc.hbrBackground = SOLID_GREY2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
384 wc.lpszClassName = "MPlayer - URL";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
385 wc.lpszMenuName = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
386 RegisterClass(&wc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
387 x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (320 / 2);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
388 y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (100 / 2);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
389 hWnd = CreateWindow("MPlayer - URL",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
390 "MPlayer - Open URL...",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
391 WS_POPUPWINDOW | WS_CAPTION,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
392 x,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
393 y,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
394 320,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
395 100,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
396 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
397 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
398 hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
399 NULL);
33638
dbca6aa18b50 Cast new user data value in SetWindowLongPtr() to LONG_PTR.
ib
parents: 33615
diff changeset
400 SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) gui);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
401 ShowWindow(hWnd, SW_SHOW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
402 UpdateWindow(hWnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
403 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
404
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
405 static void create_playlistmenu(gui_t *gui)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
406 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
407 gui->playlistmenu = CreatePopupMenu();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
408 AppendMenu(gui->playlistmenu, MF_STRING, ID_ADDFILE, "Add File...");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
409 AppendMenu(gui->playlistmenu, MF_STRING, ID_ADDURL, "Add Url...");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
410 AppendMenu(gui->playlistmenu, MF_SEPARATOR, 0, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
411 AppendMenu(gui->playlistmenu, MF_STRING, ID_REMOVE, "Remove Selected");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
412 AppendMenu(gui->playlistmenu, MF_STRING, ID_CLEAR, "Clear Playlist");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
413 AppendMenu(gui->playlistmenu, MF_SEPARATOR, 0, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
414 AppendMenu(gui->playlistmenu, MF_STRING, ID_CLOSE, "Close");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
415 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
416
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
417 static void updatetracklist(HWND hwnd)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
418 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
419 int i=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
420 gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
421 /* clear listbox */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
422 SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_RESETCONTENT, 0, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
423 for (i=0; i < gui->playlist->trackcount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
424 if (gui->playlist->tracks[i]->title)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
425 SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_ADDSTRING, 0, (LPARAM)gui->playlist->tracks[i]->title);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
426 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
427 SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_ADDSTRING, 0, (LPARAM)gui->playlist->tracks[i]->filename);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
428 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
429
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
430 static LRESULT CALLBACK PlayListWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
431 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
432 HWND wdg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
433 POINT cursor;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
434 gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
435 playlist_t *pl = gui ? gui->playlist : NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
436 switch (iMsg)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
437 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
438 case WM_CREATE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
439 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
440 wdg = CreateWindow("button", "Play",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
441 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
442 4, 10, 80, 25, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
443 (HMENU) ID_PLAY,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
444 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
445 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
446 SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
447
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
448 wdg = CreateWindow ("button", "Up",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
449 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
450 4, 37, 80, 25, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
451 (HMENU) ID_UP,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
452 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
453 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
454 SendMessage(wdg, WM_SETFONT,(WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
455
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
456 wdg = CreateWindow ("button", "Down",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
457 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
458 4, 64, 80, 25, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
459 (HMENU) ID_DOWN,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
460 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
461 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
462 SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
463
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
464 wdg = CreateWindow ("button", "Remove",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
465 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
466 4, 91, 80, 25, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
467 (HMENU) ID_REMOVE,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
468 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
469 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
470 SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
471
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
472 wdg = CreateWindow ("button", "Load",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
473 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
474 4, 118, 80, 25, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
475 (HMENU) ID_PLAYLISTLOAD,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
476 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
477 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
478 SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
479
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
480 wdg = CreateWindow ("button", "Save",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
481 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
482 4, 145, 80, 25, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
483 (HMENU) ID_PLAYLISTSAVE,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
484 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
485 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
486 SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
487
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
488 wdg = CreateWindow ("button", "Close",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
489 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
490 4, 193, 80, 25, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
491 (HMENU) ID_CLOSE,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
492 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
493 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
494 SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
495
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
496 wdg = CreateWindow ("listbox", "tracklist", WS_CHILD | WS_VISIBLE | LBS_NOTIFY | WS_VSCROLL |
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
497 WS_HSCROLL | LBS_DISABLENOSCROLL, 92, 10, 300, 208, hwnd, (HMENU) ID_TRACKLIST,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
498 ((LPCREATESTRUCT) lParam) -> hInstance, NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
499 SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
500 SendMessage(wdg, LB_SETHORIZONTALEXTENT, MAX_PATH*4, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
501 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
502 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
503 case WM_CONTEXTMENU:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
504 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
505 GetCursorPos(&cursor);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
506 SetForegroundWindow(hwnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
507 TrackPopupMenu(gui->playlistmenu, 0, cursor.x, cursor.y, 0, hwnd, NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
508 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
509 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
510 case WM_COMMAND:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
511 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
512 int selected = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
513 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
514 for (i=0; i<pl->trackcount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
515 if(0 < SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_GETSEL, i, 0)) selected = i + 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
516 switch (LOWORD(wParam))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
517 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
518 case ID_CLOSE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
519 DestroyWindow(hwnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
520 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
521 case ID_TRACKLIST:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
522 if(HIWORD(wParam) == LBN_DBLCLK)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
523 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
524 case ID_PLAY:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
525 if(selected) pl->current = selected - 1;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
526 uiSetFileName(NULL, pl->tracks[pl->current]->filename, STREAMTYPE_STREAM);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
527 gui->startplay(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
528 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
529 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
530 case ID_UP:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
531 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
532 if(selected) pl->moveup_track(pl, selected);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
533 selected--;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
534 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
535 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
536 case ID_DOWN:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
537 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
538 if(selected) pl->movedown_track(pl, selected);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
539 selected++;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
540 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
541 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
542 case ID_REMOVE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
543 if(selected) pl->remove_track(pl, selected);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
544 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
545 case ID_ADDFILE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
546 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
547 if(guiInfo.StreamType == STREAMTYPE_DVD ||
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
548 guiInfo.StreamType == STREAMTYPE_DVDNAV) return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
549 display_openfilewindow(gui, 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
550 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
551 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
552 case ID_ADDURL:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
553 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
554 if(guiInfo.StreamType == STREAMTYPE_DVD ||
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
555 guiInfo.StreamType == STREAMTYPE_DVDNAV) return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
556 display_openurlwindow(gui, 1);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
557 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
558 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
559 case ID_CLEAR:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
560 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
561 if(!gui->playlist->trackcount) return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
562 gui->playlist->clear_playlist(gui->playlist);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
563 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
564 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
565 case ID_PLAYLISTLOAD:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
566 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
567 if(guiInfo.StreamType == STREAMTYPE_DVD ||
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
568 guiInfo.StreamType == STREAMTYPE_DVDNAV) return 0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
569 display_loadplaylistwindow(gui);
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 ID_PLAYLISTSAVE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
573 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
574 /* no point saving an empty playlist */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
575 if(!gui->playlist->trackcount ||
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
576 guiInfo.StreamType == STREAMTYPE_DVD ||
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
577 guiInfo.StreamType == STREAMTYPE_DVDNAV)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
578 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
579 display_saveplaylistwindow(gui);
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 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
583 updatetracklist(hwnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
584 if(selected < 1) selected = 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
585 else if(selected>pl->trackcount) selected = pl->trackcount;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
586 SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_SETCURSEL, selected - 1, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
587 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
588 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
589 case WM_DROPFILES:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
590 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
591 char file[MAX_PATH];
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
592 int filecount = DragQueryFile((HDROP) wParam, -1, file, MAX_PATH);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
593 int i;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
594 for (i=0; i<filecount; i++)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
595 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
596 DragQueryFile((HDROP) wParam, i, file, MAX_PATH);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
597 if(!parse_filename(file, playtree, mconfig, 0))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
598 pl->add_track(pl, file, NULL, NULL, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
599 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
600 DragFinish((HDROP) wParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
601 updatetracklist(hwnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
602 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
603 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
604 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
605 return DefWindowProc(hwnd, iMsg, wParam, lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
606 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
607
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
608 void update_playlistwindow(void)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
609 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
610 HWND hWnd = FindWindow(NULL, "MPlayer Playlist");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
611 if (hWnd) updatetracklist(hWnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
612 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
613
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
614 void display_playlistwindow(gui_t *gui)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
615 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
616 HWND hWnd = FindWindow(NULL, "MPlayer Playlist");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
617 HINSTANCE hInstance = GetModuleHandle(NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
618 WNDCLASS wc;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
619 int x, y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
620
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
621 if (hWnd)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
622 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
623 SendMessage(hWnd, WM_CLOSE, 0, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
624 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
625 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
626
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
627 wc.style = CS_HREDRAW | CS_VREDRAW;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
628 wc.lpfnWndProc = PlayListWndProc;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
629 wc.cbClsExtra = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
630 wc.cbWndExtra = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
631 wc.hInstance = hInstance;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
632 wc.hCursor = LoadCursor(NULL,IDC_ARROW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
633 wc.hIcon = gui->icon;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
634 wc.hbrBackground = SOLID_GREY2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
635 wc.lpszClassName = "MPlayer - Playlist";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
636 wc.lpszMenuName = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
637 RegisterClass(&wc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
638 create_playlistmenu(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
639 x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (400 / 2); /* Erik: center popup window on screen */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
640 y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (254 / 2);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
641 hWnd = CreateWindow("MPlayer - Playlist",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
642 "MPlayer Playlist",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
643 WS_POPUPWINDOW | WS_CAPTION | WS_MINIMIZEBOX,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
644 x,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
645 y,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
646 400,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
647 254,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
648 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
649 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
650 hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
651 NULL);
33638
dbca6aa18b50 Cast new user data value in SetWindowLongPtr() to LONG_PTR.
ib
parents: 33615
diff changeset
652 SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)gui);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
653 updatetracklist(hWnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
654 DragAcceptFiles(hWnd,TRUE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
655 ShowWindow(hWnd, SW_SHOW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
656 UpdateWindow(hWnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
657 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
658
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
659 static LRESULT CALLBACK SkinBrowserWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
660 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
661 static HWND listbox;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
662 static char skinspath[MAX_PATH];
33735
84defaf2e7f8 Fix compilation of the Win32 GUI after r33812.
ib
parents: 33731
diff changeset
663 gui_t* mygui = (gui_t*) GetWindowLongPtr(hwnd, GWLP_USERDATA);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
664 switch (iMsg)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
665 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
666 case WM_CREATE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
667 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
668 HANDLE skinHandle = INVALID_HANDLE_VALUE;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
669 WIN32_FIND_DATA finddata;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
670
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
671 listbox = CreateWindow("listbox", NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
672 WS_CHILD | WS_VISIBLE | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT |
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
673 LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
674 4, 5, 166, 60, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
675 (HMENU) ID_DIR,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
676 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
677 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
678 SendMessage(listbox, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
679
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
680 /* This opens the skins directory, lists the directory names, and adds them to the listbox */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
681 sprintf(skinspath, "%s/*.", get_path("skins"));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
682
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
683 skinHandle = FindFirstFile(skinspath, &finddata);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
684 if (skinHandle != INVALID_HANDLE_VALUE)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
685 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
686 do
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
687 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
688 if (finddata.cFileName[0] == '.') continue;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
689 /* populate the listbox */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
690 capitalize(finddata.cFileName);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
691 SendDlgItemMessage(hwnd, ID_DIR, LB_ADDSTRING, 0, (LPARAM) finddata.cFileName);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
692 } while (FindNextFile(skinHandle, &finddata));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
693 FindClose(skinHandle);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
694 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
695 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
696 mp_msg(MSGT_GPLAYER, MSGL_FATAL, "Error opening %s\n", get_path("skins"));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
697 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
698 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
699 case WM_COMMAND:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
700 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
701 if ((HWND) lParam == listbox)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
702 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
703 if(HIWORD(wParam) == LBN_DBLCLK)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
704 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
705 int index = SendMessage(listbox, LB_GETCURSEL, 0, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
706 int len = SendMessage(listbox, LB_GETTEXTLEN, index, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
707 if (len)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
708 {
33731
81f71d910333 Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents: 33725
diff changeset
709 if (guiInfo.Playing) gui(GUI_SET_STATE, (void *) GUI_STOP);
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 32467
diff changeset
710 free(skinName);
30702
9fc9d1e788aa Do not cast the results of malloc/calloc/realloc.
diego
parents: 28051
diff changeset
711 skinName = malloc(len + 1);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
712 SendMessage(listbox, LB_GETTEXT, (WPARAM) index, (LPARAM) skinName);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
713 /* fill out the full pathname to the skin */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
714 strcpy(skinspath, get_path("skins"));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
715 strcat(skinspath, "\\");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
716 strcat(skinspath, skinName);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
717 ShowWindow(hwnd, SW_HIDE);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
718 Shell_NotifyIcon(NIM_DELETE, &nid);
33735
84defaf2e7f8 Fix compilation of the Win32 GUI after r33812.
ib
parents: 33731
diff changeset
719 destroy_window(mygui);
84defaf2e7f8 Fix compilation of the Win32 GUI after r33812.
ib
parents: 33731
diff changeset
720 create_window(mygui, skinspath);
33782
896b427e598e Remove unused parameter skindir from create_subwindow() in Win32 GUI.
ib
parents: 33775
diff changeset
721 create_subwindow(mygui);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
722 SendMessage(hwnd, WM_CLOSE, 0, 0); /* Avoid crashing when switching skin */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
723 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
724 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
725 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
726 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
727 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
728 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
729 return DefWindowProc(hwnd, iMsg, wParam, lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
730 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
731
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
732 void display_skinbrowser(gui_t* gui)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
733 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
734 HWND hWnd = FindWindow(NULL, "Skin Browser");
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
735 HINSTANCE hInstance = GetModuleHandle(NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
736 WNDCLASS wc;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
737 int x, y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
738
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
739 if (hWnd)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
740 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
741 SendMessage(hWnd, WM_CLOSE, 0, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
742 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
743 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
744
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
745 wc.style = CS_HREDRAW | CS_VREDRAW;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
746 wc.lpfnWndProc = SkinBrowserWndProc;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
747 wc.cbClsExtra = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
748 wc.cbWndExtra = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
749 wc.hInstance = hInstance;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
750 wc.hCursor = LoadCursor(NULL, IDC_ARROW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
751 wc.hIcon = gui->icon;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
752 wc.hbrBackground = SOLID_GREY2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
753 wc.lpszClassName = "Skin Browser";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
754 wc.lpszMenuName = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
755 RegisterClass(&wc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
756 x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (180 / 2);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
757 y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (102 / 2);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
758 hWnd = CreateWindow("Skin Browser",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
759 "Skin Browser",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
760 WS_POPUPWINDOW |WS_CAPTION,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
761 x,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
762 y,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
763 180,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
764 102,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
765 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
766 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
767 hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
768 NULL);
33638
dbca6aa18b50 Cast new user data value in SetWindowLongPtr() to LONG_PTR.
ib
parents: 33615
diff changeset
769 SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) gui);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
770 ShowWindow(hWnd, SW_SHOW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
771 UpdateWindow(hWnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
772 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
773
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26457
diff changeset
774 #ifdef CONFIG_DVDREAD
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
775 static LRESULT CALLBACK TitleChapterWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
776 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
777 static HWND title;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
778 static HWND chapter;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
779 HWND wdg;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
780 int i=0, j=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
781 char titles[MAX_PATH] = "";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
782 char chapters[MAX_PATH] = "";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
783 gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
784 switch (iMsg)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
785 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
786 case WM_CREATE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
787 wdg = CreateWindow("button", "Ok",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
788 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
789 4, 43, 80, 25, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
790 (HMENU) ID_OK,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
791 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
792 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
793 SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
794
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
795 wdg = CreateWindow("button", "Cancel",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
796 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
797 90, 43, 80, 25, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
798 (HMENU) ID_CANCEL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
799 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
800 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
801 SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
802
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
803 title = CreateWindow("combobox", NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
804 CBS_DROPDOWNLIST | CB_SHOWDROPDOWN | CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS |
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
805 WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
806 4, 10, 80, 160, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
807 (HMENU) ID_TITLESEL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
808 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
809 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
810
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
811 SendMessage(title, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
812
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
813 chapter = CreateWindow("combobox", NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
814 CBS_DROPDOWNLIST | CB_SHOWDROPDOWN | CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS |
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
815 WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
816 90, 10, 80, 160, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
817 (HMENU) ID_CHAPTERSEL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
818 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
819 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
820 SendMessage(chapter, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
821
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33790
diff changeset
822 for (i=0; i<guiInfo.Tracks; i++)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
823 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
824 /* we have to reverse the order here because of the way CB_INSERTSTRING adds items */
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33790
diff changeset
825 sprintf(&titles[i], "%d", guiInfo.Tracks - i);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
826 SendDlgItemMessage(hwnd, ID_TITLESEL, CB_INSERTSTRING, 0, (LPARAM) &titles[i]);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
827 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
828 SendDlgItemMessage(hwnd, ID_TITLESEL, CB_SETCURSEL, dvd_title, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
829
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33790
diff changeset
830 for (j=0; j<guiInfo.Chapters; j++)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
831 {
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33790
diff changeset
832 sprintf(&chapters[j], "%d", guiInfo.Chapters - j);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
833 SendDlgItemMessage(hwnd, ID_CHAPTERSEL, CB_INSERTSTRING, 0, (LPARAM) &chapters[j]);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
834 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
835 SendDlgItemMessage(hwnd, ID_CHAPTERSEL, CB_SETCURSEL, dvd_chapter, 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
836
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
837 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
838 case WM_COMMAND:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
839 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
840 switch (LOWORD(wParam))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
841 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
842 case ID_CANCEL:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
843 DestroyWindow(hwnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
844 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
845 case ID_OK:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
846 {
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33790
diff changeset
847 guiInfo.Track = SendMessage(title, CB_GETCURSEL, 0, 0) + 1;
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33790
diff changeset
848 guiInfo.Chapter = SendMessage(chapter, CB_GETCURSEL, 0, 0) + 1;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
849
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33790
diff changeset
850 if((guiInfo.Track != 0 || guiInfo.Chapter != 0))
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
851 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
852 gui->startplay(gui);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
853 DestroyWindow(hwnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
854 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
855 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
856 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
857 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
858 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
859 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
860 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
861 return DefWindowProc(hwnd, iMsg, wParam, lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
862 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
863
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
864 void display_chapterselwindow(gui_t *gui)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
865 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
866 HWND hWnd;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
867 HINSTANCE hInstance = GetModuleHandle(NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
868 WNDCLASS wc;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
869 int x, y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
870
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
871 if (guiInfo.StreamType != STREAMTYPE_DVD) return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
872 if (FindWindow(NULL, "Select Title/Chapter...")) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
873
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
874 wc.style = CS_HREDRAW | CS_VREDRAW;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
875 wc.lpfnWndProc = TitleChapterWndProc;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
876 wc.cbClsExtra = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
877 wc.cbWndExtra = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
878 wc.hInstance = hInstance;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
879 wc.hCursor = LoadCursor(NULL,IDC_ARROW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
880 wc.hIcon = gui->icon;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
881 wc.hbrBackground = SOLID_GREY2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
882 wc.lpszClassName = "Select Title/Chapter...";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
883 wc.lpszMenuName = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
884 RegisterClass(&wc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
885 x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (180 / 2);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
886 y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (100 / 2);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
887 hWnd = CreateWindow("Select Title/Chapter...",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
888 "Select Title/Chapter...",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
889 WS_POPUPWINDOW | WS_CAPTION,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
890 x,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
891 y,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
892 180,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
893 100,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
894 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
895 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
896 hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
897 NULL);
33638
dbca6aa18b50 Cast new user data value in SetWindowLongPtr() to LONG_PTR.
ib
parents: 33615
diff changeset
898 SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) gui);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
899 ShowWindow(hWnd, SW_SHOW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
900 UpdateWindow(hWnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
901 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
902 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
903
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
904 static LRESULT CALLBACK EqWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
905 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
906 HWND btn, label, eq0, eq1, eq2, eq3;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
907
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
908 switch (iMsg)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
909 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
910 case WM_CREATE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
911 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
912 btn = CreateWindow("button", "Reset",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
913 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
914 157, 143, 80, 25, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
915 (HMENU) ID_DEFAULTS,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
916 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
917 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
918 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
919
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
920 btn = CreateWindow("button", "Close",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
921 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
922 243, 143, 80, 25, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
923 (HMENU) ID_CLOSE,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
924 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
925 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
926 SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
927
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
928 label = CreateWindow("static", "Brightness",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
929 WS_CHILD | WS_VISIBLE,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
930 12, 122, 70, 15, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
931 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
932 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
933 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
934 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
935
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
936 label = CreateWindow("static", "Contrast",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
937 WS_CHILD | WS_VISIBLE,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
938 99, 122, 70, 15, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
939 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
940 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
941 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
942 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
943
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
944 label = CreateWindow("static", "Hue",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
945 WS_CHILD | WS_VISIBLE,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
946 191, 122, 70, 15, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
947 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
948 ((LPCREATESTRUCT) lParam) -> hInstance, NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
949 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
950
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
951 label = CreateWindow("static", "Saturation",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
952 WS_CHILD | WS_VISIBLE,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
953 260, 122, 70, 15, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
954 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
955 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
956 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
957 SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
958
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
959 eq0 = CreateWindow(TRACKBAR_CLASS, "brightness",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
960 WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED |
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
961 TBS_VERT | TBS_NOTICKS,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
962 30, 0, 20, 120, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
963 (HMENU) ID_EQ0,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
964 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
965 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
966 SendDlgItemMessage(hwnd, ID_EQ0, TBM_SETRANGE, 1, MAKELONG(0, 200));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
967
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
968 eq1 = CreateWindow(TRACKBAR_CLASS, "contrast",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
969 WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED |
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
970 TBS_VERT | TBS_NOTICKS,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
971 112, 0, 20, 120, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
972 (HMENU) ID_EQ1,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
973 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
974 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
975 SendDlgItemMessage(hwnd, ID_EQ1, TBM_SETRANGE, 1, MAKELONG(0, 200));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
976
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
977 eq2 = CreateWindow(TRACKBAR_CLASS, "hue",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
978 WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED |
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
979 TBS_VERT | TBS_NOTICKS,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
980 194, 0, 20, 120, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
981 (HMENU) ID_EQ2,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
982 ((LPCREATESTRUCT) lParam) -> hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
983 NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
984 SendDlgItemMessage(hwnd, ID_EQ2, TBM_SETRANGE, 1, MAKELONG(0, 200));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
985
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
986 eq3 = CreateWindow(TRACKBAR_CLASS, "saturation",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
987 WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED |
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
988 TBS_VERT | TBS_NOTICKS,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
989 276, 0, 20, 120, hwnd,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
990 (HMENU) ID_EQ3,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
991 ((LPCREATESTRUCT) lParam) -> hInstance, NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
992 SendDlgItemMessage(hwnd, ID_EQ3, TBM_SETRANGE, 1, MAKELONG(0, 200));
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
993
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
994 if(guiInfo.sh_video && guiInfo.Playing)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
995 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
996 EnableWindow(eq0, 1); EnableWindow(eq1, 1); EnableWindow(eq2, 1); EnableWindow(eq3, 1);
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
997 get_video_colors(guiInfo.sh_video, "brightness", &vo_gamma_brightness);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
998 get_video_colors(guiInfo.sh_video, "contrast", &vo_gamma_contrast);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
999 get_video_colors(guiInfo.sh_video, "hue", &vo_gamma_hue);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
1000 get_video_colors(guiInfo.sh_video, "saturation", &vo_gamma_saturation);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1001 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1002 SendDlgItemMessage(hwnd, ID_EQ0, TBM_SETPOS, 1, (LPARAM)100 - vo_gamma_brightness);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1003 SendDlgItemMessage(hwnd, ID_EQ1, TBM_SETPOS, 1, (LPARAM)100 - vo_gamma_contrast);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1004 SendDlgItemMessage(hwnd, ID_EQ2, TBM_SETPOS, 1, (LPARAM)100 - vo_gamma_hue);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1005 SendDlgItemMessage(hwnd, ID_EQ3, TBM_SETPOS, 1, (LPARAM)100 - vo_gamma_saturation);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1006 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1007 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1008 case WM_VSCROLL:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1009 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1010 switch (LOWORD(wParam))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1011 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1012 case TB_THUMBTRACK:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
1013 if(guiInfo.sh_video && guiInfo.Playing)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1014 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1015 vo_gamma_brightness = 100 - SendDlgItemMessage(hwnd, ID_EQ0, TBM_GETPOS, 0, 0);
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
1016 set_video_colors(guiInfo.sh_video, "brightness", vo_gamma_brightness);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1017
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1018 vo_gamma_contrast = 100 - SendDlgItemMessage(hwnd, ID_EQ1, TBM_GETPOS, 0, 0);
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
1019 set_video_colors(guiInfo.sh_video, "contrast", vo_gamma_contrast);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1020
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1021 vo_gamma_hue = 100 - SendDlgItemMessage(hwnd, ID_EQ2, TBM_GETPOS, 0, 0);
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
1022 set_video_colors(guiInfo.sh_video, "hue", vo_gamma_hue);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1023
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1024 vo_gamma_saturation = 100 - SendDlgItemMessage(hwnd, ID_EQ3, TBM_GETPOS, 0, 0);
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
1025 set_video_colors(guiInfo.sh_video, "saturation", vo_gamma_saturation);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1026 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1027 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1028 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1029 EnableWindow(GetDlgItem(hwnd, ID_EQ0), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1030 EnableWindow(GetDlgItem(hwnd, ID_EQ1), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1031 EnableWindow(GetDlgItem(hwnd, ID_EQ2), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1032 EnableWindow(GetDlgItem(hwnd, ID_EQ3), 0);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1033 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1034 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1035 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1036 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1037 case WM_CTLCOLORDLG:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1038 case WM_CTLCOLORSTATIC:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1039 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1040 HDC hdc = (HDC)wParam;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1041 SetBkMode(hdc, TRANSPARENT);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1042 return (INT_PTR)SOLID_GREY2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1043 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1044 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1045 case WM_COMMAND:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1046 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1047 switch (LOWORD(wParam))
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1048 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1049 case ID_CLOSE:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1050 DestroyWindow(hwnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1051 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1052 case ID_DEFAULTS:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
1053 if(guiInfo.sh_video && guiInfo.Playing)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1054 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1055 vo_gamma_brightness=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1056 SendDlgItemMessage(hwnd, ID_EQ0, TBM_SETPOS, 1, (LPARAM)100);
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
1057 set_video_colors(guiInfo.sh_video, "brightness", vo_gamma_brightness);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1058
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1059 vo_gamma_contrast=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1060 SendDlgItemMessage(hwnd, ID_EQ1, TBM_SETPOS, 1, (LPARAM)100);
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
1061 set_video_colors(guiInfo.sh_video, "contrast", vo_gamma_contrast);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1062
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1063 vo_gamma_hue=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1064 SendDlgItemMessage(hwnd, ID_EQ2, TBM_SETPOS, 1, (LPARAM)100);
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
1065 set_video_colors(guiInfo.sh_video, "hue", vo_gamma_hue);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1066
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1067 vo_gamma_saturation=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1068 SendDlgItemMessage(hwnd, ID_EQ3, TBM_SETPOS, 1, (LPARAM)100);
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
1069 set_video_colors(guiInfo.sh_video, "saturation", vo_gamma_saturation);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1070 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1071 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1072 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1073 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1074 return 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1075 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1076 return DefWindowProc(hwnd, iMsg, wParam, lParam);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1077 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1078
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1079 void display_eqwindow(gui_t *gui)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1080 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1081 HWND hWnd;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1082 HINSTANCE hInstance = GetModuleHandle(NULL);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1083 WNDCLASS wc;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1084 int x, y;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1085
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 32537
diff changeset
1086 if(!guiInfo.sh_video) return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1087 if(FindWindow(NULL, "MPlayer - Equalizer")) return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1088 wc.style = CS_HREDRAW | CS_VREDRAW;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1089 wc.lpfnWndProc = EqWndProc;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1090 wc.cbClsExtra = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1091 wc.cbWndExtra = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1092 wc.hInstance = hInstance;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1093 wc.hCursor = LoadCursor(NULL,IDC_ARROW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1094 wc.hIcon = gui->icon;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1095 wc.hbrBackground = SOLID_GREY2;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1096 wc.lpszClassName = "MPlayer - Equalizer";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1097 wc.lpszMenuName = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1098 RegisterClass(&wc);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1099 x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (332 / 2);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1100 y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (200 / 2);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1101 hWnd = CreateWindow("MPlayer - Equalizer",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1102 "MPlayer - Equalizer",
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1103 WS_POPUPWINDOW | WS_CAPTION,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1104 x,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1105 y,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1106 332,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1107 200,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1108 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1109 NULL,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1110 hInstance,
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1111 NULL);
33638
dbca6aa18b50 Cast new user data value in SetWindowLongPtr() to LONG_PTR.
ib
parents: 33615
diff changeset
1112 SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) gui);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1113 ShowWindow(hWnd, SW_SHOW);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1114 UpdateWindow(hWnd);
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
1115 }