From bce2755a134ecc39e5abac49e144f427e911d001 Mon Sep 17 00:00:00 2001 From: pontscho Date: Tue, 28 Aug 2001 15:55:02 +0000 Subject: fix hprogressbar git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1730 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/app.c | 1 + Gui/app.h | 1 + Gui/mplayer/mw.h | 43 +++++++++++++++++++++++++++---------------- Gui/mplayer/play.c | 14 ++++++++------ Gui/mplayer/sw.h | 11 +++-------- Gui/skin/skin.c | 5 +++-- Gui/skin/skin.h | 2 +- 7 files changed, 44 insertions(+), 33 deletions(-) (limited to 'Gui') diff --git a/Gui/app.c b/Gui/app.c index 557645defc..4c7ace937d 100644 --- a/Gui/app.c +++ b/Gui/app.c @@ -39,6 +39,7 @@ void appClearItem( wItem * item ) item->fontid=0; if ( item->label ) free( item->label ); item->label=NULL; item->event=0; + item->used=0; } void appCopy( listItems * dest,listItems * source ) diff --git a/Gui/app.h b/Gui/app.h index 48a4acf9b9..d2773f94a9 100644 --- a/Gui/app.h +++ b/Gui/app.h @@ -34,6 +34,7 @@ typedef struct int pressed,disabled,tmp; int key,key2; int phases; + int used; float value; txSample Bitmap; txSample Mask; diff --git a/Gui/mplayer/mw.h b/Gui/mplayer/mw.h index 9ee7270a73..514b74b6d6 100644 --- a/Gui/mplayer/mw.h +++ b/Gui/mplayer/mw.h @@ -125,6 +125,8 @@ void PutImage( txSample * bf,int x,int y,int max,int ofs ) } } +extern float gui_position; + void mplMainDraw( wsParamDisplay ) { wItem * item; @@ -133,8 +135,11 @@ void mplMainDraw( wsParamDisplay ) char * tmp; if ( appMPlayer.mainWindow.Visible == wsWindowNotVisible || - !mainVisible || - !appMPlayer.mainWindow.Mapped ) return; + !mainVisible ) return; +// !appMPlayer.mainWindow.Mapped ) return; + + btnModify( evSetMoviePosition,mplShMem->Position ); + btnModify( evSetVolume,mplShMem->Volume ); if ( mplMainRender ) { @@ -147,20 +152,19 @@ void mplMainDraw( wsParamDisplay ) case itButton: PutImage( &item->Bitmap,item->x,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 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; + 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 ) ); - image=fntRender( item->fontid,( mplRedrawTimer / 10 )%item->width,item->width,"%s",Translate( item->label ) ); + image=fntRender( item->fontid,mplTimer%item->width,item->width,"%s",Translate( item->label ) ); +// image=fntRender( item->fontid,( mplRedrawTimer / 10 )%item->width,item->width,"%s",Translate( item->label ) ); drawrenderedtext: PutImage( image,item->x,item->y,1,0 ); if ( image ) @@ -180,6 +184,8 @@ drawrenderedtext: #define IZE(x) printf("@@@ " x " @@@\n"); +extern void exit_player(char* how); + void mplMsgHandle( int msg,float param ) { int j; @@ -188,8 +194,9 @@ void mplMsgHandle( int msg,float param ) { // --- user events case evExit: - IZE("evExit"); +// IZE("evExit"); wsDoExit(); // sets wsTrue=False; + exit_player( "Exit" ); break; case evIconify: IZE("evIcon"); @@ -312,9 +319,10 @@ NoPause: case evRedraw: mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); - if ( !mplShMem->Playing ) wsPostRedisplay( &appMPlayer.subWindow ); +// if ( !mplShMem->Playing ) + wsPostRedisplay( &appMPlayer.subWindow ); XFlush( wsDisplay ); - mplRedrawTimer=mplRedrawTimerConst; + mplRedrawTimer=mplRedrawTimerConst; break; case evGeneralTimer: if ( mplMainAutoPlay ) @@ -389,6 +397,7 @@ void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) item->x+item->width,item->y+item->height ) ) { item->pressed=btnPressed; + item->used=1; mplMainRender=1; SelectedButton=i; boxMoved=0; @@ -402,6 +411,7 @@ void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) item->x+item->width,item->y+item->height ) ) { item->pressed=btnPressed; + item->used=1; mplMainRender=1; SelectedButton=i; boxMoved=0; @@ -425,12 +435,12 @@ void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) mplMenuMouseHandle( X,Y,RX,RY ); break; case itPotmeter: - value=(float)( X - item->x ) / item->width * 100.0f; + item->value=(float)( X - item->x ) / item->width * 100.0f; goto potihandled; case itHPotmeter: - value=(float)( X - item->x ) / item->width * 100.0f; + item->value=(float)( X - item->x ) / item->width * 100.0f; potihandled: - btnModify( item->msg,value ); + btnModify( item->msg,item->value ); if ( ( item->msg == evSetVolume )||( item->msg == evSetBalance ) ) mplMsgHandle( item->msg,item->value ); mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); break; @@ -450,8 +460,9 @@ potihandled: break; case itPotmeter: case itHPotmeter: + item->used=0; btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f ); - value=item->value; + value=item->value; break; } if ( SelectedButton != -1 ) mplMsgHandle( item->msg,value ); diff --git a/Gui/mplayer/play.c b/Gui/mplayer/play.c index 15724e2997..3334742d35 100644 --- a/Gui/mplayer/play.c +++ b/Gui/mplayer/play.c @@ -7,10 +7,10 @@ int mplParent = 1; -int mplx,mply,mplwidth,mplheight; - float gui_position=-1; +int mplx,mply,mplwidth,mplheight; + #include "../app.h" #include "../wm/ws.h" @@ -100,7 +100,11 @@ printf("mplResize(%d,%d,%d,%d) \n",X,Y,width,height); void mplMPlayerInit( int argc,char* argv[], char *envp[] ) { +#if 0 mplShMem=shmem_alloc( ShMemSize ); +#else + mplShMem=calloc( 1,ShMemSize ); +#endif signal( SIGTYPE,mplMainSigHandler ); signal( SIGCHLD,SIG_IGN ); @@ -120,7 +124,8 @@ void mplMPlayerInit( int argc,char* argv[], char *envp[] ) float mplGetPosition( void ) { // return 0.0 ... 100.0 - return (gui_position<0)?(mplShMem->Position):(gui_position*100.0); +// return (gui_position<0)?(mplShMem->Position):(gui_position*100.0); + return mplShMem->Position; } void mplRelSeek( float s ) @@ -128,7 +133,6 @@ void mplRelSeek( float s ) // --- printf("%%%%%% RelSEEK=%5.3f \n",s); // --- - mplShMem->Position=mplGetPosition() + s; rel_seek_secs=s; abs_seek_pos=0; } @@ -138,8 +142,6 @@ void mplAbsSeek( float s ) printf("%%%%%% AbsSEEK=%5.3f \n",s); rel_seek_secs=0.01*s; abs_seek_pos=3; // --- - mplShMem->Position=s; - mplShMem->TimeSec=s; } void mplIncAudioBufDelay( void ) diff --git a/Gui/mplayer/sw.h b/Gui/mplayer/sw.h index da28cd457e..736f865468 100644 --- a/Gui/mplayer/sw.h +++ b/Gui/mplayer/sw.h @@ -6,11 +6,7 @@ int mplSubMoved = 0; void mplSubDraw( wsParamDisplay ) { - if ( !appMPlayer.subWindow.Visible || mplShMem->Playing ) - { - mplSendMessage( mplExposeEvent ); - return; - } + if ( !appMPlayer.subWindow.Visible || mplShMem->Playing ) return; if ( mplSubRender ) { @@ -19,9 +15,8 @@ void mplSubDraw( wsParamDisplay ) 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 ); } - XFlush( wsDisplay ); - XSync( wsDisplay,False ); } void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY ) @@ -66,4 +61,4 @@ void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY ) } //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 +//{ mplResize( X,Y,width,height ); } diff --git a/Gui/skin/skin.c b/Gui/skin/skin.c index 68ca4e3d3d..5cf64471ad 100644 --- a/Gui/skin/skin.c +++ b/Gui/skin/skin.c @@ -1,4 +1,4 @@ - + #include #include #include @@ -682,6 +682,7 @@ void btnModify( int event,float state ) for ( j=0;j