annotate gui/ui/actions.c @ 35615:26a91d76cfda

Disable direct rendering for non-ref frames only again, it still seems to cause issues that need to be debugged and fixed.
author reimar
date Mon, 24 Dec 2012 14:22:46 +0000
parents 29761b2b8cb0
children a30496350cb9
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
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);
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
92 uiVideoRender = False;
34697
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
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
169 mainVisible = False;
32881
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) {
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
173 mainVisible = True;
32894
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) {
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
210 uiVideoRender = True;
34697
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)
35497
ff7cf8f1bd19 Change parameter of wsWindowDecoration().
ib
parents: 35493
diff changeset
248 wsWindowDecoration(&guiApp.mainWindow, False);
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);
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
251 mainVisible = True;
32881
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;
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
282 uiUnsetMedia(False);
35483
8ac7761bcb7c Clear information associated with a file when setting a new one.
ib
parents: 35462
diff changeset
283 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
284 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
285
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
286 /**
35453
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
287 * @brief Unset the file being played.
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
288 */
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
289 void uiUnsetFile(void)
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
290 {
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
291 uiSetFile(NULL, NULL, STREAMTYPE_DUMMY);
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
292 }
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
293
c8f3bba6250a Add an uiSetFile() counterpart.
ib
parents: 35452
diff changeset
294 /**
35562
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
295 * @brief Unset media information.
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
296 *
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
297 * @param totals whether to unset number of chapters and angles (#True) or
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
298 * just track, chapter and angle (#False) as well
35562
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
299 */
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
300 void uiUnsetMedia(int totals)
35562
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
301 {
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
302 guiInfo.VideoWidth = 0;
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
303 guiInfo.VideoHeight = 0;
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
304 guiInfo.AudioChannels = 0;
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
305 guiInfo.RunningTime = 0;
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
306
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
307 if (totals) {
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
308 guiInfo.Chapters = 0;
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
309 guiInfo.Angles = 0;
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
310 } else {
35569
8381468bb46c Cosmetic: Adjust indent.
ib
parents: 35568
diff changeset
311 guiInfo.Track = 0;
8381468bb46c Cosmetic: Adjust indent.
ib
parents: 35568
diff changeset
312 guiInfo.Chapter = 0;
8381468bb46c Cosmetic: Adjust indent.
ib
parents: 35568
diff changeset
313 guiInfo.Angle = 0;
35568
9f58ee705989 Add a parameter to uiUnsetMedia().
ib
parents: 35562
diff changeset
314 }
35562
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
315
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
316 nfree(guiInfo.CodecName);
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
317 nfree(guiInfo.AudioFilename);
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
318 nfree(guiInfo.SubtitleFilename);
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
319 }
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
320
8b3791b648c6 Add a function to unset media information.
ib
parents: 35561
diff changeset
321 /**
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
322 * @brief Set file to be played to current playlist entry.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
323 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
324 void uiCurr(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
325 {
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
326 plItem *curr;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
327
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
328 if (guiInfo.Playing == GUI_PAUSE)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
329 return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
330
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
331 switch (guiInfo.StreamType) {
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
332 case STREAMTYPE_CDDA:
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
333 case STREAMTYPE_VCD:
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
334 case STREAMTYPE_DVD:
35433
208bfdd26819 Cosmetic: Adjust indent and insert blank lines.
ib
parents: 35432
diff changeset
335
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
336 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
337
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
338 default:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
339
34663
73a5ecb53ee2 Replace symbolic constants by enums.
ib
parents: 34610
diff changeset
340 curr = listMgr(PLAYLIST_ITEM_GET_CURR, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
341
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
342 if (curr) {
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
343 uiSetFile(curr->path, curr->name, STREAMTYPE_FILE);
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
344 guiInfo.PlaylistNext = False;
35485
4d2ebecd1605 Set track number in uiCurr().
ib
parents: 35483
diff changeset
345 guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, curr);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
346 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
347 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
348
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
349 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
350 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
351
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
352 if (guiInfo.Playing == GUI_PLAY)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
353 uiEventHandling(evPlay, 0);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
354 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
355
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
356 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
357 * @brief Switch to previous playback track.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
358 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
359 void uiPrev(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
360 {
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
361 int stop = False, unset = True;
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
362 plItem *prev = NULL;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
363
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
364 if (guiInfo.Playing == GUI_PAUSE)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
365 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
366
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
367 switch (guiInfo.StreamType) {
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
368 case STREAMTYPE_CDDA:
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
369
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
370 if (--guiInfo.Track == 0) {
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
371 guiInfo.Track = 1;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
372 stop = True;
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
373 }
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
374
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
375 break;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
376
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
377 case STREAMTYPE_VCD:
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
378
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
379 if (--guiInfo.Track == 1) {
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
380 guiInfo.Track = 2;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
381 stop = True;
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
382 }
35426
fb3c60a47b2c Cosmetic: Prettify uiPrev().
ib
parents: 35425
diff changeset
383
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
384 break;
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34074
diff changeset
385
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
386 case STREAMTYPE_DVD:
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27370
diff changeset
387
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
388 if (--guiInfo.Chapter == 0) {
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
389 guiInfo.Chapter = 1;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
390
35428
0833bccb3c7b Fix bug introduced in r35521.
ib
parents: 35427
diff changeset
391 if (--guiInfo.Track == 0) {
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
392 guiInfo.Track = 1;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
393 stop = True;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
394 }
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
395 } else
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
396 unset = False;
32881
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 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
399
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
400 default:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
401
34663
73a5ecb53ee2 Replace symbolic constants by enums.
ib
parents: 34610
diff changeset
402 prev = listMgr(PLAYLIST_ITEM_GET_PREV, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
403
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
404 if (prev) {
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
405 uiSetFile(prev->path, prev->name, STREAMTYPE_FILE);
35500
6422042d74d9 Simplify assignments.
ib
parents: 35497
diff changeset
406 guiInfo.PlaylistNext = !guiInfo.Playing;
35458
2a6113c08e20 Add listMgr command PLAYLIST_ITEM_GET_CURR_POS.
ib
parents: 35454
diff changeset
407 guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, prev);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
408 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
409 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
410
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
411 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
412 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
413
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
414 if (stop)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
415 uiEventHandling(evStop, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
416
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
417 if (guiInfo.Playing == GUI_PLAY)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
418 uiEventHandling(evPlay, 0);
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
419 else if (!stop && !prev && unset)
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
420 uiUnsetMedia(True);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
421 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
422
35437
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
423 /**
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
424 * @brief Switch to next playback track.
f812dd8ae52b Add doxygen comments to actions.c.
ib
parents: 35435
diff changeset
425 */
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
426 void uiNext(void)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
427 {
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
428 int stop = False, unset = True;
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
429 plItem *next = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
430
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
431 if (guiInfo.Playing == GUI_PAUSE)
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
432 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
433
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
434 switch (guiInfo.StreamType) {
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
435 case STREAMTYPE_CDDA:
35425
e9f57004e925 Don't treat STREAMTYPE_VCD differently in uiNext().
ib
parents: 35379
diff changeset
436 case STREAMTYPE_VCD:
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
437
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
438 if (++guiInfo.Track > guiInfo.Tracks) {
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
439 guiInfo.Track = guiInfo.Tracks;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
440 stop = True;
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
441 }
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
442
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
443 break;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34077
diff changeset
444
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
445 case STREAMTYPE_DVD:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
446
35570
ca631388b039 Fix condition in uiNext().
ib
parents: 35569
diff changeset
447 if (guiInfo.Chapter++ >= guiInfo.Chapters) {
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
448 guiInfo.Chapter = 1;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
449
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
450 if (++guiInfo.Track > guiInfo.Tracks) {
35561
8889d320734f Cosmetic: Adjust indent.
ib
parents: 35560
diff changeset
451 guiInfo.Track = guiInfo.Tracks;
35560
1a2200a93ea8 Make DVD stop if manually advancing beyond last chapter of last track.
ib
parents: 35528
diff changeset
452 guiInfo.Chapter = guiInfo.Chapters;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35485
diff changeset
453 stop = True;
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
454 }
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
455 } else
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
456 unset = False;
32881
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 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
459
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
460 default:
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
461
34663
73a5ecb53ee2 Replace symbolic constants by enums.
ib
parents: 34610
diff changeset
462 next = listMgr(PLAYLIST_ITEM_GET_NEXT, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
463
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
464 if (next) {
35452
f42cc2361ee4 Cosmetic: Rename uiSetFileName().
ib
parents: 35438
diff changeset
465 uiSetFile(next->path, next->name, STREAMTYPE_FILE);
35500
6422042d74d9 Simplify assignments.
ib
parents: 35497
diff changeset
466 guiInfo.PlaylistNext = !guiInfo.Playing;
35458
2a6113c08e20 Add listMgr command PLAYLIST_ITEM_GET_CURR_POS.
ib
parents: 35454
diff changeset
467 guiInfo.Track = (int)listMgr(PLAYLIST_ITEM_GET_POS, next);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
468 break;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
469 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
470
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
471 return;
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
472 }
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
473
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
474 if (stop)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
475 uiEventHandling(evStop, 0);
32881
dd3b365972a4 Cosmetic: Format to MPlayer coding style.
ib
parents: 32537
diff changeset
476
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
477 if (guiInfo.Playing == GUI_PLAY)
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
478 uiEventHandling(evPlay, 0);
35571
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
479 else if (!stop && !next && unset)
29761b2b8cb0 Reset media information while changing tracks in stop mode.
ib
parents: 35570
diff changeset
480 uiUnsetMedia(True);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
481 }