27
27
#include "config.h"
28
28
#include "gmplayer.h"
29
29
#include "gui/app.h"
30
#include "gui/interface.h"
30
31
#include "gui/skin/font.h"
31
32
#include "gui/skin/skin.h"
33
#include "gui/util/list.h"
34
#include "gui/util/mem.h"
35
#include "gui/util/string.h"
32
36
#include "gui/wm/ws.h"
34
38
#include "help_mp.h"
35
40
#include "libvo/x11_common.h"
36
41
#include "libvo/fastmemcpy.h"
37
42
#include "libvo/wskeys.h"
106
142
// --- user events
108
guiExit( EXIT_QUIT );
144
mplayer( MPLAYER_EXIT_GUI, EXIT_QUIT, 0 );
112
gfree( (void **)&guiInfo.Subtitlename );
113
gfree( (void **)&guiInfo.AudioFile );
114
guiInfo.StreamType=STREAMTYPE_STREAM;
117
gtkShow( evPlayNetwork,NULL );
148
gtkShow( evLoadURL,NULL );
121
if ( !guiInfo.demuxer || audio_id == iparam ) break;
152
if ( !mpctx_get_demuxer(guiInfo.mpcontext) || audio_id == iparam ) break;
126
if ( !guiInfo.demuxer || video_id == iparam ) break;
157
if ( !mpctx_get_demuxer(guiInfo.mpcontext) || video_id == iparam ) break;
131
162
mp_property_do("sub",M_PROPERTY_SET,&iparam,guiInfo.mpcontext);
167
guiInfo.Track=iparam;
169
guiInfoMediumClear ( CLEAR_ALL );
170
guiInfo.StreamType=STREAMTYPE_CDDA;
134
173
#ifdef CONFIG_VCD
136
175
guiInfo.Track=iparam;
138
gtkSet( gtkClearStruct,0,(void *)guiALL );
177
guiInfoMediumClear ( CLEAR_ALL );
139
178
guiInfo.StreamType=STREAMTYPE_VCD;
142
181
#ifdef CONFIG_DVDREAD
182
case ivSetDVDSubtitle:
190
case ivSetDVDChapter:
191
guiInfo.Chapter=iparam;
195
guiInfo.Track=iparam;
144
guiInfo.DVD.current_title=1;
145
guiInfo.DVD.current_chapter=1;
146
guiInfo.DVD.current_angle=1;
148
gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD) );
205
guiInfoMediumClear( CLEAR_ALL - CLEAR_DVD );
149
206
guiInfo.StreamType=STREAMTYPE_DVD;
156
213
if ( ( msg == evPlaySwitchToPause )&&( guiInfo.Playing == GUI_PAUSE ) ) goto NoPause;
158
if ( gtkSet( gtkGetCurrPlItem,0,NULL ) &&( guiInfo.StreamType == STREAMTYPE_FILE ) )
215
if ( listSet( gtkGetCurrPlItem,NULL ) &&( guiInfo.StreamType == STREAMTYPE_FILE ) )
160
plItem * next = gtkSet( gtkGetCurrPlItem,0,NULL );
217
plItem * next = listSet( gtkGetCurrPlItem,NULL );
161
218
plLastPlayed=next;
162
uiSetFileName( next->path,next->name,STREAMTYPE_FILE );
219
uiSetFileName( next->path,next->name,SAME_STREAMTYPE );
165
222
switch ( guiInfo.StreamType )
224
case STREAMTYPE_FILE:
167
225
case STREAMTYPE_STREAM:
168
case STREAMTYPE_FILE:
169
gtkSet( gtkClearStruct,0,(void *)(guiALL - guiFilenames) );
226
guiInfoMediumClear( CLEAR_ALL - CLEAR_FILE );
227
if ( !guiInfo.Track )
229
guiInfo.NewPlay=GUI_FILE_NEW;
232
case STREAMTYPE_CDDA:
233
guiInfoMediumClear( CLEAR_ALL - CLEAR_VCD - CLEAR_FILE );
234
if ( guiInfo.Playing != GUI_PAUSE )
236
if ( !guiInfo.Track )
238
guiInfo.NewPlay=GUI_FILE_SAME;
171
242
#ifdef CONFIG_VCD
172
243
case STREAMTYPE_VCD:
173
gtkSet( gtkClearStruct,0,(void *)(guiALL - guiVCD - guiFilenames) );
174
if ( !cdrom_device ) cdrom_device=gstrdup( DEFAULT_CDROM_DEVICE );
175
uiSetFileName( NULL,cdrom_device,STREAMTYPE_VCD );
244
guiInfoMediumClear( CLEAR_ALL - CLEAR_VCD - CLEAR_FILE );
176
245
if ( guiInfo.Playing != GUI_PAUSE )
178
247
if ( !guiInfo.Track )
180
guiInfo.DiskChanged=1;
249
guiInfo.NewPlay=GUI_FILE_SAME;
184
253
#ifdef CONFIG_DVDREAD
185
254
case STREAMTYPE_DVD:
186
gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD - guiFilenames) );
187
if ( !dvd_device ) dvd_device=gstrdup( DEFAULT_DVD_DEVICE );
188
uiSetFileName( NULL,dvd_device,STREAMTYPE_DVD );
255
guiInfoMediumClear( CLEAR_ALL - CLEAR_DVD - CLEAR_FILE );
189
256
if ( guiInfo.Playing != GUI_PAUSE )
191
guiInfo.Title=guiInfo.DVD.current_title;
192
guiInfo.Chapter=guiInfo.DVD.current_chapter;
193
guiInfo.Angle=guiInfo.DVD.current_angle;
194
guiInfo.DiskChanged=1;
258
guiInfo.NewPlay=GUI_FILE_SAME;
202
#ifdef CONFIG_DVDREAD
203
case evSetDVDSubtitle:
211
case evSetDVDChapter:
212
guiInfo.DVD.current_chapter=iparam;
216
guiInfo.DVD.current_title=iparam;
217
guiInfo.DVD.current_chapter=1;
218
guiInfo.DVD.current_angle=1;
224
267
case evPauseSwitchToPlay:
230
273
guiInfo.Playing=GUI_STOP;
232
guiInfo.NoWindow=False;
236
278
uiMainAutoPlay=1;
237
279
// guiInfo.StreamType=STREAMTYPE_FILE;
239
gtkSet( gtkDelPl,0,NULL );
281
listSet( gtkDelPl,NULL );
240
282
gtkShow( evLoad,NULL );
242
284
case evLoadSubtitle: gtkShow( evLoadSubtitle,NULL ); break;
243
285
case evDropSubtitle:
244
gfree( (void **)&guiInfo.Subtitlename );
245
guiLoadSubtitle( NULL );
286
nfree( guiInfo.SubtitleFilename );
287
mplayerLoadSubtitle( NULL );
247
289
case evLoadAudioFile: gtkShow( evLoadAudioFile,NULL ); break;
248
290
case evPrev: uiPrev(); break;
249
291
case evNext: uiNext(); break;
251
case evPlayList: gtkShow( evPlayList,NULL ); break;
293
case evPlaylist: gtkShow( evPlaylist,NULL ); break;
252
294
case evSkinBrowser: gtkShow( evSkinBrowser,skinName ); break;
253
295
case evAbout: gtkShow( evAbout,NULL ); break;
254
296
case evPreferences: gtkShow( evPreferences,NULL ); break;
301
btnSet( evFullScreen,btnReleased );
302
if ( guiInfo.Playing )
343
if ( guiInfo.VideoWindow && guiInfo.Playing )
304
345
if ( guiApp.subWindow.isFullScreen )
308
wsResizeWindow( &guiApp.subWindow, guiInfo.MovieWidth / 2, guiInfo.MovieHeight / 2 );
309
wsMoveWindow( &guiApp.subWindow, 0,
310
( wsMaxX - guiInfo.MovieWidth/2 )/2 + wsOrgX,
311
( wsMaxY - guiInfo.MovieHeight/2 )/2 + wsOrgY );
349
wsResizeWindow( &guiApp.subWindow, guiInfo.VideoWidth / 2, guiInfo.VideoHeight / 2 );
350
wsMoveWindow( &guiApp.subWindow, False, guiApp.sub.x, guiApp.sub.y );
351
btnSet( evFullScreen,btnReleased );
314
354
case evDoubleSize:
315
btnSet( evFullScreen,btnReleased );
316
if ( guiInfo.Playing )
355
if ( guiInfo.VideoWindow && guiInfo.Playing )
318
357
if ( guiApp.subWindow.isFullScreen )
322
wsResizeWindow( &guiApp.subWindow, guiInfo.MovieWidth * 2, guiInfo.MovieHeight * 2 );
323
wsMoveWindow( &guiApp.subWindow, 0,
324
( wsMaxX - guiInfo.MovieWidth*2 )/2 + wsOrgX,
325
( wsMaxY - guiInfo.MovieHeight*2 )/2 + wsOrgY );
361
wsResizeWindow( &guiApp.subWindow, guiInfo.VideoWidth * 2, guiInfo.VideoHeight * 2 );
362
wsMoveWindowWithin( &guiApp.subWindow, False, guiApp.sub.x, guiApp.sub.y );
363
btnSet( evFullScreen,btnReleased );
328
366
case evNormalSize:
329
btnSet( evFullScreen,btnReleased );
330
if ( guiInfo.Playing )
367
if ( guiInfo.VideoWindow && guiInfo.Playing )
332
369
if ( guiApp.subWindow.isFullScreen )
336
wsResizeWindow( &guiApp.subWindow, guiInfo.MovieWidth, guiInfo.MovieHeight );
337
wsMoveWindow( &guiApp.subWindow, 0,
338
( wsMaxX - guiInfo.MovieWidth )/2 + wsOrgX,
339
( wsMaxY - guiInfo.MovieHeight )/2 + wsOrgY );
373
wsResizeWindow( &guiApp.subWindow, guiInfo.VideoWidth, guiInfo.VideoHeight );
374
wsMoveWindow( &guiApp.subWindow, False, guiApp.sub.x, guiApp.sub.y );
375
btnSet( evFullScreen,btnReleased );
341
377
} else if ( !guiApp.subWindow.isFullScreen ) break;
342
378
case evFullScreen:
343
if ( !guiInfo.Playing && !gtkShowVideoWindow ) break;
379
if ( guiInfo.VideoWindow && guiInfo.Playing )
382
if ( !guiApp.subWindow.isFullScreen )
384
wsResizeWindow( &guiApp.subWindow, guiInfo.VideoWidth, guiInfo.VideoHeight );
385
wsMoveWindow( &guiApp.subWindow, False, guiApp.sub.x, guiApp.sub.y );
345
388
if ( guiApp.subWindow.isFullScreen ) btnSet( evFullScreen,btnPressed );
346
389
else btnSet( evFullScreen,btnReleased );
358
401
wsClearWindow( guiApp.subWindow );
359
402
#ifdef CONFIG_DVDREAD
360
if ( guiInfo.StreamType == STREAMTYPE_DVD || guiInfo.StreamType == STREAMTYPE_VCD ) goto play_dvd_2;
403
if ( guiInfo.StreamType == STREAMTYPE_VCD || guiInfo.StreamType == STREAMTYPE_DVD ) goto play_dvd_2;
406
guiInfo.NewPlay=GUI_FILE_NEW;
366
409
// --- timer events
369
412
unsigned now = GetTimerMS();
370
413
if ((now > last_redraw_time) &&
371
414
(now < last_redraw_time + GUI_REDRAW_WAIT) &&
415
!uiPlaybarFade && (iparam == 0))
374
417
last_redraw_time = now;
378
421
wsPostRedisplay( &guiApp.playbarWindow );
380
423
// --- system events
383
mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] event none received.\n" );
425
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] uiEventHandling: evNone\n" );
386
mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] unknown event received ( %d,%.2f ).\n",msg,param );
428
mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] uiEventHandling: unknown event %d, param %.2f\n", msg, param );