annotate gui/ui/actions.c @ 35757:b1d32b46514e

Get rid of uiVideoRender. Directly use guiInfo.Playing instead.
author ib
date Thu, 24 Jan 2013 16:06:48 +0000
parents 9c7bab18690c
children afb55738b1b7
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"
35525
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35500
diff changeset
29 #include "gui/app/app.h"
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35500
diff changeset
30 #include "gui/app/gui.h"
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
31 #include "gui/interface.h"
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
32 #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
33 #include "gui/util/list.h"
33739
9f6d46d325de Remove gfree() from interface.c.
ib
parents: 33737
diff changeset
34 #include "gui/util/mem.h"
33737
71c29e8ec68f Move string functions from interface.c to string.c.
ib
parents: 33731
diff changeset
35 #include "gui/util/string.h"
35435
578e049a78ae Add necessary and remove unnecessary #includes.
ib
parents: 35434
diff changeset
36 #include "gui/wm/ws.h"
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
37 #include "gui/wm/wsxdnd.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
38
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
39 #include "help_mp.h"
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
40 #include "input/input.h"
35431
20c90da2ba0d Use symbolic constants to set abs_seek_pos.
ib
parents: 35430
diff changeset
41 #include "libmpdemux/demuxer.h"
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
42 #include "libvo/video_out.h"
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
43 #include "mp_core.h"
35435
578e049a78ae Add necessary and remove unnecessary #includes.
ib
parents: 35434
diff changeset
44 #include "mp_msg.h"
578e049a78ae Add necessary and remove unnecessary #includes.
ib
parents: 35434
diff changeset
45 #include "mplayer.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
46
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
47 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
48 * @brief Switch video window fullscreen mode.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
49 *
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
50 * Switch normal video to fullscreen and fullscreen video to normal.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
51 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
52 void uiFullScreen(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53 {
33960
1cd81338af07 Rework fullscreen handling.
ib
parents: 33957
diff changeset
54 if (!guiInfo.VideoWindow)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
55 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
56
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
57 wsWindowFullscreen(&guiApp.videoWindow);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
58
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
59 vo_fs = guiApp.videoWindow.isFullScreen;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
61 wsWindowLayer(wsDisplay, guiApp.mainWindow.WindowID, guiApp.videoWindow.isFullScreen);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
62
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
63 if (guiApp.menuIsPresent)
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
64 wsWindowLayer(wsDisplay, guiApp.menuWindow.WindowID, guiApp.videoWindow.isFullScreen);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
66
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
67 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
68 * @brief Switch to play mode.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
69 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
70 void uiPlay(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
71 {
34401
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
72 if (guiInfo.Playing == GUI_PLAY)
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
73 return;
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
74
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
75 if (guiInfo.StreamType != STREAMTYPE_CDDA &&
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
76 guiInfo.StreamType != STREAMTYPE_VCD &&
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
77 guiInfo.StreamType != STREAMTYPE_DVD &&
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
78 (!guiInfo.Filename || (guiInfo.Filename[0] == 0)))
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
79 return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
80
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
81 if (guiInfo.Playing == GUI_PAUSE) {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
82 uiPause();
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
83 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
84 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
85
33731
81f71d910333 Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents: 33725
diff changeset
86 gui(GUI_SET_STATE, (void *)GUI_PLAY);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
87 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
89 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
90 * @brief Switch to pause mode.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
91 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
92 void uiPause(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
93 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
94 if (!guiInfo.Playing)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
95 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
96
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
97 if (guiInfo.Playing == GUI_PLAY) {
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
98 mp_cmd_t *cmd = calloc(1, sizeof(*cmd));
35433
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
99
35432
a545e4994460 Check return value to avoid segmentation fault.
ib
parents: 35431
diff changeset
100 if (cmd) {
35433
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
101 cmd->id = MP_CMD_PAUSE;
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
102 cmd->name = strdup("pause");
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
103 mp_input_queue_cmd(cmd);
35432
a545e4994460 Check return value to avoid segmentation fault.
ib
parents: 35431
diff changeset
104 }
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
105 } else
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
106 guiInfo.Playing = GUI_PLAY;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
107 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
108
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
109 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
110 * @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
111 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
112 void uiState(void)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
113 {
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
114 if (guiInfo.Playing == GUI_STOP || guiInfo.Playing == GUI_PAUSE) {
33978
81aaa1420337 Replace some btnModify() calls by btnSet().
ib
parents: 33960
diff changeset
115 btnSet(evPlaySwitchToPause, btnReleased);
81aaa1420337 Replace some btnModify() calls by btnSet().
ib
parents: 33960
diff changeset
116 btnSet(evPauseSwitchToPlay, btnDisabled);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
117 } else {
35434
e589db40d32e Cosmetic: Switch two code lines.
ib
parents: 35433
diff changeset
118 btnSet(evPauseSwitchToPlay, btnReleased);
33978
81aaa1420337 Replace some btnModify() calls by btnSet().
ib
parents: 33960
diff changeset
119 btnSet(evPlaySwitchToPause, btnDisabled);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
120 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
121 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
122
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
123 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
124 * @brief Seek new playback position.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
125 *
35438
b3efe5e9f0bf Cosmetic: Correct indent.
ib
parents: 35437
diff changeset
126 * The new position is a relative one.
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
127 *
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
128 * @param sec seconds to seek (either forward (> 0) or backward (< 0))
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
129 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
130 void uiRelSeek(float sec)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
131 {
32971
dc905c693b7a Choose informative variable names.
ib
parents: 32970
diff changeset
132 rel_seek_secs = sec;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
133 abs_seek_pos = 0;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
134 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
135
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
136 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
137 * @brief Seek new playback position.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
138 *
35438
b3efe5e9f0bf Cosmetic: Correct indent.
ib
parents: 35437
diff changeset
139 * The new position is an absolute one.
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
140 *
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
141 * @param percent percentage of playback time to position to
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
142 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
143 void uiAbsSeek(float percent)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
144 {
32971
dc905c693b7a Choose informative variable names.
ib
parents: 32970
diff changeset
145 rel_seek_secs = percent / 100.0;
35431
20c90da2ba0d Use symbolic constants to set abs_seek_pos.
ib
parents: 35430
diff changeset
146 abs_seek_pos = SEEK_ABSOLUTE | SEEK_FACTOR;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
147 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
149 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
150 * @brief Change to a different skin.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
151 *
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
152 * @param name name of the skin to change to
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
153 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
154 void uiChangeSkin(char *name)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
155 {
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32882
diff changeset
156 int prev, bprev;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
157
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
158 prev = guiApp.menuIsPresent;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
159 bprev = guiApp.playbarIsPresent;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
160
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
161 mainVisible = False;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
162
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32882
diff changeset
163 if (skinRead(name) != 0) {
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32882
diff changeset
164 if (skinRead(skinName) != 0) {
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
165 mainVisible = True;
32894
f01aafc5a961 Cosmetic: Adjust indent.
ib
parents: 32893
diff changeset
166 return;
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32882
diff changeset
167 }
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
168 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
169
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34663
diff changeset
170 /* reload menu window */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
172 if (prev && guiApp.menuIsPresent) {
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
173 free(menuDrawBuffer);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
174 menuDrawBuffer = calloc(1, guiApp.menu.Bitmap.ImageSize);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
175
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
176 if (!menuDrawBuffer) {
33530
7ced3616af42 Revise some messages.
ib
parents: 33529
diff changeset
177 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB);
33768
cee9987bc81d Remove guiExit().
ib
parents: 33742
diff changeset
178 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
179 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
180
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
181 wsWindowResize(&guiApp.menuWindow, guiApp.menu.width, guiApp.menu.height);
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
182 wsImageResize(&guiApp.menuWindow, guiApp.menu.width, guiApp.menu.height);
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
183 wsWindowShape(&guiApp.menuWindow, guiApp.menu.Mask.Image);
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
184 wsWindowVisibility(&guiApp.menuWindow, wsHideWindow);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
185 } else
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
186 uiMenuInit();
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
187
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
188 /* reload video window */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
189
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
190 if (guiApp.video.Bitmap.Image)
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
191 wsImageResize(&guiApp.videoWindow, guiApp.video.Bitmap.Width, guiApp.video.Bitmap.Height);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
192
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
193 if (!guiApp.videoWindow.isFullScreen && !guiInfo.Playing) {
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
194 wsWindowResize(&guiApp.videoWindow, guiApp.video.width, guiApp.video.height);
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
195 wsWindowMove(&guiApp.videoWindow, False, guiApp.video.x, guiApp.video.y);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
196 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
197
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
198 if (guiApp.video.Bitmap.Image)
35744
bfe51acc36fb Cosmetic: Rename wsImageConvert() wsImageRender().
ib
parents: 35739
diff changeset
199 wsImageRender(&guiApp.videoWindow, guiApp.video.Bitmap.Image);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
200
35745
9c7bab18690c Remove unnecessary setting of uiVideoRender.
ib
parents: 35744
diff changeset
201 if (!guiInfo.Playing)
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
202 wsWindowRedraw(&guiApp.videoWindow);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
203
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34663
diff changeset
204 /* reload playbar */
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
205
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
206 if (bprev)
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
207 wsWindowDestroy(&guiApp.playbarWindow);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
208
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
209 uiPlaybarInit();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
210
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34663
diff changeset
211 /* reload main window */
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
212
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
213 free(mainDrawBuffer);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
214 mainDrawBuffer = calloc(1, guiApp.main.Bitmap.ImageSize);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
215
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
216 if (!mainDrawBuffer) {
33530
7ced3616af42 Revise some messages.
ib
parents: 33529
diff changeset
217 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB);
33768
cee9987bc81d Remove guiExit().
ib
parents: 33742
diff changeset
218 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
219 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
220
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
221 wsWindowDestroy(&guiApp.mainWindow);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
222
35697
13f8a04c5524 Remove redundant parameter from function.
ib
parents: 35683
diff changeset
223 wsWindowCreate(&guiApp.mainWindow, guiApp.main.x, guiApp.main.y, guiApp.main.width, guiApp.main.height, (guiApp.mainDecoration ? wsShowFrame : 0) | wsMinSize | wsMaxSize | wsHideWindow, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, "MPlayer");
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
224 wsImageCreate(&guiApp.mainWindow, guiApp.main.Bitmap.Width, guiApp.main.Bitmap.Height);
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
225 wsWindowShape(&guiApp.mainWindow, guiApp.main.Mask.Image);
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
226 wsWindowIcon(wsDisplay, guiApp.mainWindow.WindowID, &guiIcon);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
227
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
228 guiApp.mainWindow.ReDraw = (void *)uiMainDraw;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
229 guiApp.mainWindow.MouseHandler = uiMainMouseHandle;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
230 guiApp.mainWindow.KeyHandler = uiMainKeyHandle;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
231 guiApp.mainWindow.DandDHandler = uiDandDHandler;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
232
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
233 wsXDNDMakeAwareness(&guiApp.mainWindow);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
234
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
235 wsWindowVisibility(&guiApp.mainWindow, wsShowWindow);
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
236 mainVisible = True;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
237
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
238 btnModify(evSetVolume, guiInfo.Volume);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
239 btnModify(evSetBalance, guiInfo.Balance);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
240 btnModify(evSetMoviePosition, guiInfo.Position);
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
241 btnSet(evFullScreen, (guiApp.videoWindow.isFullScreen ? btnPressed : btnReleased));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
242
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
243 wsWindowLayer(wsDisplay, guiApp.mainWindow.WindowID, guiApp.videoWindow.isFullScreen);
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35658
diff changeset
244 wsWindowLayer(wsDisplay, guiApp.menuWindow.WindowID, guiApp.videoWindow.isFullScreen);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
245 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
246
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
247 /**
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
248 * @brief Set the file to be played.
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
249 *
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
250 * @param dir directory (optional, else NULL)
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
251 * @param name filename
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
252 * @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
253 *
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
254 * @note All #guiInfo members associated with the file will be cleared.
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
255 */
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
256 void uiSetFile(char *dir, char *name, int type)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
257 {
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
258 if (!dir)
33740
2c02269701bd Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents: 33739
diff changeset
259 setdup(&guiInfo.Filename, name);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
260 else
33740
2c02269701bd Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents: 33739
diff changeset
261 setddup(&guiInfo.Filename, dir, name);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
262
34064
54becc464788 Set MPlayer filename in uiSetFileName().
ib
parents: 33993
diff changeset
263 filename = guiInfo.Filename;
34399
f2c03009068d Don't explicitly set stream type if the type doesn't change.
ib
parents: 34387
diff changeset
264
35483
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
265 if (type != SAME_STREAMTYPE) {
34400
19b68f388735 Cosmetic: Adjust indent.
ib
parents: 34399
diff changeset
266 guiInfo.StreamType = type;
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
267 uiUnsetMedia(False);
35483
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
268 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
269 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
270
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
271 /**
35453
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
272 * @brief Unset the file being played.
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
273 */
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
274 void uiUnsetFile(void)
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
275 {
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
276 uiSetFile(NULL, NULL, STREAMTYPE_DUMMY);
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
277 }
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
278
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
279 /**
35562
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
280 * @brief Unset media information.
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
281 *
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
282 * @param totals whether to unset number of chapters and angles (#True) or
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
283 * just track, chapter and angle (#False) as well
35562
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
284 */
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
285 void uiUnsetMedia(int totals)
35562
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
286 {
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
287 guiInfo.VideoWidth = 0;
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
288 guiInfo.VideoHeight = 0;
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
289 guiInfo.AudioChannels = 0;
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
290 guiInfo.RunningTime = 0;
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
291
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
292 if (totals) {
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
293 guiInfo.Chapters = 0;
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
294 guiInfo.Angles = 0;
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
295 } else {
35569
8381468bb46c Cosmetic: Adjust indent.
ib
parents: 35568
diff changeset
296 guiInfo.Track = 0;
8381468bb46c Cosmetic: Adjust indent.
ib
parents: 35568
diff changeset
297 guiInfo.Chapter = 0;
8381468bb46c Cosmetic: Adjust indent.
ib
parents: 35568
diff changeset
298 guiInfo.Angle = 0;
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
299 }
35562
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
300
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
301 nfree(guiInfo.CodecName);
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
302 nfree(guiInfo.AudioFilename);
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
303 nfree(guiInfo.SubtitleFilename);
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
304 }
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
305
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
306 /**
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
307 * @brief Set file to be played to current playlist entry.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
308 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
309 void uiCurr(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
310 {
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
311 plItem *curr;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
312
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
313 if (guiInfo.Playing == GUI_PAUSE)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
314 return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
315
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
316 switch (guiInfo.StreamType) {
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
317 case STREAMTYPE_CDDA:
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
318 case STREAMTYPE_VCD:
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
319 case STREAMTYPE_DVD:
35433
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
320
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
321 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
322
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
323 default:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
324
34663
73a5ecb53ee2 Replace symbolic constants by enums.
ib
parents: 34610
diff changeset
325 curr = listMgr(PLAYLIST_ITEM_GET_CURR, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
326
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
327 if (curr) {
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
328 uiSetFile(curr->path, curr->name, STREAMTYPE_FILE);
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
329 guiInfo.PlaylistNext = False;
35485
4d2ebecd1605 Set track number in uiCurr().
ib
parents: 35483
diff changeset
330 guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, curr);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
331 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
332 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
333
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
334 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
335 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
336
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
337 if (guiInfo.Playing == GUI_PLAY)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
338 uiEventHandling(evPlay, 0);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
339 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
340
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
341 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
342 * @brief Switch to previous playback track.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
343 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
344 void uiPrev(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
345 {
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
346 int stop = False, unset = True;
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
347 plItem *prev = NULL;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
348
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
349 if (guiInfo.Playing == GUI_PAUSE)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
350 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
351
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
352 switch (guiInfo.StreamType) {
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
353 case STREAMTYPE_CDDA:
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
354
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
355 if (--guiInfo.Track == 0) {
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
356 guiInfo.Track = 1;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
357 stop = True;
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
358 }
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
359
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
360 break;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
361
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
362 case STREAMTYPE_VCD:
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
363
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
364 if (--guiInfo.Track == 1) {
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
365 guiInfo.Track = 2;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
366 stop = True;
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
367 }
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
368
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
369 break;
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
370
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
371 case STREAMTYPE_DVD:
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
372
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
373 if (--guiInfo.Chapter == 0) {
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
374 guiInfo.Chapter = 1;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
375
35428
0833bccb3c7b Fix bug introduced in r35521.
ib
parents: 35427
diff changeset
376 if (--guiInfo.Track == 0) {
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
377 guiInfo.Track = 1;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
378 stop = True;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
379 }
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
380 } else
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
381 unset = False;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
382
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
383 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
384
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
385 default:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
386
34663
73a5ecb53ee2 Replace symbolic constants by enums.
ib
parents: 34610
diff changeset
387 prev = listMgr(PLAYLIST_ITEM_GET_PREV, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
388
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
389 if (prev) {
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
390 uiSetFile(prev->path, prev->name, STREAMTYPE_FILE);
35500
6422042d74d9 Simplify assignments.
ib
parents: 35497
diff changeset
391 guiInfo.PlaylistNext = !guiInfo.Playing;
35458
2a6113c08e20 Add listMgr command PLAYLIST_ITEM_GET_CURR_POS.
ib
parents: 35454
diff changeset
392 guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, prev);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
393 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
394 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
395
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
396 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
397 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
398
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
399 if (stop)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
400 uiEventHandling(evStop, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
401
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
402 if (guiInfo.Playing == GUI_PLAY)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
403 uiEventHandling(evPlay, 0);
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
404 else if (!stop && !prev && unset)
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
405 uiUnsetMedia(True);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
406 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
407
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
408 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
409 * @brief Switch to next playback track.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
410 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
411 void uiNext(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
412 {
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
413 int stop = False, unset = True;
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
414 plItem *next = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
415
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
416 if (guiInfo.Playing == GUI_PAUSE)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
417 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
418
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
419 switch (guiInfo.StreamType) {
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
420 case STREAMTYPE_CDDA:
35425
e9f57004e925 Don't treat STREAMTYPE_VCD differently in uiNext().
ib
parents: 35379
diff changeset
421 case STREAMTYPE_VCD:
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
422
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
423 if (++guiInfo.Track > guiInfo.Tracks) {
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
424 guiInfo.Track = guiInfo.Tracks;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
425 stop = True;
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
426 }
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
427
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
428 break;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
429
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
430 case STREAMTYPE_DVD:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
431
35570
ca631388b039 Fix condition in uiNext().
ib
parents: 35569
diff changeset
432 if (guiInfo.Chapter++ >= guiInfo.Chapters) {
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
433 guiInfo.Chapter = 1;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
434
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
435 if (++guiInfo.Track > guiInfo.Tracks) {
35561
8889d320734f Cosmetic: Adjust indent.
ib
parents: 35560
diff changeset
436 guiInfo.Track = guiInfo.Tracks;
35560
1a2200a93ea8 Make DVD stop if manually advancing beyond last chapter of last track.
ib
parents: 35528
diff changeset
437 guiInfo.Chapter = guiInfo.Chapters;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
438 stop = True;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
439 }
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
440 } else
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
441 unset = False;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
442
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
443 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
444
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
445 default:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
446
34663
73a5ecb53ee2 Replace symbolic constants by enums.
ib
parents: 34610
diff changeset
447 next = listMgr(PLAYLIST_ITEM_GET_NEXT, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
448
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
449 if (next) {
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
450 uiSetFile(next->path, next->name, STREAMTYPE_FILE);
35500
6422042d74d9 Simplify assignments.
ib
parents: 35497
diff changeset
451 guiInfo.PlaylistNext = !guiInfo.Playing;
35458
2a6113c08e20 Add listMgr command PLAYLIST_ITEM_GET_CURR_POS.
ib
parents: 35454
diff changeset
452 guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, next);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
453 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
454 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
455
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
456 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
457 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
458
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
459 if (stop)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
460 uiEventHandling(evStop, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
461
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
462 if (guiInfo.Playing == GUI_PLAY)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
463 uiEventHandling(evPlay, 0);
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
464 else if (!stop && !next && unset)
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
465 uiUnsetMedia(True);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
466 }