comparison Gui/interface.c @ 8058:9246adcf95f0

cosmetic
author pontscho
date Sat, 02 Nov 2002 20:10:18 +0000
parents e5dda05f9aab
children 851e974e6eaa
comparison
equal deleted inserted replaced
8057:10698ce4b2a4 8058:9246adcf95f0
1 1
2 #include <inttypes.h> 2 #include <inttypes.h>
3 #include <stdlib.h> 3 #include <stdlib.h>
4 #include <stdio.h> 4 #include <stdio.h>
5 #include <string.h> 5 #include <string.h>
6 6 #include <sys/types.h>
7 #include "ws.h" 7
8 #include "mplayer/play.h" 8 #include "wm/ws.h"
9 #include "wm/wsxdnd.h"
9 #include "interface.h" 10 #include "interface.h"
10 #include "skin/skin.h" 11 #include "skin/skin.h"
12
11 #include "mplayer/gtk/eq.h" 13 #include "mplayer/gtk/eq.h"
12
13 #include "../mplayer.h"
14 #include "mplayer/widgets.h" 14 #include "mplayer/widgets.h"
15 #include "mplayer/mplayer.h" 15 #include "mplayer/mplayer.h"
16
17 #include "../mplayer.h"
16 #include "app.h" 18 #include "app.h"
17 #include "cfg.h" 19 #include "cfg.h"
18 #include "../help_mp.h" 20 #include "../help_mp.h"
19 #include "../subreader.h" 21 #include "../subreader.h"
20 #include "../libvo/x11_common.h" 22 #include "../libvo/x11_common.h"
24 #include "../input/input.h" 26 #include "../input/input.h"
25 #include "../libao2/audio_out.h" 27 #include "../libao2/audio_out.h"
26 #include "../mixer.h" 28 #include "../mixer.h"
27 #include "../libao2/audio_plugin.h" 29 #include "../libao2/audio_plugin.h"
28 #include "../libao2/eq.h" 30 #include "../libao2/eq.h"
29
30 #include <inttypes.h>
31 #include <sys/types.h>
32 31
33 #ifdef USE_ICONV 32 #ifdef USE_ICONV
34 #include <iconv.h> 33 #include <iconv.h>
35 #endif 34 #endif
36 35
148 } 147 }
149 #endif 148 #endif
150 149
151 void guiInit( void ) 150 void guiInit( void )
152 { 151 {
152 int i;
153
153 memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) ); 154 memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) );
154 guiIntfStruct.Balance=50.0f; 155 guiIntfStruct.Balance=50.0f;
155 guiIntfStruct.StreamType=-1; 156 guiIntfStruct.StreamType=-1;
156 157
157 memset( &gtkEquChannels,0,sizeof( gtkEquChannels ) ); 158 memset( &gtkEquChannels,0,sizeof( gtkEquChannels ) );
163 fullscreen=gtkLoadFullscreen; 164 fullscreen=gtkLoadFullscreen;
164 165
165 gtkInit(); 166 gtkInit();
166 // --- initialize X 167 // --- initialize X
167 wsXInit( (void *)mDisplay ); 168 wsXInit( (void *)mDisplay );
168 // --- 169 // --- load skin
169 skinDirInHome=get_path("Skin"); 170 skinDirInHome=get_path("Skin");
170 skinMPlayerDir=DATADIR "/Skin"; 171 skinMPlayerDir=DATADIR "/Skin";
171 printf("SKIN dir 1: '%s'\n",skinDirInHome); 172 printf("SKIN dir 1: '%s'\n",skinDirInHome);
172 printf("SKIN dir 2: '%s'\n",skinMPlayerDir); 173 printf("SKIN dir 2: '%s'\n",skinMPlayerDir);
173 if ( !skinName ) skinName=strdup( "default" ); 174 if ( !skinName ) skinName=strdup( "default" );
174 switch ( skinRead( skinName ) ) 175 switch ( skinRead( skinName ) )
175 { 176 {
176 case -1: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinNotFound,skinName ); exit( 0 ); 177 case -1: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinNotFound,skinName ); exit( 0 );
177 case -2: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinCfgReadError,skinName ); exit( 0 ); 178 case -2: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinCfgReadError,skinName ); exit( 0 );
178 } 179 }
179 mplInit( (void *)mDisplay ); 180 // --- initialize windows
181 if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
182 {
183 fprintf( stderr,MSGTR_NEMDB );
184 exit( 0 );
185 }
186
187 wsCreateWindow( &appMPlayer.subWindow,
188 appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height,
189 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"ViDEO" );
190
191 wsDestroyImage( &appMPlayer.subWindow );
192 wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
193 wsXDNDMakeAwareness(&appMPlayer.subWindow);
194
195 vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC );
196
197 // i=wsHideFrame|wsMaxSize|wsHideWindow;
198 // if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow;
199 i=wsShowFrame|wsMaxSize|wsHideWindow;
200 wsCreateWindow( &appMPlayer.mainWindow,
201 appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
202 wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize|
203
204 wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
205 wsXDNDMakeAwareness(&appMPlayer.mainWindow);
206
207 mplMenuInit();
208
209 #ifdef DEBUG
210 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] Depth on screen: %d\n",wsDepthOnScreen );
211 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID );
212 mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID );
213 #endif
214
215 appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw;
216 appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
217 appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
218 appMPlayer.mainWindow.DandDHandler=mplDandDHandler;
219
220 appMPlayer.subWindow.ReDraw=(void *)mplSubDraw;
221 appMPlayer.subWindow.MouseHandler=mplSubMouseHandle;
222 appMPlayer.subWindow.KeyHandler=mplMainKeyHandle;
223 appMPlayer.subWindow.DandDHandler=mplDandDHandler;
224
225 wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
226 wsClearWindow( appMPlayer.subWindow );
227 if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
228
229 btnModify( evSetVolume,guiIntfStruct.Volume );
230 btnModify( evSetBalance,guiIntfStruct.Balance );
231 btnModify( evSetMoviePosition,guiIntfStruct.Position );
232
233 wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask );
234 wsSetIcon( wsDisplay,appMPlayer.subWindow.WindowID,guiIcon,guiIconMask );
235
236 guiIntfStruct.Playing=0;
237
238 if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
239
240 wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
241 #if 1
242 wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
243
244 {
245 XEvent xev;
246 do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
247 appMPlayer.subWindow.Mapped=wsMapped;
248 }
249
250 if ( fullscreen )
251 {
252 mplFullScreen();
253 btnModify( evFullScreen,btnPressed );
254 }
255 #endif
256 mplSubRender=1;
180 // --- 257 // ---
181 258
182 if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE ); 259 if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE );
183 if ( sub_name ) guiSetFilename( guiIntfStruct.Subtitlename,sub_name ); 260 if ( sub_name ) guiSetFilename( guiIntfStruct.Subtitlename,sub_name );
184 #if defined( USE_OSD ) || defined( USE_SUB ) 261 #if defined( USE_OSD ) || defined( USE_SUB )