1
mirror of https://github.com/mpv-player/mpv synced 2024-10-18 10:25:02 +02:00

fix hprogressbar

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1730 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
pontscho 2001-08-28 15:55:02 +00:00
parent c5c913ad17
commit bce2755a13
8 changed files with 73 additions and 95 deletions

View File

@ -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 )

View File

@ -34,6 +34,7 @@ typedef struct
int pressed,disabled,tmp;
int key,key2;
int phases;
int used;
float value;
txSample Bitmap;
txSample Mask;

View File

@ -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;
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,7 +319,8 @@ NoPause:
case evRedraw:
mplMainRender=1;
wsPostRedisplay( &appMPlayer.mainWindow );
if ( !mplShMem->Playing ) wsPostRedisplay( &appMPlayer.subWindow );
// if ( !mplShMem->Playing )
wsPostRedisplay( &appMPlayer.subWindow );
XFlush( wsDisplay );
mplRedrawTimer=mplRedrawTimerConst;
break;
@ -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,6 +460,7 @@ potihandled:
break;
case itPotmeter:
case itHPotmeter:
item->used=0;
btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f );
value=item->value;
break;

View File

@ -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 )

View File

@ -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 );
XSync( wsDisplay,False );
}
}
void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY )

View File

@ -682,6 +682,7 @@ void btnModify( int event,float state )
for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
if ( appMPlayer.Items[j].msg == event )
{
if ( appMPlayer.Items[j].used ) continue;
switch ( appMPlayer.Items[j].type )
{
case itButton:
@ -697,7 +698,7 @@ void btnModify( int event,float state )
}
}
int btnGetValue( int event )
float btnGetValue( int event )
{
int j;
for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )

View File

@ -12,7 +12,7 @@ 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 float btnGetValue( int event );
// ---

View File

@ -66,11 +66,11 @@ void* mDisplay; // Display* mDisplay;
#include "lirc_mp.h"
#endif
#ifdef HAVE_NEW_GUI
#include "Gui/mplayer/play.h"
#endif
#define DEBUG if(0)
#ifdef HAVE_GUI
int nogui=1;
#endif
int verbose=0;
int quiet=0;
@ -190,13 +190,6 @@ extern float gui_position;
extern void avi_fixate();
#ifdef HAVE_GUI
#include "../Gui/mplayer/psignal.h"
#define GUI_MSG(x) if ( !nogui ) { mplSendMessage( x ); usec_sleep( 10000 ); }
#else
#define GUI_MSG(x)
#endif
// options:
int divx_quality=0;
@ -289,10 +282,12 @@ void exit_player(char* how){
total_time_usage_start=GetTimer()-total_time_usage_start;
// restore terminal:
#ifdef HAVE_GUI
if ( nogui )
#endif
#ifdef HAVE_NEW_GUI
if ( !use_gui ) getch2_disable();
#else
getch2_disable();
#endif
#ifdef USE_LIBVO2
if(video_out) vo2_close(video_out);
@ -308,9 +303,6 @@ void exit_player(char* how){
if(encode_name) avi_fixate();
#ifdef HAVE_LIRC
#ifdef HAVE_GUI
if ( nogui )
#endif
lirc_mp_cleanup();
#endif
@ -347,13 +339,6 @@ void exit_sighandler(int x){
mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_IntBySignal,x,
current_module?current_module:"unknown"
);
#ifdef HAVE_GUI
if ( !nogui )
{
mplShMem->items.error.signal=x;
strcpy( mplShMem->items.error.module,current_module?current_module:"unknown" );
}
#endif
exit_player(NULL);
}
@ -408,11 +393,11 @@ if ((conffile = get_path("")) == NULL) {
}
}
#ifndef HAVE_GUI
//ifndef HAVE_GUI
int main(int argc,char* argv[], char *envp[]){
#else
int mplayer(int argc,char* argv[], char *envp[]){
#endif
//else
// int mplayer(int argc,char* argv[], char *envp[]){
//endif
#ifdef USE_SUB
static subtitle* subtitles=NULL;
@ -565,14 +550,11 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){
#endif
#ifdef HAVE_LIRC
#ifdef HAVE_GUI
if ( nogui )
#endif
lirc_mp_setup();
#endif
#ifdef USE_TERMCAP
load_termcap(NULL); // load key-codes
if ( !use_gui ) load_termcap(NULL); // load key-codes
#endif
@ -581,9 +563,6 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){
signal(SIGTERM,exit_sighandler); // kill
signal(SIGHUP,exit_sighandler); // kill -HUP / xterm closed
#ifdef HAVE_GUI
if ( nogui )
#endif
signal(SIGINT,exit_sighandler); // Interrupt from keyboard
signal(SIGQUIT,exit_sighandler); // Quit from keyboard
@ -985,15 +964,6 @@ current_module="init_libvo";
fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3),
title,out_fmt);
#ifdef HAVE_GUI
if ( !nogui )
{
mplShMem->items.videodata.width=sh_video->disp_w;
mplShMem->items.videodata.height=sh_video->disp_h;
mplSendMessage( mplSetVideoData );
}
#endif
#ifdef USE_LIBVO2
if(!vo2_start(video_out,
sh_video->disp_w,sh_video->disp_h,out_fmt,0,
@ -1294,12 +1264,12 @@ if(1)
mp_msg(MSGT_AVSYNC,MSGL_DBG2,"\nstill dropping, %.2f\n", time_frame);
}
}
video_out->check_events(); // check events AST
#ifdef HAVE_NEW_GUI
if(use_gui){
wsHandleEvents();mplTimerHandler(0); // handle GUI timer events
}
#endif
video_out->check_events(); // check events AST
} else {
// It's time to sleep...
current_module="sleep";
@ -1504,10 +1474,6 @@ if(auto_quality>0){
mp_msg(MSGT_CPLAYER,MSGL_STATUS,"\n------ PAUSED -------\r");fflush(stdout);
if (audio_out && sh_audio)
audio_out->pause(); // pause audio, keep data if possible
#ifdef HAVE_GUI
if ( nogui )
{
#endif
while(
#ifdef HAVE_LIRC
lirc_mp_getinput()<=0 &&
@ -1524,9 +1490,6 @@ if(auto_quality>0){
if(use_stdin) usec_sleep(1000); // do not eat the CPU
}
osd_function=OSD_PLAY;
#ifdef HAVE_GUI
} else while( osd_function != OSD_PLAY ) usec_sleep( 1000 );
#endif
if (audio_out && sh_audio)
audio_out->resume(); // resume audio
}
@ -1781,11 +1744,14 @@ if(rel_seek_secs || abs_seek_pos){
#ifdef HAVE_NEW_GUI
if(use_gui){
int len=((demuxer->movi_end-demuxer->movi_start)>>8);
if(len>0)
gui_position=(demuxer->filepos-demuxer->movi_start)/len;
else
gui_position=-1;
int len=((demuxer->movi_end-demuxer->movi_start));
// if(len>0)
// gui_position=(float)(demuxer->filepos-demuxer->movi_start)/len;
// else
// gui_position=-1;
if ( len > 0 ) mplShMem->Position=(float)(demuxer->filepos-demuxer->movi_start) / len * 100.0f;
else mplShMem->Position=0;
mplShMem->TimeSec=d_video->pts;
}
#endif
@ -1842,10 +1808,11 @@ if(curr_filename+1<num_filenames){
// partial uninit:
// restore terminal:
#ifdef HAVE_GUI
if ( nogui )
#endif
#ifdef HAVE_NEW_GUI
if ( !use_gui ) getch2_disable();
#else
getch2_disable();
#endif
current_module="uninit_vo";