annotate gui/win32/dialogs.c @ 30901:76a13038105e

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