changeset 1729:d6c99f70449e

fix hprogressbar
author pontscho
date Tue, 28 Aug 2001 15:55:02 +0000
parents 014b29286ec4
children bea87c823666
files Gui/app.c Gui/app.h Gui/mplayer/mw.h Gui/mplayer/play.c Gui/mplayer/sw.h Gui/skin/skin.c Gui/skin/skin.h mplayer.c
diffstat 8 files changed, 73 insertions(+), 95 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/app.c	Tue Aug 28 15:37:24 2001 +0000
+++ b/Gui/app.c	Tue Aug 28 15:55:02 2001 +0000
@@ -39,6 +39,7 @@
  item->fontid=0;
  if ( item->label ) free( item->label ); item->label=NULL;
  item->event=0;
+ item->used=0;
 }
 
 void appCopy( listItems * dest,listItems * source )
--- a/Gui/app.h	Tue Aug 28 15:37:24 2001 +0000
+++ b/Gui/app.h	Tue Aug 28 15:55:02 2001 +0000
@@ -34,6 +34,7 @@
  int        pressed,disabled,tmp;
  int        key,key2;
  int        phases;
+ int        used;
  float      value;
  txSample   Bitmap;
  txSample   Mask;
--- a/Gui/mplayer/mw.h	Tue Aug 28 15:37:24 2001 +0000
+++ b/Gui/mplayer/mw.h	Tue Aug 28 15:55:02 2001 +0000
@@ -125,6 +125,8 @@
    }
 }
 
+extern float gui_position;
+
 void mplMainDraw( wsParamDisplay )
 {
  wItem    * item;
@@ -133,8 +135,11 @@
  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 @@
        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 @@
 
 #define IZE(x) printf("@@@ " x " @@@\n");
 
+extern void exit_player(char* how);
+
 void mplMsgHandle( int msg,float param )
 {
  int j;
@@ -188,8 +194,9 @@
   {
 // --- user events
    case evExit:
-        IZE("evExit");
+//        IZE("evExit");
         wsDoExit();  // sets wsTrue=False;
+	exit_player( "Exit" );
         break;
    case evIconify:
         IZE("evIcon");
@@ -312,9 +319,10 @@
    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 @@
                           item->x+item->width,item->y+item->height ) )
                       {
                        item->pressed=btnPressed;
+		       item->used=1;
                        mplMainRender=1;
                        SelectedButton=i;
                        boxMoved=0;
@@ -402,6 +411,7 @@
                           item->x+item->width,item->y+item->height ) )
                       {
                        item->pressed=btnPressed;
+		       item->used=1;
                        mplMainRender=1;
                        SelectedButton=i;
                        boxMoved=0;
@@ -425,12 +435,12 @@
                  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 @@
                   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 );
--- a/Gui/mplayer/play.c	Tue Aug 28 15:37:24 2001 +0000
+++ b/Gui/mplayer/play.c	Tue Aug 28 15:55:02 2001 +0000
@@ -7,9 +7,9 @@
 
 int    mplParent = 1;
 
-int    mplx,mply,mplwidth,mplheight;
+float gui_position=-1;
 
-float gui_position=-1;
+int    mplx,mply,mplwidth,mplheight;
 
 #include "../app.h"
 
@@ -100,7 +100,11 @@
 
 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 @@
 
 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 @@
 // ---
 printf("%%%%%% RelSEEK=%5.3f  \n",s);
 // ---
- mplShMem->Position=mplGetPosition() + s;
  rel_seek_secs=s; abs_seek_pos=0;
 }
 
@@ -138,8 +142,6 @@
 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 )
--- a/Gui/mplayer/sw.h	Tue Aug 28 15:37:24 2001 +0000
+++ b/Gui/mplayer/sw.h	Tue Aug 28 15:55:02 2001 +0000
@@ -6,11 +6,7 @@
 
 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 @@
    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 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 ); }
--- a/Gui/skin/skin.c	Tue Aug 28 15:37:24 2001 +0000
+++ b/Gui/skin/skin.c	Tue Aug 28 15:55:02 2001 +0000
@@ -1,4 +1,4 @@
-
+ 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -682,6 +682,7 @@
  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 @@
    }
 }
 
-int btnGetValue( int event )
+float btnGetValue( int event )
 {
  int j;
  for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
--- a/Gui/skin/skin.h	Tue Aug 28 15:37:24 2001 +0000
+++ b/Gui/skin/skin.h	Tue Aug 28 15:55:02 2001 +0000
@@ -12,7 +12,7 @@
 extern int skinBPRead( char * fname, txSample * bf );
 
 extern void btnModify( int event,float state );
-extern int btnGetValue( int event );
+extern float btnGetValue( int event );
 
 // ---
 
--- a/mplayer.c	Tue Aug 28 15:37:24 2001 +0000
+++ b/mplayer.c	Tue Aug 28 15:55:02 2001 +0000
@@ -66,11 +66,11 @@
 #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 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 @@
  total_time_usage_start=GetTimer()-total_time_usage_start;
 
   // restore terminal:
-  #ifdef HAVE_GUI
-   if ( nogui )
-  #endif
-     getch2_disable();
+#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 @@
 
   if(encode_name) avi_fixate();
 #ifdef HAVE_LIRC
-  #ifdef HAVE_GUI
-   if ( nogui )
-  #endif
   lirc_mp_cleanup();
 #endif
 
@@ -347,13 +339,6 @@
   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 @@
 }
 }
 
-#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 @@
 #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,10 +563,7 @@
   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(SIGINT,exit_sighandler);  // Interrupt from keyboard
 
   signal(SIGQUIT,exit_sighandler); // Quit from keyboard
   // fatal errors:
@@ -985,15 +964,6 @@
                       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 @@
 	      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 @@
       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(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 @@
 
 #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 @@
     // partial uninit:
 
   // restore terminal:
-  #ifdef HAVE_GUI
-   if ( nogui )
-  #endif
-     getch2_disable();
+#ifdef HAVE_NEW_GUI
+   if ( !use_gui ) getch2_disable();
+#else
+   getch2_disable();
+#endif
 
   current_module="uninit_vo";