Mercurial > mplayer.hg
changeset 1693:d237c5d4b216
GUI version n-1
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/Makefile Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,57 @@ + +LIB = libgui.a + +include ../config.mak +include config.mak + +include bitmap/bitmap.mak +MPLAYERDIR = mplayer/ +include gui.mak + +INCDIR = -I. -I./event -I./wm -I./skin $(GTKINC) + +OPTIMIZE = $(OPTFLAGS) -fomit-frame-pointer \ + -fexpensive-optimizations -malign-double -fschedule-insns2 -mwide-multiply -Wall + +CFLAGS = $(OPTIMIZE) $(INCDIR) $(DEBUG) + +.SUFFIXES: .c .o + +.c.o: + $(CC) -c $(CFLAGS) -o $@ $< + +### TARGETS ### + +$(LIB): .depend $(OBJS) + $(MAKE) -C mplayer + rm -f $(LIB) + ar rc $(LIB) $(OBJS) $(MPLAYEROBJS) + +all: $(LIB) + +clean: + $(MAKE) -C mplayer clean + rm -rf $(OBJS) *.o *~ *.bak main $(PRG) $(LIB) .depend + +#dep: depend +# +#depend: +# makedepend -- $(CFLAGS) -- $(SRCS) &>/dev/null +# + +distclean: clean + +dep: depend + +depend: .depend + +.depend: Makefile config.mak config.h gui.mak bitmap/bitmap.mak + $(MAKE) -C mplayer depend + $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend + +# +# include dependency files if they exist +# +ifneq ($(wildcard .depend),) +include .depend +endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/app.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,124 @@ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include "app.h" +#include "../config.h" +#include "config.h" +#include "error.h" +#include "wm/wskeys.h" +#include "skin/skin.h" +#include "mplayer/mplayer.h" + +listItems appMPlayer; +listItems appTV; +listItems appRadio; + +char * appMPlayerDirInHome=NULL; +char * appMPlayerDir=NULL; +char * skinDirInHome=NULL; +char * skinMPlayerDir=NULL; + +void appClearItem( wItem * item ) +{ + item->type=0; +// --- + item->x=0; item->y=0; item->width=0; item->height=0; +// --- + item->px=0; item->py=0; item->psx=0; item->psy=0; +// --- + item->msg=0; item->msg2=0; + item->pressed=0; + item->tmp=0; + item->key=0; item->key2=0; + item->Bitmap.Width=0; item->Bitmap.Height=0; item->Bitmap.BPP=0; item->Bitmap.ImageSize=0; + if ( item->Bitmap.Image ) + { free( item->Bitmap.Image ); item->Bitmap.Image=NULL; } +// --- + item->fontid=0; + if ( item->label ) free( item->label ); item->label=NULL; + item->event=0; +} + +void appCopy( listItems * dest,listItems * source ) +{ + dest->NumberOfItems=source->NumberOfItems; + memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) ); + + dest->NumberOfMenuItems=source->NumberOfMenuItems; + memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) ); + + memcpy( &dest->main,&source->main,sizeof( wItem ) ); + memcpy( &dest->sub,&source->sub,sizeof( wItem ) ); + memcpy( &dest->eq,&source->eq,sizeof( wItem ) ); + memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) ); + memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) ); +} + +void appInitStruct( listItems * item ) +{ + int i; + for ( i=0;i<item->NumberOfItems;i++ ) + appClearItem( &item->Items[i] ); + for ( i=0;i<item->NumberOfMenuItems;i++ ) + appClearItem( &item->MenuItems[i] ); + + item->NumberOfItems=-1; + memset( item->Items,0,128 * sizeof( wItem ) ); + item->NumberOfMenuItems=-1; + memset( item->MenuItems,0,32 * sizeof( wItem ) ); + + appClearItem( &item->main ); + appClearItem( &item->sub ); + item->sub.Bitmap.Width=256; item->sub.Bitmap.Height=256; + item->sub.width=256; item->sub.height=256; + appClearItem( &item->menuBase ); + appClearItem( &item->menuSelected ); + item->subR=0; + item->subG=0; + item->subB=0; +} + +int appFindKey( unsigned char * name ) +{ + int i; + for ( i=0;i<wsKeyNumber;i++ ) + if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code; + return -1; +} + +int appFindMessage( unsigned char * str ) +{ + int i; + for ( i=0;i<evBoxs;i++ ) + if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg; + return -1; +} + +void appInit( int argc,char* argv[], char *envp[] ) +{ + if ( ( appMPlayerDirInHome=(char *)calloc( 1,strlen( getenv( "HOME" ) ) + 9 ) ) != NULL ) + { strcpy( appMPlayerDirInHome,getenv( "HOME" ) ); strcat( appMPlayerDirInHome,"/.mplayer" ); } + if ( ( skinDirInHome=(char *)calloc( 1,strlen( appMPlayerDirInHome ) + 5 ) ) != NULL ) + { strcpy( skinDirInHome,appMPlayerDirInHome ); strcat( skinDirInHome,"/Skin" ); } + if ( ( appMPlayerDir=(char *)calloc( 1,strlen( PREFIX ) + 14 ) ) != NULL ) + { strcpy( appMPlayerDir,PREFIX ); strcat( appMPlayerDir,"/share/mplayer" ); } + if ( ( skinMPlayerDir=(char *)calloc( 1,strlen( appMPlayerDir ) + 5 ) ) != NULL ) + { strcpy( skinMPlayerDir,appMPlayerDir ); strcat( skinMPlayerDir,"/Skin" ); } + + initDebug(); + + cfgDefaults(); + cfgRead(); + if ( !strcmp( cfgAppName,"movieplayer" ) ) + { + appMPlayer.sub.x=-1; appMPlayer.sub.y=-1; appMPlayer.sub.width=512; appMPlayer.sub.height=256; + switch ( skinRead( cfgSkin ) ) + { + case -1: dbprintf( 0,"[app] skin configfile not found.\n" ); exit( 0 ); + case -2: dbprintf( 0,"[app] skin configfile read error.\n" ); exit( 0 ); + } + mplInit( argc,argv,envp ); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/app.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,89 @@ + +#ifndef __MY_APPS +#define __MY_APPS + +#include "bitmap/bitmap.h" +#include "wm/ws.h" +#include "wm/wskeys.h" +#include "events.h" + +#define itNULL 0 +#define itButton 101 // button +#define itHPotmeter 102 // horizontal potmeter +#define itVPotmeter 103 // vertical potmeter +#define itSLabel 104 // static label +#define itDLabel 105 // dynamic label +#define itBase 106 +#define itPotmeter 107 +#define itFont 108 +// --- +#define btnPressed 0 +#define btnReleased 1 +#define btnDisabled 2 +// --- +typedef struct +{ + int type; +// --- + int x,y; + int width,height; +// --- + int px,py,psx,psy; +// --- + int msg,msg2; + int pressed,disabled,tmp; + int key,key2; + int phases; + float value; + txSample Bitmap; + txSample Mask; +// --- + int fontid; + int align; + char * label; +// --- + int event; +} wItem; + +typedef struct +{ + wItem main; + wsTWindow mainWindow; + + wItem sub; + wsTWindow subWindow; + int subR,subG,subB; + int subPixel; + + wItem eq; + wsTWindow eqWindow; + + wItem menuBase; + wItem menuSelected; + wsTWindow menuWindow; + +// --- + int NumberOfItems; + wItem Items[256]; +// --- + int NumberOfMenuItems; + wItem MenuItems[32]; +} listItems; + +extern listItems appMPlayer; +extern listItems appTV; +extern listItems appRadio; + +extern char * appMPlayerDirInHome; +extern char * appMPlayerDir; +extern char * skinDirInHome; +extern char * skinMPlayerDir; + +extern void appInit( int argc,char* argv[], char *envp[] ); +extern void appInitStruct( listItems * item ); +extern void appClearItem( wItem * item ); +extern void appCopy( listItems * item1,listItems * item2 ); +extern int appFindMessage( unsigned char * str ); +extern int appFindKey( unsigned char * name ); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/bitmap.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,174 @@ + +#include <stdlib.h> +#include <stdio.h> + +#include "bitmap.h" +#include "../error.h" + +#define BMP 1 +#define TGA 2 +#define PNG 3 +#define TGAPACKED 4 + +extern char * strcat( char * dest,const char * src ); + +int conv24to32( txSample * bf ) +{ + unsigned char * tmpImage; + int i,c; + + if ( bf->BPP == 24 ) + { + tmpImage=bf->Image; + bf->ImageSize=bf->Width * bf->Height * 4; + bf->BPP=32; + if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL ) + { + #ifdef DEBUG + dbprintf( 4,"[bitmap] Not enough memory for image.\n" ); + #endif + return 1; + } + memset( bf->Image,0,bf->ImageSize ); + for ( c=0,i=0;i < bf->Width * bf->Height * 3; ) + { + bf->Image[c++]=tmpImage[i++]; + bf->Image[c++]=tmpImage[i++]; + bf->Image[c++]=tmpImage[i++]; c++; + } + free( tmpImage ); + } + return 0; +} + +void bgr2rgb( txSample * bf ) +{ + unsigned char c; + int i; + + for ( i=0;i < bf->ImageSize;i+=4 ) + { + c=bf->Image[i]; + bf->Image[i]=bf->Image[i+2]; + bf->Image[i+2]=c; + } +} + +void Normalize( txSample * bf ) +{ + int i; + + for ( i=0;i < bf->ImageSize;i+=4 ) bf->Image[i+3]=0; +} + +unsigned char tmp[512]; + +unsigned char * fExist( unsigned char * fname ) +{ + FILE * fl; + unsigned char ext[][6] = { ".tga\0",".TGA\0",".png\0",".PNG\0",".bmp\0",".BMP\0" }; + int i; + + fl=fopen( fname,"rb" ); + if ( fl != NULL ) + { + fclose( fl ); + return fname; + } + for ( i=0;i<10;i++ ) + { + strcpy( tmp,fname ); + strcat( tmp,ext[i] ); + fl=fopen( tmp,"rb" ); + if ( fl != NULL ) + { + fclose( fl ); + return tmp; + } + } + return NULL; +} + +int aComp( unsigned char * b1,unsigned char * b2,int size ) +{ + int i; + for( i=0;i<size;i++ ) if ( b1[i] != b2[i] ) return 0; + return 1; +} + +int GetFileType( char * fname ) +{ + FILE * fl; + unsigned char buffer[10]; + unsigned char bmp[2] = { 0x42,0x4d }; + unsigned char tga[7] = { 0x00,0x02,0x00,0x00,0x00,0x00,0x00 }; + unsigned char ptga[7] = { 0x00,0x0a,0x00,0x00,0x00,0x00,0x00 }; + unsigned char png[8] = { 0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a }; + + if ( ( fl=fopen( fname,"rb" ) ) == NULL ) return -1; + fread( buffer,1,10,fl ); + fclose( fl ); + + if ( aComp( buffer,bmp,2 ) ) return BMP; // --- bmp + if ( aComp( &buffer[1],tga,8 ) ) return TGA; // --- tga + if ( aComp( &buffer[1],ptga,7 ) ) return TGAPACKED; // --- tga + if ( aComp( buffer,png,8 ) ) return PNG; // --- png + return 0; // --- others +} + +int bpRead( char * fname, txSample * bf ) +{ + int bgr = 0; + int i; + + fname=fExist( fname ); + if ( fname == NULL ) return -2; + switch ( GetFileType( fname ) ) + { + case BMP: + i=bmpRead( fname,bf ); + switch ( i ) + { + case 0: break; + case 3: return -1; + default: return -3; + } + break; + case TGA: + i=tgaRead( fname,bf ); + switch ( i ) + { + case 0: break; + case 3: return -1; + default: return -4; + } + break; + case PNG: + if ( pngRead( fname,bf ) ) return -5; + bgr=1; + break; + case TGAPACKED: + #ifdef DEBUG + dbprintf( 4,"[bitmap] sorry, packed TGA not supported.\n" ); + #endif + return -6; + default: + { + #ifdef DEBUG + dbprintf( 4,"[bitmap] Unknown file type ( %s ).\n",fname ); + #endif + return -7; + } + } + if ( bf->BPP < 24 ) + { + #ifdef DEBUG + dbprintf( 4,"[bitmap] sorry, 16 or less bitmaps not supported.\n" ); + #endif + return -1; + } + if ( conv24to32( bf ) ) return -8; + if ( bgr ) bgr2rgb( bf ); + Normalize( bf ); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/bitmap.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,21 @@ + +#ifndef __MYSAMPLE +#define __MYSAMPLE + +typedef struct _txSample +{ + unsigned int Width; + unsigned int Height; + unsigned int BPP; + unsigned long ImageSize; + char * Image; +} txSample; + +#include "tga/tga.h" +#include "bmp/bmp.h" +#include "png/png.h" + +extern int bpRead( char * fname, txSample * bf ); +extern int conv24to32( txSample * bf ); + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/bitmap/Makefile Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,89 @@ + +include ../config.mak + +SRCS = bitmap.c tga/tga.c jpeg/jpeg.c bmp/bmp.c +OBJS = bitmap.o tga/tga.o jpeg/jpeg.o bmp/bmp.o + +.SUFFIXES: .c .o + +.c.o: + $(CC) -c $(CFLAGS) -o $@ $< + +### TARGETS ### + +all: + @( [ -e $(JPEGLIB) ] || \ + make -C jpeg/jpeg-6b libjpeg.a ) +# ( make -C jpeg/jpeg-6b libjpeg.a && mv jpeg/jpeg-6b/libjpeg.a "$(JPEGLIB)" ) ) + $(MAKE) $(OBJS) + ar rc libbitmap.a $(OBJS) jpeg/jpeg-6b/*.o + ranlib libbitmap.a + mv libbitmap.a ../libs + +#comp: +# $(MAKE) $(OBJS) + +clean: + $(MAKE) -C jpeg/jpeg-6b clean + -rm -rf $(OBJS) *.o *~ *.bak $(JPEGLIB) + +dep: depend + +depend: + makedepend -- $(CFLAGS) -- $(SRCS) &>/dev/null + +# DO NOT DELETE + +bitmap.o: /usr/include/stdlib.h /usr/include/features.h +bitmap.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h +bitmap.o: /usr/lib/gcc-lib/i386-linux/2.95.2/include/stddef.h +bitmap.o: /usr/include/sys/types.h /usr/include/bits/types.h +bitmap.o: /usr/include/time.h /usr/include/endian.h +bitmap.o: /usr/include/bits/endian.h /usr/include/sys/select.h +bitmap.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +bitmap.o: /usr/include/sys/sysmacros.h /usr/include/alloca.h +bitmap.o: /usr/include/stdio.h +bitmap.o: /usr/lib/gcc-lib/i386-linux/2.95.2/include/stdarg.h +bitmap.o: /usr/include/libio.h /usr/include/_G_config.h +bitmap.o: /usr/include/bits/stdio_lim.h bitmap.h tga/tga.h bitmap.h +bitmap.o: jpeg/jpeg.h bmp/bmp.h +tga/tga.o: /usr/include/string.h /usr/include/features.h +tga/tga.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h +tga/tga.o: /usr/lib/gcc-lib/i386-linux/2.95.2/include/stddef.h +tga/tga.o: /usr/include/stdio.h +tga/tga.o: /usr/lib/gcc-lib/i386-linux/2.95.2/include/stdarg.h +tga/tga.o: /usr/include/bits/types.h /usr/include/libio.h +tga/tga.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h +tga/tga.o: /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h +tga/tga.o: /usr/include/endian.h /usr/include/bits/endian.h +tga/tga.o: /usr/include/sys/select.h /usr/include/bits/select.h +tga/tga.o: /usr/include/bits/sigset.h /usr/include/sys/sysmacros.h +tga/tga.o: /usr/include/alloca.h tga/tga.h bitmap.h +jpeg/jpeg.o: /usr/include/setjmp.h /usr/include/features.h +jpeg/jpeg.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h +jpeg/jpeg.o: /usr/include/bits/setjmp.h /usr/include/bits/sigset.h +jpeg/jpeg.o: /usr/include/string.h +jpeg/jpeg.o: /usr/lib/gcc-lib/i386-linux/2.95.2/include/stddef.h +jpeg/jpeg.o: /usr/include/stdlib.h /usr/include/sys/types.h +jpeg/jpeg.o: /usr/include/bits/types.h /usr/include/time.h +jpeg/jpeg.o: /usr/include/endian.h /usr/include/bits/endian.h +jpeg/jpeg.o: /usr/include/sys/select.h /usr/include/bits/select.h +jpeg/jpeg.o: /usr/include/sys/sysmacros.h /usr/include/alloca.h +jpeg/jpeg.o: /usr/include/stdio.h +jpeg/jpeg.o: /usr/lib/gcc-lib/i386-linux/2.95.2/include/stdarg.h +jpeg/jpeg.o: /usr/include/libio.h /usr/include/_G_config.h +jpeg/jpeg.o: /usr/include/bits/stdio_lim.h jpeg/jpeg-6b/jpeglib.h +jpeg/jpeg.o: jpeg/jpeg-6b/jconfig.h jpeg/jpeg-6b/jmorecfg.h bitmap.h +jpeg/jpeg.o: jpeg/jpeg.h +bmp/bmp.o: /usr/include/stdlib.h /usr/include/features.h +bmp/bmp.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h +bmp/bmp.o: /usr/lib/gcc-lib/i386-linux/2.95.2/include/stddef.h +bmp/bmp.o: /usr/include/sys/types.h /usr/include/bits/types.h +bmp/bmp.o: /usr/include/time.h /usr/include/endian.h +bmp/bmp.o: /usr/include/bits/endian.h /usr/include/sys/select.h +bmp/bmp.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +bmp/bmp.o: /usr/include/sys/sysmacros.h /usr/include/alloca.h +bmp/bmp.o: /usr/include/stdio.h +bmp/bmp.o: /usr/lib/gcc-lib/i386-linux/2.95.2/include/stdarg.h +bmp/bmp.o: /usr/include/libio.h /usr/include/_G_config.h +bmp/bmp.o: /usr/include/bits/stdio_lim.h bmp/bmp.h bitmap.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/bitmap/bitmap.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,174 @@ + +#include <stdlib.h> +#include <stdio.h> + +#include "bitmap.h" +#include "../error.h" + +#define BMP 1 +#define TGA 2 +#define PNG 3 +#define TGAPACKED 4 + +extern char * strcat( char * dest,const char * src ); + +int conv24to32( txSample * bf ) +{ + unsigned char * tmpImage; + int i,c; + + if ( bf->BPP == 24 ) + { + tmpImage=bf->Image; + bf->ImageSize=bf->Width * bf->Height * 4; + bf->BPP=32; + if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL ) + { + #ifdef DEBUG + dbprintf( 4,"[bitmap] Not enough memory for image.\n" ); + #endif + return 1; + } + memset( bf->Image,0,bf->ImageSize ); + for ( c=0,i=0;i < bf->Width * bf->Height * 3; ) + { + bf->Image[c++]=tmpImage[i++]; + bf->Image[c++]=tmpImage[i++]; + bf->Image[c++]=tmpImage[i++]; c++; + } + free( tmpImage ); + } + return 0; +} + +void bgr2rgb( txSample * bf ) +{ + unsigned char c; + int i; + + for ( i=0;i < bf->ImageSize;i+=4 ) + { + c=bf->Image[i]; + bf->Image[i]=bf->Image[i+2]; + bf->Image[i+2]=c; + } +} + +void Normalize( txSample * bf ) +{ + int i; + + for ( i=0;i < bf->ImageSize;i+=4 ) bf->Image[i+3]=0; +} + +unsigned char tmp[512]; + +unsigned char * fExist( unsigned char * fname ) +{ + FILE * fl; + unsigned char ext[][6] = { ".tga\0",".TGA\0",".png\0",".PNG\0",".bmp\0",".BMP\0" }; + int i; + + fl=fopen( fname,"rb" ); + if ( fl != NULL ) + { + fclose( fl ); + return fname; + } + for ( i=0;i<10;i++ ) + { + strcpy( tmp,fname ); + strcat( tmp,ext[i] ); + fl=fopen( tmp,"rb" ); + if ( fl != NULL ) + { + fclose( fl ); + return tmp; + } + } + return NULL; +} + +int aComp( unsigned char * b1,unsigned char * b2,int size ) +{ + int i; + for( i=0;i<size;i++ ) if ( b1[i] != b2[i] ) return 0; + return 1; +} + +int GetFileType( char * fname ) +{ + FILE * fl; + unsigned char buffer[10]; + unsigned char bmp[2] = { 0x42,0x4d }; + unsigned char tga[7] = { 0x00,0x02,0x00,0x00,0x00,0x00,0x00 }; + unsigned char ptga[7] = { 0x00,0x0a,0x00,0x00,0x00,0x00,0x00 }; + unsigned char png[8] = { 0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a }; + + if ( ( fl=fopen( fname,"rb" ) ) == NULL ) return -1; + fread( buffer,1,10,fl ); + fclose( fl ); + + if ( aComp( buffer,bmp,2 ) ) return BMP; // --- bmp + if ( aComp( &buffer[1],tga,8 ) ) return TGA; // --- tga + if ( aComp( &buffer[1],ptga,7 ) ) return TGAPACKED; // --- tga + if ( aComp( buffer,png,8 ) ) return PNG; // --- png + return 0; // --- others +} + +int bpRead( char * fname, txSample * bf ) +{ + int bgr = 0; + int i; + + fname=fExist( fname ); + if ( fname == NULL ) return -2; + switch ( GetFileType( fname ) ) + { + case BMP: + i=bmpRead( fname,bf ); + switch ( i ) + { + case 0: break; + case 3: return -1; + default: return -3; + } + break; + case TGA: + i=tgaRead( fname,bf ); + switch ( i ) + { + case 0: break; + case 3: return -1; + default: return -4; + } + break; + case PNG: + if ( pngRead( fname,bf ) ) return -5; + bgr=1; + break; + case TGAPACKED: + #ifdef DEBUG + dbprintf( 4,"[bitmap] sorry, packed TGA not supported.\n" ); + #endif + return -6; + default: + { + #ifdef DEBUG + dbprintf( 4,"[bitmap] Unknown file type ( %s ).\n",fname ); + #endif + return -7; + } + } + if ( bf->BPP < 24 ) + { + #ifdef DEBUG + dbprintf( 4,"[bitmap] sorry, 16 or less bitmaps not supported.\n" ); + #endif + return -1; + } + if ( conv24to32( bf ) ) return -8; + if ( bgr ) bgr2rgb( bf ); + Normalize( bf ); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/bitmap/bitmap.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,21 @@ + +#ifndef __MYSAMPLE +#define __MYSAMPLE + +typedef struct _txSample +{ + unsigned int Width; + unsigned int Height; + unsigned int BPP; + unsigned long ImageSize; + char * Image; +} txSample; + +#include "tga/tga.h" +#include "bmp/bmp.h" +#include "png/png.h" + +extern int bpRead( char * fname, txSample * bf ); +extern int conv24to32( txSample * bf ); + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/bitmap/bitmap.mak Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,13 @@ + +BITMAPOBJS = \ +bitmap/bitmap.o \ +bitmap/tga/tga.o \ +bitmap/bmp/bmp.o \ +bitmap/png/png.o + + +BITMAPSRCS = \ +bitmap/bitmap.c \ +bitmap/tga/tga.c \ +bitmap/bmp/bmp.c \ +bitmap/png/png.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/bitmap/bmp/bmp.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,113 @@ + +#ifndef __MY_BMP +#define __MY_BMP + +/* + 0.1 : BMP type. + 2.5 : File size. + 6.7 : Res. + 8.9 : Res. + 10.13 : Offset of bitmap. + 14.17 : Header size. + 18.21 : X size. + 22.25 : Y size. + 26.27 : Number of planes. + 28.29 : Number of bits per pixel. + 30.33 : Compression flag. + 34.37 : Image data size in bytes. + 38.41 : Res + 42.45 : Res + 46.49 : Res + 50.53 : Res +*/ + +#include <stdlib.h> +#include <stdio.h> + +#include "bmp.h" +#include "../bitmap.h" +#include "../../error.h" + +int bmpRead( unsigned char * fname,txSample * bF ) +{ + unsigned char bmpHeader[54]; + FILE * BMP; + unsigned long i; + unsigned char * line; + int linesize; + + + if ( (BMP=fopen( fname,"rt" )) == NULL ) + { +#ifdef DEBUG + dbprintf( 4,"[bmp] File not found ( %s ).\n",fname ); +#endif + return 1; + } + if ( (i=fread( bmpHeader,54,1,BMP )) != 1 ) + { +#ifdef DEBUG + dbprintf( 4,"[bmp] Header read error ( %s ).\n",fname ); +#endif + return 2; + } +// memcpy( &bF->Size,&bmpHeader[2],4 ); + memcpy( &bF->Width,&bmpHeader[18],4 ); + memcpy( &bF->Height,&bmpHeader[22],4 ); + memcpy( &bF->BPP,&bmpHeader[28],2 ); +// memcpy( &bF->ImageSize,&bmpHeader[34],4 ); + bF->ImageSize=( bF->Width * bF->Height ) * ( bF->BPP / 8 ); + + if ( bF->BPP < 24 ) + { + #ifdef DEBUG + dbprintf( 4,"[bmp] Sorry, this loader not supported 16 bit or less ...\n" ); + #endif + return 3; + } + +#ifdef DEBUG + dbprintf( 4,"[bmp] filename: %s\n",fname ); + dbprintf( 4,"[bmp] size: %dx%d bits: %d\n",bF->Width,bF->Height,bF->BPP ); + dbprintf( 4,"[bmp] imagesize: %lu\n",bF->ImageSize ); +#endif + + if ( ( bF->Image=malloc( bF->ImageSize ) ) == NULL ) + { + #ifdef DEBUG + dbprintf( 4,"[bmp] Not enough memory for image buffer.\n" ); + #endif + return 4; + } + + if ( (i=fread( bF->Image,bF->ImageSize,1,BMP )) != 1 ) + { + #ifdef DEBUG + dbprintf( 4,"[bmp] Image read error.\n" ); + #endif + return 5; + } + + fclose( BMP ); + + linesize=bF->Width * ( bF->BPP / 8 ); + if ( (line=malloc( linesize )) == NULL ) + { + #ifdef DEBUG + dbprintf( 4,"[bmp] Not enough memory for flipping.\n" ); + #endif + return 6; + } + + for ( i=0;i < bF->Height / 2;i++ ) + { + memcpy( line,&bF->Image[ i * linesize ],linesize ); + memcpy( &bF->Image[ i * linesize ],&bF->Image[ ( bF->Height - i - 1 ) * linesize ],linesize ); + memcpy( &bF->Image[ ( bF->Height - i - 1 ) * linesize ],line,linesize ); + } + free( line ); + + return 0; +} + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/bitmap/bmp/bmp.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,28 @@ + +#ifndef __MY_BMP +#define __MY_BMP + +#include "../bitmap.h" + +/* + 0.1 : BMP type. + 2.5 : File size. + 6.7 : Res. + 8.9 : Res. + 10.13 : Offset of bitmap. + 14.17 : Header size. + 18.21 : X size. + 22.25 : Y size. + 26.27 : Number of planes. + 28.29 : Number of bits per pixel. + 30.33 : Compression flag. + 34.37 : Image data size in bytes. + 38.41 : Res + 42.45 : Res + 46.49 : Res + 50.53 : Res +*/ + +extern int bmpRead( unsigned char * fname,txSample * bF ); + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/bitmap/png/png.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,133 @@ + +#include <stdlib.h> + +#include "./png.h" +#include "../../error.h" +#include <png.h> + +typedef struct +{ + unsigned int Width; + unsigned int Height; + unsigned int Depth; + unsigned int Alpha; + + unsigned int Components; + unsigned char * Data; + unsigned char * Palette; +} pngRawInfo; + +int pngLoadRawF( FILE *fp,pngRawInfo *pinfo ) +{ + unsigned char header[8]; + png_structp png; + png_infop info; + png_infop endinfo; + png_bytep data; + png_bytep * row_p; + png_uint_32 width,height; + int depth,color; + png_uint_32 i; + + if ( !pinfo ) return 1; + + fread( header,1,8,fp ); + if ( !png_check_sig( header,8 ) ) return 1; + + png=png_create_read_struct( PNG_LIBPNG_VER_STRING,NULL,NULL,NULL ); + info=png_create_info_struct( png ); + endinfo=png_create_info_struct( png ); + + png_init_io( png,fp ); + png_set_sig_bytes( png,8 ); + png_read_info( png,info ); + png_get_IHDR( png,info,&width,&height,&depth,&color,NULL,NULL,NULL ); + + pinfo->Width=width; + pinfo->Height=height; + pinfo->Depth=depth; + + data=( png_bytep ) malloc( png_get_rowbytes( png,info )*height ); + row_p=( png_bytep * ) malloc( sizeof( png_bytep )*height ); + for ( i=0; i < height; i++ ) row_p[i]=&data[png_get_rowbytes( png,info )*i]; + + png_read_image( png,row_p ); + free( row_p ); + + if ( color == PNG_COLOR_TYPE_PALETTE ) + { + int cols; + png_get_PLTE( png,info,( png_colorp * ) &pinfo->Palette,&cols ); + } + else pinfo->Palette=NULL; + + if ( color&PNG_COLOR_MASK_ALPHA ) + { + if ( color&PNG_COLOR_MASK_PALETTE || color == PNG_COLOR_TYPE_GRAY_ALPHA ) pinfo->Components=2; + else pinfo->Components=4; + pinfo->Alpha=8; + } + else + { + if ( color&PNG_COLOR_MASK_PALETTE || color == PNG_COLOR_TYPE_GRAY ) pinfo->Components=1; + else pinfo->Components=3; + pinfo->Alpha=0; + } + pinfo->Data=data; + + png_read_end( png,endinfo ); + png_destroy_read_struct( &png,&info,&endinfo ); + + return 0; +} + +int pngLoadRaw( const char * filename,pngRawInfo * pinfo ) +{ + int result; + FILE *fp=fopen( filename,"rb" ); + + if ( !fp ) return 1; + result=pngLoadRawF( fp,pinfo ); + if ( fclose( fp ) != 0 ) + { + if ( result ) + { + free( pinfo->Data ); + free( pinfo->Palette ); + } + return 1; + } + return 0; +} + +int pngRead( unsigned char * fname,txSample * bf ) +{ + pngRawInfo raw; + + if ( pngLoadRaw( fname,&raw ) ) + { + #ifdef DEBUG + dbprintf( 4,"[png] file read error ( %s ).\n",fname ); + #endif + return 1; + } + bf->Width=raw.Width; + bf->Height=raw.Height; + bf->BPP=( raw.Depth * raw.Components ) + raw.Alpha; + bf->ImageSize=bf->Width * bf->Height * ( bf->BPP / 8 ); + if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL ) + { + #ifdef DEBUG + dbprintf( 4,"[png] Not enough memory for image buffer.\n" ); + #endif + return 2; + } + memcpy( bf->Image,raw.Data,bf->ImageSize ); + free( raw.Data ); + #ifdef DEBUG + dbprintf( 4,"[png] filename: %s.\n",fname ); + dbprintf( 4,"[png] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP ); + dbprintf( 4,"[png] imagesize: %lu\n",bf->ImageSize ); + #endif + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/bitmap/png/png.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,9 @@ + +#ifndef __MYPNG +#define __MYPNG + +#include "../bitmap.h" + +extern int pngRead( unsigned char * fname, txSample * bf ); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/bitmap/tga/tga.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,189 @@ + +#include <string.h> +#include <stdio.h> +#include <stdlib.h> + +#include "tga.h" +#include "../../error.h" + +int tgaRead( char * filename,txSample * bf ) +{ + FILE * BMP; + unsigned long i; + char tmp[255]; + unsigned char * line; + int linesize; + char * comment; + tgaHeadert tgaHeader; + + strcpy( tmp,filename ); + if ( !strstr( tmp,".tga" ) ) strcat( tmp,".tga" ); + if ( (BMP=fopen( tmp,"rb" )) == NULL ) + { + #ifdef DEBUG + dbprintf( 4,"[tga] File not found ( %s ).\n",tmp ); + #endif + return 1; + } + if ( (i=fread( &tgaHeader,sizeof( tgaHeader ),1,BMP )) != 1 ) + { + #ifdef DEBUG + dbprintf( 4,"[tga] Header read error ( %s ).\n",tmp ); + #endif + return 2; + } + if ( tgaHeader.depth < 24 ) + { + #ifdef DEBUG + dbprintf( 4,"[tga] Sorry, this loader not supported 16 bit or less ...\n" ); + #endif + return 3; + } + bf->Width=tgaHeader.sx; + bf->Height=tgaHeader.sy; + bf->BPP=tgaHeader.depth; + bf->ImageSize=bf->Width * bf->Height * ( bf->BPP / 8 ); + + if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL ) + { + #ifdef DEBUG + dbprintf( 4,"[tga] Not enough memory for image buffer.\n" ); + #endif + return 4; + } + + comment=NULL; + if ( tgaHeader.tmp[0] != 0 ) + { + if ( ( comment=malloc( tgaHeader.tmp[0] + 1 ) ) == NULL ) + { + #ifdef DEBUG + dbprintf( 4,"[tga] Not enough memory for comment string.\n" ); + #endif + return 5; + } + memset( comment,0,tgaHeader.tmp[0] + 1 ); + if ( fread( comment,tgaHeader.tmp[0],1,BMP ) != 1 ) + { + #ifdef DEBUG + dbprintf( 4,"[tga] Comment read error.\n" ); + #endif + return 6; + } + } + + #ifdef DEBUG + dbprintf( 4,"[tga] filename ( read ): %s\n",tmp ); + dbprintf( 4,"[tga] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP ); + dbprintf( 4,"[tga] imagesize: %lu\n",bf->ImageSize ); + if ( comment ) dbprintf( 4,"[tga] comment: %s\n",comment ); + #endif + + if ( comment ) free( comment ); + + if ( fread( bf->Image,bf->ImageSize,1,BMP ) != 1 ) + { + #ifdef DEBUG + dbprintf( 4,"[tga] Image read error.\n" ); + #endif + return 7; + } + + fclose( BMP ); + + if ( tgaHeader.ctmp == 0 ) + { + linesize=bf->Width * ( bf->BPP / 8 ); + if ( (line=malloc( linesize )) == NULL ) + { + #ifdef DEBUG + dbprintf( 4,"[tga] Not enough memory for flipping.\n" ); + #endif + return 8; + } + + for ( i=0;i < bf->Height / 2;i++ ) + { + memcpy( line,&bf->Image[ i * linesize ],linesize ); + memcpy( &bf->Image[ i * linesize ],&bf->Image[ ( bf->Height - i - 1 ) * linesize ],linesize ); + memcpy( &bf->Image[ ( bf->Height - i - 1 ) * linesize ],line,linesize ); + } + free( line ); + } + + return 0; +} + +char comment[] = "fresh!mindworkz's TGA Filter. v0.1"; + +void tgaWriteTexture( char * filename,txSample * bf ) +{ + FILE * BMP; + int i; + unsigned char * line; + int linesize; + tgaHeadert tgaHeader; + char tmp[255]; + + strcpy( tmp,filename ); + if ( !strstr( tmp,".tga" ) ) strcat( tmp,".tga" ); + if ( ( BMP=fopen( tmp,"wb+" ) ) == NULL ) + { + dbprintf( 0,"[tga] File not open ( %s ).\n",tmp ); + exit( 0 ); + } + memset( &tgaHeader,0,sizeof( tgaHeader ) ); + tgaHeader.sx=bf->Width; + tgaHeader.sy=bf->Height; + tgaHeader.depth=bf->BPP; + tgaHeader.ctmp=0; + tgaHeader.tmp[0]=strlen( comment ); + if ( bf->BPP != 8 ) tgaHeader.tmp[2]=2; + else tgaHeader.tmp[2]=3; + + #ifdef DEBUG + dbprintf( 4,"\n[tga] filename ( write ): %s\n",tmp ); + dbprintf( 4,"[tga] size: %dx%d\n",bf->Width,bf->Height ); + dbprintf( 4,"[tga] bits: %d\n",bf->BPP ); + dbprintf( 4,"[tga] imagesize: %lu\n",bf->ImageSize ); + dbprintf( 4,"[tga] comment: %s\n",comment ); + dbprintf( 4,"\n" ); + #endif + + if ( tgaHeader.ctmp == 0 ) + { + linesize=bf->Width * ( bf->BPP / 8 ); + if ( (line=malloc( linesize )) == NULL ) + { + dbprintf( 0,"[tga] Not enough memory for flipping.\n" ); + exit( 0 ); + } + + for ( i=0;i < bf->Height / 2;i++ ) + { + memcpy( line,&bf->Image[ i * linesize ],linesize ); + memcpy( &bf->Image[ i * linesize ],&bf->Image[ ( bf->Height - i - 1 ) * linesize ],linesize ); + memcpy( &bf->Image[ ( bf->Height - i - 1 ) * linesize ],line,linesize ); + } + free( line ); + } + + fwrite( &tgaHeader,sizeof( tgaHeader ),1,BMP ); + fwrite( comment,strlen( comment ),1,BMP ); + fwrite( bf->Image,bf->ImageSize,1,BMP ); + + fclose( BMP ); +} + +void tgaWriteBuffer( char * fname,unsigned char * Buffer,int sx,int sy,int BPP ) +{ + txSample tmp; + + memset( &tmp,0,sizeof( tmp ) ); + tmp.Width=sx; + tmp.Height=sy; + tmp.BPP=BPP; + tmp.ImageSize=sx * sy * ( BPP / 8 ); + tmp.Image=Buffer; + tgaWriteTexture( fname,&tmp ); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/bitmap/tga/tga.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,21 @@ + +#ifndef _MYTGA +#define _MYTGA + +#include "../bitmap.h" + +typedef struct +{ + char tmp[12]; + unsigned short sx; + unsigned short sy; + unsigned char depth; + unsigned char ctmp; +} tgaHeadert; + +extern int tgaRead( char * filename,txSample * bf ); +extern void tgaWriteBuffer( char * fname,unsigned char * Buffer,int sx,int sy,int BPP ); +extern void tgaWriteTexture( char * filename,txSample * bf ); + + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/config.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,22 @@ + +#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; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/config.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,11 @@ + +#ifndef __MYCONFIG +#define __MYCONFIG + +extern unsigned char * cfgAppName; +extern unsigned char * cfgSkin; + +extern int cfgRead( void ); +extern void cfgDefaults( void ); + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/error.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,61 @@ + +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> + +#include "error.h" + +int debug_level = 6; +FILE * debug_file; +int debug_stderr = 0; + +void defaultErrorHandler( int critical,const char * format, ... ) +{ + char * p; + va_list ap; + + if ( (p=(char *)malloc( 512 ) ) == NULL ) return; + va_start( ap,format ); + vsnprintf( p,512,format,ap ); + va_end( ap ); + fprintf( stderr,"%s",p ); + free( p ); + if ( critical ) exit( 1 ); +} + +void defaultDebugHandler( int critical,const char * format, ... ) +{ + char * p; + va_list ap; + + if ( critical >= debug_level ) return; + if ( (p=(char *)malloc( 512 ) ) == NULL ) return; + va_start( ap,format ); + vsnprintf( p,512,format,ap ); + va_end( ap ); + fprintf( debug_file,"%s",p ); + free( p ); +} + +errorTHandler message = defaultErrorHandler; +errorTHandler dbprintf = defaultDebugHandler; + +void initDebug( char * name ) +{ + if ( name ) + { + if ( ( debug_file=fopen( name,"wt+" ) ) != NULL ) + { + debug_stderr=0; + return; + } + } + debug_file=stderr; + debug_stderr=1; +} +void doneDebug( void ) +{ + if ( !debug_stderr ) fclose( debug_file ); + debug_file=stderr; + debug_stderr=1; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/error.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,21 @@ + +#ifndef _MPLAYER_ERROR_HANDLER +#define _MPLAYER_ERROR_HANDLER + +#define True 1 +#define False 0 + +// 0 - standard message +// 1 - detto +// 2 - events +// 3 - skin reader messages +// 4 - bitmap reader messages +// 5 - signal handling messages +// 6 - gtk messages + +typedef void (*errorTHandler)( int critical,const char * format, ... ); + +extern errorTHandler message; +extern errorTHandler dbprintf; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/events.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,46 @@ + +#include "events.h" + +evName evNames[] = + { + { evNone, "evNone" }, // 1 + { evPlay, "evPlay" }, // 2 + { evStop, "evStop" }, // 3 + { evPause, "evPause" }, // 4 + { evPrev, "evPrev" }, // 7 + { evNext, "evNext" }, // 8 + { evLoad, "evLoad" }, // 9 + { evEqualeaser, "evEqualeaser" }, // 10 + { evPlayList, "evPlaylist" }, // 11 + { evExit, "evExit" }, // 12 + { evPlusVideo, "evPlusVideo" }, // 13 + { evMinusVideo, "evMinusVideo" }, // 14 + { evIconify, "evIconify" }, // 15 + { evPlusBalance, "evPlusBalance" }, // 16 + { evMinusBalance, "evMinusBalance" }, // 17 + { evFullScreen, "evFullScreen" }, // 18 + { evFName, "evFName" }, // 19 + { evMovieTime, "evMovieTime" }, // 20 + { evAbout, "evAbout" }, // 22 + { evLoadPlay, "evLoadPlay" }, // 23 + { evPreferences, "evPreferences" }, // 24 + { evSkinBrowser, "evSkinBrowser" }, // 25 + { evBackward10sec, "evBackward10sec" }, // 26 + { evForward10sec, "evForward10sec" }, // 27 + { evBackward1min, "evBackward1min" }, // 28 + { evForward1min, "evForward1min" }, // 29 + { evIncVolume, "evIncVolume" }, // 30 + { evDecVolume, "evDecVolume" }, // 31 + { evMute, "evMute" }, // 32 + { evIncAudioBufDelay, "evIncAudioBufDelay" }, // 33 + { evDecAudioBufDelay, "evDecAudioBufDelay" }, // 34 + { evPlaySwitchToPause, "evPlaySwitchToPause" }, // 35 + { evPauseSwitchToPlay, "evPauseSwitchToPlay" }, // 36 + { evNormalSize, "evNormalSize" }, // 37 + { evDoubleSize, "evDoubleSize" }, // 38 + { evSetMoviePosition, "evSetMoviePosition" }, // 39 + { evSetVolume, "evSetVolume" }, // 40 + { evSetBalance, "evSetBalance" } // 41 + }; + +const int evBoxs = sizeof( evNames ) / sizeof( evName );
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/events.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,71 @@ + +#ifndef _MYEVENTHANDLER +#define _MYEVENTHANDLER + +// --- User events ------ + +#define evNone 0 +#define evPlay 1 +#define evStop 2 +#define evPause 3 +#define evPrev 6 +#define evNext 7 +#define evLoad 8 +#define evEqualeaser 9 +#define evPlayList 10 +#define evPlusVideo 11 +#define evMinusVideo 12 +#define evIconify 13 +#define evPlusBalance 14 +#define evMinusBalance 15 +#define evFullScreen 16 +#define evAbout 18 +#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 evSetVolume 36 +#define evSetBalance 37 + +#define evExit 1000 + +// --- General events --- + +#define evFileLoaded 5000 +#define evHideMouseCursor 5001 +#define evMessageBox 5002 +#define evGeneralTimer 5003 +#define evGtkIsOk 5004 + +#define evFName 7000 +#define evMovieTime 7001 +#define evRedraw 7002 +#define evHideWindow 7003 +#define evShowWindow 7004 + +// ---------------------- + +typedef struct +{ + int msg; + char * name; +} evName; + +extern int evBoxs; +extern evName evNames[]; + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/gui.mak Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,11 @@ + +SKINSRC = skin/skin.c skin/font.c skin/cut.c +SKINOBJ = skin/skin.o skin/font.o skin/cut.o + +MPLAYERSRCS = $(MPLAYERDIR)mplayer.c $(MPLAYERDIR)widgets.c $(MPLAYERDIR)play.c \ + $(MPLAYERDIR)psignal.c $(MPLAYERDIR)mixer.c +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 shmem.c +OBJS = $(SRCS:.c=.o) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/language.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,43 @@ + +// --- labels --- +char * langAbout = "About"; +char * langFileSelect = "Select file ..."; +char * langMessageBox = "MessageBox"; +char * langPlayList = "PlayList"; +char * langSkinBrowser = "Skin Browser"; + +// --- buttons --- +char * langOk = "Ok"; +char * langCancel = "Cancel"; +char * langAdd = "Add"; +char * langRemove = "Remove"; + +// --- error messages --- +char * langNEMDB = "Sorry, not enough memory for draw buffer."; +char * langNEMFMR = "Sorry, not enough memory for menu rendering."; +char * langNEMFMM = "Sorry, not enough memory for main window shape mask."; +char * langLIRCSNW = "LIRC support not working. Disabled."; +char * langAudioDriverSelectNotSupported = "Your audio driver DOES NOT support select(). Recompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !"; +char * langNotSupportedFileFormat = "Sorry, this file format not recognized/supported. If this file is an AVI, ASF or MPEG stream, please contact the author!"; +char * langCodecConfNotFound = "The codecs.conf config file not found. Please copy/link DOCS/codecs.conf to ~/.mplayer/codecs.conf."; +char * langErrorProcessingDVDKey = "Error processing DVD KEY."; +char * langErrorInDVDAuth = "Error in DVD authentication."; +char * langAVIMissing = "AVI_NI: missing video stream!? contact the author, it may be a bug. :("; +char * langAVIMissingVideoStream = "AVI: missing video stream!? contact the author, it may be a bug. :("; +char * langASFMissingVideoStream = "ASF: missing video stream!? contact the author, it may be a bug. :("; +char * langMPEGEOFNotFound = "MPEG: FATAL: EOF while searching for sequence header."; +char * langCannotAllocateSharedMem = "Cannot allocate shared memory. ( Not enough memory ? )"; +char * langMPEGCannotReadSeqHeader = "MPEG: FATAL: Cannot read sequence header!"; +char * langMPEGBadSeqHeader = "MPEG: Bad sequence header!"; +char * langMPEGCannotReadSeqHeaderExt = "MPEG: FATAL: Cannot read sequence header extension!"; +char * langMPEGBadSeqHeaderExt = "MPEG: Bad sequence header extension!"; +char * langCantFindCodec = "Can't find codec for video format"; +char * langSelectedVideoOutIncompTheCodec = "Sorry, selected video_out device is incompatible with this codec."; +char * langMPCompWithoutDSSupport = "MPlayer was compiled WITHOUT directshow support!"; +char * langDSCodecNotFound = "ERROR: Couldn't open required DirectShow codec: %s. " \ + "Maybe you forget to upgrade your win32 codecs?? It's time to download the new " \ + "package from: ftp://thot.banki.hu/esp-team/linux/MPlayer/w32codec.zip! " \ + "Or you should disable DShow support."; +char * langCantInitVideoDriver = "FATAL: Cannot initialize video driver!"; +char * langUnknowError = "Unknow error. Please contact the developer team."; +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/language.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,44 @@ + +#ifndef __MPLAYER_LANG +#define __MPLAYER_LANG + +// --- labels --- +extern char * langAbout; +extern char * langFileSelect; +extern char * langMessageBox; +extern char * langPlayList; +extern char * langSkinBrowser; + +// --- buttons --- +extern char * langOk; +extern char * langCancel; +extern char * langAdd; +extern char * langRemove; + +// --- error messages --- +extern char * langNEMDB; +extern char * langNEMFMR; +extern char * langNEMFMM; +extern char * langLIRCSNW; +extern char * langAudioDriverSelectNotSupported; +extern char * langNotSupportedFileFormat; +extern char * langCodecConfNotFound; +extern char * langErrorProcessingDVDKey; +extern char * langErrorInDVDAuth; +extern char * langAVIMissing; +extern char * langAVIMissingVideoStream; +extern char * langASFMissingVideoStream; +extern char * langMPEGEOFNotFound; +extern char * langCannotAllocateSharedMem; +extern char * langMPEGCannotReadSeqHeader; +extern char * langMPEGBadSeqHeader; +extern char * langMPEGCannotReadSeqHeaderExt; +extern char * langMPEGBadSeqHeaderExt; +extern char * langCantFindCodec; +extern char * langSelectedVideoOutIncompTheCodec; +extern char * langMPCompWithoutDSSupport; +extern char * langDSCodecNotFound; +extern char * langCantInitVideoDriver; +extern char * langUnknowError; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/Makefile Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,45 @@ + +include ../../config.mak +include ../config.mak + +include ../bitmap/bitmap.mak +include ../gui.mak + +LIB = mplayer + +INCDIR = -I. -I../event -I../wm -I../skin $(GTKINC) + +OPTIMIZE = $(OPTFLAGS) -fomit-frame-pointer \ + -fexpensive-optimizations -malign-double -fschedule-insns2 -mwide-multiply -Wall + +CFLAGS = $(OPTIMIZE) $(INCDIR) $(DEBUG) + +.SUFFIXES: .c .o + +.c.o: + $(CC) -c $(CFLAGS) -o $@ $< + +### TARGETS ### + +default: .depend $(MPLAYEROBJS) + +all: default + +clean: + rm -rf $(MPLAYEROBJS) *.o *~ *.bak .depend + +distclean: clean + +dep: depend + +depend: .depend + +.depend: Makefile ../config.mak ../config.h ../gui.mak ../bitmap/bitmap.mak + $(CC) -MM $(CFLAGS) $(MPLAYERSRCS) 1>.depend + +# +# include dependency files if they exist +# +ifneq ($(wildcard .depend),) +include .depend +endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/gtk/about.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,146 @@ + +#ifndef __WIDGET_ABOUT +#define __WIDGET_ABOUT + +#include "../../language.h" + +GtkWidget * About; +GdkColormap * abColorMap; + +void ab_Ok_released( GtkButton * button,gpointer user_data) +{ + gtk_widget_hide( AboutBox ); + gtkVisibleAboutBox=0; +} + +GtkWidget * create_About( void ) +{ + GtkWidget * frame17; + GtkWidget * frame18; + GtkWidget * frame19; + GtkWidget * frame20; + GtkWidget * hbox7; + GtkWidget * pixmap1; + GtkWidget * vbox8; + GtkWidget * label4; + GtkWidget * hbuttonbox6; + GtkWidget * Ok; + GtkAccelGroup * accel_group; + + GtkStyle * pixmapstyle; + GtkPixmap * pixmapwid; + GdkBitmap * mask; + + accel_group=gtk_accel_group_new(); + + About=gtk_window_new( GTK_WINDOW_DIALOG ); + gtk_widget_set_name( About,langAbout ); + gtk_object_set_data( GTK_OBJECT( About ),langAbout,About ); + gtk_widget_set_usize( About,290,105 ); + GTK_WIDGET_SET_FLAGS( About,GTK_CAN_FOCUS ); + GTK_WIDGET_SET_FLAGS( About,GTK_CAN_DEFAULT ); + gtk_window_set_title( GTK_WINDOW( About ),langAbout ); + gtk_window_set_position( GTK_WINDOW( About ),GTK_WIN_POS_CENTER ); + gtk_window_set_modal( GTK_WINDOW( About ),TRUE ); + gtk_window_set_policy( GTK_WINDOW( About ),FALSE,FALSE,FALSE ); + + frame17=gtk_frame_new( NULL ); + gtk_widget_set_name( frame17,"frame17" ); + gtk_widget_ref( frame17 ); + gtk_object_set_data_full( GTK_OBJECT( About ),"frame17",frame17, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame17 ); + gtk_container_add( GTK_CONTAINER( About ),frame17 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame17 ),GTK_SHADOW_IN ); + + frame18=gtk_frame_new( NULL ); + gtk_widget_set_name( frame18,"frame18" ); + gtk_widget_ref( frame18 ); + gtk_object_set_data_full( GTK_OBJECT( About ),"frame18",frame18, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame18 ); + gtk_container_add( GTK_CONTAINER( frame17 ),frame18 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame18 ),GTK_SHADOW_NONE ); + + frame19=gtk_frame_new( NULL ); + gtk_widget_set_name( frame19,"frame19" ); + gtk_widget_ref( frame19 ); + gtk_object_set_data_full( GTK_OBJECT( About ),"frame19",frame19,( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame19 ); + gtk_container_add( GTK_CONTAINER( frame18 ),frame19 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame19 ),GTK_SHADOW_ETCHED_OUT ); + + frame20=gtk_frame_new( NULL ); + gtk_widget_set_name( frame20,"frame20" ); + gtk_widget_ref( frame20 ); + gtk_object_set_data_full( GTK_OBJECT( About ),"frame20",frame20,( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame20 ); + gtk_container_add( GTK_CONTAINER( frame19 ),frame20 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame20 ),GTK_SHADOW_NONE ); + + hbox7=gtk_hbox_new( FALSE,0 ); + gtk_widget_set_name( hbox7,"hbox7" ); + gtk_widget_ref( hbox7 ); + gtk_object_set_data_full( GTK_OBJECT( About ),"hbox7",hbox7, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hbox7 ); + gtk_container_add( GTK_CONTAINER( frame20 ),hbox7 ); + + pixmapstyle=gtk_widget_get_style( About ); + pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( About->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar **)logo_xpm );pixmap1=gtk_pixmap_new( pixmapwid,mask ); + + gtk_widget_set_name( pixmap1,"pixmap1" ); + gtk_widget_ref( pixmap1 ); + gtk_object_set_data_full( GTK_OBJECT( About ),"pixmap1",pixmap1, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( pixmap1 ); + gtk_box_pack_start( GTK_BOX( hbox7 ),pixmap1,TRUE,TRUE,0 ); + + vbox8=gtk_vbox_new( FALSE,0 ); + gtk_widget_set_name( vbox8,"vbox8" ); + gtk_widget_ref( vbox8 ); + gtk_object_set_data_full( GTK_OBJECT( About ),"vbox8",vbox8, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( vbox8 ); + gtk_box_pack_start( GTK_BOX( hbox7 ),vbox8,TRUE,TRUE,0 ); + + label4=gtk_label_new( "The Movie Player for Linux" ); + gtk_widget_set_name( label4,"label4" ); + gtk_widget_ref( label4 ); + gtk_object_set_data_full( GTK_OBJECT( About ),"label4",label4, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( label4 ); + gtk_box_pack_start( GTK_BOX( vbox8 ),label4,FALSE,FALSE,0 ); + gtk_widget_set_usize( label4,-2,50 ); + gtk_label_set_line_wrap( GTK_LABEL( label4 ),TRUE ); + + hbuttonbox6=gtk_hbutton_box_new(); + gtk_widget_set_name( hbuttonbox6,"hbuttonbox6" ); + gtk_widget_ref( hbuttonbox6 ); + gtk_object_set_data_full( GTK_OBJECT( About ),"hbuttonbox6",hbuttonbox6,( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hbuttonbox6 ); + gtk_box_pack_start( GTK_BOX( vbox8 ),hbuttonbox6,FALSE,FALSE,0 ); + gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox6 ),0 ); + gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox6 ),115,33 ); + + Ok=gtk_button_new_with_label( langOk ); + gtk_widget_set_name( Ok,langOk ); + gtk_widget_ref( Ok ); + gtk_object_set_data_full( GTK_OBJECT( About ),langOk,Ok,( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( Ok ); + gtk_container_add( GTK_CONTAINER( hbuttonbox6 ),Ok ); + gtk_widget_set_usize( Ok,49,32 ); + GTK_WIDGET_SET_FLAGS( Ok,GTK_CAN_DEFAULT ); + gtk_widget_add_accelerator (Ok, "released",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE); + +// gtk_signal_connect( GTK_OBJECT( About ),"destroy",GTK_SIGNAL_FUNC( on_About_destroy ),NULL ); + gtk_signal_connect( GTK_OBJECT( About ),"destroy",GTK_SIGNAL_FUNC( ab_Ok_released ),NULL ); + gtk_signal_connect( GTK_OBJECT( Ok ),"released",GTK_SIGNAL_FUNC( ab_Ok_released ),NULL); + + gtk_window_add_accel_group( GTK_WINDOW( About ),accel_group ); + + gtk_widget_grab_focus( Ok ); + return About; +} + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/gtk/fs.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,659 @@ + +#ifndef __MY_fsFileSelector +#define __MY_fsFileSelector + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <glob.h> +#include <unistd.h> + +#include "../../language.h" + +#ifndef get_current_dir_name + extern char * get_current_dir_name( void ); +#endif + +gchar * fsSelectedFile = NULL; +gchar * fsSelectedDirectory = NULL; +unsigned char * fsThatDir = "."; +gchar * fsFilter = NULL; + +int fsPressed = 0; +int fsLastFilterNames = 2; +unsigned char * fsFilterNames[3][2] = { { "MPEG files( *.mpg )", "*.mpg" }, + { "AVI files( *.avi )", "*.avi" }, + { "All files( *)", "*" } }; + +GtkWidget * fsFileNamesList; +GtkWidget * fsFNameList; +GtkWidget * fsFileSelect; +GdkColormap * fsColorMap; +GtkWidget * fsOk; +GtkWidget * fsUp; +GtkWidget * fsCancel; +GtkWidget * fsCombo4; +GtkWidget * fsComboEntry2; +GList * fsList_items = NULL; +GList * fsTopList_items = NULL; + +GtkWidget * fsItemList[6]; +int fsItemListCounter = 0; + +void CheckDir( GtkWidget * list,unsigned char * directory ) +{ + struct stat fs; + int i,c=2; + gchar * str[1][2]; + GdkPixmap * dpixmap,*fpixmap,*pixmap; + GdkBitmap * dmask,*fmask,*mask; + GtkStyle * style; + glob_t gg; + + gtk_widget_hide( list ); + str[0][0]=NULL; + style=gtk_widget_get_style( fsFileSelect ); + dpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&dmask,&style->bg[GTK_STATE_NORMAL],(gchar **)dir_xpm ); + fpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&fmask,&style->bg[GTK_STATE_NORMAL],(gchar **)file_xpm ); + pixmap=dpixmap; mask=dmask; + str[0][0]=NULL; str[0][1]=(gchar *)malloc( 3 ); + strcpy( str[0][1],"." ); + gtk_clist_append( GTK_CLIST( list ),str[0] ); gtk_clist_set_pixmap( GTK_CLIST( list ),0,0,pixmap,mask ); + strcpy( str[0][1],".." ); + gtk_clist_append( GTK_CLIST( list ),str[0] ); gtk_clist_set_pixmap( GTK_CLIST( list ),1,0,pixmap,mask ); + free( str[0][0] ); + + glob( "*",GLOB_NOSORT,NULL,&gg ); +// glob( ".*",GLOB_NOSORT | GLOB_APPEND,NULL,&gg ); + for( i=0;i<gg.gl_pathc;i++ ) + { + if( !strcmp( gg.gl_pathv[i],"." ) || !strcmp( gg.gl_pathv[i],".." ) ) continue; + stat( gg.gl_pathv[i],&fs ); + if( S_ISDIR( fs.st_mode ) ) + { + str[0][1]=(gchar *)malloc( strlen( gg.gl_pathv[i] ) + 2 ); + strcpy( str[0][1],"" ); + strcat( str[0][1],gg.gl_pathv[i] ); + pixmap=dpixmap; mask=dmask; + gtk_clist_append( GTK_CLIST( list ),str[0] ); + gtk_clist_set_pixmap( GTK_CLIST( list ),c,0,pixmap,mask ); + free( str[0][1] ); + c++; + } + } + globfree( &gg ); + glob( fsFilter,GLOB_NOSORT,NULL,&gg ); +// glob( ".*",GLOB_NOSORT | GLOB_APPEND,NULL,&gg ); + pixmap=fpixmap; mask=fmask; + for( i=0;i<gg.gl_pathc;i++ ) + { + if( !strcmp( gg.gl_pathv[i],"." ) || !strcmp( gg.gl_pathv[i],".." ) ) continue; + stat( gg.gl_pathv[i],&fs ); + if( S_ISDIR( fs.st_mode ) ) continue; + str[0][1]=(gchar *)malloc( strlen( gg.gl_pathv[i] ) + 2 ); + strcpy( str[0][1],"" ); strcat( str[0][1],gg.gl_pathv[i] ); + gtk_clist_append( GTK_CLIST( list ),str[0] ); + gtk_clist_set_pixmap( GTK_CLIST( list ),c,0,pixmap,mask ); + free( str[0][1] ); + c++; + } + globfree( &gg ); + + gtk_clist_set_sort_type( GTK_CLIST( list ),GTK_SORT_ASCENDING ); + gtk_clist_set_compare_func( GTK_CLIST( list ),NULL ); + gtk_clist_set_sort_column( GTK_CLIST( list ),1 ); + gtk_clist_sort( GTK_CLIST( list ) ); + gtk_clist_set_column_width( GTK_CLIST( list ),0,17 ); + gtk_clist_select_row( GTK_CLIST( list ),0,1 ); + gtk_widget_show( list ); +} + +void HideFileSelect( void ) +{ + gtk_widget_hide( fsFileSelect ); + gtkVisibleFileSelect=0; + gtkShMem->vs.window=evLoad; + gtkSendMessage( evHideWindow ); +} + +void fs_fsFileSelect_destroy( GtkObject * object,gpointer user_data ) +{ HideFileSelect(); } + +void fs_combo_entry1_activate( GtkEditable * editable,gpointer user_data ) +{ + unsigned char * str; + + str=gtk_entry_get_text( GTK_ENTRY(user_data ) ); + gtk_clist_clear( GTK_CLIST( fsFNameList ) ); + if( fsFilter ) free( fsFilter ); + if( ( fsFilter=(unsigned char *)malloc( strlen( str ) + 1 ) ) == NULL ) + { + dbprintf( 0,"[gtk] not enough memory.\n" ); + exit( 0 ); + } + strcpy( fsFilter,str ); + CheckDir( fsFNameList,(unsigned char *)get_current_dir_name() ); +} + +void fs_combo_entry1_changed( GtkEditable * editable,gpointer user_data ) +{ + unsigned char * str; + int i; + + str=gtk_entry_get_text( GTK_ENTRY(user_data ) ); + + for( i=0;i<fsLastFilterNames+1;i++ ) + { + if( !strcmp( str,fsFilterNames[i][0] ) ) + { + if( fsFilter ) free( fsFilter ); + if( ( fsFilter=(unsigned char *)malloc( 6 ) ) == NULL ) + { + dbprintf( 0,"[gtk] not enough memory.\n" ); + exit( 0 ); + } + strcpy( fsFilter,fsFilterNames[i][1] ); + } + } + gtk_clist_clear( GTK_CLIST( fsFNameList ) ); + CheckDir( fsFNameList,(unsigned char *)get_current_dir_name() ); +} + +void fs_fsComboEntry2_activate( GtkEditable * editable,gpointer user_data ) +{ + unsigned char * str; + + str=gtk_entry_get_text( GTK_ENTRY( user_data ) ); + if ( chdir( str ) != -1 ) + { + gtk_clist_clear( GTK_CLIST( fsFNameList ) ); + CheckDir( fsFNameList,(unsigned char *)get_current_dir_name() ); + } +} + +void fs_fsComboEntry2_changed( GtkEditable * editable,gpointer user_data ) +{ + unsigned char * str; + + str=gtk_entry_get_text( GTK_ENTRY( user_data ) ); + fsPressed=2; +// if ( +// tmp=(unsigned char *)malloc( strlen( fsSelectedDirectory ) + 5 ); +// strcpy( tmp,fsSelectedDirectory ); strcat( tmp,"/*" ); +// fprintf( stderr,"str: %s\n",tmp ); +// free( tmp ); + if ( chdir( str ) != -1 ) + { + gtk_clist_clear( GTK_CLIST( fsFNameList ) ); + CheckDir( fsFNameList,(unsigned char *)get_current_dir_name() ); + } +} + +void fs_Up_released( GtkButton * button,gpointer user_data ) +{ + chdir( ".." ); + fsSelectedFile=fsThatDir; + gtk_clist_clear( GTK_CLIST( user_data ) ); + CheckDir( fsFNameList,(unsigned char *)get_current_dir_name() ); + gtk_entry_set_text( GTK_ENTRY( fsComboEntry2 ),(unsigned char *)get_current_dir_name() ); + return; +} + +int fsFileExist( unsigned char * fname ) +{ + FILE * f = fopen( fname,"r" ); + if ( f == NULL ) return 0; + fclose( f ); + return 1; +} + +void fs_Ok_released( GtkButton * button,gpointer user_data ) +{ + unsigned char * str; + GList * item; + int size,j,i = 1; + struct stat fs; + + stat( fsSelectedFile,&fs ); + if( S_ISDIR(fs.st_mode ) ) + { + chdir( fsSelectedFile ); + fsSelectedFile=fsThatDir; + if( fsFNameList != NULL ) gtk_clist_clear( GTK_CLIST( fsFNameList ) ); + CheckDir( fsFNameList,(unsigned char *)get_current_dir_name() ); + gtk_entry_set_text( GTK_ENTRY( fsComboEntry2 ),(unsigned char *)get_current_dir_name() ); + return; + } + + HideFileSelect(); + + switch( fsPressed ) + { + case 1: + fsSelectedDirectory=(unsigned char *)get_current_dir_name(); + #ifdef DEBUG + dbprintf( 1,"[gtk-fs] fsSelectedFile: %s\n",fsSelectedFile ); + #endif + break; + case 2: + str=gtk_entry_get_text( GTK_ENTRY( fsComboEntry2 ) ); + fsSelectedFile=str; + #ifdef DEBUG + dbprintf( 1,"[gtk-fs] fsSelectedFile: %s\n",fsSelectedFile ); + #endif + if ( !fsFileExist( fsSelectedFile ) ) return; + fsSelectedDirectory=fsSelectedFile; + size=strlen( fsSelectedDirectory ); + for ( j=0;j<size;j++ ) + { + if ( fsSelectedDirectory[ size - j ] == '/' ) + { + fsSelectedFile+=size - j + 1; + fsSelectedDirectory[ size - j ]=0; + break; + } + } + break; + } + strcpy( gtkShMem->fs.dir,fsSelectedDirectory ); + strcpy( gtkShMem->fs.filename,fsSelectedFile ); + item=fsTopList_items; + while( item ) + { + if ( !strcmp( item->data,fsSelectedDirectory ) ) i=0; + item=item->next; + } + if ( i ) + { + fsTopList_items=g_list_prepend( fsTopList_items,(gchar *)get_current_dir_name() ); + gtk_combo_set_popdown_strings( GTK_COMBO( user_data ),fsTopList_items ); + } + gtkSendMessage( evFileLoaded ); +} + +void fs_Cancel_released( GtkButton * button,gpointer user_data ) +{ HideFileSelect(); } + +void fs_fsFNameList_select_row( GtkWidget * widget,gint row,gint column,GdkEventButton *bevent,gpointer user_data ) +{ + gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile ); fsSelectedFile++; + fsPressed=1; + if( !bevent ) return; + if( bevent->type == GDK_2BUTTON_PRESS ) gtk_button_released( GTK_BUTTON( fsOk ) ); +} + +int fsShift = False; + +gboolean on_FileSelect_key_release_event( GtkWidget * widget,GdkEventKey * event,gpointer user_data ) +{ + switch ( event->keyval ) + { + case GDK_Escape: + if ( !fsShift ) gtk_button_released( GTK_BUTTON( fsCancel ) ); + break; + case GDK_Return: + if ( !fsShift ) gtk_button_released( GTK_BUTTON( fsOk ) ); + break; + case GDK_BackSpace: + if ( !fsShift ) gtk_button_released( GTK_BUTTON( fsUp ) ); + break; + case GDK_Tab: + if ( fsShift ) + { + fsItemListCounter--; + if ( fsItemListCounter < 0 ) fsItemListCounter=5; + } + else + { + fsItemListCounter++; + if ( fsItemListCounter > 5 ) fsItemListCounter=0; + } + gtk_widget_grab_focus( fsItemList[fsItemListCounter] ); + break; + case GDK_Shift_L: + case GDK_Shift_R: + fsShift=False; + break; + } + return FALSE; +} + +gboolean on_FileSelect_key_press_event( GtkWidget * widget,GdkEventKey * event,gpointer user_data ) +{ + switch ( event->keyval ) + { + case GDK_Shift_L: + case GDK_Shift_R: + fsShift=True; + break; + } + return FALSE; +} + +GtkWidget * create_FileSelect( void ) +{ + GtkWidget * FSFrame; + GtkWidget * frame2; + GtkWidget * frame3; + GtkWidget * frame4; + GtkWidget * vbox4; + GtkWidget * hbox4; + GtkWidget * vseparator1; + GtkWidget * hseparator1; + GtkWidget * hbox6; + GtkWidget * fsFNameListWindow; + GtkWidget * label1; + GtkWidget * hseparator2; + GtkWidget * List; + GtkWidget * combo_entry1; + GtkWidget * hseparator3; + GtkWidget * hbuttonbox3; + int i; + +// GtkWidget * okpixmapwid,*uppixmapwid,*cancelpixmapwid; +// GdkPixmap * okpixmap,*uppixmap,*cancelpixmap; +// GdkBitmap * okmask,*upmask,*cancelmask; +// GtkStyle * okstyle,*upstyle,*cancelstyle; + + GtkWidget * uppixmapwid; + GdkPixmap * uppixmap; + GdkBitmap * upmask; + GtkStyle * upstyle; + + if( ( fsFilter=(unsigned char *)malloc( 3 ) ) == NULL ) + { + dbprintf( 0,"[gtk] not enough memory.\n" ); + exit( 0 ); + } + strcpy( fsFilter,"*" ); + + fsFileSelect=gtk_window_new( GTK_WINDOW_DIALOG ); + gtk_widget_set_name( fsFileSelect,"fsFileSelect" ); + gtk_object_set_data( GTK_OBJECT( fsFileSelect ),"fsFileSelect",fsFileSelect ); + gtk_widget_set_usize( fsFileSelect,416,256 ); + GTK_WIDGET_SET_FLAGS( fsFileSelect,GTK_CAN_FOCUS ); + GTK_WIDGET_SET_FLAGS( fsFileSelect,GTK_CAN_DEFAULT ); + gtk_widget_set_events( fsFileSelect,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK ); + gtk_window_set_title( GTK_WINDOW( fsFileSelect ),langFileSelect ); + gtk_window_set_position( GTK_WINDOW( fsFileSelect ),GTK_WIN_POS_CENTER ); + gtk_window_set_policy( GTK_WINDOW( fsFileSelect ),FALSE,FALSE,TRUE ); + fsColorMap=gdk_colormap_get_system(); + + FSFrame=gtk_frame_new( NULL ); + gtk_widget_set_name( FSFrame,"FSFrame" ); + gtk_widget_ref( FSFrame ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"FSFrame",FSFrame, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( FSFrame ); + gtk_container_add( GTK_CONTAINER( fsFileSelect ),FSFrame ); + gtk_container_set_border_width( GTK_CONTAINER( FSFrame ),1 ); + gtk_frame_set_shadow_type( GTK_FRAME( FSFrame ),GTK_SHADOW_IN ); + + frame2=gtk_frame_new( NULL ); + gtk_widget_set_name( frame2,"frame2" ); + gtk_widget_ref( frame2 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"frame2",frame2, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame2 ); + gtk_container_add( GTK_CONTAINER( FSFrame ),frame2 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame2 ),GTK_SHADOW_NONE ); + + frame3=gtk_frame_new( NULL ); + gtk_widget_set_name( frame3,"frame3" ); + gtk_widget_ref( frame3 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"frame3",frame3, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame3 ); + gtk_container_add( GTK_CONTAINER( frame2 ),frame3 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame3 ),GTK_SHADOW_ETCHED_OUT ); + + frame4=gtk_frame_new( NULL ); + gtk_widget_set_name( frame4,"frame4" ); + gtk_widget_ref( frame4 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"frame4",frame4, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame4 ); + gtk_container_add( GTK_CONTAINER( frame3 ),frame4 ); + gtk_container_set_border_width( GTK_CONTAINER( frame4 ),1 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame4 ),GTK_SHADOW_NONE ); + + vbox4=gtk_vbox_new( FALSE,0 ); + gtk_widget_set_name( vbox4,"vbox4" ); + gtk_widget_ref( vbox4 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"vbox4",vbox4, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( vbox4 ); + gtk_container_add( GTK_CONTAINER( frame4 ),vbox4 ); + + hbox4=gtk_hbox_new( FALSE,0 ); + gtk_widget_set_name( hbox4,"hbox4" ); + gtk_widget_ref( hbox4 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"hbox4",hbox4, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hbox4 ); + gtk_box_pack_start( GTK_BOX( vbox4 ),hbox4,TRUE,TRUE,0 ); + + fsCombo4=gtk_combo_new(); + gtk_widget_set_name( fsCombo4,"fsCombo4" ); + gtk_widget_ref( fsCombo4 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"fsCombo4",fsCombo4, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( fsCombo4 ); + gtk_box_pack_start( GTK_BOX( hbox4 ),fsCombo4,TRUE,TRUE,0 ); + gtk_widget_set_usize( fsCombo4,-2,20 ); + + fsTopList_items=g_list_append( fsTopList_items,(gchar *)get_current_dir_name() ); + if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) ); + fsTopList_items=g_list_append( fsTopList_items,"/home" ); + fsTopList_items=g_list_append( fsTopList_items,"/mnt" ); + fsTopList_items=g_list_append( fsTopList_items,"/" ); + gtk_combo_set_popdown_strings( GTK_COMBO( fsCombo4 ),fsTopList_items ); + + fsComboEntry2=GTK_COMBO( fsCombo4 )->entry; + gtk_widget_set_name( fsComboEntry2,"fsComboEntry2" ); + gtk_widget_ref( fsComboEntry2 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"fsComboEntry2",fsComboEntry2,( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( fsComboEntry2 ); + gtk_widget_set_usize( fsComboEntry2,-2,20 ); + + vseparator1=gtk_vseparator_new(); + gtk_widget_set_name( vseparator1,"vseparator1" ); + gtk_widget_ref( vseparator1 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"vseparator1",vseparator1, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( vseparator1 ); + gtk_box_pack_start( GTK_BOX( hbox4 ),vseparator1,FALSE,TRUE,0 ); + gtk_widget_set_usize( vseparator1,7,20 ); + + upstyle=gtk_widget_get_style( fsFileSelect ); + uppixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&upmask,&upstyle->bg[GTK_STATE_NORMAL],(gchar **)up_xpm ); + uppixmapwid=gtk_pixmap_new( uppixmap,upmask ); + gtk_widget_show( uppixmapwid ); + + fsUp=gtk_button_new(); + gtk_container_add( GTK_CONTAINER(fsUp ),uppixmapwid ); + gtk_widget_show( fsUp ); + gtk_box_pack_start( GTK_BOX( hbox4 ),fsUp,FALSE,FALSE,0 ); + gtk_widget_set_usize( fsUp,65,15 ); + + hseparator1=gtk_hseparator_new(); + gtk_widget_set_name( hseparator1,"hseparator1" ); + gtk_widget_ref( hseparator1 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"hseparator1",hseparator1, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hseparator1 ); + gtk_box_pack_start( GTK_BOX( vbox4 ),hseparator1,FALSE,TRUE,0 ); + gtk_widget_set_usize( hseparator1,-2,8 ); + + hbox6=gtk_hbox_new( FALSE,0 ); + gtk_widget_set_name( hbox6,"hbox6" ); + gtk_widget_ref( hbox6 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"hbox6",hbox6, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hbox6 ); + gtk_box_pack_start( GTK_BOX( vbox4 ),hbox6,TRUE,TRUE,0 ); + + fsFNameListWindow=gtk_scrolled_window_new( NULL,NULL ); + gtk_widget_set_name( fsFNameListWindow,"fsFNameListWindow" ); + gtk_widget_ref( fsFNameListWindow ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"fsFNameListWindow",fsFNameListWindow, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( fsFNameListWindow ); + gtk_box_pack_start( GTK_BOX( hbox6 ),fsFNameListWindow,TRUE,TRUE,0 ); + gtk_widget_set_usize( fsFNameListWindow,-2,145 ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( fsFNameListWindow ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC ); + + fsFNameList=gtk_clist_new( 2 ); + gtk_widget_set_name( fsFNameList,"fsFNameList" ); + gtk_widget_ref( fsFNameList ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"fsFNameList",fsFNameList, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_container_add( GTK_CONTAINER( fsFNameListWindow ),fsFNameList ); + gtk_clist_set_column_width( GTK_CLIST( fsFNameList ),0,80 ); + gtk_clist_set_selection_mode( GTK_CLIST( fsFNameList ),GTK_SELECTION_BROWSE ); + gtk_clist_column_titles_hide( GTK_CLIST( fsFNameList ) ); + gtk_clist_set_shadow_type( GTK_CLIST( fsFNameList ),GTK_SHADOW_ETCHED_OUT ); + CheckDir( fsFNameList,(unsigned char *)get_current_dir_name() ); + + label1=gtk_label_new( "label1" ); + gtk_widget_set_name( label1,"label1" ); + gtk_widget_ref( label1 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"label1",label1, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( label1 ); + gtk_clist_set_column_widget( GTK_CLIST( fsFNameList ),0,label1 ); + + hseparator2=gtk_hseparator_new(); + gtk_widget_set_name( hseparator2,"hseparator2" ); + gtk_widget_ref( hseparator2 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"hseparator2",hseparator2, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hseparator2 ); + gtk_box_pack_start( GTK_BOX( vbox4 ),hseparator2,FALSE,TRUE,0 ); + gtk_widget_set_usize( hseparator2,-2,9 ); + + List=gtk_combo_new(); + gtk_widget_set_name( List,"List" ); + gtk_widget_ref( List ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"List",List, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( List ); + gtk_box_pack_start( GTK_BOX( vbox4 ),List,FALSE,FALSE,0 ); + gtk_widget_set_usize( List,-2,20 ); + fsList_items=NULL; + for( i=0;i<fsLastFilterNames + 1;i++ ) + fsList_items=g_list_append( fsList_items,fsFilterNames[i][0] ); + gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); + g_list_free( fsList_items ); + + combo_entry1=GTK_COMBO( List )->entry; + gtk_widget_set_name( combo_entry1,"combo_entry1" ); + gtk_widget_ref( combo_entry1 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"combo_entry1",combo_entry1, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( combo_entry1 ); + gtk_entry_set_text( GTK_ENTRY( combo_entry1 ),fsFilterNames[fsLastFilterNames][0] ); + + hseparator3=gtk_hseparator_new(); + gtk_widget_set_name( hseparator3,"hseparator3" ); + gtk_widget_ref( hseparator3 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"hseparator3",hseparator3, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hseparator3 ); + gtk_box_pack_start( GTK_BOX( vbox4 ),hseparator3,FALSE,TRUE,0 ); + gtk_widget_set_usize( hseparator3,-2,7 ); + + hbuttonbox3=gtk_hbutton_box_new(); + gtk_widget_set_name( hbuttonbox3,"hbuttonbox3" ); + gtk_widget_ref( hbuttonbox3 ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"hbuttonbox3",hbuttonbox3, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hbuttonbox3 ); + gtk_box_pack_start( GTK_BOX( vbox4 ),hbuttonbox3,FALSE,TRUE,0 ); + gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox3 ),GTK_BUTTONBOX_END ); + gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox3 ),10 ); + gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox3 ),85,20 ); + gtk_button_box_set_child_ipadding( GTK_BUTTON_BOX( hbuttonbox3 ),0,0 ); + +// okstyle=gtk_widget_get_style( fsFileSelect ); +// okpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&okmask,&okstyle->bg[GTK_STATE_NORMAL],(gchar **)ok_xpm ); +// okpixmapwid=gtk_pixmap_new( okpixmap,okmask ); +// gtk_widget_show( okpixmapwid ); +// fsOk=gtk_button_new(); +// gtk_container_add( GTK_CONTAINER(fsOk ),okpixmapwid ); +// gtk_container_add( GTK_CONTAINER( hbuttonbox3 ),fsOk ); +// gtk_widget_show( fsOk ); + + fsOk=gtk_button_new_with_label( langOk ); + gtk_widget_set_name( fsOk,langOk ); + gtk_widget_ref( fsOk ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),langOk,fsOk,( GtkDestroyNotify )gtk_widget_unref ); + gtk_container_add( GTK_CONTAINER( hbuttonbox3 ),fsOk ); + gtk_widget_show( fsOk ); + +// cancelstyle=gtk_widget_get_style( fsFileSelect ); +// cancelpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&cancelmask,&cancelstyle->bg[GTK_STATE_NORMAL],(gchar **)cancel_xpm ); +// cancelpixmapwid=gtk_pixmap_new( cancelpixmap,cancelmask ); +// gtk_widget_show( cancelpixmapwid ); +// fsCancel=gtk_button_new(); +// gtk_widget_show( fsCancel ); +// gtk_container_add( GTK_CONTAINER( fsCancel ),cancelpixmapwid ); +// gtk_container_add( GTK_CONTAINER( hbuttonbox3 ),fsCancel ); +// gtk_widget_show( fsCancel ); + + fsCancel=gtk_button_new_with_label( langCancel ); + gtk_widget_set_name( fsCancel,langCancel ); + gtk_widget_ref( fsCancel ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),langCancel,fsCancel,( GtkDestroyNotify )gtk_widget_unref ); + gtk_container_add( GTK_CONTAINER( hbuttonbox3 ),fsCancel ); + gtk_widget_show( fsCancel ); + + gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"destroy", + GTK_SIGNAL_FUNC( fs_fsFileSelect_destroy ), + NULL ); + gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"key_release_event", + GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ), + NULL ); + gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"key_press_event", + GTK_SIGNAL_FUNC( on_FileSelect_key_press_event ), + NULL ); + gtk_signal_connect( GTK_OBJECT( combo_entry1 ),"changed", + GTK_SIGNAL_FUNC( fs_combo_entry1_changed ), + combo_entry1 ); + gtk_signal_connect( GTK_OBJECT( combo_entry1 ),"activate", + GTK_SIGNAL_FUNC( fs_combo_entry1_activate ), + combo_entry1 ); + gtk_signal_connect( GTK_OBJECT( fsComboEntry2 ),"changed", + GTK_SIGNAL_FUNC( fs_fsComboEntry2_changed ), + fsComboEntry2 ); + gtk_signal_connect( GTK_OBJECT( fsComboEntry2 ),"activate", + GTK_SIGNAL_FUNC( fs_fsComboEntry2_activate ), + fsComboEntry2 ); + gtk_signal_connect( GTK_OBJECT( fsUp ),"released", + GTK_SIGNAL_FUNC( fs_Up_released ), + fsFNameList ); + gtk_signal_connect( GTK_OBJECT( fsOk ),"released", + GTK_SIGNAL_FUNC( fs_Ok_released ), + fsCombo4 ); + gtk_signal_connect( GTK_OBJECT( fsCancel ),"released", + GTK_SIGNAL_FUNC( fs_Cancel_released ), + NULL ); + + gtk_signal_connect( GTK_OBJECT( fsFNameList ),"select_row", + ( GtkSignalFunc ) fs_fsFNameList_select_row, + NULL ); + + gtk_widget_grab_focus( fsFNameList ); + + fsItemList[0]=fsFNameList; + fsItemList[1]=combo_entry1; + fsItemList[2]=fsOk; + fsItemList[3]=fsCancel; + fsItemList[4]=fsUp; + fsItemList[5]=fsComboEntry2; + + return fsFileSelect; +} + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/gtk/mb.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,160 @@ + +#ifndef __MY_MESSAGEBOX +#define __MY_MESSAGEBOX + +#include "../../language.h" + +GtkWidget * gtkMessageBoxText; + +void on_MessageBox_destroy( GtkObject * object,gpointer user_data ) +{ + gtk_widget_hide( MessageBox ); + gtkVisibleMessageBox=0; +} + +void on_Ok_released( GtkButton * button,gpointer user_data ) +{ + gtk_widget_hide( MessageBox ); + gtkVisibleMessageBox=0; + gtkSendMessage( evMessageBox ); +} + +GtkWidget * create_MessageBox( void ) +{ + GtkWidget *MessageBox; + GtkWidget *frame1; + GtkWidget *frame2; + GtkWidget *frame3; + GtkWidget *frame4; + GtkWidget *vbox1; + GtkWidget *vbox2; + GtkWidget *hseparator1; + GtkWidget *hbuttonbox1; + GtkWidget *Ok; + GtkAccelGroup *accel_group; + + accel_group=gtk_accel_group_new(); + + MessageBox=gtk_window_new( GTK_WINDOW_DIALOG ); + gtk_widget_set_name( MessageBox,langMessageBox ); + gtk_object_set_data( GTK_OBJECT( MessageBox ),langMessageBox,MessageBox ); + gtk_widget_set_usize( MessageBox,420,128 ); + GTK_WIDGET_SET_FLAGS( MessageBox,GTK_CAN_FOCUS ); + GTK_WIDGET_SET_FLAGS( MessageBox,GTK_CAN_DEFAULT ); + gtk_widget_set_events( MessageBox,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK ); + gtk_window_set_title( GTK_WINDOW( MessageBox ),langMessageBox ); + gtk_window_set_position( GTK_WINDOW( MessageBox ),GTK_WIN_POS_CENTER ); + gtk_window_set_modal( GTK_WINDOW( MessageBox ),TRUE ); + gtk_window_set_policy( GTK_WINDOW( MessageBox ),FALSE,FALSE,FALSE ); + gtk_window_set_wmclass( GTK_WINDOW( MessageBox ),langMessageBox,langMessageBox ); + + frame1=gtk_frame_new( NULL ); + gtk_widget_set_name( frame1,"frame1" ); + gtk_widget_ref( frame1 ); + gtk_object_set_data_full( GTK_OBJECT( MessageBox ),"frame1",frame1, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame1 ); + gtk_container_add( GTK_CONTAINER( MessageBox ),frame1 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame1 ),GTK_SHADOW_IN ); + + frame2=gtk_frame_new( NULL ); + gtk_widget_set_name( frame2,"frame2" ); + gtk_widget_ref( frame2 ); + gtk_object_set_data_full( GTK_OBJECT( MessageBox ),"frame2",frame2, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame2 ); + gtk_container_add( GTK_CONTAINER( frame1 ),frame2 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame2 ),GTK_SHADOW_NONE ); + + frame3=gtk_frame_new( NULL ); + gtk_widget_set_name( frame3,"frame3" ); + gtk_widget_ref( frame3 ); + gtk_object_set_data_full( GTK_OBJECT( MessageBox ),"frame3",frame3, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame3 ); + gtk_container_add( GTK_CONTAINER( frame2 ),frame3 ); + + frame4=gtk_frame_new( NULL ); + gtk_widget_set_name( frame4,"frame4" ); + gtk_widget_ref( frame4 ); + gtk_object_set_data_full( GTK_OBJECT( MessageBox ),"frame4",frame4, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame4 ); + gtk_container_add( GTK_CONTAINER( frame3 ),frame4 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame4 ),GTK_SHADOW_NONE ); + + vbox1=gtk_vbox_new( FALSE,0 ); + gtk_widget_set_name( vbox1,"vbox1" ); + gtk_widget_ref( vbox1 ); + gtk_object_set_data_full( GTK_OBJECT( MessageBox ),"vbox1",vbox1, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( vbox1 ); + gtk_container_add( GTK_CONTAINER( frame4 ),vbox1 ); + + vbox2=gtk_vbox_new( FALSE,0 ); + gtk_widget_set_name( vbox2,"vbox2" ); + gtk_widget_ref( vbox2 ); + gtk_object_set_data_full( GTK_OBJECT( MessageBox ),"vbox2",vbox2, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( vbox2 ); + gtk_box_pack_start( GTK_BOX( vbox1 ),vbox2,TRUE,FALSE,0 ); + + gtkMessageBoxText=gtk_label_new( "Ez." ); + gtk_widget_set_name( gtkMessageBoxText,"gtkMessageBoxText" ); + gtk_widget_ref( gtkMessageBoxText ); + gtk_object_set_data_full( GTK_OBJECT( MessageBox ),"gtkMessageBoxText",gtkMessageBoxText, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( gtkMessageBoxText ); + gtk_box_pack_start( GTK_BOX( vbox2 ),gtkMessageBoxText,FALSE,FALSE,0 ); +// gtk_widget_set_usize( gtkMessageBoxText,-2,77 ); + gtk_widget_set_usize( gtkMessageBoxText,384,77 ); + gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_FILL ); + gtk_label_set_line_wrap( GTK_LABEL( gtkMessageBoxText ),TRUE ); + + hseparator1=gtk_hseparator_new(); + gtk_widget_set_name( hseparator1,"hseparator1" ); + gtk_widget_ref( hseparator1 ); + gtk_object_set_data_full( GTK_OBJECT( MessageBox ),"hseparator1",hseparator1, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hseparator1 ); + gtk_box_pack_start( GTK_BOX( vbox2 ),hseparator1,TRUE,TRUE,0 ); + + hbuttonbox1=gtk_hbutton_box_new(); + gtk_widget_set_name( hbuttonbox1,"hbuttonbox1" ); + gtk_widget_ref( hbuttonbox1 ); + gtk_object_set_data_full( GTK_OBJECT( MessageBox ),"hbuttonbox1",hbuttonbox1, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hbuttonbox1 ); + gtk_box_pack_start( GTK_BOX( vbox1 ),hbuttonbox1,FALSE,FALSE,0 ); + GTK_WIDGET_SET_FLAGS( hbuttonbox1,GTK_CAN_FOCUS ); + GTK_WIDGET_SET_FLAGS( hbuttonbox1,GTK_CAN_DEFAULT ); + gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),0 ); + gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox1 ),60,0 ); + gtk_button_box_set_child_ipadding( GTK_BUTTON_BOX( hbuttonbox1 ),10,0 ); + + Ok=gtk_button_new_with_label( langOk ); + gtk_widget_set_name( Ok,langOk ); + gtk_widget_ref( Ok ); + gtk_object_set_data_full( GTK_OBJECT( MessageBox ),langOk,Ok, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( Ok ); + gtk_container_add( GTK_CONTAINER( hbuttonbox1 ),Ok ); + gtk_widget_set_usize( Ok,100,-2 ); + GTK_WIDGET_SET_FLAGS( Ok,GTK_CAN_DEFAULT ); + gtk_widget_add_accelerator( Ok,"released",accel_group, + GDK_Return,0, + GTK_ACCEL_VISIBLE ); + + gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy", + GTK_SIGNAL_FUNC( on_MessageBox_destroy ), + NULL ); + gtk_signal_connect( GTK_OBJECT( Ok ),"released", + GTK_SIGNAL_FUNC( on_Ok_released ), + NULL ); + + gtk_window_add_accel_group( GTK_WINDOW( MessageBox ),accel_group ); + + return MessageBox; +} + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/gtk/opts.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,785 @@ + +GtkWidget * opAudioFrameLabel; +GtkWidget * opAudioLabel; +GtkWidget * opAudioDriverMenu; +GtkWidget * opDelayLabel; +GtkWidget * opAudioDelaySkinButton; +GtkWidget * opAudioConfigureButton; +GtkWidget * OpVideoFrameLabel; +GtkWidget * opVideoLabel; +GtkWidget * opVideoMenu; +GtkWidget * opOsdCheckButton; +GtkWidget * opVideoConfButton; +GtkWidget * opOSDLabel; +GtkWidget * opOSDLevelSpinButton; +GtkWidget * opAutoFullscreenCheckBox; +GtkWidget * opOk; +GtkWidget * opCancel; + +int opShift = False; + +void HideOptions( void ) +{ + gtk_widget_hide( Options ); + gtkVisibleOptions=0; + gtkShMem->vs.window=evPreferences; + gtkSendMessage( evHideWindow ); +} + +gboolean on_window2_key_press_event( GtkWidget * widget,GdkEventKey * event,gpointer user_data ) +{ + switch ( event->keyval ) + { + case GDK_Shift_L: + case GDK_Shift_R: + opShift=True; + break; + } + return FALSE; +} + +gboolean on_window2_key_release_event( GtkWidget * widget,GdkEventKey * event,gpointer user_data ) +{ + switch ( event->keyval ) + { + case GDK_Escape: + case GDK_Return: + if ( !opShift ) HideOptions(); + break; + case GDK_Tab: +// if ( sbShift ) +// { if ( (--sbItemsListCounter) < 0 ) sbItemsListCounter=2; } +// else +// { if ( (++sbItemsListCounter) > 2 ) sbItemsListCounter=0; } +// gtk_widget_grab_focus( sbItemsList[sbItemsListCounter] ); + break; + case GDK_Shift_L: + case GDK_Shift_R: + opShift=False; + break; + } + return FALSE; +} + +gboolean on_window2_destroy_event( GtkWidget * widget,GdkEvent * event,gpointer user_data) +{ + HideOptions(); + return FALSE; +} + +void on_opAudioDriverMenu_released( GtkButton * button,gpointer user_data ) +{ +} + +void on_opAudioDelaySkinButton_changed( GtkEditable * editable,gpointer user_data ) +{ +} + +void on_opAudioDelaySkinButton_move_to_column( GtkEditable * editable,gint column,gpointer user_data ) +{ +} + +void on_opAudioDelaySkinButton_move_to_row( GtkEditable * editable,gint row,gpointer user_data ) +{ +} + +void on_opAudioConfigureButton_released( GtkButton * button,gpointer user_data ) +{ +} + +void on_opVideoMenu_released( GtkButton * button,gpointer user_data ) +{ + fprintf( stderr,"[opts] data: %s\n",(char *)user_data ); +} + +void on_opVideoMenu_pressed( GtkButton * button,gpointer user_data ) +{ + fprintf( stderr,"[opts] data: %s\n",(char *)user_data ); +} + +void on_opVideoMenu_clicked( GtkButton * button,gpointer user_data) +{ + fprintf( stderr,"[opts] data(2): %s\n",(char *)user_data ); +} + +gboolean on_opVideoMenu_button_release_event( GtkWidget * widget,GdkEventButton * event,gpointer user_data ) +{ + fprintf( stderr,"[opts] video menu.\n" ); + return FALSE; +} + +void on_opOsdCheckButton_toggled( GtkToggleButton * togglebutton,gpointer user_data ) +{ +} + +void on_opVideoConfButton_released( GtkButton * button,gpointer user_data ) +{ +} + +void on_opOSDLevelSpinButton_changed( GtkEditable * editable,gpointer user_data ) +{ +} + +void on_opOSDLevelSpinButton_move_to_column( GtkEditable * editable,gint column,gpointer user_data ) +{ +} + +void on_opOSDLevelSpinButton_move_to_row( GtkEditable * editable,gint row,gpointer user_data ) +{ +} + +void on_opOk_released( GtkButton * button,gpointer user_data ) +{ HideOptions(); } + +void on_opCancel_released( GtkButton * button,gpointer user_data ) +{ HideOptions(); } + +gboolean on_confOSS_destroy_event ( GtkWidget * widget,GdkEvent * event,gpointer user_data) +{ + return FALSE; +} + +gboolean on_confOSS_key_press_event ( GtkWidget * widget,GdkEventKey * event,gpointer user_data ) +{ + return FALSE; +} + +gboolean on_confOSS_key_release_event( GtkWidget * widget,GdkEventKey * event,gpointer user_data ) +{ + return FALSE; +} + +void on_opOSSDSPCombo_set_focus_child( GtkContainer * container,GtkWidget * widget,gpointer user_data ) +{ +} + +void on_opOSSDSPComboEntry_changed( GtkEditable * editable,gpointer user_data ) +{ +} + +void on_opOSSMixerCombo_set_focus_child( GtkContainer * container,GtkWidget * widget,gpointer user_data ) +{ +} + +void on_opOSSMixerComboEntry_changed( GtkEditable * editable,gpointer user_data ) +{ +} + +void on_opOSSOk_released( GtkButton * button,gpointer user_data ) +{ +} + +void on_opOSSCancel_released( GtkButton * button,gpointer user_data ) +{ +} + +void on_opAutoFullscreenCheckBox_toggled( GtkToggleButton *togglebutton,gpointer user_data ) +{ +} + +GtkWidget * create_Options( void ) +{ + GtkWidget *frame1; + GtkWidget *frame2; + GtkWidget *frame3; + GtkWidget *frame4; + GtkWidget *vbox1; + GtkWidget *notebook1; + GtkWidget *frame5; + GtkWidget *frame6; + GtkWidget *hbox1; + GtkWidget *table1; + GtkWidget *opAudioDriverMenu_menu; + GtkWidget *glade_menuitem; + GtkObject *opAudioDelaySkinButton_adj; + GtkWidget *hbuttonbox2; + GtkWidget *frame16; + GtkWidget *table2; + GtkWidget *opVideoMenu_menu; + GtkWidget *hbuttonbox3; + GtkWidget *label5; + GtkObject *opOSDLevelSpinButton_adj; + GtkWidget *frame17; + GtkWidget *opAudio; + GtkWidget *frame11; + GtkWidget *frame12; + GtkWidget *hbox2; + GtkWidget *frame13; + GtkWidget *table4; + GtkWidget *vseparator1; + GtkWidget *frame14; + GtkWidget *opMisc; + GtkWidget *hseparator1; + GtkWidget *hbuttonbox1; + GtkTooltips *tooltips; + + tooltips = gtk_tooltips_new (); + + Options = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_set_name (Options, "Options"); + gtk_object_set_data (GTK_OBJECT (Options), "Options", Options); + gtk_widget_set_usize (Options, 448, 260); + gtk_widget_set_events (Options, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK | GDK_VISIBILITY_NOTIFY_MASK); + gtk_window_set_title (GTK_WINDOW (Options),"Options"); + gtk_window_set_policy (GTK_WINDOW (Options), FALSE, FALSE, FALSE); + gtk_window_set_wmclass (GTK_WINDOW (Options), "Options", "Options"); + + frame1 = gtk_frame_new (NULL); + gtk_widget_set_name (frame1, "frame1"); + gtk_widget_ref (frame1); + gtk_object_set_data_full (GTK_OBJECT (Options), "frame1", frame1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (frame1); + gtk_container_add (GTK_CONTAINER (Options), frame1); + gtk_container_set_border_width (GTK_CONTAINER (frame1), 1); + gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_IN); + + frame2 = gtk_frame_new (NULL); + gtk_widget_set_name (frame2, "frame2"); + gtk_widget_ref (frame2); + gtk_object_set_data_full (GTK_OBJECT (Options), "frame2", frame2, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (frame2); + gtk_container_add (GTK_CONTAINER (frame1), frame2); + gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_NONE); + + frame3 = gtk_frame_new (NULL); + gtk_widget_set_name (frame3, "frame3"); + gtk_widget_ref (frame3); + gtk_object_set_data_full (GTK_OBJECT (Options), "frame3", frame3, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (frame3); + gtk_container_add (GTK_CONTAINER (frame2), frame3); + gtk_frame_set_shadow_type (GTK_FRAME (frame3), GTK_SHADOW_ETCHED_OUT); + + frame4 = gtk_frame_new (NULL); + gtk_widget_set_name (frame4, "frame4"); + gtk_widget_ref (frame4); + gtk_object_set_data_full (GTK_OBJECT (Options), "frame4", frame4, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (frame4); + gtk_container_add (GTK_CONTAINER (frame3), frame4); + gtk_frame_set_shadow_type (GTK_FRAME (frame4), GTK_SHADOW_NONE); + + vbox1 = gtk_vbox_new (FALSE, 0); + gtk_widget_set_name (vbox1, "vbox1"); + gtk_widget_ref (vbox1); + gtk_object_set_data_full (GTK_OBJECT (Options), "vbox1", vbox1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (frame4), vbox1); + + notebook1 = gtk_notebook_new (); + gtk_widget_set_name (notebook1, "notebook1"); + gtk_widget_ref (notebook1); + gtk_object_set_data_full (GTK_OBJECT (Options), "notebook1", notebook1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (notebook1); + gtk_box_pack_start (GTK_BOX (vbox1), notebook1, TRUE, TRUE, 0); + + frame5 = gtk_frame_new (NULL); + gtk_widget_set_name (frame5, "frame5"); + gtk_widget_ref (frame5); + gtk_object_set_data_full (GTK_OBJECT (Options), "frame5", frame5, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (frame5); + gtk_container_add (GTK_CONTAINER (notebook1), frame5); + + frame6 = gtk_frame_new (NULL); + gtk_widget_set_name (frame6, "frame6"); + gtk_widget_ref (frame6); + gtk_object_set_data_full (GTK_OBJECT (Options), "frame6", frame6, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (frame6); + gtk_container_add (GTK_CONTAINER (frame5), frame6); + gtk_frame_set_shadow_type (GTK_FRAME (frame6), GTK_SHADOW_NONE); + + hbox1 = gtk_hbox_new (TRUE, 0); + gtk_widget_set_name (hbox1, "hbox1"); + gtk_widget_ref (hbox1); + gtk_object_set_data_full (GTK_OBJECT (Options), "hbox1", hbox1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (hbox1); + gtk_container_add (GTK_CONTAINER (frame6), hbox1); + + opAudioFrameLabel = gtk_frame_new ("Audio"); + gtk_widget_set_name (opAudioFrameLabel, "opAudioFrameLabel"); + gtk_widget_ref (opAudioFrameLabel); + gtk_object_set_data_full (GTK_OBJECT (Options), "opAudioFrameLabel", opAudioFrameLabel, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opAudioFrameLabel); + gtk_box_pack_start (GTK_BOX (hbox1), opAudioFrameLabel, FALSE, FALSE, 0); + gtk_widget_set_usize (opAudioFrameLabel, 212, -2); + gtk_container_set_border_width (GTK_CONTAINER (opAudioFrameLabel), 3); + gtk_frame_set_shadow_type (GTK_FRAME (opAudioFrameLabel), GTK_SHADOW_ETCHED_OUT); + + table1 = gtk_table_new (4, 2, FALSE); + gtk_widget_set_name (table1, "table1"); + gtk_widget_ref (table1); + gtk_object_set_data_full (GTK_OBJECT (Options), "table1", table1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (table1); + gtk_container_add (GTK_CONTAINER (opAudioFrameLabel), table1); + + opAudioLabel = gtk_label_new ("Driver: "); + gtk_widget_set_name (opAudioLabel, "opAudioLabel"); + gtk_widget_ref (opAudioLabel); + gtk_object_set_data_full (GTK_OBJECT (Options), "opAudioLabel", opAudioLabel, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opAudioLabel); + gtk_table_attach (GTK_TABLE (table1), opAudioLabel, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_widget_set_usize (opAudioLabel, 40, -2); + gtk_misc_set_alignment (GTK_MISC (opAudioLabel), 0, 0.5); + + opAudioDriverMenu = gtk_option_menu_new (); + gtk_widget_set_name (opAudioDriverMenu, "opAudioDriverMenu"); + gtk_widget_ref (opAudioDriverMenu); + gtk_object_set_data_full (GTK_OBJECT (Options), "opAudioDriverMenu", opAudioDriverMenu, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opAudioDriverMenu); + gtk_table_attach (GTK_TABLE (table1), opAudioDriverMenu, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_widget_set_usize (opAudioDriverMenu, 159, 25); + gtk_tooltips_set_tip (tooltips, opAudioDriverMenu, "Select audio output driver.", NULL); + opAudioDriverMenu_menu = gtk_menu_new (); + glade_menuitem = gtk_menu_item_new_with_label ("null"); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (opAudioDriverMenu_menu), glade_menuitem); + + #ifdef USE_OSS_AUDIO + glade_menuitem = gtk_menu_item_new_with_label ("OSS"); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (opAudioDriverMenu_menu), glade_menuitem); + #endif + #ifdef HAVE_ALSA5 + glade_menuitem = gtk_menu_item_new_with_label ("ALSA 0.5.x"); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (opAudioDriverMenu_menu), glade_menuitem); + #endif + #ifdef HAVE_ALSA9 + glade_menuitem = gtk_menu_item_new_with_label ("ALSA 0.9.x"); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (opAudioDriverMenu_menu), glade_menuitem); + #endif + #ifdef HAVE_ESD + glade_menuitem = gtk_menu_item_new_with_label ("ESD"); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (opAudioDriverMenu_menu), glade_menuitem); + #endif + + gtk_option_menu_set_menu (GTK_OPTION_MENU (opAudioDriverMenu), opAudioDriverMenu_menu); + + opDelayLabel = gtk_label_new ("Delay:"); + gtk_widget_set_name (opDelayLabel, "opDelayLabel"); + gtk_widget_ref (opDelayLabel); + gtk_object_set_data_full (GTK_OBJECT (Options), "opDelayLabel", opDelayLabel, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opDelayLabel); + gtk_table_attach (GTK_TABLE (table1), opDelayLabel, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_widget_set_usize (opDelayLabel, 35, -2); + gtk_misc_set_alignment (GTK_MISC (opDelayLabel), 0, 0.5); + + opAudioDelaySkinButton_adj = gtk_adjustment_new (0, -500, 500, 0.01, 10, 10); + opAudioDelaySkinButton = gtk_spin_button_new (GTK_ADJUSTMENT (opAudioDelaySkinButton_adj), 1, 2); + gtk_widget_set_name (opAudioDelaySkinButton, "opAudioDelaySkinButton"); + gtk_widget_ref (opAudioDelaySkinButton); + gtk_object_set_data_full (GTK_OBJECT (Options), "opAudioDelaySkinButton", opAudioDelaySkinButton, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opAudioDelaySkinButton); + gtk_table_attach (GTK_TABLE (table1), opAudioDelaySkinButton, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), //GTK_EXPAND | + (GtkAttachOptions) (0), 0, 0); + gtk_widget_set_usize (opAudioDelaySkinButton, 160, 25); + gtk_tooltips_set_tip (tooltips, opAudioDelaySkinButton, "Set audio delay.", NULL); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (opAudioDelaySkinButton), TRUE); + + hbuttonbox2 = gtk_hbutton_box_new (); + gtk_widget_set_name (hbuttonbox2, "hbuttonbox2"); + gtk_widget_ref (hbuttonbox2); + gtk_object_set_data_full (GTK_OBJECT (Options), "hbuttonbox2", hbuttonbox2, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (hbuttonbox2); + gtk_table_attach (GTK_TABLE (table1), hbuttonbox2, 1, 2, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_widget_set_usize (hbuttonbox2, -2, 31); + gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox2), GTK_BUTTONBOX_END); + + opAudioConfigureButton = gtk_button_new_with_label ("Configure"); + gtk_widget_set_name (opAudioConfigureButton, "opAudioConfigureButton"); + gtk_widget_ref (opAudioConfigureButton); + gtk_object_set_data_full (GTK_OBJECT (Options), "opAudioConfigureButton", opAudioConfigureButton, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opAudioConfigureButton); + gtk_container_add (GTK_CONTAINER (hbuttonbox2), opAudioConfigureButton); + gtk_widget_set_usize (opAudioConfigureButton, -2, 31); + GTK_WIDGET_SET_FLAGS (opAudioConfigureButton, GTK_CAN_DEFAULT); + gtk_tooltips_set_tip (tooltips, opAudioConfigureButton, "Configure selected audio driver.", NULL); + + frame16 = gtk_frame_new (NULL); + gtk_widget_set_name (frame16, "frame16"); + gtk_widget_ref (frame16); + gtk_object_set_data_full (GTK_OBJECT (Options), "frame16", frame16, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (frame16); + gtk_table_attach (GTK_TABLE (table1), frame16, 1, 2, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); + gtk_frame_set_shadow_type (GTK_FRAME (frame16), GTK_SHADOW_NONE); + + OpVideoFrameLabel = gtk_frame_new ("Video"); + gtk_widget_set_name (OpVideoFrameLabel, "OpVideoFrameLabel"); + gtk_widget_ref (OpVideoFrameLabel); + gtk_object_set_data_full (GTK_OBJECT (Options), "OpVideoFrameLabel", OpVideoFrameLabel, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (OpVideoFrameLabel); + gtk_box_pack_start (GTK_BOX (hbox1), OpVideoFrameLabel, FALSE, FALSE, 0); + gtk_widget_set_usize (OpVideoFrameLabel, 212, -2); + gtk_container_set_border_width (GTK_CONTAINER (OpVideoFrameLabel), 3); + gtk_frame_set_shadow_type (GTK_FRAME (OpVideoFrameLabel), GTK_SHADOW_ETCHED_OUT); + + table2 = gtk_table_new (5, 2, FALSE); + gtk_widget_set_name (table2, "table2"); + gtk_widget_ref (table2); + gtk_object_set_data_full (GTK_OBJECT (Options), "table2", table2, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (table2); + gtk_container_add (GTK_CONTAINER (OpVideoFrameLabel), table2); + + opVideoLabel = gtk_label_new ("Driver:"); + gtk_widget_set_name (opVideoLabel, "opVideoLabel"); + gtk_widget_ref (opVideoLabel); + gtk_object_set_data_full (GTK_OBJECT (Options), "opVideoLabel", opVideoLabel, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opVideoLabel); + gtk_table_attach (GTK_TABLE (table2), opVideoLabel, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_widget_set_usize (opVideoLabel, 35, -2); + gtk_misc_set_alignment (GTK_MISC (opVideoLabel), 0, 0.5); + + opVideoMenu = gtk_option_menu_new (); + gtk_widget_set_name (opVideoMenu, "opVideoMenu"); + gtk_widget_ref (opVideoMenu); + gtk_object_set_data_full (GTK_OBJECT (Options), "opVideoMenu", opVideoMenu, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opVideoMenu); + gtk_table_attach (GTK_TABLE (table2), opVideoMenu, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_widget_set_usize (opVideoMenu, 137, 25); + gtk_tooltips_set_tip (tooltips, opVideoMenu, "Select video output driver.", NULL); + opVideoMenu_menu = gtk_menu_new (); + #if defined( HAVE_X11 ) && defined( HAVE_MGA ) + glade_menuitem = gtk_menu_item_new_with_label ("xmga"); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (opVideoMenu_menu), glade_menuitem); + #endif + #ifdef HAVE_XV + glade_menuitem = gtk_menu_item_new_with_label ("xv"); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (opVideoMenu_menu), glade_menuitem); + #endif + #ifdef HAVE_X11 + glade_menuitem = gtk_menu_item_new_with_label ("x11"); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (opVideoMenu_menu), glade_menuitem); + #endif + #ifdef HAVE_PNG + glade_menuitem = gtk_menu_item_new_with_label ("png"); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (opVideoMenu_menu), glade_menuitem); + #endif + glade_menuitem = gtk_menu_item_new_with_label ("null"); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (opVideoMenu_menu), glade_menuitem); + gtk_option_menu_set_menu (GTK_OPTION_MENU (opVideoMenu), opVideoMenu_menu); + + opOsdCheckButton = gtk_check_button_new_with_label (""); + gtk_widget_set_name (opOsdCheckButton, "opOsdCheckButton"); + gtk_widget_ref (opOsdCheckButton); + gtk_object_set_data_full (GTK_OBJECT (Options), "opOsdCheckButton", opOsdCheckButton, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opOsdCheckButton); + gtk_table_attach (GTK_TABLE (table2), opOsdCheckButton, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_widget_set_usize (opOsdCheckButton, -2, 24); + gtk_tooltips_set_tip (tooltips, opOsdCheckButton, "On/off OSD.", NULL); + + hbuttonbox3 = gtk_hbutton_box_new (); + gtk_widget_set_name (hbuttonbox3, "hbuttonbox3"); + gtk_widget_ref (hbuttonbox3); + gtk_object_set_data_full (GTK_OBJECT (Options), "hbuttonbox3", hbuttonbox3, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (hbuttonbox3); + gtk_table_attach (GTK_TABLE (table2), hbuttonbox3, 1, 2, 4, 5, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); + gtk_widget_set_usize (hbuttonbox3, -2, 31); + gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox3), GTK_BUTTONBOX_END); + + opVideoConfButton = gtk_button_new_with_label ("Configure"); + gtk_widget_set_name (opVideoConfButton, "opVideoConfButton"); + gtk_widget_ref (opVideoConfButton); + gtk_object_set_data_full (GTK_OBJECT (Options), "opVideoConfButton", opVideoConfButton, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opVideoConfButton); + gtk_container_add (GTK_CONTAINER (hbuttonbox3), opVideoConfButton); + gtk_widget_set_usize (opVideoConfButton, -2, 31); + GTK_WIDGET_SET_FLAGS (opVideoConfButton, GTK_CAN_DEFAULT); + gtk_tooltips_set_tip (tooltips, opVideoConfButton, "Configure selected video driver.", NULL); + + opOSDLabel = gtk_label_new ("OSD:"); + gtk_widget_set_name (opOSDLabel, "opOSDLabel"); + gtk_widget_ref (opOSDLabel); + gtk_object_set_data_full (GTK_OBJECT (Options), "opOSDLabel", opOSDLabel, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opOSDLabel); + gtk_table_attach (GTK_TABLE (table2), opOSDLabel, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_widget_set_usize (opOSDLabel, 35, -2); + gtk_misc_set_alignment (GTK_MISC (opOSDLabel), 0, 0.5); + + label5 = gtk_label_new ("OSD level:"); + gtk_widget_set_name (label5, "label5"); + gtk_widget_ref (label5); + gtk_object_set_data_full (GTK_OBJECT (Options), "label5", label5, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (label5); + gtk_table_attach (GTK_TABLE (table2), label5, 0, 1, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_widget_set_usize (label5, 63, -2); + gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5); + + opOSDLevelSpinButton_adj = gtk_adjustment_new (0, 0, 2, 1, 10, 10); + opOSDLevelSpinButton = gtk_spin_button_new (GTK_ADJUSTMENT (opOSDLevelSpinButton_adj), 1, 0); + gtk_widget_set_name (opOSDLevelSpinButton, "opOSDLevelSpinButton"); + gtk_widget_ref (opOSDLevelSpinButton); + gtk_object_set_data_full (GTK_OBJECT (Options), "opOSDLevelSpinButton", opOSDLevelSpinButton, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opOSDLevelSpinButton); + gtk_table_attach (GTK_TABLE (table2), opOSDLevelSpinButton, 1, 2, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_widget_set_usize (opOSDLevelSpinButton, 136, 25); + gtk_tooltips_set_tip (tooltips, opOSDLevelSpinButton, "Set OSD level.", NULL); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (opOSDLevelSpinButton), TRUE); + + frame17 = gtk_frame_new (NULL); + gtk_widget_set_name (frame17, "frame17"); + gtk_widget_ref (frame17); + gtk_object_set_data_full (GTK_OBJECT (Options), "frame17", frame17, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (frame17); + gtk_table_attach (GTK_TABLE (table2), frame17, 1, 2, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_widget_set_usize (frame17, -2, 40); + gtk_frame_set_shadow_type (GTK_FRAME (frame17), GTK_SHADOW_NONE); + + opAudio = gtk_label_new ("Audio & Video"); + gtk_widget_set_name (opAudio, "opAudio"); + gtk_widget_ref (opAudio); + gtk_object_set_data_full (GTK_OBJECT (Options), "opAudio", opAudio, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opAudio); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), opAudio); + gtk_widget_set_usize (opAudio, 80, -2); + + frame11 = gtk_frame_new (NULL); + gtk_widget_set_name (frame11, "frame11"); + gtk_widget_ref (frame11); + gtk_object_set_data_full (GTK_OBJECT (Options), "frame11", frame11, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (frame11); + gtk_container_add (GTK_CONTAINER (notebook1), frame11); + + frame12 = gtk_frame_new (NULL); + gtk_widget_set_name (frame12, "frame12"); + gtk_widget_ref (frame12); + gtk_object_set_data_full (GTK_OBJECT (Options), "frame12", frame12, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (frame12); + gtk_container_add (GTK_CONTAINER (frame11), frame12); + gtk_frame_set_shadow_type (GTK_FRAME (frame12), GTK_SHADOW_NONE); + + hbox2 = gtk_hbox_new (FALSE, 0); + gtk_widget_set_name (hbox2, "hbox2"); + gtk_widget_ref (hbox2); + gtk_object_set_data_full (GTK_OBJECT (Options), "hbox2", hbox2, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (hbox2); + gtk_container_add (GTK_CONTAINER (frame12), hbox2); + + frame13 = gtk_frame_new (NULL); + gtk_widget_set_name (frame13, "frame13"); + gtk_widget_ref (frame13); + gtk_object_set_data_full (GTK_OBJECT (Options), "frame13", frame13, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (frame13); + gtk_box_pack_start (GTK_BOX (hbox2), frame13, TRUE, TRUE, 0); + gtk_widget_set_usize (frame13, 212, -2); + gtk_frame_set_shadow_type (GTK_FRAME (frame13), GTK_SHADOW_NONE); + + table4 = gtk_table_new (2, 1, FALSE); + gtk_widget_set_name (table4, "table4"); + gtk_widget_ref (table4); + gtk_object_set_data_full (GTK_OBJECT (Options), "table4", table4, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (table4); + gtk_container_add (GTK_CONTAINER (frame13), table4); + + opAutoFullscreenCheckBox = gtk_check_button_new_with_label ("Always switch fullscreen on play"); + gtk_widget_set_name (opAutoFullscreenCheckBox, "opAutoFullscreenCheckBox"); + gtk_widget_ref (opAutoFullscreenCheckBox); + gtk_object_set_data_full (GTK_OBJECT (Options), "opAutoFullscreenCheckBox", opAutoFullscreenCheckBox, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opAutoFullscreenCheckBox); + gtk_table_attach (GTK_TABLE (table4), opAutoFullscreenCheckBox, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_widget_set_usize (opAutoFullscreenCheckBox, -2, 25); + gtk_tooltips_set_tip (tooltips, opAutoFullscreenCheckBox, "Switch player window to fullscreen on all play.", NULL); + + vseparator1 = gtk_vseparator_new (); + gtk_widget_set_name (vseparator1, "vseparator1"); + gtk_widget_ref (vseparator1); + gtk_object_set_data_full (GTK_OBJECT (Options), "vseparator1", vseparator1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (vseparator1); + gtk_box_pack_start (GTK_BOX (hbox2), vseparator1, FALSE, FALSE, 0); + gtk_widget_set_usize (vseparator1, 3, -2); + + frame14 = gtk_frame_new (NULL); + gtk_widget_set_name (frame14, "frame14"); + gtk_widget_ref (frame14); + gtk_object_set_data_full (GTK_OBJECT (Options), "frame14", frame14, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (frame14); + gtk_box_pack_start (GTK_BOX (hbox2), frame14, TRUE, TRUE, 0); + gtk_widget_set_usize (frame14, 212, -2); + gtk_frame_set_shadow_type (GTK_FRAME (frame14), GTK_SHADOW_NONE); + + opMisc = gtk_label_new ("Misc"); + gtk_widget_set_name (opMisc, "opMisc"); + gtk_widget_ref (opMisc); + gtk_object_set_data_full (GTK_OBJECT (Options), "opMisc", opMisc, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opMisc); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), opMisc); + gtk_widget_set_usize (opMisc, 75, -2); + + hseparator1 = gtk_hseparator_new (); + gtk_widget_set_name (hseparator1, "hseparator1"); + gtk_widget_ref (hseparator1); + gtk_object_set_data_full (GTK_OBJECT (Options), "hseparator1", hseparator1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (hseparator1); + gtk_box_pack_start (GTK_BOX (vbox1), hseparator1, FALSE, FALSE, 0); + gtk_widget_set_usize (hseparator1, -2, 5); + + hbuttonbox1 = gtk_hbutton_box_new (); + gtk_widget_set_name (hbuttonbox1, "hbuttonbox1"); + gtk_widget_ref (hbuttonbox1); + gtk_object_set_data_full (GTK_OBJECT (Options), "hbuttonbox1", hbuttonbox1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (hbuttonbox1); + gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, TRUE, TRUE, 0); + gtk_widget_set_usize (hbuttonbox1, -2, 27); + gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_END); + gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox1), 0); + gtk_button_box_set_child_size (GTK_BUTTON_BOX (hbuttonbox1), 90, 30); + + opOk = gtk_button_new_with_label ("Ok"); + gtk_widget_set_name (opOk, "opOk"); + gtk_widget_ref (opOk); + gtk_object_set_data_full (GTK_OBJECT (Options), "opOk", opOk, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opOk); + gtk_container_add (GTK_CONTAINER (hbuttonbox1), opOk); + GTK_WIDGET_SET_FLAGS (opOk, GTK_CAN_DEFAULT); + + opCancel = gtk_button_new_with_label ("Cancel"); + gtk_widget_set_name (opCancel, "opCancel"); + gtk_widget_ref (opCancel); + gtk_object_set_data_full (GTK_OBJECT (Options), "opCancel", opCancel, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (opCancel); + gtk_container_add (GTK_CONTAINER (hbuttonbox1), opCancel); + GTK_WIDGET_SET_FLAGS (opCancel, GTK_CAN_DEFAULT); + + gtk_signal_connect (GTK_OBJECT (Options), "key_press_event", + GTK_SIGNAL_FUNC (on_window2_key_press_event), + NULL); + gtk_signal_connect (GTK_OBJECT (Options), "key_release_event", + GTK_SIGNAL_FUNC (on_window2_key_release_event), + NULL); + gtk_signal_connect (GTK_OBJECT (Options), "destroy_event", + GTK_SIGNAL_FUNC (on_window2_destroy_event), + NULL); + gtk_signal_connect (GTK_OBJECT (opAudioDriverMenu), "released", + GTK_SIGNAL_FUNC (on_opAudioDriverMenu_released), + NULL); + gtk_signal_connect (GTK_OBJECT (opAudioDelaySkinButton), "changed", + GTK_SIGNAL_FUNC (on_opAudioDelaySkinButton_changed), + NULL); + gtk_signal_connect (GTK_OBJECT (opAudioDelaySkinButton), "move_to_column", + GTK_SIGNAL_FUNC (on_opAudioDelaySkinButton_move_to_column), + NULL); + gtk_signal_connect (GTK_OBJECT (opAudioDelaySkinButton), "move_to_row", + GTK_SIGNAL_FUNC (on_opAudioDelaySkinButton_move_to_row), + NULL); + gtk_signal_connect (GTK_OBJECT (opAudioConfigureButton), "released", + GTK_SIGNAL_FUNC (on_opAudioConfigureButton_released), + NULL); + + gtk_signal_connect (GTK_OBJECT (opVideoMenu), "released", + GTK_SIGNAL_FUNC (on_opVideoMenu_released), + NULL); + gtk_signal_connect (GTK_OBJECT (opVideoMenu), "clicked", + GTK_SIGNAL_FUNC (on_opVideoMenu_clicked), + NULL); + gtk_signal_connect (GTK_OBJECT (opVideoMenu), "button_release_event", + GTK_SIGNAL_FUNC (on_opVideoMenu_button_release_event), + NULL); + gtk_signal_connect (GTK_OBJECT (opVideoMenu), "pressed", + GTK_SIGNAL_FUNC (on_opVideoMenu_pressed), + NULL); + + gtk_signal_connect (GTK_OBJECT (opOsdCheckButton), "toggled", + GTK_SIGNAL_FUNC (on_opOsdCheckButton_toggled), + NULL); + gtk_signal_connect (GTK_OBJECT (opVideoConfButton), "released", + GTK_SIGNAL_FUNC (on_opVideoConfButton_released), + NULL); + gtk_signal_connect (GTK_OBJECT (opOSDLevelSpinButton), "changed", + GTK_SIGNAL_FUNC (on_opOSDLevelSpinButton_changed), + NULL); + gtk_signal_connect (GTK_OBJECT (opOSDLevelSpinButton), "move_to_column", + GTK_SIGNAL_FUNC (on_opOSDLevelSpinButton_move_to_column), + NULL); + gtk_signal_connect (GTK_OBJECT (opOSDLevelSpinButton), "move_to_row", + GTK_SIGNAL_FUNC (on_opOSDLevelSpinButton_move_to_row), + NULL); + gtk_signal_connect (GTK_OBJECT (opAutoFullscreenCheckBox), "toggled", + GTK_SIGNAL_FUNC (on_opAutoFullscreenCheckBox_toggled), + NULL); + gtk_signal_connect (GTK_OBJECT (opOk), "released", + GTK_SIGNAL_FUNC (on_opOk_released), + NULL); + gtk_signal_connect (GTK_OBJECT (opCancel), "released", + GTK_SIGNAL_FUNC (on_opCancel_released), + NULL); + + gtk_object_set_data (GTK_OBJECT (Options), "tooltips", tooltips); + + return Options; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/gtk/pl.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,305 @@ + +// play list + +#ifndef __MY_PLAYLIST +#define __MY_PLAYLIST + +#include "../../language.h" + +void HidePlayList( void ) +{ + gtk_widget_hide( PlayList ); + gtkVisiblePlayList=0; + gtkShMem->vs.window=evPlayList; + gtkSendMessage( evHideWindow ); +} + +void pl_PlayList_destroy( GtkObject * object,gpointer user_data ) +{ HidePlayList(); } + +void pl_Add_released( GtkButton * button,gpointer user_data ) +{ +} + +void pl_Remove_released( GtkButton * button,gpointer user_data ) +{ +} + +void pl_Ok_released( GtkButton * button,gpointer user_data ) +{ HidePlayList(); } + +void pl_Cancel_released( GtkButton * button,gpointer user_data ) +{ HidePlayList(); } + +void pl_DirTree_select_child( GtkTree * tree,GtkWidget * widget,gpointer user_data ) +{ +} + +void pl_DirTree_selection_changed( GtkTree * tree,gpointer user_data ) +{ +} + +void pl_DirTree_unselect_child( GtkTree * tree,GtkWidget * widget,gpointer user_data ) +{ +} + +void pl_FNameList_select_child( GtkList * list,GtkWidget * widget,gpointer user_data ) +{ +} + +void pl_FNameList_selection_changed( GtkList * list,gpointer user_data ) +{ +} + +void pl_FNameList_unselect_child( GtkList * list,GtkWidget * widget,gpointer user_data ) +{ +} + +void pl_SelectedList_select_child( GtkList * list,GtkWidget * widget,gpointer user_data ) +{ +} + +void pl_SelectedList_selection_changed( GtkList * list,gpointer user_data ) +{ +} + +void pl_SelectedList_unselect_child( GtkList * list,GtkWidget * widget,gpointer user_data ) +{ +} + +GtkWidget* create_PlayList( void ) +{ + GtkWidget *PlayList; + GtkWidget *frame9; + GtkWidget *frame10; + GtkWidget *frame11; + GtkWidget *frame12; + GtkWidget *hbox5; + GtkWidget *frame13; + GtkWidget *frame14; + GtkWidget *DirTree; + GtkWidget *vbox6; + GtkWidget *frame15; + GtkWidget *FNameList; + GtkWidget *frame16; + GtkWidget *SelectedList; + GtkWidget *hseparator6; + GtkWidget *hbuttonbox5; + GtkWidget *Add; + GtkWidget *Remove; + GtkWidget *Ok; + GtkWidget *Cancel; + + PlayList = gtk_window_new( GTK_WINDOW_DIALOG ); + gtk_object_set_data( GTK_OBJECT( PlayList ),langPlayList,PlayList ); + gtk_widget_set_usize( PlayList,512,256 ); + GTK_WIDGET_SET_FLAGS( PlayList,GTK_CAN_FOCUS ); + GTK_WIDGET_SET_FLAGS( PlayList,GTK_CAN_DEFAULT ); + gtk_widget_set_events( PlayList,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK ); + gtk_window_set_title( GTK_WINDOW( PlayList ),langPlayList ); + gtk_window_set_position( GTK_WINDOW( PlayList ),GTK_WIN_POS_CENTER ); + gtk_window_set_policy( GTK_WINDOW( PlayList ),FALSE,FALSE,TRUE ); + + frame9 = gtk_frame_new( NULL ); + gtk_widget_ref( frame9 ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame9",frame9, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame9 ); + gtk_container_add( GTK_CONTAINER( PlayList ),frame9 ); + gtk_container_set_border_width( GTK_CONTAINER( frame9 ),1 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame9 ),GTK_SHADOW_IN ); + + frame10 = gtk_frame_new( NULL ); + gtk_widget_ref( frame10 ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame10",frame10, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame10 ); + gtk_container_add( GTK_CONTAINER( frame9 ),frame10 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame10 ),GTK_SHADOW_NONE ); + + frame11 = gtk_frame_new( NULL ); + gtk_widget_ref( frame11 ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame11",frame11, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame11 ); + gtk_container_add( GTK_CONTAINER( frame10 ),frame11 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame11 ),GTK_SHADOW_ETCHED_OUT ); + + frame12 = gtk_frame_new( NULL ); + gtk_widget_ref( frame12 ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame12",frame12, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame12 ); + gtk_container_add( GTK_CONTAINER( frame11 ),frame12 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame12 ),GTK_SHADOW_NONE ); + + hbox5 = gtk_hbox_new( FALSE,0 ); + gtk_widget_ref( hbox5 ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"hbox5",hbox5, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hbox5 ); + gtk_container_add( GTK_CONTAINER( frame12 ),hbox5 ); + + frame13 = gtk_frame_new( NULL ); + gtk_widget_ref( frame13 ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame13",frame13, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame13 ); + gtk_box_pack_start( GTK_BOX( hbox5 ),frame13,TRUE,TRUE,0 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame13 ),GTK_SHADOW_ETCHED_OUT ); + + frame14 = gtk_frame_new( NULL ); + gtk_widget_ref( frame14 ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame14",frame14, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame14 ); + gtk_container_add( GTK_CONTAINER( frame13 ),frame14 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame14 ),GTK_SHADOW_NONE ); + + DirTree = gtk_tree_new(); + gtk_widget_ref( DirTree ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"DirTree",DirTree, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( DirTree ); + gtk_container_add( GTK_CONTAINER( frame14 ),DirTree ); + gtk_widget_set_usize( DirTree,217,-2 ); + + vbox6 = gtk_vbox_new( FALSE,0 ); + gtk_widget_ref( vbox6 ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"vbox6",vbox6, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( vbox6 ); + gtk_box_pack_start( GTK_BOX( hbox5 ),vbox6,TRUE,TRUE,0 ); + + frame15 = gtk_frame_new( NULL ); + gtk_widget_ref( frame15 ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame15",frame15, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame15 ); + gtk_box_pack_start( GTK_BOX( vbox6 ),frame15,TRUE,TRUE,0 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame15 ),GTK_SHADOW_ETCHED_OUT ); + + FNameList = gtk_list_new(); + gtk_widget_ref( FNameList ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"FNameList",FNameList, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( FNameList ); + gtk_container_add( GTK_CONTAINER( frame15 ),FNameList ); + + frame16 = gtk_frame_new( NULL ); + gtk_widget_ref( frame16 ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"frame16",frame16, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame16 ); + gtk_box_pack_start( GTK_BOX( vbox6 ),frame16,TRUE,TRUE,0 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame16 ),GTK_SHADOW_ETCHED_OUT ); + + SelectedList = gtk_list_new(); + gtk_widget_ref( SelectedList ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"SelectedList",SelectedList, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( SelectedList ); + gtk_container_add( GTK_CONTAINER( frame16 ),SelectedList ); + + hseparator6 = gtk_hseparator_new(); + gtk_widget_ref( hseparator6 ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"hseparator6",hseparator6, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hseparator6 ); + gtk_box_pack_start( GTK_BOX( vbox6 ),hseparator6,FALSE,TRUE,0 ); + gtk_widget_set_usize( hseparator6,-2,11 ); + + hbuttonbox5 = gtk_hbutton_box_new(); + gtk_widget_ref( hbuttonbox5 ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),"hbuttonbox5",hbuttonbox5, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hbuttonbox5 ); + gtk_box_pack_start( GTK_BOX( vbox6 ),hbuttonbox5,FALSE,FALSE,0 ); + gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox5 ),GTK_BUTTONBOX_END ); + gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox5 ),0 ); + gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox5 ),65,27 ); + gtk_button_box_set_child_ipadding( GTK_BUTTON_BOX( hbuttonbox5 ),2,0 ); + + Add = gtk_button_new_with_label( langAdd ); + gtk_widget_ref( Add ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),langAdd,Add, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( Add ); + gtk_container_add( GTK_CONTAINER( hbuttonbox5 ),Add ); + gtk_widget_set_usize( Add,45,-2 ); + GTK_WIDGET_SET_FLAGS( Add,GTK_CAN_DEFAULT ); + + Remove = gtk_button_new_with_label( langRemove ); + gtk_widget_ref( Remove ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),langRemove,Remove, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( Remove ); + gtk_container_add( GTK_CONTAINER( hbuttonbox5 ),Remove ); + gtk_widget_set_usize( Remove,45,-2 ); + GTK_WIDGET_SET_FLAGS( Remove,GTK_CAN_DEFAULT ); + + Ok = gtk_button_new_with_label( langOk ); + gtk_widget_ref( Ok ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),langOk,Ok, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( Ok ); + gtk_container_add( GTK_CONTAINER( hbuttonbox5 ),Ok ); + gtk_widget_set_usize( Ok,45,-2 ); + GTK_WIDGET_SET_FLAGS( Ok,GTK_CAN_DEFAULT ); + + Cancel = gtk_button_new_with_label( langCancel ); + gtk_widget_ref( Cancel ); + gtk_object_set_data_full( GTK_OBJECT( PlayList ),langCancel,Cancel, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( Cancel ); + gtk_container_add( GTK_CONTAINER( hbuttonbox5 ),Cancel ); + gtk_widget_set_usize( Cancel,45,-2 ); + GTK_WIDGET_SET_FLAGS( Cancel,GTK_CAN_DEFAULT ); + + gtk_signal_connect( GTK_OBJECT( PlayList ),"destroy", + GTK_SIGNAL_FUNC( pl_PlayList_destroy ), + NULL ); + gtk_signal_connect( GTK_OBJECT( DirTree ),"select_child", + GTK_SIGNAL_FUNC( pl_DirTree_select_child ), + NULL ); + gtk_signal_connect( GTK_OBJECT( DirTree ),"selection_changed", + GTK_SIGNAL_FUNC( pl_DirTree_selection_changed ), + NULL ); + gtk_signal_connect( GTK_OBJECT( DirTree ),"unselect_child", + GTK_SIGNAL_FUNC( pl_DirTree_unselect_child ), + NULL ); + gtk_signal_connect( GTK_OBJECT( FNameList ),"select_child", + GTK_SIGNAL_FUNC( pl_FNameList_select_child ), + NULL ); + gtk_signal_connect( GTK_OBJECT( FNameList ),"selection_changed", + GTK_SIGNAL_FUNC( pl_FNameList_selection_changed ), + NULL ); + gtk_signal_connect( GTK_OBJECT( FNameList ),"unselect_child", + GTK_SIGNAL_FUNC( pl_FNameList_unselect_child ), + NULL ); + gtk_signal_connect( GTK_OBJECT( SelectedList ),"select_child", + GTK_SIGNAL_FUNC( pl_SelectedList_select_child ), + NULL ); + gtk_signal_connect( GTK_OBJECT( SelectedList ),"selection_changed", + GTK_SIGNAL_FUNC( pl_SelectedList_selection_changed ), + NULL ); + gtk_signal_connect( GTK_OBJECT( SelectedList ),"unselect_child", + GTK_SIGNAL_FUNC( pl_SelectedList_unselect_child ), + NULL ); + gtk_signal_connect( GTK_OBJECT( Add ),"released", + GTK_SIGNAL_FUNC( pl_Add_released ), + NULL ); + gtk_signal_connect( GTK_OBJECT( Remove ),"released", + GTK_SIGNAL_FUNC( pl_Remove_released ), + NULL ); + gtk_signal_connect( GTK_OBJECT( Ok ),"released", + GTK_SIGNAL_FUNC( pl_Ok_released ), + NULL ); + gtk_signal_connect( GTK_OBJECT( Cancel ),"released", + GTK_SIGNAL_FUNC( pl_Cancel_released ), + NULL ); + + return PlayList; +} + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/gtk/sb.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,313 @@ + +// skin browser + +#ifndef __MYSKINBROWSER +#define __MYSKINBROWSER + +#include <sys/stat.h> +#include <glob.h> +#include <unistd.h> + +#include "../app.h" +#include "../../language.h" + +GtkWidget * SkinList; +GtkWidget * sbOk; +char * sbSelectedSkin=NULL; +char * sbNotEnoughMemory="SkinBrowser: not enough memory."; +char * sbMPlayerDirInHome=NULL; +char * sbMPlayerPrefixDir=NULL; + +GtkWidget * sbItemsList[3]; +int sbItemsListCounter = 0; + +void HideSkinBrowser( void ) +{ + gtk_widget_hide( SkinBrowser ); + gtkVisibleSkinBrowser=0; + gtkShMem->vs.window=evSkinBrowser; + gtkSendMessage( evHideWindow ); +} + +int gtkFillSkinList( gchar * mdir ) +{ + gchar * str[2]; + gchar * tmp; + int i; + glob_t gg; + struct stat fs; + + if ( ( str[0]=(char *)calloc( 1,7 ) ) == NULL ) + { + gtkMessageBox( sbNotEnoughMemory ); + return 0; + } + str[1]=""; + strcpy( str[0],"default" ); + if ( gtkFindCList( SkinList,str[0] ) == -1 ) gtk_clist_append( GTK_CLIST( SkinList ),str ); + free( str[0] ); + + glob( mdir,GLOB_NOSORT,NULL,&gg ); + for( i=0;i<gg.gl_pathc;i++ ) + { + if ( !strcmp( gg.gl_pathv[i],"." ) || !strcmp( gg.gl_pathv[i],".." ) ) continue; + stat( gg.gl_pathv[i],&fs ); + if ( S_ISDIR( fs.st_mode ) ) + { + tmp=strrchr( gg.gl_pathv[i],'/' ); tmp++; + if ( !strcmp( tmp,"default" ) ) continue; + if ( ( str[0]=(char *)malloc( strlen( tmp ) + 1 ) ) == NULL ) { gtkMessageBox( sbNotEnoughMemory ); return 0; } + strcpy( str[0],tmp ); + if ( gtkFindCList( SkinList,str[0] ) == -1 ) gtk_clist_append( GTK_CLIST( SkinList ),str ); + free( str[0] ); + } + } + globfree( &gg ); + return 1; +} + +void on_SkinBrowser_destroy( GtkObject * object,gpointer user_data ) +{ HideSkinBrowser(); } + +void on_SkinList_select_row( GtkCList * clist,gint row,gint column,GdkEvent * bevent,gpointer user_data ) +{ + gtk_clist_get_text( clist,row,0,&sbSelectedSkin ); + strcpy( gtkShMem->sb.name,sbSelectedSkin ); + gtkSendMessage( evSkinBrowser ); + if( !bevent ) return; + if( bevent->type == GDK_2BUTTON_PRESS ) HideSkinBrowser(); +} + +int sbShift = False; + +gboolean on_SkinBrowser_key_release_event( GtkWidget * widget,GdkEventKey * event,gpointer user_data ) +{ + switch ( event->keyval ) + { + case GDK_Escape: + case GDK_Return: + if ( !sbShift ) HideSkinBrowser(); + break; + case GDK_Tab: + if ( sbShift ) + { if ( (--sbItemsListCounter) < 0 ) sbItemsListCounter=2; } + else + { if ( (++sbItemsListCounter) > 2 ) sbItemsListCounter=0; } + gtk_widget_grab_focus( sbItemsList[sbItemsListCounter] ); + break; + case GDK_Shift_L: + case GDK_Shift_R: + sbShift=False; + break; + } +// if ( ( event->keyval == GDK_Escape )|| ( event->keyval == GDK_Return ) ) HideSkinBrowser(); + return FALSE; +} + +gboolean on_SkinBrowser_key_press_event( GtkWidget * widget,GdkEventKey * event,gpointer user_data ) +{ + switch ( event->keyval ) + { + case GDK_Shift_L: + case GDK_Shift_R: + sbShift=True; + break; + } + return FALSE; +} + +GtkWidget * create_SkinBrowser( void ) +{ + GtkWidget * SkinBrowser; + GtkWidget * frame5; + GtkWidget * frame6; + GtkWidget * frame7; + GtkWidget * frame8; + GtkWidget * vbox5; + GtkWidget * label; + GtkWidget * hseparator4; + GtkWidget * scrolledwindow1; + GtkWidget * label2; + GtkWidget * hseparator5; + GtkWidget * hbuttonbox4; + GtkWidget * Cancel; + + SkinBrowser=gtk_window_new( GTK_WINDOW_DIALOG ); + gtk_widget_set_name( SkinBrowser,langSkinBrowser ); + gtk_object_set_data( GTK_OBJECT( SkinBrowser ),langSkinBrowser,SkinBrowser ); + gtk_widget_set_usize( SkinBrowser,256,320 ); + gtk_container_set_border_width( GTK_CONTAINER( SkinBrowser ),1 ); + GTK_WIDGET_SET_FLAGS( SkinBrowser,GTK_CAN_FOCUS ); + GTK_WIDGET_SET_FLAGS( SkinBrowser,GTK_CAN_DEFAULT ); + gtk_widget_set_events( SkinBrowser,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK ); + gtk_window_set_title( GTK_WINDOW( SkinBrowser ),langSkinBrowser ); + gtk_window_set_position( GTK_WINDOW( SkinBrowser ),GTK_WIN_POS_CENTER ); + gtk_window_set_policy( GTK_WINDOW( SkinBrowser ),FALSE,FALSE,TRUE ); + + frame5=gtk_frame_new( NULL ); + gtk_widget_set_name( frame5,"frame5" ); + gtk_widget_ref( frame5 ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"frame5",frame5, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame5 ); + gtk_container_add( GTK_CONTAINER( SkinBrowser ),frame5 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame5 ),GTK_SHADOW_IN ); + + frame6=gtk_frame_new( NULL ); + gtk_widget_set_name( frame6,"frame6" ); + gtk_widget_ref( frame6 ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"frame6",frame6, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame6 ); + gtk_container_add( GTK_CONTAINER( frame5 ),frame6 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame6 ),GTK_SHADOW_NONE ); + + frame7=gtk_frame_new( NULL ); + gtk_widget_set_name( frame7,"frame7" ); + gtk_widget_ref( frame7 ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"frame7",frame7, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame7 ); + gtk_container_add( GTK_CONTAINER( frame6 ),frame7 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame7 ),GTK_SHADOW_ETCHED_OUT ); + + frame8=gtk_frame_new( NULL ); + gtk_widget_set_name( frame8,"frame8" ); + gtk_widget_ref( frame8 ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"frame8",frame8, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( frame8 ); + gtk_container_add( GTK_CONTAINER( frame7 ),frame8 ); + gtk_frame_set_shadow_type( GTK_FRAME( frame8 ),GTK_SHADOW_NONE ); + + vbox5=gtk_vbox_new( FALSE,0 ); + gtk_widget_set_name( vbox5,"vbox5" ); + gtk_widget_ref( vbox5 ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"vbox5",vbox5, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( vbox5 ); + gtk_container_add( GTK_CONTAINER( frame8 ),vbox5 ); + + label=gtk_label_new( "Skins:" ); + gtk_widget_set_name( label,"label" ); + gtk_widget_ref( label ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"label",label, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( label ); + gtk_box_pack_start( GTK_BOX( vbox5 ),label,FALSE,FALSE,0 ); + gtk_label_set_justify( GTK_LABEL( label ),GTK_JUSTIFY_RIGHT ); + gtk_misc_set_alignment( GTK_MISC( label ),7.45058e-09,7.45058e-09 ); + + hseparator4=gtk_hseparator_new(); + gtk_widget_set_name( hseparator4,"hseparator4" ); + gtk_widget_ref( hseparator4 ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"hseparator4",hseparator4, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hseparator4 ); + gtk_box_pack_start( GTK_BOX( vbox5 ),hseparator4,FALSE,TRUE,0 ); + gtk_widget_set_usize( hseparator4,-2,5 ); + + scrolledwindow1=gtk_scrolled_window_new( NULL,NULL ); + gtk_widget_set_name( scrolledwindow1,"scrolledwindow1" ); + gtk_widget_ref( scrolledwindow1 ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"scrolledwindow1",scrolledwindow1, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( scrolledwindow1 ); + gtk_box_pack_start( GTK_BOX( vbox5 ),scrolledwindow1,TRUE,TRUE,0 ); + gtk_container_set_border_width( GTK_CONTAINER( scrolledwindow1 ),2 ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC ); + + SkinList=gtk_clist_new( 1 ); + gtk_widget_set_name( SkinList,"SkinList" ); + gtk_widget_ref( SkinList ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"SkinList",SkinList, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( SkinList ); + gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),SkinList ); + gtk_clist_set_column_width( GTK_CLIST( SkinList ),0,80 ); + gtk_clist_set_selection_mode( GTK_CLIST( SkinList ),GTK_SELECTION_SINGLE ); + gtk_clist_column_titles_hide( GTK_CLIST( SkinList ) ); + gtk_clist_set_shadow_type( GTK_CLIST( SkinList ),GTK_SHADOW_ETCHED_OUT ); + + label2=gtk_label_new( "label2" ); + gtk_widget_set_name( label2,"label2" ); + gtk_widget_ref( label2 ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"label2",label2, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( label2 ); + gtk_clist_set_column_widget( GTK_CLIST( SkinList ),0,label2 ); + + hseparator5=gtk_hseparator_new(); + gtk_widget_set_name( hseparator5,"hseparator5" ); + gtk_widget_ref( hseparator5 ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"hseparator5",hseparator5, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hseparator5 ); + gtk_box_pack_start( GTK_BOX( vbox5 ),hseparator5,FALSE,TRUE,0 ); + gtk_widget_set_usize( hseparator5,-2,9 ); + + hbuttonbox4=gtk_hbutton_box_new(); + gtk_widget_set_name( hbuttonbox4,"hbuttonbox4" ); + gtk_widget_ref( hbuttonbox4 ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"hbuttonbox4",hbuttonbox4, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( hbuttonbox4 ); + gtk_box_pack_start( GTK_BOX( vbox5 ),hbuttonbox4,FALSE,TRUE,0 ); + gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox4 ),GTK_BUTTONBOX_END ); + gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox4 ),0 ); + gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox4 ),80,0 ); + + sbOk=gtk_button_new_with_label( langOk ); + gtk_widget_set_name( sbOk,langOk ); + gtk_widget_ref( sbOk ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),langOk,sbOk, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( sbOk ); + gtk_container_add( GTK_CONTAINER( hbuttonbox4 ),sbOk ); + gtk_widget_set_usize( sbOk,-2,33 ); + GTK_WIDGET_SET_FLAGS( sbOk,GTK_CAN_DEFAULT ); + + Cancel=gtk_button_new_with_label( langCancel ); + gtk_widget_set_name( Cancel,langCancel ); + gtk_widget_ref( Cancel ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),langCancel,Cancel, + ( GtkDestroyNotify ) gtk_widget_unref ); + gtk_widget_show( Cancel ); + gtk_container_add( GTK_CONTAINER( hbuttonbox4 ),Cancel ); + gtk_widget_set_usize( Cancel,-2,33 ); + GTK_WIDGET_SET_FLAGS( Cancel,GTK_CAN_DEFAULT ); + + gtk_signal_connect( GTK_OBJECT( SkinBrowser ),"destroy", + GTK_SIGNAL_FUNC( on_SkinBrowser_destroy ), + NULL ); + gtk_signal_connect( GTK_OBJECT( SkinBrowser ),"key_release_event", + GTK_SIGNAL_FUNC( on_SkinBrowser_key_release_event ), + NULL ); + gtk_signal_connect( GTK_OBJECT( SkinBrowser ),"key_press_event", + GTK_SIGNAL_FUNC( on_SkinBrowser_key_press_event ), + NULL ); + gtk_signal_connect( GTK_OBJECT( SkinList ),"select_row", + GTK_SIGNAL_FUNC( on_SkinList_select_row ), + NULL ); + gtk_signal_connect( GTK_OBJECT( sbOk ),"released", + GTK_SIGNAL_FUNC( on_SkinBrowser_destroy ), + NULL ); + gtk_signal_connect( GTK_OBJECT( Cancel ),"released", + GTK_SIGNAL_FUNC( on_SkinBrowser_destroy ), + NULL ); + + if ( ( sbMPlayerDirInHome=(char *)calloc( 1,strlen( skinDirInHome ) + 2 ) ) != NULL ) + { strcpy( sbMPlayerDirInHome,skinDirInHome ); strcat( sbMPlayerDirInHome,"/*" ); } + if ( ( sbMPlayerPrefixDir=(char *)calloc( 1,strlen( skinMPlayerDir ) + 2 ) ) != NULL ) + { strcpy( sbMPlayerPrefixDir,skinMPlayerDir ); strcat( sbMPlayerPrefixDir,"/*" ); } + + gtk_widget_grab_focus( SkinList ); + + sbItemsList[0]=SkinList; + sbItemsList[1]=sbOk; + sbItemsList[2]=Cancel; + + return SkinBrowser; +} + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/menu.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,139 @@ + +unsigned char * mplMenuDrawBuffer = NULL; +int mplMenuRender = 1; +int mplMenuItem = -1; +int mplOldMenuItem = -1; +int mplMenuX,mplMenuY; + +void mplHideMenu( int mx,int my ); + +void mplMenuDraw( wsParamDisplay ) +{ + unsigned long * buf = NULL; + unsigned long * drw = NULL; + unsigned long x,y,tmp; + + if ( !appMPlayer.menuBase.Bitmap.Image ) return; + if ( !appMPlayer.menuWindow.Visible ) return; + + if ( mplMenuRender || mplMenuItem != mplOldMenuItem ) + { + memcpy( mplMenuDrawBuffer,appMPlayer.menuBase.Bitmap.Image,appMPlayer.menuBase.Bitmap.ImageSize ); +// --- + if ( mplMenuItem != -1 ) + { + buf=(unsigned long *)mplMenuDrawBuffer; + drw=(unsigned long *)appMPlayer.menuSelected.Bitmap.Image; + for ( y=appMPlayer.MenuItems[ mplMenuItem ].y; y < appMPlayer.MenuItems[ mplMenuItem ].y + appMPlayer.MenuItems[ mplMenuItem ].height; y++ ) + for ( x=appMPlayer.MenuItems[ mplMenuItem ].x; x < appMPlayer.MenuItems[ mplMenuItem ].x + appMPlayer.MenuItems[ mplMenuItem ].width; x++ ) + { + tmp=drw[ y * appMPlayer.menuSelected.width + x ]; + if ( tmp != 0x00ff00ff ) buf[ y * appMPlayer.menuBase.width + x ]=tmp; + } + } + mplOldMenuItem=mplMenuItem; +// --- + wsConvert( &appMPlayer.menuWindow,mplMenuDrawBuffer,appMPlayer.menuBase.Bitmap.ImageSize ); +// wsConvert( &appMPlayer.menuWindow,mplMenuDrawBuffer,appMPlayer.menuBase.Bitmap.Height * appMPlayer.menuBase.Bitmap.Width ); + mplMenuRender=0; + } + wsPutImage( &appMPlayer.menuWindow ); +} + +void mplMenuMouseHandle( int X,int Y,int RX,int RY ) +{ + int x,y,i; + + if ( !appMPlayer.menuBase.Bitmap.Image ) return; + + mplMenuItem=-1; + x=RX - appMPlayer.menuWindow.X; + y=RY - appMPlayer.menuWindow.Y; + if ( ( x < 0 ) || ( y < 0 ) || ( x > appMPlayer.menuBase.width ) || ( y > appMPlayer.menuBase.height ) ) + { + wsPostRedisplay( &appMPlayer.menuWindow ); + return; + } + + for( i=0;i<appMPlayer.NumberOfMenuItems+1;i++ ) + { + if ( wgIsRect( x,y, + appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y, + appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width,appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) ) mplMenuItem=i; + } + wsPostRedisplay( &appMPlayer.menuWindow ); +} + +void mplShowMenu( int mx,int my ) +{ + int x,y; + + if ( !appMPlayer.menuBase.Bitmap.Image ) return; + + x=mx; + if ( x + appMPlayer.menuWindow.Width > wsMaxX ) x=wsMaxX - appMPlayer.menuWindow.Width - 1; + y=my; + if ( y + appMPlayer.menuWindow.Height > wsMaxY ) y=wsMaxY - appMPlayer.menuWindow.Height - 1; + + mplMenuX=x; mplMenuY=y; + + mplMenuItem = 0; + + wsMoveWindow( &appMPlayer.menuWindow,x,y ); + wsVisibleWindow( &appMPlayer.menuWindow,wsShowWindow ); + wsMoveTopWindow( &appMPlayer.menuWindow ); +} + +void mplHideMenu( int mx,int my ) +{ + int x,y,i=mplMenuItem; + + if ( !appMPlayer.menuBase.Bitmap.Image ) return; + + x=mx-mplMenuX; + y=my-mplMenuY; + + wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow ); + + if ( ( x < 0 ) || ( y < 0 ) ) return; + + if ( wgIsRect( x,y, + appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y, + appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width, + appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) ) + { + mplMsgHandle( appMPlayer.MenuItems[i].msg,0 ); + } +} + +void mplMenuInit( void ) +{ + + if ( !appMPlayer.menuBase.Bitmap.Image ) return; + + appMPlayer.menuBase.x=0; + appMPlayer.menuBase.y=0; + + if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) + { + #ifdef DEBUG + dbprintf( 1,langNEMFMR ); + #endif + gtkMessageBox( langNEMFMR ); + return; + } + + wsCreateWindow( &appMPlayer.menuWindow, + appMPlayer.menuBase.x,appMPlayer.menuBase.y,appMPlayer.menuBase.width,appMPlayer.menuBase.height, + wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsMaxSize|wsMinSize|wsHideWindow,"MPlayer menu" ); + + #ifdef DEBUG + dbprintf( 1,"[menu.h] menu: 0x%x\n",(int)appMPlayer.menuWindow.WindowID ); + #endif + + appMPlayer.menuWindow.ReDraw=mplMenuDraw; +// appMPlayer.menuWindow.MouseHandler=mplMenuMouseHandle; +// appMPlayer.menuWindow.KeyHandler=mplMainKeyHandle; + + wsPostRedisplay( &appMPlayer.menuWindow ); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/mixer.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,39 @@ + +#include "play.h" + +float mixerGetVolume( void ) +{ +// --- +// --- + return mplShMem->Volume; +} + +void mixerSetVolume( float v ) +{ // 0.0 ... 100.0 +// --- +printf("%%%%%% mixerSetVolume(%5.3f) \n",v); +// --- + mplShMem->Volume=v; +} + +void mixerIncVolume( void ) +{ + mixerSetVolume( mixerGetVolume() + 1.0f ); +} + +void mixerDecVolume( void ) +{ + mixerSetVolume( mixerGetVolume() - 1.0f ); +} + +void mixerMute( void ) +{ +} + +void mixerSetBalance( float b ) +{ +// --- +// --- +printf("%%%%%% mixerSetBalance(%5.3f) \n",b); + mplShMem->Balance=b; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/mixer.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,12 @@ + +#ifndef _MIXER_H +#define _MIXER_H + +extern float mixerGetVolume( void ); +extern void mixerSetVolume( float v ); +extern void mixerIncVolume( void ); +extern void mixerDecVolume( void ); +extern void mixerMute( void ); +extern void mixerSetBalance( float b ); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/mplayer.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,112 @@ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include "./mplayer.h" +#include "../events.h" +#include "../app.h" +#include "../skin/skin.h" +#include "../skin/font.h" +#include "../wm/ws.h" +#include "../wm/wskeys.h" +#include "../wm/widget.h" +#include "../bitmap/bitmap.h" +#include "../timer.h" +#include "../language.h" +#include "../error.h" + +#include "../../config.h" + +#define mplMouseTimerConst 100 +#define mplRedrawTimerConst 50 + +int mplMouseTimer = mplMouseTimerConst; +int mplRedrawTimer = mplRedrawTimerConst; +int mplGeneralTimer = -1; +int mplTimer = 0; + +int mplSkinChanged = 0; + +void mplMsgHandle( int msg,float param ); + +#include "widgets.h" +#include "play.h" +#include "menu.h" +#include "mw.h" +#include "sw.h" +#include "widget.h" + +void mplTimerHandler( int signum ) +{ + mplTimer++; + mplMouseTimer--; + mplRedrawTimer--; + mplGeneralTimer--; + if ( mplMouseTimer == 0 ) mplMsgHandle( evHideMouseCursor,0 ); + if ( mplRedrawTimer == 0 ) mplMsgHandle( evRedraw,0 ); + if ( mplGeneralTimer == 0 ) mplMsgHandle( evGeneralTimer,0 ); +} + +void mplInit( int argc,char* argv[], char *envp[] ) +{ +// parse_cfgfiles( argc,argv,envp ); + gtkInit( argc,argv,envp ); + mplMPlayerInit( argc,argv,envp ); + + message=mplErrorHandler; + + wsXInit(); + + if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL ) + { + fprintf( stderr,langNEMDB ); + exit( 0 ); + } + + wsCreateWindow( &appMPlayer.subWindow, + appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height, + wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsShowWindow,"ViDEO" ); + + wsCreateWindow( &appMPlayer.mainWindow, + appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height, + wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsMaxSize|wsMinSize|wsShowWindow,"MPlayer" ); + + wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); + + mplMenuInit(); + + #ifdef DEBUG + dbprintf( 1,"[main] Depth on screen: %d\n",wsDepthOnScreen ); + dbprintf( 1,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); + dbprintf( 1,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID ); + #endif + + appMPlayer.mainWindow.ReDraw=mplMainDraw; + appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle; + appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle; + + appMPlayer.subWindow.ReDraw=mplSubDraw; + appMPlayer.subWindow.MouseHandler=mplSubMouseHandle; + appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; + appMPlayer.subWindow.ReSize=mplResize; + + wsPostRedisplay( &appMPlayer.mainWindow ); + wsPostRedisplay( &appMPlayer.subWindow ); + + btnModify( evSetVolume,mplShMem->Volume ); + btnModify( evSetBalance,mplShMem->Balance ); + btnModify( evSetMoviePosition,mplShMem->Position ); + + timerSetHandler( mplTimerHandler ); + timerInit(); + + wsMainLoop(); + + dbprintf( 1,"[mplayer] exit.\n" ); + + mplStop(); + timerDone(); + gtkDone(); + wsXDone(); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/mplayer.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,19 @@ + +#ifndef __MYMPLAYERHANDLER +#define __MYMPLAYERHANDLER + +extern int mplSubRender; +extern int mplMainRender; +extern int mplGeneralTimer; +extern int mplSkinChanged; + +extern unsigned char * mplDrawBuffer; +extern unsigned char * mplMenuDrawBuffer; +extern int mainVisible; + +extern int mplMainAutoPlay; + +extern void mplInit( int argc,char* argv[], char *envp[] ); +extern void mplMsgHandle( int msg,float param ); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/mw.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,526 @@ + +// main window + +#include "mixer.h" + +unsigned char * mplDrawBuffer = NULL; +int mplMainRender = 1; +int mplMainAutoPlay = 0; + +int mainVisible = 1; + +int boxMoved = 0; +int msButton = 0; +int sx = 0,sy = 0; +int i,pot = 0; + +char * Translate( char * str ) +{ + static char trbuf[512]; + char tmp[128]; + int i,c; + int t,h,m,s; + memset( trbuf,0,512 ); + memset( tmp,0,128 ); + for ( c=0,i=0;i < strlen( str );i++ ) + { + if ( str[i] != '$' ) { trbuf[c++]=str[i]; trbuf[c]=0; } + else + { + switch ( str[++i] ) + { + case 't': + if ( mplShMem->Track < 10 ) strcat( trbuf,"0" ); + sprintf( tmp,"%d",mplShMem->Track ); strcat( trbuf,tmp ); + break; + case 'f': + if ( strlen( gtkShMem->fs.filename ) ) + { + int i; + strcpy( tmp,gtkShMem->fs.filename ); + for ( i=0;i < strlen( tmp );i++ ) + { + t=0; + if ( ( tmp[i] >= 'A' )&&( tmp[i] <= 'Z' ) ) t=32; + tmp[i]=(char)( tmp[i] + t ); + } + if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0; + if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0; + } else strcpy( tmp,"no file loaded" ); + strcat( trbuf,tmp ); + break; + case 'F': + if ( strlen( gtkShMem->fs.filename ) ) + { + int i; + strcpy( tmp,gtkShMem->fs.filename ); + for ( i=0;i < strlen( tmp );i++ ) + { + char t = 0; + if ( ( tmp[i] >= 'a' )&&( tmp[i] <= 'z' ) ) t=32; + tmp[i]=tmp[i] - t; + } + if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0; + if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0; + } else strcpy( tmp,"NO FILE LOADED" ); + strcat( trbuf,tmp ); + break; + case 'o': + if ( strlen( gtkShMem->fs.filename ) ) + { + strcat( trbuf,gtkShMem->fs.filename ); + if ( trbuf[strlen( trbuf ) - 4] == '.' ) trbuf[strlen( trbuf ) - 4]=0; + if ( trbuf[strlen( trbuf ) - 5] == '.' ) trbuf[strlen( trbuf ) - 5]=0; + } else strcat( trbuf,"no file loaded" ); + break; + case '6': t=mplShMem->LengthInSec; goto calclengthhhmmss; + case '1': t=mplShMem->TimeSec; +calclengthhhmmss: + s=t%60; t=( t - s ) / 60; m=t%60; h=t/60; + sprintf( tmp,"%02d:%02d:%02d",h,m,s ); strcat( trbuf,tmp ); + break; + case '7': t=mplShMem->LengthInSec; goto calclengthmmmmss; + case '2': t=mplShMem->TimeSec; +calclengthmmmmss: + s=t%60; m=( ( t - s ) / 60 ) % 60; + sprintf( tmp,"%04d:%02d",m,s ); strcat( trbuf,tmp ); + break; + case '3': + sprintf( tmp,"%02d",( mplShMem->TimeSec - ( mplShMem->TimeSec % 60 ) ) / 3600 ); strcat( trbuf,tmp ); + break; + case '4': + sprintf( tmp,"%02d",( ( mplShMem->TimeSec - ( mplShMem->TimeSec % 60 ) ) / 60 ) % 60 ); strcat( trbuf,tmp ); + break; + case '5': + sprintf( tmp,"%02d",mplShMem->TimeSec % 60 ); strcat( trbuf,tmp ); + break; + case 'v': + sprintf( tmp,"%3.2f%%",mplShMem->Volume ); strcat( trbuf,tmp ); + break; + case 'V': + sprintf( tmp,"%3.1f",mplShMem->Volume ); strcat( trbuf,tmp ); + break; + case 'b': + sprintf( tmp,"%3.2f%%",mplShMem->Balance ); strcat( trbuf,tmp ); + break; + case 'B': + sprintf( tmp,"%3.1f",mplShMem->Balance ); strcat( trbuf,tmp ); + break; + case 's': + if ( mplShMem->Playing == 0 ) strcat( trbuf,"s" ); + break; + case 'l': + if ( mplShMem->Playing == 1 ) strcat( trbuf,"p" ); + break; + case 'e': + if ( mplShMem->Playing == 2 ) strcat( trbuf,"e" ); + break; + case '$': + strcat( trbuf,"$" ); + break; + default: continue; + } + c=strlen( trbuf ); + } + } + return trbuf; +} + +void PutImage( txSample * bf,int x,int y,int max,int ofs ) +{ + int i=0,ix,iy; + unsigned long * buf = NULL; + unsigned long * drw = NULL; + unsigned long tmp; + + if ( ( !bf )||( bf->Image == NULL ) ) return; + + i=( bf->Width * ( bf->Height / max ) ) * ofs; + buf=(unsigned long *)mplDrawBuffer; + drw=(unsigned long *)bf->Image; + + for ( iy=y;iy < y+bf->Height / max;iy++ ) + for ( ix=x;ix < x+bf->Width;ix++ ) + { + tmp=drw[i++]; + if ( tmp != 0x00ff00ff ) + buf[ iy*appMPlayer.main.Bitmap.Width+ix ]=tmp; + } +} + +void mplMainDraw( wsParamDisplay ) +{ + wItem * item; + txSample * image = NULL; + int i; + char * tmp; + + if ( appMPlayer.mainWindow.Visible == wsWindowNotVisible || + !mainVisible || + !appMPlayer.mainWindow.Mapped ) return; + + if ( mplMainRender ) + { + memcpy( mplDrawBuffer,appMPlayer.main.Bitmap.Image,appMPlayer.main.Bitmap.ImageSize ); + for( i=0;i < appMPlayer.NumberOfItems + 1;i++ ) + { + item=&appMPlayer.Items[i]; + switch( item->type ) + { + case itButton: + PutImage( &item->Bitmap,item->x,item->y,3,item->pressed ); + break; + case itHPotmeter: + PutImage( &item->Bitmap,item->x,item->y,item->phases,item->phases * ( item->value / 100.0f ) ); + PutImage( &item->Mask,item->x + (int)( ( item->width - item->psx ) * item->value / 100.0f ),item->y,3,item->pressed ); + break; + case itPotmeter: + PutImage( &item->Bitmap,item->x,item->y,item->phases, + item->phases * ( item->value / 100.0f ) ); + break; + case itSLabel: + image=fntRender( item->fontid,0,item->width,"%s",item->label ); + goto drawrenderedtext; + case itDLabel: + image=fntRender( item->fontid,( mplTimer / 10 )%item->width,item->width,"%s",Translate( item->label ) ); +drawrenderedtext: + PutImage( image,item->x,item->y,1,0 ); + if ( image ) + { + if ( image->Image ) free( image->Image ); + free( image ); + } + break; + } + } + wsConvert( &appMPlayer.mainWindow,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize ); + mplMainRender=0; + } + wsPutImage( &appMPlayer.mainWindow ); +} + +void mplMsgHandle( int msg,float param ) +{ + int j; + + switch( msg ) + { +// --- user events + case evExit: + wsDoExit(); + break; + case evIconify: + wsIconify( appMPlayer.mainWindow ); + break; + case evFullScreen: + for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) + { + if ( appMPlayer.Items[j].msg == evFullScreen ) + { + appMPlayer.Items[j].tmp=!appMPlayer.Items[j].tmp; + appMPlayer.Items[j].pressed=appMPlayer.Items[j].tmp; + } + } + mplMainRender=1; + mplFullScreen(); + break; + + case evPlaySwitchToPause: + if ( Filename ) + { + btnModify( evPlaySwitchToPause,btnDisabled ); + btnModify( evPauseSwitchToPlay,btnReleased ); + } + if ( mplShMem->Playing == 1 ) goto NoPause; + case evPlay: + mplMainRender=1; + mplPlay(); + break; + + case evPauseSwitchToPlay: + btnModify( evPlaySwitchToPause,btnReleased ); + btnModify( evPauseSwitchToPlay,btnDisabled ); + case evPause: +NoPause: + mplMainRender=1; + mplPause(); + break; + + case evStop: + btnModify( evPlaySwitchToPause,btnReleased ); + btnModify( evPauseSwitchToPlay,btnDisabled ); + mplMainRender=1; + mplStop(); + break; + + case evLoadPlay: + mplMainAutoPlay=1; + case evLoad: + mplMainRender=1; + gtkSendMessage( evLoad ); + break; + case evPrev: + mplMainRender=1; + #ifdef DEBUG + dbprintf( 1,"[mw.h] previous stream ...\n" ); + #endif + break; + case evNext: + mplMainRender=1; + #ifdef DEBUG + dbprintf( 1,"[mw.h] next stream ...\n" ); + #endif + break; + + case evPlayList: + mplMainRender=1; + if ( gtkVisiblePlayList ) + { + btnModify( evPlayList,btnReleased ); + gtkShMem->vs.window=evPlayList; + gtkSendMessage( evHideWindow ); + gtkVisiblePlayList=0; + } + else + { + gtkSendMessage( evPlayList ); + btnModify( evPlayList,btnPressed ); + gtkVisiblePlayList=1; + } + break; + + case evSkinBrowser: gtkSendMessage( evSkinBrowser ); break; + case evAbout: gtkSendMessage( evAbout ); break; + case evPreferences: gtkSendMessage( evPreferences ); break; + + case evForward1min: mplRelSeek( 60 ); break; + case evBackward1min: mplRelSeek( -60 ); break; + case evForward10sec: mplRelSeek( 10 ); break; + case evBackward10sec: mplRelSeek( -10 ); break; + case evSetMoviePosition: mplAbsSeek( param ); break; + + case evIncVolume: mixerIncVolume(); break; + case evDecVolume: mixerDecVolume(); break; + case evSetVolume: mixerSetVolume( param ); break; + case evSetBalance: mixerSetBalance( param ); break; + case evMute: mixerMute(); break; + + case evIncAudioBufDelay: mplIncAudioBufDelay(); break; + case evDecAudioBufDelay: mplDecAudioBufDelay(); break; + + case evNormalSize: if ( mplShMem->Playing ) wsResizeWindow( &appMPlayer.subWindow,mplwidth,mplheight ); break; + case evDoubleSize: if ( mplShMem->Playing ) wsResizeWindow( &appMPlayer.subWindow,mplwidth * 2,mplheight * 2 ); break; + +// --- timer events + case evHideMouseCursor: + wsVisibleMouse( &appMPlayer.subWindow,wsHideMouseCursor ); + break; + case evRedraw: + mplMainRender=1; + wsPostRedisplay( &appMPlayer.mainWindow ); + if ( !mplShMem->Playing ) wsPostRedisplay( &appMPlayer.subWindow ); + XFlush( wsDisplay ); + mplRedrawTimer=mplRedrawTimerConst; + break; + case evGeneralTimer: + if ( mplMainAutoPlay ) + { + mplMainRender=1; + mplMainAutoPlay=0; + mplPlay(); + } + break; +// --- system events + case evNone: + dbprintf( 1,"[mw] event none received.\n" ); + break; + default: + dbprintf( 1,"[mw] unknown event received ( %d,%.2f ).\n",msg,param ); + break; + } +} + +void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) +{ + static int itemtype = 0; + static int SelectedButton = -1; + wItem * item = NULL; + float value = 0.0f; + wsVisibleMouse( &appMPlayer.subWindow,wsShowMouseCursor ); + switch ( Button ) + { + case wsPRMouseButton: + mplShowMenu( RX,RY ); + msButton=wsPRMouseButton; + break; + case wsRRMouseButton: + mplHideMenu( RX,RY ); + msButton=0; + break; + case wsPLMouseButton: + sx=X; sy=Y; + boxMoved=1; + msButton=wsPLMouseButton; + for ( i=0;i < appMPlayer.NumberOfItems + 1;i++ ) + { + item=&appMPlayer.Items[i]; + if ( item->pressed != btnDisabled ) + { + switch( item->type ) + { + case itButton: + if ( wgIsRect( X,Y, + item->x,item->y, + item->x+item->width,item->y+item->height ) ) + { + item->pressed=btnPressed; + mplMainRender=1; + SelectedButton=i; + msButton=0; + boxMoved=0; + } + if ( ( SelectedButton > -1 ) && + ( ( ( appMPlayer.Items[SelectedButton].msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) || + ( ( appMPlayer.Items[SelectedButton].msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) ) + { + appMPlayer.Items[SelectedButton].pressed=btnDisabled; + SelectedButton=i; + appMPlayer.Items[SelectedButton].pressed=btnPressed; + } + itemtype=itButton; + break; + case itPotmeter: + if ( wgIsRect( X,Y, + item->x,item->y, + item->x+item->width,item->y+item->height ) ) + { + item->pressed=btnPressed; + mplMainRender=1; + SelectedButton=i; + boxMoved=0; + msButton=itPotmeter; + itemtype=itPotmeter; + } + break; + case itHPotmeter: + if ( wgIsRect( X,Y, + item->x,item->y, + item->x+item->width,item->y+item->height ) ) + { + item->pressed=btnPressed; + mplMainRender=1; + SelectedButton=i; + boxMoved=0; + msButton=itHPotmeter; + itemtype=itHPotmeter; + } + break; + } + } + } + break; + case wsMoveMouse: + item=&appMPlayer.Items[SelectedButton]; + switch ( msButton ) + { + case wsPLMouseButton: + wsMoveWindow( &appMPlayer.mainWindow,RX - abs( sx ),RY - abs( sy ) ); + mplMainRender=0; + break; + case wsPRMouseButton: + mplMenuMouseHandle( X,Y,RX,RY ); + break; + case itPotmeter: + value=(float)( X - item->x ) / item->width * 100.0f; + goto potihandled; + case itHPotmeter: + value=(float)( X - item->x ) / item->width * 100.0f; +potihandled: + btnModify( item->msg,value ); + if ( ( item->msg == evSetVolume )||( item->msg == evSetBalance ) ) mplMsgHandle( item->msg,item->value ); + mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); + break; + } + break; + case wsRLMouseButton: + msButton=0; + boxMoved=0; + item=&appMPlayer.Items[SelectedButton]; + item->pressed=btnReleased; + switch( itemtype ) + { + case itButton: + if ( wgIsRect( X,Y, + item->x,item->y, + item->x+item->width,item->y+item->height ) ) value=0; + break; + case itPotmeter: + case itHPotmeter: + btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f ); + value=item->value; + break; + } + if ( SelectedButton != -1 ) mplMsgHandle( item->msg,value ); + SelectedButton=-1; + mplMainRender=1; + itemtype=0; + break; + case wsPMMouseButton: break; + case wsRMMouseButton: break; + } + if ( Button != wsMoveMouse ) wsPostRedisplay( &appMPlayer.mainWindow ); +} + +int keyPressed = 0; + +void mplMainKeyHandle( int State,int Type,int Key ) +{ + int msg = evNone; + switch ( Key ) + { + case '.': + case '>': msg=evNext; break; + case ',': + case '<': msg=evPrev; break; + + case wsx: + case wsX: + case wsEscape: msg=evExit; break; + + case wsUp: msg=evForward1min; break; + case wsDown: msg=evBackward1min; break; + case wsRight: msg=evForward10sec; break; + case wsLeft: msg=evBackward10sec; break; + + case wsGrayMul: msg=evIncVolume; break; + case wsGrayDiv: msg=evDecVolume; break; + + case wsGrayPlus: msg=evIncAudioBufDelay; break; + case wsGrayMinus: msg=evDecAudioBufDelay; break; + + case wsEnter: msg=evPlay; break; + case wsSpace: msg=evPause; break; + case wsa: + case wsA: msg=evAbout; break; + case wsb: + case wsB: msg=evSkinBrowser; break; + case wse: + case wsE: msg=evEqualeaser; break; + case wsf: + case wsF: msg=evFullScreen; break; + case wsl: + case wsL: msg=evLoad; break; + case wsm: + case wsM: msg=evMute; break; + case wss: + case wsS: msg=evStop; break; + case wsp: + case wsP: msg=evPlayList; break; + } + if ( ( msg != evNone )&&( Type == wsKeyPressed ) ) + { + mplMsgHandle( msg,0 ); + mplMainRender=1; + wsPostRedisplay( &appMPlayer.mainWindow ); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/pixmaps/cancel.xpm Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,26 @@ +/* XPM */ +static char * cancel_xpm[] = { +"55 16 7 1", +" c None", +". c #FF0000", +"+ c #000000", +"@ c #FF0016", +"# c #FF0008", +"$ c #ED0000", +"% c #F30000", +" ", +" .. . ", +" ... .. ++ ", +" ... .. ++ ", +" @.. .. ++ ", +" ..... ++++ ++++ +++++ ++++ ++++ ++ ", +" #... ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ", +" $$. ++ ++++ ++ ++ ++ ++++++ ++ ", +" .%%. ++ ++ ++ ++ ++ ++ ++ ++ ", +" ....$ ++ ++ ++ ++ ++ ++ ++ ++ ", +" .. .. ++ ++ ++ ++ ++ ++ ++ ++ ++ + ++ ", +" .. .. ++++ +++++ ++ ++ ++++ ++++ ++ ", +" .. .. ", +" .. ", +" ", +" "};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/pixmaps/dir.xpm Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,43 @@ +/* XPM */ +static char * dir_xpm[] = { +"16 16 24 1", +" c None", +". c #4B4B4B", +"+ c #A86A14", +"@ c #A36209", +"# c #9A6213", +"$ c #925808", +"% c #955A08", +"& c #8C5408", +"* c #A46714", +"= c #9D5E09", +"- c #9E5F09", +"; c #9B5D09", +"> c #A5650D", +", c #A4630A", +"' c #A9A9A9", +") c #A4640D", +"! c #ABABAB", +"~ c #A76813", +"{ c #ACACAC", +"] c #ADADAD", +"^ c #A8A8A8", +"/ c #A7A7A7", +"( c #AAAAAA", +"_ c #AEAEAE", +" ", +" ", +" ", +" .... ", +" .+@@. ", +" .#$%&..... ", +" .*=-;>,@,.' ", +" .)@@@@@@@.! ", +" .~@@@@@@@.{ ", +" .,@@@@@@@.' ", +" .@@@@@@@@.] ", +" ..........^ ", +" //^(_^!_// ", +" ", +" ", +" "};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/pixmaps/file.xpm Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,23 @@ +/* XPM */ +static char * file_xpm[] = { +"16 16 4 1", +" c None", +". c #3D3D3D", +"+ c #FDC689", +"@ c #9A9A9A", +" ", +" ", +" .............. ", +" .++++++++++++.@", +" .++++++++++++.@", +" .++..++++..++.@", +" .+....++....+.@", +" .+....++....+.@", +" .++..++++..++.@", +" .++++++++++++.@", +" .++++++++++++.@", +" .++++++++++++.@", +" ..............@", +" ..............@", +" @@@@@@@@@@@@@@", +" "};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/pixmaps/logo.xpm Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,215 @@ +/* XPM */ +static char * logo_xpm[] = { +"100 83 128 2", +"`` c None", +"`. c #040b9a", +"`# c #040ca9", +"`a c #0611e7", +"`b c #040db8", +"`c c #050fd7", +"`d c #050ec8", +"`e c #6e719b", +"`f c #4c51b4", +"`g c #4349ba", +"`h c #6669a1", +"`i c #23299a", +"`j c #171fbb", +"`k c #dddddd", +"`l c #ffffff", +"`m c #8a8ed5", +"`n c #3a41c1", +"`o c #0914db", +"`p c #1e9fa0", +"`q c #24bfc0", +"`r c #2deff1", +"`s c #31e5e7", +"`t c #80e6e7", +"`u c #f1feff", +"`v c #eff0fe", +"`w c #7377cc", +"`x c #0f18d1", +"`y c #27cfd0", +"`z c #53e1e2", +"`A c #4b51c2", +"`B c #8ff7f8", +"`C c #c0c2ed", +"`D c #0c16cf", +"`E c #abf9fa", +"`F c #1a22cd", +"`G c #2adfe0", +"`H c #dfe0ee", +"`I c #0f18c3", +"`J c #65f4f5", +"`K c #0911ad", +"`L c #e3fdfe", +"`M c #555abd", +"`N c #3aeef0", +"`O c #bbbbbb", +"`P c #81f6f7", +"`Q c #d5fcfd", +"`R c #aaaaaa", +"`S c #73f5f6", +"`T c #9df8f9", +"`U c #c7fbfc", +"`V c #21afb0", +"`W c #389fa0", +"`X c #35b6b7", +"`Y c #34c1c2", +"`Z c #4951ee", +"`0 c #1721e9", +"`1 c #3841ec", +"`2 c #2831eb", +"`3 c #7b81f3", +"`4 c #bdc0f9", +"`5 c #777777", +"`6 c #666666", +"`7 c #444444", +"`8 c #555555", +".` c #9ca0f6", +".. c #000000", +".# c #ced0fb", +".a c #cccccc", +".b c #333333", +".c c #888888", +".d c #dee0fc", +".e c #8b90f4", +".f c #6a71f1", +".g c #acb0f7", +".h c #3ae1e3", +".i c #eeeeee", +".j c #46d3d5", +".k c #222222", +".l c #111111", +".m c #999999", +".n c #5961ef", +".o c #58bec0", +".p c #64b1b2", +".q c #7c9596", +".r c #83cfd0", +".s c #4bbfc0", +".t c #2ce1e3", +".u c #8ccccd", +".v c #32ccce", +".w c #b2b5df", +".x c #78c5c6", +".y c #161fc9", +".z c #e2eeee", +".A c #2bd3d5", +".B c #4148c7", +".C c #3bbbbd", +".D c #484fce", +".E c #1533dd", +".F c #4f55d5", +".G c #2029d4", +".H c #0c16dd", +".I c #797ee1", +".J c #1821da", +".K c #9296ec", +".L c #0d17de", +".M c #1d26d0", +".N c #2931cd", +".O c #5359ca", +".P c #5b61d2", +".Q c #8b8ec6", +".R c #2a33de", +".S c #b7ffbf", +".T c #ea113c", +".U c #40d89c", +".V c #444060", +".W c #884440", +".X c #608844", +".Y c #40ea11", +".Z c #3c40d8", +".0 c #9c4440", +".1 c #608844", +".2 c #406088", +".3 c #44409d", +".4 c #352440", +".5 c #884c27", +".6 c #406888", +".7 c #444088", +".8 c #b7ffbf", +"```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````.`a`a`a`a`#``````````````````````````````", +"```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````c`a`a`a`a`a`a`a`a`a`a`a`a`a``````````````````````````", +"`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````b`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a``````````````````````", +"```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````#`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a````````````````````", +"`````````````````````````````````````````````````````````````````````````````````````````````````````````#`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a``````````````````", +"```````````````````````````````````````````````````````````````````````````````````````````#`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a``````````````````", +"`````````````````````````````````````````````````````````````````````````````.`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a````````````````", +"`````````````````````````````````````````````````````````````````c`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a````````````````", +"```````````````````````````````````````````````````b`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`c``````````````", +"`````````````````````````````````````#`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a``````````````", +"```````````````````````````l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`n`a`a`a`a``````````````", +"`````````````````r`r`z`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`A`a`a``````````````", +"`````````````r`r`r`E`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`v`a``````````````", +"`````````G`r`r`r`B`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`H``````````````", +"```````r`r`r`r`r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`M````````````", +"`````y`r`r`r`r`u`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l````````````", +"`````r`r`r`r`r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l````````````", +"```r`r`r`r`r`S`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l``````````", +"```r`r`r`r`r`T`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l``````````", +"```r`r`r`r`r`U`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l``````````", +"```r`r`r`r`r`U`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l``````````", +"`V`r`r`r`r`r`U`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l``````````", +"```r`r`r`r`r`U`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l``````````", +"```r`r`r`r`r`U`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l``````````", +"```r`r`r`r`r`U`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`V````````", +"```r`r`r`r`r`U`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r````````", +"```r`r`r`r`r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r````````", +"```r`r`r`r`r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r````````", +"```y`r`r`r`r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r````````", +"`````r`r`r`r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r````````", +"`````r`r`r`r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`p``````", +"`````r`r`r`r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r``````", +"`````r`r`r`r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r``````", +"`````r`r`r`r`l`l`l`l`l`l`l`l`l`a`a`a.``l`l`l`l`a`a`a`a`l`l`l`Z`a`a`a`a`a`a`a`4`l`l`l........`8`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r``````", +"`````r`r`r`r`l`l`l`l`l`l`l`l`4`a`a`a`a`l`l`l.d`a`a`a`a`l`l`l`Z`a`a`a`a`a`a`a`a`4`l`l`l`5....`O`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r``````", +"`````V`r`r`r`l`l`l`l`l`l`l`l`3`a`a`a`a`l`l`l`0`a`a`a`a`l`l`l`Z`a`a`a`3`Z`a`a`a`a`l`l`l`7....`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r``````", +"```````r`r`r`l`l`l`l`l`l`l`l`0`a`a`a`a.f`l`l`a`a`a`a`a`l`l`l`Z`a`a`a`l`l`3`a`a`a`l`l`l......`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r``````", +"```````r`r`r`l`l`l`l`l`l`l`l`a`a`a`a`a`a`l.f`a`a`a`a`a`4`l`l`Z`a`a`a`l`l`3`a`a`a`l`l`l.....k`l`l`l`l`6.....l`k`5.k`l`l.m.....m`l`l`l.l....`l`l`l`l`O.l.....k.i`l.i`8...k`l`l.l..`O`l`l`l`l`l`l`r`r`G````", +"```````r`r`r`l`l`l`l`l`l`l`l`a`a`a`a`a`a.#`a`a`a`Z`a`a`3`l`l`Z`a`a`a`3`3`a`a`a`a`l`l`k.....m`l`l`l....`7`l.a......`l`O`R.l....`l`l`l.....b`l`l`l.l..`O`l......`l`5.c.....b.l......`l`l`l`l`l`l`r`r`r````", +"```````r`r`r`l`l`l`l`l`l`l`l`a`a`a`4`a`a`0`a`a`a`3`a`a`Z`l`l`Z`a`a`a`a`a`a`a`a.``l`l`5....`l`l`l......`l`l`l....`5`l`l`l`7....`l`l`k.....m`l`l.l....`l`l......`l`l`l.....l`l.....l`l`l`l`l`l`l`r`r`r````", +"```````r`r`r`l`l`l`l`l`l`l`4`a`a`a`l`a`a`a`a`a`4`4`a`a`a`l`l`Z`a`a`a`a`a`a`a`3`l`l`l......`l`l.a....`5`l`l.c.....i`l`l`l......`l`l`5....`l`l`l....`7`l.i....`k`l`l`k....`R`l`6`7`l`l`l`l`l`l`l`r`r`r````", +"```````r`r`r`l`l`l`l`l`l`l.f`a`a`Z`l.f`a`a`a`a`l`l`a`a`a`l`l`Z`a`a`a`l`l`l`l`l`l`l`l......`l`l`7....`O`l`l.k....`l`l`l`l.....k`l`l......`l`l.m...........c`l`l`l`l`5....`l`l`l`l`l`l`l`l`l`l`l`r`r`r````", +"```````V`r`r`l`l`l`l`l`l`l`a`a`a`3`l`l`a`a`a.f`l`l`a`a`a`l`l`Z`a`a`a`l`l`l`l`l`l`l`l....`5`l`l......`l`l`l......`l`l`l.a....`R`l`l......`l`l`5....`5`l`l`l`l`l`l`l......`l`l`l`l`l`l`l`l`l`l`l`r`r`r````", +"`````````r`r`l`l`l`l`l`l`l`a`a`a`4`l`l`a`a`a`l`l`l`a`a`a`l`l`Z`a`a`a`l`l`l`l`l`l`l`O....`O`l`l`7....`R`l.i....`7`l`l`l`5.....i`l`5....`8`l`l.i.....l`l`l`l`6`8`l`l......`l`l`l`l`l`l`l`l`l`l`l`r`r`r`y``", +"`````````r`r`l`l`l`l`l`l`l`a`a`a`l`l`l`4`a`2`l`l`l`a`a`a.g`l`Z`a`a`a`l`l`l`l`l`l`l`k......`7`k`l.......l.b.........c`l.m.........m.....a`l`l`l.b.......k..`8`l`l`l....`5`l`l`l`l`l`l`l`l`l`l`l`r`r`r`r``", +"`````````r`r`l`l`l`l`l`l`l`4`4`4`l`l`l`l`4`v`l`l`l`4`4`4.d`l.#`4`4`4`l`l`l`l`l`l`l`l`O`7`6.i`l`l`l`5`8`k`l`l`5`5`l`l`l`l.m`8.m`l.b....`l`l`l`l`l`k`8`7`5`l`l`l`l.i`O`O.i`l`l`l`l`l`l`l`l`l`l`l`r`r`r`r``", +"`````````r`r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l...l`l`l`l....`5`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r`r`r``", +"`````````r`r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l.....k`l.b...b`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r`r`r``", +"`````````y`r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`8........`R`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r`r`r``", +"```````````r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r`r`r`V", +"```````````r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r`r`r`r", +"```````````r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r`r`r`r", +"```````````r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r`r`r`r", +"```````````r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r`r`r`r", +"```````````r`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`r`r`r`r`r", +"```````````V`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l.``Z`Z`1`Z`3.d`l`l`l`l`l`l`l`l`l`l`l`l`r`r`r`r`r", +"`````````````l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`3`a`a`a`a`a`a`a`a`a`a`2`l`l`l`l`l`l`l`l`l`l`r`r`r`r`r", +"`````````````l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`4`a`a`a`a`a`a`a`a`a`a`a`a`a`a`1`l`l`l`l`l`l`l`l`r`r`r`r`r", +"`````````````l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`Z`a`a`a`a`a`3`v`l`l`l`4`1`a`a`a`a`a`v`l`l`l`l`l`l`r`r`r`r`r", +"`````````````l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`0`a`a`a`0`l`l`l`l`l`l`l`l`l`l`3`a`a`a`a`v`l`l`l`l`l`r`r`r`r`G", +"`````````````l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`Z`a`a`a.``l`l`l`l`l`l`l`l`l`l`l`l`l`a`a`a`a`l`l`l`l`l`r`r`r`r``", +"`````````````l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`4`a`a`a.#`l`l`O...i`l`l`l`l`l`l`l`l`l`l`0`a`a`a`l`l`l.r`r`r`r`q``", +"```````````````l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`a`a`a.``l`l`l`O.....k`l`l`l`l`l`l`l`l`l`l`a`a`a.``l`l.t`r`r`r````", +"```````````````l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l.``a`a`0`l`l`l`l`O........`7`l`l`l`l`l`l`l`l.d`a`a`a`l`l`r`r`r``````", +"``````````````.y`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`a`a`a`v`l`l`l`l`O............`6`l`l`l`l`l`l`l`0`a`a.d.A`r`V````````", +"```````````````a.D`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`a`a`a`l`l`l`l`l`O.................m`l`l`l`l`l.#`a`a.E`p````````````", +"`````````````````a.G`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l.g`a`a`3`l`l`l`l`l`O....................`O`l`l`l`l`a`a`a``````````````", +"`````````````````a`a`a.K`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l`l.n`a`a.d`l`l`l`l`l`O.........................i`l`l`a`a`a``````````````", +"`````````````````a`a`a`a`a`a.N.O.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.R`a`a`l`l`l`l`l`l`O...........................m`l`a`a`a``````````````", +"`````````````````a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`l`l`l`l`l`l`O......................`7`l`l`l`a`a`a``````````````", +"```````````````````a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`#```````````#`a`a`l`l`l`l`l`l`O...................l`l`l`l`l`l`a`a`a``````````````", +"```````````````````a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`d```````````````````````````a`a.g`l`l`l`l`l`O................`O`l`l`l`l`l`l`a`a`a``````````````", +"`````````````````````a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`#```````````````````````````````````````a`a`2`l`l`l`l`l`O............`5`l`l`l`l`l`l`l`l`a`a`a``````````````", +"```````````````````````a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`#`````````````````````````````````````````````````````a`a`a`l`l`l`l`l`O.........b`l`l`l`l`l`l`l`l`l.f`a`a````````````````", +"`````````````````````````a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a`d```````````````````````````````````````````````````````````````````b`a`a`3`l`l`l`l`O.......i`l`l`l`l`l`l`l`l`l`l`a`a`a````````````````", +"`````````````````````````````a`a`a`a`a`a`a`a`a`a`a`a`#`````````````````````````````````````````````````````````````````````````````````a`a`a`l`l`l`l`O..`R`l`l`l`l`l`l`l`l`l`l`l`1`a`a`#````````````````", +"```````````````````````````````````#`#`#```````````````````````````````````````````````````````````````````````````````````````````````#`a`a`a`l`l`l`k`l`l`l`l`l`l`l`l`l`l`l`l.``a`a`a``````````````````", +"`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````a`a`a`a`l`l`l`l`l`l`l`l`l`l`l`l`l`l.``a`a`a````````````````````", +"```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````a`a`a`a.#`l`l`l`l`l`l`l`l`l`l`l`1`a`a`a``````````````````````", +"`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````a`a`a`a`a.g`l`l`l`l`l`l`l.n`a`a`a`a````````````````````````", +"```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````c`a`a`a`a`a`a`a`a`a`a`a`a`a`a`a``````````````````````````", +"```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````a`a`a`a`a`a`a`a`a`a`a`a`#````````````````````````````", +"```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````.`a`a`a`a`a`a`c``````````````````````````````````" +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/pixmaps/ok.xpm Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,26 @@ +/* XPM */ +static char *ok_xpm[] = { +"28 16 6 1", +" c None", +". c #000000", +"# c #4b4b4b", +"a c #8e8e8e", +"b c #c69c6d", +"c c #e6e6e6", +" ", +" ##c ", +" #b#c .. ", +" #bb#c .. ", +" #bbb#c .. ", +" #bbbb#c .... .. .. ", +" #bbbbb#c .. .. .. .. ", +" #bbbbb#a .. .. .... ", +" #bbbb#aa .. .. ... ", +" #bbb#aa .. .. .... ", +" #bb#aa .. .. .. .. ", +" #b#aa .... .. .. ", +" ##aa ", +" aaa ", +" ", +" " +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/pixmaps/up.xpm Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,52 @@ +/* XPM */ +static char * up_xpm[] = { +"16 16 33 1", +" c None", +". c #121212", +"+ c #222222", +"@ c #131313", +"# c #181818", +"$ c #1B1B1B", +"% c #070707", +"& c #232323", +"* c #191919", +"= c #A7A7A7", +"- c #161616", +"; c #4B4B4B", +"> c #A86A14", +", c #A36209", +"' c #9A6213", +") c #925808", +"! c #955A08", +"~ c #8C5408", +"{ c #A46714", +"] c #9D5E09", +"^ c #9E5F09", +"/ c #9B5D09", +"( c #A5650D", +"_ c #A4630A", +": c #A9A9A9", +"< c #A4640D", +"[ c #ABABAB", +"} c #A76813", +"| c #ACACAC", +"1 c #ADADAD", +"2 c #A8A8A8", +"3 c #AAAAAA", +"4 c #AEAEAE", +" . ", +" +@ ", +" @##$%$& ", +" *===.#= ", +" *= -= ", +" *= = ", +" ;;;; *= ", +" ;>,,; = ", +" ;')!~;;;;; ", +" ;{]^/(_,_;: ", +" ;<,,,,,,,;[ ", +" ;},,,,,,,;| ", +" ;_,,,,,,,;: ", +" ;,,,,,,,,;1 ", +" ;;;;;;;;;;2 ", +" ==2342[4== "};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/play.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,138 @@ + +#include <stdlib.h> +#include <stdio.h> + +#include <unistd.h> +#include <signal.h> + +int mplParent = 1; + +int mplx,mply,mplwidth,mplheight; + +#include "../app.h" + +#include "../wm/ws.h" +#include "../wm/wskeys.h" +#include "../wm/widget.h" + +#include "../../config.h" + +#include "widgets.h" +#include "./mplayer.h" +#include "psignal.h" +#include "play.h" + +mplCommStruct * mplShMem; +char * Filename = NULL; + +void mplPlayerThread( void ) +{ +// mplayer( 0,NULL,NULL ); +} + +void mplFullScreen( void ) +{ + if ( appMPlayer.subWindow.isFullScreen ) + { + if ( mplShMem->Playing ) + { + appMPlayer.subWindow.OldX=mplx; + appMPlayer.subWindow.OldY=mply; + appMPlayer.subWindow.OldWidth=mplwidth; + appMPlayer.subWindow.OldHeight=mplheight; + } + else + { + appMPlayer.subWindow.OldWidth=appMPlayer.sub.width; + appMPlayer.subWindow.OldHeight=appMPlayer.sub.height; + appMPlayer.subWindow.OldX=( wsMaxX - appMPlayer.sub.width ) / 2; + appMPlayer.subWindow.OldY=( wsMaxY - appMPlayer.sub.height ) / 2; + } + } + wsFullScreen( &appMPlayer.subWindow ); + wsMoveTopWindow( &appMPlayer.subWindow ); +} + +extern int mplSubRender; + +void mplStop() +{ + if ( !mplShMem->Playing ) return; +// --- +printf("%%%%%% STOP \n"); +// --- + mplShMem->Playing=0; +} + +void mplPlay( void ) +{ + if ( !Filename ) return; + if ( mplShMem->Playing ) mplStop(); +// --- +printf("%%%%%% PLAY \n"); +// --- + mplShMem->Playing=1; +} + +void mplPause( void ) +{ + if ( mplShMem->Playing != 1 ) return; +// --- +printf("%%%%%% PAUSE \n"); +// --- + mplShMem->Playing=2; +} + +void mplResize( unsigned int X,unsigned int Y,unsigned int width,unsigned int height ) +{ +} + +void mplMPlayerInit( int argc,char* argv[], char *envp[] ) +{ + mplShMem=shmem_alloc( ShMemSize ); + signal( SIGTYPE,mplMainSigHandler ); + signal( SIGCHLD,SIG_IGN ); + + mplShMem->Playing=0; + mplShMem->Volume=0.0f; + mplShMem->Position=0.0f; + mplShMem->Balance=50.0f; + mplShMem->Track=0; + mplShMem->AudioType=0; + mplShMem->StreamType=0; + mplShMem->TimeSec=0; + mplShMem->LengthInSec=0; + +// --- +// --- +} + +float mplGetPosition( void ) +{ // return 0.0 ... 100.0 + return mplShMem->Position; +} + +void mplRelSeek( float s ) +{ // -+s +// --- +printf("%%%%%% RelSEEK=%5.3f \n",s); +// --- + mplShMem->Position=mplGetPosition() + s; +} + +void mplAbsSeek( float s ) +{ // 0.0 ... 100.0 +// --- +printf("%%%%%% AbsSEEK=%5.3f \n",s); +// --- + mplShMem->Position=s; + mplShMem->TimeSec=s; +} + +void mplIncAudioBufDelay( void ) +{ +} + +void mplDecAudioBufDelay( void ) +{ +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/play.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,80 @@ + +#ifndef __GUI_PLAY_H +#define __GUI_PLAY_H + +#include "./psignal.h" + +typedef struct +{ + int x; + int y; + int width; + int height; +} mplResizeStruct; + +typedef struct +{ + int signal; + char module[512]; +} mplUnknowErrorStruct; + +typedef struct +{ + int seek; + int format; + int width; + int height; + char codecdll[128]; +} mplVideoStruct; + +typedef struct +{ + int message; + mplResizeStruct resize; + mplVideoStruct videodata; + mplUnknowErrorStruct error; + + int Playing; + float Volume; + float Position; + float Balance; + int Track; + int AudioType; + int StreamType; + int TimeSec; + int LengthInSec; +} mplCommStruct; + +extern mplCommStruct * mplShMem; +extern char * Filename; + +extern int mplParent; + +extern int mplx; +extern int mply; +extern int mplwidth; +extern int mplheight; + +extern mplCommStruct * mplShMem; + +extern void mplMPlayerInit( int argc,char* argv[], char *envp[] ); + +extern void mplStop(); +extern void mplFullScreen( void ); +extern void mplPlay( void ); +extern void mplPause( void ); +extern void mplResize( unsigned int X,unsigned int Y,unsigned int width,unsigned int height ); + +extern void mplIncAudioBufDelay( void ); +extern void mplDecAudioBufDelay( void ); + +extern void mplRelSeek( float s ); +extern void mplAbsSeek( float s ); +extern float mplGetPosition( void ); + +extern void mplPlayFork( void ); +extern void mplSigHandler( int s ); +extern void mplSendMessage( int msg ); +extern void mplPlayerThread( void ); + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/psignal.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,292 @@ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <signal.h> +#include <unistd.h> + +#include "widgets.h" +#include "play.h" + +#include "../app.h" + +#include "../skin/skin.h" +#include "../wm/ws.h" +#include "../config.h" +#include "../error.h" +#include "../language.h" + +#include "../../config.h" + +#include "./mplayer.h" + +#define gtkShow( w ) gtkShMem->vs.window=w; gtkSendMessage( evShowWindow ); + +pid_t mplMPlayerPID = 0; +pid_t mplParentPID = 0; + +pid_t gtkChildPID = 0; +pid_t gtkParentPID = 0; + +int mplCriticalError = 0; +int gtkIsOk = 0; + +void mplErrorHandler( int critical,const char * format, ... ) +{ + char * p; + va_list ap; + int n; + + if ( (p=(char *)malloc( 512 ) ) == NULL ) return; + va_start( ap,format ); + n=vsnprintf( p,512,format,ap ); + va_end( ap ); + mplCriticalError=critical; + gtkMessageBox( p ); +// message( False,p ); +} + +void mplPlayerSigHandler( int s ) +{ + #ifdef DEBUG + dbprintf( 5,"[psignal] mpl sig handler msg: %d\n",mplShMem->message ); + #endif + if ( s != SIGTYPE ) return; + switch ( mplShMem->message ) + { + case mplQuit: +// exit_player( "Quit" ); + break; + case mplPauseEvent: +// if ( osd_function != OSD_PAUSE ) osd_function=OSD_PAUSE; +// else osd_function=OSD_PLAY; + break; + case mplResizeEvent: +// vo_resize=1; +// vo_expose=1; +// dbprintf( 2,"[psignal] resize.\n" ); +// if (video_out != NULL ) video_out->check_events(); + break; + case mplExposeEvent: +// vo_expose=1; +// if (video_out != NULL ) video_out->check_events(); + break; + case mplSeekEvent: +// rel_seek_secs+=mplShMem->videodata.seek; +// if ( rel_seek_secs > 0 ) osd_function=OSD_FFW; +// else osd_function=OSD_REW; + break; + case mplIncAudioBufferDelay: +// audio_delay+=0.1; // increase audio buffer delay +// a_frame-=0.1; + break; + case mplDecAudioBufferDelay: +// audio_delay-=0.1; // increase audio buffer delay +// a_frame+=0.1; + break; + } + mplShMem->message=0; +} + +void gtkSigHandler( int s ) +{ + if ( s != SIGTYPE ) return; + #ifdef DEBUG + dbprintf( 5,"[psignal] gtk sig handler msg: %d\n",gtkShMem->message ); + #endif + switch ( gtkShMem->message ) + { + case evHideWindow: + switch ( gtkShMem->vs.window ) + { + case evPlayList: gtk_widget_hide( PlayList ); gtkVisiblePlayList=0; break; + case evSkinBrowser: gtk_widget_hide( SkinBrowser ); gtkVisibleSkinBrowser=0; break; + case evLoad: gtk_widget_hide( FileSelect ); gtkVisibleFileSelect=0; break; + } + break; + case evSkinBrowser: + if ( gtkVisibleSkinBrowser ) gtk_widget_hide( SkinBrowser ); + gtkClearList( SkinList ); + if ( !gtkFillSkinList( sbMPlayerPrefixDir ) ) break; + if ( gtkFillSkinList( sbMPlayerDirInHome ) ) + { + gtkSetDefaultToCList( SkinList,cfgSkin ); + gtk_widget_show( SkinBrowser ); + gtkVisibleSkinBrowser=1; + gtkShow( evSkinBrowser ); + } + break; + case evPreferences: + if ( gtkVisibleOptions ) gtk_widget_hide( Options ); + gtk_widget_show( Options ); + gtkVisibleOptions=1; + break; + case evPlayList: + if ( gtkVisiblePlayList ) gtk_widget_hide( PlayList ); + gtk_widget_show( PlayList ); + gtkVisiblePlayList=1; + gtkShow( evPlayList ); + break; + case evLoad: + if ( gtkVisibleFileSelect ) gtk_widget_hide( FileSelect ); + gtk_widget_show( FileSelect ); + gtkVisibleFileSelect=1; + gtkShow( evPlay ); + break; + case evMessageBox: + gtk_label_set_text( gtkMessageBoxText,(char *)gtkShMem->mb.str ); + gtk_widget_set_usize( MessageBox,gtkShMem->mb.sx,gtkShMem->mb.sy ); + gtk_widget_set_usize( gtkMessageBoxText,gtkShMem->mb.tsx,gtkShMem->mb.tsy ); + if ( gtkVisibleMessageBox ) gtk_widget_hide( MessageBox ); + gtk_widget_show( MessageBox ); + gtkVisibleMessageBox=1; + break; + case evAbout: + if ( gtkVisibleAboutBox ) gtk_widget_hide( AboutBox ); + gtk_widget_show( AboutBox ); + gtkVisibleAboutBox=1; + break; + case evExit: + gtkExit(); + break; + } + gtkShMem->message=0; +} + +listItems tmpList; + +void mplMainSigHandler( int s ) +{ + #ifdef DEBUG + if ( gtkShMem->message ) dbprintf( 5,"[psignal] main sig handler gtk msg: %d\n",gtkShMem->message ); + if ( mplShMem->message ) dbprintf( 5,"[psignal] main sig handler mpl msg: %d\n",mplShMem->message ); + #endif + + if ( s != SIGTYPE ) return; + + switch ( gtkShMem->message ) + { + case evGtkIsOk: + #ifdef DEBUG + dbprintf( 1,"[psignal] gtk is ok.\n" ); + #endif + gtkIsOk=True; + break; + case evShowWindow: + switch ( gtkShMem->vs.window ) + { + case evPlayList: gtkVisiblePlayList=1; break; + case evLoad: gtkVisibleFileSelect=1; break; + case evSkinBrowser: gtkVisibleSkinBrowser=1; break; + } + break; + case evHideWindow: + switch ( gtkShMem->vs.window ) + { + case evPlayList: + btnModify( evPlayList,btnReleased ); gtkVisiblePlayList=0; + mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); + break; + case evSkinBrowser: gtkVisibleSkinBrowser=0; break; + case evLoad: gtkVisibleFileSelect=0; break; + } + break; + case evSkinBrowser: + if ( strcmp( cfgSkin,gtkShMem->sb.name ) ) + { + int ret; + #ifdef DEBUG + dbprintf( 1,"[psignal] skin: %s\n",gtkShMem->sb.name ); + #endif + + mainVisible=0; + + appInitStruct( &tmpList ); + skinAppMPlayer=&tmpList; + ret=skinRead( gtkShMem->sb.name ); + + appInitStruct( &tmpList ); + skinAppMPlayer=&appMPlayer; + appInitStruct( &appMPlayer ); + if ( !ret ) strcpy( cfgSkin,gtkShMem->sb.name ); + skinRead( cfgSkin ); + + if ( ret ) + { + mainVisible=1; + break; + } + +// 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 ); break; } + wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height ); + wsMoveWindow( &appMPlayer.mainWindow,appMPlayer.main.x,appMPlayer.main.y ); + wsResizeImage( &appMPlayer.mainWindow ); + 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 ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer ); + if ( ( mplMenuDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL ) + { message( False,langNEMDB ); break; } + wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height ); + wsResizeImage( &appMPlayer.menuWindow ); + } + + mplSkinChanged=1; + if ( !mplShMem->Playing ) + { + mplSkinChanged=0; + if ( appMPlayer.subWindow.isFullScreen ) wsFullScreen( &appMPlayer.subWindow ); + wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height ); + wsMoveWindow( &appMPlayer.subWindow,appMPlayer.sub.x,appMPlayer.sub.y ); + if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow ); + mplSubRender=1; wsPostRedisplay( &appMPlayer.subWindow ); + } + } + break; + case evFileLoaded: + if ( Filename ) free( Filename ); + Filename=(char *)malloc( strlen( gtkShMem->fs.dir ) + strlen( gtkShMem->fs.filename ) + 2 ); + strcpy( Filename,gtkShMem->fs.dir ); strcat( Filename,"/" ); strcat( Filename,gtkShMem->fs.filename ); + if ( mplMainAutoPlay ) mplGeneralTimer=1; + break; + case evMessageBox: + if ( mplCriticalError ) + { gtkSendMessage( evExit ); exit( 1 ); } + mplCriticalError=0; + break; + } + +// switch( mplShMem->message ) +// { +// } + gtkShMem->message=0; + mplShMem->message=0; +} + +void mplSendMessage( int msg ) +{ + if ( !mplShMem->Playing ) return; + mplShMem->message=msg; + kill( mplMPlayerPID,SIGTYPE ); usleep( 10 ); + kill( mplMPlayerPID,SIGTYPE ); usleep( 10 ); + kill( mplMPlayerPID,SIGTYPE ); +} + +void gtkSendMessage( int msg ) +{ + if ( !gtkIsOk ) return; + gtkShMem->message=msg; + kill( gtkChildPID,SIGTYPE ); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/psignal.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,61 @@ + +#ifndef __GUI_SIGNAL +#define __GUI_SIGNAL + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <signal.h> + +#define mplNoneEvent 0 +#define mplResizeEvent 1 +#define mplQuit 2 +#define mplPauseEvent 3 +#define mplEndOfFile 4 +#define mplExposeEvent 5 +#define mplSetVideoData 6 +#define mplAudioError 7 +#define mplUnknowError 8 +#define mplSeekEvent 9 +#define mplUnknowFileType 10 +#define mplCodecConfNotFound 11 +#define mplErrorDVDKeyProcess 12 +#define mplErrorDVDAuth 13 +#define mplErrorAVINI 14 +#define mplAVIErrorMissingVideoStream 15 +#define mplASFErrorMissingVideoStream 16 +#define mplMPEGErrorSeqHeaderSearch 17 +#define mplErrorShMemAlloc 18 +#define mplMPEGErrorCannotReadSeqHeader 19 +#define mplMPEGErrorBadSeqHeader 20 +#define mplMPEGErrorCannotReadSeqHeaderExt 21 +#define mplMPEGErrorBadSeqHeaderExt 22 +#define mplCantFindCodecForVideoFormat 23 +#define mplIncompatibleVideoOutDevice 24 +#define mplCompileWithoutDSSupport 25 +#define mplDSCodecNotFound 26 +#define mplCantInitVideoDriver 27 +#define mplIncAudioBufferDelay 28 +#define mplDecAudioBufferDelay 29 + +#define SIGTYPE _NSIG - 1 + +extern int gtkIsOk; + +extern pid_t mplMPlayerPID; +extern pid_t mplParentPID; + +extern pid_t gtkChildPID; +extern pid_t gtkParentPID; + +extern void gtkSigHandler( int s ); +extern void mplPlayerSigHandler( int s ); +extern void mplMainSigHandler( int s ); + +extern void mplSendMessage( int msg ); +extern void gtkSendMessage( int msg ); + +extern void mplErrorHandler( int critical,const char * format, ... ); + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/sw.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,69 @@ + +// sub window + +int mplSubRender = 1; +int mplSubMoved = 0; + +void mplSubDraw( wsParamDisplay ) +{ + if ( !appMPlayer.subWindow.Visible || mplShMem->Playing ) + { + mplSendMessage( mplExposeEvent ); + return; + } + + if ( mplSubRender ) + { + wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); + wsClearWindow( appMPlayer.subWindow ); + if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); + mplSubRender=0; + } + if ( appMPlayer.sub.Bitmap.Image ) wsPutImage( &appMPlayer.subWindow ); + XFlush( wsDisplay ); + XSync( wsDisplay,False ); +} + +void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY ) +{ + mplMouseTimer=mplMouseTimerConst; + wsVisibleMouse( &appMPlayer.subWindow,wsShowMouseCursor ); + + switch( Button ) + { + case wsPRMouseButton: + mplShowMenu( RX,RY ); + msButton=wsPRMouseButton; + break; + case wsRRMouseButton: + mplHideMenu( RX,RY ); + msButton=0; + break; + case wsPLMouseButton: + sx=X; sy=Y; + msButton=wsPLMouseButton; + mplSubMoved=0; + break; + case wsMoveMouse: + switch ( msButton ) + { + case wsPLMouseButton: + mplSubMoved=1; + wsMoveWindow( &appMPlayer.subWindow,RX - sx,RY - sy ); + break; + case wsPRMouseButton: + mplMenuMouseHandle( X,Y,RX,RY ); + mplMouseTimer=mplMouseTimerConst; + break; + } + break; + case wsRLMouseButton: + if ( !mplSubMoved ) wsMoveTopWindow( &appMPlayer.mainWindow ); + msButton=0; + mplSubMoved=0; + break; + } +} + +//void mplSubResizeHandle( unsigned int X,unsigned int Y,unsigned int width,unsigned int height ) +//{ mplResize( X,Y,width,height ); } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/widgets.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,139 @@ + +#include <stdlib.h> +#include <stdio.h> + +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <string.h> +#include <signal.h> + +#include <gdk/gdkkeysyms.h> +#include <gtk/gtk.h> + +#include "widgets.h" + +#include "./mplayer.h" +#include "psignal.h" +#include "../events.h" + +#include "../../config.h" +#include "../error.h" + +#include "pixmaps/up.xpm" +#include "pixmaps/dir.xpm" +#include "pixmaps/file.xpm" +#include "pixmaps/logo.xpm" + +GtkWidget * SkinBrowser; +GtkWidget * PlayList; +GtkWidget * FileSelect; +GtkWidget * MessageBox; +GtkWidget * AboutBox; +GtkWidget * Options; + +int gtkVisibleSkinBrowser = 0; +int gtkVisiblePlayList = 0; +int gtkVisibleFileSelect = 0; +int gtkVisibleMessageBox = 0; +int gtkVisibleAboutBox = 0; +int gtkVisibleOptions = 0; + +gtkCommStruct * gtkShMem; + +#include "gtk/sb.h" +#include "gtk/pl.h" +#include "gtk/fs.h" +#include "gtk/mb.h" +#include "gtk/about.h" +#include "gtk/opts.h" + +void widgetsCreate( void ) +{ + AboutBox=create_About(); + SkinBrowser=create_SkinBrowser(); + PlayList=create_PlayList(); + FileSelect=create_FileSelect(); + MessageBox=create_MessageBox(); + Options=create_Options(); +} + +int gtkParent = 1; + +// --- forked function + +static void gtkThreadProc( int argc,char * argv[] ) +{ + gtk_set_locale(); + gtk_init( &argc,&argv ); + gdk_set_use_xshm( TRUE ); + + widgetsCreate(); + + gtkParentPID=getpid(); + gtkChildPID=getppid(); + gtkParent=0; + + signal( SIGTYPE,gtkSigHandler ); + + gtkIsOk=True; + gtkSendMessage( evGtkIsOk ); + + gtk_main(); + dbprintf( 6,"[gtk] exit.\n" ); + exit( 0 ); +} + +// --- init & close gtk + +void gtkInit( int argc,char* argv[], char *envp[] ) +{ + gtkParentPID=getpid(); + gtkShMem=shmem_alloc( ShMemSize ); + if ( ( gtkChildPID = fork() ) == 0 ) gtkThreadProc( argc,argv ); +} + +void gtkDone( void ) +{ + kill( gtkChildPID,SIGKILL ); + usleep( 1000 ); +} + +void gtkMessageBox( gchar * str ) +{ + gtkShMem->mb.sx=420; gtkShMem->mb.sy=128; + gtkShMem->mb.tsx=384; gtkShMem->mb.tsy=77; + if ( strlen( str ) > 200 ) + { + gtkShMem->mb.sx=512; + gtkShMem->mb.sy=128; + gtkShMem->mb.tsx=476; + gtkShMem->mb.tsy=77; + } + strcpy( gtkShMem->mb.str,str ); + gtkSendMessage( evMessageBox ); +} + +void gtkClearList( GtkWidget * list ) +{ gtk_clist_clear( GTK_CLIST( list ) ); } + +int gtkFindCList( GtkWidget * list,char * item ) +{ + gint j,t; + gchar * tmpstr; + for( t=0,j=0;j<GTK_CLIST( list )->rows;j++ ) + { + gtk_clist_get_text( GTK_CLIST( list ),j,0,&tmpstr ); + if ( !strcmp( tmpstr,item ) ) return j; + } + return -1; +} + +void gtkSetDefaultToCList( GtkWidget * list,char * item ) +{ + gint i; + if ( ( i=gtkFindCList( list,item ) ) > -1 ) gtk_clist_select_row( GTK_CLIST( list ),i,0 ); +} + +void gtkExit( void ) +{ gtk_main_quit(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/mplayer/widgets.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,85 @@ + +#ifndef __MY_WIDGET +#define __MY_WIDGET + +#include <gdk/gdkkeysyms.h> +#include <gtk/gtk.h> + +#include "../shmem.h" + +typedef struct +{ + char dir[ 1024 ]; + char filename[ 1024 ]; +} gtkFileSelectorStruct; + +typedef struct +{ + int sx; + int sy; + int tsx; + int tsy; + char str[512]; +} gtkMessageBoxStruct; + +typedef struct +{ + char name[128]; +} gtkSkinStruct; + +typedef struct +{ + int window; +} gtkVisibleStruct; + +typedef struct +{ + int i; +} gtkOptionsStruct; + +typedef struct +{ + int message; + gtkFileSelectorStruct fs; + gtkMessageBoxStruct mb; + gtkSkinStruct sb; + gtkVisibleStruct vs; + gtkOptionsStruct op; +} gtkCommStruct; + +#define ShMemSize sizeof( gtkCommStruct ) + +extern gtkCommStruct * gtkShMem; + +extern GtkWidget * SkinBrowser; +extern GtkWidget * PlayList; +extern GtkWidget * FileSelect; +extern GtkWidget * MessageBox; +extern GtkWidget * AboutBox; +extern GtkWidget * Options; + +extern GtkWidget * SkinList; +extern GtkWidget * gtkMessageBoxText; + +extern int gtkVisibleSkinBrowser; +extern int gtkVisiblePlayList; +extern int gtkVisibleFileSelect; +extern int gtkVisibleMessageBox; +extern int gtkVisibleAboutBox; +extern int gtkVisibleOptions; + +extern char * sbMPlayerDirInHome; +extern char * sbMPlayerPrefixDir; + +extern void widgetsCreate( void ); + +extern void gtkInit( int argc,char* argv[], char *envp[] ); +extern void gtkDone( void ); +extern void gtkMessageBox( gchar * str ); +extern int gtkFillSkinList( gchar * dir ); +extern void gtkClearList( GtkWidget * list ); +extern void gtkSetDefaultToCList( GtkWidget * list,char * item ); +extern int gtkFindCList( GtkWidget * list,char * item ); +extern void gtkExit( void ); + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/shmem.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,88 @@ +/* + * shmem.c - Shared memory allocation + * + * based on mpg123's xfermem.c by + * Oliver Fromme <oliver.fromme@heim3.tu-clausthal.de> + * Sun Apr 6 02:26:26 MET DST 1997 + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/time.h> +#include <sys/uio.h> +#include <sys/mman.h> +#include <sys/socket.h> +#include <fcntl.h> + +#ifdef AIX +#include <sys/select.h> +#endif + +#include <sys/ipc.h> +#include <sys/shm.h> + +extern int errno; + +#if defined(MAP_ANONYMOUS) && !defined(MAP_ANON) +#define MAP_ANON MAP_ANONYMOUS +#endif + +static int shmem_type=0; + +void* shmem_alloc(int size){ +void* p; +static int devzero = -1; +while(1){ + switch(shmem_type){ + case 0: // ========= MAP_ANON|MAP_SHARED ========== +#ifdef MAP_ANON + p=mmap(0,size,PROT_READ|PROT_WRITE,MAP_ANON|MAP_SHARED,-1,0); + if(p==MAP_FAILED) break; // failed +// printf("shmem: %d bytes allocated using mmap anon (%X)\n",size,p); + return p; +#else +// system does not support MAP_ANON at all (e.g. solaris 2.5.1/2.6), just fail + break; +#endif + case 1: // ========= MAP_SHARED + /dev/zero ========== + if (devzero == -1 && (devzero = open("/dev/zero", O_RDWR, 0)) == -1) break; + p=mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,devzero,0); + if(p==MAP_FAILED) break; // failed +// printf("shmem: %d bytes allocated using mmap /dev/zero (%X)\n",size,p); + return p; + case 2: { // ========= shmget() ========== + struct shmid_ds shmemds; + int shmemid; + if ((shmemid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0600)) == -1) break; + if ((int)(p = shmat(shmemid, 0, 0)) == -1){ + perror ("shmat()"); + shmctl (shmemid, IPC_RMID, &shmemds); + break; + } + if (shmctl(shmemid, IPC_RMID, &shmemds) == -1) { + perror ("shmctl()"); + if (shmdt(p) == -1) perror ("shmdt()"); + break; + } +// printf("shmem: %d bytes allocated using shmget() & shmat() (%X)\n",size,p); + return p; + } + default: + printf("FATAL: Cannot alloate %d bytes shared memory :(\n",size); + return NULL; + } + ++shmem_type; +} +} + +void shmem_free(void* p){ + switch(shmem_type){ + case 2: + if (shmdt(p) == -1) perror ("shmdt()"); + break; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/shmem.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,4 @@ + +void* shmem_alloc(int size); +void shmem_free(void* p); +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/skin/cut.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,21 @@ + +#include <string.h> +#include <stdlib.h> + +void cutItem( char * in,char * out,char sep,int num ) +{ + int i,n,c; + for ( c=0,n=0,i=0;i<strlen( in );i++ ) + { + if ( in[i] == sep ) n++; + if ( n >= num && in[i] != sep ) out[c++]=in[i]; + if ( n >= num && in[i+1] == sep ) { out[c]=0; return; } + } + out[c]=0; +} + +void cutChunk( char * in,char * s1 ) +{ + cutItem( in,s1,'=',0 ); + memmove( in,strchr( in,'=' )+1,strlen( in ) - strlen( s1 ) ); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/skin/cut.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,9 @@ + +#ifndef _MYCUTS +#define _MYCUTS + +extern void cutItem( char * in,char * out,char sep,int num ); + +extern void cutChunk( char * in,char * s1 ); + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/skin/font.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,179 @@ + +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <string.h> + +#include "skin.h" +#include "font.h" +#include "cut.h" +#include "../error.h" + +int items; + +bmpFont * Fonts[25] = { NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL }; + +int fntAddNewFont( char * name ) +{ + int id; + for( id=0;id<25;id++ ) if ( !Fonts[id] ) break; + if ( ( Fonts[id]=malloc( sizeof( bmpFont ) ) ) == NULL ) return -1; + strcpy( Fonts[id]->name,name ); + memset( Fonts[id]->Fnt,-1,256 * sizeof( fntChar ) ); + return id; +} + +void fntFreeFont( int id ) +{ +} + +int fntRead( char * path,char * fname,int id ) +{ + FILE * f; + unsigned char tmp[512]; + unsigned char * ptmp; + unsigned char command[32]; + unsigned char param[256]; + int c,i; + int linenumber = 0; + + strcpy( tmp,path ); strcat( tmp,fname ); strcat( tmp,".fnt" ); + if ( ( f=fopen( tmp,"rt" ) ) == NULL ) return -1; + while ( !feof( f ) ) + { + fgets( tmp,255,f ); 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 < strlen( tmp );c++ ) + if ( tmp[c] == ';' ) + { + tmp[c]=0; + break; + } + if ( strlen( tmp ) == 0 ) continue; + ptmp=strdelspacesbeforecommand( tmp ); + if ( strlen( ptmp ) == 0 ) continue; + ptmp=strswap( ptmp,'\t',' ' ); + ptmp=strdelspaces( ptmp ); + cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 ); + if ( command[0] == '"' ) + { + int i; + cutItem( command,command,'"',1 ); + i=(int)command[0]; + cutItem( param,tmp,',',0 ); Fonts[id]->Fnt[i].x=atoi( tmp ); + cutItem( param,tmp,',',1 ); Fonts[id]->Fnt[i].y=atoi( tmp ); + cutItem( param,tmp,',',2 ); Fonts[id]->Fnt[i].sx=atoi( tmp ); + cutItem( param,tmp,',',3 ); Fonts[id]->Fnt[i].sy=atoi( tmp ); + #ifdef DEBUG + dbprintf( 0,"[font] char: '%s' params: %d,%d %dx%d\n",command,Fonts[id]->Fnt[i].x,Fonts[id]->Fnt[i].y,Fonts[id]->Fnt[i].sx,Fonts[id]->Fnt[i].sy ); + #endif + } + else + { + if ( !strcmp( command,"image" ) ) + { + strcpy( tmp,path ); strcat( tmp,param ); + #ifdef DEBUG + dbprintf( 0,"[font] font imagefile: %s\n",tmp ); + #endif + if ( skinBPRead( tmp,&Fonts[id]->Bitmap ) ) return -2; + } + } + } + return 0; +} + +int fntFindID( char * name ) +{ + int i; + for ( i=0;i < 25;i++ ) + if ( Fonts[i] ) + if ( !strcmp( name,Fonts[i]->name ) ) return i; + return -1; +} + +int fntTextWidth( int id,char * str ) +{ + int size = 0; + int i; + if ( !Fonts[id] ) return 0; + for ( i=0;i < strlen( str );i++ ) + if ( Fonts[id]->Fnt[ (int)str[i] ].sx != -1 ) size+=Fonts[id]->Fnt[ (int)str[i] ].sx; + return size; +} + +int fntTextHeight( int id,char * str ) +{ + int max = 0,i; + if ( !Fonts[id] ) return 0; + for ( i=0;i < strlen( str );i++ ) + if ( Fonts[id]->Fnt[ (int)str[i] ].sy > max ) max=Fonts[id]->Fnt[ (int)str[i] ].sy; + return max; +} + +txSample * fntRender( int id,int px,int sx,char * fmt,... ) +{ + txSample * tmp = NULL; + char p[512]; + va_list ap; + unsigned long * ibuf; + unsigned long * obuf; + int i,x,y; + int oy = 0, ox = 0, dx = 0; + + va_start( ap,fmt ); + vsnprintf( p,512,fmt,ap ); + va_end( ap ); + + if ( ( !Fonts[id] )|| + ( !strlen( p ) )|| + ( !fntTextWidth( id,p ) )|| + ( (tmp=malloc( sizeof( txSample ) )) == NULL ) ) return NULL; + + tmp->Width=fntTextWidth( id,p ); + tmp->Height=fntTextHeight( id,p ); + tmp->BPP=32; + tmp->ImageSize=tmp->Width * tmp->Height * 4; + if ( ( tmp->Image=malloc( tmp->ImageSize ) ) == NULL ) return NULL; + + obuf=(unsigned long *)tmp->Image; + ibuf=(unsigned long *)Fonts[id]->Bitmap.Image; + for ( i=0;i < strlen( p );i++ ) + { + int c = (int)p[i]; + if ( Fonts[id]->Fnt[c].x == -1 ) c=32; + for ( oy=0,y=Fonts[id]->Fnt[c].y;y < Fonts[id]->Fnt[c].y + Fonts[id]->Fnt[c].sy; y++,oy++ ) + for ( ox=0,x=Fonts[id]->Fnt[c].x;x < Fonts[id]->Fnt[c].x + Fonts[id]->Fnt[c].sx; x++,ox++ ) + { + obuf[ oy * tmp->Width + dx + ox ]=ibuf[ y * Fonts[id]->Bitmap.Width + x ]; + } + dx+=Fonts[id]->Fnt[c].sx; + } + + if ( ( sx > 0 )&&( sx < tmp->Width ) ) + { + txSample tmp2; + tmp2.ImageSize=sx * tmp->Height * 4; + if ( ( tmp2.Image=malloc( tmp2.ImageSize ) ) == NULL ) { free( tmp->Image ); return NULL; } + + obuf=(unsigned long *)tmp->Image; + ibuf=(unsigned long *)tmp2.Image; + + for ( y=0;y < tmp->Height;y++ ) + { + ox=px; + oy=y * sx; dx=y * tmp->Width; + for ( x=0;x < sx;x++ ) + { + ibuf[oy++]=obuf[dx + ox++]; + if ( ox >= tmp->Width ) ox=0; + } + } + + free( tmp->Image ); tmp->Width=sx; tmp->ImageSize=tmp2.ImageSize; tmp->Image=tmp2.Image; + } + + return tmp; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/skin/font.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,31 @@ + +#ifndef _MYFONT +#define _MYFONT + +#include "../bitmap/bitmap.h" + +typedef struct +{ + int x,y; // location + int sx,sy; // size +} fntChar; + +typedef struct +{ + fntChar Fnt[256]; + txSample Bitmap; + char name[128]; +} bmpFont; + +extern fntChar Fnt[256]; +extern txSample Bitmap; +extern bmpFont * Fonts[25]; + +extern int fntAddNewFont( char * name ); +extern void fntFreeFont( int id ); +extern int fntFindID( char * name ); + +extern int fntRead( char * path,char * fname,int id ); +extern txSample * fntRender( int id,int px,int sx,char * fmt,... ); + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/skin/skin.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,706 @@ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "cut.h" +#include "error.h" +#include "font.h" +#include "../app.h" +#include "../language.h" +#include "../../config.h" + +char SkinDir[] = "/.mplayer/Skin/"; +char * Skin; + +listItems * skinAppMPlayer = &appMPlayer; +listItems * skinAppTV = &appTV; +listItems * skinAppRadio = &appRadio; + +int linenumber; + +unsigned char path[512],fn[512]; + +listItems * defList = NULL; +unsigned char winList[32] = ""; + +#include <stdarg.h> + +void ERRORMESSAGE( const char * format, ... ) +{ + char p[512]; + va_list ap; + va_start( ap,format ); + vsnprintf( p,512,format,ap ); + va_end( ap ); + message( False,"[skin] error in skin config file on line %d: %s",linenumber,p ); +} + +#define CHECKDEFLIST( str ) { \ + if ( defList == NULL ) \ + { \ + message( False,"[skin] warning in skin config file on line %d: widget found but before \"section\" not found ("str")",linenumber ); \ + return 1; \ + } \ + } +#define CHECKWINLIST( str ) { \ + if ( !strlen( winList ) ) \ + { \ + message( False,"[skin] warning in skin config file on line %d: widget found but before \"subsection\" not found ("str")",linenumber ); \ + return 1; \ + } \ + } + +char * strlower( char * in ) +{ + int i; + for( i=0;i<strlen( in );i++ ) in[i]=( in[i] >= 'A' ? ( in[i] <= 'Z' ? in[i]+='A' : in[i] ) : in[i] ); + return in; +} + +int skinBPRead( char * fname, txSample * bf ) +{ + int i=bpRead( fname,bf ); + switch ( i ) + { + case -1: ERRORMESSAGE( "16 bits or less depth bitmap not supported ( %s ).\n",fname ); break; + case -2: ERRORMESSAGE( "file not found ( %s )\n",fname ); break; + case -3: ERRORMESSAGE( "bmp read error ( %s )\n",fname ); break; + case -4: ERRORMESSAGE( "tga read error ( %s )\n",fname ); break; + case -5: ERRORMESSAGE( "png read error ( %s )\n",fname ); break; + case -6: ERRORMESSAGE( "RLE packed tga not supported ( %s )\n",fname ); break; + case -7: ERRORMESSAGE( "unknown file type ( %s )\n",fname ); break; + case -8: ERRORMESSAGE( "24 bit to 32 bit convert error ( %s )\n",fname ); break; + } + return i; +} + +int __section( char * in ) +{ + strlower( in ); + defList=NULL; + if ( !strcmp( in,"movieplayer" ) ) defList=skinAppMPlayer; + #ifdef DEBUG + dbprintf( 3,"\n[skin] sectionname: %s\n",in ); + #endif + return 0; +} + +int __end( char * in ) +{ + if ( strlen( winList ) ) winList[0]=0; + else defList=NULL; + #ifdef DEBUG + dbprintf( 3,"\n[skin] end section\n" ); + #endif + return 0; +} + +int __window( char * in ) +{ + CHECKDEFLIST( "window" ); + + strlower( in ); + strcpy( winList,in ); + #ifdef DEBUG + dbprintf( 3,"\n[skin] window: %s\n",winList ); + #endif + return 0; +} + +int __base( char * in ) +{ + unsigned char fname[512]; + unsigned char tmp[512]; + int x,y; + + CHECKDEFLIST( "base" ); + CHECKWINLIST( "base" ); + + cutItem( in,fname,',',0 ); + cutItem( in,tmp,',',1 ); x=atoi( tmp ); + cutItem( in,tmp,',',2 ); y=atoi( tmp ); + #ifdef DEBUG + dbprintf( 3,"\n[skin] base: %s x: %d y: %d\n",fname,x,y ); + #endif + if ( !strcmp( winList,"main" ) ) + { + defList->main.x=x; + defList->main.y=y; + defList->main.type=itBase; + strcpy( tmp,path ); strcat( tmp,fname ); + if ( skinBPRead( tmp,&defList->main.Bitmap ) ) return 1; + defList->main.width=defList->main.Bitmap.Width; + defList->main.height=defList->main.Bitmap.Height; + #ifdef HAVE_XSHAPE + defList->main.Mask.Width=defList->main.Bitmap.Width; + defList->main.Mask.Height=defList->main.Bitmap.Height; + defList->main.Mask.BPP=1; + defList->main.Mask.ImageSize=defList->main.Mask.Width * defList->main.Mask.Height / 8; + defList->main.Mask.Image=(char *)calloc( 1,defList->main.Mask.ImageSize ); + if ( defList->main.Mask.Image == NULL ) message( True,langNEMFMM ); + { + int i,b,c=0; unsigned long * buf = NULL; unsigned char tmp = 0; + buf=(unsigned long *)defList->main.Bitmap.Image; + for ( b=0,i=0;i < defList->main.Mask.Width * defList->main.Mask.Height;i++ ) + { + if ( buf[i] != 0x00ff00ff ) tmp=( tmp >> 1 )|128; + else { tmp=tmp >> 1; buf[i]=0; } + if ( b++ == 7 ) { defList->main.Mask.Image[c++]=tmp; tmp=0; b=0; } + } + defList->main.Mask.Image[c++]=tmp; + } + #ifdef DEBUG + dbprintf( 3,"[skin] mask: %dX%d\n",defList->main.Mask.Width,defList->main.Mask.Height ); + #endif + #else + defList->main.Mask.Image=NULL; + #endif + #ifdef DEBUG + dbprintf( 3,"[skin] width: %d height: %d\n",defList->main.width,defList->main.height ); + #endif + } + if ( !strcmp( winList,"sub" ) ) + { + defList->sub.x=x; + defList->sub.y=y; + defList->sub.type=itBase; + strcpy( tmp,path ); strcat( tmp,fname ); + if ( skinBPRead( tmp,&defList->sub.Bitmap ) ) return 1; + defList->sub.width=defList->sub.Bitmap.Width; + defList->sub.height=defList->sub.Bitmap.Height; + #ifdef DEBUG + dbprintf( 3,"[skin] width: %d height: %d\n",defList->sub.width,defList->sub.height ); + #endif + } +/* + if ( !strcmp( winList,"eq" ) ) + { + defList->eq.x=x; + defList->eq.y=y; + defList->eq.type=itBase; + strcpy( tmp,path ); strcat( tmp,fname ); + if ( skinBPRead( tmp,&defList->eq.Bitmap ) ) return 1; + defList->eq.width=defList->eq.Bitmap.Width; + defList->eq.height=defList->eq.Bitmap.Height; + #ifdef DEBUG + dbprintf( 3,"[skin] width: %d height: %d\n",defList->eq.width,defList->eq.height ); + #endif + } +*/ + if ( !strcmp( winList,"menu" ) ) + { + defList->menuBase.type=itBase; + strcpy( tmp,path ); strcat( tmp,fname ); + if ( skinBPRead( tmp,&defList->menuBase.Bitmap ) ) return 1; + defList->menuBase.width=defList->menuBase.Bitmap.Width; + defList->menuBase.height=defList->menuBase.Bitmap.Height; + #ifdef DEBUG + dbprintf( 3,"[skin] width: %d height: %d\n",defList->menuBase.width,defList->menuBase.height ); + #endif + } + return 0; +} + +int __background( char * in ) +{ + unsigned char tmp[512]; + + CHECKDEFLIST( "background" ); + CHECKWINLIST( "background" ); + + if ( !strcmp( winList,"sub" ) ) + { + cutItem( in,tmp,',',0 ); defList->subR=atoi( tmp ); + cutItem( in,tmp,',',1 ); defList->subG=atoi( tmp ); + cutItem( in,tmp,',',2 ); defList->subB=atoi( tmp ); + #ifdef DEBUG + dbprintf( 3,"\n[skin] subwindow background color is #%x%x%x.\n",defList->subR,defList->subG,defList->subB ); + #endif + } + return 0; +} + +int __button( char * in ) +{ + unsigned char fname[512]; + unsigned char tmp[512]; + int x,y,sx,sy; + unsigned char msg[32]; + + CHECKDEFLIST( "button" ); + CHECKWINLIST( "button" ); + +// button=prev,17,89,23,18,Up,evPrev + + cutItem( in,fname,',',0 ); + cutItem( in,tmp,',',1 ); x=atoi( tmp ); + cutItem( in,tmp,',',2 ); y=atoi( tmp ); + cutItem( in,tmp,',',3 ); sx=atoi( tmp ); + cutItem( in,tmp,',',4 ); sy=atoi( tmp ); + cutItem( in,msg,',',5 ); + + defList->NumberOfItems++; + defList->Items[ defList->NumberOfItems ].type=itButton; + defList->Items[ defList->NumberOfItems ].x=x; + defList->Items[ defList->NumberOfItems ].y=y; + defList->Items[ defList->NumberOfItems ].width=sx; + defList->Items[ defList->NumberOfItems ].height=sy; + #ifdef DEBUG + dbprintf( 3,"\n[skin] button: fname: %s\n",fname ); + dbprintf( 3,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); + #endif + + if ( ( defList->Items[ defList->NumberOfItems ].msg=appFindMessage( msg ) ) == -1 ) + { ERRORMESSAGE( "unknown message: %s\n",msg ); return 1; } + defList->Items[ defList->NumberOfItems ].pressed=btnReleased; + if ( defList->Items[ defList->NumberOfItems ].msg == evPauseSwitchToPlay ) defList->Items[ defList->NumberOfItems ].pressed=btnDisabled; + defList->Items[ defList->NumberOfItems ].tmp=1; + + #ifdef DEBUG + dbprintf( 3,"[skin] message: %d\n", + defList->Items[ defList->NumberOfItems ].msg ); + #endif + + defList->Items[ defList->NumberOfItems ].Bitmap.Image=NULL; + if ( strcmp( fname,"NULL" ) ) + { + strcpy( tmp,path ); strcat( tmp,fname ); + if ( skinBPRead( tmp,&defList->Items[ defList->NumberOfItems ].Bitmap ) ) return 1; + } + return 0; +} + +int __selected( char * in ) +{ + unsigned char fname[512]; + unsigned char tmp[512]; + + CHECKDEFLIST( "selected" ); + CHECKWINLIST( "selected" ); + + cutItem( in,fname,',',0 ); + defList->menuSelected.type=itBase; + strcpy( tmp,path ); strcat( tmp,fname ); + #ifdef DEBUG + dbprintf( 3,"\n[skin] selected: %s\n",fname ); + #endif + if ( skinBPRead( tmp,&defList->menuSelected.Bitmap ) ) return 1; + defList->menuSelected.width=defList->menuSelected.Bitmap.Width; + defList->menuSelected.height=defList->menuSelected.Bitmap.Height; + #ifdef DEBUG + dbprintf( 3,"[skin] width: %d height: %d\n",defList->menuSelected.width,defList->menuSelected.height ); + #endif + return 0; +} + +int __menu( char * in ) +{ // menu = number,x,y,sx,sy,msg + int x,y,sx,sy,msg; + unsigned char tmp[64]; + + CHECKDEFLIST( "menu" ); + CHECKWINLIST( "menu" ); + + cutItem( in,tmp,',',0 ); x=atoi( tmp ); + cutItem( in,tmp,',',1 ); y=atoi( tmp ); + cutItem( in,tmp,',',2 ); sx=atoi( tmp ); + cutItem( in,tmp,',',3 ); sy=atoi( tmp ); + cutItem( in,tmp,',',4 ); msg=appFindMessage( tmp ); + + defList->NumberOfMenuItems++; + defList->MenuItems[ defList->NumberOfMenuItems ].x=x; + defList->MenuItems[ defList->NumberOfMenuItems ].y=y; + defList->MenuItems[ defList->NumberOfMenuItems ].width=sx; + defList->MenuItems[ defList->NumberOfMenuItems ].height=sy; + + #ifdef DEBUG + dbprintf( 3,"\n[skin] menuitem: %d\n",defList->NumberOfMenuItems ); + dbprintf( 3,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); + #endif + + if ( ( defList->MenuItems[ defList->NumberOfMenuItems ].msg=msg ) == -1 ) + ERRORMESSAGE( "unknown message: %s\n",tmp ); + + #ifdef DEBUG + dbprintf( 3,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg ); + #endif + + defList->MenuItems[ defList->NumberOfMenuItems ].Bitmap.Image=NULL; + return 0; +} + +int __hpotmeter( char * in ) +{ // hpotmeter=buttonbitmaps,sx,sy,phasebitmaps,phases,default value,x,y,sx,sy,msg + int x,y,psx,psy,ph,sx,sy,msg,d; + unsigned char tmp[512]; + unsigned char pfname[512]; + unsigned char phfname[512]; + wItem * item; + + CHECKDEFLIST( "hpotmeter" ); + CHECKWINLIST( "hpotmeter" ); + + cutItem( in,pfname,',',0 ); + cutItem( in,tmp,',',1 ); psx=atoi( tmp ); + cutItem( in,tmp,',',2 ); psy=atoi( tmp ); + cutItem( in,phfname,',',3 ); + cutItem( in,tmp,',',4 ); ph=atoi( tmp ); + cutItem( in,tmp,',',5 ); d=atoi( tmp ); + cutItem( in,tmp,',',6 ); x=atoi( tmp ); + cutItem( in,tmp,',',7 ); y=atoi( tmp ); + cutItem( in,tmp,',',8 ); sx=atoi( tmp ); + cutItem( in,tmp,',',9 ); sy=atoi( tmp ); + cutItem( in,tmp,',',10 ); msg=appFindMessage( tmp ); + + #ifdef DEBUG + dbprintf( 3,"\n[skin] hpotmeter: pointer filename: '%s'\n",pfname ); + dbprintf( 3, "[skin] pointer size is %dx%d\n",psx,psy ); + dbprintf( 3, "[skin] phasebitmaps filename: '%s'\n",phfname ); + dbprintf( 3, "[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); + dbprintf( 3, "[skin] default value: %d\n",d ); + dbprintf( 3, "[skin] message: %d\n",msg ); + #endif + + defList->NumberOfItems++; + item=&defList->Items[ defList->NumberOfItems ]; + item->type=itHPotmeter; + item->x=x; item->y=y; item->width=sx; item->height=sy; + item->phases=ph; + item->psx=psx; item->psy=psy; + item->msg=msg; + item->value=(float)d; + item->pressed=btnReleased; + + item->Bitmap.Image=NULL; + if ( strcmp( phfname,"NULL" ) ) + { + strcpy( tmp,path ); strcat( tmp,phfname ); + if ( skinBPRead( tmp,&item->Bitmap ) ) return 1; + } + + item->Mask.Image=NULL; + if ( strcmp( pfname,"NULL" ) ) + { + strcpy( tmp,path ); strcat( tmp,pfname ); + if ( skinBPRead( tmp,&item->Mask ) ) return 1; + } + + return 0; +} + +int __potmeter( char * in ) +{ // potmeter=phasebitmaps,phases,default value,x,y,sx,sy,msg + int x,y,ph,sx,sy,msg,d; + unsigned char tmp[512]; + unsigned char phfname[512]; + wItem * item; + + CHECKDEFLIST( "potmeter" ); + CHECKWINLIST( "potmeter" ); + + cutItem( in,phfname,',',0 ); + cutItem( in,tmp,',',1 ); ph=atoi( tmp ); + cutItem( in,tmp,',',2 ); d=atoi( tmp ); + cutItem( in,tmp,',',3 ); x=atoi( tmp ); + cutItem( in,tmp,',',4 ); y=atoi( tmp ); + cutItem( in,tmp,',',5 ); sx=atoi( tmp ); + cutItem( in,tmp,',',6 ); sy=atoi( tmp ); + cutItem( in,tmp,',',7 ); msg=appFindMessage( tmp ); + + #ifdef DEBUG + dbprintf( 3,"\n[skin] potmeter: phases filename: '%s'\n",phfname ); + dbprintf( 3, "[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); + dbprintf( 3, "[skin] phases: %d\n",ph ); + dbprintf( 3, "[skin] default value: %d\n",d ); + dbprintf( 3, "[skin] message: %d\n",msg ); + #endif + + defList->NumberOfItems++; + item=&defList->Items[ defList->NumberOfItems ]; + item->type=itPotmeter; + item->x=x; item->y=y; + item->width=sx; item->height=sy; + item->phases=ph; + item->msg=msg; + item->value=(float)d; + + item->Bitmap.Image=NULL; + if ( strcmp( phfname,"NULL" ) ) + { + strcpy( tmp,path ); strcat( tmp,phfname ); + if ( skinBPRead( tmp,&item->Bitmap ) ) return 1; + } + return 0; +} + +int __font( char * in ) +{ // font=fontname,fontid + char name[512]; + char id[512]; + wItem * item; + + CHECKDEFLIST( "font" ); + CHECKWINLIST( "font" ); + + cutItem( in,name,',',0 ); + cutItem( in,id,',',1 ); + + #ifdef DEBUG + dbprintf( 3,"\n[skin] font\n" ); + dbprintf( 3, "[skin] name: %s\n",name ); + #endif + + defList->NumberOfItems++; + item=&defList->Items[ defList->NumberOfItems ]; + item->type=itFont; + item->fontid=fntAddNewFont( name ); + switch ( item->fontid ) + { + case -1: ERRORMESSAGE( "not enought memory\n" ); return 1; + case -2: ERRORMESSAGE( "too many fonts\n" ); return 1; + } + + #ifdef DEBUG + dbprintf( 3, "[skin] id: %s ( %d )\n",id,item->fontid ); + #endif + + switch ( fntRead( path,name,item->fontid ) ) + { + case -1: ERRORMESSAGE( "font file not found\n" ); return 1; + case -2: ERRORMESSAGE( "font image not found\n" ); return 1; + } + + return 0; +} + +int __slabel( char * in ) +{ + char tmp[512]; + char sid[63]; + int x,y,id; + wItem * item; + + CHECKDEFLIST( "slabel" ); + CHECKWINLIST( "slabel" ); + + #ifdef DEBUG + dbprintf( 3,"\n[skin] slabel\n" ); + #endif + + cutItem( in,tmp,',',0 ); x=atoi( tmp ); + cutItem( in,tmp,',',1 ); y=atoi( tmp ); + cutItem( in,sid,',',2 ); id=fntFindID( sid ); + if ( id < 0 ) { ERRORMESSAGE( "nonexistent font id. ( %s )\n",sid ); return 1; } + cutItem( in,tmp,',',3 ); cutItem( tmp,tmp,'"',1 ); + + #ifdef DEBUG + dbprintf( 3, "[skin] pos: %d,%d\n",x,y ); + dbprintf( 3, "[skin] id: %s ( %d )\n",sid,id ); + dbprintf( 3, "[skin] str: '%s'\n",tmp ); + #endif + + defList->NumberOfItems++; + item=&defList->Items[ defList->NumberOfItems ]; + item->type=itSLabel; + item->fontid=id; + item->x=x; item->y=y; + item->width=-1; item->height=-1; + if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( "not enought memory.\n" ); return 1; } + strcpy( item->label,tmp ); + + return 0; +} + +int __dlabel( char * in ) +{ // dlabel=x,y,sx,align,fontid,string ... + char tmp[512]; + char sid[63]; + int x,y,sx,id,a; + wItem * item; + + CHECKDEFLIST( "dlabel" ); + CHECKWINLIST( "dlabel" ); + + #ifdef DEBUG + dbprintf( 3,"\n[skin] dlabel\n" ); + #endif + + cutItem( in,tmp,',',0 ); x=atoi( tmp ); + cutItem( in,tmp,',',1 ); y=atoi( tmp ); + cutItem( in,tmp,',',2 ); sx=atoi( tmp ); + cutItem( in,tmp,',',3 ); a=atoi( tmp ); + cutItem( in,sid,',',4 ); id=fntFindID( sid ); + if ( id < 0 ) { ERRORMESSAGE( "nonexistent font id. ( %s )\n",sid ); return 1; } + cutItem( in,tmp,',',5 ); cutItem( tmp,tmp,'"',1 ); + + #ifdef DEBUG + dbprintf( 3,"[skin] pos: %d,%d width: %d align: %d\n",x,y,sx,a ); + dbprintf( 3,"[skin] id: %s ( %d )\n",sid,id ); + dbprintf( 3,"[skin] str: '%s'\n",tmp ); + #endif + + defList->NumberOfItems++; + item=&defList->Items[ defList->NumberOfItems ]; + item->type=itDLabel; + item->fontid=id; item->align=a; + item->x=x; item->y=y; + item->width=sx; item->height=-1; + if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( "not enought memory.\n" ); return 1; } + strcpy( item->label,tmp ); + + return 0; +} + +typedef struct +{ + char * name; + int (*func)( char * in ); +} _item; + +_item skinItem[] = + { + { "section", __section }, + { "end", __end }, + { "window", __window }, + { "base", __base }, + { "button", __button }, + { "selected", __selected }, + { "background", __background }, + { "hpotmeter", __hpotmeter }, + { "potmeter", __potmeter }, + { "font", __font }, + { "slabel", __slabel }, + { "dlabel", __dlabel }, + { "menu", __menu } + }; + +#define ITEMS ( sizeof( skinItem )/sizeof( _item ) ) + +char * strdelspacesbeforecommand( char * in ) +{ + int c = 0; + char * out; + if ( strlen( in ) == 0 ) return NULL; + while ( in[c] == ' ' ) c++; + if ( c != 0 ) + { + out=malloc( strlen( in ) - c + 1 ); + memcpy( out,&in[c],strlen( in ) - c + 1 ); + } + else out=in; + return out; +} + +char * strswap( char * in,char what,char whereof ) +{ + int i; + if ( strlen( in ) == 0 ) return NULL; + for ( i=0;i<strlen( in );i++ ) + if ( in[i] == what ) in[i]=whereof; + return in; +} + +char * strdelspaces( char * in ) +{ + int c = 0,i = 0,id = 0; + if ( strlen( in ) == 0 ) return NULL; + while ( c != strlen( in ) ) + { + if ( in[c] == '"' ) id=!id; + if ( ( in[c] == ' ' )&&( !id ) ) + { + for ( i=0;i<strlen( in ) - c; i++ ) in[c+i]=in[c+i+1]; + continue; + } + c++; + } + return in; +} + +FILE * skinFile; + +void setname( char * item1, char * item2 ) +{ strcpy( fn,item1 ); strcat( fn,"/" ); strcat( fn,item2 ); strcpy( path,fn ); strcat( path,"/" ); strcat( fn,"/skin" ); } + +int skinRead( char * dname ) +{ + unsigned char tmp[255]; + unsigned char * ptmp; + unsigned char command[32]; + unsigned char param[256]; + int c,i; + + setname( skinMPlayerDir,dname ); + if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) + { + setname( skinDirInHome,dname ); + if ( ( skinFile = fopen( fn,"rt" ) ) == NULL ) + { + dbprintf( 3,"[skin] file ( %s ) not found.\n",fn ); + return -1; + } + } + + #ifdef DEBUG + dbprintf( 3,"[skin] file: %s\n",fn ); + #endif + + appInitStruct( &appMPlayer ); + + linenumber=0; + while ( !feof( skinFile ) ) + { + 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<strlen( tmp );c++ ) + if ( tmp[c] == ';' ) + { + tmp[c]=0; + break; + } + if ( strlen( tmp ) == 0 ) continue; + ptmp=strdelspacesbeforecommand( tmp ); + if ( strlen( ptmp ) == 0 ) continue; + ptmp=strswap( ptmp,'\t',' ' ); + ptmp=strdelspaces( 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; + } + return 0; +} + +void btnModify( int event,float state ) +{ + int j; + for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) + if ( appMPlayer.Items[j].msg == event ) + { + switch ( appMPlayer.Items[j].type ) + { + case itButton: + appMPlayer.Items[j].pressed=(int)state; + break; + case itPotmeter: + case itHPotmeter: + if ( state < 0.0f ) state=0.0f; + if ( state > 100.f ) state=100.0f; + appMPlayer.Items[j].value=state; + break; + } + } +} + +int btnGetValue( int event ) +{ + int j; + for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ ) + if ( appMPlayer.Items[j].msg == event ) return appMPlayer.Items[j].value; + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/skin/skin.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,23 @@ + +#ifndef __MY_SKIN +#define __MY_SKIN + +#include "../app.h" + +extern listItems * skinAppMPlayer; +//extern listItems * skinAppTV; +//extern listItems * skinAppRadio; + +extern int skinRead( char * dname ); +extern int skinBPRead( char * fname, txSample * bf ); + +extern void btnModify( int event,float state ); +extern int btnGetValue( int event ); + +// --- + +extern char * strdelspacesbeforecommand( char * in ); +extern char * strswap( char * in,char what,char whereof ); +extern char * strdelspaces( char * in ); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/timer.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,37 @@ + +#include <signal.h> +#include <time.h> +#include <sys/time.h> + +#include "timer.h" + +static struct itimerval it; +static struct sigaction sa; + +timerTSigHandler timerSigHandler; + +void timerSetHandler( timerTSigHandler handler ) +{ timerSigHandler=handler; } + +void timerInit( void ) +{ + sa.sa_handler=timerSigHandler; + sa.sa_flags=SA_RESTART; + sigemptyset( &sa.sa_mask ); + sigaction( SIGALRM,&sa,NULL ); + it.it_interval.tv_sec=0; + it.it_interval.tv_usec=20000; + it.it_value.tv_sec=0; + it.it_value.tv_usec=50000; + setitimer( ITIMER_REAL,&it,NULL ); +} + +void timerDone( void ) +{ + it.it_interval.tv_sec=0; + it.it_interval.tv_usec=0; + it.it_value.tv_sec=0; + it.it_value.tv_usec=0; + setitimer( ITIMER_REAL,&it,NULL ); +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/timer.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,12 @@ + +#ifndef __MYTIMER +#define __MYTIMER + +typedef void (* timerTSigHandler)( int signum ); +extern timerTSigHandler timerSigHandler; + +extern void timerSetHandler( timerTSigHandler handler ); +extern void timerInit( void ); +extern void timerDone( void ); + +#endif; \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/wm/widget.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,2 @@ + +#define wgIsRect( X,Y,tX,tY,bX,bY ) ( ( X > tX )&&( Y > tY )&&( X < bX )&&( Y < bY ) ) \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/wm/ws.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,1077 @@ + +// -------------------------------------------------------------------------- +// AutoSpace Window System for Linux/Win32 v0.85 +// Writed by pontscho/fresh!mindworkz +// -------------------------------------------------------------------------- + +#include <X11/Xlib.h> +#include <X11/Xproto.h> +#include <X11/Xutil.h> +#include <X11/keysym.h> +#include <X11/Xatom.h> +#include <errno.h> +#include <stdlib.h> +#include <stdio.h> + +#include "ws.h" +#include "wsconv.h" +#include "../../config.h" + +#include <X11/extensions/xf86dga.h> +#include <X11/extensions/xf86dgastr.h> +#include <X11/extensions/XShm.h> +#include <X11/extensions/shape.h> +#include <sys/ipc.h> +#include <sys/shm.h> + +typedef struct +{ + long flags; + long functions; + long decorations; + long input_mode; + long status; +} MotifWmHints; + +Atom wsMotifHints; + +unsigned int wsMaxX = 0; // Screen width. +unsigned int wsMaxY = 0; // Screen height. + +Display * wsDisplay; +int wsScreen; +Window wsRootWin; +XEvent wsEvent; +int wsWindowDepth; +GC wsHGC; +MotifWmHints wsMotifWmHints; +Atom wsTextProperlyAtom = None; + +int wsDepthOnScreen = 0; +int wsRedMask = 0; +int wsGreenMask = 0; +int wsBlueMask = 0; +int wsOutMask = 0; + +int wsTrue = True; + +wsTWindow * wsWindowList[5] = { NULL,NULL,NULL,NULL,NULL }; +int wsWLCount = 0; + +unsigned long wsKeyTable[512]; + +int wsUseXShm = 1; +int wsUseDGA = 1; +int wsUseXShape = 1; + +int XShmGetEventBase( Display* ); +inline int wsSearch( Window win ); + +#define MWM_HINTS_FUNCTIONS (1L << 0) +#define MWM_HINTS_DECORATIONS (1L << 1) +#define MWM_HINTS_INPUT_MODE (1L << 2) +#define MWM_HINTS_STATUS (1L << 3) + +#define MWM_FUNC_ALL (1L << 0) +#define MWM_FUNC_RESIZE (1L << 1) +#define MWM_FUNC_MOVE (1L << 2) +#define MWM_FUNC_MINIMIZE (1L << 3) +#define MWM_FUNC_MAXIMIZE (1L << 4) +#define MWM_FUNC_CLOSE (1L << 5) + +#define MWM_DECOR_ALL (1L << 0) +#define MWM_DECOR_BORDER (1L << 1) +#define MWM_DECOR_RESIZEH (1L << 2) +#define MWM_DECOR_TITLE (1L << 3) +#define MWM_DECOR_MENU (1L << 4) +#define MWM_DECOR_MINIMIZE (1L << 5) +#define MWM_DECOR_MAXIMIZE (1L << 6) + +#define MWM_INPUT_MODELESS 0 +#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 +#define MWM_INPUT_SYSTEM_MODAL 2 +#define MWM_INPUT_FULL_APPLICATION_MODAL 3 +#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL + +#define MWM_TEAROFF_WINDOW (1L<<0) + +void wsWindowDecoration( wsTWindow * win,long d ) +{ + wsMotifHints=XInternAtom( wsDisplay,"_MOTIF_WM_HINTS",0 ); + if ( wsMotifHints != None ) + { + memset( &wsMotifWmHints,0,sizeof( MotifWmHints ) ); + wsMotifWmHints.flags=( d?0:MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS ); + wsMotifWmHints.functions=( d?0:MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE ); + wsMotifWmHints.decorations=( d?MWM_DECOR_ALL:0 ); + XChangeProperty( wsDisplay,win->WindowID,wsMotifHints,wsMotifHints,32, + PropModeReplace,(unsigned char *)&wsMotifWmHints,5 ); + } +} + +// ---------------------------------------------------------------------------------------------- +// Init X Window System. +// ---------------------------------------------------------------------------------------------- + +int wsIOErrorHandler( Display * dpy ) +{ + fprintf( stderr,"[ws] io error in display.\n" ); + exit( 0 ); +} + +int wsErrorHandler( Display * dpy,XErrorEvent * Event ) +{ + char type[128]; + XGetErrorText( wsDisplay,Event->error_code,type,128 ); + fprintf(stderr,"[ws] Error in display.\n"); + fprintf(stderr,"[ws] Error code: %d ( %s )\n",Event->error_code,type ); + fprintf(stderr,"[ws] Request code: %d\n",Event->request_code ); + fprintf(stderr,"[ws] Minor code: %d\n",Event->minor_code ); + exit( 0 ); +} + +void wsXInit( void ) +{ + char * DisplayName = ":0.0"; + int eventbase; + int errorbase; + + if ( getenv( "DISPLAY" ) ) DisplayName=getenv( "DISPLAY" ); + wsDisplay=XOpenDisplay( DisplayName ); + if ( !wsDisplay ) + { + fprintf( stderr,"[ws] couldn't open the display !\n" ); + exit( 0 ); + } + + if ( !XShmQueryExtension( wsDisplay ) ) + { + fprintf( stderr,"[ws] sorry, your system is not supported X shared memory extension.\n" ); + wsUseXShm=0; + } +// if ( !XDGAQueryExtension( wsDisplay,&eventbase,&errorbase ) ) + { + fprintf( stderr,"[ws] sorry, your system is not supported DGA extension.\n" ); + wsUseDGA=0; + } + #ifdef HAVE_XSHAPE + if ( !XShapeQueryExtension( wsDisplay,&eventbase,&errorbase ) ) + { + fprintf( stderr,"[ws] sorry, your system is not supported XShape extension.\n" ); + wsUseXShape=0; + } + #else + wsUseXShape=0; + #endif + + XSynchronize( wsDisplay,True ); + + wsScreen=DefaultScreen( wsDisplay ); + wsRootWin=RootWindow( wsDisplay,wsScreen ); + wsMaxX=DisplayWidth( wsDisplay,wsScreen ); + wsMaxY=DisplayHeight( wsDisplay,wsScreen ); + + wsGetDepthOnScreen(); + #ifdef DEBUG + { + int minor,major,shp; + fprintf( stderr,"[ws] Screen depth: %d\n",wsDepthOnScreen ); + fprintf( stderr,"[ws] red mask: 0x%x\n",wsRedMask ); + fprintf( stderr,"[ws] green mask: 0x%x\n",wsGreenMask ); + fprintf( stderr,"[ws] blue mask: 0x%x\n",wsBlueMask ); + if ( wsUseXShm ) + { + XShmQueryVersion( wsDisplay,&major,&minor,&shp ); + fprintf( stderr,"[ws] XShm version is %d.%d\n",major,minor ); + } + if ( wsUseDGA ) + { +// XDGAQueryVersion( wsDisplay,&major,&minor ); +// fprintf( stderr,"[ws] DGA version is %d.%d\n",major,minor ); + } + #ifdef HAVE_XSHAPE + if ( wsUseXShape ) + { + XShapeQueryVersion( wsDisplay,&major,&minor ); + fprintf( stderr,"[ws] XShape version is %d.%d\n",major,minor ); + } + #endif + } + #endif + initConverter(); + wsOutMask=wsGetOutMask(); + switch ( wsOutMask ) + { + case wsRGB32: + wsConvFunc=BGR8880_to_RGB8880_c; + break; + case wsBGR32: + wsConvFunc=BGR8880_to_BGR8880_c; + break; + case wsRGB24: + #ifdef xHAVE_MMX + wsConvFunc=BGR8880_to_RGB888_mmx; + #else + wsConvFunc=BGR8880_to_RGB888_c; + #endif + break; + case wsBGR24: + wsConvFunc=BGR8880_to_BGR888_c; + break; + case wsRGB16: + wsConvFunc=BGR8880_to_RGB565_c; + break; + case wsBGR16: + wsConvFunc=BGR8880_to_BGR565_c; + break; + case wsRGB15: + wsConvFunc=BGR8880_to_RGB555_c; + break; + case wsBGR15: + wsConvFunc=BGR8880_to_BGR555_c; + break; + } + XSetIOErrorHandler( wsIOErrorHandler ); + XSetErrorHandler( wsErrorHandler ); +} + +// ---------------------------------------------------------------------------------------------- +// Create window. +// X,Y : window position +// wX,wY : size of window +// bW : border width +// cV : visible mouse cursor on window +// D : visible frame, title, etc. +// sR : screen ratio +// ---------------------------------------------------------------------------------------------- + +XClassHint wsClassHint; +XTextProperty wsTextProperty; +Window LeaderWindow; + +void wsCreateWindow( wsTWindow * win,int X,int Y,int wX,int hY,int bW,int cV,unsigned char D,char * label ) +{ + win->Property=D; + if ( D & wsShowFrame ) win->Decorations=1; + wsHGC=DefaultGC( wsDisplay,wsScreen ); +// The window position and size. + switch ( X ) + { + case -1: win->X=( wsMaxX / 2 ) - ( wX / 2 ); break; + case -2: win->X=wsMaxX - wX - 1; break; + default: win->X=X; break; + } + switch ( Y ) + { + case -1: win->Y=( wsMaxY / 2 ) - ( hY / 2 ); break; + case -2: win->Y=wsMaxY - hY - 1; break; + default: win->Y=Y; break; + } + win->Width=wX; + win->Height=hY; + win->OldX=win->X; + win->OldY=win->Y; + win->OldWidth=win->Width; + win->OldHeight=win->Height; + +// Border size for window. + win->BorderWidth=bW; +// Hide Mouse Cursor + win->wsCursor=None; + win->wsMouseEventType=cV; + win->wsCursorData[0]=0; + win->wsCursorPixmap=XCreateBitmapFromData( wsDisplay,wsRootWin,win->wsCursorData,1,1 ); + if ( !(cV & wsShowMouseCursor) ) win->wsCursor=XCreatePixmapCursor( wsDisplay,win->wsCursorPixmap,win->wsCursorPixmap,&win->wsColor,&win->wsColor,0,0 ); + + XGetWindowAttributes( wsDisplay,wsRootWin,&win->Attribs ); + if ( win->Attribs.depth < 15 ) + { + fprintf( stderr,"[ws] sorry, this color depth is not enough.\n" ); + exit( 0 ); + } + XMatchVisualInfo( wsDisplay,wsScreen,win->Attribs.depth,TrueColor,&win->VisualInfo ); + +// --- + win->AtomLeaderClient=XInternAtom( wsDisplay,"WM_CLIENT_LEADER",False ); + win->AtomDeleteWindow=XInternAtom( wsDisplay,"WM_DELETE_WINDOW",False ); + win->AtomTakeFocus=XInternAtom( wsDisplay,"WM_TAKE_FOCUS",False ); + win->AtomRolle=XInternAtom( wsDisplay,"WM_WINDOW_ROLE",False ); + win->AtomProtocols=XInternAtom( wsDisplay,"WM_PROTOCOLS",False ); + { + char buf[32]; int i; + sprintf( buf,"_%s_REMOTE",label ); + for( i=0;i<strlen( buf );i++ ) + if ( ( buf[i] >= 'a' )&&( buf[i] <= 'z' ) ) buf[i]=buf[i] - 32; + for( i=0;i<strlen( buf );i++ ) + if ( buf[i] == ' ' ) buf[i]='_'; + fprintf( stderr,"[ws] atomname: %s\n",buf ); + win->AtomRemote=XInternAtom( wsDisplay,buf,False ); + } + win->AtomsProtocols[0]=win->AtomDeleteWindow; + win->AtomsProtocols[1]=win->AtomTakeFocus; + win->AtomsProtocols[2]=win->AtomRolle; +// --- + +// win->WindowAttrib.background_pixel=BlackPixel( wsDisplay,wsScreen ); +// win->WindowAttrib.border_pixel=BlackPixel( wsDisplay,wsScreen ); + win->WindowAttrib.background_pixel=BlackPixel( wsDisplay,wsScreen ); + win->WindowAttrib.border_pixel=WhitePixel( wsDisplay,wsScreen ); + win->WindowAttrib.colormap=XCreateColormap( wsDisplay,wsRootWin,win->VisualInfo.visual,AllocNone ); + win->WindowAttrib.event_mask=StructureNotifyMask | FocusChangeMask | + //SubstructureRedirectMask | + //SubstructureNotifyMask | + //ResizeRedirectMask | + //GCGraphicsExposures | + ExposureMask | PropertyChangeMask | + EnterWindowMask | LeaveWindowMask | + VisibilityChangeMask | + KeyPressMask | KeyReleaseMask; + if ( ( cV & wsHandleMouseButton ) ) win->WindowAttrib.event_mask|=ButtonPressMask | ButtonReleaseMask; + if ( ( cV & wsHandleMouseMove ) ) win->WindowAttrib.event_mask|=PointerMotionMask; + win->WindowAttrib.cursor=win->wsCursor; + win->WindowAttrib.override_redirect=False; + if ( D & wsOverredirect ) win->WindowAttrib.override_redirect=True; + +// win->WindowAttrib.save_under=True; +// win->WindowAttrib.do_not_propagate_mask = True; + + win->WindowMask=CWBackPixel | CWBorderPixel | + CWColormap | CWEventMask | CWCursor | + CWX | CWY | CWWidth | CWHeight | + CWOverrideRedirect; + + win->WindowID=XCreateWindow( wsDisplay, + (win->Parent != 0?win->Parent:wsRootWin), + win->X,win->Y,win->Width,win->Height,win->BorderWidth, + win->VisualInfo.depth, + InputOutput, + win->VisualInfo.visual, + win->WindowMask,&win->WindowAttrib ); + + wsClassHint.res_name=label; + wsClassHint.res_class="mPlayer"; + XSetClassHint( wsDisplay,win->WindowID,&wsClassHint ); + + win->SizeHint.flags=PPosition | PSize | PResizeInc; // | PBaseSize + win->SizeHint.x=win->X; + win->SizeHint.y=win->Y; + win->SizeHint.width=win->Width; + win->SizeHint.height=win->Height; + if ( D & wsMaxSize ) + { + win->SizeHint.flags|=PMaxSize; + win->SizeHint.min_width=win->Width; + win->SizeHint.min_height=win->Height; + } + if ( D & wsMinSize ) + { + win->SizeHint.flags|=PMinSize; + win->SizeHint.max_width=win->Width; + win->SizeHint.max_height=win->Height; + } + win->SizeHint.height_inc=1; + win->SizeHint.width_inc=1; +// win->SizeHint.base_width=win->Width; +// win->SizeHint.base_height=win->Height; + XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint ); + + win->WMHints.flags=InputHint | StateHint; + win->WMHints.input=True; + win->WMHints.initial_state=NormalState; + XSetWMHints( wsDisplay,win->WindowID,&win->WMHints ); + + wsWindowDecoration( win,win->Decorations ); + XStoreName( wsDisplay,win->WindowID,label ); + XmbSetWMProperties( wsDisplay,win->WindowID,label,label,NULL,0,NULL,NULL,NULL ); + + XSetWMProtocols( wsDisplay,win->WindowID,win->AtomsProtocols,3 ); + XChangeProperty( wsDisplay,win->WindowID, + win->AtomLeaderClient, + XA_WINDOW,32,PropModeReplace, + (unsigned char *)&LeaderWindow,1 ); + + wsTextProperty.value=label; + wsTextProperty.encoding=XA_STRING; + wsTextProperty.format=8; + wsTextProperty.nitems=strlen( label ); + XSetWMIconName( wsDisplay,win->WindowID,&wsTextProperty ); + + XChangeProperty( wsDisplay,win->WindowID, + win->AtomRemote,XA_STRING, + 8,PropModeReplace, + "REALIZED",8 ); + +// win->Font=XLoadQueryFont( wsDisplay,"-adobe-helvetica-bold-r-normal--14-140-75-75-p-77-iso8859-1" ); +// -adobe-times-medium-r-normal--14-140-75-75-p-77-iso8859-1" ); +// -misc-fixed-bold-r-normal--13-120-75-75-C-80-iso8859-1" ); +// -misc-fixed-bold-r-normal--15-140-75-75-C-90-iso8859-1" ); +// -misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1" ); +// -adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1" ); +// -adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1" ); +// -*-helvetica-bold-o-normal--14-*-*-*-p-*-iso8859-1" ); +// if ( !win->Font ) win->Font=XLoadQueryFont( wsDisplay,"fixed" ); +// if ( !win->Font ) +// { +// fprintf( stderr,"[main] could not load font.\n" ); +// exit( 0 ); +// } +// win->FontHeight=win->Font->ascent + win->Font->descent; +// +// #ifdef DEBUG +// fprintf( stderr,"[ws] font height: %d\n",win->FontHeight ); +// #endif + +// win->wGCV.font=win->Font->fid; +// win->wGCV.foreground=wsBlack; +// win->wGCV.background=wsBlack; + + win->wGC=XCreateGC( wsDisplay,win->WindowID, +// GCForeground | GCBackground, + 0, + &win->wGCV ); + + win->Visible=0; + win->Focused=0; + win->Mapped=0; + win->Rolled=0; + if ( D & wsShowWindow ) XMapWindow( wsDisplay,win->WindowID ); + + wsCreateImage( win ); +// --- End of creating -------------------------------------------------------------------------- + + wsWindowList[wsWLCount++]=win; + + XFlush( wsDisplay ); + XSync( wsDisplay,False ); + + win->ReDraw=NULL; + win->ReSize=NULL; + win->Idle=NULL; + win->MouseHandler=NULL; + win->KeyHandler=NULL; + #ifdef DEBUG + fprintf( stderr,"[ws] window is created. ( %s ).\n",label ); + #endif +} + +void wsDestroyWindow( wsTWindow * win ) +{ + int l; + l=wsSearch( win->WindowID ); + wsWindowList[l]=NULL; + if ( win->wsCursor != None ) + { + XFreeCursor( wsDisplay,win->wsCursor ); + win->wsCursor=None; + } + XUnmapWindow( wsDisplay,win->WindowID ); + wsDestroyImage( win ); + XDestroyWindow( wsDisplay,win->WindowID ); + win->ReDraw=NULL; + win->ReSize=NULL; + win->Idle=NULL; + win->MouseHandler=NULL; + win->KeyHandler=NULL; + win->Visible=0; + win->Focused=0; + win->Mapped=0; + win->Rolled=0; +} + +// ---------------------------------------------------------------------------------------------- +// Handle events. +// ---------------------------------------------------------------------------------------------- + +inline int wsSearch( Window win ) +{ + int i; + for ( i=0;i<wsWLCount;i++ ) if ( wsWindowList[i]->WindowID == win ) return i; + return -1; +} + +Bool wsEvents( Display * display,XEvent * Event,XPointer arg ) +{ + KeySym keySym; + unsigned long i = 0; + int l; + int x,y; + Window child_window = 0; + + l=wsSearch( Event->xany.window ); + if ( l == -1 ) return !wsTrue; + switch( Event->type ) + { + case ClientMessage: + if ( Event->xclient.message_type == wsWindowList[l]->AtomProtocols ) + { + if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomDeleteWindow ) + { wsTrue=False; break; } + if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomTakeFocus ) + { i=wsWindowFocusIn; wsWindowList[l]->Focused=wsFocused; goto expose; } + if ( Event->xclient.data.l[0] == wsWindowList[l]->AtomRolle ) + { fprintf( stderr,"[ws] rolled.\n" ); } + } + break; + +// case CirculateRequest:fprintf( stderr,"[ws,r] win: 0x%x\n",(int)Event->xcirculaterequest.window ); break; +// case CirculateNotify: fprintf( stderr,"[ws,c] win: 0x%x\n",(int)Event->xcirculate.window ); break; + + case MapNotify: i=wsWindowMapped; wsWindowList[l]->Mapped=wsMapped; goto expose; + case UnmapNotify: i=wsWindowUnmapped; wsWindowList[l]->Mapped=wsNone; goto expose; + case FocusIn: + if ( wsWindowList[l]->Focused == wsFocused ) break; + i=wsWindowFocusIn; wsWindowList[l]->Focused=wsFocused; goto expose; + case FocusOut: + if ( wsWindowList[l]->Focused == wsNone ) break; + i=wsWindowFocusOut; wsWindowList[l]->Focused=wsNone; goto expose; + case VisibilityNotify: + switch( Event->xvisibility.state ) + { + case VisibilityUnobscured: i=wsWindowVisible; wsWindowList[l]->Visible=wsVisible; goto expose; + case VisibilityFullyObscured: i=wsWindowNotVisible; wsWindowList[l]->Visible=wsNotVisible; goto expose; + case VisibilityPartiallyObscured: i=wsWindowPartialVisible; wsWindowList[l]->Visible=wsPVisible; goto expose; + } +expose: + wsWindowList[l]->State=i; + if ( wsWindowList[l]->ReDraw ) wsWindowList[l]->ReDraw( wsDisplay,Event->xany.window ); + break; + + case Expose: + wsWindowList[l]->State=wsWindowExpose; + if ( ( wsWindowList[l]->ReDraw )&&( !Event->xexpose.count ) ) wsWindowList[l]->ReDraw( wsDisplay,Event->xany.window ); + break; + + case ConfigureNotify: + XTranslateCoordinates( wsDisplay,wsWindowList[l]->WindowID,wsRootWin,0,0,&x,&y,&child_window ); + if ( ( wsWindowList[l]->X != x )||( wsWindowList[l]->Y != y )||( wsWindowList[l]->Width != Event->xconfigure.width )||( wsWindowList[l]->Height != Event->xconfigure.height ) ) + { + wsWindowList[l]->X=x; wsWindowList[l]->Y=y; + wsWindowList[l]->Width=Event->xconfigure.width; wsWindowList[l]->Height=Event->xconfigure.height; +// fprintf( stderr,"[ws] resize: %d,%d %dx%d\n",wsWindowList[l]->X,wsWindowList[l]->Y,Event->xconfigure.width,Event->xconfigure.height ); + if ( wsWindowList[l]->ReSize ) wsWindowList[l]->ReSize( wsWindowList[l]->X,wsWindowList[l]->Y,wsWindowList[l]->Width,wsWindowList[l]->Height ); + } + + wsWindowList[l]->Rolled=wsNone; + if ( Event->xconfigure.y < 0 ) + { i=wsWindowRolled; wsWindowList[l]->Rolled=wsRolled; goto expose; } + + break; + + case KeyPress: i=wsKeyPressed; goto keypressed; + case KeyRelease: i=wsKeyReleased; +keypressed: + wsWindowList[l]->Alt=0; + wsWindowList[l]->Shift=0; + wsWindowList[l]->NumLock=0; + wsWindowList[l]->Control=0; + wsWindowList[l]->CapsLock=0; + if ( Event->xkey.state & Mod1Mask ) wsWindowList[l]->Alt=1; + if ( Event->xkey.state & Mod2Mask ) wsWindowList[l]->NumLock=1; + if ( Event->xkey.state & ControlMask ) wsWindowList[l]->Control=1; + if ( Event->xkey.state & ShiftMask ) wsWindowList[l]->Shift=1; + if ( Event->xkey.state & LockMask ) wsWindowList[l]->CapsLock=1; + keySym=XKeycodeToKeysym( wsDisplay,Event->xkey.keycode,0 ); + if ( keySym != NoSymbol ) + { + keySym=( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) ); + wsKeyTable[ keySym ]=i; + if ( wsWindowList[l]->KeyHandler ) + wsWindowList[l]->KeyHandler( Event->xkey.state,i,keySym ); + } + break; + + case MotionNotify: i=wsMoveMouse; goto buttonreleased; + case ButtonRelease: i=Event->xbutton.button + 128; goto buttonreleased; + case ButtonPress: i=Event->xbutton.button; goto buttonreleased; + case EnterNotify: i=wsEnterWindow; goto buttonreleased; + case LeaveNotify: i=wsLeaveWindow; +buttonreleased: + if ( wsWindowList[l]->MouseHandler ) + wsWindowList[l]->MouseHandler( i,Event->xbutton.x,Event->xbutton.y,Event->xmotion.x_root,Event->xmotion.y_root ); + break; + + case PropertyNotify: +// fprintf(stderr,"[ws] PropertyNotify %s\n",XGetAtomName( wsDisplay,Event->xproperty.atom ) ); + if ( Event->xproperty.atom == wsWindowList[l]->AtomRemote ) + { + Atom type; + int format; + unsigned long nitems, bytesafter; + unsigned char * args = NULL; + +// fprintf( stderr,"[ws] remote property notify.\n" ); + XGetWindowProperty( wsDisplay, + Event->xproperty.window, + Event->xproperty.atom, + 0,( 65536 / sizeof( long ) ), + False,XA_STRING, + &type,&format,&nitems,&bytesafter, + &args ); + if ( ( nitems )&&( wsWindowList[l]->RemoteHandler ) ) + { + args[strlen( args ) - 1]=0; + wsWindowList[l]->RemoteHandler( args ); + args[strlen( args ) - 1]=1; + XFree( args ); + } + } + break; + + } + XFlush( wsDisplay ); + XSync( wsDisplay,False ); + return !wsTrue; +// return True; +} + +Bool wsDummyEvents( Display * display,XEvent * Event,XPointer arg ) +{ return True; } + +void wsMainLoop( void ) +{ + fprintf( stderr,"[ws] init threads: %d\n",XInitThreads() ); + XSynchronize( wsDisplay,False ); + XLockDisplay( wsDisplay ); +// XIfEvent( wsDisplay,&wsEvent,wsEvents,NULL ); + while( wsTrue ) + { + XIfEvent( wsDisplay,&wsEvent,wsDummyEvents,NULL ); + wsEvents( wsDisplay,&wsEvent,NULL ); + } + XUnlockDisplay( wsDisplay ); +} + +// ---------------------------------------------------------------------------------------------- +// Switch to fullscreen. +// ---------------------------------------------------------------------------------------------- +void wsFullScreen( wsTWindow * win ) +{ + int decoration = 0; + XUnmapWindow( wsDisplay,win->WindowID ); + win->SizeHint.flags=0; + if ( win->isFullScreen ) + { + win->X=win->OldX; + win->Y=win->OldY; + win->Width=win->OldWidth; + win->Height=win->OldHeight; + win->isFullScreen=False; + if ( win->Property & wsMaxSize ) + { + win->SizeHint.flags|=PMaxSize; + win->SizeHint.max_width=win->Width; + win->SizeHint.max_height=win->Height; + } + if ( win->Property & wsMinSize ) + { + win->SizeHint.flags|=PMinSize; + win->SizeHint.min_width=win->Width; + win->SizeHint.min_height=win->Height; + } + decoration=win->Decorations; + wsScreenSaverOn( wsDisplay ); + } + else + { + win->OldX=win->X; win->OldY=win->Y; + win->OldWidth=win->Width; win->OldHeight=win->Height; + win->X=0; win->Y=0; + win->Width=wsMaxX; win->Height=wsMaxY; + win->isFullScreen=True; +// if ( win->Property & wsMaxSize ) +// { +// win->SizeHint.flags|=PMaxSize; +// win->SizeHint.min_width=0; +// win->SizeHint.min_height=0; +// } +// if ( win->Property & wsMinSize ) +// { +// win->SizeHint.flags|=PMinSize; +// win->SizeHint.max_width=4096; +// win->SizeHint.max_height=4096; +// } + wsScreenSaverOff( wsDisplay ); + } + + win->SizeHint.flags|=PPosition | PSize; + win->SizeHint.x=win->X; + win->SizeHint.y=win->Y; + win->SizeHint.width=win->Width; + win->SizeHint.height=win->Height; + XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint ); + + XMoveResizeWindow( wsDisplay,win->WindowID,win->X,win->Y,win->Width,win->Height ); + wsWindowDecoration( win,decoration ); + XRaiseWindow( wsDisplay,win->WindowID ); + XMapWindow( wsDisplay,win->WindowID ); +} + +// ---------------------------------------------------------------------------------------------- +// Redraw screen. +// ---------------------------------------------------------------------------------------------- +void wsPostRedisplay( wsTWindow * win ) +{ + if ( win->ReDraw ) + { + win->ReDraw( wsDisplay,win->WindowID ); + XFlush( wsDisplay ); + } +} + +// ---------------------------------------------------------------------------------------------- +// Do Exit. +// ---------------------------------------------------------------------------------------------- +void wsDoExit( void ) +{ wsTrue=False; wsResizeWindow( wsWindowList[0],32,32 ); } + +// ---------------------------------------------------------------------------------------------- +// Put 'Image' to window. +// ---------------------------------------------------------------------------------------------- +void wsConvert( wsTWindow * win,unsigned char * Image,unsigned int Size ) +{ if ( wsConvFunc ) wsConvFunc( Image,win->ImageData,win->xImage->width * win->xImage->height ); } + +void wsPutImage( wsTWindow * win ) +{ + if ( wsUseXShm ) + { + XShmPutImage( wsDisplay,win->WindowID,win->wGC,win->xImage, + 0,0, + ( win->Width - win->xImage->width ) / 2,( win->Height - win->xImage->height ) / 2, + win->xImage->width,win->xImage->height,0 ); +// win->Width,win->Height,0 ); + } + else + { + XPutImage( wsDisplay,win->WindowID,win->wGC,win->xImage, + 0,0, + ( win->Width - win->xImage->width ) / 2,( win->Height - win->xImage->height ) / 2, + win->xImage->width,win->xImage->height ); + } +} + +// ---------------------------------------------------------------------------------------------- +// Move window to x, y. +// ---------------------------------------------------------------------------------------------- +void wsMoveWindow( wsTWindow * win,int x, int y ) +{ + switch ( x ) + { + case -1: win->X=( wsMaxX / 2 ) - ( win->Width / 2 ); break; + case -2: win->X=wsMaxX - win->Width; break; + default: win->X=x; break; + } + switch ( y ) + { + case -1: win->Y=( wsMaxY / 2 ) - ( win->Height / 2 ); break; + case -2: win->Y=wsMaxY - win->Height; break; + default: win->Y=y; break; + } + + win->SizeHint.flags=PPosition; + win->SizeHint.x=win->X; + win->SizeHint.y=win->Y; + XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint ); + + XMoveWindow( wsDisplay,win->WindowID,win->X,win->Y ); +} + +// ---------------------------------------------------------------------------------------------- +// Resize window to sx, sy. +// ---------------------------------------------------------------------------------------------- +void wsResizeWindow( wsTWindow * win,int sx, int sy ) +{ + win->Width=sx; + win->Height=sy; + + win->SizeHint.flags=PSize; + win->SizeHint.width=win->Width; + win->SizeHint.height=win->Height; + if ( win->Property & wsMinSize ) + { + win->SizeHint.flags|=PMinSize; + win->SizeHint.min_width=win->Width; + win->SizeHint.min_height=win->Height; + } + if ( win->Property & wsMaxSize ) + { + win->SizeHint.flags|=PMaxSize; + win->SizeHint.max_width=win->Width; + win->SizeHint.max_height=win->Height; + } + XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint ); + XResizeWindow( wsDisplay,win->WindowID,sx,sy ); +} + +// ---------------------------------------------------------------------------------------------- +// Iconify window. +// ---------------------------------------------------------------------------------------------- +void wsIconify( wsTWindow win ) +{ XIconifyWindow( wsDisplay,win.WindowID,0 ); } + +// ---------------------------------------------------------------------------------------------- +// Move top the window. +// ---------------------------------------------------------------------------------------------- +void wsMoveTopWindow( wsTWindow * win ) +{ XRaiseWindow( wsDisplay,win->WindowID ); } +//{ XUnmapWindow( wsDisplay,win.WindowID ); XMapWindow( wsDisplay,win.WindowID ); } + +// ---------------------------------------------------------------------------------------------- +// Set window background to 'color'. +// ---------------------------------------------------------------------------------------------- +void wsSetBackground( wsTWindow * win,int color ) +{ XSetWindowBackground( wsDisplay,win->WindowID,color ); } + +void wsSetBackgroundRGB( wsTWindow * win,int r,int g,int b ) +{ + int color = 0; + switch ( wsOutMask ) + { + case wsRGB32: + case wsRGB24: color=( r << 16 ) + ( g << 8 ) + b; break; + case wsBGR32: + case wsBGR24: color=( b << 16 ) + ( g << 8 ) + r; break; + case wsRGB16: PACK_RGB16( r,g,b,color ); break; + case wsBGR16: PACK_RGB16( b,g,r,color ); break; + case wsRGB15: PACK_RGB15( r,g,b,color ); break; + case wsBGR15: PACK_RGB15( b,g,r,color ); break; + } + XSetWindowBackground( wsDisplay,win->WindowID,color ); +} + + +// ---------------------------------------------------------------------------------------------- +// Draw string at x,y with fc ( foreground color ) and bc ( background color ). +// ---------------------------------------------------------------------------------------------- +void wsDrawString( wsTWindow win,int x,int y,char * str,int fc,int bc ) +{ + XSetForeground( wsDisplay,win.wGC,bc ); + XFillRectangle( wsDisplay,win.WindowID,win.wGC,x,y, + XTextWidth( win.Font,str,strlen( str ) ) + 20, + win.FontHeight + 2 ); + XSetForeground( wsDisplay,win.wGC,fc ); + XDrawString( wsDisplay,win.WindowID,win.wGC,x + 10,y + 13,str,strlen( str ) ); +} + +// ---------------------------------------------------------------------------------------------- +// Calculation string width. +// ---------------------------------------------------------------------------------------------- +int wsTextWidth( wsTWindow win,char * str ) +{ return XTextWidth( win.Font,str,strlen( str ) ) + 20; } + +// ---------------------------------------------------------------------------------------------- +// Show / hide mouse cursor. +// ---------------------------------------------------------------------------------------------- +void wsVisibleMouse( wsTWindow * win,int m ) +{ + switch ( m ) + { + case wsShowMouseCursor: + if ( win->wsCursor != None ) + { + XFreeCursor( wsDisplay,win->wsCursor ); + win->wsCursor=None; + } + XDefineCursor( wsDisplay,win->WindowID,0 ); + break; + case wsHideMouseCursor: + win->wsCursor=XCreatePixmapCursor( wsDisplay,win->wsCursorPixmap,win->wsCursorPixmap,&win->wsColor,&win->wsColor,0,0 ); + XDefineCursor( wsDisplay,win->WindowID,win->wsCursor ); + break; + } + XFlush( wsDisplay ); +} + +int wsGetDepthOnScreen( void ) +{ + int bpp,ibpp; + XImage * mXImage; + XWindowAttributes attribs; + + mXImage=XGetImage( wsDisplay,wsRootWin,0,0,1,1,AllPlanes,ZPixmap ); + bpp=mXImage->bits_per_pixel; + + XGetWindowAttributes( wsDisplay,wsRootWin,&attribs ); + ibpp=attribs.depth; + mXImage=XGetImage( wsDisplay,wsRootWin,0,0,1,1,AllPlanes,ZPixmap ); + bpp=mXImage->bits_per_pixel; + if ( ( ibpp + 7 ) / 8 != ( bpp + 7 ) / 8 ) ibpp=bpp; + wsDepthOnScreen=ibpp; + wsRedMask=mXImage->red_mask; + wsGreenMask=mXImage->green_mask; + wsBlueMask=mXImage->blue_mask; + XDestroyImage( mXImage ); + return ibpp; +} + +void wsXDone( void ) +{ +// if ( wsSwitchedAnotherVideoMode ) wsChangeVideoMode( wsOldXResolution,wsOldYResolution ); +// if ( wsUseDGA ) XF86DGADirectVideo( wsDisplay,wsScreen,0 ); + XCloseDisplay( wsDisplay ); +} + +void wsVisibleWindow( wsTWindow * win,int show ) +{ + switch( show ) + { + case wsShowWindow: XMapWindow( wsDisplay,win->WindowID ); break; + case wsHideWindow: XUnmapWindow( wsDisplay,win->WindowID ); break; + } + XFlush( wsDisplay ); +} + +void wsDestroyImage( wsTWindow * win ) +{ + if ( win->xImage ) + { + XDestroyImage( win->xImage ); + if ( wsUseXShm ) + { + XShmDetach( wsDisplay,&win->Shminfo ); + shmdt( win->Shminfo.shmaddr ); + } + } + win->xImage=NULL; +} + +void wsCreateImage( wsTWindow * win ) +{ + int CompletionType = -1; + if ( wsUseXShm ) + { + CompletionType=XShmGetEventBase( wsDisplay ) + ShmCompletion; + win->xImage=XShmCreateImage( wsDisplay,win->VisualInfo.visual, + win->Attribs.depth,ZPixmap,NULL,&win->Shminfo,win->Width,win->Height ); + if ( win->xImage == NULL ) + { + fprintf( stderr,"[ws] shared memory extension error.\n" ); + exit( 0 ); + } +// #ifdef DEBUG +// fprintf( stderr,"[ws] Screen depth: %d\n",win->xImage->bits_per_pixel ); +// #endif + win->Shminfo.shmid=shmget( IPC_PRIVATE,win->xImage->bytes_per_line * win->xImage->height,IPC_CREAT|0777 ); + if ( win->Shminfo.shmid < 0 ) + { + XDestroyImage( win->xImage ); + fprintf( stderr,"[ws] shared memory extension error.\n" ); + exit( 0 ); + } + win->Shminfo.shmaddr=(char *)shmat( win->Shminfo.shmid,0,0 ); + + if ( win->Shminfo.shmaddr == ((char *) -1) ) + { + XDestroyImage( win->xImage ); + if ( win->Shminfo.shmaddr != ((char *) -1) ) shmdt( win->Shminfo.shmaddr ); + fprintf( stderr,"[ws] shared memory extension error.\n" ); + exit( 0 ); + } + win->xImage->data=win->Shminfo.shmaddr; + win->Shminfo.readOnly=0; + XShmAttach( wsDisplay,&win->Shminfo ); + shmctl( win->Shminfo.shmid,IPC_RMID,0 ); + } + else + { + win->xImage=XCreateImage( wsDisplay,win->VisualInfo.visual,win->Attribs.depth, + ZPixmap,0,0,win->Width,win->Height, + (wsDepthOnScreen == 3) ? 32 : wsDepthOnScreen, + 0 ); + if ( ( win->xImage->data=malloc( win->xImage->bytes_per_line * win->xImage->height ) ) == NULL ) + { + fprintf( stderr,"[ws] sorry, not enough memory for draw buffer.\n" ); + exit( 0 ); + } + } + win->ImageData=(unsigned char *)win->xImage->data; + win->ImageDataw=(unsigned short int *)win->xImage->data; + win->ImageDatadw=(unsigned int *)win->xImage->data; +} + +void wsResizeImage( wsTWindow * win ) +{ wsDestroyImage( win ); wsCreateImage( win ); } + +int wsGetOutMask( void ) +{ + if ( ( wsDepthOnScreen == 32 )&&( wsRedMask == 0xff0000 )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0x0000ff ) ) return wsRGB32; + if ( ( wsDepthOnScreen == 32 )&&( wsRedMask == 0x0000ff )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0xff0000 ) ) return wsBGR32; + if ( ( wsDepthOnScreen == 24 )&&( wsRedMask == 0xff0000 )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0x0000ff ) ) return wsRGB24; + if ( ( wsDepthOnScreen == 24 )&&( wsRedMask == 0x0000ff )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0xff0000 ) ) return wsBGR24; + if ( ( wsDepthOnScreen == 16 )&&( wsRedMask == 0xf800 )&&( wsGreenMask == 0x7e0 )&&( wsBlueMask == 0x1f ) ) return wsRGB16; + if ( ( wsDepthOnScreen == 16 )&&( wsRedMask == 0x1f )&&( wsGreenMask == 0x7e0 )&&( wsBlueMask == 0xf800 ) ) return wsBGR16; + if ( ( wsDepthOnScreen == 15 )&&( wsRedMask == 0x7c00 )&&( wsGreenMask == 0x3e0 )&&( wsBlueMask == 0x1f ) ) return wsRGB15; + if ( ( wsDepthOnScreen == 15 )&&( wsRedMask == 0x1f )&&( wsGreenMask == 0x3e0 )&&( wsBlueMask == 0x7c00 ) ) return wsBGR15; + return 0; +} + +void wsSetTitle( wsTWindow * win,char * name ) +{ XStoreName( wsDisplay,win->WindowID,name ); } + +void wsSetMousePosition( wsTWindow * win,int x, int y ) +{ XWarpPointer( wsDisplay,wsRootWin,win->WindowID,0,0,0,0,x,y ); } + +static int dpms_disabled=0; +static int timeout_save=0; + +void wsScreenSaverOn( Display *mDisplay ) +{ + int nothing; + if ( dpms_disabled ) + { + if ( DPMSQueryExtension( mDisplay,¬hing,¬hing ) ) + { + if ( !DPMSEnable( mDisplay ) ) fprintf( stderr,"DPMS not available ?\n" ); // restoring power saving settings + else + { + // DPMS does not seem to be enabled unless we call DPMSInfo + BOOL onoff; + CARD16 state; + DPMSInfo( mDisplay,&state,&onoff ); + if ( onoff ) fprintf( stderr,"Successfully enabled DPMS.\n" ); + else fprintf( stderr,"Could not enable DPMS.\n" ); + } + } + } + + if ( timeout_save ) + { + int dummy, interval, prefer_blank, allow_exp; + XGetScreenSaver( mDisplay,&dummy,&interval,&prefer_blank,&allow_exp ); + XSetScreenSaver( mDisplay,timeout_save,interval,prefer_blank,allow_exp ); + XGetScreenSaver( mDisplay,&timeout_save,&interval,&prefer_blank,&allow_exp ); + } +} + +void wsScreenSaverOff( Display * mDisplay ) +{ + int interval,prefer_blank,allow_exp,nothing; + + if ( DPMSQueryExtension( mDisplay,¬hing,¬hing ) ) + { + BOOL onoff; + CARD16 state; + DPMSInfo( mDisplay,&state,&onoff ); + if ( onoff ) + { + Status stat; + fprintf( stderr,"Disabling DPMS.\n" ); + dpms_disabled=1; + stat=DPMSDisable( mDisplay ); // monitor powersave off + fprintf( stderr,"stat: %d.\n",stat ); + } + } + XGetScreenSaver( mDisplay,&timeout_save,&interval,&prefer_blank,&allow_exp ); + if ( timeout_save ) XSetScreenSaver( mDisplay,0,interval,prefer_blank,allow_exp ); // turning off screensaver +} + +void wsSetShape( wsTWindow * win,char * data ) +{ +#ifdef HAVE_XSHAPE + if ( ( !wsUseXShape )||( !data ) ) return; + win->Mask=XCreateBitmapFromData( wsDisplay,win->WindowID,data,win->Width,win->Height ); + XShapeCombineMask( wsDisplay,win->WindowID,ShapeBounding,0,0,win->Mask,ShapeSet ); + XFreePixmap( wsDisplay,win->Mask ); +#endif +} + +#include "wsmkeys.h"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/wm/ws.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,239 @@ + +// ---------------------------------------------------------------------------------------------- +// AutoSpace Window System for Linux/Win32 v0.61 +// Writed by pontscho / fresh!mindworkz +// ---------------------------------------------------------------------------------------------- + +#ifndef __MY_WS +#define __MY_WS + +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/keysym.h> +#include <X11/Xatom.h> +#include <X11/extensions/XShm.h> +#include <X11/extensions/dpms.h> + +#define wsKeyReleased 0 +#define wsKeyPressed 1 + +#define wsShift (1L<<0) +#define wsLock (1L<<1) +#define wsCtrl (1L<<2) +#define wsAlt (1L<<3) + +#define wsPLMouseButton 1 +#define wsPMMouseButton 2 +#define wsPRMouseButton 3 +#define wsRLMouseButton 1 + 128 +#define wsRMMouseButton 2 + 128 +#define wsRRMouseButton 3 + 128 +#define wsEnterWindow 253 +#define wsLeaveWindow 254 +#define wsMoveMouse 255 + +#define wsShowMouseCursor 1 +#define wsMouse 1 +#define wsHideMouseCursor 0 +#define wsNoMouse 0 +#define wsHandleMouseButton 2 +#define wsHandleMouseMove 4 + +#define wsHideFrame 0 +#define wsNoFrame 0 +#define wsShowFrame 1 +#define wsFrame 1 +#define wsMaxSize 2 +#define wsMinSize 4 +#define wsShowWindow 8 +#define wsHideWindow 16 +#define wsOverredirect 32 + +#define wsNoBorder 0 + +#define wsSysName "AutoSpace Window System LiTe" + +#define wsRGB32 1 +#define wsBGR32 2 +#define wsRGB24 3 +#define wsBGR24 4 +#define wsRGB16 5 +#define wsBGR16 6 +#define wsRGB15 7 +#define wsBGR15 8 + +#define wsWindowVisible 1 +#define wsWindowPartialVisible 2 +#define wsWindowNotVisible 4 +#define wsWindowMapped 8 +#define wsWindowUnmapped 16 +#define wsWindowFocusIn 32 +#define wsWindowFocusOut 64 +#define wsWindowExpose 128 +#define wsWindowRolled 256 + +#define wsNone 0 +#define wsMapped 1 +#define wsFocused 2 +#define wsVisible 3 +#define wsNotVisible 4 +#define wsPVisible 5 +#define wsRolled 6 + +#define wsParamDisplay Display *dpy,Window w + +typedef void (*wsTReDraw)( wsParamDisplay ); +typedef void (*wsTReSize)( unsigned int X,unsigned int Y,unsigned int width,unsigned int height ); +typedef void (*wsTIdle)( void ); +typedef void (*wsTKeyHandler)( int State,int Type,int Key ); +typedef void (*wsTMouseHandler)( int Button,int X,int Y,int RX,int RY ); +typedef void (*wsRemoteHandler)( char * str ); + +typedef struct +{ + Window WindowID; + Window Parent; + int X,Y,Width,Height; + int OldX,OldY,OldWidth,OldHeight; + int MaxX,MaxY; + int isFullScreen; + int BorderWidth; + int Property; + unsigned char * bImage; + XImage * xImage; + Pixmap Mask; + int Decorations; + + int State; + int Visible; + int Mapped; + int Focused; + int Rolled; + + wsTReDraw ReDraw; + wsTReSize ReSize; + wsTIdle Idle; + wsTKeyHandler KeyHandler; + wsTMouseHandler MouseHandler; + wsRemoteHandler RemoteHandler; + + int Alt; + int Shift; + int Control; + int NumLock; + int CapsLock; +// --- Misc ------------------------------------------------------------------------------------- + + Atom AtomDeleteWindow; + Atom AtomTakeFocus; + Atom AtomRolle; + Atom AtomProtocols; + Atom AtomsProtocols[3]; + Atom AtomLeaderClient; + Atom AtomRemote; + + XShmSegmentInfo Shminfo; + unsigned char * ImageData; + unsigned short int * ImageDataw; + unsigned int * ImageDatadw; + GC wGC; + XGCValues wGCV; + unsigned long WindowMask; + XVisualInfo VisualInfo; + XWindowAttributes Attribs; + XSetWindowAttributes WindowAttrib; + XSizeHints SizeHint; + XWMHints WMHints; + + XFontStruct * Font; + int FontHeight; + + Cursor wsCursor; + char wsCursorData[1]; + Pixmap wsCursorPixmap; + int wsMouseEventType; + XColor wsColor; +} wsTWindow; + +extern unsigned int wsMaxX; +extern unsigned int wsMaxY; + +extern Display * wsDisplay; +extern int wsScreen; +extern Window wsRootWin; + +extern unsigned char * wsImageData; + +extern XEvent wsEvent; + +extern int wsDepthOnScreen; +extern int wsRedMask; +extern int wsGreenMask; +extern int wsBlueMask; + +extern int wsUseXShm; +extern int wsUseDGA; + +// ---------------------------------------------------------------------------------------------- +// wsKeyTable +// ---------------------------------------------------------------------------------------------- +extern unsigned long wsKeyTable[512]; + +extern void wsXDone( void ); +extern void wsXInit( void ); + +extern int wsGetDepthOnScreen( void ); + +extern void wsDoExit( void ); +extern void wsMainLoop( void ); + +// ---------------------------------------------------------------------------------------------- +// wsCrateWindow: create a new window on the screen. +// X,Y : window position +// wX,hY : window size +// bW : window frame size +// cV : mouse cursor visible +// D : "decoration", visible titlebar, etc ... +// ---------------------------------------------------------------------------------------------- +extern void wsCreateWindow( wsTWindow * win,int X,int Y,int wX,int hY,int bW,int cV,unsigned char D,char * label ); +extern void wsDestroyWindow( wsTWindow * win ); +extern void wsMoveWindow( wsTWindow * win,int x, int y ); +extern void wsResizeWindow( wsTWindow * win,int sx, int sy ); +extern void wsIconify( wsTWindow win ); +extern void wsMoveTopWindow( wsTWindow * win ); +extern void wsSetBackground( wsTWindow * win,int color ); +extern void wsSetBackgroundRGB( wsTWindow * win,int r,int g,int b ); +#define wsClearWindow( win ); XClearWindow( wsDisplay,win.WindowID ); +extern void wsSetTitle( wsTWindow * win,char * name ); +extern void wsVisibleWindow( wsTWindow * win,int show ); +extern void wsWindowDecoration( wsTWindow * win,long d ); +extern void wsFullScreen( wsTWindow * win ); +extern void wsPostRedisplay( wsTWindow * win ); +extern void wsSetShape( wsTWindow * win,char * data ); + +// ---------------------------------------------------------------------------------------------- +// Draw string at x,y with fc ( foreground color ) and bc ( background color ). +// ---------------------------------------------------------------------------------------------- +extern void wsDrawString( wsTWindow win,int x,int y,char * str,int fc,int bc ); +extern int wsTextWidth( wsTWindow win,char * str ); + +// ---------------------------------------------------------------------------------------------- +// Show / hide mouse cursor. +// ---------------------------------------------------------------------------------------------- +extern void wsVisibleMouse( wsTWindow * win,int m ); +extern void wsSetMousePosition( wsTWindow * win,int x, int y ); + +// ---------------------------------------------------------------------------------------------- +// Image handling +// ---------------------------------------------------------------------------------------------- +extern void wsCreateImage( wsTWindow * win ); +extern void wsConvert( wsTWindow * win,unsigned char * Image,unsigned int Size ); +extern void wsPutImage( wsTWindow * win ); +extern void wsResizeImage( wsTWindow * win ); +extern void wsDestroyImage( wsTWindow * win ); +extern int wsGetOutMask( void ); + +extern void wsScreenSaverOn( Display *mDisplay ); +extern void wsScreenSaverOff( Display * mDisplay ); + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/wm/wsconv.c Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,204 @@ + +#include <stdlib.h> +#include <stdio.h> + +#include "../../config.h" +#ifdef xHAVE_MMX + #include "../../main/libvo/mmx.h" + #include "../../main/libvo/fastmemcpy.h" +#endif +#include "wsconv.h" + +wsTConvFunc wsConvFunc = NULL; + +// --- + +#define COPY_RGB_24(src,dst) dst[0]=src[0];dst[1]=src[1];dst[2]=src[2] + +#define SWAP_RGB_24(src,dst) dst[1]=src[0];dst[1]=src[1];dst[2]=src[0] + +void BGR8880_to_RGB555_c( unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels) +{ + unsigned short pixel; + int i; + for(i = 0; i < num_pixels; i++) + { + PACK_RGB15(in_pixels[0],in_pixels[1],in_pixels[2],pixel); + *(unsigned short*)out_pixels = pixel; + in_pixels += 4; + out_pixels += 2; + } +} + +void BGR8880_to_BGR555_c( unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels) +{ + unsigned short pixel; + int i; + for(i = 0; i < num_pixels; i++) + { + PACK_RGB15(in_pixels[2],in_pixels[1],in_pixels[0],pixel); + *(unsigned short*)out_pixels = pixel; + in_pixels += 4; + out_pixels += 2; + } +} + +void BGR8880_to_RGB565_c( unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels) +{ + unsigned short pixel; + int i; + for(i = 0; i < num_pixels; i++) + { + PACK_RGB16(in_pixels[0],in_pixels[1],in_pixels[2],pixel); + *(unsigned short*)out_pixels = pixel; + in_pixels += 4; + out_pixels += 2; + } +} + +void BGR8880_to_BGR565_c( unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels) +{ + unsigned short pixel; + int i; + for(i = 0; i < num_pixels; i++) + { + PACK_RGB16(in_pixels[2],in_pixels[1],in_pixels[0],pixel); + *(unsigned short*)out_pixels = pixel; + in_pixels += 4; + out_pixels += 2; + } +} + +void BGR8880_to_RGB888_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels ) +{ + int i; + for(i = 0; i < num_pixels; i++) + { + COPY_RGB_24(in_pixels,out_pixels); + in_pixels += 4; + out_pixels += 3; + } +} + +void BGR8880_to_BGR888_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels ) +{ + int i; + for(i = 0; i < num_pixels; i++) + { + SWAP_RGB_24(in_pixels,out_pixels); + in_pixels += 4; + out_pixels += 3; + } +} + +void BGR8880_to_BGR8880_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels ) +{ + int i; + for(i = 0; i < num_pixels; i++) + { + SWAP_RGB_24(in_pixels,out_pixels); + in_pixels += 4; + out_pixels += 4; + } +} + +void BGR8880_to_RGB8880_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels ) +{ memcpy( out_pixels,in_pixels,num_pixels * 4 ); } + +/* + +unsigned char * map_5_to_8[32]; +unsigned char * map_6_to_8[64]; + +#define POINTER_TO_GUINT16(a) *((unsigned short*)a) +#define RGB16_TO_R(pixel) map_5_to_8[pixel & RGB16_LOWER_MASK] +#define RGB16_TO_G(pixel) map_6_to_8[(pixel & RGB16_MIDDLE_MASK)>>5] +#define RGB16_TO_B(pixel) map_5_to_8[(pixel & RGB16_UPPER_MASK)>>11] +#define RGB16_LOWER_MASK 0x001f +#define RGB16_MIDDLE_MASK 0x07e0 +#define RGB16_UPPER_MASK 0xf800 + +void RGB565_to_RGB888_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels) +{ + unsigned short in_pixel; + int i; + for(i = 0; i < num_pixels; i++) + { + in_pixel = POINTER_TO_GUINT16(in_pixels); + out_pixels[0] = RGB16_TO_R(in_pixel); + out_pixels[1] = RGB16_TO_G(in_pixel); + out_pixels[2] = RGB16_TO_B(in_pixel); + in_pixels += 2; + out_pixels += 3; + } +} + +*/ + +// --- + +#ifdef xHAVE_MMX + +#define LOAD_32(in) movq_m2r(*in, mm0); in += 8;\ + movq_m2r(*in, mm1); in += 8 + +#define PACK_32_TO_24 movq_r2r(mm0, mm2);\ + pand_m2r(rgb32_l_mask,mm0);\ + pand_m2r(rgb32_u_mask,mm2);\ + psrlq_i2r(8, mm2);\ + por_r2r(mm2,mm0);\ + movq_r2r(mm1, mm2);\ + pand_m2r(rgb32_l_mask,mm1);\ + pand_m2r(rgb32_u_mask,mm2);\ + psrlq_i2r(8, mm2);\ + por_r2r(mm2,mm1); + +#define WRITE_24(out) movq_r2m(mm0, *out); out+=6;\ + movq_r2m(mm1, *out); out+=6; + +#define WRITE_16(out) movq_r2m(mm0, *out); out+=8; + +static mmx_t rgb32_l_mask; // Mask for the lower of 2 RGB24 pixels +static mmx_t rgb32_u_mask; // Mask for the upper of 2 RGB24 pixels + +static mmx_t rgb32_r_mask; // Mask for the reds of 2 RGB32 pixels +static mmx_t rgb32_g_mask; // Mask for the greens of 2 RGB32 pixels +static mmx_t rgb32_b_mask; // Mask for the blues of 2 RGB32 pixels + +static mmx_t lower_dword_mask; // Mask for the lower doublewords +static mmx_t upper_dword_mask; // Mask for the upper doublewords + +void BGR8880_to_RGB888_mmx(unsigned char * in_pixels,unsigned char * out_pixels,int num_pixels) +{ + int imax = num_pixels/4; + int i; + + for(i = 0; i < imax; i++) + { + LOAD_32(in_pixels); + PACK_32_TO_24; + WRITE_24(out_pixels); + } + emms(); +} + +#endif + +// --- + +void initConverter( void ) +{ +#ifdef xHAVE_MMX +// int i; + +// for(i = 0; i < 64; i++) map_6_to_8[i] = (unsigned char)((float)i/63.0*255.0+0.5); +// for(i = 0; i < 32; i++) map_5_to_8[i] = (unsigned char)((float)i/31.0*255.0+0.5); + + rgb32_l_mask.q = 0x0000000000FFFFFFLL; // Mask for the lower of 2 RGB32 pixels + rgb32_u_mask.q = 0x00FFFFFF00000000LL; // Mask for the upper of 2 RGB32 pixels + + rgb32_r_mask.q = 0x000000FF000000FFLL; // Mask for the reds of 2 RGB32 pixels + rgb32_g_mask.q = 0x0000FF000000FF00LL; // Mask for the greens of 2 RGB32 pixels + rgb32_b_mask.q = 0x00FF000000FF0000LL; // Mask for the blues of 2 RGB32 pixels +#endif +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/wm/wsconv.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,39 @@ + +#ifndef __WSCONV_H +#define __WSCONV_H + +#include "../../config.h" + +#define PACK_RGB16(r,g,b,pixel) pixel=(b>>3);\ + pixel<<=6;\ + pixel|=(g>>2);\ + pixel<<=5;\ + pixel|=(r>>3) + +#define PACK_RGB15(r,g,b,pixel) pixel=(b>>3);\ + pixel<<=5;\ + pixel|=(g>>3);\ + pixel<<=5;\ + pixel|=(r>>3) + +typedef void(*wsTConvFunc)( unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels ); +extern wsTConvFunc wsConvFunc; + +extern void BGR8880_to_RGB555_c( unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels ); +extern void BGR8880_to_BGR555_c( unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels ); +extern void BGR8880_to_RGB565_c( unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels ); +extern void BGR8880_to_BGR565_c( unsigned char * in_pixels, unsigned char * out_pixels, int num_pixels ); +extern void BGR8880_to_RGB888_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels ); +extern void BGR8880_to_BGR888_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels ); +extern void BGR8880_to_BGR8880_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels ); +extern void BGR8880_to_RGB8880_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels ); + +#ifdef xHAVE_MMX + extern void BGR8880_to_RGB888_mmx(unsigned char * in_pixels,unsigned char * out_pixels,int num_pixels); +#endif + +extern void RGB565_to_RGB888_c( unsigned char * in_pixels, unsigned char * out_pixels,int num_pixels); + +extern void initConverter( void ); + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/wm/wskeys.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,140 @@ + +#ifndef _MY_WSKEY +#define _MY_WSKEY + +#define wsKeyNone -1 + +#define wsosbrackets '[' +#define wscsbrackets ']' +#define wsomore '<' +#define wscmore '>' + +#define wsq 'q' +#define wsa 'a' +#define wsz 'z' +#define wsw 'w' +#define wss 's' +#define wsx 'x' +#define wse 'e' +#define wsd 'd' +#define wsr 'r' +#define wsf 'f' +#define wsv 'v' +#define wst 't' +#define wsg 'g' +#define wsb 'b' +#define wsy 'y' +#define wsh 'h' +#define wsn 'n' +#define wsu 'u' +#define wsj 'j' +#define wsm 'm' +#define wsi 'i' +#define wsk 'k' +#define wso 'o' +#define wsl 'l' +#define wsp 'p' +#define wsc 'c' + +#define wsQ 'Q' +#define wsA 'A' +#define wsZ 'Z' +#define wsW 'W' +#define wsS 'S' +#define wsX 'X' +#define wsE 'E' +#define wsD 'D' +#define wsR 'R' +#define wsF 'F' +#define wsV 'V' +#define wsT 'T' +#define wsG 'G' +#define wsB 'B' +#define wsY 'Y' +#define wsH 'H' +#define wsN 'N' +#define wsU 'U' +#define wsJ 'J' +#define wsM 'M' +#define wsI 'I' +#define wsK 'K' +#define wsO 'O' +#define wsL 'L' +#define wsP 'P' +#define wsC 'C' + +#define ws0 '0' +#define ws1 '1' +#define ws2 '2' +#define ws3 '3' +#define ws4 '4' +#define ws5 '5' +#define ws6 '6' +#define ws7 '7' +#define ws8 '8' +#define ws9 '9' + +#define wsSpace ' ' + +#define wsUp 0x52 + 256 +#define wsDown 0x54 + 256 +#define wsLeft 0x51 + 256 +#define wsRight 0x53 + 256 +#define wsLeftCtrl 0xe3 + 256 +#define wsRightCtrl 0xe4 + 256 +#define wsLeftAlt 0xe9 + 256 +#define wsRightAlt 0x7e + 256 +#define wsLeftShift 0xe1 + 256 +#define wsRightShift 0xe2 + 256 +#define wsEnter 0x0d + 256 +#define wsBackSpace 0x08 + 256 +#define wsCapsLock 0xe5 + 256 +#define wsTab 0x09 + 256 +#define wsF1 0xbe + 256 +#define wsF2 0xbf + 256 +#define wsF3 0xc0 + 256 +#define wsF4 0xc1 + 256 +#define wsF5 0xc2 + 256 +#define wsF6 0xc3 + 256 +#define wsF7 0xc4 + 256 +#define wsF8 0xc5 + 256 +#define wsF9 0xc6 + 256 +#define wsF10 0xc7 + 256 +#define wsInsert 0x63 + 256 +#define wsDelete 0xff + 256 +#define wsHome 0x50 + 256 +#define wsEnd 0x57 + 256 +#define wsPageUp 0x55 + 256 +#define wsPageDown 0x56 + 256 +#define wsNumLock 0x7f + 256 +#define wsEscape 0x1b + 256 +#define wsGrayEnter 0x8d + 256 +#define wsGrayPlus 0xab + 256 +#define wsGrayMinus 0xad + 256 +#define wsGrayMul 0xaa + 256 +#define wsGrayDiv 0xaf + 256 + +#define wsGrayInsert 0xb0 + 256 +#define wsGrayDelete 0xae + 256 +#define wsGrayEnd 0xb1 + 256 +#define wsGrayDown 0xb2 + 256 +#define wsGrayPageDown 0xb3 + 256 +#define wsGrayLeft 0xb4 + 256 +#define wsGray5 0xb5 + 256 +#define wsGrayRight 0xb6 + 256 +#define wsGrayHome 0xb7 + 256 +#define wsGrayUp 0xb8 + 256 +#define wsGrayPageUp 0xb9 + 256 + +#define wsKeyNumber 116 + +typedef struct +{ + int code; + char * name; +} TwsKeyNames; + +extern TwsKeyNames wsKeyNames[ wsKeyNumber ]; + +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gui/wm/wsmkeys.h Sat Aug 25 21:04:29 2001 +0000 @@ -0,0 +1,52 @@ + +#include "wskeys.h" + +TwsKeyNames wsKeyNames[ wsKeyNumber ] = + { + { wsq, "q" }, { wsa, "a" }, { wsz, "z" }, { wsw, "w" }, { wss, "s" }, { wsx, "x" }, + { wse, "e" }, { wsd, "d" }, { wsr, "r" }, { wsf, "f" }, { wsv, "v" }, { wst, "t" }, + { wsg, "g" }, { wsb, "b" }, { wsy, "y" }, { wsh, "h" }, { wsn, "n" }, { wsu, "u" }, + { wsj, "j" }, { wsm, "m" }, { wsi, "i" }, { wsk, "k" }, { wso, "o" }, { wsl, "l" }, + { wsp, "p" }, { wsc, "c" }, + + { wsQ, "Q" }, { wsA, "A" }, { wsZ, "Z" }, { wsW, "W" }, { wsS, "S" }, { wsX, "X" }, + { wsE, "E" }, { wsD, "D" }, { wsR, "R" }, { wsF, "F" }, { wsV, "V" }, { wsT, "T" }, + { wsG, "G" }, { wsB, "B" }, { wsY, "Y" }, { wsH, "H" }, { wsN, "N" }, { wsU, "U" }, + { wsJ, "J" }, { wsM, "M" }, { wsI, "I" }, { wsK, "K" }, { wsO, "O" }, { wsL, "L" }, + { wsP, "P" }, { wsC, "C" }, + + { wsUp, "Up" }, { wsDown, "Down" }, { wsLeft, "Left" }, + { wsRight, "Right" }, { wsPageUp, "PageUp" }, { wsPageDown, "PageDown" }, + + { wsLeftCtrl, "LeftCtrl" }, { wsRightCtrl, "RightCtrl" }, { wsLeftAlt, "LeftAlt" }, + { wsRightAlt, "RightAlt" }, { wsLeftShift, "LeftShift" }, { wsRightShift, "RightShift" }, + + + { wsBackSpace, "BackSpace" }, + { wsCapsLock, "CapsLock" }, + { wsNumLock, "NumLock" }, + + { wsF1, "F1" }, { wsF2, "F2" }, { wsF3, "F3" }, { wsF4, "F4" }, { wsF5, "F5" }, + { wsF6, "F6" }, { wsF7, "F7" }, { wsF8, "F8" }, { wsF9, "F9" }, { wsF10, "F10" }, + + { wsEnter, "Enter" }, { wsTab, "Tab" }, { wsSpace, "Space" }, + { wsInsert, "Insert" }, { wsDelete, "Delete" }, { wsHome, "Home" }, + { wsEnd, "End" }, { wsEscape, "Escape" }, + + { wsosbrackets, "[" }, { wscsbrackets, "]" }, + { wsomore, "<" }, { wscmore, ">" }, + + { ws0, "0" }, { ws1, "1" }, { ws2, "2" }, { ws3, "3" }, { ws4, "4" }, + { ws5, "5" }, { ws6, "6" }, { ws7, "7" }, { ws8, "8" }, { ws9, "9" }, + + { wsGrayEnter, "GrayEnter" }, { wsGrayPlus, "GrayPlus" }, + { wsGrayMinus, "GrayMinus" }, { wsGrayMul, "GrayMul" }, + { wsGrayDiv, "GrayDiv" }, { wsGrayInsert, "GrayInsert" }, + { wsGrayDelete, "GrayDelete" }, { wsGrayEnd, "GrayEnd" }, + { wsGrayDown, "GrayDown" }, { wsGrayPageDown, "GrayPageDown" }, + { wsGrayLeft, "GrayLeft" }, { wsGray5, "Gray5" }, + { wsGrayRight, "GrayRight" }, { wsGrayHome, "GrayHome" }, + { wsGrayUp, "GrayUp" }, { wsGrayPageUp, "GrayPageUp" }, + + { wsKeyNone, "None" } + };