From 4ae9c5c307d951bf995434cfd6948c7a716516e7 Mon Sep 17 00:00:00 2001 From: pontscho Date: Fri, 17 Jan 2003 22:39:43 +0000 Subject: - add playbar - add vpotmeter - fix gtk menu's pixel bug - fix some critical (10l) bug git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8974 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/Makefile | 2 +- Gui/app.c | 29 ++++-- Gui/app.h | 14 +-- Gui/cfg.c | 4 +- Gui/cfg.h | 1 + Gui/interface.c | 9 +- Gui/mplayer/common.c | 238 +++++++++++++++++++++++++++++++++++++++++++++++++ Gui/mplayer/common.h | 19 ++++ Gui/mplayer/gtk/opts.c | 56 +++++++----- Gui/mplayer/mplayer.h | 3 + Gui/mplayer/mw.c | 203 ++++------------------------------------- Gui/mplayer/pb.c | 228 ++++++++++++++++++++++++++++++++++++++++++++++ Gui/mplayer/play.c | 35 ++++---- Gui/mplayer/sw.c | 3 + Gui/mplayer/widgets.c | 13 ++- Gui/skin/font.c | 4 +- Gui/skin/skin.c | 216 +++++++++++++++++++++++++++++--------------- Gui/skin/skin.h | 4 +- Gui/wm/ws.c | 7 +- 19 files changed, 764 insertions(+), 324 deletions(-) create mode 100644 Gui/mplayer/common.c create mode 100644 Gui/mplayer/common.h create mode 100644 Gui/mplayer/pb.c (limited to 'Gui') diff --git a/Gui/Makefile b/Gui/Makefile index f9fa4b5483..8c952c94aa 100644 --- a/Gui/Makefile +++ b/Gui/Makefile @@ -16,7 +16,7 @@ CFLAGS = $(OPTIMIZE) $(INCDIR) $(DEBUG) SRCS = wm/ws.c wm/wsxdnd.c app.c interface.c cfg.c bitmap.c \ skin/skin.c skin/font.c skin/cut.c \ - mplayer/widgets.c mplayer/play.c mplayer/mw.c mplayer/sw.c mplayer/menu.c \ + mplayer/widgets.c mplayer/play.c mplayer/mw.c mplayer/sw.c mplayer/menu.c mplayer/pb.c mplayer/common.c \ mplayer/gtk/menu.c mplayer/gtk/mb.c mplayer/gtk/about.c mplayer/gtk/pl.c mplayer/gtk/sb.c mplayer/gtk/fs.c mplayer/gtk/opts.c mplayer/gtk/url.c mplayer/gtk/eq.c mplayer/gtk/common.c OBJS = $(SRCS:.c=.o) diff --git a/Gui/app.c b/Gui/app.c index d6e7303dca..c0a3f6e5a9 100644 --- a/Gui/app.c +++ b/Gui/app.c @@ -109,7 +109,6 @@ void appCopy( listItems * dest,listItems * source ) memcpy( &dest->main,&source->main,sizeof( wItem ) ); memcpy( &dest->sub,&source->sub,sizeof( wItem ) ); - memcpy( &dest->eq,&source->eq,sizeof( wItem ) ); memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) ); memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) ); } @@ -135,9 +134,9 @@ void appInitStruct( listItems * item ) item->sub.x=-1; item->sub.y=-1; appClearItem( &item->menuBase ); appClearItem( &item->menuSelected ); - item->subR=0; - item->subG=0; - item->subB=0; + item->sub.R=item->sub.G=item->sub.B=0; + item->bar.R=item->bar.G=item->bar.B=0; + item->main.R=item->main.G=item->main.B=0; item->barIsPresent=0; item->menuIsPresent=0; } @@ -161,7 +160,7 @@ int appFindMessage( unsigned char * str ) void btnModify( int event,float state ) { int j; - for ( j=0;j 100.f ) state=100.0f; @@ -178,6 +178,25 @@ void btnModify( int event,float state ) break; } } + + for ( j=0;j < appMPlayer.NumberOfBarItems + 1;j++ ) + if ( appMPlayer.barItems[j].msg == event ) + { + switch ( appMPlayer.barItems[j].type ) + { + case itButton: + appMPlayer.barItems[j].pressed=(int)state; + appMPlayer.barItems[j].tmp=(int)state; + break; + case itPotmeter: + case itVPotmeter: + case itHPotmeter: + if ( state < 0.0f ) state=0.0f; + if ( state > 100.f ) state=100.0f; + appMPlayer.barItems[j].value=state; + break; + } + } } float btnGetValue( int event ) diff --git a/Gui/app.h b/Gui/app.h index 5441630c11..d0afd320e4 100644 --- a/Gui/app.h +++ b/Gui/app.h @@ -134,6 +134,8 @@ typedef struct char * label; // --- int event; +// --- + int R,G,B; } wItem; typedef struct @@ -144,16 +146,11 @@ typedef struct wItem sub; wsTWindow subWindow; - int subR,subG,subB; wItem bar; wsTWindow barWindow; - int barR,barG,barB; int barIsPresent; - - wItem eq; - wsTWindow eqWindow; - + wItem menuBase; wItem menuSelected; wsTWindow menuWindow; @@ -164,7 +161,10 @@ typedef struct wItem Items[256]; // --- int NumberOfMenuItems; - wItem MenuItems[32]; + wItem MenuItems[64]; +// --- + int NumberOfBarItems; + wItem barItems[32]; } listItems; extern listItems appMPlayer; diff --git a/Gui/cfg.c b/Gui/cfg.c index 96b4c9d1ce..8eca1724ce 100644 --- a/Gui/cfg.c +++ b/Gui/cfg.c @@ -57,6 +57,7 @@ int gtkSubDumpMPSub = 0; int gtkSubDumpSrt = 0; int gtkLoadFullscreen = 0; +int gtkEnablePlayBar = 0; // --- @@ -128,7 +129,8 @@ static config_t gui_opts[] = { "cache",>kCacheOn,CONF_TYPE_FLAG,0,0,1,NULL }, { "cache_size",>kCacheSize,CONF_TYPE_INT,CONF_RANGE,-1,65535,NULL }, - + + { "playbar",>kEnablePlayBar,CONF_TYPE_FLAG,0,0,1,NULL }, { "load_fullscreen",>kLoadFullscreen,CONF_TYPE_FLAG,0,0,1,NULL }, { "stopxscreensaver",&stop_xscreensaver,CONF_TYPE_FLAG,0,0,1,NULL }, diff --git a/Gui/cfg.h b/Gui/cfg.h index 76e5e3bb38..1035595886 100644 --- a/Gui/cfg.h +++ b/Gui/cfg.h @@ -39,6 +39,7 @@ extern char * gtkEquChannel4; extern char * gtkEquChannel5; extern char * gtkEquChannel6; extern int gtkLoadFullscreen; +extern int gtkEnablePlayBar; extern int cfg_read( void ); extern int cfg_write( void ); diff --git a/Gui/interface.c b/Gui/interface.c index c2f53978f6..8bc3b901f1 100644 --- a/Gui/interface.c +++ b/Gui/interface.c @@ -203,6 +203,9 @@ void guiInit( void ) wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height ); wsXDNDMakeAwareness(&appMPlayer.subWindow); + mplMenuInit(); + mplPBInit(); + vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC ); // i=wsHideFrame|wsMaxSize|wsHideWindow; @@ -215,8 +218,6 @@ void guiInit( void ) wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image ); wsXDNDMakeAwareness(&appMPlayer.mainWindow); - mplMenuInit(); - #ifdef DEBUG mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] Depth on screen: %d\n",wsDepthOnScreen ); mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID ); @@ -233,7 +234,7 @@ void guiInit( void ) appMPlayer.subWindow.KeyHandler=mplMainKeyHandle; appMPlayer.subWindow.DandDHandler=mplDandDHandler; - wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.subR,appMPlayer.subG,appMPlayer.subB ); + wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B ); wsClearWindow( appMPlayer.subWindow ); if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize ); @@ -433,7 +434,7 @@ int guiGetEvent( int type,char * arg ) switch ( type ) { case guiXEvent: - guiIntfStruct.event_struct=(void *)arg; + guiIntfStruct.event_struct=(void *)arg; wsEvents( wsDisplay,(XEvent *)arg,NULL ); gtkEventHandling(); break; diff --git a/Gui/mplayer/common.c b/Gui/mplayer/common.c new file mode 100644 index 0000000000..7509666513 --- /dev/null +++ b/Gui/mplayer/common.c @@ -0,0 +1,238 @@ + +// main window + +#include +#include +#include +#include +#include + +#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 ); +} diff --git a/Gui/mplayer/common.h b/Gui/mplayer/common.h new file mode 100644 index 0000000000..7183930124 --- /dev/null +++ b/Gui/mplayer/common.h @@ -0,0 +1,19 @@ +#ifndef __COMMON_H +#define __COMMON_H + +#include +#include +#include +#include +#include + +#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 diff --git a/Gui/mplayer/gtk/opts.c b/Gui/mplayer/gtk/opts.c index 4168c5ec49..8c2b0c1287 100644 --- a/Gui/mplayer/gtk/opts.c +++ b/Gui/mplayer/gtk/opts.c @@ -68,6 +68,7 @@ static GtkWidget * CBPostprocess; static GtkWidget * CBCache; static GtkWidget * CBLoadFullscreen; static GtkWidget * CBStopXScreenSaver; +static GtkWidget * CBPlayBar; static GtkWidget * SBCache; static GtkAdjustment * SBCacheadj; @@ -264,6 +265,8 @@ void ShowPreferences( void ) #if 0 if ( guiIntfStruct.Subtitlename ) gtk_entry_set_text( GTK_ENTRY( ESubtitleName ),guiIntfStruct.Subtitlename ); #endif + +// --- 4. page // font ... if ( font_name ) gtk_entry_set_text( GTK_ENTRY( prEFontName ),font_name ); #ifndef HAVE_FREETYPE @@ -290,13 +293,9 @@ void ShowPreferences( void ) } #endif -// -- 4. page +// -- 5. page gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNonInterlaved ),force_ni ); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBIndex ),index_mode ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBPostprocess ),gtkVopPP ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ),gtkLoadFullscreen ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBStopXScreenSaver ),stop_xscreensaver ); - gtk_adjustment_set_value( HSPPQualityadj,auto_quality ); { int i; GList * Items = NULL; @@ -329,6 +328,13 @@ void ShowPreferences( void ) if ( name ) gtk_entry_set_text( GTK_ENTRY( EAFM ),name ); } +// --- 6. page + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBPostprocess ),gtkVopPP ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ),gtkLoadFullscreen ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBPlayBar ),gtkEnablePlayBar ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBStopXScreenSaver ),stop_xscreensaver ); + gtk_adjustment_set_value( HSPPQualityadj,auto_quality ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBCache ),0 ); gtk_adjustment_set_value( SBCacheadj,(float)gtkCacheSize ); if ( !gtkCacheOn ) gtk_widget_set_sensitive( SBCache,FALSE ); @@ -484,7 +490,7 @@ void prButton( GtkButton * button,gpointer user_data ) if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDTandP ) ) ) osd_level=2; if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDTPTT ) ) ) osd_level=3; - // font ... + // --- 4. page guiSetFilename( font_name,gtk_entry_get_text( GTK_ENTRY( prEFontName ) ) ); #ifndef HAVE_FREETYPE gtkSet( gtkSetFontFactor,HSFontFactoradj->value,NULL ); @@ -499,19 +505,9 @@ void prButton( GtkButton * button,gpointer user_data ) if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleDiagonal ) ) ) gtkSet( gtkSetFontAutoScale,3,NULL ); #endif - // -- 4. page + // -- 5. page force_ni=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNonInterlaved ) ); index_mode=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBIndex ) ); - gtkVopPP=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBPostprocess ) ); - gtkLoadFullscreen=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ) ); - stop_xscreensaver=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBStopXScreenSaver ) ); - gtkSet( gtkSetAutoq,HSPPQualityadj->value,NULL ); - - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBCache ) ) ) { gtkCacheSize=(int)SBCacheadj->value; gtkCacheOn=1; } - else gtkCacheOn=0; - - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBAutoSync ) ) ) { gtkAutoSync=(int)SBAutoSyncadj->value; gtkAutoSyncOn=1; } - else gtkAutoSyncOn=0; { int i; @@ -529,6 +525,19 @@ void prButton( GtkButton * button,gpointer user_data ) { gaddlist( &audio_fm_list,(char *)mpcodecs_ad_drivers[i]->info->short_name ); break; } } + // --- 6. page + gtkVopPP=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBPostprocess ) ); + gtkLoadFullscreen=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ) ); + stop_xscreensaver=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBStopXScreenSaver ) ); + gtkEnablePlayBar=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBPlayBar ) ); + gtkSet( gtkSetAutoq,HSPPQualityadj->value,NULL ); + + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBCache ) ) ) { gtkCacheSize=(int)SBCacheadj->value; gtkCacheOn=1; } + else gtkCacheOn=0; + + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBAutoSync ) ) ) { gtkAutoSync=(int)SBAutoSyncadj->value; gtkAutoSyncOn=1; } + else gtkAutoSyncOn=0; + guiSetFilename( dvd_device,gtk_entry_get_text( GTK_ENTRY( prEDVDDevice ) ) ); guiSetFilename( cdrom_device,gtk_entry_get_text( GTK_ENTRY( prECDRomDevice ) ) ); @@ -725,7 +734,7 @@ GtkWidget * create_Preferences( void ) frame=AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,hbox1,1 ); frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 ); -// --- 1. panel +// --- 1. page vbox2=AddVBox( frame,0 ); @@ -777,7 +786,7 @@ GtkWidget * create_Preferences( void ) label=AddLabel( MSGTR_PREFERENCES_Audio,NULL ); gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),0 ),label ); -// --- 2. panel +// --- 2. page hbox2=AddVBox( notebook1,0 ); @@ -827,7 +836,7 @@ GtkWidget * create_Preferences( void ) label=AddLabel( MSGTR_PREFERENCES_Video,NULL ); gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),1 ),label ); -// --- 3. panel +// --- 3. page vbox6=AddVBox( notebook1,0 ); @@ -899,7 +908,7 @@ GtkWidget * create_Preferences( void ) gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),2 ),label ); vbox601=AddVBox( notebook1,0 ); -// --- 4. panel +// --- 4. page vbox603=AddVBox( AddFrame( NULL,GTK_SHADOW_NONE, @@ -984,7 +993,7 @@ GtkWidget * create_Preferences( void ) label=AddLabel( MSGTR_PREFERENCES_FRAME_Font,NULL ); gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),3 ),label ); -// --- 5. panel +// --- 5. page vbox601=AddVBox( notebook1,0 ); @@ -1028,7 +1037,7 @@ GtkWidget * create_Preferences( void ) vbox601=AddVBox( notebook1,0 ); -// --- 6. panel +// --- 6. page vbox602=AddVBox( AddFrame( NULL,GTK_SHADOW_NONE, @@ -1065,6 +1074,7 @@ GtkWidget * create_Preferences( void ) CBLoadFullscreen=AddCheckButton( MSGTR_PREFERENCES_LoadFullscreen,vbox602 ); CBStopXScreenSaver=AddCheckButton( MSGTR_PREFERENCES_XSCREENSAVER,vbox602 ); + CBPlayBar=AddCheckButton( MSGTR_PREFERENCES_PlayBar,vbox602 ); AddHSeparator( vbox602 ); diff --git a/Gui/mplayer/mplayer.h b/Gui/mplayer/mplayer.h index 99183ad7e1..d7bd01b1ac 100644 --- a/Gui/mplayer/mplayer.h +++ b/Gui/mplayer/mplayer.h @@ -29,4 +29,7 @@ extern void mplHideMenu( int mx,int my,int w ); 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 diff --git a/Gui/mplayer/mw.c b/Gui/mplayer/mw.c index b653ff7721..3dd9948e08 100644 --- a/Gui/mplayer/mw.c +++ b/Gui/mplayer/mw.c @@ -43,146 +43,7 @@ int boxMoved = 0; 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 @@ void mplMainDraw( void ) !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 @@ set_volume: case evRedraw: mplMainRender=1; wsPostRedisplay( &appMPlayer.mainWindow ); + wsPostRedisplay( &appMPlayer.barWindow ); break; // --- system events #ifdef MP_DEBUG @@ -542,10 +376,10 @@ void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) 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 @@ void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) { 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 @@ void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY ) break; } mplEventHandling( item->msg,value ); -// mplMainRender=1; itemtype=0; break; @@ -612,6 +445,9 @@ rollerhandled: 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 @@ potihandled: } break; } -// if ( Button != wsMoveMouse ) wsPostRedisplay( &appMPlayer.mainWindow ); } int keyPressed = 0; @@ -659,15 +494,13 @@ void mplMainKeyHandle( int KeyCode,int Type,int Key ) 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; } } diff --git a/Gui/mplayer/pb.c b/Gui/mplayer/pb.c new file mode 100644 index 0000000000..8c326ba208 --- /dev/null +++ b/Gui/mplayer/pb.c @@ -0,0 +1,228 @@ + +// main window + +#include +#include +#include +#include +#include + +#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; +} diff --git a/Gui/mplayer/play.c b/Gui/mplayer/play.c index 5058fb19fe..6c11d9204a 100644 --- a/Gui/mplayer/play.c +++ b/Gui/mplayer/play.c @@ -84,7 +84,7 @@ void mplFullScreen( void ) 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 @@ void mplEnd( void ) } 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 @@ void ChangeSkin( char * name ) { int ret; int prev = appMPlayer.menuIsPresent; + int bprev = appMPlayer.barIsPresent; mainVisible=0; - + appInitStruct( &tmpList ); skinAppMPlayer=&tmpList; fntFreeFont(); @@ -210,6 +211,8 @@ void ChangeSkin( char * name ) return; } +// --- reload menu window + if ( prev && appMPlayer.menuIsPresent ) { if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer ); @@ -221,6 +224,7 @@ void ChangeSkin( char * name ) 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 @@ void ChangeSkin( char * name ) 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 @@ void ChangeSkin( char * name ) 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 ) diff --git a/Gui/mplayer/sw.c b/Gui/mplayer/sw.c index 21191b4fb2..1eca6d6bfa 100644 --- a/Gui/mplayer/sw.c +++ b/Gui/mplayer/sw.c @@ -42,6 +42,8 @@ void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY ) static int mplSubMoved = 0; static int msButton = 0; + mplPBShow( X,Y ); + switch( Button ) { case wsPRMouseButton: @@ -73,6 +75,7 @@ void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY ) case wsPMMouseButton: mplMenuMouseHandle( X,Y,RX,RY ); break; + default: mplPBShow( X,Y ); break; } break; case wsRLMouseButton: diff --git a/Gui/mplayer/widgets.c b/Gui/mplayer/widgets.c index 206c3f25f0..5bb92f8e41 100644 --- a/Gui/mplayer/widgets.c +++ b/Gui/mplayer/widgets.c @@ -211,12 +211,21 @@ void gtkShow( int type,char * param ) 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(); diff --git a/Gui/skin/font.c b/Gui/skin/font.c index ca369a10d1..fdeaf234fc 100644 --- a/Gui/skin/font.c +++ b/Gui/skin/font.c @@ -73,10 +73,10 @@ int fntRead( char * path,char * fname ) for ( c=0;c < (int)strlen( tmp );c++ ) if ( tmp[c] == ';' ) { tmp[c]=0; break; } if ( !tmp[0] ) continue; - ptmp=strdelspacesbeforecommand( tmp ); + ptmp=trimleft( tmp ); if ( !tmp[0] ) continue; ptmp=strswap( ptmp,'\t',' ' ); - ptmp=strdelspaces( ptmp ); + ptmp=trim( ptmp ); cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 ); if ( command[0] == '"' ) { diff --git a/Gui/skin/skin.c b/Gui/skin/skin.c index 30c9cd2f6b..6ccce8157a 100644 --- a/Gui/skin/skin.c +++ b/Gui/skin/skin.c @@ -12,14 +12,22 @@ #include "../../help_mp.h" #include "../mplayer/widgets.h" +//#define MSGL_DBG2 MSGL_STATUS + listItems * skinAppMPlayer = &appMPlayer; -int linenumber; +// --- + +static int linenumber; + +static unsigned char path[512],fn[512]; -unsigned char path[512],fn[512]; +static listItems * defList = NULL; +static unsigned char window_name[32] = ""; -listItems * defList = NULL; -unsigned char winList[32] = ""; +static wItem * currSection = NULL; +static int * currSubItem = NULL; +static wItem * currSubItems = NULL; #include @@ -47,13 +55,22 @@ void ERRORMESSAGE( const char * format, ... ) #define CHECKWINLIST( str ) \ { \ - if ( !strlen( winList ) ) \ + if ( !window_name[0] ) \ { \ mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING2,linenumber,str ); \ return 1; \ } \ } +#define CHECK( name ) \ +{ \ + if ( !strcmp( window_name,name ) ) \ + { \ + mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING3,linenumber,name ); \ + return 1; \ + } \ +} + char * strlower( char * in ) { int i; @@ -89,7 +106,7 @@ int cmd_section( char * in ) int cmd_end( char * in ) { - if ( strlen( winList ) ) winList[0]=0; + if ( strlen( window_name ) ) { window_name[0]=0; currSection=NULL; currSubItem=NULL; currSubItems=NULL; } else defList=NULL; mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] end section\n" ); return 0; @@ -99,9 +116,13 @@ int cmd_window( char * in ) { CHECKDEFLIST( "window" ); - strlower( in ); - strcpy( winList,in ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window: %s\n",winList ); + strcpy( window_name,strlower( in ) ); + if ( !strncmp( in,"main",4 ) ) { currSection=&skinAppMPlayer->main; currSubItem=&skinAppMPlayer->NumberOfItems; currSubItems=skinAppMPlayer->Items; } + else if ( !strncmp( in,"sub",3 ) ) currSection=&skinAppMPlayer->sub; + else if ( !strncmp( in,"playbar",7 ) ) { currSection=&skinAppMPlayer->bar; currSubItem=&skinAppMPlayer->NumberOfBarItems; currSubItems=skinAppMPlayer->barItems; } + else if ( !strncmp( in,"menu",4 ) ) { currSection=&skinAppMPlayer->menuBase; currSubItem=&skinAppMPlayer->NumberOfMenuItems; currSubItems=skinAppMPlayer->MenuItems; } + else ERRORMESSAGE( "Unknown window type found ..." ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window: %s\n",window_name ); return 0; } @@ -121,7 +142,7 @@ int cmd_base( char * in ) sx=cutItemToInt( in,',',3 ); sy=cutItemToInt( in,',',4 ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] base: %s x: %d y: %d ( %dx%d )\n",fname,x,y,sx,sy ); - if ( !strcmp( winList,"main" ) ) + if ( !strcmp( window_name,"main" ) ) { defList->main.x=x; defList->main.y=y; @@ -130,25 +151,15 @@ int cmd_base( char * in ) if ( skinBPRead( tmp,&defList->main.Bitmap ) ) return 1; defList->main.width=defList->main.Bitmap.Width; defList->main.height=defList->main.Bitmap.Height; - #ifdef HAVE_XSHAPE +#ifdef HAVE_XSHAPE Convert32to1( &defList->main.Bitmap,&defList->main.Mask,0x00ff00ff ); -#if 0 - { - if ( defList->main.Mask.Image != NULL ) - { - txSample d; - Convert1to32( &defList->main.Mask,&d ); - tgaWriteTexture( "debug.tga",&d ); - } - } -#endif mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->main.Mask.Width,defList->main.Mask.Height ); - #else +#else defList->main.Mask.Image=NULL; - #endif +#endif mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->main.width,defList->main.height ); } - if ( !strcmp( winList,"sub" ) ) + if ( !strcmp( window_name,"sub" ) ) { defList->sub.type=itBase; strcpy( tmp,path ); strcat( tmp,fname ); @@ -164,31 +175,40 @@ int cmd_base( char * in ) } mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] %d,%d %dx%d\n",defList->sub.x,defList->sub.y,defList->sub.width,defList->sub.height ); } - if ( !strcmp( winList,"menu" ) ) + if ( !strcmp( window_name,"menu" ) ) { + defList->menuIsPresent=1; defList->menuBase.type=itBase; strcpy( tmp,path ); strcat( tmp,fname ); if ( skinBPRead( tmp,&defList->menuBase.Bitmap ) ) return 1; defList->menuBase.width=defList->menuBase.Bitmap.Width; defList->menuBase.height=defList->menuBase.Bitmap.Height; - #ifdef HAVE_XSHAPE +#ifdef HAVE_XSHAPE Convert32to1( &defList->menuBase.Bitmap,&defList->menuBase.Mask,0x00ff00ff ); -#if 0 - { - if ( defList->menuBase.Mask.Image != NULL ) - { - txSample d; - Convert1to32( &defList->menuBase.Mask,&d ); - tgaWriteTexture( "debug.tga",&d ); - } - } -#endif mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->menuBase.Mask.Width,defList->menuBase.Mask.Height ); - #else +#else defList->menuBase.Mask.Image=NULL; - #endif +#endif mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuBase.width,defList->menuBase.height ); } + if ( !strcmp( window_name,"playbar" ) ) + { + defList->barIsPresent=1; + defList->bar.x=x; + defList->bar.y=y; + defList->bar.type=itBase; + strcpy( tmp,path ); strcat( tmp,fname ); + if ( skinBPRead( tmp,&defList->bar.Bitmap ) ) return 1; + defList->bar.width=defList->bar.Bitmap.Width; + defList->bar.height=defList->bar.Bitmap.Height; +#ifdef HAVE_XSHAPE + Convert32to1( &defList->bar.Bitmap,&defList->bar.Mask,0x00ff00ff ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->bar.Mask.Width,defList->bar.Mask.Height ); +#else + defList->bar.Mask.Image=NULL; +#endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->bar.width,defList->bar.height ); + } return 0; } @@ -197,13 +217,14 @@ int cmd_background( char * in ) CHECKDEFLIST( "background" ); CHECKWINLIST( "background" ); - if ( !strcmp( winList,"sub" ) ) - { - defList->subR=cutItemToInt( in,',',0 ); - defList->subG=cutItemToInt( in,',',1 ); - defList->subB=cutItemToInt( in,',',2 ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] subwindow background color is #%x%x%x.\n",defList->subR,defList->subG,defList->subB ); - } + CHECK( "menu" ); + CHECK( "main" ); + + currSection->R=cutItemToInt( in,',',0 ); + currSection->G=cutItemToInt( in,',',1 ); + currSection->B=cutItemToInt( in,',',2 ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] background color is #%x%x%x.\n",currSection->R,currSection->G,currSection->B ); + return 0; } @@ -217,6 +238,9 @@ int cmd_button( char * in ) CHECKDEFLIST( "button" ); CHECKWINLIST( "button" ); + CHECK( "sub" ); + CHECK( "menu" ); + cutItem( in,fname,',',0 ); x=cutItemToInt( in,',',1 ); y=cutItemToInt( in,',',2 ); @@ -224,29 +248,30 @@ int cmd_button( char * in ) sy=cutItemToInt( in,',',4 ); cutItem( in,msg,',',5 ); - defList->NumberOfItems++; - defList->Items[ defList->NumberOfItems ].type=itButton; - defList->Items[ defList->NumberOfItems ].x=x; - defList->Items[ defList->NumberOfItems ].y=y; - defList->Items[ defList->NumberOfItems ].width=sx; - defList->Items[ defList->NumberOfItems ].height=sy; + (*currSubItem)++; + currSubItems[ *currSubItem ].type=itButton; + currSubItems[ *currSubItem ].x=x; + currSubItems[ *currSubItem ].y=y; + currSubItems[ *currSubItem ].width=sx; + currSubItems[ *currSubItem ].height=sy; mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] button: fname: %s\n",fname ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy ); - if ( ( defList->Items[ defList->NumberOfItems ].msg=appFindMessage( msg ) ) == -1 ) + if ( ( currSubItems[ *currSubItem ].msg=appFindMessage( msg ) ) == -1 ) { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 0; } - defList->Items[ defList->NumberOfItems ].pressed=btnReleased; - if ( defList->Items[ defList->NumberOfItems ].msg == evPauseSwitchToPlay ) defList->Items[ defList->NumberOfItems ].pressed=btnDisabled; - defList->Items[ defList->NumberOfItems ].tmp=1; + currSubItems[ *currSubItem ].pressed=btnReleased; + if ( currSubItems[ *currSubItem ].msg == evPauseSwitchToPlay ) currSubItems[ *currSubItem ].pressed=btnDisabled; + currSubItems[ *currSubItem ].tmp=1; - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",currSubItems[ *currSubItem ].msg ); - defList->Items[ defList->NumberOfItems ].Bitmap.Image=NULL; + currSubItems[ *currSubItem ].Bitmap.Image=NULL; if ( strcmp( fname,"NULL" ) ) { strcpy( tmp,path ); strcat( tmp,fname ); - if ( skinBPRead( tmp,&defList->Items[ defList->NumberOfItems ].Bitmap ) ) return 1; + if ( skinBPRead( tmp,&currSubItems[ *currSubItem ].Bitmap ) ) return 1; } + return 0; } @@ -258,6 +283,10 @@ int cmd_selected( char * in ) CHECKDEFLIST( "selected" ); CHECKWINLIST( "selected" ); + CHECK( "main" ); + CHECK( "sub" ); + CHECK( "playbar" ); + cutItem( in,fname,',',0 ); defList->menuSelected.type=itBase; strcpy( tmp,path ); strcat( tmp,fname ); @@ -277,6 +306,10 @@ int cmd_menu( char * in ) CHECKDEFLIST( "menu" ); CHECKWINLIST( "menu" ); + CHECK( "main" ); + CHECK( "sub" ); + CHECK( "playbar" ); + x=cutItemToInt( in,',',0 ); y=cutItemToInt( in,',',1 ); sx=cutItemToInt( in,',',2 ); @@ -312,6 +345,9 @@ int cmd_hpotmeter( char * in ) CHECKDEFLIST( "hpotmeter" ); CHECKWINLIST( "hpotmeter" ); + CHECK( "sub" ); + CHECK( "menu" ); + cutItem( in,pfname,',',0 ); psx=cutItemToInt( in,',',1 ); psy=cutItemToInt( in,',',2 ); @@ -324,15 +360,16 @@ int cmd_hpotmeter( char * in ) sy=cutItemToInt( in,',',9 ); cutItem( in,tmp,',',10 ); msg=appFindMessage( tmp ); - mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] hpotmeter: pointer filename: '%s'\n",pfname ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] h/v potmeter: pointer filename: '%s'\n",pfname ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pointer size is %dx%d\n",psx,psy ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phasebitmaps filename: '%s'\n",phfname ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg ); - defList->NumberOfItems++; - item=&defList->Items[ defList->NumberOfItems ]; + (*currSubItem)++; + item=&currSubItems[ *currSubItem ]; + item->type=itHPotmeter; item->x=x; item->y=y; item->width=sx; item->height=sy; item->phases=ph; @@ -354,10 +391,19 @@ int cmd_hpotmeter( char * in ) strcpy( tmp,path ); strcat( tmp,pfname ); if ( skinBPRead( tmp,&item->Mask ) ) return 1; } - return 0; } +int cmd_vpotmeter( char * in ) +{ + int r = cmd_hpotmeter( in ); + wItem * item; + + item=&currSubItems[ *currSubItem ]; + item->type=itVPotmeter; + return r; +} + int cmd_potmeter( char * in ) { // potmeter=phasebitmaps,phases,default value,x,y,sx,sy,msg int x,y,ph,sx,sy,msg,d; @@ -368,6 +414,9 @@ int cmd_potmeter( char * in ) CHECKDEFLIST( "potmeter" ); CHECKWINLIST( "potmeter" ); + CHECK( "sub" ); + CHECK( "menu" ); + cutItem( in,phfname,',',0 ); ph=cutItemToInt( in,',',1 ); d=cutItemToInt( in,',',2 ); @@ -383,8 +432,9 @@ int cmd_potmeter( char * in ) mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg ); - defList->NumberOfItems++; - item=&defList->Items[ defList->NumberOfItems ]; + (*currSubItem)++; + item=&currSubItems[ *currSubItem ]; + item->type=itPotmeter; item->x=x; item->y=y; item->width=sx; item->height=sy; @@ -410,14 +460,18 @@ int cmd_font( char * in ) CHECKDEFLIST( "font" ); CHECKWINLIST( "font" ); + CHECK( "sub" ); + CHECK( "menu" ); + cutItem( in,name,',',0 ); cutItem( in,id,',',1 ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] font\n" ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] name: %s\n",name ); - defList->NumberOfItems++; - item=&defList->Items[ defList->NumberOfItems ]; + (*currSubItem)++; + item=&currSubItems[ *currSubItem ]; + item->type=itFont; item->fontid=fntRead( path,name ); switch ( item->fontid ) @@ -440,6 +494,9 @@ int cmd_slabel( char * in ) CHECKDEFLIST( "slabel" ); CHECKWINLIST( "slabel" ); + CHECK( "sub" ); + CHECK( "menu" ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] slabel\n" ); x=cutItemToInt( in,',',0 ); @@ -452,8 +509,9 @@ int cmd_slabel( char * in ) mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp ); - defList->NumberOfItems++; - item=&defList->Items[ defList->NumberOfItems ]; + (*currSubItem)++; + item=&currSubItems[ *currSubItem ]; + item->type=itSLabel; item->fontid=id; item->x=x; item->y=y; @@ -474,6 +532,9 @@ int cmd_dlabel( char * in ) CHECKDEFLIST( "dlabel" ); CHECKWINLIST( "dlabel" ); + CHECK( "sub" ); + CHECK( "menu" ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] dlabel\n" ); x=cutItemToInt( in,',',0 ); @@ -488,8 +549,9 @@ int cmd_dlabel( char * in ) mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id ); mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp ); - defList->NumberOfItems++; - item=&defList->Items[ defList->NumberOfItems ]; + (*currSubItem)++; + item=&currSubItems[ *currSubItem ]; + item->type=itDLabel; item->fontid=id; item->align=a; item->x=x; item->y=y; @@ -507,7 +569,12 @@ int cmd_decoration( char * in ) CHECKDEFLIST( "decoration" ); CHECKWINLIST( "decoration" ); + CHECK( "sub" ); + CHECK( "menu" ); + CHECK( "playbar" ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",in ); + strlower( in ); cutItem( in,tmp,',',0 ); if ( strcmp( tmp,"enable" )&&strcmp( tmp,"disable" ) ) { ERRORMESSAGE( MSGTR_SKIN_UnknownParameter,tmp ); return 1; } if ( strcmp( tmp,"enable" ) ) defList->mainDecoration=0; @@ -532,6 +599,7 @@ _item skinItem[] = { "button", cmd_button }, { "selected", cmd_selected }, { "background", cmd_background }, + { "vpotmeter", cmd_vpotmeter }, { "hpotmeter", cmd_hpotmeter }, { "potmeter", cmd_potmeter }, { "font", cmd_font }, @@ -543,7 +611,7 @@ _item skinItem[] = #define ITEMS (int)( sizeof( skinItem )/sizeof( _item ) ) -char * strdelspacesbeforecommand( char * in ) +char * trimleft( char * in ) { int c = 0; char * out; @@ -567,7 +635,7 @@ char * strswap( char * in,char what,char whereof ) return in; } -char * strdelspaces( char * in ) +char * trim( char * in ) { int c = 0,i = 0,id = 0; if ( strlen( in ) == 0 ) return NULL; @@ -626,10 +694,10 @@ int skinRead( char * dname ) break; } if ( strlen( tmp ) == 0 ) continue; - ptmp=strdelspacesbeforecommand( tmp ); + ptmp=trimleft( tmp ); if ( strlen( ptmp ) == 0 ) continue; ptmp=strswap( ptmp,'\t',' ' ); - ptmp=strdelspaces( ptmp ); + ptmp=trim( ptmp ); cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 ); strlower( command ); diff --git a/Gui/skin/skin.h b/Gui/skin/skin.h index 7a99affd7d..d71e90f610 100644 --- a/Gui/skin/skin.h +++ b/Gui/skin/skin.h @@ -13,8 +13,8 @@ extern int skinBPRead( char * fname, txSample * bf ); // --- -extern char * strdelspacesbeforecommand( char * in ); +extern char * trimleft( char * in ); extern char * strswap( char * in,char what,char whereof ); -extern char * strdelspaces( char * in ); +extern char * trim( char * in ); #endif diff --git a/Gui/wm/ws.c b/Gui/wm/ws.c index 979720e4dc..277452410d 100644 --- a/Gui/wm/ws.c +++ b/Gui/wm/ws.c @@ -620,12 +620,15 @@ keypressed: { /* pump all motion events from the display queue: this way it works faster when moving the window */ - static XEvent e; - while(XCheckTypedWindowEvent(display,Event->xany.window,MotionNotify,&e)){ + static XEvent e; + if ( Event->xmotion.state ) + { + while(XCheckTypedWindowEvent(display,Event->xany.window,MotionNotify,&e)){ /* FIXME: need to make sure we didn't release/press the button in between...*/ /* FIXME: do we need some timeout here to make sure we don't spend too much time removing events from the queue? */ Event = &e; + } } } goto buttonreleased; -- cgit v1.2.3