annotate gui/ui/actions.c @ 36144:43bff9dd44be

Disable dangerous feature in ASX playlist parser.
author reimar
date Sun, 05 May 2013 17:02:30 +0000
parents c667e34fb941
children 703a51ce08c8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26458
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
1 /*
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
2 * This file is part of MPlayer.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
3 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
5 * it under the terms of the GNU General Public License as published by
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
7 * (at your option) any later version.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
8 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
12 * GNU General Public License for more details.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
13 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
14 * You should have received a copy of the GNU General Public License along
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
17 */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
18
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
19 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
20 * @file
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
21 * @brief User interface actions
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
22 */
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
23
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
24 #include <stdlib.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
25 #include <string.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
26
33556
520fb0f7544c Rename GUI directory 'mplayer' and some files in it.
ib
parents: 33555
diff changeset
27 #include "actions.h"
35528
ab07b17fddfb Rebuild GUI directory structure.
ib
parents: 35525
diff changeset
28 #include "ui.h"
36032
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35968
diff changeset
29 #include "gui/interface.h"
35525
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35500
diff changeset
30 #include "gui/app/app.h"
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
31 #include "gui/app/cfg.h"
35525
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35500
diff changeset
32 #include "gui/app/gui.h"
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
33 #include "gui/dialog/dialog.h"
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
34 #include "gui/skin/skin.h"
33742
e1539e14d60f Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents: 33740
diff changeset
35 #include "gui/util/list.h"
33739
9f6d46d325de Remove gfree() from interface.c.
ib
parents: 33737
diff changeset
36 #include "gui/util/mem.h"
33737
71c29e8ec68f Move string functions from interface.c to string.c.
ib
parents: 33731
diff changeset
37 #include "gui/util/string.h"
35435
578e049a78ae Add necessary and remove unnecessary #includes.
ib
parents: 35434
diff changeset
38 #include "gui/wm/ws.h"
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
39 #include "gui/wm/wsxdnd.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
40
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
41 #include "access_mpcontext.h"
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
42 #include "config.h"
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
43 #include "help_mp.h"
36032
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35968
diff changeset
44 #include "m_property.h"
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35968
diff changeset
45 #include "mixer.h"
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35968
diff changeset
46 #include "mp_core.h"
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35968
diff changeset
47 #include "mp_msg.h"
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35968
diff changeset
48 #include "mpcommon.h"
c667e34fb941 Cosmetic: Rearrange #includes.
ib
parents: 35968
diff changeset
49 #include "mplayer.h"
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
50 #include "input/input.h"
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
51 #include "libmpcodecs/vd.h"
35431
20c90da2ba0d Use symbolic constants to set abs_seek_pos.
ib
parents: 35430
diff changeset
52 #include "libmpdemux/demuxer.h"
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
53 #include "libvo/video_out.h"
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
54 #include "libvo/wskeys.h"
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
55 #include "libvo/x11_common.h"
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
56 #include "osdep/timer.h"
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
57 #include "stream/stream.h"
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
58 #include "sub/sub.h"
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
59
35776
85d45ea7ba5d Add comments.
ib
parents: 35775
diff changeset
60 #define GUI_REDRAW_WAIT 375 // in milliseconds
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
61
35777
6d576acb772b Relocate uiLoadPlay.
ib
parents: 35776
diff changeset
62 int uiLoadPlay;
6d576acb772b Relocate uiLoadPlay.
ib
parents: 35776
diff changeset
63
35775
745d887d4975 Add missing type to variable declaration.
ib
parents: 35774
diff changeset
64 static unsigned int last_redraw_time;
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
65
35776
85d45ea7ba5d Add comments.
ib
parents: 35775
diff changeset
66 /**
85d45ea7ba5d Add comments.
ib
parents: 35775
diff changeset
67 * @brief Clear information not used for this @a type of stream.
85d45ea7ba5d Add comments.
ib
parents: 35775
diff changeset
68 *
85d45ea7ba5d Add comments.
ib
parents: 35775
diff changeset
69 * @param type stream type
85d45ea7ba5d Add comments.
ib
parents: 35775
diff changeset
70 */
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
71 static void MediumPrepare(int type)
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
72 {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
73 switch (type) {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
74 case STREAMTYPE_DVD:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
75 listMgr(PLAYLIST_DELETE, 0);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
76 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
77
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
78 case STREAMTYPE_CDDA:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
79 case STREAMTYPE_VCD:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
80 listMgr(PLAYLIST_DELETE, 0);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
81 case STREAMTYPE_FILE:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
82 case STREAMTYPE_STREAM:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
83 case STREAMTYPE_PLAYLIST:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
84 guiInfo.AudioStreams = 0;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
85 guiInfo.Subtitles = 0;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
86 guiInfo.Chapters = 0;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
87 guiInfo.Angles = 0;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
88 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
89 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
90 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
91
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
92 void uiEvent(int ev, float param)
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
93 {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
94 int iparam = (int)param, osd;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
95 mixer_t *mixer = mpctx_get_mixer(guiInfo.mpcontext);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
96
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
97 switch (ev) {
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
98 /* user events */
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
99 case evExit:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
100 mplayer(MPLAYER_EXIT_GUI, EXIT_QUIT, 0);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
101 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
102
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
103 case evLoadURL:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
104 gtkShow(evLoadURL, NULL);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
105 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
106
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
107 case ivSetAudio:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
108
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
109 if (!mpctx_get_demuxer(guiInfo.mpcontext) || audio_id == iparam)
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
110 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
111
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
112 mp_property_do("switch_audio", M_PROPERTY_SET, &iparam, guiInfo.mpcontext);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
113 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
114
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
115 case ivSetVideo:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
116
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
117 if (!mpctx_get_demuxer(guiInfo.mpcontext) || video_id == iparam)
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
118 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
119
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
120 mp_property_do("switch_video", M_PROPERTY_SET, &iparam, guiInfo.mpcontext);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
121 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
122
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
123 case ivSetSubtitle:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
124 mp_property_do("sub", M_PROPERTY_SET, &iparam, guiInfo.mpcontext);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
125 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
126
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
127 #ifdef CONFIG_CDDA
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
128 case ivSetCDTrack:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
129 guiInfo.Track = iparam;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
130
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
131 case evPlayCD:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
132 guiInfo.StreamType = STREAMTYPE_CDDA;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
133 goto play;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
134
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
135 #endif
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
136 #ifdef CONFIG_VCD
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
137 case ivSetVCDTrack:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
138 guiInfo.Track = iparam;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
139
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
140 case evPlayVCD:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
141 guiInfo.StreamType = STREAMTYPE_VCD;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
142 goto play;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
143
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
144 #endif
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
145 #ifdef CONFIG_DVDREAD
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
146 case ivSetDVDSubtitle:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
147 dvdsub_id = iparam;
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
148 uiEvent(ivPlayDVD, 0);
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
149 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
150
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
151 case ivSetDVDAudio:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
152 audio_id = iparam;
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
153 uiEvent(ivPlayDVD, 0);
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
154 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
155
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
156 case ivSetDVDChapter:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
157 guiInfo.Chapter = iparam;
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
158 uiEvent(ivPlayDVD, 0);
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
159 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
160
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
161 case ivSetDVDTitle:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
162 guiInfo.Track = iparam;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
163 guiInfo.Chapter = 1;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
164 guiInfo.Angle = 1;
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
165 uiEvent(ivPlayDVD, 0);
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
166 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
167
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
168 case evPlayDVD:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
169 guiInfo.Chapter = 1;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
170 guiInfo.Angle = 1;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
171
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
172 case ivPlayDVD:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
173 guiInfo.StreamType = STREAMTYPE_DVD;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
174 goto play;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
175
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
176 #endif
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
177 case evPlay:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
178 case evPlaySwitchToPause:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
179 play:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
180
35791
eda12497788f Fix bug with evPlay.
ib
parents: 35789
diff changeset
181 if (guiInfo.Playing != GUI_PAUSE) {
35792
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
182 MediumPrepare(guiInfo.StreamType);
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
183
35792
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
184 switch (guiInfo.StreamType) {
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
185 case STREAMTYPE_FILE:
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
186 case STREAMTYPE_STREAM:
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
187 case STREAMTYPE_PLAYLIST:
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
188
35792
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
189 if (!guiInfo.Track)
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
190 guiInfo.Track = 1;
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
191
35792
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
192 guiInfo.NewPlay = GUI_FILE_NEW;
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
193 guiInfo.PlaylistNext = !guiInfo.Playing;
35791
eda12497788f Fix bug with evPlay.
ib
parents: 35789
diff changeset
194
35792
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
195 break;
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
196
35792
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
197 case STREAMTYPE_CDDA:
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
198 case STREAMTYPE_VCD:
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
199 case STREAMTYPE_DVD:
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
200
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
201 if (!guiInfo.Track)
35793
c6ffe6a4c1e5 Compact code.
ib
parents: 35792
diff changeset
202 guiInfo.Track = (guiInfo.StreamType == STREAMTYPE_VCD ? 2 : 1);
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
203
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
204 guiInfo.NewPlay = GUI_FILE_SAME;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
205
35792
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
206 break;
97a4f5644b74 Cosmetic: Adjust indent.
ib
parents: 35791
diff changeset
207 }
35791
eda12497788f Fix bug with evPlay.
ib
parents: 35789
diff changeset
208 }
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
209
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
210 uiPlay();
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
211 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
212
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
213 case evPause:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
214 case evPauseSwitchToPlay:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
215 uiPause();
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
216 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
217
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
218 case evStop:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
219 guiInfo.Playing = GUI_STOP;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
220 uiState();
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
221 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
222
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
223 case evLoadPlay:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
224 uiLoadPlay = True;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
225
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
226 // guiInfo.StreamType=STREAMTYPE_FILE;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
227 case evLoad:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
228 gtkShow(evLoad, NULL);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
229 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
230
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
231 case evLoadSubtitle:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
232 gtkShow(evLoadSubtitle, NULL);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
233 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
234
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
235 case evDropSubtitle:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
236 nfree(guiInfo.SubtitleFilename);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
237 mplayerLoadSubtitle(NULL);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
238 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
239
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
240 case evLoadAudioFile:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
241 gtkShow(evLoadAudioFile, NULL);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
242 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
243
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
244 case evPrev:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
245 uiPrev();
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
246 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
247
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
248 case evNext:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
249 uiNext();
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
250 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
251
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
252 case evPlaylist:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
253 gtkShow(evPlaylist, NULL);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
254 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
255
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
256 case evSkinBrowser:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
257 gtkShow(evSkinBrowser, skinName);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
258 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
259
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
260 case evAbout:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
261 gtkShow(evAbout, NULL);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
262 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
263
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
264 case evPreferences:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
265 gtkShow(evPreferences, NULL);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
266 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
267
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
268 case evEqualizer:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
269 gtkShow(evEqualizer, NULL);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
270 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
271
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
272 case evForward10min:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
273 uiRelSeek(600);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
274 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
275
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
276 case evBackward10min:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
277 uiRelSeek(-600);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
278 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
279
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
280 case evForward1min:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
281 uiRelSeek(60);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
282 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
283
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
284 case evBackward1min:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
285 uiRelSeek(-60);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
286 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
287
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
288 case evForward10sec:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
289 uiRelSeek(10);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
290 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
291
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
292 case evBackward10sec:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
293 uiRelSeek(-10);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
294 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
295
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
296 case evSetMoviePosition:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
297 uiAbsSeek(param);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
298 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
299
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
300 case evIncVolume:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
301 vo_x11_putkey(wsGrayMul);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
302 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
303
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
304 case evDecVolume:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
305 vo_x11_putkey(wsGrayDiv);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
306 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
307
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
308 case evMute:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
309 mixer_mute(mixer);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
310 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
311
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
312 case evSetVolume:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
313 guiInfo.Volume = param;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
314 {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
315 float l = guiInfo.Volume * ((100.0 - guiInfo.Balance) / 50.0);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
316 float r = guiInfo.Volume * ((guiInfo.Balance) / 50.0);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
317 mixer_setvolume(mixer, FFMIN(l, guiInfo.Volume), FFMIN(r, guiInfo.Volume));
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
318 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
319
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
320 if (osd_level) {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
321 osd_visible = (GetTimerMS() + 1000) | 1;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
322 vo_osd_progbar_type = OSD_VOLUME;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
323 vo_osd_progbar_value = ((guiInfo.Volume) * 256.0) / 100.0;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
324 vo_osd_changed(OSDTYPE_PROGBAR);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
325 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
326
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
327 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
328
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
329 case evSetBalance:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
330 guiInfo.Balance = param;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
331 mixer_setbalance(mixer, (guiInfo.Balance - 50.0) / 50.0); // transform 0..100 to -1..1
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
332 osd = osd_level;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
333 osd_level = 0;
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
334 uiEvent(evSetVolume, guiInfo.Volume);
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
335 osd_level = osd;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
336
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
337 if (osd_level) {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
338 osd_visible = (GetTimerMS() + 1000) | 1;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
339 vo_osd_progbar_type = OSD_BALANCE;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
340 vo_osd_progbar_value = ((guiInfo.Balance) * 256.0) / 100.0;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
341 vo_osd_changed(OSDTYPE_PROGBAR);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
342 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
343
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
344 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
345
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
346 case evMenu:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
347 /*if (guiApp.menuIsPresent) NOTE TO MYSELF: Uncomment only after mouse
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
348 * { pointer and cursor keys work
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
349 * gtkShow( ivHidePopUpMenu,NULL ); with this menu from skin as
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
350 * uiMenuShow( 0,0 ); they do with normal menus.
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
351 * }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
352 * else*/gtkShow(ivShowPopUpMenu, NULL);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
353 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
354
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
355 case evIconify:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
356
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
357 switch (iparam) {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
358 case 0:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
359 wsWindowIconify(&guiApp.mainWindow);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
360 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
361
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
362 case 1:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
363 wsWindowIconify(&guiApp.videoWindow);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
364 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
365 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
366
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
367 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
368
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
369 case evHalfSize:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
370
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
371 if (guiInfo.VideoWindow && guiInfo.Playing) {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
372 if (guiApp.videoWindow.isFullScreen) {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
373 uiFullScreen();
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
374 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
375
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
376 wsWindowResize(&guiApp.videoWindow, guiInfo.VideoWidth / 2, guiInfo.VideoHeight / 2);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
377 btnSet(evFullScreen, btnReleased);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
378 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
379
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
380 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
381
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
382 case evDoubleSize:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
383
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
384 if (guiInfo.VideoWindow && guiInfo.Playing) {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
385 if (guiApp.videoWindow.isFullScreen) {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
386 uiFullScreen();
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
387 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
388
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
389 wsWindowResize(&guiApp.videoWindow, guiInfo.VideoWidth * 2, guiInfo.VideoHeight * 2);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
390 wsWindowMoveWithin(&guiApp.videoWindow, False, guiApp.video.x, guiApp.video.y);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
391 btnSet(evFullScreen, btnReleased);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
392 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
393
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
394 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
395
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
396 case evNormalSize:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
397
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
398 if (guiInfo.VideoWindow && guiInfo.Playing) {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
399 if (guiApp.videoWindow.isFullScreen) {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
400 uiFullScreen();
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
401 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
402
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
403 wsWindowResize(&guiApp.videoWindow, guiInfo.VideoWidth, guiInfo.VideoHeight);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
404 btnSet(evFullScreen, btnReleased);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
405 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
406 } else if (!guiApp.videoWindow.isFullScreen)
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
407 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
408
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
409 case evFullScreen:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
410
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
411 if (guiInfo.VideoWindow && (guiInfo.Playing || !iparam)) {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
412 uiFullScreen();
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
413
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
414 if (!guiApp.videoWindow.isFullScreen)
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
415 wsWindowResize(&guiApp.videoWindow, iparam ? guiInfo.VideoWidth : guiApp.video.width, iparam ? guiInfo.VideoHeight : guiApp.video.height);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
416 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
417
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
418 if (guiApp.videoWindow.isFullScreen)
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
419 btnSet(evFullScreen, btnPressed);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
420 else
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
421 btnSet(evFullScreen, btnReleased);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
422
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
423 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
424
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
425 case evSetAspect:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
426
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
427 switch (iparam) {
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
428 case 2:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
429 movie_aspect = 16.0f / 9.0f;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
430 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
431
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
432 case 3:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
433 movie_aspect = 4.0f / 3.0f;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
434 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
435
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
436 case 4:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
437 movie_aspect = 2.35;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
438 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
439
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
440 case 1:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
441 default:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
442 movie_aspect = -1;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
443 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
444
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
445 if (guiInfo.StreamType == STREAMTYPE_VCD)
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
446 uiEvent(evPlayVCD, 0);
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
447 else if (guiInfo.StreamType == STREAMTYPE_DVD)
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
448 uiEvent(ivPlayDVD, 0);
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
449 else
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
450 guiInfo.NewPlay = GUI_FILE_NEW;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
451
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
452 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
453
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
454 /* timer events */
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
455 case ivRedraw:
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
456 {
35775
745d887d4975 Add missing type to variable declaration.
ib
parents: 35774
diff changeset
457 unsigned int now = GetTimerMS();
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
458
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
459 if ((now > last_redraw_time) &&
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
460 (now < last_redraw_time + GUI_REDRAW_WAIT) &&
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
461 !uiPlaybarFade && (iparam == 0))
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
462 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
463
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
464 last_redraw_time = now;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
465 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
466 uiMainRender = True;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
467 wsWindowRedraw(&guiApp.mainWindow);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
468 wsWindowRedraw(&guiApp.playbarWindow);
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
469 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
470
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
471 /* system events */
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
472 case evNone:
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
473 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[actions] uiEvent: evNone\n");
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
474 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
475
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
476 default:
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
477 mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[actions] uiEvent: unknown event %d, param %.2f\n", ev, param);
35771
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
478 break;
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
479 }
07057fd75c51 Relocate uiMainEvent().
ib
parents: 35768
diff changeset
480 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
481
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
482 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
483 * @brief Switch video window fullscreen mode.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
484 *
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
485 * Switch normal video to fullscreen and fullscreen video to normal.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
486 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
487 void uiFullScreen(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
488 {
33960
1cd81338af07 Rework fullscreen handling.
ib
parents: 33957
diff changeset
489 if (!guiInfo.VideoWindow)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
490 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
491
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
492 wsWindowFullscreen(&guiApp.videoWindow);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
493
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
494 vo_fs = guiApp.videoWindow.isFullScreen;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
495
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
496 wsWindowLayer(wsDisplay, guiApp.mainWindow.WindowID, guiApp.videoWindow.isFullScreen);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
497
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
498 if (guiApp.menuIsPresent)
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
499 wsWindowLayer(wsDisplay, guiApp.menuWindow.WindowID, guiApp.videoWindow.isFullScreen);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
500 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
501
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
502 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
503 * @brief Switch to play mode.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
504 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
505 void uiPlay(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
506 {
34401
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
507 if (guiInfo.Playing == GUI_PLAY)
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
508 return;
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
509
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
510 if (guiInfo.StreamType != STREAMTYPE_CDDA &&
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
511 guiInfo.StreamType != STREAMTYPE_VCD &&
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
512 guiInfo.StreamType != STREAMTYPE_DVD &&
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
513 (!guiInfo.Filename || (guiInfo.Filename[0] == 0)))
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
514 return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
515
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
516 if (guiInfo.Playing == GUI_PAUSE) {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
517 uiPause();
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
518 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
519 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
520
33731
81f71d910333 Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents: 33725
diff changeset
521 gui(GUI_SET_STATE, (void *)GUI_PLAY);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
522 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
523
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
524 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
525 * @brief Switch to pause mode.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
526 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
527 void uiPause(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
528 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
529 if (!guiInfo.Playing)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
530 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
531
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
532 if (guiInfo.Playing == GUI_PLAY) {
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
533 mp_cmd_t *cmd = calloc(1, sizeof(*cmd));
35433
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
534
35432
a545e4994460 Check return value to avoid segmentation fault.
ib
parents: 35431
diff changeset
535 if (cmd) {
35433
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
536 cmd->id = MP_CMD_PAUSE;
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
537 cmd->name = strdup("pause");
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
538 mp_input_queue_cmd(cmd);
35432
a545e4994460 Check return value to avoid segmentation fault.
ib
parents: 35431
diff changeset
539 }
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
540 } else
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
541 guiInfo.Playing = GUI_PLAY;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
542 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
543
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
544 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
545 * @brief Adjust GUI items to reflect current state (i.e. current playing mode).
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
546 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
547 void uiState(void)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
548 {
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
549 if (guiInfo.Playing == GUI_STOP || guiInfo.Playing == GUI_PAUSE) {
33978
81aaa1420337 Replace some btnModify() calls by btnSet().
ib
parents: 33960
diff changeset
550 btnSet(evPlaySwitchToPause, btnReleased);
81aaa1420337 Replace some btnModify() calls by btnSet().
ib
parents: 33960
diff changeset
551 btnSet(evPauseSwitchToPlay, btnDisabled);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
552 } else {
35434
e589db40d32e Cosmetic: Switch two code lines.
ib
parents: 35433
diff changeset
553 btnSet(evPauseSwitchToPlay, btnReleased);
33978
81aaa1420337 Replace some btnModify() calls by btnSet().
ib
parents: 33960
diff changeset
554 btnSet(evPlaySwitchToPause, btnDisabled);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
555 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
556 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
557
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
558 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
559 * @brief Seek new playback position.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
560 *
35438
b3efe5e9f0bf Cosmetic: Correct indent.
ib
parents: 35437
diff changeset
561 * The new position is a relative one.
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
562 *
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
563 * @param sec seconds to seek (either forward (> 0) or backward (< 0))
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
564 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
565 void uiRelSeek(float sec)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
566 {
32971
dc905c693b7a Choose informative variable names.
ib
parents: 32970
diff changeset
567 rel_seek_secs = sec;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
568 abs_seek_pos = 0;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
569 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
570
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
571 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
572 * @brief Seek new playback position.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
573 *
35438
b3efe5e9f0bf Cosmetic: Correct indent.
ib
parents: 35437
diff changeset
574 * The new position is an absolute one.
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
575 *
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
576 * @param percent percentage of playback time to position to
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
577 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
578 void uiAbsSeek(float percent)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
579 {
32971
dc905c693b7a Choose informative variable names.
ib
parents: 32970
diff changeset
580 rel_seek_secs = percent / 100.0;
35431
20c90da2ba0d Use symbolic constants to set abs_seek_pos.
ib
parents: 35430
diff changeset
581 abs_seek_pos = SEEK_ABSOLUTE | SEEK_FACTOR;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
582 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
583
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
584 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
585 * @brief Change to a different skin.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
586 *
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
587 * @param name name of the skin to change to
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
588 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
589 void uiChangeSkin(char *name)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
590 {
35799
fa803d807b58 Cosmetic: Rename variables.
ib
parents: 35796
diff changeset
591 int was_menu, was_playbar;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
592
35799
fa803d807b58 Cosmetic: Rename variables.
ib
parents: 35796
diff changeset
593 was_menu = guiApp.menuIsPresent;
fa803d807b58 Cosmetic: Rename variables.
ib
parents: 35796
diff changeset
594 was_playbar = guiApp.playbarIsPresent;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
595
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
596 mainVisible = False;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
597
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32882
diff changeset
598 if (skinRead(name) != 0) {
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32882
diff changeset
599 if (skinRead(skinName) != 0) {
35801
98693cc5df48 Exit GUI if we can't return to the skin we started with.
ib
parents: 35800
diff changeset
600 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SKINCFG_SkinCfgError, skinName);
98693cc5df48 Exit GUI if we can't return to the skin we started with.
ib
parents: 35800
diff changeset
601 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32882
diff changeset
602 }
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
603 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
604
35800
6a7be705643b Change window reload order.
ib
parents: 35799
diff changeset
605 /* reload main window (must be first!) */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
606
35800
6a7be705643b Change window reload order.
ib
parents: 35799
diff changeset
607 uiMainDone();
6a7be705643b Change window reload order.
ib
parents: 35799
diff changeset
608 uiMainInit();
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
609
35800
6a7be705643b Change window reload order.
ib
parents: 35799
diff changeset
610 wsWindowVisibility(&guiApp.mainWindow, wsShowWindow);
6a7be705643b Change window reload order.
ib
parents: 35799
diff changeset
611 mainVisible = True;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
612
35805
5d163370a554 Restructure code for video window in uiChangeSkin().
ib
parents: 35804
diff changeset
613 /* adjust video window */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
614
35805
5d163370a554 Restructure code for video window in uiChangeSkin().
ib
parents: 35804
diff changeset
615 if (guiApp.video.Bitmap.Image) {
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
616 wsImageResize(&guiApp.videoWindow, guiApp.video.Bitmap.Width, guiApp.video.Bitmap.Height);
35805
5d163370a554 Restructure code for video window in uiChangeSkin().
ib
parents: 35804
diff changeset
617 wsImageRender(&guiApp.videoWindow, guiApp.video.Bitmap.Image);
5d163370a554 Restructure code for video window in uiChangeSkin().
ib
parents: 35804
diff changeset
618 }
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
619
35805
5d163370a554 Restructure code for video window in uiChangeSkin().
ib
parents: 35804
diff changeset
620 if (!guiInfo.Playing) {
5d163370a554 Restructure code for video window in uiChangeSkin().
ib
parents: 35804
diff changeset
621 if (!guiApp.videoWindow.isFullScreen) {
35806
ea15d7aebf13 Cosmetic: Adjust indent.
ib
parents: 35805
diff changeset
622 wsWindowResize(&guiApp.videoWindow, guiApp.video.width, guiApp.video.height);
ea15d7aebf13 Cosmetic: Adjust indent.
ib
parents: 35805
diff changeset
623 wsWindowMove(&guiApp.videoWindow, False, guiApp.video.x, guiApp.video.y);
ea15d7aebf13 Cosmetic: Adjust indent.
ib
parents: 35805
diff changeset
624 }
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
625
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
626 wsWindowRedraw(&guiApp.videoWindow);
35805
5d163370a554 Restructure code for video window in uiChangeSkin().
ib
parents: 35804
diff changeset
627 }
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
628
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34663
diff changeset
629 /* reload playbar */
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
630
35799
fa803d807b58 Cosmetic: Rename variables.
ib
parents: 35796
diff changeset
631 if (was_playbar)
35796
497a1c45a597 Add uiMainDone(), uiVideoDone(), uiPlaybarDone() and uiMenuDone().
ib
parents: 35795
diff changeset
632 uiPlaybarDone();
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
633
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
634 uiPlaybarInit();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
635
35800
6a7be705643b Change window reload order.
ib
parents: 35799
diff changeset
636 /* reload menu window */
6a7be705643b Change window reload order.
ib
parents: 35799
diff changeset
637
35804
25852c740093 Remove code almost identical to uiMenuDone() plus uiMenuInit().
ib
parents: 35801
diff changeset
638 if (was_menu)
25852c740093 Remove code almost identical to uiMenuDone() plus uiMenuInit().
ib
parents: 35801
diff changeset
639 uiMenuDone();
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
640
35804
25852c740093 Remove code almost identical to uiMenuDone() plus uiMenuInit().
ib
parents: 35801
diff changeset
641 uiMenuInit();
35800
6a7be705643b Change window reload order.
ib
parents: 35799
diff changeset
642
6a7be705643b Change window reload order.
ib
parents: 35799
diff changeset
643 /* */
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
644
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
645 btnModify(evSetVolume, guiInfo.Volume);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
646 btnModify(evSetBalance, guiInfo.Balance);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
647 btnModify(evSetMoviePosition, guiInfo.Position);
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
648 btnSet(evFullScreen, (guiApp.videoWindow.isFullScreen ? btnPressed : btnReleased));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
649
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
650 wsWindowLayer(wsDisplay, guiApp.mainWindow.WindowID, guiApp.videoWindow.isFullScreen);
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
651 wsWindowLayer(wsDisplay, guiApp.menuWindow.WindowID, guiApp.videoWindow.isFullScreen);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
652 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
653
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
654 /**
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
655 * @brief Set the file to be played.
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
656 *
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
657 * @param dir directory (optional, else NULL)
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
658 * @param name filename
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
659 * @param type stream type of the file
35483
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
660 *
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
661 * @note All #guiInfo members associated with the file will be cleared.
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
662 */
35968
9474726062ef Change parameter declaration to const.
ib
parents: 35806
diff changeset
663 void uiSetFile(const char *dir, const char *name, int type)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
664 {
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
665 if (!dir)
33740
2c02269701bd Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents: 33739
diff changeset
666 setdup(&guiInfo.Filename, name);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
667 else
33740
2c02269701bd Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents: 33739
diff changeset
668 setddup(&guiInfo.Filename, dir, name);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
669
34064
54becc464788 Set MPlayer filename in uiSetFileName().
ib
parents: 33993
diff changeset
670 filename = guiInfo.Filename;
34399
f2c03009068d Don't explicitly set stream type if the type doesn't change.
ib
parents: 34387
diff changeset
671
35483
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
672 if (type != SAME_STREAMTYPE) {
34400
19b68f388735 Cosmetic: Adjust indent.
ib
parents: 34399
diff changeset
673 guiInfo.StreamType = type;
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
674 uiUnsetMedia(False);
35483
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
675 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
676 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
677
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
678 /**
35453
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
679 * @brief Unset the file being played.
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
680 */
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
681 void uiUnsetFile(void)
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
682 {
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
683 uiSetFile(NULL, NULL, STREAMTYPE_DUMMY);
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
684 }
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
685
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
686 /**
35562
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
687 * @brief Unset media information.
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
688 *
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
689 * @param totals whether to unset number of chapters and angles (#True) or
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
690 * just track, chapter and angle (#False) as well
35562
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
691 */
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
692 void uiUnsetMedia(int totals)
35562
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
693 {
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
694 guiInfo.VideoWidth = 0;
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
695 guiInfo.VideoHeight = 0;
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
696 guiInfo.AudioChannels = 0;
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
697 guiInfo.RunningTime = 0;
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
698
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
699 if (totals) {
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
700 guiInfo.Chapters = 0;
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
701 guiInfo.Angles = 0;
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
702 } else {
35569
8381468bb46c Cosmetic: Adjust indent.
ib
parents: 35568
diff changeset
703 guiInfo.Track = 0;
8381468bb46c Cosmetic: Adjust indent.
ib
parents: 35568
diff changeset
704 guiInfo.Chapter = 0;
8381468bb46c Cosmetic: Adjust indent.
ib
parents: 35568
diff changeset
705 guiInfo.Angle = 0;
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
706 }
35562
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
707
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
708 nfree(guiInfo.CodecName);
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
709 nfree(guiInfo.AudioFilename);
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
710 nfree(guiInfo.SubtitleFilename);
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
711 }
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
712
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
713 /**
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
714 * @brief Set file to be played to current playlist entry.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
715 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
716 void uiCurr(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
717 {
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
718 plItem *curr;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
719
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
720 if (guiInfo.Playing == GUI_PAUSE)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
721 return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
722
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
723 switch (guiInfo.StreamType) {
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
724 case STREAMTYPE_CDDA:
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
725 case STREAMTYPE_VCD:
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
726 case STREAMTYPE_DVD:
35433
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
727
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
728 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
729
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
730 default:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
731
34663
73a5ecb53ee2 Replace symbolic constants by enums.
ib
parents: 34610
diff changeset
732 curr = listMgr(PLAYLIST_ITEM_GET_CURR, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
733
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
734 if (curr) {
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
735 uiSetFile(curr->path, curr->name, STREAMTYPE_FILE);
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
736 guiInfo.PlaylistNext = False;
35485
4d2ebecd1605 Set track number in uiCurr().
ib
parents: 35483
diff changeset
737 guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, curr);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
738 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
739 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
740
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
741 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
742 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
743
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
744 if (guiInfo.Playing == GUI_PLAY)
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
745 uiEvent(evPlay, 0);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
746 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
747
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
748 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
749 * @brief Switch to previous playback track.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
750 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
751 void uiPrev(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
752 {
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
753 int stop = False, unset = True;
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
754 plItem *prev = NULL;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
755
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
756 if (guiInfo.Playing == GUI_PAUSE)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
757 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
758
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
759 switch (guiInfo.StreamType) {
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
760 case STREAMTYPE_CDDA:
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
761
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
762 if (--guiInfo.Track == 0) {
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
763 guiInfo.Track = 1;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
764 stop = True;
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
765 }
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
766
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
767 break;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
768
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
769 case STREAMTYPE_VCD:
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
770
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
771 if (--guiInfo.Track == 1) {
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
772 guiInfo.Track = 2;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
773 stop = True;
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
774 }
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
775
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
776 break;
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
777
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
778 case STREAMTYPE_DVD:
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
779
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
780 if (--guiInfo.Chapter == 0) {
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
781 guiInfo.Chapter = 1;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
782
35428
0833bccb3c7b Fix bug introduced in r35521.
ib
parents: 35427
diff changeset
783 if (--guiInfo.Track == 0) {
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
784 guiInfo.Track = 1;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
785 stop = True;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
786 }
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
787 } else
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
788 unset = False;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
789
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
790 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
791
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
792 default:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
793
34663
73a5ecb53ee2 Replace symbolic constants by enums.
ib
parents: 34610
diff changeset
794 prev = listMgr(PLAYLIST_ITEM_GET_PREV, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
795
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
796 if (prev) {
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
797 uiSetFile(prev->path, prev->name, STREAMTYPE_FILE);
35500
6422042d74d9 Simplify assignments.
ib
parents: 35497
diff changeset
798 guiInfo.PlaylistNext = !guiInfo.Playing;
35458
2a6113c08e20 Add listMgr command PLAYLIST_ITEM_GET_CURR_POS.
ib
parents: 35454
diff changeset
799 guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, prev);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
800 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
801 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
802
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
803 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
804 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
805
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
806 if (stop)
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
807 uiEvent(evStop, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
808
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
809 if (guiInfo.Playing == GUI_PLAY)
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
810 uiEvent(evPlay, 0);
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
811 else if (!stop && !prev && unset)
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
812 uiUnsetMedia(True);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
813 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
814
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
815 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
816 * @brief Switch to next playback track.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
817 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
818 void uiNext(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
819 {
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
820 int stop = False, unset = True;
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
821 plItem *next = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
822
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
823 if (guiInfo.Playing == GUI_PAUSE)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
824 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
825
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
826 switch (guiInfo.StreamType) {
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
827 case STREAMTYPE_CDDA:
35425
e9f57004e925 Don't treat STREAMTYPE_VCD differently in uiNext().
ib
parents: 35379
diff changeset
828 case STREAMTYPE_VCD:
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
829
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
830 if (++guiInfo.Track > guiInfo.Tracks) {
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
831 guiInfo.Track = guiInfo.Tracks;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
832 stop = True;
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
833 }
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
834
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
835 break;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
836
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
837 case STREAMTYPE_DVD:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
838
35570
ca631388b039 Fix condition in uiNext().
ib
parents: 35569
diff changeset
839 if (guiInfo.Chapter++ >= guiInfo.Chapters) {
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
840 guiInfo.Chapter = 1;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
841
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
842 if (++guiInfo.Track > guiInfo.Tracks) {
35561
8889d320734f Cosmetic: Adjust indent.
ib
parents: 35560
diff changeset
843 guiInfo.Track = guiInfo.Tracks;
35560
1a2200a93ea8 Make DVD stop if manually advancing beyond last chapter of last track.
ib
parents: 35528
diff changeset
844 guiInfo.Chapter = guiInfo.Chapters;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
845 stop = True;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
846 }
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
847 } else
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
848 unset = False;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
849
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
850 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
851
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
852 default:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
853
34663
73a5ecb53ee2 Replace symbolic constants by enums.
ib
parents: 34610
diff changeset
854 next = listMgr(PLAYLIST_ITEM_GET_NEXT, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
855
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
856 if (next) {
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
857 uiSetFile(next->path, next->name, STREAMTYPE_FILE);
35500
6422042d74d9 Simplify assignments.
ib
parents: 35497
diff changeset
858 guiInfo.PlaylistNext = !guiInfo.Playing;
35458
2a6113c08e20 Add listMgr command PLAYLIST_ITEM_GET_CURR_POS.
ib
parents: 35454
diff changeset
859 guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, next);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
860 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
861 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
862
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
863 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
864 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
865
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
866 if (stop)
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
867 uiEvent(evStop, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
868
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
869 if (guiInfo.Playing == GUI_PLAY)
35773
c688b0dcbe66 Cosmetic: Rename uiMainEvent() uiEvent().
ib
parents: 35771
diff changeset
870 uiEvent(evPlay, 0);
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
871 else if (!stop && !next && unset)
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
872 uiUnsetMedia(True);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
873 }