annotate gui/win32/dialogs.c @ 23541:5fda2824ce8a

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