[Mplayer-cvslog] CVS: main/Gui/mplayer/gtk common.c,1.3,1.4 fs.c,1.41,1.42 fs.h,1.16,1.17 opts.c,1.49,1.50
Zoltan Ponekker
pontscho at mplayerhq.hu
Tue Jan 21 14:33:42 CET 2003
Update of /cvsroot/mplayer/main/Gui/mplayer/gtk
In directory mail:/var/tmp.root/cvs-serv6039/Gui/mplayer/gtk
Modified Files:
common.c fs.c fs.h opts.c
Log Message:
- rewrite sub_fps
- add fps support
- rewrite history
Index: common.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/gtk/common.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- common.c 2 Jan 2003 15:48:29 -0000 1.3
+++ common.c 21 Jan 2003 13:33:39 -0000 1.4
@@ -29,9 +29,10 @@
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;
}
Index: fs.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/gtk/fs.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- fs.c 18 Jan 2003 01:07:46 -0000 1.41
+++ fs.c 21 Jan 2003 13:33:39 -0000 1.42
@@ -304,14 +304,12 @@
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 @@
fsFileSelect=NULL;
}
-//----------------------------------------------------
+int fs_PersistantHistory( char * subject )
+{
+ int i;
-/*
- * 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));
+ 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 == 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;
- }
-
- 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 @@
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 @@
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_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 )
Index: fs.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/gtk/fs.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- fs.h 2 Jan 2003 12:33:06 -0000 1.16
+++ fs.h 21 Jan 2003 13:33:39 -0000 1.17
@@ -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;
Index: opts.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/mplayer/gtk/opts.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- opts.c 19 Jan 2003 21:24:31 -0000 1.49
+++ opts.c 21 Jan 2003 13:33:39 -0000 1.50
@@ -90,9 +90,10 @@
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 @@
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 @@
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 @@
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 @@
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 );
More information about the MPlayer-cvslog
mailing list