/** * @brief Free all memory allocated to all GUI items and reset all item counters. */ void appFreeStruct(void) { int i; appClearItem(&guiApp.main); guiApp.mainDecoration = 0; appClearItem(&guiApp.video); appClearItem(&guiApp.playbar); guiApp.playbarIsPresent = 0; appClearItem(&guiApp.menu); appClearItem(&guiApp.menuSelected); guiApp.menuIsPresent = 0; for (i = 0; i <= guiApp.IndexOfMainItems; i++) appClearItem(&guiApp.mainItems[i]); for (i = 0; i <= guiApp.IndexOfPlaybarItems; i++) appClearItem(&guiApp.playbarItems[i]); for (i = 0; i <= guiApp.IndexOfMenuItems; i++) appClearItem(&guiApp.menuItems[i]); guiApp.IndexOfMainItems = -1; guiApp.IndexOfPlaybarItems = -1; guiApp.IndexOfMenuItems = -1; fntFreeFont(); }
void appFreeStruct(void) { int i; appClearItem(&appMPlayer.main); appMPlayer.mainDecoration = 0; appClearItem(&appMPlayer.sub); appClearItem(&appMPlayer.bar); appMPlayer.barIsPresent = 0; appClearItem(&appMPlayer.menuBase); appClearItem(&appMPlayer.menuSelected); appMPlayer.menuIsPresent = 0; for (i = 0; i <= appMPlayer.IndexOfMainItems; i++) appClearItem(&appMPlayer.mainItems[i]); for (i = 0; i <= appMPlayer.IndexOfBarItems; i++) appClearItem(&appMPlayer.barItems[i]); for (i = 0; i <= appMPlayer.IndexOfMenuItems; i++) appClearItem(&appMPlayer.menuItems[i]); appResetStruct(); fntFreeFont(); }
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 ); }