1693
|
1
|
|
2 #include <stdlib.h>
|
|
3 #include <stdio.h>
|
|
4 #include <string.h>
|
|
5
|
|
6 #include "./mplayer.h"
|
|
7 #include "../events.h"
|
|
8 #include "../app.h"
|
|
9 #include "../skin/skin.h"
|
|
10 #include "../skin/font.h"
|
|
11 #include "../wm/ws.h"
|
|
12 #include "../wm/wskeys.h"
|
|
13 #include "../wm/widget.h"
|
|
14 #include "../bitmap/bitmap.h"
|
|
15 #include "../timer.h"
|
|
16 #include "../language.h"
|
|
17 #include "../error.h"
|
|
18
|
|
19 #include "../../config.h"
|
|
20
|
|
21 #define mplMouseTimerConst 100
|
|
22 #define mplRedrawTimerConst 50
|
|
23
|
|
24 int mplMouseTimer = mplMouseTimerConst;
|
|
25 int mplRedrawTimer = mplRedrawTimerConst;
|
|
26 int mplGeneralTimer = -1;
|
|
27 int mplTimer = 0;
|
|
28
|
|
29 int mplSkinChanged = 0;
|
|
30
|
|
31 void mplMsgHandle( int msg,float param );
|
|
32
|
|
33 #include "widgets.h"
|
|
34 #include "play.h"
|
|
35 #include "menu.h"
|
|
36 #include "mw.h"
|
|
37 #include "sw.h"
|
|
38 #include "widget.h"
|
|
39
|
|
40 void mplTimerHandler( int signum )
|
|
41 {
|
|
42 mplTimer++;
|
|
43 mplMouseTimer--;
|
|
44 mplRedrawTimer--;
|
|
45 mplGeneralTimer--;
|
|
46 if ( mplMouseTimer == 0 ) mplMsgHandle( evHideMouseCursor,0 );
|
|
47 if ( mplRedrawTimer == 0 ) mplMsgHandle( evRedraw,0 );
|
|
48 if ( mplGeneralTimer == 0 ) mplMsgHandle( evGeneralTimer,0 );
|
|
49 }
|
|
50
|
|
51 void mplInit( int argc,char* argv[], char *envp[] )
|
|
52 {
|
|
53 // parse_cfgfiles( argc,argv,envp );
|
|
54 gtkInit( argc,argv,envp );
|
|
55 mplMPlayerInit( argc,argv,envp );
|
|
56
|
|
57 message=mplErrorHandler;
|
|
58
|
|
59 wsXInit();
|
|
60
|
|
61 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
|
|
62 {
|
|
63 fprintf( stderr,langNEMDB );
|
|
64 exit( 0 );
|
|
65 }
|
|
66
|
|
67 wsCreateWindow( &appMPlayer.subWindow,
|
|
68 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height,
|
|
69 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsShowWindow,"ViDEO" );
|
|
70
|
|
71 wsCreateWindow( &appMPlayer.mainWindow,
|
|
72 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
|
|
73 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsMaxSize|wsMinSize|wsShowWindow,"MPlayer" );
|
|
74
|
|
75 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
|
|
76
|
|
77 mplMenuInit();
|
|
78
|
|
79 #ifdef DEBUG
|
|
80 dbprintf( 1,"[main] Depth on screen: %d\n",wsDepthOnScreen );
|
|
81 dbprintf( 1,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID );
|
|
82 dbprintf( 1,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID );
|
|
83 #endif
|
|
84
|
|
85 appMPlayer.mainWindow.ReDraw=mplMainDraw;
|
|
86 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
|
|
87 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
|
|
88
|
|
89 appMPlayer.subWindow.ReDraw=mplSubDraw;
|
|
90 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle;
|
|
91 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle;
|
|
92 appMPlayer.subWindow.ReSize=mplResize;
|
|
93
|
|
94 wsPostRedisplay( &appMPlayer.mainWindow );
|
|
95 wsPostRedisplay( &appMPlayer.subWindow );
|
|
96
|
|
97 btnModify( evSetVolume,mplShMem->Volume );
|
|
98 btnModify( evSetBalance,mplShMem->Balance );
|
|
99 btnModify( evSetMoviePosition,mplShMem->Position );
|
|
100
|
|
101 timerSetHandler( mplTimerHandler );
|
|
102 timerInit();
|
|
103
|
|
104 wsMainLoop();
|
|
105
|
|
106 dbprintf( 1,"[mplayer] exit.\n" );
|
|
107
|
|
108 mplStop();
|
|
109 timerDone();
|
|
110 gtkDone();
|
|
111 wsXDone();
|
|
112 }
|