1
mirror of https://github.com/mpv-player/mpv synced 2024-07-31 16:29:58 +02:00

some bug fix, and add decoration item to skin conffile. faszom(C)

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1867 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
pontscho 2001-09-07 21:04:14 +00:00
parent 70c0a8df28
commit 83e1eed13d
14 changed files with 136 additions and 149 deletions

View File

@ -45,7 +45,7 @@ dep: depend
depend: .depend depend: .depend
.depend: Makefile config.mak config.h gui.mak bitmap/bitmap.mak .depend: Makefile config.mak gui.mak bitmap/bitmap.mak
$(MAKE) -C mplayer depend $(MAKE) -C mplayer depend
$(CC) -MM $(CFLAGS) $(SRCS) 1>.depend $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend

View File

@ -5,20 +5,16 @@
#include "app.h" #include "app.h"
#include "../config.h" #include "../config.h"
#include "config.h"
#include "error.h" #include "error.h"
#include "wm/wskeys.h" #include "wm/wskeys.h"
#include "skin/skin.h" #include "skin/skin.h"
#include "mplayer/mplayer.h" #include "mplayer/mplayer.h"
listItems appMPlayer; listItems appMPlayer;
listItems appTV;
listItems appRadio;
//char * appMPlayerDirInHome=NULL;
//char * appMPlayerDir=NULL;
char * skinDirInHome=NULL; char * skinDirInHome=NULL;
char * skinMPlayerDir=NULL; char * skinMPlayerDir=NULL;
char * skinName = NULL;
void appClearItem( wItem * item ) void appClearItem( wItem * item )
{ {
@ -71,6 +67,7 @@ void appInitStruct( listItems * item )
memset( item->MenuItems,0,32 * sizeof( wItem ) ); memset( item->MenuItems,0,32 * sizeof( wItem ) );
appClearItem( &item->main ); appClearItem( &item->main );
item->mainDecoration=0;
appClearItem( &item->sub ); appClearItem( &item->sub );
item->sub.Bitmap.Width=384; item->sub.Bitmap.Height=384; item->sub.Bitmap.Width=384; item->sub.Bitmap.Height=384;
item->sub.width=384; item->sub.height=384; item->sub.width=384; item->sub.height=384;
@ -104,12 +101,13 @@ void appInit( int argc,char* argv[], char *envp[], void* disp )
skinMPlayerDir=DATADIR "/Skin"; skinMPlayerDir=DATADIR "/Skin";
printf("SKIN dir 1: '%s'\n",skinDirInHome); printf("SKIN dir 1: '%s'\n",skinDirInHome);
printf("SKIN dir 2: '%s'\n",skinMPlayerDir); printf("SKIN dir 2: '%s'\n",skinMPlayerDir);
if ( !skinName )
{
if ( ( skinName=(char *)calloc( 1,7 ) ) == NULL ) { dbprintf( 0,"[config] Not enough memory.\n" ); exit( 1 ); }
strcpy( skinName,"default" );
}
initDebug(NULL); // write messages to stderr initDebug(NULL); // write messages to stderr
switch ( skinRead( skinName ) )
cfgDefaults(); // set skin to "default"
cfgRead(); // empty function - NOP
switch ( skinRead( cfgSkin ) )
{ {
case -1: dbprintf( 0,"[app] skin configfile not found.\n" ); exit( 0 ); case -1: dbprintf( 0,"[app] skin configfile not found.\n" ); exit( 0 );
case -2: dbprintf( 0,"[app] skin configfile read error.\n" ); exit( 0 ); case -2: dbprintf( 0,"[app] skin configfile read error.\n" ); exit( 0 );

View File

@ -50,6 +50,7 @@ typedef struct
{ {
wItem main; wItem main;
wsTWindow mainWindow; wsTWindow mainWindow;
int mainDecoration;
wItem sub; wItem sub;
wsTWindow subWindow; wsTWindow subWindow;
@ -72,13 +73,10 @@ typedef struct
} listItems; } listItems;
extern listItems appMPlayer; extern listItems appMPlayer;
extern listItems appTV;
extern listItems appRadio;
//extern char * appMPlayerDirInHome;
//extern char * appMPlayerDir;
extern char * skinDirInHome; extern char * skinDirInHome;
extern char * skinMPlayerDir; extern char * skinMPlayerDir;
extern char * skinName;
extern void appInit( int argc,char* argv[], char *envp[], void* disp ); extern void appInit( int argc,char* argv[], char *envp[], void* disp );
extern void appInitStruct( listItems * item ); extern void appInitStruct( listItems * item );

View File

@ -1,22 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
unsigned char * cfgAppName = "movieplayer";
unsigned char * cfgSkin = NULL;
void cfgDefaults( void )
{
if ( ( cfgSkin=(char *)calloc( 1,256 ) ) == NULL )
{
fprintf( stderr,"[config] Not enough memory.\n" );
exit( 1 );
}
strcpy( cfgSkin,"default" );
// strcpy( cfgSkin,"blueHeart" );
}
int cfgRead( void )
{
return 0;
}

View File

@ -1,11 +0,0 @@
#ifndef __MYCONFIG
#define __MYCONFIG
extern unsigned char * cfgAppName;
extern unsigned char * cfgSkin;
extern int cfgRead( void );
extern void cfgDefaults( void );
#endif

View File

@ -3,44 +3,44 @@
evName evNames[] = evName evNames[] =
{ {
{ evNone, "evNone" }, // 1 { evNone, "evNone" },
{ evPlay, "evPlay" }, // 2 { evPlay, "evPlay" },
{ evStop, "evStop" }, // 3 { evStop, "evStop" },
{ evPause, "evPause" }, // 4 { evPause, "evPause" },
{ evPrev, "evPrev" }, // 7 { evPrev, "evPrev" },
{ evNext, "evNext" }, // 8 { evNext, "evNext" },
{ evLoad, "evLoad" }, // 9 { evLoad, "evLoad" },
{ evEqualeaser, "evEqualeaser" }, // 10 { evEqualeaser, "evEqualeaser" },
{ evPlayList, "evPlaylist" }, // 11 { evPlayList, "evPlaylist" },
{ evExit, "evExit" }, // 12 { evExit, "evExit" },
{ evPlusVideo, "evPlusVideo" }, // 13 { evIconify, "evIconify" },
{ evMinusVideo, "evMinusVideo" }, // 14 { evIncBalance, "evIncBalance" },
{ evIconify, "evIconify" }, // 15 { evDecBalance, "evDecBalance" },
{ evPlusBalance, "evPlusBalance" }, // 16 { evFullScreen, "evFullScreen" },
{ evMinusBalance, "evMinusBalance" }, // 17 { evFName, "evFName" },
{ evFullScreen, "evFullScreen" }, // 18 { evMovieTime, "evMovieTime" },
{ evFName, "evFName" }, // 19 { evAbout, "evAbout" },
{ evMovieTime, "evMovieTime" }, // 20 { evLoadPlay, "evLoadPlay" },
{ evAbout, "evAbout" }, // 22 { evPreferences, "evPreferences" },
{ evLoadPlay, "evLoadPlay" }, // 23 { evSkinBrowser, "evSkinBrowser" },
{ evPreferences, "evPreferences" }, // 24 { evBackward10sec, "evBackward10sec" },
{ evSkinBrowser, "evSkinBrowser" }, // 25 { evForward10sec, "evForward10sec" },
{ evBackward10sec, "evBackward10sec" }, // 26 { evBackward1min, "evBackward1min" },
{ evForward10sec, "evForward10sec" }, // 27 { evForward1min, "evForward1min" },
{ evBackward1min, "evBackward1min" }, // 28 { evBackward10min, "evBackward10min" },
{ evForward1min, "evForward1min" }, // 29 { evForward10min, "evForward10min" },
{ evIncVolume, "evIncVolume" }, // 30 { evIncVolume, "evIncVolume" },
{ evDecVolume, "evDecVolume" }, // 31 { evDecVolume, "evDecVolume" },
{ evMute, "evMute" }, // 32 { evMute, "evMute" },
{ evIncAudioBufDelay, "evIncAudioBufDelay" }, // 33 { evIncAudioBufDelay, "evIncAudioBufDelay" },
{ evDecAudioBufDelay, "evDecAudioBufDelay" }, // 34 { evDecAudioBufDelay, "evDecAudioBufDelay" },
{ evPlaySwitchToPause, "evPlaySwitchToPause" }, // 35 { evPlaySwitchToPause, "evPlaySwitchToPause" },
{ evPauseSwitchToPlay, "evPauseSwitchToPlay" }, // 36 { evPauseSwitchToPlay, "evPauseSwitchToPlay" },
{ evNormalSize, "evNormalSize" }, // 37 { evNormalSize, "evNormalSize" },
{ evDoubleSize, "evDoubleSize" }, // 38 { evDoubleSize, "evDoubleSize" },
{ evSetMoviePosition, "evSetMoviePosition" }, // 39 { evSetMoviePosition, "evSetMoviePosition" },
{ evSetVolume, "evSetVolume" }, // 40 { evSetVolume, "evSetVolume" },
{ evSetBalance, "evSetBalance" }, // 41 { evSetBalance, "evSetBalance" },
{ evHelp, "evHelp" } { evHelp, "evHelp" }
}; };

View File

@ -13,35 +13,38 @@
#define evLoad 8 #define evLoad 8
#define evEqualeaser 9 #define evEqualeaser 9
#define evPlayList 10 #define evPlayList 10
#define evPlusVideo 11 #define evIconify 11
#define evMinusVideo 12 #define evAbout 12
#define evIconify 13 #define evLoadPlay 13
#define evPlusBalance 14 #define evPreferences 14
#define evMinusBalance 15 #define evSkinBrowser 15
#define evFullScreen 16 #define evPlaySwitchToPause 16
#define evAbout 18 #define evPauseSwitchToPlay 17
#define evLoadPlay 19
#define evPreferences 20
#define evSkinBrowser 21
#define evBackward10sec 22
#define evForward10sec 23
#define evBackward1min 24
#define evForward1min 25
#define evIncVolume 26
#define evDecVolume 27
#define evMute 28
#define evIncAudioBufDelay 29
#define evDecAudioBufDelay 30
#define evPlaySwitchToPause 31
#define evPauseSwitchToPlay 32
#define evNormalSize 33
#define evDoubleSize 34
#define evSetMoviePosition 35 #define evBackward10sec 18
#define evSetVolume 36 #define evForward10sec 19
#define evSetBalance 37 #define evBackward1min 20
#define evForward1min 21
#define evBackward10min 22
#define evForward10min 23
#define evHelp 38 #define evNormalSize 24
#define evDoubleSize 25
#define evFullScreen 26
#define evSetMoviePosition 27
#define evSetVolume 28
#define evSetBalance 29
#define evMute 30
#define evIncVolume 31
#define evDecVolume 32
#define evIncAudioBufDelay 33
#define evDecAudioBufDelay 34
#define evIncBalance 35
#define evDecBalance 36
#define evHelp 37
#define evExit 1000 #define evExit 1000

View File

@ -6,6 +6,6 @@ MPLAYERSRCS = $(MPLAYERDIR)mplayer.c $(MPLAYERDIR)widgets.c $(MPLAYERDIR)play.c
$(MPLAYERDIR)psignal.c $(MPLAYERDIR)psignal.c
MPLAYEROBJS = $(MPLAYERSRCS:.c=.o) MPLAYEROBJS = $(MPLAYERSRCS:.c=.o)
SRCS = $(SKINSRC) $(BITMAPSRCS) wm/ws.c wm/wsconv.c app.c config.c events.c timer.c language.c error.c SRCS = $(SKINSRC) $(BITMAPSRCS) wm/ws.c wm/wsconv.c app.c events.c timer.c language.c error.c
OBJS = $(SRCS:.c=.o) OBJS = $(SRCS:.c=.o)

View File

@ -34,7 +34,7 @@ dep: depend
depend: .depend depend: .depend
.depend: Makefile ../config.mak ../config.h ../gui.mak ../bitmap/bitmap.mak .depend: Makefile ../config.mak ../gui.mak ../bitmap/bitmap.mak
$(CC) -MM $(CFLAGS) $(MPLAYERSRCS) 1>.depend $(CC) -MM $(CFLAGS) $(MPLAYERSRCS) 1>.depend
# #

View File

@ -15,7 +15,6 @@
#include "../timer.h" #include "../timer.h"
#include "../language.h" #include "../language.h"
#include "../error.h" #include "../error.h"
#include "../config.h"
#include "../../config.h" #include "../../config.h"
#include "../../libvo/x11_common.h" #include "../../libvo/x11_common.h"
@ -52,10 +51,11 @@ void mplTimerHandler( int signum )
void mplInit( int argc,char* argv[], char *envp[], void* disp ) void mplInit( int argc,char* argv[], char *envp[], void* disp )
{ {
int i;
// allocates shmem to gtkShMem // allocates shmem to gtkShMem
// fork() a process which runs gtkThreadProc() [gtkPID] // fork() a process which runs gtkThreadProc() [gtkPID]
gtkInit( argc,argv,envp ); gtkInit( argc,argv,envp );
strcpy( gtkShMem->sb.name,cfgSkin ); strcpy( gtkShMem->sb.name,skinName );
// allocates shmem to mplShMem // allocates shmem to mplShMem
// init fields of this struct to default values // init fields of this struct to default values
@ -79,9 +79,11 @@ void mplInit( int argc,char* argv[], char *envp[], void* disp )
vo_setwindow(appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC); vo_setwindow(appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC);
vo_setwindowsize( appMPlayer.sub.width,appMPlayer.sub.height ); vo_setwindowsize( appMPlayer.sub.width,appMPlayer.sub.height );
i=wsHideFrame|wsMaxSize|wsShowWindow;
if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsShowWindow;
wsCreateWindow( &appMPlayer.mainWindow, wsCreateWindow( &appMPlayer.mainWindow,
appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsMaxSize|wsShowWindow,"MPlayer" ); //wsMinSize| wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" ); //wsMinSize|
wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );

View File

@ -24,7 +24,6 @@ int moviex,moviey,moviewidth,movieheight;
#include "play.h" #include "play.h"
#include "../skin/skin.h" #include "../skin/skin.h"
#include "../config.h"
#include "../error.h" #include "../error.h"
#include "../language.h" #include "../language.h"
@ -127,7 +126,7 @@ listItems tmpList;
void ChangeSkin( void ) void ChangeSkin( void )
{ {
if ( strcmp( cfgSkin,gtkShMem->sb.name ) ) if ( strcmp( skinName,gtkShMem->sb.name ) )
{ {
int ret; int ret;
#ifdef DEBUG #ifdef DEBUG
@ -145,8 +144,8 @@ void ChangeSkin( void )
appInitStruct( &tmpList ); appInitStruct( &tmpList );
skinAppMPlayer=&appMPlayer; skinAppMPlayer=&appMPlayer;
appInitStruct( &appMPlayer ); appInitStruct( &appMPlayer );
if ( !ret ) strcpy( cfgSkin,gtkShMem->sb.name ); if ( !ret ) strcpy( skinName,gtkShMem->sb.name );
skinRead( cfgSkin ); skinRead( skinName );
if ( ret ) if ( ret )
{ {
@ -154,24 +153,6 @@ void ChangeSkin( void )
return; return;
} }
// appCopy( &appMPlayer,&tmpList );
// appInitStruct( &tmpList );
// skinAppMPlayer=&appMPlayer;
// strcpy( cfgSkin,gtkShMem->sb.name );
if ( mplDrawBuffer ) free( mplDrawBuffer );
if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
{ message( False,langNEMDB ); return; }
wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
wsMoveWindow( &appMPlayer.mainWindow,appMPlayer.main.x,appMPlayer.main.y );
wsResizeImage( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow );
btnModify( evSetVolume,mplShMem->Volume );
btnModify( evSetBalance,mplShMem->Balance );
btnModify( evSetMoviePosition,mplShMem->Position );
if ( appMPlayer.menuBase.Bitmap.Image ) if ( appMPlayer.menuBase.Bitmap.Image )
{ {
if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer ); if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer );
@ -186,7 +167,6 @@ void ChangeSkin( void )
if ( !mplShMem->Playing ) if ( !mplShMem->Playing )
{ {
mplSkinChanged=0; mplSkinChanged=0;
// if ( appMPlayer.subWindow.isFullScreen ) wsFullScreen( &appMPlayer.subWindow );
if ( !appMPlayer.subWindow.isFullScreen ) if ( !appMPlayer.subWindow.isFullScreen )
{ {
wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
@ -196,6 +176,22 @@ void ChangeSkin( void )
wsClearWindow( appMPlayer.subWindow ); wsClearWindow( appMPlayer.subWindow );
mplSubRender=1; wsPostRedisplay( &appMPlayer.subWindow ); mplSubRender=1; wsPostRedisplay( &appMPlayer.subWindow );
} }
if ( mplDrawBuffer ) free( mplDrawBuffer );
if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
{ message( False,langNEMDB ); return; }
wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow );
wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
wsMoveWindow( &appMPlayer.mainWindow,appMPlayer.main.x,appMPlayer.main.y );
wsResizeImage( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow );
wsWindowDecoration( &appMPlayer.mainWindow,appMPlayer.mainDecoration );
wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
btnModify( evSetVolume,mplShMem->Volume );
btnModify( evSetBalance,mplShMem->Balance );
btnModify( evSetMoviePosition,mplShMem->Position );
} }
mplShMem->SkinChange=0; mplShMem->SkinChange=0;
} }

View File

@ -12,12 +12,10 @@
#include "../skin/skin.h" #include "../skin/skin.h"
#include "../wm/ws.h" #include "../wm/ws.h"
#include "../config.h"
#include "../error.h" #include "../error.h"
#include "../language.h" #include "../language.h"
#include "../../config.h" #include "../../config.h"
#include "../../libvo/x11_common.h" #include "../../libvo/x11_common.h"
//#include "../../libvo/sub.h" //#include "../../libvo/sub.h"
@ -69,7 +67,7 @@ void gtkSigHandler( int s )
if ( !gtkFillSkinList( sbMPlayerPrefixDir ) ) break; if ( !gtkFillSkinList( sbMPlayerPrefixDir ) ) break;
if ( gtkFillSkinList( sbMPlayerDirInHome ) ) if ( gtkFillSkinList( sbMPlayerDirInHome ) )
{ {
gtkSetDefaultToCList( SkinList,cfgSkin ); gtkSetDefaultToCList( SkinList,skinName );
gtk_widget_show( SkinBrowser ); gtk_widget_show( SkinBrowser );
gtkVisibleSkinBrowser=1; gtkVisibleSkinBrowser=1;
gtkShow( evSkinBrowser ); gtkShow( evSkinBrowser );

View File

@ -10,12 +10,7 @@
#include "../language.h" #include "../language.h"
#include "../../config.h" #include "../../config.h"
//char SkinDir[] = "/.mplayer/Skin/";
//char * Skin;
listItems * skinAppMPlayer = &appMPlayer; listItems * skinAppMPlayer = &appMPlayer;
//listItems * skinAppTV = &appTV;
//listItems * skinAppRadio = &appRadio;
int linenumber; int linenumber;
@ -549,6 +544,27 @@ int __dlabel( char * in )
return 0; return 0;
} }
int __decoration( char * in )
{
char tmp[512];
CHECKDEFLIST( "decoration" );
CHECKWINLIST( "decoration" );
#ifdef DEBUG
dbprintf( 0,"\n[skin] window decoration is %s\n",in );
#endif
cutItem( in,tmp,',',0 );
if ( strcmp( tmp,"enable" )&&strcmp( tmp,"disable" ) ) { ERRORMESSAGE( "unknown parameter.\n" ); return 1; }
if ( strcmp( tmp,"enable" ) ) defList->mainDecoration=0;
else defList->mainDecoration=1;
#ifdef DEBUG
dbprintf( 3,"\n[skin] window decoration is %s\n",(defList->mainDecoration?"enabled":"disabled") );
#endif
return 0;
}
typedef struct typedef struct
{ {
char * name; char * name;
@ -569,6 +585,7 @@ _item skinItem[] =
{ "font", __font }, { "font", __font },
{ "slabel", __slabel }, { "slabel", __slabel },
{ "dlabel", __dlabel }, { "dlabel", __dlabel },
{ "decoration", __decoration },
{ "menu", __menu } { "menu", __menu }
}; };

View File

@ -60,6 +60,10 @@ extern int dvd_chapter;
extern int dvd_angle; extern int dvd_angle;
#endif #endif
#ifdef HAVE_NEW_GUI
extern char * skinName;
#endif
/* /*
* CONF_TYPE_FUNC_FULL : * CONF_TYPE_FUNC_FULL :
* allows own implemtations for passing the params * allows own implemtations for passing the params
@ -236,6 +240,10 @@ struct config conf[]={
{"noidx", &index_mode, CONF_TYPE_FLAG, 0, -1, 0}, {"noidx", &index_mode, CONF_TYPE_FLAG, 0, -1, 0},
{"idx", &index_mode, CONF_TYPE_FLAG, 0, -1, 1}, {"idx", &index_mode, CONF_TYPE_FLAG, 0, -1, 1},
{"forceidx", &index_mode, CONF_TYPE_FLAG, 0, -1, 2}, {"forceidx", &index_mode, CONF_TYPE_FLAG, 0, -1, 2},
#ifdef HAVE_NEW_GUI
{"skin", &skinName, CONF_TYPE_STRING, 0, 0, 0},
#endif
{"quiet", &quiet, CONF_TYPE_FLAG, 0, 0, 1}, {"quiet", &quiet, CONF_TYPE_FLAG, 0, 0, 1},
{"verbose", &verbose, CONF_TYPE_INT, CONF_RANGE, 0, 100}, {"verbose", &verbose, CONF_TYPE_INT, CONF_RANGE, 0, 100},