11
#include "wm/wsxdnd.h"
12
#include "../config.h"
13
#include "../help_mp.h"
14
#include "../mplayer.h"
15
#include "../libvo/x11_common.h"
16
#include "../libvo/video_out.h"
17
#include "../input/input.h"
21
#include "wm/wskeys.h"
22
#include "interface.h"
25
#include "./mplayer.h"
28
#include "skin/skin.h"
29
#include "skin/font.h"
31
#include "libmpdemux/stream.h"
33
extern float rel_seek_secs;
34
extern int abs_seek_pos;
36
int mplGotoTheNext = 1;
38
void mplFullScreen( void )
40
if ( guiIntfStruct.NoWindow && guiIntfStruct.Playing ) return;
42
if ( ( guiIntfStruct.Playing )&&( appMPlayer.subWindow.isFullScreen ) )
44
appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight;
45
switch ( appMPlayer.sub.x )
47
case -1: appMPlayer.subWindow.OldX=( wsMaxX / 2 ) - ( appMPlayer.subWindow.OldWidth / 2 ) + wsOrgX; break;
48
case -2: appMPlayer.subWindow.OldX=wsMaxX - appMPlayer.subWindow.OldWidth + wsOrgX; break;
49
default: appMPlayer.subWindow.OldX=appMPlayer.sub.x; break;
51
switch ( appMPlayer.sub.y )
53
case -1: appMPlayer.subWindow.OldY=( wsMaxY / 2 ) - ( appMPlayer.subWindow.OldHeight / 2 ) + wsOrgY; break;
54
case -2: appMPlayer.subWindow.OldY=wsMaxY - appMPlayer.subWindow.OldHeight + wsOrgY; break;
55
default: appMPlayer.subWindow.OldY=appMPlayer.sub.y; break;
58
if ( guiIntfStruct.Playing || gtkShowVideoWindow ) wsFullScreen( &appMPlayer.subWindow );
59
fullscreen=vo_fs=appMPlayer.subWindow.isFullScreen;
60
wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen );
61
if ( appMPlayer.menuIsPresent ) wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen );
63
if ( guiIntfStruct.Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
64
else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
67
extern int mplSubRender;
73
if ( !mplGotoTheNext && guiIntfStruct.Playing) { mplGotoTheNext=1; return; }
75
if ( guiIntfStruct.Playing && (next=gtkSet( gtkGetNextPlItem,0,NULL )) && plLastPlayed != next )
78
guiSetDF( guiIntfStruct.Filename,next->path,next->name );
79
guiIntfStruct.StreamType=STREAMTYPE_FILE;
80
guiIntfStruct.FilenameChanged=guiIntfStruct.NewPlay=1;
81
gfree( (void **)&guiIntfStruct.AudioFile );
82
gfree( (void **)&guiIntfStruct.Subtitlename );
86
if ( guiIntfStruct.FilenameChanged || guiIntfStruct.NewPlay ) return;
88
guiIntfStruct.TimeSec=0;
89
guiIntfStruct.Position=0;
90
guiIntfStruct.AudioType=0;
91
guiIntfStruct.NoWindow=False;
94
guiIntfStruct.DVD.current_title=1;
95
guiIntfStruct.DVD.current_chapter=1;
96
guiIntfStruct.DVD.current_angle=1;
99
if ( !appMPlayer.subWindow.isFullScreen && gtkShowVideoWindow)
101
wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
102
wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
104
else wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
105
guiGetEvent( guiCEvent,guiSetStop );
107
wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
108
wsClearWindow( appMPlayer.subWindow );
109
wsPostRedisplay( &appMPlayer.subWindow );
115
if ( ( !guiIntfStruct.Filename )||
116
( guiIntfStruct.Filename[0] == 0 )||
117
( guiIntfStruct.Playing == 1 ) ) return;
118
if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; }
119
guiGetEvent( guiCEvent,(void *)guiSetPlay );
121
wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
122
wsClearWindow( appMPlayer.subWindow );
125
void mplPause( void )
127
if ( !guiIntfStruct.Playing ) return;
128
if ( guiIntfStruct.Playing == 1 )
130
mp_cmd_t * cmd = (mp_cmd_t *)calloc( 1,sizeof( *cmd ) );
131
cmd->id=MP_CMD_PAUSE;
132
cmd->name=strdup("pause");
133
mp_input_queue_cmd(cmd);
134
} else guiIntfStruct.Playing=1;
137
void mplState( void )
139
if ( ( guiIntfStruct.Playing == 0 )||( guiIntfStruct.Playing == 2 ) )
141
btnModify( evPlaySwitchToPause,btnReleased );
142
btnModify( evPauseSwitchToPlay,btnDisabled );
146
btnModify( evPlaySwitchToPause,btnDisabled );
147
btnModify( evPauseSwitchToPlay,btnReleased );
151
float mplGetPosition( void )
152
{ // return 0.0 ... 100.0
153
return guiIntfStruct.Position;
156
void mplRelSeek( float s )
158
rel_seek_secs=s; abs_seek_pos=0;
161
void mplAbsSeek( float s )
163
if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) return;
164
rel_seek_secs=0.01*s; abs_seek_pos=3;
169
void ChangeSkin( char * name )
172
int prev = appMPlayer.menuIsPresent;
173
int bprev = appMPlayer.barIsPresent;
177
appInitStruct( &tmpList );
178
skinAppMPlayer=&tmpList;
180
ret=skinRead( name );
182
appInitStruct( &tmpList );
183
skinAppMPlayer=&appMPlayer;
184
appInitStruct( &appMPlayer );
185
if ( ret ) name=skinName;
186
if ( skinRead( name ) )
192
// --- reload menu window
194
if ( prev && appMPlayer.menuIsPresent )
196
if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer );
197
if ( ( mplMenuDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL )
198
{ mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
199
wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
200
wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
201
wsSetShape( &appMPlayer.menuWindow,appMPlayer.menuBase.Mask.Image );
202
wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow );
203
} else { mplMenuInit(); }
205
// --- reload sub window
206
if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
207
if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) )
209
wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
210
wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
212
if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
213
if ( !guiIntfStruct.Playing )
216
wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
217
wsClearWindow( appMPlayer.subWindow );
218
wsPostRedisplay( &appMPlayer.subWindow );
221
// --- reload play bar
222
if ( bprev ) wsDestroyWindow( &appMPlayer.barWindow );
225
// --- reload main window
226
if ( mplDrawBuffer ) free( mplDrawBuffer );
227
if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
228
{ mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
230
wsDestroyWindow( &appMPlayer.mainWindow );
232
wsCreateWindow( &appMPlayer.mainWindow,
233
appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
234
wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsMaxSize|wsHideWindow,"MPlayer" );
235
wsCreateImage( &appMPlayer.mainWindow,appMPlayer.main.Bitmap.Width,appMPlayer.main.Bitmap.Height );
236
wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
237
wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask );
239
appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw;
240
appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
241
appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
242
appMPlayer.mainWindow.DandDHandler=mplDandDHandler;
244
wsXDNDMakeAwareness( &appMPlayer.mainWindow );
245
if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
246
wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
250
btnModify( evSetVolume,guiIntfStruct.Volume );
251
btnModify( evSetBalance,guiIntfStruct.Balance );
252
btnModify( evSetMoviePosition,guiIntfStruct.Position );
253
btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen );
255
wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen );
256
wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen );
260
void mplSetFileName( char * dir,char * name,int type )
264
if ( !dir ) guiSetFilename( guiIntfStruct.Filename,name )
265
else guiSetDF( guiIntfStruct.Filename,dir,name );
267
// filename=guiIntfStruct.Filename;
268
guiIntfStruct.StreamType=type;
269
gfree( (void **)&guiIntfStruct.AudioFile );
270
gfree( (void **)&guiIntfStruct.Subtitlename );
278
if ( guiIntfStruct.Playing == 2 ) return;
279
switch ( guiIntfStruct.StreamType )
290
if ( (curr=gtkSet( gtkGetCurrPlItem,0,NULL)) )
292
mplSetFileName( curr->path,curr->name,STREAMTYPE_FILE );
298
if ( stop ) mplEventHandling( evStop,0 );
299
if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
308
if ( guiIntfStruct.Playing == 2 ) return;
309
switch ( guiIntfStruct.StreamType )
313
if ( --guiIntfStruct.DVD.current_chapter == 0 )
315
guiIntfStruct.DVD.current_chapter=1;
316
if ( --guiIntfStruct.DVD.current_title <= 0 ) { guiIntfStruct.DVD.current_title=1; stop=1; }
318
guiIntfStruct.Track=guiIntfStruct.DVD.current_title;
323
if ( --guiIntfStruct.Track == 0 ) { guiIntfStruct.Track=1; stop=1; }
327
if ( (prev=gtkSet( gtkGetPrevPlItem,0,NULL)) )
329
mplSetFileName( prev->path,prev->name,STREAMTYPE_FILE );
335
if ( stop ) mplEventHandling( evStop,0 );
336
if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
344
if ( guiIntfStruct.Playing == 2 ) return;
345
switch ( guiIntfStruct.StreamType )
349
if ( guiIntfStruct.DVD.current_chapter++ == guiIntfStruct.DVD.chapters )
351
guiIntfStruct.DVD.current_chapter=1;
352
if ( ++guiIntfStruct.DVD.current_title > guiIntfStruct.DVD.titles ) { guiIntfStruct.DVD.current_title=guiIntfStruct.DVD.titles; stop=1; }
354
guiIntfStruct.Track=guiIntfStruct.DVD.current_title;
359
if ( ++guiIntfStruct.Track > guiIntfStruct.VCDTracks ) { guiIntfStruct.Track=guiIntfStruct.VCDTracks; stop=1; }
363
if ( (next=gtkSet( gtkGetNextPlItem,0,NULL)) )
365
mplSetFileName( next->path,next->name,STREAMTYPE_FILE );
371
if ( stop ) mplEventHandling( evStop,0 );
372
if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );