[Mplayer-cvslog] CVS: main/Gui/mplayer mplayer.c,1.28,1.29 mw.h,1.71,1.72 play.c,1.67,1.68 play.h,1.26,1.27 sw.h,1.35,1.36 widgets.c,1.33,1.34

Zoltan Ponekker pontscho at mplayerhq.hu
Thu Jul 25 22:26:39 CEST 2002


Update of /cvsroot/mplayer/main/Gui/mplayer
In directory mail:/var/tmp.root/cvs-serv1722/mplayer

Modified Files:
	mplayer.c mw.h play.c play.h sw.h widgets.c 
Log Message:


- add preferences support (first try)
- fix some playlist bug
- fix some equ bug
- fix some redraw bug
- fix dvd playing
- fix file open dialog box
- etc.

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mplayer.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- mplayer.c	5 Jul 2002 23:46:57 -0000	1.28
+++ mplayer.c	25 Jul 2002 20:26:34 -0000	1.29
@@ -7,6 +7,7 @@
 #include "./mplayer.h"
 #include "../events.h"
 #include "../app.h"
+#include "../cfg.h"
 #include "../interface.h"
 #include "../skin/skin.h"
 #include "../skin/font.h"
@@ -98,9 +99,6 @@
  wsClearWindow( appMPlayer.subWindow );
  if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
 
- wsPostRedisplay( &appMPlayer.mainWindow );
- wsPostRedisplay( &appMPlayer.subWindow );
-
  btnModify( evSetVolume,guiIntfStruct.Volume );
  btnModify( evSetBalance,guiIntfStruct.Balance );
  btnModify( evSetMoviePosition,guiIntfStruct.Position );
@@ -108,17 +106,25 @@
  wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask );
  wsSetIcon( wsDisplay,appMPlayer.subWindow.WindowID,guiIcon,guiIconMask );
  
- if ( fullscreen )
-  {
-   btnModify( evFullScreen,btnPressed );
-   mplFullScreen();
-  }
-
  guiIntfStruct.Playing=0;
 
  if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
  
  wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
  wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
+
+ {
+  XEvent xev;
+  do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
+  appMPlayer.subWindow.Mapped=wsMapped;
+ }
+
+ if ( fullscreen )
+  {
+   mplFullScreen();
+   btnModify( evFullScreen,btnPressed );
+  }
+
+ mplSubRender=1;
 }
 

Index: mw.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mw.h,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- mw.h	19 Jul 2002 20:51:45 -0000	1.71
+++ mw.h	25 Jul 2002 20:26:34 -0000	1.72
@@ -170,7 +170,7 @@
  btnModify( evSetMoviePosition,guiIntfStruct.Position );
  btnModify( evSetVolume,guiIntfStruct.Volume );
 
- if ( mplMainRender )
+ if ( mplMainRender && appMPlayer.mainWindow.State == wsWindowExpose )
   {
    memcpy( mplDrawBuffer,appMPlayer.main.Bitmap.Image,appMPlayer.main.Bitmap.ImageSize );
    for( i=0;i < appMPlayer.NumberOfItems + 1;i++ )
@@ -234,6 +234,8 @@
         break;
 
    case evPlayNetwork:
+        if ( guiIntfStruct.Subtitlename ) { free( guiIntfStruct.Subtitlename ); guiIntfStruct.Subtitlename=NULL; }
+	if ( guiIntfStruct.AudioFile ) { free( guiIntfStruct.AudioFile ); guiIntfStruct.AudioFile=NULL; }
 	guiIntfStruct.StreamType=STREAMTYPE_STREAM;
         goto play;
    case evSetURL:
@@ -244,6 +246,7 @@
    case evSetVCDTrack:
         guiIntfStruct.Track=(int)param;
    case evPlayVCD:
+ 	gtkSet( gtkClearStruct,guiALL,NULL );
 	guiIntfStruct.StreamType=STREAMTYPE_VCD;
 	goto play;
 #endif
@@ -253,6 +256,7 @@
         guiIntfStruct.DVD.current_chapter=1;
         guiIntfStruct.DVD.current_angle=1;
 play_dvd_2:
+ 	gtkSet( gtkClearStruct,guiALL - guiDVD,NULL );
         guiIntfStruct.StreamType=STREAMTYPE_DVD;
 #endif
    case evPlay:
@@ -260,7 +264,7 @@
 play:
 
         mplMainAutoPlay=0;
-        if ( ( msg == evPlaySwitchToPause )&&( guiIntfStruct.Playing == 1 ) ) goto NoPause;
+        if ( ( msg == evPlaySwitchToPause )&&( guiIntfStruct.Playing == 2 ) ) goto NoPause;
 
 	vcd_track=0;
 	dvd_title=0;
@@ -272,19 +276,19 @@
 	  guiSetDF( guiIntfStruct.Filename,next->path,next->name );
 	  guiIntfStruct.StreamType=STREAMTYPE_FILE;
 	  guiIntfStruct.FilenameChanged=1;
-	  if ( guiIntfStruct.AudioFile ) free( guiIntfStruct.AudioFile );
-	  guiIntfStruct.AudioFile=NULL;
+	  gfree( (void **)&guiIntfStruct.AudioFile );
+	  gfree( (void **)&guiIntfStruct.Subtitlename );
 	 }
 
         switch ( guiIntfStruct.StreamType )
          {
 	  case STREAMTYPE_STREAM:
 	  case STREAMTYPE_FILE:
-	       guiGetEvent( guiClearStruct,(char *)guiALL );
+	       gtkSet( gtkClearStruct,guiALL - guiFilenames,NULL );
 	       break;
 #ifdef HAVE_VCD
           case STREAMTYPE_VCD:
-	       guiGetEvent( guiClearStruct,(char *)(guiALL - guiVCD ) );
+	       gtkSet( gtkClearStruct,guiALL - guiVCD - guiFilenames,NULL );
 	       if ( !cdrom_device )
 	        {
 		 cdrom_device=DEFAULT_CDROM_DEVICE;
@@ -304,11 +308,11 @@
 #endif
 #ifdef USE_DVDREAD
           case STREAMTYPE_DVD:
-	       guiGetEvent( guiClearStruct,(char *)(guiALL - guiDVD ) );
+	       gtkSet( gtkClearStruct,guiALL - guiDVD - guiFilenames,NULL );
 	       if ( !dvd_device ) 
 	        {
 	         dvd_device=DEFAULT_DVD_DEVICE;
-                 guiSetFilename( guiIntfStruct.Filename,dvd_device );
+                 guiSetFilename( guiIntfStruct.Filename,dvd_device )
 		} 
 	       if ( guiIntfStruct.Playing != 2 )
 	        {
@@ -321,7 +325,6 @@
 #endif
          }
         mplPlay();
-        mplMainRender=1;
         break;
 #ifdef USE_DVDREAD
    case evSetDVDSubtitle:
@@ -348,37 +351,21 @@
    case evPauseSwitchToPlay:
 NoPause:
         mplPause();
-        mplMainRender=1;
         break;
 
-   case evStop:
-        mplStop();
-        mplMainRender=1;
-        break;
+   case evStop: guiIntfStruct.Playing=guiSetStop; break;
 
    case evLoadPlay:
         mplMainAutoPlay=1;
 //	guiIntfStruct.StreamType=STREAMTYPE_FILE;
    case evLoad:
-        mplMainRender=1;
 	gtkSet( gtkDelPl,0,NULL );
         gtkShow( evLoad,NULL );
         break;
-   case evLoadSubtitle:
-        mplMainRender=1;
-        gtkShow( evLoadSubtitle,NULL );
-        break;
-   case evLoadAudioFile:
-	gtkShow( evLoadAudioFile,NULL );
-	break;
-   case evPrev:
-	mplPrev();
-        mplMainRender=1;
-        break;
-   case evNext:
-	mplNext();
-        mplMainRender=1;
-        break;
+   case evLoadSubtitle:  gtkShow( evLoadSubtitle,NULL );  break;
+   case evLoadAudioFile: gtkShow( evLoadAudioFile,NULL ); break;
+   case evPrev: mplPrev(); break;
+   case evNext: mplNext(); break;
 
    case evPlayList:    gtkShow( evPlayList,NULL );        break;
    case evSkinBrowser: gtkShow( evSkinBrowser,skinName ); break;
@@ -461,7 +448,6 @@
            }
          }
         mplFullScreen();
-        mplMainRender=1;
         break;
 
 // --- timer events
@@ -516,7 +502,7 @@
           sx=X; sy=Y; boxMoved=1; itemtype=itPLMButton; // if move the main window
           SelectedItem=currentselected;
           if ( SelectedItem == -1 ) break; // yeees, i'm move the fucking window
-          boxMoved=0; mplMainRender=1; // No, not move the window, i'm pressed one button
+          boxMoved=0; //mplMainRender=1; // No, not move the window, i'm pressed one button
           item=&appMPlayer.Items[SelectedItem];
           itemtype=item->type;
           item->pressed=btnPressed;
@@ -547,7 +533,7 @@
                  break;
            }
           mplEventHandling( item->msg,value );
