annotate gui/ui/main.c @ 35760:1aedd24c032b

Cosmetic: Rename ReDraw DrawHandler.
author ib
date Thu, 24 Jan 2013 16:56:44 +0000
parents afb55738b1b7
children 6742a91ba28a
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
34699
ed0e00db4306 Cosmetic: Move, change and add some comments on GUI windows.
ib
parents: 34697
diff changeset
19 /* main window */
ed0e00db4306 Cosmetic: Move, change and add some comments on GUI windows.
ib
parents: 34697
diff changeset
20
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
21 #include <stdlib.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
22 #include <stdio.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
23 #include <sys/stat.h>
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
24 #include <unistd.h>
23305
22d3d12c6dfb Include string.h for memcpy, fastmemcpy.h alone is not enough.
reimar
parents: 23154
diff changeset
25 #include <string.h>
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
26
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
27 #include "config.h"
35528
ab07b17fddfb Rebuild GUI directory structure.
ib
parents: 35525
diff changeset
28 #include "ui.h"
35525
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35521
diff changeset
29 #include "gui/app/app.h"
e27855a45128 Rebuild GUI directory structure.
ib
parents: 35521
diff changeset
30 #include "gui/app/gui.h"
33738
998f94e62a61 Remove unnecessary #include "gui/interface.h".
ib
parents: 33737
diff changeset
31 #include "gui/interface.h"
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
32 #include "gui/skin/font.h"
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
33 #include "gui/skin/skin.h"
33742
e1539e14d60f Move purely list related parts of gtkSet() from interface.c to list.c.
ib
parents: 33739
diff changeset
34 #include "gui/util/list.h"
33739
9f6d46d325de Remove gfree() from interface.c.
ib
parents: 33738
diff changeset
35 #include "gui/util/mem.h"
33737
71c29e8ec68f Move string functions from interface.c to string.c.
ib
parents: 33657
diff changeset
36 #include "gui/util/string.h"
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
37 #include "gui/wm/ws.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"
34174
a93891202051 Add missing mp_msg.h #includes, remove some unnecessary ones.
diego
parents: 34077
diff changeset
40 #include "mp_msg.h"
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
41 #include "libvo/x11_common.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
42 #include "libvo/fastmemcpy.h"
33531
84ce059fae34 Get non-multimedia X11 key definitions from libvo/wskeys.h.
ib
parents: 33525
diff changeset
43 #include "libvo/wskeys.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
44
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
45 #include "stream/stream.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
46 #include "stream/url.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
47 #include "mixer.h"
32467
fbe5c829c69b Move libvo/sub.[ch] from libvo to sub.
cigaes
parents: 32043
diff changeset
48 #include "sub/sub.h"
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
49 #include "access_mpcontext.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50
30537
7bebe34b6ad2 Move movie_aspect extern declaration to libmpcodecs/vd.h.
diego
parents: 30516
diff changeset
51 #include "libmpcodecs/vd.h"
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
52 #include "libmpdemux/demuxer.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
53 #include "libmpdemux/stheader.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
54 #include "codec-cfg.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
55 #include "m_option.h"
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
56 #include "m_property.h"
30516
f4e017b6921a Fix exit_player() usage throughout the codebase.
diego
parents: 29263
diff changeset
57 #include "mp_core.h"
32043
f6249bc89c38 Move extern declarations used by both mplayer.c and mencoder.c to mpcommon.h.
diego
parents: 32041
diff changeset
58 #include "mpcommon.h"
35545
d83d2bd5f365 Use FFMIN in evSetVolume.
ib
parents: 35544
diff changeset
59 #include "libavutil/common.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
61 #define GUI_REDRAW_WAIT 375
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62
33556
520fb0f7544c Rename GUI directory 'mplayer' and some files in it.
ib
parents: 33555
diff changeset
63 #include "actions.h"
35529
8ad4d2fb46e8 Rebuild GUI directory structure.
ib
parents: 35528
diff changeset
64 #include "gui/dialog/dialog.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27370
diff changeset
66 unsigned int GetTimerMS( void );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
67
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
68 unsigned char * mainDrawBuffer = NULL;
35758
75724b59a3a8 Make uiMainRender static.
ib
parents: 35749
diff changeset
69 static int uiMainRender = True;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35490
diff changeset
71 int uiMainAutoPlay = False;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
72
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35490
diff changeset
73 int mainVisible = True;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35490
diff changeset
75 int boxMoved = False;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
76 int sx = 0,sy = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
77 int i,pot = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
78
33556
520fb0f7544c Rename GUI directory 'mplayer' and some files in it.
ib
parents: 33555
diff changeset
79 #include "render.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
80
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
81 void uiMainDraw( void )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
82 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
83
33768
cee9987bc81d Remove guiExit().
ib
parents: 33763
diff changeset
84 if ( guiApp.mainWindow.State == wsWindowClosed ) mplayer( MPLAYER_EXIT_GUI, EXIT_QUIT, 0 );
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
85
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
86 if ( guiApp.mainWindow.Visible == wsWindowNotVisible ||
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
87 !mainVisible ) return;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
88 // !guiApp.mainWindow.Mapped ) return;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
89
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
90 if ( uiMainRender && guiApp.mainWindow.State == wsWindowExpose )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
91 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
92 btnModify( evSetMoviePosition,guiInfo.Position );
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
93 btnModify( evSetVolume,guiInfo.Volume );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
94
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
95 fast_memcpy( mainDrawBuffer,guiApp.main.Bitmap.Image,guiApp.main.Bitmap.ImageSize );
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
96 RenderAll( &guiApp.mainWindow,guiApp.mainItems,guiApp.IndexOfMainItems,mainDrawBuffer );
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35490
diff changeset
97 uiMainRender=False;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98 }
35746
e745b22750f6 Add some notes for later checking and fixing.
ib
parents: 35727
diff changeset
99 // NOTE TO MYSELF: probably not, if uiMainRender is False
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
100 wsImageDraw( &guiApp.mainWindow );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101 // XFlush( wsDisplay );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
103
35490
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
104 static void MediumPrepare (int type)
33771
6e774a02d00c Remove gtkClearStruct code from mplayer() in interface.c.
ib
parents: 33768
diff changeset
105 {
35490
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
106 switch (type)
33771
6e774a02d00c Remove gtkClearStruct code from mplayer() in interface.c.
ib
parents: 33768
diff changeset
107 {
35490
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
108 case STREAMTYPE_DVD:
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
109 listMgr(PLAYLIST_DELETE, 0);
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
110 break;
33771
6e774a02d00c Remove gtkClearStruct code from mplayer() in interface.c.
ib
parents: 33768
diff changeset
111
35490
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
112 case STREAMTYPE_CDDA:
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
113 case STREAMTYPE_VCD:
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
114 listMgr(PLAYLIST_DELETE, 0);
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
115 case STREAMTYPE_FILE:
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
116 case STREAMTYPE_STREAM:
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
117 case STREAMTYPE_PLAYLIST:
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
118 guiInfo.AudioStreams = 0;
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
119 guiInfo.Subtitles = 0;
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
120 guiInfo.Chapters = 0;
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
121 guiInfo.Angles = 0;
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
122 break;
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
123 }
33771
6e774a02d00c Remove gtkClearStruct code from mplayer() in interface.c.
ib
parents: 33768
diff changeset
124 }
6e774a02d00c Remove gtkClearStruct code from mplayer() in interface.c.
ib
parents: 33768
diff changeset
125
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
126 static unsigned last_redraw_time = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
127
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
128 void uiEventHandling( int msg,float param )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
129 {
35543
5289e495e70e Set volume in evSetBalance.
ib
parents: 35539
diff changeset
130 int iparam = (int)param, osd;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
131 mixer_t *mixer = mpctx_get_mixer(guiInfo.mpcontext);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
132
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
133 switch( msg )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
134 {
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34681
diff changeset
135 /* user events */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
136 case evExit:
33768
cee9987bc81d Remove guiExit().
ib
parents: 33763
diff changeset
137 mplayer( MPLAYER_EXIT_GUI, EXIT_QUIT, 0 );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
138 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
139
34324
58aaa0d8cc82 Replace evSetURL by evLoadURL for consistency.
ib
parents: 34321
diff changeset
140 case evLoadURL:
34329
d7c8a3cee15e Replace evPlayNetwork by evLoadURL.
ib
parents: 34324
diff changeset
141 gtkShow( evLoadURL,NULL );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
142 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
143
34333
e8e4e6f9b7ac Change prefix for internal events from ev to iv.
ib
parents: 34329
diff changeset
144 case ivSetAudio:
33657
c92f23eac7a4 Remove guiGetEvent type guiSetDemuxer.
ib
parents: 33655
diff changeset
145 if ( !mpctx_get_demuxer(guiInfo.mpcontext) || audio_id == iparam ) break;
34469
c3f95506f756 Fix bug with switching audio and video tracks.
ib
parents: 34458
diff changeset
146 mp_property_do("switch_audio",M_PROPERTY_SET,&iparam,guiInfo.mpcontext);
c3f95506f756 Fix bug with switching audio and video tracks.
ib
parents: 34458
diff changeset
147 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
148
34333
e8e4e6f9b7ac Change prefix for internal events from ev to iv.
ib
parents: 34329
diff changeset
149 case ivSetVideo:
33657
c92f23eac7a4 Remove guiGetEvent type guiSetDemuxer.
ib
parents: 33655
diff changeset
150 if ( !mpctx_get_demuxer(guiInfo.mpcontext) || video_id == iparam ) break;
34469
c3f95506f756 Fix bug with switching audio and video tracks.
ib
parents: 34458
diff changeset
151 mp_property_do("switch_video",M_PROPERTY_SET,&iparam,guiInfo.mpcontext);
c3f95506f756 Fix bug with switching audio and video tracks.
ib
parents: 34458
diff changeset
152 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
153
34333
e8e4e6f9b7ac Change prefix for internal events from ev to iv.
ib
parents: 34329
diff changeset
154 case ivSetSubtitle:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
155 mp_property_do("sub",M_PROPERTY_SET,&iparam,guiInfo.mpcontext);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
156 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
157
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
158 #ifdef CONFIG_CDDA
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
159 case ivSetCDTrack:
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
160 guiInfo.Track=iparam;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
161 case evPlayCD:
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
162 guiInfo.StreamType=STREAMTYPE_CDDA;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
163 goto play;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
164 #endif
27370
14c5017f40d2 Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents: 27341
diff changeset
165 #ifdef CONFIG_VCD
34333
e8e4e6f9b7ac Change prefix for internal events from ev to iv.
ib
parents: 34329
diff changeset
166 case ivSetVCDTrack:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
167 guiInfo.Track=iparam;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
168 case evPlayVCD:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
169 guiInfo.StreamType=STREAMTYPE_VCD;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
170 goto play;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
171 #endif
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26458
diff changeset
172 #ifdef CONFIG_DVDREAD
34417
1745c2a7a628 Move some DVD related events.
ib
parents: 34416
diff changeset
173 case ivSetDVDSubtitle:
1745c2a7a628 Move some DVD related events.
ib
parents: 34416
diff changeset
174 dvdsub_id=iparam;
34455
00cf27b14c15 Replace goto label by an internal event case expression.
ib
parents: 34454
diff changeset
175 uiEventHandling( ivPlayDVD, 0 );
34417
1745c2a7a628 Move some DVD related events.
ib
parents: 34416
diff changeset
176 break;
1745c2a7a628 Move some DVD related events.
ib
parents: 34416
diff changeset
177 case ivSetDVDAudio:
1745c2a7a628 Move some DVD related events.
ib
parents: 34416
diff changeset
178 audio_id=iparam;
34455
00cf27b14c15 Replace goto label by an internal event case expression.
ib
parents: 34454
diff changeset
179 uiEventHandling( ivPlayDVD, 0 );
34417
1745c2a7a628 Move some DVD related events.
ib
parents: 34416
diff changeset
180 break;
1745c2a7a628 Move some DVD related events.
ib
parents: 34416
diff changeset
181 case ivSetDVDChapter:
1745c2a7a628 Move some DVD related events.
ib
parents: 34416
diff changeset
182 guiInfo.Chapter=iparam;
34455
00cf27b14c15 Replace goto label by an internal event case expression.
ib
parents: 34454
diff changeset
183 uiEventHandling( ivPlayDVD, 0 );
34417
1745c2a7a628 Move some DVD related events.
ib
parents: 34416
diff changeset
184 break;
1745c2a7a628 Move some DVD related events.
ib
parents: 34416
diff changeset
185 case ivSetDVDTitle:
1745c2a7a628 Move some DVD related events.
ib
parents: 34416
diff changeset
186 guiInfo.Track=iparam;
1745c2a7a628 Move some DVD related events.
ib
parents: 34416
diff changeset
187 guiInfo.Chapter=1;
1745c2a7a628 Move some DVD related events.
ib
parents: 34416
diff changeset
188 guiInfo.Angle=1;
34455
00cf27b14c15 Replace goto label by an internal event case expression.
ib
parents: 34454
diff changeset
189 uiEventHandling( ivPlayDVD, 0 );
34417
1745c2a7a628 Move some DVD related events.
ib
parents: 34416
diff changeset
190 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
191 case evPlayDVD:
33876
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
192 guiInfo.Chapter=1;
4789b8eed97e Get rid of a bunch of needless or redundant guiInfo members.
ib
parents: 33874
diff changeset
193 guiInfo.Angle=1;
34455
00cf27b14c15 Replace goto label by an internal event case expression.
ib
parents: 34454
diff changeset
194 case ivPlayDVD:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
195 guiInfo.StreamType=STREAMTYPE_DVD;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
196 goto play;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
197 #endif
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
198 case evPlay:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
199 case evPlaySwitchToPause:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
200 play:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
201
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
202 if ( ( msg == evPlaySwitchToPause )&&( guiInfo.Playing == GUI_PAUSE ) ) goto NoPause;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
203
35490
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
204 MediumPrepare( guiInfo.StreamType );
a5f5f61a7a35 Replace confusing guiInfoMediumClear() by MediumPrepare().
ib
parents: 35484
diff changeset
205
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
206 switch ( guiInfo.StreamType )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
207 {
34077
deff81b57903 Cosmetic: Order STREAMTYPE related code.
ib
parents: 34067
diff changeset
208 case STREAMTYPE_FILE:
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
209 case STREAMTYPE_STREAM:
34859
203d0d5cac1f Add playlist support to the GUI.
ib
parents: 34699
diff changeset
210 case STREAMTYPE_PLAYLIST:
33898
67790ce1185e Provide track information for playlists.
ib
parents: 33897
diff changeset
211 if ( !guiInfo.Track )
67790ce1185e Provide track information for playlists.
ib
parents: 33897
diff changeset
212 guiInfo.Track=1;
33890
c51e44dd38e2 Remove needless guiInfo member DiskChanged.
ib
parents: 33876
diff changeset
213 guiInfo.NewPlay=GUI_FILE_NEW;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
214 break;
34454
5a45efc630b8 Remove all unnecessary #ifdefs from GUI code.
ib
parents: 34417
diff changeset
215
34387
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
216 case STREAMTYPE_CDDA:
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
217 if ( guiInfo.Playing != GUI_PAUSE )
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
218 {
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
219 if ( !guiInfo.Track )
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
220 guiInfo.Track=1;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
221 guiInfo.NewPlay=GUI_FILE_SAME;
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
222 }
0ba85cad4c7e Add audio CD playback support to the X11/GTK GUI.
ib
parents: 34333
diff changeset
223 break;
34454
5a45efc630b8 Remove all unnecessary #ifdefs from GUI code.
ib
parents: 34417
diff changeset
224
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
225 case STREAMTYPE_VCD:
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
226 if ( guiInfo.Playing != GUI_PAUSE )
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 ( !guiInfo.Track )
33874
e1bec41397bb Don't let VCD track number and guiInfo.Track differ.
ib
parents: 33773
diff changeset
229 guiInfo.Track=2;
33890
c51e44dd38e2 Remove needless guiInfo member DiskChanged.
ib
parents: 33876
diff changeset
230 guiInfo.NewPlay=GUI_FILE_SAME;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
231 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
232 break;
34454
5a45efc630b8 Remove all unnecessary #ifdefs from GUI code.
ib
parents: 34417
diff changeset
233
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
234 case STREAMTYPE_DVD:
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
235 if ( guiInfo.Playing != GUI_PAUSE )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
236 {
35422
696a8a165952 Check and set track for DVDs just as for the other StreamTypes.
ib
parents: 35389
diff changeset
237 if ( !guiInfo.Track )
696a8a165952 Check and set track for DVDs just as for the other StreamTypes.
ib
parents: 35389
diff changeset
238 guiInfo.Track=1;
33890
c51e44dd38e2 Remove needless guiInfo member DiskChanged.
ib
parents: 33876
diff changeset
239 guiInfo.NewPlay=GUI_FILE_SAME;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
240 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
241 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
242 }
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
243 uiPlay();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
244 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
245
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
246 case evPause:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
247 case evPauseSwitchToPlay:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
248 NoPause:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
249 uiPause();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
250 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
251
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
252 case evStop:
33614
79743a5cf4f0 Rename the symbolic playback state constants.
ib
parents: 33556
diff changeset
253 guiInfo.Playing=GUI_STOP;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
254 uiState();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
255 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
256
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
257 case evLoadPlay:
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35490
diff changeset
258 uiMainAutoPlay=True;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
259 // guiInfo.StreamType=STREAMTYPE_FILE;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
260 case evLoad:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
261 gtkShow( evLoad,NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
262 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
263 case evLoadSubtitle: gtkShow( evLoadSubtitle,NULL ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
264 case evDropSubtitle:
33897
e0d211c62cf7 Cosmetic: Rename some guiInfo members.
ib
parents: 33890
diff changeset
265 nfree( guiInfo.SubtitleFilename );
33763
03824cf8728d Cosmetic: Rename two functions that do MPlayer calls.
ib
parents: 33743
diff changeset
266 mplayerLoadSubtitle( NULL );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
267 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
268 case evLoadAudioFile: gtkShow( evLoadAudioFile,NULL ); break;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
269 case evPrev: uiPrev(); break;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
270 case evNext: uiNext(); break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
271
34321
daebf766dea6 Cosmetic: Synchronize evPlaylist event and message names.
ib
parents: 34174
diff changeset
272 case evPlaylist: gtkShow( evPlaylist,NULL ); break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
273 case evSkinBrowser: gtkShow( evSkinBrowser,skinName ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
274 case evAbout: gtkShow( evAbout,NULL ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
275 case evPreferences: gtkShow( evPreferences,NULL ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
276 case evEqualizer: gtkShow( evEqualizer,NULL ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
277
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
278 case evForward10min: uiRelSeek( 600 ); break;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
279 case evBackward10min: uiRelSeek( -600 );break;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
280 case evForward1min: uiRelSeek( 60 ); break;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
281 case evBackward1min: uiRelSeek( -60 ); break;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
282 case evForward10sec: uiRelSeek( 10 ); break;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
283 case evBackward10sec: uiRelSeek( -10 ); break;
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
284 case evSetMoviePosition: uiAbsSeek( param ); break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
285
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
286 case evIncVolume: vo_x11_putkey( wsGrayMul ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
287 case evDecVolume: vo_x11_putkey( wsGrayDiv ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
288 case evMute: mixer_mute( mixer ); break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
289
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
290 case evSetVolume:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
291 guiInfo.Volume=param;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
292 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
293 float l = guiInfo.Volume * ( ( 100.0 - guiInfo.Balance ) / 50.0 );
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
294 float r = guiInfo.Volume * ( ( guiInfo.Balance ) / 50.0 );
35545
d83d2bd5f365 Use FFMIN in evSetVolume.
ib
parents: 35544
diff changeset
295 mixer_setvolume( mixer,FFMIN(l,guiInfo.Volume),FFMIN(r,guiInfo.Volume) );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
296 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
297 if ( osd_level )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
298 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
299 osd_visible=(GetTimerMS() + 1000) | 1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
300 vo_osd_progbar_type=OSD_VOLUME;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
301 vo_osd_progbar_value=( ( guiInfo.Volume ) * 256.0 ) / 100.0;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
302 vo_osd_changed( OSDTYPE_PROGBAR );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
303 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
304 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
305
35539
9bc02a829c48 Fix bug with evSetBalance.
ib
parents: 35529
diff changeset
306 case evSetBalance:
9bc02a829c48 Fix bug with evSetBalance.
ib
parents: 35529
diff changeset
307 guiInfo.Balance=param;
35544
fd7a5b62326d Add comment.
ib
parents: 35543
diff changeset
308 mixer_setbalance( mixer,(guiInfo.Balance - 50.0 ) / 50.0 ); // transform 0..100 to -1..1
35543
5289e495e70e Set volume in evSetBalance.
ib
parents: 35539
diff changeset
309 osd = osd_level;
5289e495e70e Set volume in evSetBalance.
ib
parents: 35539
diff changeset
310 osd_level = 0;
5289e495e70e Set volume in evSetBalance.
ib
parents: 35539
diff changeset
311 uiEventHandling(evSetVolume, guiInfo.Volume);
5289e495e70e Set volume in evSetBalance.
ib
parents: 35539
diff changeset
312 osd_level = osd;
35539
9bc02a829c48 Fix bug with evSetBalance.
ib
parents: 35529
diff changeset
313 if ( osd_level )
9bc02a829c48 Fix bug with evSetBalance.
ib
parents: 35529
diff changeset
314 {
9bc02a829c48 Fix bug with evSetBalance.
ib
parents: 35529
diff changeset
315 osd_visible=(GetTimerMS() + 1000) | 1;
9bc02a829c48 Fix bug with evSetBalance.
ib
parents: 35529
diff changeset
316 vo_osd_progbar_type=OSD_BALANCE;
9bc02a829c48 Fix bug with evSetBalance.
ib
parents: 35529
diff changeset
317 vo_osd_progbar_value=( ( guiInfo.Balance ) * 256.0 ) / 100.0;
9bc02a829c48 Fix bug with evSetBalance.
ib
parents: 35529
diff changeset
318 vo_osd_changed( OSDTYPE_PROGBAR );
9bc02a829c48 Fix bug with evSetBalance.
ib
parents: 35529
diff changeset
319 }
9bc02a829c48 Fix bug with evSetBalance.
ib
parents: 35529
diff changeset
320 break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
321
34458
1e84148527ab Add user event evMenu.
ib
parents: 34456
diff changeset
322 case evMenu:
34473
2f88fa3b9e5e Cosmetic: Revise comment.
ib
parents: 34472
diff changeset
323 /*if (guiApp.menuIsPresent) NOTE TO MYSELF: Uncomment only after mouse
2f88fa3b9e5e Cosmetic: Revise comment.
ib
parents: 34472
diff changeset
324 { pointer and cursor keys work
2f88fa3b9e5e Cosmetic: Revise comment.
ib
parents: 34472
diff changeset
325 gtkShow( ivHidePopUpMenu,NULL ); with this menu from skin as
2f88fa3b9e5e Cosmetic: Revise comment.
ib
parents: 34472
diff changeset
326 uiShowMenu( 0,0 ); they do with normal menus.
34458
1e84148527ab Add user event evMenu.
ib
parents: 34456
diff changeset
327 }
1e84148527ab Add user event evMenu.
ib
parents: 34456
diff changeset
328 else*/ gtkShow( ivShowPopUpMenu,NULL );
1e84148527ab Add user event evMenu.
ib
parents: 34456
diff changeset
329 break;
1e84148527ab Add user event evMenu.
ib
parents: 34456
diff changeset
330
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
331 case evIconify:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
332 switch ( iparam )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
333 {
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
334 case 0: wsWindowIconify( &guiApp.mainWindow ); break;
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
335 case 1: wsWindowIconify( &guiApp.videoWindow ); break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
336 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
337 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
338 case evHalfSize:
33947
3867c67b35a3 Modify video window size change behavior.
ib
parents: 33945
diff changeset
339 if ( guiInfo.VideoWindow && guiInfo.Playing )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
340 {
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
341 if ( guiApp.videoWindow.isFullScreen )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
342 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
343 uiFullScreen();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
344 }
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
345 wsWindowResize( &guiApp.videoWindow, guiInfo.VideoWidth / 2, guiInfo.VideoHeight / 2 );
33950
bb35e74851cd Cosmetic: Adjust indent.
ib
parents: 33949
diff changeset
346 btnSet( evFullScreen,btnReleased );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
347 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
348 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
349 case evDoubleSize:
33947
3867c67b35a3 Modify video window size change behavior.
ib
parents: 33945
diff changeset
350 if ( guiInfo.VideoWindow && guiInfo.Playing )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
351 {
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
352 if ( guiApp.videoWindow.isFullScreen )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
353 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
354 uiFullScreen();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
355 }
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
356 wsWindowResize( &guiApp.videoWindow, guiInfo.VideoWidth * 2, guiInfo.VideoHeight * 2 );
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
357 wsWindowMoveWithin( &guiApp.videoWindow, False, guiApp.video.x, guiApp.video.y );
33950
bb35e74851cd Cosmetic: Adjust indent.
ib
parents: 33949
diff changeset
358 btnSet( evFullScreen,btnReleased );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
359 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
360 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
361 case evNormalSize:
33947
3867c67b35a3 Modify video window size change behavior.
ib
parents: 33945
diff changeset
362 if ( guiInfo.VideoWindow && guiInfo.Playing )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
363 {
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
364 if ( guiApp.videoWindow.isFullScreen )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
365 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
366 uiFullScreen();
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
367 }
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
368 wsWindowResize( &guiApp.videoWindow, guiInfo.VideoWidth, guiInfo.VideoHeight );
33947
3867c67b35a3 Modify video window size change behavior.
ib
parents: 33945
diff changeset
369 btnSet( evFullScreen,btnReleased );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
370 break;
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
371 } else if ( !guiApp.videoWindow.isFullScreen ) break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
372 case evFullScreen:
35611
a4741058bb40 Reset video window after STOP (MP command or evStop) has been pressed.
ib
parents: 35605
diff changeset
373 if ( guiInfo.VideoWindow && ( guiInfo.Playing || !iparam ) )
33947
3867c67b35a3 Modify video window size change behavior.
ib
parents: 33945
diff changeset
374 {
33950
bb35e74851cd Cosmetic: Adjust indent.
ib
parents: 33949
diff changeset
375 uiFullScreen();
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
376 if ( !guiApp.videoWindow.isFullScreen )
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
377 wsWindowResize( &guiApp.videoWindow, iparam ? guiInfo.VideoWidth : guiApp.video.width, iparam ? guiInfo.VideoHeight : guiApp.video.height );
33947
3867c67b35a3 Modify video window size change behavior.
ib
parents: 33945
diff changeset
378 }
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
379 if ( guiApp.videoWindow.isFullScreen ) btnSet( evFullScreen,btnPressed );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
380 else btnSet( evFullScreen,btnReleased );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
381 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
382
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
383 case evSetAspect:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
384 switch ( iparam )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
385 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
386 case 2: movie_aspect=16.0f / 9.0f; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
387 case 3: movie_aspect=4.0f / 3.0f; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
388 case 4: movie_aspect=2.35; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
389 case 1:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
390 default: movie_aspect=-1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
391 }
34456
d04da1858866 Fix bug with VCD stream calling DVD code.
ib
parents: 34455
diff changeset
392 if ( guiInfo.StreamType == STREAMTYPE_VCD ) uiEventHandling( evPlayVCD, 0 );
d04da1858866 Fix bug with VCD stream calling DVD code.
ib
parents: 34455
diff changeset
393 else if ( guiInfo.StreamType == STREAMTYPE_DVD ) uiEventHandling( ivPlayDVD, 0 );
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
394 else
33890
c51e44dd38e2 Remove needless guiInfo member DiskChanged.
ib
parents: 33876
diff changeset
395 guiInfo.NewPlay=GUI_FILE_NEW;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
396 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
397
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34681
diff changeset
398 /* timer events */
34333
e8e4e6f9b7ac Change prefix for internal events from ev to iv.
ib
parents: 34329
diff changeset
399 case ivRedraw:
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
400 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
401 unsigned now = GetTimerMS();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
402 if ((now > last_redraw_time) &&
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
403 (now < last_redraw_time + GUI_REDRAW_WAIT) &&
34035
5daa51a194ed Force redraw of main window after playback has ended.
ib
parents: 33998
diff changeset
404 !uiPlaybarFade && (iparam == 0))
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
405 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
406 last_redraw_time = now;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
407 }
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35490
diff changeset
408 uiMainRender=True;
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
409 wsWindowRedraw( &guiApp.mainWindow );
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
410 wsWindowRedraw( &guiApp.playbarWindow );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
411 break;
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34681
diff changeset
412 /* system events */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
413 case evNone:
34416
b3837500181a Remove #ifdef MP_DEBUG.
ib
parents: 34403
diff changeset
414 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] uiEventHandling: evNone\n" );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
415 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
416 default:
34416
b3837500181a Remove #ifdef MP_DEBUG.
ib
parents: 34403
diff changeset
417 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] uiEventHandling: unknown event %d, param %.2f\n", msg, param );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
418 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
419 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
420 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
421
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
422 void uiMainMouseHandle( int Button,int X,int Y,int RX,int RY )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
423 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
424 static int itemtype = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
425 int i;
35688
6fd886ce32b9 Cosmetic: Rename wItem guiItem.
ib
parents: 35681
diff changeset
426 guiItem * item = NULL;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
427 float value = 0.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
428
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
429 static int SelectedItem = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
430 int currentselected = -1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
431
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
432 for ( i=0;i <= guiApp.IndexOfMainItems;i++ )
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
433 if ( ( guiApp.mainItems[i].pressed != btnDisabled )&&
35675
9e2183017f1f Move wgIsRect from ws.h to gui.h.
ib
parents: 35671
diff changeset
434 ( isInside( X,Y,guiApp.mainItems[i].x,guiApp.mainItems[i].y,guiApp.mainItems[i].x+guiApp.mainItems[i].width,guiApp.mainItems[i].y+guiApp.mainItems[i].height ) ) )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
435 { currentselected=i; break; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
436
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
437 switch ( Button )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
438 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
439 case wsPMMouseButton:
34333
e8e4e6f9b7ac Change prefix for internal events from ev to iv.
ib
parents: 34329
diff changeset
440 gtkShow( ivHidePopUpMenu,NULL );
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
441 uiShowMenu( RX,RY );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
442 itemtype=itPRMButton;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
443 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
444 case wsRMMouseButton:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
445 uiHideMenu( RX,RY,0 );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
446 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
447
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
448 case wsPLMouseButton:
34333
e8e4e6f9b7ac Change prefix for internal events from ev to iv.
ib
parents: 34329
diff changeset
449 gtkShow( ivHidePopUpMenu,NULL );
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35490
diff changeset
450 sx=X; sy=Y; boxMoved=True; itemtype=itPLMButton;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
451 SelectedItem=currentselected;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
452 if ( SelectedItem == -1 ) break;
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35490
diff changeset
453 boxMoved=False;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
454 item=&guiApp.mainItems[SelectedItem];
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
455 itemtype=item->type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
456 item->pressed=btnPressed;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
457 switch( item->type )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
458 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
459 case itButton:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
460 if ( ( SelectedItem > -1 ) &&
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32896
diff changeset
461 ( ( ( item->message == evPlaySwitchToPause && item->message == evPauseSwitchToPlay ) ) ||
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32896
diff changeset
462 ( ( item->message == evPauseSwitchToPlay && item->message == evPlaySwitchToPause ) ) ) )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
463 { item->pressed=btnDisabled; }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
464 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
465 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
466 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
467 case wsRLMouseButton:
35493
411875efca3f Introduce boolean symbolic constants.
ib
parents: 35490
diff changeset
468 boxMoved=False;
33107
eda3df3e4a9d Prevent an out-of-bounds array access.
ib
parents: 33002
diff changeset
469 if ( SelectedItem != -1 ) // NOTE TO MYSELF: only if itButton, itHPotmeter or itVPotmeter
eda3df3e4a9d Prevent an out-of-bounds array access.
ib
parents: 33002
diff changeset
470 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
471 item=&guiApp.mainItems[SelectedItem];
33108
5450a92ac4bd Cosmetic: Adjust indent.
ib
parents: 33107
diff changeset
472 item->pressed=btnReleased;
33107
eda3df3e4a9d Prevent an out-of-bounds array access.
ib
parents: 33002
diff changeset
473 }
35351
92f6fc87ddc8 Fix segmentation fault with mouse button release.
ib
parents: 35349
diff changeset
474 if ( currentselected == - 1 || SelectedItem == -1 ) { itemtype=0; break; }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
475 SelectedItem=-1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
476 value=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
477 switch( itemtype )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
478 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
479 case itPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
480 case itHPotmeter:
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32896
diff changeset
481 btnModify( item->message,(float)( X - item->x ) / item->width * 100.0f );
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
482 uiEventHandling( item->message,item->value );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
483 value=item->value;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
484 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
485 case itVPotmeter:
32911
e06fbdd8eb46 Clean up the wItem structure.
ib
parents: 32896
diff changeset
486 btnModify( item->message, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f );
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
487 uiEventHandling( item->message,item->value );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
488 value=item->value;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
489 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
490 }
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
491 uiEventHandling( item->message,value );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
492 itemtype=0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
493 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
494
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
495 case wsRRMouseButton:
34333
e8e4e6f9b7ac Change prefix for internal events from ev to iv.
ib
parents: 34329
diff changeset
496 gtkShow( ivShowPopUpMenu,NULL );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
497 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
498
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34681
diff changeset
499 /* rolled mouse ... de szar :))) */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
500 case wsP5MouseButton: value=-2.5f; goto rollerhandled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
501 case wsP4MouseButton: value= 2.5f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
502 rollerhandled:
35365
fb054f36c3a9 Prevent negative array index read.
ib
parents: 35357
diff changeset
503 if (currentselected != - 1)
fb054f36c3a9 Prevent negative array index read.
ib
parents: 35357
diff changeset
504 {
35366
92cafcf6f6b2 Cosmetic: Adjust indent.
ib
parents: 35365
diff changeset
505 item=&guiApp.mainItems[currentselected];
92cafcf6f6b2 Cosmetic: Adjust indent.
ib
parents: 35365
diff changeset
506 if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) )
92cafcf6f6b2 Cosmetic: Adjust indent.
ib
parents: 35365
diff changeset
507 {
92cafcf6f6b2 Cosmetic: Adjust indent.
ib
parents: 35365
diff changeset
508 item->value+=value;
92cafcf6f6b2 Cosmetic: Adjust indent.
ib
parents: 35365
diff changeset
509 btnModify( item->message,item->value );
92cafcf6f6b2 Cosmetic: Adjust indent.
ib
parents: 35365
diff changeset
510 uiEventHandling( item->message,item->value );
92cafcf6f6b2 Cosmetic: Adjust indent.
ib
parents: 35365
diff changeset
511 }
35365
fb054f36c3a9 Prevent negative array index read.
ib
parents: 35357
diff changeset
512 }
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
513 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
514
34684
b03481253518 Cosmetic: Prefer C style for single line comments.
ib
parents: 34681
diff changeset
515 /* moving */
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
516 case wsMoveMouse:
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
517 item=&guiApp.mainItems[SelectedItem];
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
518 switch ( itemtype )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
519 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
520 case itPLMButton:
35681
80c5c89f77d6 Cosmetic: Rename ws functions for the sake of consistency.
ib
parents: 35675
diff changeset
521 wsWindowMove( &guiApp.mainWindow,True,RX - abs( sx ),RY - abs( sy ) );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
522 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
523 case itPRMButton:
34472
f866092d51cd Remove unused parameter from uiMenuMouseHandle().
ib
parents: 34469
diff changeset
524 uiMenuMouseHandle( RX,RY );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
525 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
526 case itPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
527 item->value=(float)( X - item->x ) / item->width * 100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
528 goto potihandled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
529 case itVPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
530 item->value=(1. - (float)( Y - item->y ) / item->height) * 100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
531 goto potihandled;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
532 case itHPotmeter:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
533 item->value=(float)( X - item->x ) / item->width * 100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
534 potihandled:
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
535 if ( item->value > 100.0f ) item->value=100.0f;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
536 if ( item->value < 0.0f ) item->value=0.0f;
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
537 uiEventHandling( item->message,item->value );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
538 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
539 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
540 break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
541 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
542 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
543
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
544 void uiMainKeyHandle( int KeyCode,int Type,int Key )
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
545 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
546 int msg = evNone;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
547
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
548 if ( Type != wsKeyPressed ) return;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
549
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
550 if ( !Key )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
551 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
552 switch ( KeyCode )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
553 {
33524
7d5fd12b86e7 Add note on wsXFMM key definitions.
ib
parents: 33263
diff changeset
554 // NOTE TO MYSELF: This is only for the Acer AirKey V keyboard.
33536
fc1402410163 Remove support for Acer AirKey V keyboard multimedia keys.
ib
parents: 33535
diff changeset
555 /*case wsXFMMPrev: msg=evPrev; break;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
556 case wsXFMMStop: msg=evStop; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
557 case wsXFMMPlay: msg=evPlaySwitchToPause; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
558 case wsXFMMNext: msg=evNext; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
559 case wsXFMMVolUp: msg=evIncVolume; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
560 case wsXFMMVolDown: msg=evDecVolume; break;
33536
fc1402410163 Remove support for Acer AirKey V keyboard multimedia keys.
ib
parents: 33535
diff changeset
561 case wsXFMMMute: msg=evMute; break;*/
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
562 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
563 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
564 else
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
565 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
566 switch ( Key )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
567 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
568 case wsEnter: msg=evPlay; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
569 case wsXF86LowerVolume: msg=evDecVolume; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
570 case wsXF86RaiseVolume: msg=evIncVolume; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
571 case wsXF86Mute: msg=evMute; break;
33525
b32fcc18c9b4 Add support for multimedia pause key.
ib
parents: 33524
diff changeset
572 case wsXF86Pause:
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
573 case wsXF86Play: msg=evPlaySwitchToPause; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
574 case wsXF86Stop: msg=evStop; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
575 case wsXF86Prev: msg=evPrev; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
576 case wsXF86Next: msg=evNext; break;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
577 case wsXF86Media: msg=evLoad; break;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
578 case wsEscape:
34697
ac6b38cd0d45 Rename sub window video window.
ib
parents: 34684
diff changeset
579 if ( guiInfo.VideoWindow && guiInfo.Playing && guiApp.videoWindow.isFullScreen )
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
580 {
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
581 uiEventHandling( evNormalSize,0 );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
582 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
583 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
584 default: vo_x11_putkey( Key ); return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
585 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
586 }
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
587 if ( msg != evNone ) uiEventHandling( msg,0 );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
588 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
589
35759
afb55738b1b7 Cosmetic: Replace DandD by DND.
ib
parents: 35758
diff changeset
590 /* this will be used to handle drag & drop files */
afb55738b1b7 Cosmetic: Replace DandD by DND.
ib
parents: 35758
diff changeset
591 void uiDNDHandler(int num,char** files)
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
592 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
593 struct stat buf;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
594 int f = 0;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
595
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
596 char* subtitles = NULL;
35521
baf53d200292 Avoid using local variables named filename.
ib
parents: 35496
diff changeset
597 char* file = NULL;
35384
9c7bba653bfb Avoid a duplicate strrchr() call.
ib
parents: 35377
diff changeset
598 char* s;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
599
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
600 if (num <= 0)
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
601 return;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
602
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
603
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
604 /* now fill it with new items */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
605 for(f=0; f < num; f++){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
606 char* str = strdup( files[f] );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
607 plItem* item;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
608
24086
f5b32d12b691 remove gconvert_uri_to_filename() and use url_unescape_string() instead.
iive
parents: 23457
diff changeset
609 url_unescape_string(str, files[f]);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
610
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
611 if(stat(str,&buf) == 0 && S_ISDIR(buf.st_mode) == 0) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
612 /* this is not a directory so try to play it */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
613 mp_msg( MSGT_GPLAYER,MSGL_V,"Received D&D %s\n",str );
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
614
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
615 /* check if it is a subtitle file */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
616 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
617 char* ext = strrchr(str,'.');
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
618 if (ext) {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
619 static char supported[] = "utf/sub/srt/smi/rt//txt/ssa/aqt/";
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
620 char* type;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
621 int len;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
622 if((len=strlen(++ext)) && (type=strstr(supported,ext)) &&\
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
623 (type-supported)%4 == 0 && *(type+len) == '/'){
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
624 /* handle subtitle file */
33739
9f6d46d325de Remove gfree() from interface.c.
ib
parents: 33738
diff changeset
625 nfree(subtitles);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
626 subtitles = str;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
627 continue;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
628 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
629 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
630 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
631
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
632 /* clear playlist */
35521
baf53d200292 Avoid using local variables named filename.
ib
parents: 35496
diff changeset
633 if (file == NULL) {
baf53d200292 Avoid using local variables named filename.
ib
parents: 35496
diff changeset
634 file = files[f];
34663
73a5ecb53ee2 Replace symbolic constants by enums.
ib
parents: 34610
diff changeset
635 listMgr(PLAYLIST_DELETE,0);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
636 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
637
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
638 item = calloc(1,sizeof(plItem));
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28051
diff changeset
639
35384
9c7bba653bfb Avoid a duplicate strrchr() call.
ib
parents: 35377
diff changeset
640 s = strrchr( str,'/' );
9c7bba653bfb Avoid a duplicate strrchr() call.
ib
parents: 35377
diff changeset
641
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
642 /* FIXME: decompose file name ? */
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
643 /* yes -- Pontscho */
35384
9c7bba653bfb Avoid a duplicate strrchr() call.
ib
parents: 35377
diff changeset
644 if ( s ) {
9c7bba653bfb Avoid a duplicate strrchr() call.
ib
parents: 35377
diff changeset
645 *s=0; s++;
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
646 item->name = gstrdup( s );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
647 item->path = gstrdup( str );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
648 } else {
35385
8b8534de8b83 A non-existing path shouldn't be an empty string.
ib
parents: 35384
diff changeset
649 // NOTE TO MYSELF: this shouldn't happen, make sure we have a full path
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
650 item->name = strdup(str);
35385
8b8534de8b83 A non-existing path shouldn't be an empty string.
ib
parents: 35384
diff changeset
651 item->path = strdup(".");
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
652 }
34681
42fa91951bd2 Rename PLAYLIST_ITEM_ADD PLAYLIST_ITEM_APPEND.
ib
parents: 34669
diff changeset
653 listMgr(PLAYLIST_ITEM_APPEND,item);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
654 } else {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
655 mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_NotAFile,str );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
656 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
657 free( str );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
658 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
659
35521
baf53d200292 Avoid using local variables named filename.
ib
parents: 35496
diff changeset
660 if (file) {
baf53d200292 Avoid using local variables named filename.
ib
parents: 35496
diff changeset
661 uiSetFile( NULL,file,STREAMTYPE_FILE );
33615
1f9a31d4f114 Replace all playback integer constants by their symbolic constants.
ib
parents: 33614
diff changeset
662 if ( guiInfo.Playing == GUI_PLAY ) uiEventHandling( evStop,0 );
33555
c5a19bbeac2b Cosmetic: Rename some GUI variables and functions.
ib
parents: 33548
diff changeset
663 uiEventHandling( evPlay,0 );
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
664 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
665 if (subtitles) {
33897
e0d211c62cf7 Cosmetic: Rename some guiInfo members.
ib
parents: 33890
diff changeset
666 nfree(guiInfo.SubtitleFilename);
e0d211c62cf7 Cosmetic: Rename some guiInfo members.
ib
parents: 33890
diff changeset
667 guiInfo.SubtitleFilename = subtitles;
e0d211c62cf7 Cosmetic: Rename some guiInfo members.
ib
parents: 33890
diff changeset
668 mplayerLoadSubtitle(guiInfo.SubtitleFilename);
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
669 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
670 }