annotate gui/win32/dialogs.c @ 37194:d773c8901dd8

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