-          mplMainRender=1;
+//          mplMainRender=1;
           itemtype=0;
           break;
 
@@ -565,7 +551,6 @@
             item->value+=value;
             btnModify( item->msg,item->value );
             mplEventHandling( item->msg,item->value );
-            mplMainRender=1;
            }
           break;
 

Index: play.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/play.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- play.c	12 Jul 2002 00:53:25 -0000	1.67
+++ play.c	25 Jul 2002 20:26:34 -0000	1.68
@@ -91,7 +91,7 @@
 
  if ( !mplGotoTheNext ) { mplGotoTheNext=1; return; }
 
- if ( (next=gtkSet( gtkGetNextPlItem,0,NULL )) && plLastPlayed != next )
+ if ( guiIntfStruct.Playing && (next=gtkSet( gtkGetNextPlItem,0,NULL )) && plLastPlayed != next )
   {
    plLastPlayed=next;
    guiSetDF( guiIntfStruct.Filename,next->path,next->name );
@@ -99,26 +99,24 @@
    guiIntfStruct.FilenameChanged=1;
    if ( guiIntfStruct.AudioFile ) free( guiIntfStruct.AudioFile );
    guiIntfStruct.AudioFile=NULL;
-  } else mplStop();
-}
-
-void mplStop( void )
-{
- guiIntfStruct.Playing=0;
- guiIntfStruct.TimeSec=0;
- guiIntfStruct.Position=0;
- guiIntfStruct.AudioType=0;
-
- if ( !appMPlayer.subWindow.isFullScreen )
-  {
-   wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
-   wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
-  }
- guiGetEvent( guiCEvent,guiSetStop );
- mplSubRender=1;
- wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
- wsClearWindow( appMPlayer.subWindow );
- wsPostRedisplay( &appMPlayer.subWindow );
+  } 
+  else
+    {
+     guiIntfStruct.TimeSec=0;
+     guiIntfStruct.Position=0;
+     guiIntfStruct.AudioType=0;
+
+     if ( !appMPlayer.subWindow.isFullScreen )
+      {
+       wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
+       wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
+      }
+     guiGetEvent( guiCEvent,guiSetStop );
+     mplSubRender=1;
+     wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
+     wsClearWindow( appMPlayer.subWindow );
+     wsPostRedisplay( &appMPlayer.subWindow );
+    }
 }
 
 void mplPlay( void )
@@ -127,20 +125,22 @@
       ( guiIntfStruct.Filename[0] == 0 )||
       ( guiIntfStruct.Playing == 1 ) ) return;
  if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; }
- guiGetEvent( guiCEvent,guiSetPlay );
+ guiGetEvent( guiCEvent,(void *)guiSetPlay );
  mplSubRender=0;
  wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
  wsClearWindow( appMPlayer.subWindow );
-// wsPostRedisplay( &appMPlayer.subWindow );
 }
 
 void mplPause( void )
 {
- mp_cmd_t * cmd = (mp_cmd_t *)calloc( 1,sizeof( *cmd ) );
- cmd->id=MP_CMD_PAUSE;
- cmd->name=strdup("pause");
- mp_input_queue_cmd(cmd);
- mplSubRender=0;
+ if ( !guiIntfStruct.Playing ) return;
+ if ( guiIntfStruct.Playing == 1 )
+  {
+   mp_cmd_t * cmd = (mp_cmd_t *)calloc( 1,sizeof( *cmd ) );
+   cmd->id=MP_CMD_PAUSE;
+   cmd->name=strdup("pause");
+   mp_input_queue_cmd(cmd);
+  } else guiIntfStruct.Playing=1;
 }
 
 void mplState( void )
@@ -239,11 +239,14 @@
  btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen );
 }
 
-void mplSetFileName( char * fname )
+void mplSetFileName( char * dir,char * name )
 {
- if ( !fname ) return;
- if ( guiIntfStruct.Filename ) free( guiIntfStruct.Filename );
- guiIntfStruct.Filename=strdup( fname );
+ if ( !name || !dir ) return;
+ guiSetDF( guiIntfStruct.Filename,dir,name );
+ guiIntfStruct.StreamType=STREAMTYPE_FILE;
+ guiIntfStruct.FilenameChanged=1;
+ gfree( (void **)&guiIntfStruct.AudioFile );
+ gfree( (void **)&guiIntfStruct.Subtitlename );
 }
 
 void mplPrev( void )
@@ -270,12 +273,12 @@
 	break;
 #endif
    default: 
