#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "../../../config.h"
#include "../../../help_mp.h"
#include "../../../mixer.h"
#include "../../../libao2/audio_out.h"
#include "../../../libvo/video_out.h"
#include "../../cfg.h"
#include "../../interface.h"
#include "../widgets.h"
#include "opts.h"
#include "fs.h"
#include "common.h"
typedef struct sh_video_t sh_video_t;
typedef struct sh_audio_t sh_audio_t;
// for mpcodecs_[av]d_drivers:
#include "../../../libmpcodecs/vd.h"
#include "../../../libmpcodecs/ad.h"
GtkWidget * Preferences = NULL;
static GtkWidget * AConfig;
static GtkWidget * VConfig;
//static GtkWidget * BLoadSubtitle;
static GtkWidget * BLoadFont;
static GtkWidget * BOk;
static GtkWidget * BCancel;
static GtkWidget * CLADrivers;
static GtkWidget * CLVDrivers;
//static GtkWidget * ESubtitleName;
GtkWidget * prEFontName;
static GtkWidget * EVFM;
static GtkWidget * EAFM;
static GtkWidget * CBVFM;
static GtkWidget * CBAFM;
static GtkWidget * CBAudioEqualizer;
//static GtkWidget * CBSurround;
static GtkWidget * CBExtraStereo;
static GtkWidget * CBNoSound;
static GtkWidget * CBNormalize;
static GtkWidget * CBDoubleBuffer;
static GtkWidget * CBDR;
static GtkWidget * CBFramedrop;
static GtkWidget * CBHFramedrop;
//static GtkWidget * CBFullScreen;
static GtkWidget * CBNonInterlaved;
static GtkWidget * CBIndex;
static GtkWidget * CBFlip;
static GtkWidget * CBNoAutoSub;
static GtkWidget * CBSubUnicode;
static GtkWidget * CBSubOverlap;
static GtkWidget * CBDumpMPSub;
static GtkWidget * CBDumpSrt;
static GtkWidget * CBPostprocess;
static GtkWidget * CBCache;
static GtkWidget * CBLoadFullscreen;
static GtkWidget * CBStopXScreenSaver;
static GtkWidget * SBCache;
static GtkAdjustment * SBCacheadj;
static GtkWidget * CBAutoSync;
static GtkWidget * SBAutoSync;
static GtkAdjustment * SBAutoSyncadj;
static GtkWidget * RBOSDNone;
static GtkWidget * RBOSDTandP;
static GtkWidget * RBOSDIndicator;
static GtkWidget * HSAudioDelay;
static GtkWidget * HSExtraStereoMul;
static GtkWidget * HSPanscan;
static GtkWidget * HSSubDelay;
static GtkWidget * HSSubPosition;
static GtkWidget * HSSubFPS;
static GtkWidget * HSPPQuality;
static GtkAdjustment * HSExtraStereoMuladj, * HSAudioDelayadj, * HSPanscanadj, * HSSubDelayadj;
static GtkAdjustment * HSSubPositionadj, * HSSubFPSadj, * HSPPQualityadj;
#ifndef HAVE_FREETYPE
static GtkWidget * HSFontFactor;
static GtkAdjustment * HSFontFactoradj;
#else
static GtkWidget * HSFontBlur, * HSFontOutLine, * HSFontTextScale, * HSFontOSDScale;
static GtkAdjustment * HSFontBluradj, * HSFontOutLineadj, * HSFontTextScaleadj, * HSFontOSDScaleadj;
static GtkWidget * CBFontEncoding, * EFontEncoding;
static GtkWidget * RBFontNoAutoScale, * BRFontAutoScaleWidth, * RBFontAutoScaleHeight, * RBFontAutoScaleDiagonal;
//static GtkWidget * AutoScale;
#endif
#ifdef HAVE_FREETYPE
static struct
{
char * name;
char * comment;
} lEncoding[] =
{
{ "unicode", MSGTR_PREFERENCES_FontEncoding1 },
{ "iso-8859-1", MSGTR_PREFERENCES_FontEncoding2 },
{ "iso-8859-15", MSGTR_PREFERENCES_FontEncoding3 },
{ "iso-8859-2", MSGTR_PREFERENCES_FontEncoding4 },
{ "iso-8859-3", MSGTR_PREFERENCES_FontEncoding5 },
{ "iso-8859-4", MSGTR_PREFERENCES_FontEncoding6 },
{ "iso-8859-5", MSGTR_PREFERENCES_FontEncoding7 },
{ "cp1251", MSGTR_PREFERENCES_FontEncoding21},
{ "iso-8859-6", MSGTR_PREFERENCES_FontEncoding8 },
{ "iso-8859-7", MSGTR_PREFERENCES_FontEncoding9 },
{ "iso-8859-9", MSGTR_PREFERENCES_FontEncoding10 },
{ "iso-8859-13", MSGTR_PREFERENCES_FontEncoding11 },
{ "iso-8859-14", MSGTR_PREFERENCES_FontEncoding12 },
{ "iso-8859-8", MSGTR_PREFERENCES_FontEncoding13 },
{ "koi8-r", MSGTR_PREFERENCES_FontEncoding14 },
{ "koi8-u/ru", MSGTR_PREFERENCES_FontEncoding15 },
{ "cp936", MSGTR_PREFERENCES_FontEncoding16 },
{ "big5", MSGTR_PREFERENCES_FontEncoding17 },
{ "shift-jis", MSGTR_PREFERENCES_FontEncoding18 },
{ "cp949", MSGTR_PREFERENCES_FontEncoding19 },
{ "cp874", MSGTR_PREFERENCES_FontEncoding20 },
{ NULL,NULL }
};
char * lCEncoding = NULL;
#endif
static int old_audio_driver = 0;
static char * ao_driver[3];
static char * vo_driver[3];
static int old_video_driver = 0;
#ifdef USE_OSS_AUDIO
void ShowOSSConfig( void );
void HideOSSConfig( void );
#endif
#ifdef HAVE_DXR3
void ShowDXR3Config( void );
void HideDXR3Config( void );
#endif
#ifdef HAVE_SDL
void ShowSDLConfig( void );
void HideSDLConfig( void );
#endif
static gboolean prHScaler( GtkWidget * widget,GdkEventMotion * event,gpointer user_data );
static void prToggled( GtkToggleButton * togglebutton,gpointer user_data );
static void prCListRow( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data );
#ifdef HAVE_FREETYPE
static void prEntry( GtkContainer * container,GtkWidget * widget,gpointer user_data );
#endif
extern int muted;
extern int stop_xscreensaver;
void ShowPreferences( void )
{
if ( Preferences ) gtkActive( Preferences );
else Preferences=create_Preferences();
// -- 1. page
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBAudioEqualizer ),gtkEnableAudioEqualizer );
gtkAONoSound=muted;
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNoSound ),gtkAONoSound );
#if 0
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSurround ),gtkAOSurround );
#endif
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBExtraStereo ),gtkAOExtraStereo );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNormalize ),gtkAONorm );
gtk_adjustment_set_value( HSExtraStereoMuladj,gtkAOExtraStereoMul );
{
int i = 0;
char * tmp[3]; tmp[2]="";
old_audio_driver=-1;
if ( CLADrivers ) gtk_clist_clear( GTK_CLIST( CLADrivers ) );
while ( audio_out_drivers[i] )
{
const ao_info_t *info = audio_out_drivers[i++]->info;
if ( !strcmp( info->short_name,"plugin" ) ) continue;
if ( audio_driver_list )
{
char * name = gstrdup( audio_driver_list[0] );
char * sep = gstrchr( audio_driver_list[0],':' );
if ( sep ) *sep=0;
if ( !gstrcmp( name,(char *)info->short_name ) ) old_audio_driver=i - 1;
free( name );
}
tmp[0]=(char *)info->short_name; tmp[1]=(char *)info->name; gtk_clist_append( GTK_CLIST( CLADrivers ),tmp );
}
if ( old_audio_driver > -1 )
{
gtk_clist_select_row( GTK_CLIST( CLADrivers ),old_audio_driver,0 );
gtk_clist_get_text( GTK_CLIST( CLADrivers ),old_audio_driver,0,(char **)&ao_driver );
gtk_widget_set_sensitive( AConfig,FALSE );
#ifdef USE_OSS_AUDIO
if ( !strncmp( ao_driver[0],"oss",3 ) ) gtk_widget_set_sensitive( AConfig,TRUE );
#endif
#ifdef HAVE_SDL
if ( !strncmp( ao_driver[0],"sdl",3 ) ) gtk_widget_set_sensitive( AConfig,TRUE );
#endif
}
}
// -- 2. page
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBDoubleBuffer ),vo_doublebuffering );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBDR ),vo_directrendering );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBFramedrop ),FALSE );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBHFramedrop ),FALSE );
switch ( frame_dropping )
{
case 2: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBHFramedrop ),TRUE );
case 1: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBFramedrop ),TRUE );
}
if (flip != -1)
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBFlip ),fli
|