void ChangeSkin( char * name ) { int ret; int prev = appMPlayer.menuIsPresent; int bprev = appMPlayer.barIsPresent; mainVisible=0; appInitStruct( &tmpList ); skinAppMPlayer=&tmpList; fntFreeFont(); ret=skinRead( name ); appInitStruct( &tmpList ); skinAppMPlayer=&appMPlayer; appInitStruct( &appMPlayer ); if ( ret ) name=skinName; if ( skinRead( name ) ) { mainVisible=1; return; } // --- reload menu window if ( prev && appMPlayer.menuIsPresent ) { free( mplMenuDrawBuffer ); if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); wsSetShape( &appMPlayer.menuWindow,appMPlayer.menuBase.Mask.Image ); wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow ); } else { mplMenuInit(); } // --- reload sub window if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) ) { wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y ); } if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); if ( !guiIntfStruct.Playing ) { mplSubRender=1; wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B ); wsClearWindow( appMPlayer.subWindow ); wsPostRedisplay( &appMPlayer.subWindow ); } // --- reload play bar if ( bprev ) wsDestroyWindow( &appMPlayer.barWindow ); mplPBInit(); // --- reload main window free( mplDrawBuffer ); if ( ( mplDrawBuffer = calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; } wsDestroyWindow( &appMPlayer.mainWindow ); wsCreateWindow( &appMPlayer.mainWindow, appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsMaxSize|wsHideWindow,"MPlayer" ); wsCreateImage( &appMPlayer.mainWindow,appMPlayer.main.Bitmap.Width,appMPlayer.main.Bitmap.Height ); wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask ); appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw; appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; appMPlayer.mainWindow.DandDHandler=mplDandDHandler; wsXDNDMakeAwareness( &appMPlayer.mainWindow ); if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 ); wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow ); mainVisible=1; // --- btnModify( evSetVolume,guiIntfStruct.Volume ); btnModify( evSetBalance,guiIntfStruct.Balance ); btnModify( evSetMoviePosition,guiIntfStruct.Position ); btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen ); wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen ); wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen ); }
int skinRead( char * dname ) { unsigned char tmp[255]; unsigned char * ptmp; unsigned char command[32]; unsigned char param[256]; int c,i; setname( skinDirInHome,dname ); if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) { setname( skinMPlayerDir,dname ); if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) { setname( skinDirInHome_obsolete,dname ); if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) { setname( skinMPlayerDir_obsolete,dname ); if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) { setname( skinMPlayerDir,dname ); mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_SkinFileNotFound,fn ); return -1; } } } } mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] file: %s\n",fn ); appInitStruct( skinAppMPlayer ); linenumber=0; while (fgets(tmp, 255, skinFile)) { linenumber++; c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; for ( c=0;c<(int)strlen( tmp );c++ ) if ( tmp[c] == ';' ) { tmp[c]=0; break; } if ( strlen( tmp ) == 0 ) continue; ptmp=trimleft( tmp ); if ( strlen( ptmp ) == 0 ) continue; ptmp=strswap( ptmp,'\t',' ' ); ptmp=trim( ptmp ); cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 ); strlower( command ); for( i=0;i<ITEMS;i++ ) if ( !strcmp( command,skinItem[i].name ) ) if ( skinItem[i].func( param ) ) return -2; } if (linenumber == 0) { mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SkinFileNotReadable, fn); return -1; } return 0; }