annotate gui/ui/actions.c @ 36669:cb9975cda4bc

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