annotate gui/ui/actions.c @ 35483:8ac7761bcb7c

Clear information associated with a file when setting a new one. This fixes showing wrong information when jumping through the playlist tracks in stop mode.
author ib
date Mon, 03 Dec 2012 14:04:43 +0000
parents e671bb33230f
children 4d2ebecd1605
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"
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
28 #include "gmplayer.h"
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
29 #include "gui/app.h"
35429
3a9048421524 Create new header file gui.h.
ib
parents: 35428
diff changeset
30 #include "gui/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
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
57 wsFullScreen(&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
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
61 wsSetLayer(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)
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
64 wsSetLayer(wsDisplay, guiApp.menuWindow.WindowID, guiApp.videoWindow.isFullScreen);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
65
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
66 if (guiInfo.Playing)
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
67 wsSetBackgroundRGB(&guiApp.videoWindow, 0, 0, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
68 else
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
69 wsSetBackgroundRGB(&guiApp.videoWindow, guiApp.video.R, guiApp.video.G, guiApp.video.B);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
71
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
72 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
73 * @brief Switch to play mode.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
74 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
75 void uiPlay(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
76 {
34401
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
77 if (guiInfo.Playing == GUI_PLAY)
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
78 return;
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
79
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
80 if (guiInfo.StreamType != STREAMTYPE_CDDA &&
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
81 guiInfo.StreamType != STREAMTYPE_VCD &&
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
82 guiInfo.StreamType != STREAMTYPE_DVD &&
af8838c2b60b Allow uiPlay() without guiInfo.Filename for some stream types.
ib
parents: 34400
diff changeset
83 (!guiInfo.Filename || (guiInfo.Filename[0] == 0)))
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
84 return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
85
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
86 if (guiInfo.Playing == GUI_PAUSE) {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
87 uiPause();
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
88 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
89 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
90
33731
81f71d910333 Cosmetic: Change prefix for symbolic constants from GMP to GUI.
ib
parents: 33725
diff changeset
91 gui(GUI_SET_STATE, (void *)GUI_PLAY);
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
92 uiVideoRender = 0;
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
93 wsSetBackgroundRGB(&guiApp.videoWindow, 0, 0, 0);
35357
80fe9ad7f318 Pass guiApp's wsTWindow parameters always by reference (if possible).
ib
parents: 34697
diff changeset
94 wsClearWindow(&guiApp.videoWindow);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
95 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
96
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
97 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
98 * @brief Switch to pause mode.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
99 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
100 void uiPause(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
102 if (!guiInfo.Playing)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
103 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
104
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
105 if (guiInfo.Playing == GUI_PLAY) {
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
106 mp_cmd_t *cmd = calloc(1, sizeof(*cmd));
35433
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
107
35432
a545e4994460 Check return value to avoid segmentation fault.
ib
parents: 35431
diff changeset
108 if (cmd) {
35433
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
109 cmd->id = MP_CMD_PAUSE;
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
110 cmd->name = strdup("pause");
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
111 mp_input_queue_cmd(cmd);
35432
a545e4994460 Check return value to avoid segmentation fault.
ib
parents: 35431
diff changeset
112 }
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
113 } else
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
114 guiInfo.Playing = GUI_PLAY;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
115 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
116
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
117 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
118 * @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
119 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
120 void uiState(void)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
121 {
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
122 if (guiInfo.Playing == GUI_STOP || guiInfo.Playing == GUI_PAUSE) {
33978
81aaa1420337 Replace some btnModify() calls by btnSet().
ib
parents: 33960
diff changeset
123 btnSet(evPlaySwitchToPause, btnReleased);
81aaa1420337 Replace some btnModify() calls by btnSet().
ib
parents: 33960
diff changeset
124 btnSet(evPauseSwitchToPlay, btnDisabled);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
125 } else {
35434
e589db40d32e Cosmetic: Switch two code lines.
ib
parents: 35433
diff changeset
126 btnSet(evPauseSwitchToPlay, btnReleased);
33978
81aaa1420337 Replace some btnModify() calls by btnSet().
ib
parents: 33960
diff changeset
127 btnSet(evPlaySwitchToPause, btnDisabled);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
128 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
129 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
130
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
131 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
132 * @brief Seek new playback position.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
133 *
35438
b3efe5e9f0bf Cosmetic: Correct indent.
ib
parents: 35437
diff changeset
134 * The new position is a relative one.
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
135 *
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
136 * @param sec seconds to seek (either forward (> 0) or backward (< 0))
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
137 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
138 void uiRelSeek(float sec)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
139 {
32971
dc905c693b7a Choose informative variable names.
ib
parents: 32970
diff changeset
140 rel_seek_secs = sec;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
141 abs_seek_pos = 0;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
142 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
143
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
144 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
145 * @brief Seek new playback position.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
146 *
35438
b3efe5e9f0bf Cosmetic: Correct indent.
ib
parents: 35437
diff changeset
147 * The new position is an absolute one.
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
148 *
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
149 * @param percent percentage of playback time to position to
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
150 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
151 void uiAbsSeek(float percent)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
152 {
32971
dc905c693b7a Choose informative variable names.
ib
parents: 32970
diff changeset
153 rel_seek_secs = percent / 100.0;
35431
20c90da2ba0d Use symbolic constants to set abs_seek_pos.
ib
parents: 35430
diff changeset
154 abs_seek_pos = SEEK_ABSOLUTE | SEEK_FACTOR;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
155 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
156
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
157 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
158 * @brief Change to a different skin.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
159 *
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
160 * @param name name of the skin to change to
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
161 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
162 void uiChangeSkin(char *name)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
163 {
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32882
diff changeset
164 int prev, bprev;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
165
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
166 prev = guiApp.menuIsPresent;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
167 bprev = guiApp.playbarIsPresent;
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 mainVisible = 0;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
170
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32882
diff changeset
171 if (skinRead(name) != 0) {
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32882
diff changeset
172 if (skinRead(skinName) != 0) {
32894
f01aafc5a961 Cosmetic: Adjust indent.
ib
parents: 32893
diff changeset
173 mainVisible = 1;
f01aafc5a961 Cosmetic: Adjust indent.
ib
parents: 32893
diff changeset
174 return;
32893
c873777e957d Get rid of needless listItems variable and pointer.
ib
parents: 32882
diff changeset
175 }
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
176 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
177
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34663
diff changeset
178 /* reload menu window */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
179
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
180 if (prev && guiApp.menuIsPresent) {
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
181 free(menuDrawBuffer);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
182 menuDrawBuffer = calloc(1, guiApp.menu.Bitmap.ImageSize);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
183
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
184 if (!menuDrawBuffer) {
33530
7ced3616af42 Revise some messages.
ib
parents: 33529
diff changeset
185 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB);
33768
cee9987bc81d Remove guiExit().
ib
parents: 33742
diff changeset
186 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
187 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
188
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
189 wsResizeWindow(&guiApp.menuWindow, guiApp.menu.width, guiApp.menu.height);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
190 wsResizeImage(&guiApp.menuWindow, guiApp.menu.width, guiApp.menu.height);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
191 wsSetShape(&guiApp.menuWindow, guiApp.menu.Mask.Image);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
192 wsVisibleWindow(&guiApp.menuWindow, wsHideWindow);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
193 } else
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
194 uiMenuInit();
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
195
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
196 /* reload video window */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
197
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
198 if (guiApp.video.Bitmap.Image)
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
199 wsResizeImage(&guiApp.videoWindow, guiApp.video.Bitmap.Width, guiApp.video.Bitmap.Height);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
200
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
201 if (!guiApp.videoWindow.isFullScreen && !guiInfo.Playing) {
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
202 wsResizeWindow(&guiApp.videoWindow, guiApp.video.width, guiApp.video.height);
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
203 wsMoveWindow(&guiApp.videoWindow, False, guiApp.video.x, guiApp.video.y);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
204 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
205
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
206 if (guiApp.video.Bitmap.Image)
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
207 wsConvert(&guiApp.videoWindow, guiApp.video.Bitmap.Image);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
208
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
209 if (!guiInfo.Playing) {
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
210 uiVideoRender = 1;
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
211 wsSetBackgroundRGB(&guiApp.videoWindow, guiApp.video.R, guiApp.video.G, guiApp.video.B);
35357
80fe9ad7f318 Pass guiApp's wsTWindow parameters always by reference (if possible).
ib
parents: 34697
diff changeset
212 wsClearWindow(&guiApp.videoWindow);
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
213 wsPostRedisplay(&guiApp.videoWindow);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
214 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
215
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34663
diff changeset
216 /* reload playbar */
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
217
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
218 if (bprev)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
219 wsDestroyWindow(&guiApp.playbarWindow);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
220
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
221 uiPlaybarInit();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
222
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34663
diff changeset
223 /* reload main window */
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
224
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
225 free(mainDrawBuffer);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
226 mainDrawBuffer = calloc(1, guiApp.main.Bitmap.ImageSize);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
227
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
228 if (!mainDrawBuffer) {
33530
7ced3616af42 Revise some messages.
ib
parents: 33529
diff changeset
229 gmp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_NEMDB);
33768
cee9987bc81d Remove guiExit().
ib
parents: 33742
diff changeset
230 mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
231 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
232
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
233 wsDestroyWindow(&guiApp.mainWindow);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
234
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
235 wsCreateWindow(&guiApp.mainWindow, guiApp.main.x, guiApp.main.y, guiApp.main.width, guiApp.main.height, wsNoBorder, wsShowMouseCursor | wsHandleMouseButton | wsHandleMouseMove, wsShowFrame | wsMaxSize | wsHideWindow, "MPlayer");
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
236 wsCreateImage(&guiApp.mainWindow, guiApp.main.Bitmap.Width, guiApp.main.Bitmap.Height);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
237 wsSetShape(&guiApp.mainWindow, guiApp.main.Mask.Image);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
238 wsSetIcon(wsDisplay, guiApp.mainWindow.WindowID, &guiIcon);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
239
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
240 guiApp.mainWindow.ReDraw = (void *)uiMainDraw;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
241 guiApp.mainWindow.MouseHandler = uiMainMouseHandle;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
242 guiApp.mainWindow.KeyHandler = uiMainKeyHandle;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
243 guiApp.mainWindow.DandDHandler = uiDandDHandler;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
244
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
245 wsXDNDMakeAwareness(&guiApp.mainWindow);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
246
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
247 if (!guiApp.mainDecoration)
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
248 wsWindowDecoration(&guiApp.mainWindow, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
249
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
250 wsVisibleWindow(&guiApp.mainWindow, wsShowWindow);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
251 mainVisible = 1;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
252
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
253 btnModify(evSetVolume, guiInfo.Volume);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
254 btnModify(evSetBalance, guiInfo.Balance);
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
255 btnModify(evSetMoviePosition, guiInfo.Position);
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
256 btnSet(evFullScreen, (guiApp.videoWindow.isFullScreen ? btnPressed : btnReleased));
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
257
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
258 wsSetLayer(wsDisplay, guiApp.mainWindow.WindowID, guiApp.videoWindow.isFullScreen);
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34690
diff changeset
259 wsSetLayer(wsDisplay, guiApp.menuWindow.WindowID, guiApp.videoWindow.isFullScreen);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
260 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
261
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
262 /**
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
263 * @brief Set the file to be played.
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
264 *
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
265 * @param dir directory (optional, else NULL)
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
266 * @param name filename
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
267 * @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
268 *
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
269 * @note All #guiInfo members associated with the file will be cleared.
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
270 */
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
271 void uiSetFile(char *dir, char *name, int type)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
272 {
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
273 if (!dir)
33740
2c02269701bd Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents: 33739
diff changeset
274 setdup(&guiInfo.Filename, name);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
275 else
33740
2c02269701bd Remove macros guiSetFilename() and guiSetDF() from interface.h.
ib
parents: 33739
diff changeset
276 setddup(&guiInfo.Filename, dir, name);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
277
34064
54becc464788 Set MPlayer filename in uiSetFileName().
ib
parents: 33993
diff changeset
278 filename = guiInfo.Filename;
34399
f2c03009068d Don't explicitly set stream type if the type doesn't change.
ib
parents: 34387
diff changeset
279
35483
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
280 if (type != SAME_STREAMTYPE) {
34400
19b68f388735 Cosmetic: Adjust indent.
ib
parents: 34399
diff changeset
281 guiInfo.StreamType = type;
34064
54becc464788 Set MPlayer filename in uiSetFileName().
ib
parents: 33993
diff changeset
282
35483
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
283 guiInfo.VideoWidth = 0;
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
284 guiInfo.VideoHeight = 0;
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
285 guiInfo.AudioChannels = 0;
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
286 guiInfo.RunningTime = 0;
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
287 guiInfo.Track = 0;
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
288 guiInfo.Chapter = 0;
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
289 guiInfo.Angle = 0;
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
290
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
291 nfree(guiInfo.CodecName);
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
292 nfree(guiInfo.AudioFilename);
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
293 nfree(guiInfo.SubtitleFilename);
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
294 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
295 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
296
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
297 /**
35453
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
298 * @brief Unset the file being played.
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
299 */
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
300 void uiUnsetFile(void)
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
301 {
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
302 uiSetFile(NULL, NULL, STREAMTYPE_DUMMY);
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
303 }
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
304
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
305 /**
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
306 * @brief Set file to be played to current playlist entry.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
307 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
308 void uiCurr(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
309 {
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
310 plItem *curr;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
311
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
312 if (guiInfo.Playing == GUI_PAUSE)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
313 return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
314
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
315 switch (guiInfo.StreamType) {
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
316 case STREAMTYPE_CDDA:
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
317 case STREAMTYPE_VCD:
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
318 case STREAMTYPE_DVD:
35433
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
319
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
320 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
321
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
322 default:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
323
34663
73a5ecb53ee2 Replace symbolic constants by enums.
ib
parents: 34610
diff changeset
324 curr = listMgr(PLAYLIST_ITEM_GET_CURR, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
325
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
326 if (curr) {
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
327 uiSetFile(curr->path, curr->name, STREAMTYPE_FILE);
35430
2d55540614a9 Move uiProcessNextInPlaylist to the guiInfo structure.
ib
parents: 35429
diff changeset
328 guiInfo.PlaylistNext = 0;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
329 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
330 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
331
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
332 return;
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
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
335 if (guiInfo.Playing == GUI_PLAY)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
336 uiEventHandling(evPlay, 0);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
337 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
338
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
339 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
340 * @brief Switch to previous playback track.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
341 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
342 void uiPrev(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
343 {
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
344 int stop = 0;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
345 plItem *prev;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
346
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
347 if (guiInfo.Playing == GUI_PAUSE)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
348 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
349
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
350 switch (guiInfo.StreamType) {
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
351 case STREAMTYPE_CDDA:
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
352
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
353 if (--guiInfo.Track == 0) {
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
354 guiInfo.Track = 1;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
355 stop = 1;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
356 }
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
357
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
358 break;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
359
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
360 case STREAMTYPE_VCD:
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
361
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
362 if (--guiInfo.Track == 1) {
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
363 guiInfo.Track = 2;
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
364 stop = 1;
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
365 }
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
366
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
367 break;
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
368
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
369 case STREAMTYPE_DVD:
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
370
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
371 if (--guiInfo.Chapter == 0) {
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
372 guiInfo.Chapter = 1;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
373
35428
0833bccb3c7b Fix bug introduced in r35521.
ib
parents: 35427
diff changeset
374 if (--guiInfo.Track == 0) {
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
375 guiInfo.Track = 1;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
376 stop = 1;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
377 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
378 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
379
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
380 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
381
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
382 default:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
383
34663
73a5ecb53ee2 Replace symbolic constants by enums.
ib
parents: 34610
diff changeset
384 prev = listMgr(PLAYLIST_ITEM_GET_PREV, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
385
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
386 if (prev) {
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
387 uiSetFile(prev->path, prev->name, STREAMTYPE_FILE);
35430
2d55540614a9 Move uiProcessNextInPlaylist to the guiInfo structure.
ib
parents: 35429
diff changeset
388 guiInfo.PlaylistNext = (guiInfo.Playing ? 0 : 1);
35458
2a6113c08e20 Add listMgr command PLAYLIST_ITEM_GET_CURR_POS.
ib
parents: 35454
diff changeset
389 guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, prev);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
390 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
391 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
392
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
393 return;
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 if (stop)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
397 uiEventHandling(evStop, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
398
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
399 if (guiInfo.Playing == GUI_PLAY)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
400 uiEventHandling(evPlay, 0);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
401 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
402
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
403 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
404 * @brief Switch to next playback track.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
405 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
406 void uiNext(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
407 {
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
408 int stop = 0;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
409 plItem *next;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
410
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
411 if (guiInfo.Playing == GUI_PAUSE)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
412 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
413
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
414 switch (guiInfo.StreamType) {
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
415 case STREAMTYPE_CDDA:
35425
e9f57004e925 Don't treat STREAMTYPE_VCD differently in uiNext().
ib
parents: 35379
diff changeset
416 case STREAMTYPE_VCD:
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
417
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
418 if (++guiInfo.Track > guiInfo.Tracks) {
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
419 guiInfo.Track = guiInfo.Tracks;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
420 stop = 1;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
421 }
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 break;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
424
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
425 case STREAMTYPE_DVD:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
426
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
427 if (guiInfo.Chapter++ == guiInfo.Chapters) {
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
428 guiInfo.Chapter = 1;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
429
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
430 if (++guiInfo.Track > guiInfo.Tracks) {
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
431 guiInfo.Track = guiInfo.Tracks;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
432 stop = 1;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
433 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
434 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
435
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
436 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
437
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
438 default:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
439
34663
73a5ecb53ee2 Replace symbolic constants by enums.
ib
parents: 34610
diff changeset
440 next = listMgr(PLAYLIST_ITEM_GET_NEXT, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
441
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
442 if (next) {
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
443 uiSetFile(next->path, next->name, STREAMTYPE_FILE);
35430
2d55540614a9 Move uiProcessNextInPlaylist to the guiInfo structure.
ib
parents: 35429
diff changeset
444 guiInfo.PlaylistNext = (guiInfo.Playing ? 0 : 1);
35458
2a6113c08e20 Add listMgr command PLAYLIST_ITEM_GET_CURR_POS.
ib
parents: 35454
diff changeset
445 guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, next);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
446 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
447 }
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 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
450 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
451
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
452 if (stop)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
453 uiEventHandling(evStop, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
454
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
455 if (guiInfo.Playing == GUI_PLAY)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
456 uiEventHandling(evPlay, 0);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
457 }