-	if ( (prev=gtkSet( gtkGetPrevPlItem,0,NULL)) ) { mplGotoTheNext=0; break; }
-//	 {
-//	  guiSetDF( guiIntfStruct.Filename,prev->path,prev->name );
-//	  guiIntfStruct.FilenameChanged=1;
-//	  break;
-//	 }
+	if ( (prev=gtkSet( gtkGetPrevPlItem,0,NULL)) )
+	 {
+	  mplSetFileName( prev->path,prev->name );
+	  mplGotoTheNext=0;
+	  break;
+	 }
 	return;
   }
  if ( stop ) mplEventHandling( evStop,0 );
@@ -306,12 +309,12 @@
 	break;
 #endif
    default:
-	if ( (next=gtkSet( gtkGetNextPlItem,0,NULL)) ) { mplGotoTheNext=0; break; }
-//	 {
-//	  guiSetDF( guiIntfStruct.Filename,next->path,next->name );
-//	  guiIntfStruct.FilenameChanged=1;
-//	  break;
-//	 }
+	if ( (next=gtkSet( gtkGetNextPlItem,0,NULL)) ) 
+	 { 
+	  mplSetFileName( next->path,next->name );
+	  mplGotoTheNext=0;
+	  break;
+	 }
 	return;
   }
  if ( stop ) mplEventHandling( evStop,0 );

Index: play.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/play.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- play.h	12 Jul 2002 00:53:25 -0000	1.26
+++ play.h	25 Jul 2002 20:26:34 -0000	1.27
@@ -7,7 +7,6 @@
 #include "./mplayer.h"
 
 extern void mplEnd( void );
-extern void mplStop( void );
 extern void mplFullScreen( void );
 extern void mplPlay( void );
 extern void mplPause( void );
@@ -29,6 +28,6 @@
 extern void ChangeSkin( char * name );
 extern void EventHandling( void );
 
-extern void mplSetFileName( char * fname );
+extern void mplSetFileName( char * dir,char * name );
 
 #endif

Index: sw.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/sw.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- sw.h	5 Jul 2002 23:46:57 -0000	1.35
+++ sw.h	25 Jul 2002 20:26:34 -0000	1.36
@@ -1,7 +1,7 @@
 
 // sub window
 
-int             mplSubRender = 1;
+int             mplSubRender = 0;
 int             SubVisible = 0;
 
 void mplSubDraw( wsParamDisplay )
@@ -16,7 +16,7 @@
 
  if ( guiIntfStruct.Playing ) mplSubRender=0;
 
- if ( mplSubRender )
+ if ( mplSubRender && appMPlayer.subWindow.State == wsWindowExpose )
   {
    if ( appMPlayer.sub.Bitmap.Image ) wsPutImage( &appMPlayer.subWindow );
   }

Index: widgets.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/widgets.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- widgets.c	19 Jul 2002 20:51:45 -0000	1.33
+++ widgets.c	25 Jul 2002 20:26:34 -0000	1.34
@@ -30,7 +30,6 @@
 #include "../../config.h"
 #include "../../help_mp.h"
 
-GtkWidget     * Options;
 GtkWidget     * PopUpMenu = NULL;
 
 GtkWidget     * WarningPixmap;
@@ -148,6 +147,9 @@
          break;
   }
  gtk_widget_show( MessageBox );
+ gtkSetLayer( MessageBox );
+ if ( type == GTK_MB_FATAL )
+  while ( gtkVMessageBox ) gtk_main_iteration_do( 0 );
 }
 
 void gtkSetLayer( GtkWidget * wdg )
@@ -187,13 +189,9 @@
 	  }
         break;
    case evPreferences:
-        gtkMessageBox( GTK_MB_WARNING,"Sorry, this feature is under development ..." );
-//	Options=create_Options();
-//        gtk_widget_show( Options );
-//	gtkSetLayer( Options );
+        ShowPreferences();
         break;
    case evPlayList:
-//	gtkMessageBox( GTK_MB_WARNING,"Sorry, this feature is under development ..." );
         ShowPlayList();
 	gtkSetLayer( PlayList );
         break;
@@ -226,7 +224,7 @@
 	gtkVisible++;
         break;
    case evHidePopUpMenu:
-        if ( PopUpMenu ) { gtk_widget_hide_on_delete( PopUpMenu ); gtkVisible--; PopUpMenu=NULL; }
+        if ( PopUpMenu ) { gtk_widget_hide_on_delete( PopUpMenu ); /*gtkVisible--;*/ PopUpMenu=NULL; }
         break;
    case evPlayNetwork:
 	ShowURLDialogBox();




More information about the MPlayer-cvslog mailing list