summaryrefslogtreecommitdiffstats
path: root/Gui
diff options
context:
space:
mode:
authorpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-01-21 13:33:40 +0000
committerpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-01-21 13:33:40 +0000
commit337542a33163ccb9d836219f8ed202db65401efd (patch)
treea97fa3ba73741c313064c62ffc78a66e576a42ba /Gui
parentcaf9e7d7b3551a3d2f9198526d7d0ffcd8d5b25b (diff)
downloadmpv-337542a33163ccb9d836219f8ed202db65401efd.tar.bz2
mpv-337542a33163ccb9d836219f8ed202db65401efd.tar.xz
- rewrite sub_fps
- add fps support - rewrite history git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9056 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'Gui')
-rw-r--r--Gui/cfg.c27
-rw-r--r--Gui/interface.c7
-rw-r--r--Gui/interface.h4
-rw-r--r--Gui/mplayer/gtk/common.c3
-rw-r--r--Gui/mplayer/gtk/fs.c76
-rw-r--r--Gui/mplayer/gtk/fs.h4
-rw-r--r--Gui/mplayer/gtk/opts.c45
7 files changed, 88 insertions, 78 deletions
diff --git a/Gui/cfg.c b/Gui/cfg.c
index b46a56c551..17cca48eb6 100644
--- a/Gui/cfg.c
+++ b/Gui/cfg.c
@@ -230,6 +230,21 @@ int cfg_read( void )
}
free( cfg );
+// -- reade file loader history
+ cfg=get_path( "gui.history" );
+ if ( (f=fopen( cfg,"rt+" )) )
+ {
+ int i = 0;
+ while ( !feof( f ) )
+ {
+ char tmp[512];
+ if ( gfgets( tmp,512,f ) == NULL ) continue;
+ fsHistory[i++]=gstrdup( tmp );
+ }
+ fclose( f );
+ }
+ free( cfg );
+
#ifdef USE_SETLOCALE
setlocale( LC_ALL,"" );
#endif
@@ -315,6 +330,18 @@ int cfg_write( void )
}
free( cfg );
+// -- save file loader history
+ cfg=get_path( "gui.history" );
+ if ( (f=fopen( cfg,"wt+" )) )
+ {
+ int i = 0;
+// while ( fsHistory[i] != NULL )
+ for ( i=0;i < 5; i++)
+ if( fsHistory[i] ) fprintf( f,"%s\n",fsHistory[i] );
+ fclose( f );
+ }
+ free( cfg );
+
#ifdef USE_SETLOCALE
setlocale( LC_ALL,"" );
#endif
diff --git a/Gui/interface.c b/Gui/interface.c
index 8bc3b901f1..f757a5cc01 100644
--- a/Gui/interface.c
+++ b/Gui/interface.c
@@ -597,7 +597,8 @@ int guiGetEvent( int type,char * arg )
#endif
break;
case guiSetDefaults:
- if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged )
+// if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged )
+ if ( guiIntfStruct.FilenameChanged )
{
audio_id=-1;
video_id=-1;
@@ -607,10 +608,12 @@ int guiGetEvent( int type,char * arg )
autosync=0;
vcd_track=0;
dvd_title=0;
+ force_fps=0;
}
wsPostRedisplay( &appMPlayer.subWindow );
break;
case guiSetParameters:
+ guiGetEvent( guiSetDefaults,NULL );
switch ( guiIntfStruct.StreamType )
{
case STREAMTYPE_PLAYLIST:
@@ -754,6 +757,8 @@ plItem * plLastPlayed = NULL;
URLItem *URLList = NULL;
+char *fsHistory[fsPersistant_MaxPos] = { NULL,NULL,NULL,NULL,NULL };
+
#if defined( MP_DEBUG ) && 0
void list( void )
{
diff --git a/Gui/interface.h b/Gui/interface.h
index ad4c1cb2e5..4a4aea6d8a 100644
--- a/Gui/interface.h
+++ b/Gui/interface.h
@@ -169,6 +169,10 @@ extern plItem * plLastPlayed;
extern URLItem * URLList;
+#define fsPersistant_MaxPath 512
+#define fsPersistant_MaxPos 5
+extern char * fsHistory[fsPersistant_MaxPos];
+
#define gtkSetContrast 0
#define gtkSetBrightness 1
#define gtkSetHue 2
diff --git a/Gui/mplayer/gtk/common.c b/Gui/mplayer/gtk/common.c
index 721f1f1ad4..7162b75e4e 100644
--- a/Gui/mplayer/gtk/common.c
+++ b/Gui/mplayer/gtk/common.c
@@ -29,9 +29,10 @@ GtkWidget * AddFrame( char * title,int type,GtkWidget * parent,int add )
frame=gtk_frame_new( title );
gtk_widget_set_name( frame,"frame" );
gtk_widget_show( frame );
+ gtk_frame_set_shadow_type( GTK_FRAME( frame ),type );
+ if ( !parent ) return frame;
if ( add ) gtk_container_add( GTK_CONTAINER( parent ),frame );
else gtk_box_pack_start( GTK_BOX( parent ),frame,FALSE,FALSE,0 );
- gtk_frame_set_shadow_type( GTK_FRAME( frame ),type );
return frame;
}
diff --git a/Gui/mplayer/gtk/fs.c b/Gui/mplayer/gtk/fs.c
index 0ae6336ca8..db91bf739f 100644
--- a/Gui/mplayer/gtk/fs.c
+++ b/Gui/mplayer/gtk/fs.c
@@ -304,14 +304,12 @@ void ShowFileSelect( int type,int modal )
if ( fsTopList_items ) g_list_free( fsTopList_items ); fsTopList_items=NULL;
{
- char hist[fsPersistant_MaxPath + 1];
+ char * hist;
+ int i, c = 1;
- bzero( hist,fsPersistant_MaxPath + 1 );
- if ( fs_PersistantHistory( 0,hist,0 ) == 0 )
- {
- fsTopList_items=g_list_append( fsTopList_items,hist );
- chdir( hist );
- } else fsTopList_items=g_list_append( fsTopList_items,(gchar *)get_current_dir_name() );
+ for ( i=0;i < fsPersistant_MaxPos;i++ )
+ if ( fsHistory[i] ) { fsTopList_items=g_list_append( fsTopList_items,fsHistory[i] ); c=0; }
+ if ( c ) fsTopList_items=g_list_append( fsTopList_items,(gchar *)get_current_dir_name() );
}
if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) );
fsTopList_items=g_list_append( fsTopList_items,"/home" );
@@ -332,60 +330,16 @@ void HideFileSelect( void )
fsFileSelect=NULL;
}
-//----------------------------------------------------
-
-/*
- * int fs_PersistantHistory(int rw_command, char *subject)
- *
- * is used to read/write in the $HOME/.mplayer/persistant_history file
- * parameters: rw_command = (0,1) <=> (read,write)
- * subject - for i/o
- * pos - position in history file (line)
- * return: 0 = ok
- *
- */
-
- int fs_PersistantHistory(int rw_command, char *subject, int pos)
- {
- FILE *pfile;
-
- char path[fsPersistant_MaxPath+1];
- int fdata,fpos = 0;
- char *subpath = NULL;
- const char *ph_filename = fsPersistant_FilePath;
-
- if (!subject) return -1;
- if (pos < 0 || pos > fsPersistant_MaxPos) return -2;
- bzero(path,fsPersistant_MaxPath+1);
-
- subpath = getenv("HOME");
- if (!subpath) return -3;
- if (strlen(subpath)+strlen(fsPersistant_FilePath) > fsPersistant_MaxPath) return -4;
- memcpy(path, subpath, strlen(subpath));
- memcpy(path+strlen(subpath), ph_filename, strlen(ph_filename));
+int fs_PersistantHistory( char * subject )
+{
+ int i;
- if (rw_command == 0)
- {
- pfile = fopen(path,"r");
- if (!pfile) return -5;
- while ((fdata = fgetc(pfile)) != EOF)
- {
- if (fpos > fsPersistant_MaxPath) { fclose(pfile);return -6; }
- subject[fpos++] = fdata;
- }
- fclose(pfile);
- return 0;
- }
+ for ( i=0;i < fsPersistant_MaxPos;i++ ) if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) ) return 0;
+ gfree( (void **)&fsHistory[fsPersistant_MaxPos - 1] );
+ for ( i=fsPersistant_MaxPos - 1;i;i-- ) fsHistory[i]=fsHistory[i - 1];
+ fsHistory[0]=gstrdup( subject );
- if (rw_command == 1)
- {
- pfile = fopen(path,"w+");
- if (!pfile) return -6;
- fprintf(pfile,"%s",subject);
- fclose(pfile);
- return 0;
- }
- else return -10;
+ return 0;
}
//-----------------------------------------------
@@ -482,7 +436,6 @@ void fs_Ok_released( GtkButton * button,gpointer user_data )
fsSelectedFile=fsThatDir;
CheckDir( fsFNameList,get_current_dir_name() );
gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name() );
- fs_PersistantHistory(1,get_current_dir_name(),0); //totem, write into history
return;
}
@@ -516,6 +469,7 @@ void fs_Ok_released( GtkButton * button,gpointer user_data )
guiIntfStruct.FilenameChanged=1;
gfree( (void **)&guiIntfStruct.AudioFile );
gfree( (void **)&guiIntfStruct.Subtitlename );
+ fs_PersistantHistory( fsSelectedDirectory ); //totem, write into history
break;
#ifdef USE_SUB
case fsSubtitleSelector:
@@ -553,7 +507,7 @@ void fs_Ok_released( GtkButton * button,gpointer user_data )
void fs_Cancel_released( GtkButton * button,gpointer user_data )
{
HideFileSelect();
- fs_PersistantHistory(1,get_current_dir_name(),0); //totem, write into history file
+ fs_PersistantHistory( get_current_dir_name() ); //totem, write into history file
}
void fs_fsFNameList_select_row( GtkWidget * widget,gint row,gint column,GdkEventButton *bevent,gpointer user_data )
diff --git a/Gui/mplayer/gtk/fs.h b/Gui/mplayer/gtk/fs.h
index b0dddbc790..94e9ff08e8 100644
--- a/Gui/mplayer/gtk/fs.h
+++ b/Gui/mplayer/gtk/fs.h
@@ -9,10 +9,6 @@
#define fsAudioSelector 3
#define fsFontSelector 4
-#define fsPersistant_MaxPath 512
-#define fsPersistant_MaxPos 10
-#define fsPersistant_FilePath "/.mplayer/phistory"
-
#include <errno.h>
extern GtkWidget * fsFileSelect;
diff --git a/Gui/mplayer/gtk/opts.c b/Gui/mplayer/gtk/opts.c
index 2f88800b04..897bf7a8c8 100644
--- a/Gui/mplayer/gtk/opts.c
+++ b/Gui/mplayer/gtk/opts.c
@@ -90,9 +90,10 @@ static GtkWidget * HSSubDelay;
static GtkWidget * HSSubPosition;
static GtkWidget * HSSubFPS;
static GtkWidget * HSPPQuality;
+static GtkWidget * HSFPS;
static GtkAdjustment * HSExtraStereoMuladj, * HSAudioDelayadj, * HSPanscanadj, * HSSubDelayadj;
-static GtkAdjustment * HSSubPositionadj, * HSSubFPSadj, * HSPPQualityadj;
+static GtkAdjustment * HSSubPositionadj, * HSSubFPSadj, * HSPPQualityadj, * HSFPSadj;
#ifndef HAVE_FREETYPE
static GtkWidget * HSFontFactor;
@@ -246,6 +247,8 @@ void ShowPreferences( void )
if ( !gstrcmp( vo_driver[0],"dxr3" ) ) gtk_widget_set_sensitive( VConfig,TRUE );
#endif
}
+
+ gtk_adjustment_set_value( HSFPS,force_fps );
// -- 3. page
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSubOverlap ),suboverlap_enabled );
@@ -499,6 +502,7 @@ void prButton( GtkButton * button,gpointer user_data )
sub_delay=HSSubDelayadj->value;
sub_fps=HSSubFPSadj->value;
sub_pos=(int)HSSubPositionadj->value;
+ force_fps=HSFPSadj->value;
if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDNone ) ) ) osd_level=0;
if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDIndicator ) ) ) osd_level=1;
if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDTandP ) ) ) osd_level=2;
@@ -840,12 +844,27 @@ GtkWidget * create_Preferences( void )
CBHFramedrop=AddCheckButton( MSGTR_PREFERENCES_HFrameDrop,vbox5 );
CBFlip=AddCheckButton( MSGTR_PREFERENCES_Flip,vbox5 );
- hbox3=AddHBox( vbox5,1 );
+ table1=gtk_table_new( 3,2,FALSE );
+ gtk_widget_set_name( table1,"table1" );
+ gtk_widget_show( table1 );
+ gtk_box_pack_start( GTK_BOX( vbox5 ),table1,FALSE,FALSE,0 );
- AddLabel( MSGTR_PREFERENCES_Panscan,hbox3 );
+ label=AddLabel( MSGTR_PREFERENCES_Panscan,NULL );
+ gtk_table_attach( GTK_TABLE( table1 ),label,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
+
+ label=AddLabel( MSGTR_PREFERENCES_FPS,NULL );
+ gtk_table_attach( GTK_TABLE( table1 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
HSPanscanadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,1,0.001,0,0 ) );
- HSPanscan=AddHScaler( HSPanscanadj,hbox3,1 );
+ HSPanscan=AddHScaler( HSPanscanadj,NULL,1 );
+ gtk_table_attach( GTK_TABLE( table1 ),HSPanscan,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
+
+ HSFPSadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,1000,0.001,0,0 ) );
+ HSFPS=gtk_spin_button_new( GTK_ADJUSTMENT( HSFPSadj ),1,3 );
+ gtk_widget_set_name( HSFPS,"HSFPS" );
+ gtk_widget_show( HSFPS );
+ gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( HSFPS ),TRUE );
+ gtk_table_attach( GTK_TABLE( table1 ),HSFPS,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
label=AddLabel( MSGTR_PREFERENCES_Video,NULL );
gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),1 ),label );
@@ -892,23 +911,27 @@ GtkWidget * create_Preferences( void )
label=AddLabel( MSGTR_PREFERENCES_SUB_Delay,NULL );
gtk_table_attach( GTK_TABLE( table1 ),label,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
+ label=AddLabel( MSGTR_PREFERENCES_SUB_POS,NULL );
+ gtk_table_attach( GTK_TABLE( table1 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
+
label=AddLabel( MSGTR_PREFERENCES_SUB_FPS,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
+ gtk_table_attach( GTK_TABLE( table1 ),label,0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
HSSubDelayadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-10.0,10,0.01,0,0 ) );
HSSubDelay=AddHScaler( HSSubDelayadj,NULL,1 );
gtk_table_attach( GTK_TABLE( table1 ),HSSubDelay,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
- label=AddLabel( MSGTR_PREFERENCES_SUB_POS,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
HSSubPositionadj=GTK_ADJUSTMENT( gtk_adjustment_new( 100,0,100,1,0,0 ) );
HSSubPosition=AddHScaler( HSSubPositionadj,NULL,0 );
- gtk_table_attach( GTK_TABLE( table1 ),HSSubPosition,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
+ gtk_table_attach( GTK_TABLE( table1 ),HSSubPosition,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
HSSubFPSadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.01,0,0 ) );
- HSSubFPS=AddHScaler( HSSubFPSadj,NULL,1 );
- gtk_table_attach( GTK_TABLE( table1 ),HSSubFPS,1,2,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
+ HSSubFPS=gtk_spin_button_new( GTK_ADJUSTMENT( HSSubFPSadj ),1,3 );
+ gtk_widget_set_name( HSSubFPS,"HSSubFPS" );
+ gtk_widget_show( HSSubFPS );
+ gtk_widget_set_usize( HSSubFPS,60,-1 );
+ gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( HSSubFPS ),TRUE );
+ gtk_table_attach( GTK_TABLE( table1 ),HSSubFPS,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
vbox9=AddVBox( vbox8,0 );