annotate gui/win32/dialogs.c @ 32866:9acb64ec6484

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