[Mplayer-cvslog] CVS: main/Gui/mplayer common.c,NONE,1.1 common.h,NONE,1.1 pb.c,NONE,1.1 mplayer.h,1.8,1.9 mw.c,1.104,1.105 play.c,1.82,1.83 sw.c,1.39,1.40 widgets.c,1.42,1.43
Zoltan Ponekker
pontscho at mplayerhq.hu
Fri Jan 17 23:40:12 CET 2003
- Previous message: [Mplayer-cvslog] CVS: main/Gui Makefile,1.21,1.22 app.c,1.19,1.20 app.h,1.16,1.17 cfg.c,1.30,1.31 cfg.h,1.12,1.13 interface.c,1.72,1.73
- Next message: [Mplayer-cvslog] CVS: main/Gui/mplayer/gtk opts.c,1.46,1.47
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/mplayer/main/Gui/mplayer
In directory mail:/var/tmp.root/cvs-serv29898/Gui/mplayer
Modified Files:
mplayer.h mw.c play.c sw.c widgets.c
Added Files:
common.c common.h pb.c
Log Message:
- add playbar
- add vpotmeter
- fix gtk menu's pixel bug
- fix some critical (10l) bug
--- NEW FILE ---
// main window
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <sys/stat.h>
#include <unistd.h>
#include "../app.h"
#include "../skin/font.h"
#include "../skin/skin.h"
#include "../wm/ws.h"
#include "../../config.h"
#include "../../help_mp.h"
#include "../../libvo/x11_common.h"
#include "../../libmpdemux/stream.h"
#include "../../mixer.h"
#include "../../libvo/sub.h"
#include "../../mplayer.h"
#include "../../libmpdemux/demuxer.h"
#include "../../libmpdemux/stheader.h"
#include "../../codec-cfg.h"
#include "play.h"
#include "widgets.h"
extern unsigned int GetTimerMS( void );
inline void TranslateFilename( int c,char * tmp )
{
int i;
switch ( guiIntfStruct.StreamType )
{
case STREAMTYPE_STREAM:
strcpy( tmp,guiIntfStruct.Filename );
break;
case STREAMTYPE_FILE:
if ( ( guiIntfStruct.Filename )&&( guiIntfStruct.Filename[0] ) )
{
if ( strrchr( guiIntfStruct.Filename,'/' ) ) strcpy( tmp,strrchr( guiIntfStruct.Filename,'/' ) + 1 );
else strcpy( tmp,guiIntfStruct.Filename );
if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0;
if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0;
} else strcpy( tmp,MSGTR_NoFileLoaded );
break;
#ifdef USE_DVDREAD
case STREAMTYPE_DVD:
if ( guiIntfStruct.DVD.current_chapter ) sprintf( tmp,MSGTR_Chapter,guiIntfStruct.DVD.current_chapter );
else strcat( tmp,MSGTR_NoChapter );
break;
#endif
#ifdef HAVE_VCD
case STREAMTYPE_VCD:
sprintf( tmp,MSGTR_VCDTrack,guiIntfStruct.Track );
break;
#endif
default: strcpy( tmp,MSGTR_NoMediaOpened );
}
if ( c )
{
for ( i=0;i < (int)strlen( tmp );i++ )
{
int t=0;
if ( c == 1 ) { if ( ( tmp[i] >= 'A' )&&( tmp[i] <= 'Z' ) ) t=32; }
if ( c == 2 ) { if ( ( tmp[i] >= 'a' )&&( tmp[i] <= 'z' ) ) t=-32; }
tmp[i]=(char)( tmp[i] + t );
}
}
}
char * Translate( char * str )
{
static char trbuf[512];
char tmp[512];
int i,c;
int t;
memset( trbuf,0,512 );
memset( tmp,0,128 );
for ( c=0,i=0;i < (int)strlen( str );i++ )
{
if ( str[i] != '$' ) { trbuf[c++]=str[i]; trbuf[c]=0; }
else
{
switch ( str[++i] )
{
case 't': sprintf( tmp,"%02d",guiIntfStruct.Track ); strcat( trbuf,tmp ); break;
case 'o': TranslateFilename( 0,tmp ); strcat( trbuf,tmp ); break;
case 'f': TranslateFilename( 1,tmp ); strcat( trbuf,tmp ); break;
case 'F': TranslateFilename( 2,tmp ); strcat( trbuf,tmp ); break;
case '6': t=guiIntfStruct.LengthInSec; goto calclengthhhmmss;
case '1': t=guiIntfStruct.TimeSec;
calclengthhhmmss:
sprintf( tmp,"%02d:%02d:%02d",t/3600,t/60%60,t%60 ); strcat( trbuf,tmp );
break;
case '7': t=guiIntfStruct.LengthInSec; goto calclengthmmmmss;
case '2': t=guiIntfStruct.TimeSec;
calclengthmmmmss:
sprintf( tmp,"%04d:%02d",t/60,t%60 ); strcat( trbuf,tmp );
break;
case '3': sprintf( tmp,"%02d",guiIntfStruct.TimeSec / 3600 ); strcat( trbuf,tmp ); break;
case '4': sprintf( tmp,"%02d",( ( guiIntfStruct.TimeSec / 60 ) % 60 ) ); strcat( trbuf,tmp ); break;
case '5': sprintf( tmp,"%02d",guiIntfStruct.TimeSec % 60 ); strcat( trbuf,tmp ); break;
case '8': sprintf( tmp,"%01d:%02d:%02d",guiIntfStruct.TimeSec / 3600,( guiIntfStruct.TimeSec / 60 ) % 60,guiIntfStruct.TimeSec % 60 ); strcat( trbuf,tmp ); break;
case 'v': sprintf( tmp,"%3.2f%%",guiIntfStruct.Volume ); strcat( trbuf,tmp ); break;
case 'V': sprintf( tmp,"%3.1f",guiIntfStruct.Volume ); strcat( trbuf,tmp ); break;
case 'b': sprintf( tmp,"%3.2f%%",guiIntfStruct.Balance ); strcat( trbuf,tmp ); break;
case 'B': sprintf( tmp,"%3.1f",guiIntfStruct.Balance ); strcat( trbuf,tmp ); break;
case 'd': sprintf( tmp,"%d",guiIntfStruct.FrameDrop ); strcat( trbuf,tmp ); break;
case 'x': sprintf( tmp,"%d",guiIntfStruct.MovieWidth ); strcat( trbuf,tmp ); break;
case 'y': sprintf( tmp,"%d",guiIntfStruct.MovieHeight ); strcat( trbuf,tmp ); break;
case 'C': sprintf( tmp,"%s", guiIntfStruct.sh_video? ((sh_video_t *)guiIntfStruct.sh_video)->codec->name : "");
strcat( trbuf,tmp ); break;
case 's': if ( guiIntfStruct.Playing == 0 ) strcat( trbuf,"s" ); break;
case 'l': if ( guiIntfStruct.Playing == 1 ) strcat( trbuf,"p" ); break;
case 'e': if ( guiIntfStruct.Playing == 2 ) strcat( trbuf,"e" ); break;
case 'a':
if ( muted ) { strcat( trbuf,"n" ); break; }
switch ( guiIntfStruct.AudioType )
{
case 0: strcat( trbuf,"n" ); break;
case 1: strcat( trbuf,"m" ); break;
case 2: strcat( trbuf,"t" ); break;
}
break;
case 'T':
switch ( guiIntfStruct.StreamType )
{
case STREAMTYPE_FILE: strcat( trbuf,"f" ); break;
#ifdef HAVE_VCD
case STREAMTYPE_VCD: strcat( trbuf,"v" ); break;
#endif
case STREAMTYPE_STREAM: strcat( trbuf,"u" ); break;
#ifdef USE_DVDREAD
case STREAMTYPE_DVD: strcat( trbuf,"d" ); break;
#endif
default: strcat( trbuf," " ); break;
}
break;
case '$': strcat( trbuf,"$" ); break;
default: continue;
}
c=strlen( trbuf );
}
}
return trbuf;
}
static char * image_buffer = NULL;
static int image_width = 0;
void PutImage( txSample * bf,int x,int y,int max,int ofs )
{
int i=0,ix,iy;
uint32_t * buf = NULL;
uint32_t * drw = NULL;
register uint32_t tmp;
register uint32_t yc;
if ( ( !bf )||( bf->Image == NULL ) ) return;
i=( bf->Width * ( bf->Height / max ) ) * ofs;
buf=(uint32_t *)image_buffer;
drw=(uint32_t *)bf->Image;
#if 0
for ( iy=y;iy < (int)(y+bf->Height / max);iy++ )
for ( ix=x;ix < (int)(x+bf->Width);ix++ )
{
tmp=drw[i++];
if ( tmp != 0x00ff00ff ) buf[iy * image_width + ix]=tmp;
}
#else
yc=y * image_width;
for ( iy=y;iy < (int)(y+bf->Height / max);iy++ )
{
for ( ix=x;ix < (int)(x+bf->Width);ix++ )
{
tmp=drw[i++];
if ( tmp != 0x00ff00ff ) buf[yc + ix]=tmp;
}
yc+=image_width;
}
#endif
}
void Render( wsTWindow * window,wItem * Items,int nrItems,char * db,int size )
{
wItem * item;
txSample * image = NULL;
int i, type;
image_buffer=db;
image_width=window->Width;
for( i=0;i < nrItems + 1;i++ )
{
item=&Items[i];
switch( item->type )
{
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 - 1 ) * ( 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 itVPotmeter:
PutImage( &item->Bitmap,
item->x,item->y,
item->phases,
item->phases * ( item->value / 100.0f ) );
PutImage( &item->Mask,
item->x,item->y + (int)( ( item->height - item->psy ) * item->value / 100.0f ),
3,item->pressed );
break;
case itSLabel:
image=fntRender( item,0,"%s",item->label );
if ( image ) PutImage( image,item->x,item->y,1,0 );
case itDLabel:
{
char * t = Translate( item->label );
int l = fntTextWidth( item->fontid,t );
image=fntRender( item,(GetTimerMS() / 20)%(l?l:item->width),"%s",t );
}
if ( image ) PutImage( image,item->x,item->y,1,0 );
break;
}
}
wsConvert( window,db,size );
}
--- NEW FILE ---
#ifndef __COMMON_H
#define __COMMON_H
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <sys/stat.h>
#include <unistd.h>
#include "../app.h"
#include "../bitmap.h"
#include "../wm/ws.h"
extern inline void TranslateFilename( int c,char * tmp );
extern char * Translate( char * str );
extern void PutImage( txSample * bf,int x,int y,int max,int ofs );
extern void Render( wsTWindow * window,wItem * Items,int nrItems,char * db,int size );
#endif
--- NEW FILE ---
// main window
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <sys/stat.h>
#include <unistd.h>
#include "../app.h"
#include "../skin/font.h"
#include "../skin/skin.h"
#include "../wm/ws.h"
#include "../../config.h"
#include "../../help_mp.h"
#include "../../libvo/x11_common.h"
#include "../../libmpdemux/stream.h"
#include "../../mixer.h"
#include "../../libvo/sub.h"
#include "../../mplayer.h"
#include "../../libmpdemux/demuxer.h"
#include "../../libmpdemux/stheader.h"
#include "../../codec-cfg.h"
#include "play.h"
#include "widgets.h"
#include "common.h"
extern unsigned int GetTimerMS( void );
extern unsigned int GetTimer( void );
unsigned char * mplPBDrawBuffer = NULL;
int mplPBVisible = 0;
int mplPBLength = 0;
int mplPBFade = 0;
void mplPBDraw( void )
{
if ( !appMPlayer.subWindow.isFullScreen ) return;
if ( !mplPBVisible || !appMPlayer.barIsPresent ) return;
appMPlayer.bar.x=( appMPlayer.subWindow.Width - appMPlayer.bar.width ) / 2;
switch ( mplPBFade )
{
case 1: // fade in
mplPBLength--;
if ( appMPlayer.subWindow.Height - appMPlayer.bar.height >= mplPBLength )
{
mplPBLength=appMPlayer.subWindow.Height - appMPlayer.bar.height;
mplPBFade=0;
vo_mouse_autohide=0;
}
wsMoveWindow( &appMPlayer.barWindow,0,appMPlayer.bar.x,mplPBLength );
break;
case 2: // fade out
mplPBLength+=10;
if ( mplPBLength > appMPlayer.subWindow.Height )
{
mplPBLength=appMPlayer.subWindow.Height;
mplPBFade=mplPBVisible=0;
vo_mouse_autohide=1;
wsVisibleWindow( &appMPlayer.barWindow,wsHideWindow );
return;
}
wsMoveWindow( &appMPlayer.barWindow,0,appMPlayer.bar.x,mplPBLength );
break;
}
// --- render
if ( appMPlayer.barWindow.State == wsWindowExpose )
{
btnModify( evSetMoviePosition,guiIntfStruct.Position );
btnModify( evSetVolume,guiIntfStruct.Volume );
memcpy( mplPBDrawBuffer,appMPlayer.bar.Bitmap.Image,appMPlayer.bar.Bitmap.ImageSize );
Render( &appMPlayer.barWindow,appMPlayer.barItems,appMPlayer.NumberOfBarItems,mplPBDrawBuffer,appMPlayer.bar.Bitmap.ImageSize );
wsConvert( &appMPlayer.barWindow,mplPBDrawBuffer,appMPlayer.bar.Bitmap.ImageSize );
}
wsPutImage( &appMPlayer.barWindow );
}
#define itPLMButton (itNULL - 1)
#define itPRMButton (itNULL - 2)
void mplPBMouseHandle( int Button,int X,int Y,int RX,int RY )
{
static int itemtype = 0;
int i;
wItem * item = NULL;
float value = 0.0f;
static int SelectedItem = -1;
int currentselected = -1;
for ( i=0;i < appMPlayer.NumberOfBarItems + 1;i++ )
if ( ( appMPlayer.barItems[i].pressed != btnDisabled )&&
( wgIsRect( X,Y,appMPlayer.barItems[i].x,appMPlayer.barItems[i].y,appMPlayer.barItems[i].x+appMPlayer.barItems[i].width,appMPlayer.barItems[i].y+appMPlayer.barItems[i].height ) ) )
{ currentselected=i; break; }
switch ( Button )
{
case wsPMMouseButton:
gtkShow( evHidePopUpMenu,NULL );
mplShowMenu( RX,RY );
break;
case wsRMMouseButton:
mplHideMenu( RX,RY,0 );
break;
case wsPRMouseButton:
gtkShow( evShowPopUpMenu,NULL );
break;
// ---
case wsPLMouseButton:
gtkShow( evHidePopUpMenu,NULL );
SelectedItem=currentselected;
if ( SelectedItem == -1 ) break; // yeees, i'm move the fucking window
item=&appMPlayer.barItems[SelectedItem];
itemtype=item->type;
item->pressed=btnPressed;
switch( item->type )
{
case itButton:
if ( ( SelectedItem > -1 ) &&
( ( ( item->msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) ||
( ( item->msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) )
{ item->pressed=btnDisabled; }
break;
}
break;
case wsRLMouseButton:
item=&appMPlayer.barItems[SelectedItem];
item->pressed=btnReleased;
SelectedItem=-1;
if ( currentselected == - 1 ) { itemtype=0; break; }
value=0;
switch( itemtype )
{
case itPotmeter:
case itHPotmeter:
btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f );
mplEventHandling( item->msg,item->value );
value=item->value;
break;
}
mplEventHandling( item->msg,value );
itemtype=0;
break;
// ---
case wsP5MouseButton: value=-2.5f; goto rollerhandled;
case wsP4MouseButton: value= 2.5f;
rollerhandled:
item=&appMPlayer.barItems[currentselected];
if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) )
{
item->value+=value;
btnModify( item->msg,item->value );
mplEventHandling( item->msg,item->value );
}
break;
// ---
case wsMoveMouse:
item=&appMPlayer.barItems[SelectedItem];
switch ( itemtype )
{
case itPRMButton:
mplMenuMouseHandle( X,Y,RX,RY );
break;
case itPotmeter:
item->value=(float)( X - item->x ) / item->width * 100.0f;
goto potihandled;
case itHPotmeter:
item->value=(float)( X - item->x ) / item->width * 100.0f;
potihandled:
if ( item->value > 100.0f ) item->value=100.0f;
if ( item->value < 0.0f ) item->value=0.0f;
mplEventHandling( item->msg,item->value );
break;
}
break;
}
}
void mplPBShow( int x, int y )
{
if ( !appMPlayer.barIsPresent || !gtkEnablePlayBar ) return;
if ( !appMPlayer.subWindow.isFullScreen ) return;
if ( y > appMPlayer.subWindow.Height - appMPlayer.bar.height )
{
if ( !mplPBFade ) wsVisibleWindow( &appMPlayer.barWindow,wsShowWindow );
mplPBFade=1; mplPBVisible=1; wsPostRedisplay( &appMPlayer.barWindow );
}
else if ( !mplPBFade ) mplPBFade=2;
}
void mplPBInit( void )
{
gfree( (void**)&mplPBDrawBuffer );
if ( !appMPlayer.barIsPresent ) return;
if ( ( mplPBDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.bar.Bitmap.ImageSize ) ) == NULL )
{
fprintf( stderr,MSGTR_NEMDB );
exit( 0 );
}
appMPlayer.barWindow.Parent=appMPlayer.subWindow.WindowID;
wsCreateWindow( &appMPlayer.barWindow,
appMPlayer.bar.x,appMPlayer.bar.y,appMPlayer.bar.width,appMPlayer.bar.height,
wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsHideWindow,"PlayBar" );
wsSetShape( &appMPlayer.barWindow,appMPlayer.bar.Mask.Image );
appMPlayer.barWindow.ReDraw=(void *)mplPBDraw;
appMPlayer.barWindow.MouseHandler=mplPBMouseHandle;
appMPlayer.barWindow.KeyHandler=mplMainKeyHandle;
mplPBLength=appMPlayer.subWindow.Height;
}
Index: mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mplayer.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- mplayer.h 2 Nov 2002 20:10:16 -0000 1.8
+++ mplayer.h 17 Jan 2003 22:39:39 -0000 1.9
@@ -29,4 +29,7 @@
extern void mplShowMenu( int mx,int my );
extern void mplMenuMouseHandle( int X,int Y,int RX,int RY );
+extern void mplPBInit( void );
+extern void mplPBShow( int x, int y );
+
#endif
Index: mw.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/mw.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- mw.c 12 Jan 2003 23:38:53 -0000 1.104
+++ mw.c 17 Jan 2003 22:39:39 -0000 1.105
@@ -43,146 +43,7 @@
int sx = 0,sy = 0;
int i,pot = 0;
-inline void TranslateFilename( int c,char * tmp )
-{
- int i;
- switch ( guiIntfStruct.StreamType )
- {
- case STREAMTYPE_STREAM:
- strcpy( tmp,guiIntfStruct.Filename );
- break;
- case STREAMTYPE_FILE:
- if ( ( guiIntfStruct.Filename )&&( guiIntfStruct.Filename[0] ) )
- {
- if ( strrchr( guiIntfStruct.Filename,'/' ) ) strcpy( tmp,strrchr( guiIntfStruct.Filename,'/' ) + 1 );
- else strcpy( tmp,guiIntfStruct.Filename );
- if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0;
- if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0;
- } else strcpy( tmp,MSGTR_NoFileLoaded );
- break;
-#ifdef USE_DVDREAD
- case STREAMTYPE_DVD:
- if ( guiIntfStruct.DVD.current_chapter ) sprintf( tmp,MSGTR_Chapter,guiIntfStruct.DVD.current_chapter );
- else strcat( tmp,MSGTR_NoChapter );
- break;
-#endif
-#ifdef HAVE_VCD
- case STREAMTYPE_VCD:
- sprintf( tmp,MSGTR_VCDTrack,guiIntfStruct.Track );
- break;
-#endif
- default: strcpy( tmp,MSGTR_NoMediaOpened );
- }
- if ( c )
- {
- for ( i=0;i < (int)strlen( tmp );i++ )
- {
- int t=0;
- if ( c == 1 ) { if ( ( tmp[i] >= 'A' )&&( tmp[i] <= 'Z' ) ) t=32; }
- if ( c == 2 ) { if ( ( tmp[i] >= 'a' )&&( tmp[i] <= 'z' ) ) t=-32; }
- tmp[i]=(char)( tmp[i] + t );
- }
- }
-}
-
-char * Translate( char * str )
-{
- static char trbuf[512];
- char tmp[512];
- int i,c;
- int t;
- memset( trbuf,0,512 );
- memset( tmp,0,128 );
- for ( c=0,i=0;i < (int)strlen( str );i++ )
- {
- if ( str[i] != '$' ) { trbuf[c++]=str[i]; trbuf[c]=0; }
- else
- {
- switch ( str[++i] )
- {
- case 't': sprintf( tmp,"%02d",guiIntfStruct.Track ); strcat( trbuf,tmp ); break;
- case 'o': TranslateFilename( 0,tmp ); strcat( trbuf,tmp ); break;
- case 'f': TranslateFilename( 1,tmp ); strcat( trbuf,tmp ); break;
- case 'F': TranslateFilename( 2,tmp ); strcat( trbuf,tmp ); break;
- case '6': t=guiIntfStruct.LengthInSec; goto calclengthhhmmss;
- case '1': t=guiIntfStruct.TimeSec;
-calclengthhhmmss:
- sprintf( tmp,"%02d:%02d:%02d",t/3600,t/60%60,t%60 ); strcat( trbuf,tmp );
- break;
- case '7': t=guiIntfStruct.LengthInSec; goto calclengthmmmmss;
- case '2': t=guiIntfStruct.TimeSec;
-calclengthmmmmss:
- sprintf( tmp,"%04d:%02d",t/60,t%60 ); strcat( trbuf,tmp );
- break;
- case '3': sprintf( tmp,"%02d",guiIntfStruct.TimeSec / 3600 ); strcat( trbuf,tmp ); break;
- case '4': sprintf( tmp,"%02d",( ( guiIntfStruct.TimeSec / 60 ) % 60 ) ); strcat( trbuf,tmp ); break;
- case '5': sprintf( tmp,"%02d",guiIntfStruct.TimeSec % 60 ); strcat( trbuf,tmp ); break;
- case '8': sprintf( tmp,"%01d:%02d:%02d",guiIntfStruct.TimeSec / 3600,( guiIntfStruct.TimeSec / 60 ) % 60,guiIntfStruct.TimeSec % 60 ); strcat( trbuf,tmp ); break;
- case 'v': sprintf( tmp,"%3.2f%%",guiIntfStruct.Volume ); strcat( trbuf,tmp ); break;
- case 'V': sprintf( tmp,"%3.1f",guiIntfStruct.Volume ); strcat( trbuf,tmp ); break;
- case 'b': sprintf( tmp,"%3.2f%%",guiIntfStruct.Balance ); strcat( trbuf,tmp ); break;
- case 'B': sprintf( tmp,"%3.1f",guiIntfStruct.Balance ); strcat( trbuf,tmp ); break;
- case 'd': sprintf( tmp,"%d",guiIntfStruct.FrameDrop ); strcat( trbuf,tmp ); break;
- case 'x': sprintf( tmp,"%d",guiIntfStruct.MovieWidth ); strcat( trbuf,tmp ); break;
- case 'y': sprintf( tmp,"%d",guiIntfStruct.MovieHeight ); strcat( trbuf,tmp ); break;
- case 'C': sprintf( tmp,"%s", guiIntfStruct.sh_video? ((sh_video_t *)guiIntfStruct.sh_video)->codec->name : "");
- strcat( trbuf,tmp ); break;
- case 's': if ( guiIntfStruct.Playing == 0 ) strcat( trbuf,"s" ); break;
- case 'l': if ( guiIntfStruct.Playing == 1 ) strcat( trbuf,"p" ); break;
- case 'e': if ( guiIntfStruct.Playing == 2 ) strcat( trbuf,"e" ); break;
- case 'a':
- if ( muted ) { strcat( trbuf,"n" ); break; }
- switch ( guiIntfStruct.AudioType )
- {
- case 0: strcat( trbuf,"n" ); break;
- case 1: strcat( trbuf,"m" ); break;
- case 2: strcat( trbuf,"t" ); break;
- }
- break;
- case 'T':
- switch ( guiIntfStruct.StreamType )
- {
- case STREAMTYPE_FILE: strcat( trbuf,"f" ); break;
-#ifdef HAVE_VCD
- case STREAMTYPE_VCD: strcat( trbuf,"v" ); break;
-#endif
- case STREAMTYPE_STREAM: strcat( trbuf,"u" ); break;
-#ifdef USE_DVDREAD
- case STREAMTYPE_DVD: strcat( trbuf,"d" ); break;
-#endif
- default: strcat( trbuf," " ); break;
- }
- break;
- case '$': strcat( trbuf,"$" ); break;
- default: continue;
- }
- c=strlen( trbuf );
- }
- }
- return trbuf;
-}
-
-inline void PutImage( txSample * bf,int x,int y,int max,int ofs )
-{
- int i=0,ix,iy;
- uint32_t * buf = NULL;
- uint32_t * drw = NULL;
- uint32_t tmp;
-
- if ( ( !bf )||( bf->Image == NULL ) ) return;
-
- i=( bf->Width * ( bf->Height / max ) ) * ofs;
- buf=(uint32_t *)mplDrawBuffer;
- drw=(uint32_t *)bf->Image;
-
- for ( iy=y;iy < (int)(y+bf->Height / max);iy++ )
- for ( ix=x;ix < (int)(x+bf->Width);ix++ )
- {
- tmp=drw[i++];
- if ( tmp != 0x00ff00ff )
- buf[ iy*appMPlayer.main.Bitmap.Width+ix ]=tmp;
- }
-}
+#include "common.h"
void mplMainDraw( void )
{
@@ -196,41 +57,13 @@
!mainVisible ) return;
// !appMPlayer.mainWindow.Mapped ) return;
- btnModify( evSetMoviePosition,guiIntfStruct.Position );
- btnModify( evSetVolume,guiIntfStruct.Volume );
-
if ( mplMainRender && appMPlayer.mainWindow.State == wsWindowExpose )
{
+ btnModify( evSetMoviePosition,guiIntfStruct.Position );
+ btnModify( evSetVolume,guiIntfStruct.Volume );
+
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 itPotmeter:
- PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( 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 itSLabel:
- image=fntRender( item,0,"%s",item->label );
- if ( image ) PutImage( image,item->x,item->y,1,0 );
- case itDLabel:
- {
- char * t = Translate( item->label );
- int l = fntTextWidth( item->fontid,t );
- image=fntRender( item,(GetTimerMS() / 20)%(l?l:item->width),"%s",t );
- }
- if ( image ) PutImage( image,item->x,item->y,1,0 );
- break;
- }
- }
- wsConvert( &appMPlayer.mainWindow,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize );
+ Render( &appMPlayer.mainWindow,appMPlayer.Items,appMPlayer.NumberOfItems,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize );
mplMainRender=0;
}
wsPutImage( &appMPlayer.mainWindow );
@@ -498,6 +331,7 @@
case evRedraw:
mplMainRender=1;
wsPostRedisplay( &appMPlayer.mainWindow );
+ wsPostRedisplay( &appMPlayer.barWindow );
break;
// --- system events
#ifdef MP_DEBUG
@@ -542,10 +376,10 @@
case wsPLMouseButton:
gtkShow( evHidePopUpMenu,NULL );
- sx=X; sy=Y; boxMoved=1; itemtype=itPLMButton; // if move the main window
+ sx=X; sy=Y; boxMoved=1; itemtype=itPLMButton;
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
+ if ( SelectedItem == -1 ) break;
+ boxMoved=0;
item=&appMPlayer.Items[SelectedItem];
itemtype=item->type;
item->pressed=btnPressed;
@@ -553,9 +387,9 @@
{
case itButton:
if ( ( SelectedItem > -1 ) &&
- ( ( ( appMPlayer.Items[SelectedItem].msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) ||
- ( ( appMPlayer.Items[SelectedItem].msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) )
- { appMPlayer.Items[SelectedItem].pressed=btnDisabled; }
+ ( ( ( item->msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) ||
+ ( ( item->msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) )
+ { item->pressed=btnDisabled; }
break;
}
break;
@@ -576,7 +410,6 @@
break;
}
mplEventHandling( item->msg,value );
-// mplMainRender=1;
itemtype=0;
break;
@@ -612,6 +445,9 @@
case itPotmeter:
item->value=(float)( X - item->x ) / item->width * 100.0f;
goto potihandled;
+ case itVPotmeter:
+ item->value=(float)( Y - item->y ) / item->height * 100.0f;
+ goto potihandled;
case itHPotmeter:
item->value=(float)( X - item->x ) / item->width * 100.0f;
potihandled:
@@ -622,7 +458,6 @@
}
break;
}
-// if ( Button != wsMoveMouse ) wsPostRedisplay( &appMPlayer.mainWindow );
}
int keyPressed = 0;
@@ -659,15 +494,13 @@
case wsXF86Prev: msg=evPrev; break;
case wsXF86Next: msg=evNext; break;
case wsXF86Media: msg=evLoad; break;
- case wsEscape:
+ case wsEscape:
if ( appMPlayer.subWindow.isFullScreen )
{
- if ( guiIntfStruct.event_struct )
- { memset( guiIntfStruct.event_struct,0,sizeof( XEvent ) ); guiIntfStruct.event_struct=NULL; }
+ if ( guiIntfStruct.event_struct ) ((XEvent *)guiIntfStruct.event_struct)->type=None;
mplEventHandling( evNormalSize,0 );
- break;
+ return;
}
-
default: vo_x11_putkey( Key ); return;
}
}
Index: play.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/play.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- play.c 13 Jan 2003 23:38:48 -0000 1.82
+++ play.c 17 Jan 2003 22:39:39 -0000 1.83
@@ -84,7 +84,7 @@
fullscreen=appMPlayer.subWindow.isFullScreen;
if ( guiIntfStruct.Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
- else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
+ else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
}
extern int mplSubRender;
@@ -126,7 +126,7 @@
}
guiGetEvent( guiCEvent,guiSetStop );
mplSubRender=1;
- wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
+ wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
wsClearWindow( appMPlayer.subWindow );
wsPostRedisplay( &appMPlayer.subWindow );
}
@@ -192,9 +192,10 @@
{
int ret;
int prev = appMPlayer.menuIsPresent;
+ int bprev = appMPlayer.barIsPresent;
mainVisible=0;
-
+
appInitStruct( &tmpList );
skinAppMPlayer=&tmpList;
fntFreeFont();
@@ -210,6 +211,8 @@
return;
}
+// --- reload menu window
+
if ( prev && appMPlayer.menuIsPresent )
{
if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer );
@@ -221,6 +224,7 @@
wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow );
} else { mplMenuInit(); }
+// --- reload sub window
if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) )
{
@@ -231,26 +235,20 @@
if ( !guiIntfStruct.Playing )
{
mplSubRender=1;
- wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB );
+ wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
wsClearWindow( appMPlayer.subWindow );
wsPostRedisplay( &appMPlayer.subWindow );
}
+// --- reload play bar
+ if ( bprev ) wsDestroyWindow( &appMPlayer.barWindow );
+ mplPBInit();
+
+// --- reload main window
if ( mplDrawBuffer ) free( mplDrawBuffer );
if ( ( mplDrawBuffer = (unsigned char *)calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
{ mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
-#if 0
-// if ( vo_wm_type == vo_wm_Unknown )
- wsVisibleWindow( &appMPlayer.mainWindow,wsHideWindow );
- wsResizeWindow( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
- wsMoveWindow( &appMPlayer.mainWindow,True,appMPlayer.main.x,appMPlayer.main.y );
- wsResizeImage( &appMPlayer.mainWindow,appMPlayer.main.width,appMPlayer.main.height );
- wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
- wsWindowDecoration( &appMPlayer.mainWindow,appMPlayer.mainDecoration );
- mainVisible=1; mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow );
- wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
-#else
wsDestroyWindow( &appMPlayer.mainWindow );
wsCreateWindow( &appMPlayer.mainWindow,
@@ -269,11 +267,16 @@
if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
mainVisible=1;
-#endif
+// ---
+
btnModify( evSetVolume,guiIntfStruct.Volume );
btnModify( evSetBalance,guiIntfStruct.Balance );
btnModify( evSetMoviePosition,guiIntfStruct.Position );
btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen );
+
+ wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen );
+ wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen );
+
}
void mplSetFileName( char * dir,char * name,int type )
Index: sw.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/sw.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- sw.c 9 Jan 2003 20:47:10 -0000 1.39
+++ sw.c 17 Jan 2003 22:39:39 -0000 1.40
@@ -42,6 +42,8 @@
static int mplSubMoved = 0;
static int msButton = 0;
+ mplPBShow( X,Y );
+
switch( Button )
{
case wsPRMouseButton:
@@ -73,6 +75,7 @@
case wsPMMouseButton:
mplMenuMouseHandle( X,Y,RX,RY );
break;
+ default: mplPBShow( X,Y ); break;
}
break;
case wsRLMouseButton:
Index: widgets.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/widgets.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- widgets.c 9 Jan 2003 20:47:10 -0000 1.42
+++ widgets.c 17 Jan 2003 22:39:39 -0000 1.43
@@ -211,12 +211,21 @@
case evShowPopUpMenu:
gtkPopupMenu=evNone;
gtkPopupMenuParam=0;
- if ( PopUpMenu ) { gtk_widget_hide_on_delete( PopUpMenu ); }
+ if ( PopUpMenu )
+ {
+ gtk_widget_hide( PopUpMenu );
+ gtk_widget_destroy( PopUpMenu );
+ }
PopUpMenu=create_PopUpMenu();
gtk_menu_popup( GTK_MENU( PopUpMenu ),NULL,NULL,NULL,NULL,0,0 );
break;
case evHidePopUpMenu:
- if ( PopUpMenu ) { gtk_widget_hide_on_delete( PopUpMenu ); PopUpMenu=NULL; }
+ if ( PopUpMenu )
+ {
+ gtk_widget_hide( PopUpMenu );
+ gtk_widget_destroy( PopUpMenu );
+ PopUpMenu=NULL;
+ }
break;
case evPlayNetwork:
ShowURLDialogBox();
- Previous message: [Mplayer-cvslog] CVS: main/Gui Makefile,1.21,1.22 app.c,1.19,1.20 app.h,1.16,1.17 cfg.c,1.30,1.31 cfg.h,1.12,1.13 interface.c,1.72,1.73
- Next message: [Mplayer-cvslog] CVS: main/Gui/mplayer/gtk opts.c,1.46,1.47
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the MPlayer-cvslog
mailing list