Mercurial > mplayer.hg
changeset 33572:d9b805602aa1
Rename some gtk files.
The new names better reflect what the files implement.
List of changes:
eq.* -> equalizer.*
fs.* -> fileselect.*
gtk_common.* -> tools.*
gtk_menu.* -> menu.*
gtk_url.* -> url.*
mb.* -> msgbox.*
opts.* -> preferences.*
pl.* -> playlist.*
sb.* -> skinbrowser.*
author | ib |
---|---|
date | Sun, 19 Jun 2011 15:34:08 +0000 |
parents | 4f9ad91c79b4 |
children | 42b250e4f40e |
files | Makefile gui/ui/gtk/about.c gui/ui/gtk/eq.c gui/ui/gtk/eq.h gui/ui/gtk/equalizer.c gui/ui/gtk/equalizer.h gui/ui/gtk/fileselect.c gui/ui/gtk/fileselect.h gui/ui/gtk/fs.c gui/ui/gtk/fs.h gui/ui/gtk/gtk_common.c gui/ui/gtk/gtk_common.h gui/ui/gtk/gtk_menu.c gui/ui/gtk/gtk_menu.h gui/ui/gtk/gtk_url.c gui/ui/gtk/gtk_url.h gui/ui/gtk/mb.c gui/ui/gtk/mb.h gui/ui/gtk/menu.c gui/ui/gtk/menu.h gui/ui/gtk/msgbox.c gui/ui/gtk/msgbox.h gui/ui/gtk/opts.c gui/ui/gtk/opts.h gui/ui/gtk/pl.c gui/ui/gtk/pl.h gui/ui/gtk/playlist.c gui/ui/gtk/playlist.h gui/ui/gtk/preferences.c gui/ui/gtk/preferences.h gui/ui/gtk/sb.c gui/ui/gtk/sb.h gui/ui/gtk/skinbrowser.c gui/ui/gtk/skinbrowser.h gui/ui/gtk/tools.c gui/ui/gtk/tools.h gui/ui/gtk/url.c gui/ui/gtk/url.h gui/ui/widgets.c |
diffstat | 39 files changed, 5495 insertions(+), 5496 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Sun Jun 19 13:58:45 2011 +0000 +++ b/Makefile Sun Jun 19 15:34:08 2011 +0000 @@ -525,15 +525,15 @@ gui/skin/skin.c \ gui/ui/actions.c \ gui/ui/gtk/about.c \ - gui/ui/gtk/eq.c \ - gui/ui/gtk/fs.c \ - gui/ui/gtk/gtk_common.c \ - gui/ui/gtk/gtk_menu.c \ - gui/ui/gtk/gtk_url.c \ - gui/ui/gtk/mb.c \ - gui/ui/gtk/opts.c \ - gui/ui/gtk/pl.c \ - gui/ui/gtk/sb.c \ + gui/ui/gtk/equalizer.c \ + gui/ui/gtk/fileselect.c \ + gui/ui/gtk/menu.c \ + gui/ui/gtk/msgbox.c \ + gui/ui/gtk/playlist.c \ + gui/ui/gtk/preferences.c \ + gui/ui/gtk/skinbrowser.c \ + gui/ui/gtk/tools.c \ + gui/ui/gtk/url.c \ gui/ui/main.c \ gui/ui/menu.c \ gui/ui/playbar.c \
--- a/gui/ui/gtk/about.c Sun Jun 19 13:58:45 2011 +0000 +++ b/gui/ui/gtk/about.c Sun Jun 19 15:34:08 2011 +0000 @@ -23,7 +23,7 @@ #include "gui/ui/pixmaps/emblem.xpm" #include "gui/ui/widgets.h" #include "about.h" -#include "gtk_common.h" +#include "tools.h" GtkWidget * About = NULL;
--- a/gui/ui/gtk/eq.c Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,691 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <stdlib.h> -#include <stdio.h> -#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 "gui/app.h" -#include "gui/cfg.h" -#include "help_mp.h" -#include "libaf/equalizer.h" -#include "libvo/video_out.h" -#include "stream/stream.h" -#include "libmpdemux/demuxer.h" -#include "libmpdemux/stheader.h" -#include "libmpcodecs/dec_video.h" -#include "gui/ui/widgets.h" - -#include "eq.h" -#include "gtk_common.h" - -#define eqRange 15 - -GtkWidget * Equalizer = NULL; -static GtkWidget * EquConfig; - -static GtkWidget * Notebook; -static GtkWidget * ChannelsList; -static GtkWidget * VContrast, * VBrightness, * VHue, * VSaturation; -static GtkAdjustment * VContrastadj, * VBrightnessadj, * VHueadj, * VSaturationadj; -static GtkWidget * Ok, * Clear, * Config; -static GtkWidget * A3125, * A125, * A6250, * A250, * A500, * A1000, * A2000, * A4000, * A8000, * A16000; -static GtkAdjustment * A3125adj, * A125adj, * A6250adj, * A250adj, * A500adj, * A1000adj, * A2000adj, * A4000adj, * A8000adj, * A16000adj; - -static int Channel = -1; - -// --- - -char * gtkEquChannel1 = NULL; -char * gtkEquChannel2 = NULL; -char * gtkEquChannel3 = NULL; -char * gtkEquChannel4 = NULL; -char * gtkEquChannel5 = NULL; -char * gtkEquChannel6 = NULL; - -// --- - -void ShowEquConfig( void ); -void HideEquConfig( void ); - -static void eqSetBands( int channel ) -{ - if ( channel < 0 ) channel=0; - gtk_adjustment_set_value( A3125adj,0.0f - gtkEquChannels[channel][0] ); - gtk_adjustment_set_value( A6250adj,0.0f - gtkEquChannels[channel][1] ); - gtk_adjustment_set_value( A125adj,0.0f - gtkEquChannels[channel][2] ); - gtk_adjustment_set_value( A250adj,0.0f - gtkEquChannels[channel][3] ); - gtk_adjustment_set_value( A500adj,0.0f - gtkEquChannels[channel][4] ); - gtk_adjustment_set_value( A1000adj,0.0f - gtkEquChannels[channel][5] ); - gtk_adjustment_set_value( A2000adj,0.0f - gtkEquChannels[channel][6] ); - gtk_adjustment_set_value( A4000adj,0.0f - gtkEquChannels[channel][7] ); - gtk_adjustment_set_value( A8000adj,0.0f - gtkEquChannels[channel][8] ); - gtk_adjustment_set_value( A16000adj,0.0f - gtkEquChannels[channel][9] ); - - if ( guiInfo.sh_video ) - { - get_video_colors( guiInfo.sh_video,"brightness",&vo_gamma_brightness ); - get_video_colors( guiInfo.sh_video,"contrast",&vo_gamma_contrast ); - get_video_colors( guiInfo.sh_video,"hue",&vo_gamma_hue ); - get_video_colors( guiInfo.sh_video,"saturation",&vo_gamma_saturation ); - } - - gtk_adjustment_set_value( VContrastadj,(float)vo_gamma_contrast ); - gtk_adjustment_set_value( VBrightnessadj,(float)vo_gamma_brightness ); - gtk_adjustment_set_value( VHueadj,(float)vo_gamma_hue ); - gtk_adjustment_set_value( VSaturationadj,(float)vo_gamma_saturation ); -} - -static void eqSetChannelNames( void ) -{ - gchar * str[2]; - gtk_clist_clear( GTK_CLIST( ChannelsList ) ); - str[1]=""; - str[0]=MSGTR_EQU_All; - gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); - if ( guiInfo.AudioType > 1 ) - { - str[0]=gtkEquChannel1; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); - str[0]=gtkEquChannel2; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); - } - if ( guiInfo.AudioType > 2 ) - { - str[0]=gtkEquChannel3; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); - str[0]=gtkEquChannel4; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); - } - if ( guiInfo.AudioType > 4 ) - { - str[0]=gtkEquChannel5; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); - str[0]=gtkEquChannel6; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); - } - gtk_clist_select_row( GTK_CLIST( ChannelsList ),0,0 ); -} - -void ShowEqualizer( void ) -{ - if ( Equalizer ) gtkActive( Equalizer ); - else Equalizer=create_Equalizer(); - - if ( !gtkEquChannel1 ) gtkEquChannel1=strdup( MSGTR_EQU_Front_Right ); - if ( !gtkEquChannel2 ) gtkEquChannel2=strdup( MSGTR_EQU_Front_Left ); - if ( !gtkEquChannel3 ) gtkEquChannel3=strdup( MSGTR_EQU_Back_Right ); - if ( !gtkEquChannel4 ) gtkEquChannel4=strdup( MSGTR_EQU_Back_Left ); - if ( !gtkEquChannel5 ) gtkEquChannel5=strdup( MSGTR_EQU_Center ); - if ( !gtkEquChannel6 ) gtkEquChannel6=strdup( MSGTR_EQU_Bass ); - - eqSetChannelNames(); - - if ( !guiInfo.Playing || !guiInfo.sh_video ) - { - gtk_widget_set_sensitive( VContrast,FALSE ); - gtk_widget_set_sensitive( VBrightness,FALSE ); - gtk_widget_set_sensitive( VHue,FALSE ); - gtk_widget_set_sensitive( VSaturation,FALSE ); - } - Channel=-1; - eqSetBands( 0 ); - if ( !guiInfo.Playing || !gtkEnableAudioEqualizer ) - { - gtk_widget_set_sensitive( ChannelsList,FALSE ); - gtk_widget_set_sensitive( A3125,FALSE ); - gtk_widget_set_sensitive( A125,FALSE ); - gtk_widget_set_sensitive( A6250,FALSE ); - gtk_widget_set_sensitive( A250,FALSE ); - gtk_widget_set_sensitive( A500,FALSE ); - gtk_widget_set_sensitive( A1000,FALSE ); - gtk_widget_set_sensitive( A2000,FALSE ); - gtk_widget_set_sensitive( A4000,FALSE ); - gtk_widget_set_sensitive( A8000,FALSE ); - gtk_widget_set_sensitive( A16000,FALSE ); - } - - if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( Notebook ) ) == 0 ) gtk_widget_show( Config ); - gtk_widget_show( Equalizer ); -} - -static void HideEqualizer( void ) -{ - if ( !Equalizer ) return; - gtk_widget_hide( Equalizer ); - gtk_widget_destroy( Equalizer ); - Equalizer=NULL; - if ( EquConfig ) HideEquConfig(); -} - -static gboolean eqHScaleMotion( GtkWidget * widget,GdkEventMotion * event,gpointer user_data ) -{ - equalizer_t eq; - switch ( (int)user_data ) - { - case 0: eq.gain=A3125adj->value; break; - case 1: eq.gain=A6250adj->value; break; - case 2: eq.gain=A125adj->value; break; - case 3: eq.gain=A250adj->value; break; - case 4: eq.gain=A500adj->value; break; - case 5: eq.gain=A1000adj->value; break; - case 6: eq.gain=A2000adj->value; break; - case 7: eq.gain=A4000adj->value; break; - case 8: eq.gain=A8000adj->value; break; - case 9: eq.gain=A16000adj->value; break; - default: return FALSE; - } - eq.gain=0.0f - eq.gain; - eq.band=(int)user_data; - if ( Channel == -1 ) - { - int i; - for ( i=0;i<6;i++ ) - { eq.channel=i; gtkSet( gtkSetEqualizer,0,&eq ); } - } else { eq.channel=Channel; gtkSet( gtkSetEqualizer,0,&eq ); } - - return FALSE; -} - -static gboolean eqVScaleMotion( GtkWidget * widget,GdkEventMotion * event,gpointer user_data ) -{ - - switch( (int)user_data ) - { - case 1: gtkSet( gtkSetContrast,VContrastadj->value,NULL ); break; - case 2: gtkSet( gtkSetBrightness,VBrightnessadj->value,NULL ); break; - case 3: gtkSet( gtkSetHue,VHueadj->value,NULL ); break; - case 4: gtkSet( gtkSetSaturation,VSaturationadj->value,NULL ); break; - } - - return FALSE; -} - -static void eqButtonReleased( GtkButton * button,gpointer user_data ) -{ - switch( (int)user_data ) - { - case 0: HideEqualizer(); break; - case 1: - if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( Notebook ) ) == 0 ) - { - if ( !guiInfo.Playing || !gtkEnableAudioEqualizer ) break; - gtkSet( gtkSetEqualizer,0,NULL ); - eqSetBands( Channel ); - } - else - { - if ( !guiInfo.Playing ) break; - gtkSet( gtkSetContrast,0.0f,NULL ); - gtkSet( gtkSetBrightness,0.0f,NULL ); - gtkSet( gtkSetHue,0.0f,NULL ); - gtkSet( gtkSetSaturation,0.0f,NULL ); - eqSetBands( Channel ); - } - break; - case 2: - ShowEquConfig(); - break; - } -} - -static void eqFocus( GtkWindow * window,GtkWidget * widget,gpointer user_data ) -{ eqSetBands( Channel ); } - -static void eqSelectChannelsListRow( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data ) -{ - Channel=row - 1; - eqSetBands( Channel ); - if ( Channel == -1 ) - { - int i,j; equalizer_t eq; - for ( i=1;i<6;i++ ) - for ( j=0;j<10;j++ ) - { eq.band=j; eq.channel=i; eq.gain=gtkEquChannels[0][j]; gtkSet( gtkSetEqualizer,0,&eq ); } - } -} - -static void eqNotebook( GtkNotebook * notebook, GtkNotebookPage * page, - gint page_num, gpointer user_data ) -{ - if ( page_num ) gtk_widget_hide( Config ); - else gtk_widget_show( Config ); -} - -GtkWidget * create_Equalizer( void ) -{ - GtkWidget * vbox1; - GtkWidget * hbox1; - GtkWidget * scrolledwindow1; - GtkWidget * table1; - GtkWidget * hbuttonbox1; - GtkAccelGroup * accel_group; - - accel_group=gtk_accel_group_new(); - - Equalizer=gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_widget_set_name( Equalizer,MSGTR_Equalizer ); - gtk_object_set_data( GTK_OBJECT( Equalizer ),MSGTR_Equalizer,Equalizer ); - gtk_widget_set_usize( Equalizer,-1,256 ); - gtk_window_set_title( GTK_WINDOW( Equalizer ),MSGTR_Equalizer ); - gtk_window_set_position( GTK_WINDOW( Equalizer ),GTK_WIN_POS_CENTER ); - gtk_window_set_policy( GTK_WINDOW( Equalizer ),FALSE,FALSE,FALSE ); - gtk_window_set_wmclass( GTK_WINDOW( Equalizer ),"Equalizer","MPlayer" ); - - gtk_widget_realize( Equalizer ); - gtkAddIcon( Equalizer ); - - vbox1=AddVBox( AddDialogFrame( Equalizer ),0 ); - - Notebook=gtk_notebook_new(); - gtk_widget_set_name( Notebook,"Notebook" ); - gtk_widget_show( Notebook ); - gtk_box_pack_start( GTK_BOX( vbox1 ),Notebook,TRUE,TRUE,0 ); - gtk_container_set_border_width( GTK_CONTAINER( Notebook ),1 ); - - hbox1=AddHBox( Notebook,0 ); - - scrolledwindow1=gtk_scrolled_window_new( NULL,NULL ); - gtk_widget_set_name( scrolledwindow1,"scrolledwindow1" ); - gtk_widget_show( scrolledwindow1 ); - gtk_box_pack_start( GTK_BOX( hbox1 ),scrolledwindow1,FALSE,FALSE,0 ); - gtk_widget_set_usize( scrolledwindow1,106,-2 ); - gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC ); - - ChannelsList=gtk_clist_new( 1 ); - gtk_widget_set_name( ChannelsList,"ChannelsList" ); - gtk_widget_show( ChannelsList ); - gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),ChannelsList ); - gtk_clist_set_column_width( GTK_CLIST( ChannelsList ),0,80 ); - gtk_clist_column_titles_hide( GTK_CLIST( ChannelsList ) ); - - table1=gtk_table_new( 2,10,FALSE ); - gtk_widget_set_name( table1,"table1" ); - gtk_widget_show( table1 ); - gtk_box_pack_start( GTK_BOX( hbox1 ),table1,FALSE,FALSE,0 ); - gtk_table_set_row_spacings( GTK_TABLE( table1 ),4 ); - gtk_table_set_col_spacings( GTK_TABLE( table1 ),9 ); - - A3125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); - A3125=AddVScaler( A3125adj,NULL,-1 ); - gtk_table_attach( GTK_TABLE( table1 ),A3125,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); - - A6250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); - A6250=AddVScaler( A6250adj,NULL,-1 ); - gtk_table_attach( GTK_TABLE( table1 ),A6250,1,2,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); - - A125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); - A125=AddVScaler( A125adj,NULL,-1 ); - gtk_table_attach( GTK_TABLE( table1 ),A125,2,3,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); - - A250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); - A250=AddVScaler( A250adj,NULL,-1 ); - gtk_table_attach( GTK_TABLE( table1 ),A250,3,4,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); - - A500adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); - A500=AddVScaler( A500adj,NULL,-1 ); - gtk_table_attach( GTK_TABLE( table1 ),A500,4,5,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); - - A1000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); - A1000=AddVScaler( A1000adj,NULL,-1 ); - gtk_table_attach( GTK_TABLE( table1 ),A1000,5,6,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); - - A2000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); - A2000=AddVScaler( A2000adj,NULL,-1 ); - gtk_table_attach( GTK_TABLE( table1 ),A2000,6,7,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); - - A4000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); - A4000=AddVScaler( A4000adj,NULL,-1 ); - gtk_table_attach( GTK_TABLE( table1 ),A4000,7,8,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); - - A8000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); - A8000=AddVScaler( A8000adj,NULL,-1 ); - gtk_table_attach( GTK_TABLE( table1 ),A8000,8,9,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); - - A16000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); - A16000=AddVScaler( A16000adj,NULL,-1 ); - gtk_table_attach( GTK_TABLE( table1 ),A16000,9,10,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( "31.25",NULL ), - 0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( "62.50",NULL ), - 1,2,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( "125",NULL ), - 2,3,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( "250",NULL ), - 3,4,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( "500",NULL ), - 4,5,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( "1000",NULL ), - 5,6,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( "2000",NULL ), - 6,7,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( "4000",NULL ), - 7,8,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( "8000",NULL ), - 8,9,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( "16000",NULL ), - 9,10,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_notebook_set_tab_label( GTK_NOTEBOOK( Notebook ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( Notebook ),0 ), - AddLabel( MSGTR_EQU_Audio,NULL ) ); - - table1=gtk_table_new( 4,2,FALSE ); - gtk_widget_set_name( table1,"table1" ); - gtk_widget_show( table1 ); - gtk_container_add( GTK_CONTAINER( Notebook ),table1 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( MSGTR_EQU_Contrast,NULL ), - 0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( MSGTR_EQU_Brightness,NULL ), - 0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( MSGTR_EQU_Hue,NULL ), - 0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( MSGTR_EQU_Saturation,NULL ), - 0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - VContrastadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); - VContrast=AddHScaler( VContrastadj,NULL,1 ); - gtk_table_attach( GTK_TABLE( table1 ),VContrast,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - gtk_widget_set_usize( VContrast,-1,45 ); - - VBrightnessadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); - VBrightness=AddHScaler( VBrightnessadj,NULL,1 ); - gtk_table_attach( GTK_TABLE( table1 ),VBrightness,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - gtk_widget_set_usize( VBrightness,-1,45 ); - - VHueadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); - VHue=AddHScaler( VHueadj,NULL,1 ); - gtk_table_attach( GTK_TABLE( table1 ),VHue,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - gtk_widget_set_usize( VHue,-1,45 ); - - VSaturationadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); - VSaturation=AddHScaler( VSaturationadj,NULL,1 ); - gtk_table_attach( GTK_TABLE( table1 ),VSaturation,1,2,3,4,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - gtk_widget_set_usize( VSaturation,-1,45 ); - - gtk_notebook_set_tab_label( GTK_NOTEBOOK( Notebook ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( Notebook ),1 ), - AddLabel( MSGTR_EQU_Video,NULL ) ); - - AddHSeparator( vbox1 ); - - hbuttonbox1=AddHButtonBox( vbox1 ); - gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); - gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); - - Config=AddButton( MSGTR_Config,hbuttonbox1 ); - Clear=AddButton( MSGTR_Clear,hbuttonbox1 ); - Ok=AddButton( MSGTR_Ok,hbuttonbox1 ); - - gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); - gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); - - gtk_signal_connect( GTK_OBJECT( Equalizer ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&Equalizer ); - gtk_signal_connect( GTK_OBJECT( Equalizer ),"focus_in_event",GTK_SIGNAL_FUNC( eqFocus ),(void *)2 ); - - gtk_signal_connect( GTK_OBJECT( ChannelsList ),"select_row",GTK_SIGNAL_FUNC( eqSelectChannelsListRow ),NULL ); - - gtk_signal_connect( GTK_OBJECT( A3125 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)0 ); - gtk_signal_connect( GTK_OBJECT( A6250 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)1 ); - gtk_signal_connect( GTK_OBJECT( A125 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)2 ); - gtk_signal_connect( GTK_OBJECT( A250 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)3 ); - gtk_signal_connect( GTK_OBJECT( A500 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)4 ); - gtk_signal_connect( GTK_OBJECT( A1000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)5 ); - gtk_signal_connect( GTK_OBJECT( A2000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)6 ); - gtk_signal_connect( GTK_OBJECT( A4000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)7 ); - gtk_signal_connect( GTK_OBJECT( A8000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)8 ); - gtk_signal_connect( GTK_OBJECT( A16000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)9 ); - - gtk_signal_connect( GTK_OBJECT( VContrast ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void*)1 ); - gtk_signal_connect( GTK_OBJECT( VBrightness ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void*)2 ); - gtk_signal_connect( GTK_OBJECT( VHue ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void*)3 ); - gtk_signal_connect( GTK_OBJECT( VSaturation ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void *)4 ); - - gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( eqButtonReleased ),(void *)0 ); - gtk_signal_connect( GTK_OBJECT( Clear ),"clicked",GTK_SIGNAL_FUNC( eqButtonReleased ),(void *)1 ); - gtk_signal_connect( GTK_OBJECT( Config ),"clicked",GTK_SIGNAL_FUNC( eqButtonReleased ),(void *)2 ); - - gtk_signal_connect( GTK_OBJECT( Notebook ),"switch_page",GTK_SIGNAL_FUNC( eqNotebook ),NULL ); - - gtk_window_add_accel_group( GTK_WINDOW( Equalizer ),accel_group ); - - return Equalizer; -} - -// --- equalizer config dialog box - -static GtkWidget * CBChannel1; -static GtkWidget * CEChannel1; -static GtkWidget * CBChannel2; -static GtkWidget * CEChannel2; -static GtkWidget * CBChannel3; -static GtkWidget * CEChannel3; -static GtkWidget * CBChannel4; -static GtkWidget * CEChannel4; -static GtkWidget * CBChannel5; -static GtkWidget * CEChannel5; -static GtkWidget * CBChannel6; -static GtkWidget * CEChannel6; -static GtkWidget * ecOk; -static GtkWidget * ecCancel; - -GtkWidget * create_EquConfig( void ); - -void ShowEquConfig( void ) -{ - GList * Items = NULL; - - if ( EquConfig ) gtkActive( EquConfig ); - else EquConfig=create_EquConfig(); - - Items=g_list_append( Items,(gpointer)MSGTR_EQU_Front_Right ); - Items=g_list_append( Items,(gpointer)MSGTR_EQU_Front_Left ); - Items=g_list_append( Items,(gpointer)MSGTR_EQU_Back_Right ); - Items=g_list_append( Items,(gpointer)MSGTR_EQU_Back_Left ); - Items=g_list_append( Items,(gpointer)MSGTR_EQU_Center ); - Items=g_list_append( Items,(gpointer)MSGTR_EQU_Bass ); - - gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel1 ),Items ); - gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel2 ),Items ); - gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel3 ),Items ); - gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel4 ),Items ); - gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel5 ),Items ); - gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel6 ),Items ); - - g_list_free( Items ); - - gtk_entry_set_text( GTK_ENTRY( CEChannel1 ),gtkEquChannel1 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel1 ),FALSE ); - gtk_entry_set_text( GTK_ENTRY( CEChannel2 ),gtkEquChannel2 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel2 ),FALSE ); - gtk_entry_set_text( GTK_ENTRY( CEChannel3 ),gtkEquChannel3 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel3 ),FALSE ); - gtk_entry_set_text( GTK_ENTRY( CEChannel4 ),gtkEquChannel4 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel4 ),FALSE ); - gtk_entry_set_text( GTK_ENTRY( CEChannel5 ),gtkEquChannel5 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel5 ),FALSE ); - gtk_entry_set_text( GTK_ENTRY( CEChannel6 ),gtkEquChannel6 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel6 ),FALSE ); - - gtk_widget_show( EquConfig ); - gtkSetLayer( EquConfig ); -} - -void HideEquConfig( void ) -{ - if ( !EquConfig ) return; - gtk_widget_hide( EquConfig ); - gtk_widget_destroy( EquConfig ); - EquConfig=NULL; -} - -static void ecButtonReleased( GtkButton * button,gpointer user_data ) -{ - if ( (int)user_data ) - { // if you pressed Ok - gfree( (void **)>kEquChannel1 ); gtkEquChannel1=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel1 ) ) ); - gfree( (void **)>kEquChannel2 ); gtkEquChannel2=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel2 ) ) ); - gfree( (void **)>kEquChannel3 ); gtkEquChannel3=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel3 ) ) ); - gfree( (void **)>kEquChannel4 ); gtkEquChannel4=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel4 ) ) ); - gfree( (void **)>kEquChannel5 ); gtkEquChannel5=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel5 ) ) ); - gfree( (void **)>kEquChannel6 ); gtkEquChannel6=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel6 ) ) ); - eqSetChannelNames(); - } - HideEquConfig(); -} - -GtkWidget * create_EquConfig( void ) -{ - GtkWidget * vbox1; - GtkWidget * table1; - GtkWidget * hbuttonbox1; - GtkAccelGroup * accel_group; - - accel_group=gtk_accel_group_new(); - - EquConfig=gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_widget_set_name( EquConfig,"EquConfig" ); - gtk_object_set_data( GTK_OBJECT( EquConfig ),"EquConfig",EquConfig ); - gtk_widget_set_usize( EquConfig,350,260 ); - GTK_WIDGET_SET_FLAGS( EquConfig,GTK_CAN_DEFAULT ); - gtk_window_set_title( GTK_WINDOW( EquConfig ),MSGTR_ConfigureEqualizer ); - gtk_window_set_position( GTK_WINDOW( EquConfig ),GTK_WIN_POS_CENTER ); -// gtk_window_set_modal( GTK_WINDOW( EquConfig ),TRUE ); - gtk_window_set_policy( GTK_WINDOW( EquConfig ),FALSE,FALSE,FALSE ); - gtk_window_set_wmclass( GTK_WINDOW( EquConfig ),"EquConfig","MPlayer" ); - - gtk_widget_realize( EquConfig ); - gtkAddIcon( EquConfig ); - - vbox1=AddVBox( AddDialogFrame( EquConfig ),0 ); - - table1=gtk_table_new( 6,2,FALSE ); - gtk_widget_set_name( table1,"table1" ); - gtk_widget_show( table1 ); - gtk_box_pack_start( GTK_BOX( vbox1 ),table1,TRUE,TRUE,0 ); - gtk_table_set_row_spacings( GTK_TABLE( table1 ),4 ); - gtk_table_set_col_spacings( GTK_TABLE( table1 ),4 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( MSGTR_EQU_Channel1,NULL ), - 0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( MSGTR_EQU_Channel2,NULL ), - 0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( MSGTR_EQU_Channel3,NULL ), - 0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( MSGTR_EQU_Channel4,NULL ), - 0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( MSGTR_EQU_Channel5,NULL ), - 0,1,4,5,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - gtk_table_attach( GTK_TABLE( table1 ), - AddLabel( MSGTR_EQU_Channel6,NULL ), - 0,1,5,6,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - CBChannel1=AddComboBox( NULL ); - gtk_table_attach( GTK_TABLE( table1 ),CBChannel1,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - CEChannel1=GTK_COMBO( CBChannel1 )->entry; - gtk_widget_set_name( CEChannel1,"CEChannel1" ); - gtk_widget_show( CEChannel1 ); - - CBChannel2=AddComboBox( NULL ); - gtk_table_attach( GTK_TABLE( table1 ),CBChannel2,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - CEChannel2=GTK_COMBO( CBChannel2 )->entry; - gtk_widget_set_name( CEChannel2,"CEChannel2" ); - gtk_widget_show( CEChannel2 ); - - CBChannel3=AddComboBox( NULL ); - gtk_table_attach( GTK_TABLE( table1 ),CBChannel3,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - CEChannel3=GTK_COMBO( CBChannel3 )->entry; - gtk_widget_set_name( CEChannel3,"CEChannel3" ); - gtk_widget_show( CEChannel3 ); - - CBChannel4=AddComboBox( NULL ); - gtk_table_attach( GTK_TABLE( table1 ),CBChannel4,1,2,3,4,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - CEChannel4=GTK_COMBO( CBChannel4 )->entry; - gtk_widget_set_name( CEChannel4,"CEChannel4" ); - gtk_widget_show( CEChannel4 ); - - CBChannel5=AddComboBox( NULL ); - gtk_table_attach( GTK_TABLE( table1 ),CBChannel5,1,2,4,5,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - CEChannel5=GTK_COMBO( CBChannel5 )->entry; - gtk_widget_set_name( CEChannel5,"CEChannel5" ); - gtk_widget_show( CEChannel5 ); - - CBChannel6=AddComboBox( NULL ); - gtk_table_attach( GTK_TABLE( table1 ),CBChannel6,1,2,5,6,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - CEChannel6=GTK_COMBO( CBChannel6 )->entry; - gtk_widget_set_name( CEChannel6,"CEChannel6" ); - gtk_widget_show( CEChannel6 ); - - AddHSeparator( vbox1 ); - - hbuttonbox1=AddHButtonBox( vbox1 ); - gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); - gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); - - ecOk=AddButton( MSGTR_Ok,hbuttonbox1 ); - ecCancel=AddButton( MSGTR_Cancel,hbuttonbox1 ); - - gtk_widget_add_accelerator( ecOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); - gtk_widget_add_accelerator( ecCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); - - gtk_signal_connect( GTK_OBJECT( EquConfig ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&EquConfig ); - - gtk_signal_connect( GTK_OBJECT( ecOk ),"clicked",GTK_SIGNAL_FUNC( ecButtonReleased ),(void *)1 ); - gtk_signal_connect( GTK_OBJECT( ecCancel ),"clicked",GTK_SIGNAL_FUNC( ecButtonReleased ),(void *)0 ); - - gtk_window_add_accel_group( GTK_WINDOW( EquConfig ),accel_group ); - - return EquConfig; -}
--- a/gui/ui/gtk/eq.h Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_GUI_EQ_H -#define MPLAYER_GUI_EQ_H - -#include <gtk/gtk.h> - -extern GtkWidget * Equalizer; - -GtkWidget * create_Equalizer( void ); -void ShowEqualizer( void ); - -#endif /* MPLAYER_GUI_EQ_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/equalizer.c Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,691 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <stdlib.h> +#include <stdio.h> +#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 "gui/app.h" +#include "gui/cfg.h" +#include "help_mp.h" +#include "libaf/equalizer.h" +#include "libvo/video_out.h" +#include "stream/stream.h" +#include "libmpdemux/demuxer.h" +#include "libmpdemux/stheader.h" +#include "libmpcodecs/dec_video.h" +#include "gui/ui/widgets.h" + +#include "equalizer.h" +#include "tools.h" + +#define eqRange 15 + +GtkWidget * Equalizer = NULL; +static GtkWidget * EquConfig; + +static GtkWidget * Notebook; +static GtkWidget * ChannelsList; +static GtkWidget * VContrast, * VBrightness, * VHue, * VSaturation; +static GtkAdjustment * VContrastadj, * VBrightnessadj, * VHueadj, * VSaturationadj; +static GtkWidget * Ok, * Clear, * Config; +static GtkWidget * A3125, * A125, * A6250, * A250, * A500, * A1000, * A2000, * A4000, * A8000, * A16000; +static GtkAdjustment * A3125adj, * A125adj, * A6250adj, * A250adj, * A500adj, * A1000adj, * A2000adj, * A4000adj, * A8000adj, * A16000adj; + +static int Channel = -1; + +// --- + +char * gtkEquChannel1 = NULL; +char * gtkEquChannel2 = NULL; +char * gtkEquChannel3 = NULL; +char * gtkEquChannel4 = NULL; +char * gtkEquChannel5 = NULL; +char * gtkEquChannel6 = NULL; + +// --- + +void ShowEquConfig( void ); +void HideEquConfig( void ); + +static void eqSetBands( int channel ) +{ + if ( channel < 0 ) channel=0; + gtk_adjustment_set_value( A3125adj,0.0f - gtkEquChannels[channel][0] ); + gtk_adjustment_set_value( A6250adj,0.0f - gtkEquChannels[channel][1] ); + gtk_adjustment_set_value( A125adj,0.0f - gtkEquChannels[channel][2] ); + gtk_adjustment_set_value( A250adj,0.0f - gtkEquChannels[channel][3] ); + gtk_adjustment_set_value( A500adj,0.0f - gtkEquChannels[channel][4] ); + gtk_adjustment_set_value( A1000adj,0.0f - gtkEquChannels[channel][5] ); + gtk_adjustment_set_value( A2000adj,0.0f - gtkEquChannels[channel][6] ); + gtk_adjustment_set_value( A4000adj,0.0f - gtkEquChannels[channel][7] ); + gtk_adjustment_set_value( A8000adj,0.0f - gtkEquChannels[channel][8] ); + gtk_adjustment_set_value( A16000adj,0.0f - gtkEquChannels[channel][9] ); + + if ( guiInfo.sh_video ) + { + get_video_colors( guiInfo.sh_video,"brightness",&vo_gamma_brightness ); + get_video_colors( guiInfo.sh_video,"contrast",&vo_gamma_contrast ); + get_video_colors( guiInfo.sh_video,"hue",&vo_gamma_hue ); + get_video_colors( guiInfo.sh_video,"saturation",&vo_gamma_saturation ); + } + + gtk_adjustment_set_value( VContrastadj,(float)vo_gamma_contrast ); + gtk_adjustment_set_value( VBrightnessadj,(float)vo_gamma_brightness ); + gtk_adjustment_set_value( VHueadj,(float)vo_gamma_hue ); + gtk_adjustment_set_value( VSaturationadj,(float)vo_gamma_saturation ); +} + +static void eqSetChannelNames( void ) +{ + gchar * str[2]; + gtk_clist_clear( GTK_CLIST( ChannelsList ) ); + str[1]=""; + str[0]=MSGTR_EQU_All; + gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); + if ( guiInfo.AudioType > 1 ) + { + str[0]=gtkEquChannel1; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); + str[0]=gtkEquChannel2; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); + } + if ( guiInfo.AudioType > 2 ) + { + str[0]=gtkEquChannel3; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); + str[0]=gtkEquChannel4; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); + } + if ( guiInfo.AudioType > 4 ) + { + str[0]=gtkEquChannel5; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); + str[0]=gtkEquChannel6; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str); + } + gtk_clist_select_row( GTK_CLIST( ChannelsList ),0,0 ); +} + +void ShowEqualizer( void ) +{ + if ( Equalizer ) gtkActive( Equalizer ); + else Equalizer=create_Equalizer(); + + if ( !gtkEquChannel1 ) gtkEquChannel1=strdup( MSGTR_EQU_Front_Right ); + if ( !gtkEquChannel2 ) gtkEquChannel2=strdup( MSGTR_EQU_Front_Left ); + if ( !gtkEquChannel3 ) gtkEquChannel3=strdup( MSGTR_EQU_Back_Right ); + if ( !gtkEquChannel4 ) gtkEquChannel4=strdup( MSGTR_EQU_Back_Left ); + if ( !gtkEquChannel5 ) gtkEquChannel5=strdup( MSGTR_EQU_Center ); + if ( !gtkEquChannel6 ) gtkEquChannel6=strdup( MSGTR_EQU_Bass ); + + eqSetChannelNames(); + + if ( !guiInfo.Playing || !guiInfo.sh_video ) + { + gtk_widget_set_sensitive( VContrast,FALSE ); + gtk_widget_set_sensitive( VBrightness,FALSE ); + gtk_widget_set_sensitive( VHue,FALSE ); + gtk_widget_set_sensitive( VSaturation,FALSE ); + } + Channel=-1; + eqSetBands( 0 ); + if ( !guiInfo.Playing || !gtkEnableAudioEqualizer ) + { + gtk_widget_set_sensitive( ChannelsList,FALSE ); + gtk_widget_set_sensitive( A3125,FALSE ); + gtk_widget_set_sensitive( A125,FALSE ); + gtk_widget_set_sensitive( A6250,FALSE ); + gtk_widget_set_sensitive( A250,FALSE ); + gtk_widget_set_sensitive( A500,FALSE ); + gtk_widget_set_sensitive( A1000,FALSE ); + gtk_widget_set_sensitive( A2000,FALSE ); + gtk_widget_set_sensitive( A4000,FALSE ); + gtk_widget_set_sensitive( A8000,FALSE ); + gtk_widget_set_sensitive( A16000,FALSE ); + } + + if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( Notebook ) ) == 0 ) gtk_widget_show( Config ); + gtk_widget_show( Equalizer ); +} + +static void HideEqualizer( void ) +{ + if ( !Equalizer ) return; + gtk_widget_hide( Equalizer ); + gtk_widget_destroy( Equalizer ); + Equalizer=NULL; + if ( EquConfig ) HideEquConfig(); +} + +static gboolean eqHScaleMotion( GtkWidget * widget,GdkEventMotion * event,gpointer user_data ) +{ + equalizer_t eq; + switch ( (int)user_data ) + { + case 0: eq.gain=A3125adj->value; break; + case 1: eq.gain=A6250adj->value; break; + case 2: eq.gain=A125adj->value; break; + case 3: eq.gain=A250adj->value; break; + case 4: eq.gain=A500adj->value; break; + case 5: eq.gain=A1000adj->value; break; + case 6: eq.gain=A2000adj->value; break; + case 7: eq.gain=A4000adj->value; break; + case 8: eq.gain=A8000adj->value; break; + case 9: eq.gain=A16000adj->value; break; + default: return FALSE; + } + eq.gain=0.0f - eq.gain; + eq.band=(int)user_data; + if ( Channel == -1 ) + { + int i; + for ( i=0;i<6;i++ ) + { eq.channel=i; gtkSet( gtkSetEqualizer,0,&eq ); } + } else { eq.channel=Channel; gtkSet( gtkSetEqualizer,0,&eq ); } + + return FALSE; +} + +static gboolean eqVScaleMotion( GtkWidget * widget,GdkEventMotion * event,gpointer user_data ) +{ + + switch( (int)user_data ) + { + case 1: gtkSet( gtkSetContrast,VContrastadj->value,NULL ); break; + case 2: gtkSet( gtkSetBrightness,VBrightnessadj->value,NULL ); break; + case 3: gtkSet( gtkSetHue,VHueadj->value,NULL ); break; + case 4: gtkSet( gtkSetSaturation,VSaturationadj->value,NULL ); break; + } + + return FALSE; +} + +static void eqButtonReleased( GtkButton * button,gpointer user_data ) +{ + switch( (int)user_data ) + { + case 0: HideEqualizer(); break; + case 1: + if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( Notebook ) ) == 0 ) + { + if ( !guiInfo.Playing || !gtkEnableAudioEqualizer ) break; + gtkSet( gtkSetEqualizer,0,NULL ); + eqSetBands( Channel ); + } + else + { + if ( !guiInfo.Playing ) break; + gtkSet( gtkSetContrast,0.0f,NULL ); + gtkSet( gtkSetBrightness,0.0f,NULL ); + gtkSet( gtkSetHue,0.0f,NULL ); + gtkSet( gtkSetSaturation,0.0f,NULL ); + eqSetBands( Channel ); + } + break; + case 2: + ShowEquConfig(); + break; + } +} + +static void eqFocus( GtkWindow * window,GtkWidget * widget,gpointer user_data ) +{ eqSetBands( Channel ); } + +static void eqSelectChannelsListRow( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data ) +{ + Channel=row - 1; + eqSetBands( Channel ); + if ( Channel == -1 ) + { + int i,j; equalizer_t eq; + for ( i=1;i<6;i++ ) + for ( j=0;j<10;j++ ) + { eq.band=j; eq.channel=i; eq.gain=gtkEquChannels[0][j]; gtkSet( gtkSetEqualizer,0,&eq ); } + } +} + +static void eqNotebook( GtkNotebook * notebook, GtkNotebookPage * page, + gint page_num, gpointer user_data ) +{ + if ( page_num ) gtk_widget_hide( Config ); + else gtk_widget_show( Config ); +} + +GtkWidget * create_Equalizer( void ) +{ + GtkWidget * vbox1; + GtkWidget * hbox1; + GtkWidget * scrolledwindow1; + GtkWidget * table1; + GtkWidget * hbuttonbox1; + GtkAccelGroup * accel_group; + + accel_group=gtk_accel_group_new(); + + Equalizer=gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_name( Equalizer,MSGTR_Equalizer ); + gtk_object_set_data( GTK_OBJECT( Equalizer ),MSGTR_Equalizer,Equalizer ); + gtk_widget_set_usize( Equalizer,-1,256 ); + gtk_window_set_title( GTK_WINDOW( Equalizer ),MSGTR_Equalizer ); + gtk_window_set_position( GTK_WINDOW( Equalizer ),GTK_WIN_POS_CENTER ); + gtk_window_set_policy( GTK_WINDOW( Equalizer ),FALSE,FALSE,FALSE ); + gtk_window_set_wmclass( GTK_WINDOW( Equalizer ),"Equalizer","MPlayer" ); + + gtk_widget_realize( Equalizer ); + gtkAddIcon( Equalizer ); + + vbox1=AddVBox( AddDialogFrame( Equalizer ),0 ); + + Notebook=gtk_notebook_new(); + gtk_widget_set_name( Notebook,"Notebook" ); + gtk_widget_show( Notebook ); + gtk_box_pack_start( GTK_BOX( vbox1 ),Notebook,TRUE,TRUE,0 ); + gtk_container_set_border_width( GTK_CONTAINER( Notebook ),1 ); + + hbox1=AddHBox( Notebook,0 ); + + scrolledwindow1=gtk_scrolled_window_new( NULL,NULL ); + gtk_widget_set_name( scrolledwindow1,"scrolledwindow1" ); + gtk_widget_show( scrolledwindow1 ); + gtk_box_pack_start( GTK_BOX( hbox1 ),scrolledwindow1,FALSE,FALSE,0 ); + gtk_widget_set_usize( scrolledwindow1,106,-2 ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC ); + + ChannelsList=gtk_clist_new( 1 ); + gtk_widget_set_name( ChannelsList,"ChannelsList" ); + gtk_widget_show( ChannelsList ); + gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),ChannelsList ); + gtk_clist_set_column_width( GTK_CLIST( ChannelsList ),0,80 ); + gtk_clist_column_titles_hide( GTK_CLIST( ChannelsList ) ); + + table1=gtk_table_new( 2,10,FALSE ); + gtk_widget_set_name( table1,"table1" ); + gtk_widget_show( table1 ); + gtk_box_pack_start( GTK_BOX( hbox1 ),table1,FALSE,FALSE,0 ); + gtk_table_set_row_spacings( GTK_TABLE( table1 ),4 ); + gtk_table_set_col_spacings( GTK_TABLE( table1 ),9 ); + + A3125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); + A3125=AddVScaler( A3125adj,NULL,-1 ); + gtk_table_attach( GTK_TABLE( table1 ),A3125,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); + + A6250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); + A6250=AddVScaler( A6250adj,NULL,-1 ); + gtk_table_attach( GTK_TABLE( table1 ),A6250,1,2,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); + + A125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); + A125=AddVScaler( A125adj,NULL,-1 ); + gtk_table_attach( GTK_TABLE( table1 ),A125,2,3,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); + + A250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); + A250=AddVScaler( A250adj,NULL,-1 ); + gtk_table_attach( GTK_TABLE( table1 ),A250,3,4,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); + + A500adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); + A500=AddVScaler( A500adj,NULL,-1 ); + gtk_table_attach( GTK_TABLE( table1 ),A500,4,5,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); + + A1000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); + A1000=AddVScaler( A1000adj,NULL,-1 ); + gtk_table_attach( GTK_TABLE( table1 ),A1000,5,6,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); + + A2000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); + A2000=AddVScaler( A2000adj,NULL,-1 ); + gtk_table_attach( GTK_TABLE( table1 ),A2000,6,7,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); + + A4000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); + A4000=AddVScaler( A4000adj,NULL,-1 ); + gtk_table_attach( GTK_TABLE( table1 ),A4000,7,8,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); + + A8000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); + A8000=AddVScaler( A8000adj,NULL,-1 ); + gtk_table_attach( GTK_TABLE( table1 ),A8000,8,9,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); + + A16000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) ); + A16000=AddVScaler( A16000adj,NULL,-1 ); + gtk_table_attach( GTK_TABLE( table1 ),A16000,9,10,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( "31.25",NULL ), + 0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( "62.50",NULL ), + 1,2,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( "125",NULL ), + 2,3,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( "250",NULL ), + 3,4,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( "500",NULL ), + 4,5,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( "1000",NULL ), + 5,6,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( "2000",NULL ), + 6,7,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( "4000",NULL ), + 7,8,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( "8000",NULL ), + 8,9,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( "16000",NULL ), + 9,10,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_notebook_set_tab_label( GTK_NOTEBOOK( Notebook ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( Notebook ),0 ), + AddLabel( MSGTR_EQU_Audio,NULL ) ); + + table1=gtk_table_new( 4,2,FALSE ); + gtk_widget_set_name( table1,"table1" ); + gtk_widget_show( table1 ); + gtk_container_add( GTK_CONTAINER( Notebook ),table1 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( MSGTR_EQU_Contrast,NULL ), + 0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( MSGTR_EQU_Brightness,NULL ), + 0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( MSGTR_EQU_Hue,NULL ), + 0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( MSGTR_EQU_Saturation,NULL ), + 0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + VContrastadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); + VContrast=AddHScaler( VContrastadj,NULL,1 ); + gtk_table_attach( GTK_TABLE( table1 ),VContrast,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + gtk_widget_set_usize( VContrast,-1,45 ); + + VBrightnessadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); + VBrightness=AddHScaler( VBrightnessadj,NULL,1 ); + gtk_table_attach( GTK_TABLE( table1 ),VBrightness,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + gtk_widget_set_usize( VBrightness,-1,45 ); + + VHueadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); + VHue=AddHScaler( VHueadj,NULL,1 ); + gtk_table_attach( GTK_TABLE( table1 ),VHue,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + gtk_widget_set_usize( VHue,-1,45 ); + + VSaturationadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) ); + VSaturation=AddHScaler( VSaturationadj,NULL,1 ); + gtk_table_attach( GTK_TABLE( table1 ),VSaturation,1,2,3,4,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + gtk_widget_set_usize( VSaturation,-1,45 ); + + gtk_notebook_set_tab_label( GTK_NOTEBOOK( Notebook ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( Notebook ),1 ), + AddLabel( MSGTR_EQU_Video,NULL ) ); + + AddHSeparator( vbox1 ); + + hbuttonbox1=AddHButtonBox( vbox1 ); + gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); + gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); + + Config=AddButton( MSGTR_Config,hbuttonbox1 ); + Clear=AddButton( MSGTR_Clear,hbuttonbox1 ); + Ok=AddButton( MSGTR_Ok,hbuttonbox1 ); + + gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); + + gtk_signal_connect( GTK_OBJECT( Equalizer ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&Equalizer ); + gtk_signal_connect( GTK_OBJECT( Equalizer ),"focus_in_event",GTK_SIGNAL_FUNC( eqFocus ),(void *)2 ); + + gtk_signal_connect( GTK_OBJECT( ChannelsList ),"select_row",GTK_SIGNAL_FUNC( eqSelectChannelsListRow ),NULL ); + + gtk_signal_connect( GTK_OBJECT( A3125 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)0 ); + gtk_signal_connect( GTK_OBJECT( A6250 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)1 ); + gtk_signal_connect( GTK_OBJECT( A125 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)2 ); + gtk_signal_connect( GTK_OBJECT( A250 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)3 ); + gtk_signal_connect( GTK_OBJECT( A500 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)4 ); + gtk_signal_connect( GTK_OBJECT( A1000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)5 ); + gtk_signal_connect( GTK_OBJECT( A2000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)6 ); + gtk_signal_connect( GTK_OBJECT( A4000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)7 ); + gtk_signal_connect( GTK_OBJECT( A8000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)8 ); + gtk_signal_connect( GTK_OBJECT( A16000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)9 ); + + gtk_signal_connect( GTK_OBJECT( VContrast ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void*)1 ); + gtk_signal_connect( GTK_OBJECT( VBrightness ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void*)2 ); + gtk_signal_connect( GTK_OBJECT( VHue ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void*)3 ); + gtk_signal_connect( GTK_OBJECT( VSaturation ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void *)4 ); + + gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( eqButtonReleased ),(void *)0 ); + gtk_signal_connect( GTK_OBJECT( Clear ),"clicked",GTK_SIGNAL_FUNC( eqButtonReleased ),(void *)1 ); + gtk_signal_connect( GTK_OBJECT( Config ),"clicked",GTK_SIGNAL_FUNC( eqButtonReleased ),(void *)2 ); + + gtk_signal_connect( GTK_OBJECT( Notebook ),"switch_page",GTK_SIGNAL_FUNC( eqNotebook ),NULL ); + + gtk_window_add_accel_group( GTK_WINDOW( Equalizer ),accel_group ); + + return Equalizer; +} + +// --- equalizer config dialog box + +static GtkWidget * CBChannel1; +static GtkWidget * CEChannel1; +static GtkWidget * CBChannel2; +static GtkWidget * CEChannel2; +static GtkWidget * CBChannel3; +static GtkWidget * CEChannel3; +static GtkWidget * CBChannel4; +static GtkWidget * CEChannel4; +static GtkWidget * CBChannel5; +static GtkWidget * CEChannel5; +static GtkWidget * CBChannel6; +static GtkWidget * CEChannel6; +static GtkWidget * ecOk; +static GtkWidget * ecCancel; + +GtkWidget * create_EquConfig( void ); + +void ShowEquConfig( void ) +{ + GList * Items = NULL; + + if ( EquConfig ) gtkActive( EquConfig ); + else EquConfig=create_EquConfig(); + + Items=g_list_append( Items,(gpointer)MSGTR_EQU_Front_Right ); + Items=g_list_append( Items,(gpointer)MSGTR_EQU_Front_Left ); + Items=g_list_append( Items,(gpointer)MSGTR_EQU_Back_Right ); + Items=g_list_append( Items,(gpointer)MSGTR_EQU_Back_Left ); + Items=g_list_append( Items,(gpointer)MSGTR_EQU_Center ); + Items=g_list_append( Items,(gpointer)MSGTR_EQU_Bass ); + + gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel1 ),Items ); + gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel2 ),Items ); + gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel3 ),Items ); + gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel4 ),Items ); + gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel5 ),Items ); + gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel6 ),Items ); + + g_list_free( Items ); + + gtk_entry_set_text( GTK_ENTRY( CEChannel1 ),gtkEquChannel1 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel1 ),FALSE ); + gtk_entry_set_text( GTK_ENTRY( CEChannel2 ),gtkEquChannel2 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel2 ),FALSE ); + gtk_entry_set_text( GTK_ENTRY( CEChannel3 ),gtkEquChannel3 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel3 ),FALSE ); + gtk_entry_set_text( GTK_ENTRY( CEChannel4 ),gtkEquChannel4 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel4 ),FALSE ); + gtk_entry_set_text( GTK_ENTRY( CEChannel5 ),gtkEquChannel5 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel5 ),FALSE ); + gtk_entry_set_text( GTK_ENTRY( CEChannel6 ),gtkEquChannel6 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel6 ),FALSE ); + + gtk_widget_show( EquConfig ); + gtkSetLayer( EquConfig ); +} + +void HideEquConfig( void ) +{ + if ( !EquConfig ) return; + gtk_widget_hide( EquConfig ); + gtk_widget_destroy( EquConfig ); + EquConfig=NULL; +} + +static void ecButtonReleased( GtkButton * button,gpointer user_data ) +{ + if ( (int)user_data ) + { // if you pressed Ok + gfree( (void **)>kEquChannel1 ); gtkEquChannel1=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel1 ) ) ); + gfree( (void **)>kEquChannel2 ); gtkEquChannel2=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel2 ) ) ); + gfree( (void **)>kEquChannel3 ); gtkEquChannel3=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel3 ) ) ); + gfree( (void **)>kEquChannel4 ); gtkEquChannel4=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel4 ) ) ); + gfree( (void **)>kEquChannel5 ); gtkEquChannel5=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel5 ) ) ); + gfree( (void **)>kEquChannel6 ); gtkEquChannel6=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel6 ) ) ); + eqSetChannelNames(); + } + HideEquConfig(); +} + +GtkWidget * create_EquConfig( void ) +{ + GtkWidget * vbox1; + GtkWidget * table1; + GtkWidget * hbuttonbox1; + GtkAccelGroup * accel_group; + + accel_group=gtk_accel_group_new(); + + EquConfig=gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_name( EquConfig,"EquConfig" ); + gtk_object_set_data( GTK_OBJECT( EquConfig ),"EquConfig",EquConfig ); + gtk_widget_set_usize( EquConfig,350,260 ); + GTK_WIDGET_SET_FLAGS( EquConfig,GTK_CAN_DEFAULT ); + gtk_window_set_title( GTK_WINDOW( EquConfig ),MSGTR_ConfigureEqualizer ); + gtk_window_set_position( GTK_WINDOW( EquConfig ),GTK_WIN_POS_CENTER ); +// gtk_window_set_modal( GTK_WINDOW( EquConfig ),TRUE ); + gtk_window_set_policy( GTK_WINDOW( EquConfig ),FALSE,FALSE,FALSE ); + gtk_window_set_wmclass( GTK_WINDOW( EquConfig ),"EquConfig","MPlayer" ); + + gtk_widget_realize( EquConfig ); + gtkAddIcon( EquConfig ); + + vbox1=AddVBox( AddDialogFrame( EquConfig ),0 ); + + table1=gtk_table_new( 6,2,FALSE ); + gtk_widget_set_name( table1,"table1" ); + gtk_widget_show( table1 ); + gtk_box_pack_start( GTK_BOX( vbox1 ),table1,TRUE,TRUE,0 ); + gtk_table_set_row_spacings( GTK_TABLE( table1 ),4 ); + gtk_table_set_col_spacings( GTK_TABLE( table1 ),4 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( MSGTR_EQU_Channel1,NULL ), + 0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( MSGTR_EQU_Channel2,NULL ), + 0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( MSGTR_EQU_Channel3,NULL ), + 0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( MSGTR_EQU_Channel4,NULL ), + 0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( MSGTR_EQU_Channel5,NULL ), + 0,1,4,5,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + gtk_table_attach( GTK_TABLE( table1 ), + AddLabel( MSGTR_EQU_Channel6,NULL ), + 0,1,5,6,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + CBChannel1=AddComboBox( NULL ); + gtk_table_attach( GTK_TABLE( table1 ),CBChannel1,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + CEChannel1=GTK_COMBO( CBChannel1 )->entry; + gtk_widget_set_name( CEChannel1,"CEChannel1" ); + gtk_widget_show( CEChannel1 ); + + CBChannel2=AddComboBox( NULL ); + gtk_table_attach( GTK_TABLE( table1 ),CBChannel2,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + CEChannel2=GTK_COMBO( CBChannel2 )->entry; + gtk_widget_set_name( CEChannel2,"CEChannel2" ); + gtk_widget_show( CEChannel2 ); + + CBChannel3=AddComboBox( NULL ); + gtk_table_attach( GTK_TABLE( table1 ),CBChannel3,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + CEChannel3=GTK_COMBO( CBChannel3 )->entry; + gtk_widget_set_name( CEChannel3,"CEChannel3" ); + gtk_widget_show( CEChannel3 ); + + CBChannel4=AddComboBox( NULL ); + gtk_table_attach( GTK_TABLE( table1 ),CBChannel4,1,2,3,4,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + CEChannel4=GTK_COMBO( CBChannel4 )->entry; + gtk_widget_set_name( CEChannel4,"CEChannel4" ); + gtk_widget_show( CEChannel4 ); + + CBChannel5=AddComboBox( NULL ); + gtk_table_attach( GTK_TABLE( table1 ),CBChannel5,1,2,4,5,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + CEChannel5=GTK_COMBO( CBChannel5 )->entry; + gtk_widget_set_name( CEChannel5,"CEChannel5" ); + gtk_widget_show( CEChannel5 ); + + CBChannel6=AddComboBox( NULL ); + gtk_table_attach( GTK_TABLE( table1 ),CBChannel6,1,2,5,6,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + CEChannel6=GTK_COMBO( CBChannel6 )->entry; + gtk_widget_set_name( CEChannel6,"CEChannel6" ); + gtk_widget_show( CEChannel6 ); + + AddHSeparator( vbox1 ); + + hbuttonbox1=AddHButtonBox( vbox1 ); + gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); + gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); + + ecOk=AddButton( MSGTR_Ok,hbuttonbox1 ); + ecCancel=AddButton( MSGTR_Cancel,hbuttonbox1 ); + + gtk_widget_add_accelerator( ecOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( ecCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); + + gtk_signal_connect( GTK_OBJECT( EquConfig ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&EquConfig ); + + gtk_signal_connect( GTK_OBJECT( ecOk ),"clicked",GTK_SIGNAL_FUNC( ecButtonReleased ),(void *)1 ); + gtk_signal_connect( GTK_OBJECT( ecCancel ),"clicked",GTK_SIGNAL_FUNC( ecButtonReleased ),(void *)0 ); + + gtk_window_add_accel_group( GTK_WINDOW( EquConfig ),accel_group ); + + return EquConfig; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/equalizer.h Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,29 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_GUI_EQUALIZER_H +#define MPLAYER_GUI_EQUALIZER_H + +#include <gtk/gtk.h> + +extern GtkWidget * Equalizer; + +GtkWidget * create_Equalizer( void ); +void ShowEqualizer( void ); + +#endif /* MPLAYER_GUI_EQUALIZER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/fileselect.c Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,710 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <glob.h> +#include <unistd.h> + +#include "config.h" +#include "gui/ui/gmplayer.h" + +#include "gui/ui/pixmaps/up.xpm" +#include "gui/ui/pixmaps/dir.xpm" +#include "gui/ui/pixmaps/file.xpm" + +#include "gui/app.h" +#include "gui/interface.h" +#include "help_mp.h" +#include "mpcommon.h" +#include "stream/stream.h" + +#include "gui/ui/widgets.h" +#include "fileselect.h" +#include "preferences.h" +#include "tools.h" + +#ifndef __linux__ +#define get_current_dir_name() getcwd(NULL, PATH_MAX) +#else +char * get_current_dir_name( void ); +#endif + +gchar * fsSelectedFile = NULL; +gchar * fsSelectedFileUtf8 = NULL; +gchar * fsSelectedDirectory = NULL; +unsigned char * fsThatDir = "."; +const gchar * fsFilter = "*"; + +int fsType = 0; + +char * fsVideoFilterNames[][2] = + { + { "ASF files (*.asf)", "*.asf" }, + { "AVI files (*.avi)", "*.avi" }, + { "Autodesk animations (*.fli,*.flc)", "*.fli,*.flc" }, + { "DGStation Cuberevo recordings (*.trp)", "*.trp" }, + { "DiVX files (*.divx)", "*.divx" }, + { "MP3 files (*.mp3,*.mp2)", "*.mp3,*.mp2" }, + { "MPEG files (*.mpg,*.mpeg,*.m1v)", "*.mpg,*.mpeg,*.m1v" }, + { "Macromedia Flash Video (*.flv)", "*.flv" }, + { "Matroska Audio files (*.mka)", "*.mka" }, + { "Matroska Media files (*.mkv)", "*.mkv" }, + { "NuppelVideo files (*.nuv)", "*.nuv" }, + { "OGG Vorbis files (*.ogg)", "*.ogg" }, + { "OGG Media files (*.ogm)", "*.ogm" }, + { "QuickTime files (*.mov,*.qt,*.mp4)", "*.mov,*.qt,*.mp4" }, + { "RealVideo files (*.rm,*.rmvb)", "*.rm,*.rmvb" }, + { "Tivo files (*.ty)", "*.ty" }, + { "VCD/SVCD Images (*.bin)", "*.bin" }, + { "VIVO files (*.viv)", "*.viv" }, + { "VOB files (*.vob)", "*.vob" }, + { "Wave files (*.wav)", "*.wav" }, + { "Windows Media Audio (*.wma)", "*.wma" }, + { "Windows Media Video (*.wmv)", "*.wmv" }, + { "Audio files", "*.mp2,*.mp3,*.mka,*.ogg,*.wav,*.wma" }, + { "Video files", "*.asf,*.avi,*.fli,*.flc,*.trp,*.divx,*.mpg,*.mpeg,*.m1v,*.flv,*.mkv,*.nuv,*.ogm,*.mov,*.qt,*.mp4,*.rm,*.rmvb,*.ty,*.bin,*.viv,*.vob,*.wmv" }, + { "All files", "*" }, + { NULL,NULL } + }; +int fsLastVideoFilterSelected = -1; + +char * fsSubtitleFilterNames[][2] = + { + { "AQT (*.aqt)", "*.aqt" }, + { "ASS (*.ass)", "*.ass" }, + { "RT (*.rt) ", "*.rt" }, + { "SMI (*.smi)", "*.smi" }, + { "SRT (*.srt)", "*.srt" }, + { "SSA (*.ssa)", "*.ssa" }, + { "SUB (*.sub)", "*.sub" }, + { "TXT (*.txt)", "*.txt" }, + { "UTF (*.utf)", "*.utf" }, + { "Subtitles", "*.aqt,*.ass,*.rt,*.smi,*.srt,*.ssa,*.sub,*.txt,*.utf" }, + { "All files", "*" }, + { NULL,NULL } + }; +int fsLastSubtitleFilterSelected = -1; + +char * fsOtherFilterNames[][2] = + { + { "All files", "*" }, + { NULL,NULL } + }; + +char * fsAudioFileNames[][2] = + { + { "MP3 files (*.mp2, *.mp3)", "*.mp2,*.mp3" }, + { "Matroska Audio files (*.mka)", "*.mka" }, + { "OGG Vorbis files (*.ogg)", "*.ogg" }, + { "WAV files (*.wav)", "*.wav" }, + { "WMA files (*.wma)", "*.wma" }, + { "Audio files", "*.mp2,*.mp3,*.mka,*.ogg,*.wav,*.wma" }, + { "All files", "*" }, + { NULL, NULL } + }; +int fsLastAudioFilterSelected = -1; + +char * fsFontFileNames[][2] = + { +#ifdef CONFIG_FREETYPE + { "True Type fonts (*.ttf)", "*.ttf" }, + { "Type1 fonts (*.pfb)", "*.pfb" }, + { "All fonts", "*.ttf,*.pfb" }, +#else + { "Font files (*.desc)", "*.desc" }, +#endif + { "All files", "*" }, + { NULL,NULL } + }; +int fsLastFontFilterSelected = -1; + +GtkWidget * fsFileNamesList; +GtkWidget * fsFNameList; +GtkWidget * fsFileSelect = NULL; +GdkColormap * fsColorMap; +GtkWidget * fsOk; +GtkWidget * fsUp; +GtkWidget * fsCancel; +GtkWidget * fsCombo4; +GtkWidget * fsPathCombo; +GList * fsList_items = NULL; +GList * fsTopList_items = NULL; +GtkWidget * List; +GtkWidget * fsFilterCombo; + +GtkStyle * style; +GdkPixmap * dpixmap; +GdkPixmap * fpixmap; +GdkBitmap * dmask; +GdkBitmap * fmask; + +static char * get_current_dir_name_utf8( void ) +{ + char * dir, * utf8dir; + dir = get_current_dir_name(); + utf8dir = g_filename_to_utf8( dir, -1, NULL, NULL, NULL ); + if ( !utf8dir ) utf8dir = g_strdup( dir ); + free( dir ); + return utf8dir; +} + +static char * Filter( const char * name ) +{ + static char tmp[32]; + int i,c; + for ( i=0,c=0;i < strlen( name );i++ ) + { + if ( ( name[i] >='a' )&&( name[i] <= 'z' ) ) { tmp[c++]='['; tmp[c++]=name[i]; tmp[c++]=name[i] - 32; tmp[c++]=']'; } + else tmp[c++]=name[i]; + } + tmp[c]=0; + return tmp; +} + +static void clist_append_fname(GtkWidget * list, char *fname, + GdkPixmap *pixmap, GdkPixmap *mask) { + gint pos; + gchar *filename, *str[2]; + filename = g_filename_to_utf8(fname, -1, NULL, NULL, NULL); + str[0] = NULL; + str[1] = filename ? filename : fname; + pos = gtk_clist_append(GTK_CLIST(list), str); + gtk_clist_set_pixmap(GTK_CLIST(list), pos, 0, pixmap, mask); + g_free(filename); +} + +static void CheckDir( GtkWidget * list ) +{ + struct stat fs; + int i; + glob_t gg; + + if ( !fsFilter[0] ) return; + + gtk_widget_hide( list ); + gtk_clist_clear( GTK_CLIST( list ) ); + + clist_append_fname(list, ".", dpixmap, dmask); + clist_append_fname(list, "..", dpixmap, dmask); + + glob( "*",0,NULL,&gg ); + for( i=0;(unsigned)i<gg.gl_pathc;i++ ) + { + stat( gg.gl_pathv[i],&fs ); + if( !S_ISDIR( fs.st_mode ) ) continue; + clist_append_fname(list, gg.gl_pathv[i], dpixmap, dmask); + } + globfree( &gg ); + + if ( strchr( fsFilter,',' ) ) + { + char tmp[8]; + int i,c,glob_param = 0; + for ( i=0,c=0;i<(int)strlen( fsFilter ) + 1;i++,c++ ) + { + tmp[c]=fsFilter[i]; + if ( ( tmp[c] == ',' )||( tmp[c] == '\0' ) ) + { + tmp[c]=0; c=-1; + glob( Filter( tmp ),glob_param,NULL,&gg ); + glob_param=GLOB_APPEND; + } + } + } else glob( Filter( fsFilter ),0,NULL,&gg ); + + for( i=0;(unsigned)i<gg.gl_pathc;i++ ) + { + stat( gg.gl_pathv[i],&fs ); + if( S_ISDIR( fs.st_mode ) ) continue; + clist_append_fname(list, gg.gl_pathv[i], fpixmap, fmask); + } + globfree( &gg ); + + gtk_clist_set_column_width( GTK_CLIST( list ),0,17 ); + gtk_clist_select_row( GTK_CLIST( list ),0,1 ); + gtk_widget_show( list ); +} + +void ShowFileSelect( int type,int modal ) +{ + int i, k; + char * tmp = NULL; + + if ( fsFileSelect ) gtkActive( fsFileSelect ); + else fsFileSelect=create_FileSelect(); + + fsType=type; + switch ( type ) + { + case fsVideoSelector: + gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect ); + fsList_items=NULL; + for( i=0;fsVideoFilterNames[i][0];i++ ) + fsList_items=g_list_append( fsList_items,fsVideoFilterNames[i][0] ); + k = fsLastVideoFilterSelected; + gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); + g_list_free( fsList_items ); + gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsVideoFilterNames[k >= 0 ? k : i-2][0] ); + tmp=guiInfo.Filename; + break; + case fsSubtitleSelector: + gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_SubtitleSelect ); + fsList_items=NULL; + for( i=0;fsSubtitleFilterNames[i][0];i++ ) + fsList_items=g_list_append( fsList_items,fsSubtitleFilterNames[i][0] ); + k = fsLastSubtitleFilterSelected; + gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); + g_list_free( fsList_items ); + gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsSubtitleFilterNames[k >= 0 ? k : i-2][0] ); + tmp=guiInfo.Subtitlename; + break; + case fsOtherSelector: + gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_OtherSelect ); + fsList_items=NULL; + for( i=0;fsOtherFilterNames[i][0];i++ ) + fsList_items=g_list_append( fsList_items,fsOtherFilterNames[i][0] ); + gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); + g_list_free( fsList_items ); + gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsOtherFilterNames[0][0] ); + tmp=guiInfo.Othername; + break; + case fsAudioSelector: + gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_AudioFileSelect ); + fsList_items=NULL; + for( i=0;fsAudioFileNames[i][0];i++ ) + fsList_items=g_list_append( fsList_items,fsAudioFileNames[i][0] ); + k = fsLastAudioFilterSelected; + gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); + g_list_free( fsList_items ); + gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsAudioFileNames[k >= 0 ? k : i-2][0] ); + tmp=guiInfo.AudioFile; + break; + case fsFontSelector: + gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FontSelect ); + fsList_items=NULL; + for( i=0;fsFontFileNames[i][0];i++ ) + fsList_items=g_list_append( fsList_items,fsFontFileNames[i][0] ); + k = fsLastFontFilterSelected; + gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); + g_list_free( fsList_items ); + gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsFontFileNames[k >= 0 ? k : i-2][0] ); + tmp=font_name; + break; + } + + if ( tmp && tmp[0] ) + { + struct stat f; + char * dir = strdup( tmp ); + + do + { + char * c = strrchr( dir,'/' ); + stat( dir,&f ); + if ( S_ISDIR( f.st_mode ) ) break; + if ( c ) *c=0; + } while ( strrchr( dir,'/' ) ); + + if ( dir[0] ) chdir( dir ); + + free( dir ); + } + + if ( fsTopList_items ) g_list_free( fsTopList_items ); fsTopList_items=NULL; + { + int i, c = 1; + + if ( fsType == fsVideoSelector ) + { + 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_utf8() ); + } + if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) ); + fsTopList_items=g_list_append( fsTopList_items,"/home" ); + fsTopList_items=g_list_append( fsTopList_items,"/mnt" ); + fsTopList_items=g_list_append( fsTopList_items,"/" ); + gtk_combo_set_popdown_strings( GTK_COMBO( fsCombo4 ),fsTopList_items ); + + gtk_window_set_modal( GTK_WINDOW( fsFileSelect ),modal ); + + gtk_widget_show( fsFileSelect ); +} + +void HideFileSelect( void ) +{ + if ( !fsFileSelect ) return; + gtk_widget_hide( fsFileSelect ); + gtk_widget_destroy( fsFileSelect ); + fsFileSelect=NULL; +} + +static void fs_PersistantHistory( char * subject ) +{ + int i; + + if ( fsType != fsVideoSelector ) return; + + for ( i=0;i < fsPersistant_MaxPos;i++ ) + if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) ) + { + char * tmp = fsHistory[i]; fsHistory[i]=fsHistory[0]; fsHistory[0]=tmp; + return; + } + gfree( (void **)&fsHistory[fsPersistant_MaxPos - 1] ); + for ( i=fsPersistant_MaxPos - 1;i;i-- ) fsHistory[i]=fsHistory[i - 1]; + fsHistory[0]=gstrdup( subject ); +} +//----------------------------------------------- + +static void fs_fsFilterCombo_activate( GtkEditable * editable, + gpointer user_data ) +{ + fsFilter=gtk_entry_get_text( GTK_ENTRY( user_data ) ); + CheckDir( fsFNameList ); +} + +static void fs_fsFilterCombo_changed( GtkEditable * editable, + gpointer user_data ) +{ + const char * str; + int i; + + str=gtk_entry_get_text( GTK_ENTRY(user_data ) ); + + switch ( fsType ) + { + case fsVideoSelector: + for( i=0;fsVideoFilterNames[i][0];i++ ) + if( !strcmp( str,fsVideoFilterNames[i][0] ) ) + { fsFilter=fsVideoFilterNames[i][1]; fsLastVideoFilterSelected = i; break; } + break; + case fsSubtitleSelector: + for( i=0;fsSubtitleFilterNames[i][0];i++ ) + if( !strcmp( str,fsSubtitleFilterNames[i][0] ) ) + { fsFilter=fsSubtitleFilterNames[i][1]; fsLastSubtitleFilterSelected = i; break; } + break; + case fsOtherSelector: + for( i=0;fsOtherFilterNames[i][0];i++ ) + if( !strcmp( str,fsOtherFilterNames[i][0] ) ) + { fsFilter=fsOtherFilterNames[i][1]; break; } + break; + case fsAudioSelector: + for( i=0;fsAudioFileNames[i][0];i++ ) + if( !strcmp( str,fsAudioFileNames[i][0] ) ) + { fsFilter=fsAudioFileNames[i][1]; fsLastAudioFilterSelected = i; break; } + break; + case fsFontSelector: + for( i=0;fsFontFileNames[i][0];i++ ) + if( !strcmp( str,fsFontFileNames[i][0] ) ) + { fsFilter=fsFontFileNames[i][1]; fsLastFontFilterSelected = i; break; } + break; + default: return; + } + CheckDir( fsFNameList ); +} + +static void fs_fsPathCombo_activate( GtkEditable * editable, + gpointer user_data ) +{ + const unsigned char * str; + gchar * dirname; + + str=gtk_entry_get_text( GTK_ENTRY( user_data ) ); + dirname = g_filename_from_utf8( str, -1, NULL, NULL, NULL ); + if ( chdir( dirname ? (const unsigned char *)dirname : str ) != -1 ) CheckDir( fsFNameList ); + g_free( dirname ); +} + +static void fs_fsPathCombo_changed( GtkEditable * editable, + gpointer user_data ) +{ + const unsigned char * str; + gchar * dirname; + + str=gtk_entry_get_text( GTK_ENTRY( user_data ) ); + dirname = g_filename_from_utf8( str, -1, NULL, NULL, NULL ); + if ( chdir( dirname ? (const unsigned char *)dirname : str ) != -1 ) CheckDir( fsFNameList ); + g_free( dirname ); +} + +static void fs_Up_released( GtkButton * button, gpointer user_data ) +{ + chdir( ".." ); + fsSelectedFile=fsThatDir; + CheckDir( fsFNameList ); + gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name_utf8() ); + return; +} + +static void fs_Ok_released( GtkButton * button, gpointer user_data ) +{ + GList * item; + int i = 1; + struct stat fs; + + stat( fsSelectedFile,&fs ); + if( S_ISDIR(fs.st_mode ) ) + { + chdir( fsSelectedFile ); + fsSelectedFile=fsThatDir; + CheckDir( fsFNameList ); + gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name_utf8() ); + return; + } + + fsSelectedDirectory=(unsigned char *)get_current_dir_name(); + switch ( fsType ) + { + case fsVideoSelector: + guiSetDF( guiInfo.Filename,fsSelectedDirectory,fsSelectedFile ); + guiInfo.StreamType=STREAMTYPE_FILE; + guiInfo.FilenameChanged=1; sub_fps=0; + gfree( (void **)&guiInfo.AudioFile ); + gfree( (void **)&guiInfo.Subtitlename ); + fs_PersistantHistory( get_current_dir_name_utf8() ); //totem, write into history + break; + case fsSubtitleSelector: + guiSetDF( guiInfo.Subtitlename,fsSelectedDirectory,fsSelectedFile ); + guiLoadSubtitle( guiInfo.Subtitlename ); + break; + case fsOtherSelector: + guiSetDF( guiInfo.Othername,fsSelectedDirectory,fsSelectedFile ); + break; + case fsAudioSelector: + guiSetDF( guiInfo.AudioFile,fsSelectedDirectory,fsSelectedFile ); + break; + case fsFontSelector: + guiSetDF( font_name,fsSelectedDirectory,fsSelectedFile ); + guiLoadFont(); + if ( Preferences ) gtk_entry_set_text( GTK_ENTRY( prEFontName ),font_name ); + break; + } + + HideFileSelect(); + + item=fsTopList_items; + while( item ) + { + if ( !strcmp( item->data,fsSelectedDirectory ) ) i=0; + item=item->next; + } + if ( i ) fsTopList_items=g_list_prepend( fsTopList_items,(gchar *)get_current_dir_name_utf8() ); + if ( uiMainAutoPlay ) { uiMainAutoPlay=0; uiEventHandling( evPlay,0 ); } + else guiGetEvent( guiCEvent,guiSetStop ); +} + +static void fs_Cancel_released( GtkButton * button,gpointer user_data ) +{ + HideFileSelect(); + fs_PersistantHistory( get_current_dir_name_utf8() ); //totem, write into history file +} + +static void fs_fsFNameList_select_row( GtkWidget * widget, gint row, gint column, + GdkEventButton *bevent, gpointer user_data) +{ + gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile ); + g_free( fsSelectedFileUtf8 ); + fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL ); + if ( fsSelectedFileUtf8 ) fsSelectedFile = fsSelectedFileUtf8; + if( bevent && bevent->type == GDK_BUTTON_PRESS ) gtk_button_released( GTK_BUTTON( fsOk ) ); +} + +static gboolean on_FileSelect_key_release_event( GtkWidget * widget, + GdkEventKey * event, + gpointer user_data ) +{ + switch ( event->keyval ) + { + case GDK_Escape: + gtk_button_released( GTK_BUTTON( fsCancel ) ); + break; + case GDK_Return: + gtk_button_released( GTK_BUTTON( fsOk ) ); + break; + case GDK_BackSpace: + gtk_button_released( GTK_BUTTON( fsUp ) ); + break; + } + return FALSE; +} + +static gboolean fs_fsFNameList_event( GtkWidget * widget, + GdkEvent * event, + gpointer user_data ) +{ + GdkEventButton *bevent; + gint row, col; + + (void) user_data; + + bevent = (GdkEventButton *) event; + + if ( event->type == GDK_BUTTON_RELEASE && bevent->button == 2 ) + { + if ( gtk_clist_get_selection_info( GTK_CLIST( widget ), bevent->x, bevent->y, &row, &col ) ) + { + gtk_clist_get_text( GTK_CLIST( widget ), row, 1, &fsSelectedFile ); + g_free( fsSelectedFileUtf8 ); + fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL ); + if ( fsSelectedFileUtf8 ) fsSelectedFile = fsSelectedFileUtf8; + gtk_button_released( GTK_BUTTON( fsOk ) ); + return TRUE; + } + } + + return FALSE; +} + +static void fs_Destroy( void ) +{ + g_free( fsSelectedFileUtf8 ); + fsSelectedFileUtf8 = NULL; + WidgetDestroy( fsFileSelect, &fsFileSelect ); +} + +GtkWidget * create_FileSelect( void ) +{ + GtkWidget * vbox4; + GtkWidget * hbox4; + GtkWidget * vseparator1; + GtkWidget * hbox6; + GtkWidget * fsFNameListWindow; + GtkWidget * hbuttonbox3; + + GtkWidget * uppixmapwid; + GdkPixmap * uppixmap; + GdkBitmap * upmask; + GtkStyle * upstyle; + + + fsFileSelect=gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_name( fsFileSelect,"fsFileSelect" ); + gtk_object_set_data( GTK_OBJECT( fsFileSelect ),"fsFileSelect",fsFileSelect ); + gtk_widget_set_usize( fsFileSelect,512,300 ); + GTK_WIDGET_SET_FLAGS( fsFileSelect,GTK_CAN_DEFAULT ); + gtk_widget_set_events( fsFileSelect,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK ); + gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect ); + gtk_window_set_position( GTK_WINDOW( fsFileSelect ),GTK_WIN_POS_CENTER ); + gtk_window_set_policy( GTK_WINDOW( fsFileSelect ),TRUE,TRUE,TRUE ); + gtk_window_set_wmclass( GTK_WINDOW( fsFileSelect ),"FileSelect","MPlayer" ); + fsColorMap=gdk_colormap_get_system(); + + gtk_widget_realize( fsFileSelect ); + gtkAddIcon( fsFileSelect ); + + style=gtk_widget_get_style( fsFileSelect ); + dpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&dmask,&style->bg[GTK_STATE_NORMAL],(gchar **)dir_xpm ); + fpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&fmask,&style->bg[GTK_STATE_NORMAL],(gchar **)file_xpm ); + + vbox4=AddVBox( AddDialogFrame( fsFileSelect ),0 ); + hbox4=AddHBox( vbox4,1 ); + + fsCombo4=gtk_combo_new(); + gtk_widget_set_name( fsCombo4,"fsCombo4" ); + gtk_widget_show( fsCombo4 ); + gtk_box_pack_start( GTK_BOX( hbox4 ),fsCombo4,TRUE,TRUE,0 ); + gtk_widget_set_usize( fsCombo4,-2,20 ); + + fsPathCombo=GTK_COMBO( fsCombo4 )->entry; + gtk_widget_set_name( fsPathCombo,"fsPathCombo" ); + gtk_widget_show( fsPathCombo ); + gtk_widget_set_usize( fsPathCombo,-2,20 ); + + vseparator1=gtk_vseparator_new(); + gtk_widget_set_name( vseparator1,"vseparator1" ); + gtk_widget_show( vseparator1 ); + gtk_box_pack_start( GTK_BOX( hbox4 ),vseparator1,FALSE,TRUE,0 ); + gtk_widget_set_usize( vseparator1,7,20 ); + + upstyle=gtk_widget_get_style( fsFileSelect ); + uppixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&upmask,&upstyle->bg[GTK_STATE_NORMAL],(gchar **)up_xpm ); + uppixmapwid=gtk_pixmap_new( uppixmap,upmask ); + gtk_widget_show( uppixmapwid ); + + fsUp=gtk_button_new(); + gtk_container_add( GTK_CONTAINER(fsUp ),uppixmapwid ); + gtk_widget_show( fsUp ); + gtk_box_pack_start( GTK_BOX( hbox4 ),fsUp,FALSE,FALSE,0 ); + gtk_widget_set_usize( fsUp,65,15 ); + + AddHSeparator( vbox4 ); + + hbox6=AddHBox( NULL,0 ); + gtk_box_pack_start( GTK_BOX( vbox4 ),hbox6,TRUE,TRUE,0 ); + + fsFNameListWindow=gtk_scrolled_window_new( NULL,NULL ); + gtk_widget_set_name( fsFNameListWindow,"fsFNameListWindow" ); + gtk_widget_show( fsFNameListWindow ); + gtk_box_pack_start( GTK_BOX( hbox6 ),fsFNameListWindow,TRUE,TRUE,0 ); + gtk_widget_set_usize( fsFNameListWindow,-2,145 ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( fsFNameListWindow ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC ); + + fsFNameList=gtk_clist_new( 2 ); + gtk_widget_set_name( fsFNameList,"fsFNameList" ); + gtk_container_add( GTK_CONTAINER( fsFNameListWindow ),fsFNameList ); + gtk_clist_set_column_width( GTK_CLIST( fsFNameList ),0,80 ); + gtk_clist_set_selection_mode( GTK_CLIST( fsFNameList ),GTK_SELECTION_BROWSE ); + gtk_clist_column_titles_hide( GTK_CLIST( fsFNameList ) ); + gtk_clist_set_shadow_type( GTK_CLIST( fsFNameList ),GTK_SHADOW_ETCHED_OUT ); + + AddHSeparator( vbox4 ); + + List=gtk_combo_new(); + gtk_widget_set_name( List,"List" ); + gtk_widget_ref( List ); + gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"List",List,(GtkDestroyNotify)gtk_widget_unref ); + gtk_widget_show( List ); + gtk_box_pack_start( GTK_BOX( vbox4 ),List,FALSE,FALSE,0 ); + gtk_widget_set_usize( List,-2,20 ); + + fsFilterCombo=GTK_COMBO( List )->entry; + gtk_widget_set_name( fsFilterCombo,"fsFilterCombo" ); + gtk_widget_show( fsFilterCombo ); + gtk_entry_set_editable (GTK_ENTRY( fsFilterCombo ),FALSE ); + + AddHSeparator( vbox4 ); + + hbuttonbox3=AddHButtonBox( vbox4 ); + gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox3 ),GTK_BUTTONBOX_END ); + gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox3 ),10 ); + + fsOk=AddButton( MSGTR_Ok,hbuttonbox3 ); + fsCancel=AddButton( MSGTR_Cancel,hbuttonbox3 ); + + gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"destroy",GTK_SIGNAL_FUNC( fs_Destroy ), NULL ); + gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL ); + + gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsFilterCombo_changed ),fsFilterCombo ); + gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsFilterCombo_activate ),fsFilterCombo ); + gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsPathCombo_changed ),fsPathCombo ); + gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsPathCombo_activate ),fsPathCombo ); + gtk_signal_connect( GTK_OBJECT( fsUp ),"released",GTK_SIGNAL_FUNC( fs_Up_released ),fsFNameList ); + gtk_signal_connect( GTK_OBJECT( fsOk ),"released",GTK_SIGNAL_FUNC( fs_Ok_released ),fsCombo4 ); + gtk_signal_connect( GTK_OBJECT( fsCancel ),"released",GTK_SIGNAL_FUNC( fs_Cancel_released ),NULL ); + gtk_signal_connect( GTK_OBJECT( fsFNameList ),"select_row",(GtkSignalFunc)fs_fsFNameList_select_row,NULL ); + gtk_signal_connect( GTK_OBJECT( fsFNameList ),"event", (GtkSignalFunc)fs_fsFNameList_event,NULL ); + + gtk_widget_grab_focus( fsFNameList ); + + return fsFileSelect; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/fileselect.h Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,39 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_GUI_FILESELECT_H +#define MPLAYER_GUI_FILESELECT_H + +#include <gtk/gtk.h> + +#define fsVideoSelector 0 +#define fsSubtitleSelector 1 +#define fsOtherSelector 2 +#define fsAudioSelector 3 +#define fsFontSelector 4 + +#include <errno.h> + +extern GtkWidget * fsFileSelect; + +void HideFileSelect( void ); +void ShowFileSelect( int type, int modal ); + +GtkWidget * create_FileSelect( void ); + +#endif /* MPLAYER_GUI_FILESELECT_H */
--- a/gui/ui/gtk/fs.c Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,710 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <sys/stat.h> -#include <glob.h> -#include <unistd.h> - -#include "config.h" -#include "gui/ui/gmplayer.h" - -#include "gui/ui/pixmaps/up.xpm" -#include "gui/ui/pixmaps/dir.xpm" -#include "gui/ui/pixmaps/file.xpm" - -#include "gui/app.h" -#include "gui/interface.h" -#include "help_mp.h" -#include "mpcommon.h" -#include "stream/stream.h" - -#include "gui/ui/widgets.h" -#include "fs.h" -#include "opts.h" -#include "gtk_common.h" - -#ifndef __linux__ -#define get_current_dir_name() getcwd(NULL, PATH_MAX) -#else -char * get_current_dir_name( void ); -#endif - -gchar * fsSelectedFile = NULL; -gchar * fsSelectedFileUtf8 = NULL; -gchar * fsSelectedDirectory = NULL; -unsigned char * fsThatDir = "."; -const gchar * fsFilter = "*"; - -int fsType = 0; - -char * fsVideoFilterNames[][2] = - { - { "ASF files (*.asf)", "*.asf" }, - { "AVI files (*.avi)", "*.avi" }, - { "Autodesk animations (*.fli,*.flc)", "*.fli,*.flc" }, - { "DGStation Cuberevo recordings (*.trp)", "*.trp" }, - { "DiVX files (*.divx)", "*.divx" }, - { "MP3 files (*.mp3,*.mp2)", "*.mp3,*.mp2" }, - { "MPEG files (*.mpg,*.mpeg,*.m1v)", "*.mpg,*.mpeg,*.m1v" }, - { "Macromedia Flash Video (*.flv)", "*.flv" }, - { "Matroska Audio files (*.mka)", "*.mka" }, - { "Matroska Media files (*.mkv)", "*.mkv" }, - { "NuppelVideo files (*.nuv)", "*.nuv" }, - { "OGG Vorbis files (*.ogg)", "*.ogg" }, - { "OGG Media files (*.ogm)", "*.ogm" }, - { "QuickTime files (*.mov,*.qt,*.mp4)", "*.mov,*.qt,*.mp4" }, - { "RealVideo files (*.rm,*.rmvb)", "*.rm,*.rmvb" }, - { "Tivo files (*.ty)", "*.ty" }, - { "VCD/SVCD Images (*.bin)", "*.bin" }, - { "VIVO files (*.viv)", "*.viv" }, - { "VOB files (*.vob)", "*.vob" }, - { "Wave files (*.wav)", "*.wav" }, - { "Windows Media Audio (*.wma)", "*.wma" }, - { "Windows Media Video (*.wmv)", "*.wmv" }, - { "Audio files", "*.mp2,*.mp3,*.mka,*.ogg,*.wav,*.wma" }, - { "Video files", "*.asf,*.avi,*.fli,*.flc,*.trp,*.divx,*.mpg,*.mpeg,*.m1v,*.flv,*.mkv,*.nuv,*.ogm,*.mov,*.qt,*.mp4,*.rm,*.rmvb,*.ty,*.bin,*.viv,*.vob,*.wmv" }, - { "All files", "*" }, - { NULL,NULL } - }; -int fsLastVideoFilterSelected = -1; - -char * fsSubtitleFilterNames[][2] = - { - { "AQT (*.aqt)", "*.aqt" }, - { "ASS (*.ass)", "*.ass" }, - { "RT (*.rt) ", "*.rt" }, - { "SMI (*.smi)", "*.smi" }, - { "SRT (*.srt)", "*.srt" }, - { "SSA (*.ssa)", "*.ssa" }, - { "SUB (*.sub)", "*.sub" }, - { "TXT (*.txt)", "*.txt" }, - { "UTF (*.utf)", "*.utf" }, - { "Subtitles", "*.aqt,*.ass,*.rt,*.smi,*.srt,*.ssa,*.sub,*.txt,*.utf" }, - { "All files", "*" }, - { NULL,NULL } - }; -int fsLastSubtitleFilterSelected = -1; - -char * fsOtherFilterNames[][2] = - { - { "All files", "*" }, - { NULL,NULL } - }; - -char * fsAudioFileNames[][2] = - { - { "MP3 files (*.mp2, *.mp3)", "*.mp2,*.mp3" }, - { "Matroska Audio files (*.mka)", "*.mka" }, - { "OGG Vorbis files (*.ogg)", "*.ogg" }, - { "WAV files (*.wav)", "*.wav" }, - { "WMA files (*.wma)", "*.wma" }, - { "Audio files", "*.mp2,*.mp3,*.mka,*.ogg,*.wav,*.wma" }, - { "All files", "*" }, - { NULL, NULL } - }; -int fsLastAudioFilterSelected = -1; - -char * fsFontFileNames[][2] = - { -#ifdef CONFIG_FREETYPE - { "True Type fonts (*.ttf)", "*.ttf" }, - { "Type1 fonts (*.pfb)", "*.pfb" }, - { "All fonts", "*.ttf,*.pfb" }, -#else - { "Font files (*.desc)", "*.desc" }, -#endif - { "All files", "*" }, - { NULL,NULL } - }; -int fsLastFontFilterSelected = -1; - -GtkWidget * fsFileNamesList; -GtkWidget * fsFNameList; -GtkWidget * fsFileSelect = NULL; -GdkColormap * fsColorMap; -GtkWidget * fsOk; -GtkWidget * fsUp; -GtkWidget * fsCancel; -GtkWidget * fsCombo4; -GtkWidget * fsPathCombo; -GList * fsList_items = NULL; -GList * fsTopList_items = NULL; -GtkWidget * List; -GtkWidget * fsFilterCombo; - -GtkStyle * style; -GdkPixmap * dpixmap; -GdkPixmap * fpixmap; -GdkBitmap * dmask; -GdkBitmap * fmask; - -static char * get_current_dir_name_utf8( void ) -{ - char * dir, * utf8dir; - dir = get_current_dir_name(); - utf8dir = g_filename_to_utf8( dir, -1, NULL, NULL, NULL ); - if ( !utf8dir ) utf8dir = g_strdup( dir ); - free( dir ); - return utf8dir; -} - -static char * Filter( const char * name ) -{ - static char tmp[32]; - int i,c; - for ( i=0,c=0;i < strlen( name );i++ ) - { - if ( ( name[i] >='a' )&&( name[i] <= 'z' ) ) { tmp[c++]='['; tmp[c++]=name[i]; tmp[c++]=name[i] - 32; tmp[c++]=']'; } - else tmp[c++]=name[i]; - } - tmp[c]=0; - return tmp; -} - -static void clist_append_fname(GtkWidget * list, char *fname, - GdkPixmap *pixmap, GdkPixmap *mask) { - gint pos; - gchar *filename, *str[2]; - filename = g_filename_to_utf8(fname, -1, NULL, NULL, NULL); - str[0] = NULL; - str[1] = filename ? filename : fname; - pos = gtk_clist_append(GTK_CLIST(list), str); - gtk_clist_set_pixmap(GTK_CLIST(list), pos, 0, pixmap, mask); - g_free(filename); -} - -static void CheckDir( GtkWidget * list ) -{ - struct stat fs; - int i; - glob_t gg; - - if ( !fsFilter[0] ) return; - - gtk_widget_hide( list ); - gtk_clist_clear( GTK_CLIST( list ) ); - - clist_append_fname(list, ".", dpixmap, dmask); - clist_append_fname(list, "..", dpixmap, dmask); - - glob( "*",0,NULL,&gg ); - for( i=0;(unsigned)i<gg.gl_pathc;i++ ) - { - stat( gg.gl_pathv[i],&fs ); - if( !S_ISDIR( fs.st_mode ) ) continue; - clist_append_fname(list, gg.gl_pathv[i], dpixmap, dmask); - } - globfree( &gg ); - - if ( strchr( fsFilter,',' ) ) - { - char tmp[8]; - int i,c,glob_param = 0; - for ( i=0,c=0;i<(int)strlen( fsFilter ) + 1;i++,c++ ) - { - tmp[c]=fsFilter[i]; - if ( ( tmp[c] == ',' )||( tmp[c] == '\0' ) ) - { - tmp[c]=0; c=-1; - glob( Filter( tmp ),glob_param,NULL,&gg ); - glob_param=GLOB_APPEND; - } - } - } else glob( Filter( fsFilter ),0,NULL,&gg ); - - for( i=0;(unsigned)i<gg.gl_pathc;i++ ) - { - stat( gg.gl_pathv[i],&fs ); - if( S_ISDIR( fs.st_mode ) ) continue; - clist_append_fname(list, gg.gl_pathv[i], fpixmap, fmask); - } - globfree( &gg ); - - gtk_clist_set_column_width( GTK_CLIST( list ),0,17 ); - gtk_clist_select_row( GTK_CLIST( list ),0,1 ); - gtk_widget_show( list ); -} - -void ShowFileSelect( int type,int modal ) -{ - int i, k; - char * tmp = NULL; - - if ( fsFileSelect ) gtkActive( fsFileSelect ); - else fsFileSelect=create_FileSelect(); - - fsType=type; - switch ( type ) - { - case fsVideoSelector: - gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect ); - fsList_items=NULL; - for( i=0;fsVideoFilterNames[i][0];i++ ) - fsList_items=g_list_append( fsList_items,fsVideoFilterNames[i][0] ); - k = fsLastVideoFilterSelected; - gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); - g_list_free( fsList_items ); - gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsVideoFilterNames[k >= 0 ? k : i-2][0] ); - tmp=guiInfo.Filename; - break; - case fsSubtitleSelector: - gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_SubtitleSelect ); - fsList_items=NULL; - for( i=0;fsSubtitleFilterNames[i][0];i++ ) - fsList_items=g_list_append( fsList_items,fsSubtitleFilterNames[i][0] ); - k = fsLastSubtitleFilterSelected; - gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); - g_list_free( fsList_items ); - gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsSubtitleFilterNames[k >= 0 ? k : i-2][0] ); - tmp=guiInfo.Subtitlename; - break; - case fsOtherSelector: - gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_OtherSelect ); - fsList_items=NULL; - for( i=0;fsOtherFilterNames[i][0];i++ ) - fsList_items=g_list_append( fsList_items,fsOtherFilterNames[i][0] ); - gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); - g_list_free( fsList_items ); - gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsOtherFilterNames[0][0] ); - tmp=guiInfo.Othername; - break; - case fsAudioSelector: - gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_AudioFileSelect ); - fsList_items=NULL; - for( i=0;fsAudioFileNames[i][0];i++ ) - fsList_items=g_list_append( fsList_items,fsAudioFileNames[i][0] ); - k = fsLastAudioFilterSelected; - gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); - g_list_free( fsList_items ); - gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsAudioFileNames[k >= 0 ? k : i-2][0] ); - tmp=guiInfo.AudioFile; - break; - case fsFontSelector: - gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FontSelect ); - fsList_items=NULL; - for( i=0;fsFontFileNames[i][0];i++ ) - fsList_items=g_list_append( fsList_items,fsFontFileNames[i][0] ); - k = fsLastFontFilterSelected; - gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items ); - g_list_free( fsList_items ); - gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsFontFileNames[k >= 0 ? k : i-2][0] ); - tmp=font_name; - break; - } - - if ( tmp && tmp[0] ) - { - struct stat f; - char * dir = strdup( tmp ); - - do - { - char * c = strrchr( dir,'/' ); - stat( dir,&f ); - if ( S_ISDIR( f.st_mode ) ) break; - if ( c ) *c=0; - } while ( strrchr( dir,'/' ) ); - - if ( dir[0] ) chdir( dir ); - - free( dir ); - } - - if ( fsTopList_items ) g_list_free( fsTopList_items ); fsTopList_items=NULL; - { - int i, c = 1; - - if ( fsType == fsVideoSelector ) - { - 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_utf8() ); - } - if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) ); - fsTopList_items=g_list_append( fsTopList_items,"/home" ); - fsTopList_items=g_list_append( fsTopList_items,"/mnt" ); - fsTopList_items=g_list_append( fsTopList_items,"/" ); - gtk_combo_set_popdown_strings( GTK_COMBO( fsCombo4 ),fsTopList_items ); - - gtk_window_set_modal( GTK_WINDOW( fsFileSelect ),modal ); - - gtk_widget_show( fsFileSelect ); -} - -void HideFileSelect( void ) -{ - if ( !fsFileSelect ) return; - gtk_widget_hide( fsFileSelect ); - gtk_widget_destroy( fsFileSelect ); - fsFileSelect=NULL; -} - -static void fs_PersistantHistory( char * subject ) -{ - int i; - - if ( fsType != fsVideoSelector ) return; - - for ( i=0;i < fsPersistant_MaxPos;i++ ) - if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) ) - { - char * tmp = fsHistory[i]; fsHistory[i]=fsHistory[0]; fsHistory[0]=tmp; - return; - } - gfree( (void **)&fsHistory[fsPersistant_MaxPos - 1] ); - for ( i=fsPersistant_MaxPos - 1;i;i-- ) fsHistory[i]=fsHistory[i - 1]; - fsHistory[0]=gstrdup( subject ); -} -//----------------------------------------------- - -static void fs_fsFilterCombo_activate( GtkEditable * editable, - gpointer user_data ) -{ - fsFilter=gtk_entry_get_text( GTK_ENTRY( user_data ) ); - CheckDir( fsFNameList ); -} - -static void fs_fsFilterCombo_changed( GtkEditable * editable, - gpointer user_data ) -{ - const char * str; - int i; - - str=gtk_entry_get_text( GTK_ENTRY(user_data ) ); - - switch ( fsType ) - { - case fsVideoSelector: - for( i=0;fsVideoFilterNames[i][0];i++ ) - if( !strcmp( str,fsVideoFilterNames[i][0] ) ) - { fsFilter=fsVideoFilterNames[i][1]; fsLastVideoFilterSelected = i; break; } - break; - case fsSubtitleSelector: - for( i=0;fsSubtitleFilterNames[i][0];i++ ) - if( !strcmp( str,fsSubtitleFilterNames[i][0] ) ) - { fsFilter=fsSubtitleFilterNames[i][1]; fsLastSubtitleFilterSelected = i; break; } - break; - case fsOtherSelector: - for( i=0;fsOtherFilterNames[i][0];i++ ) - if( !strcmp( str,fsOtherFilterNames[i][0] ) ) - { fsFilter=fsOtherFilterNames[i][1]; break; } - break; - case fsAudioSelector: - for( i=0;fsAudioFileNames[i][0];i++ ) - if( !strcmp( str,fsAudioFileNames[i][0] ) ) - { fsFilter=fsAudioFileNames[i][1]; fsLastAudioFilterSelected = i; break; } - break; - case fsFontSelector: - for( i=0;fsFontFileNames[i][0];i++ ) - if( !strcmp( str,fsFontFileNames[i][0] ) ) - { fsFilter=fsFontFileNames[i][1]; fsLastFontFilterSelected = i; break; } - break; - default: return; - } - CheckDir( fsFNameList ); -} - -static void fs_fsPathCombo_activate( GtkEditable * editable, - gpointer user_data ) -{ - const unsigned char * str; - gchar * dirname; - - str=gtk_entry_get_text( GTK_ENTRY( user_data ) ); - dirname = g_filename_from_utf8( str, -1, NULL, NULL, NULL ); - if ( chdir( dirname ? (const unsigned char *)dirname : str ) != -1 ) CheckDir( fsFNameList ); - g_free( dirname ); -} - -static void fs_fsPathCombo_changed( GtkEditable * editable, - gpointer user_data ) -{ - const unsigned char * str; - gchar * dirname; - - str=gtk_entry_get_text( GTK_ENTRY( user_data ) ); - dirname = g_filename_from_utf8( str, -1, NULL, NULL, NULL ); - if ( chdir( dirname ? (const unsigned char *)dirname : str ) != -1 ) CheckDir( fsFNameList ); - g_free( dirname ); -} - -static void fs_Up_released( GtkButton * button, gpointer user_data ) -{ - chdir( ".." ); - fsSelectedFile=fsThatDir; - CheckDir( fsFNameList ); - gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name_utf8() ); - return; -} - -static void fs_Ok_released( GtkButton * button, gpointer user_data ) -{ - GList * item; - int i = 1; - struct stat fs; - - stat( fsSelectedFile,&fs ); - if( S_ISDIR(fs.st_mode ) ) - { - chdir( fsSelectedFile ); - fsSelectedFile=fsThatDir; - CheckDir( fsFNameList ); - gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name_utf8() ); - return; - } - - fsSelectedDirectory=(unsigned char *)get_current_dir_name(); - switch ( fsType ) - { - case fsVideoSelector: - guiSetDF( guiInfo.Filename,fsSelectedDirectory,fsSelectedFile ); - guiInfo.StreamType=STREAMTYPE_FILE; - guiInfo.FilenameChanged=1; sub_fps=0; - gfree( (void **)&guiInfo.AudioFile ); - gfree( (void **)&guiInfo.Subtitlename ); - fs_PersistantHistory( get_current_dir_name_utf8() ); //totem, write into history - break; - case fsSubtitleSelector: - guiSetDF( guiInfo.Subtitlename,fsSelectedDirectory,fsSelectedFile ); - guiLoadSubtitle( guiInfo.Subtitlename ); - break; - case fsOtherSelector: - guiSetDF( guiInfo.Othername,fsSelectedDirectory,fsSelectedFile ); - break; - case fsAudioSelector: - guiSetDF( guiInfo.AudioFile,fsSelectedDirectory,fsSelectedFile ); - break; - case fsFontSelector: - guiSetDF( font_name,fsSelectedDirectory,fsSelectedFile ); - guiLoadFont(); - if ( Preferences ) gtk_entry_set_text( GTK_ENTRY( prEFontName ),font_name ); - break; - } - - HideFileSelect(); - - item=fsTopList_items; - while( item ) - { - if ( !strcmp( item->data,fsSelectedDirectory ) ) i=0; - item=item->next; - } - if ( i ) fsTopList_items=g_list_prepend( fsTopList_items,(gchar *)get_current_dir_name_utf8() ); - if ( uiMainAutoPlay ) { uiMainAutoPlay=0; uiEventHandling( evPlay,0 ); } - else guiGetEvent( guiCEvent,guiSetStop ); -} - -static void fs_Cancel_released( GtkButton * button,gpointer user_data ) -{ - HideFileSelect(); - fs_PersistantHistory( get_current_dir_name_utf8() ); //totem, write into history file -} - -static void fs_fsFNameList_select_row( GtkWidget * widget, gint row, gint column, - GdkEventButton *bevent, gpointer user_data) -{ - gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile ); - g_free( fsSelectedFileUtf8 ); - fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL ); - if ( fsSelectedFileUtf8 ) fsSelectedFile = fsSelectedFileUtf8; - if( bevent && bevent->type == GDK_BUTTON_PRESS ) gtk_button_released( GTK_BUTTON( fsOk ) ); -} - -static gboolean on_FileSelect_key_release_event( GtkWidget * widget, - GdkEventKey * event, - gpointer user_data ) -{ - switch ( event->keyval ) - { - case GDK_Escape: - gtk_button_released( GTK_BUTTON( fsCancel ) ); - break; - case GDK_Return: - gtk_button_released( GTK_BUTTON( fsOk ) ); - break; - case GDK_BackSpace: - gtk_button_released( GTK_BUTTON( fsUp ) ); - break; - } - return FALSE; -} - -static gboolean fs_fsFNameList_event( GtkWidget * widget, - GdkEvent * event, - gpointer user_data ) -{ - GdkEventButton *bevent; - gint row, col; - - (void) user_data; - - bevent = (GdkEventButton *) event; - - if ( event->type == GDK_BUTTON_RELEASE && bevent->button == 2 ) - { - if ( gtk_clist_get_selection_info( GTK_CLIST( widget ), bevent->x, bevent->y, &row, &col ) ) - { - gtk_clist_get_text( GTK_CLIST( widget ), row, 1, &fsSelectedFile ); - g_free( fsSelectedFileUtf8 ); - fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL ); - if ( fsSelectedFileUtf8 ) fsSelectedFile = fsSelectedFileUtf8; - gtk_button_released( GTK_BUTTON( fsOk ) ); - return TRUE; - } - } - - return FALSE; -} - -static void fs_Destroy( void ) -{ - g_free( fsSelectedFileUtf8 ); - fsSelectedFileUtf8 = NULL; - WidgetDestroy( fsFileSelect, &fsFileSelect ); -} - -GtkWidget * create_FileSelect( void ) -{ - GtkWidget * vbox4; - GtkWidget * hbox4; - GtkWidget * vseparator1; - GtkWidget * hbox6; - GtkWidget * fsFNameListWindow; - GtkWidget * hbuttonbox3; - - GtkWidget * uppixmapwid; - GdkPixmap * uppixmap; - GdkBitmap * upmask; - GtkStyle * upstyle; - - - fsFileSelect=gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_widget_set_name( fsFileSelect,"fsFileSelect" ); - gtk_object_set_data( GTK_OBJECT( fsFileSelect ),"fsFileSelect",fsFileSelect ); - gtk_widget_set_usize( fsFileSelect,512,300 ); - GTK_WIDGET_SET_FLAGS( fsFileSelect,GTK_CAN_DEFAULT ); - gtk_widget_set_events( fsFileSelect,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK ); - gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect ); - gtk_window_set_position( GTK_WINDOW( fsFileSelect ),GTK_WIN_POS_CENTER ); - gtk_window_set_policy( GTK_WINDOW( fsFileSelect ),TRUE,TRUE,TRUE ); - gtk_window_set_wmclass( GTK_WINDOW( fsFileSelect ),"FileSelect","MPlayer" ); - fsColorMap=gdk_colormap_get_system(); - - gtk_widget_realize( fsFileSelect ); - gtkAddIcon( fsFileSelect ); - - style=gtk_widget_get_style( fsFileSelect ); - dpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&dmask,&style->bg[GTK_STATE_NORMAL],(gchar **)dir_xpm ); - fpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&fmask,&style->bg[GTK_STATE_NORMAL],(gchar **)file_xpm ); - - vbox4=AddVBox( AddDialogFrame( fsFileSelect ),0 ); - hbox4=AddHBox( vbox4,1 ); - - fsCombo4=gtk_combo_new(); - gtk_widget_set_name( fsCombo4,"fsCombo4" ); - gtk_widget_show( fsCombo4 ); - gtk_box_pack_start( GTK_BOX( hbox4 ),fsCombo4,TRUE,TRUE,0 ); - gtk_widget_set_usize( fsCombo4,-2,20 ); - - fsPathCombo=GTK_COMBO( fsCombo4 )->entry; - gtk_widget_set_name( fsPathCombo,"fsPathCombo" ); - gtk_widget_show( fsPathCombo ); - gtk_widget_set_usize( fsPathCombo,-2,20 ); - - vseparator1=gtk_vseparator_new(); - gtk_widget_set_name( vseparator1,"vseparator1" ); - gtk_widget_show( vseparator1 ); - gtk_box_pack_start( GTK_BOX( hbox4 ),vseparator1,FALSE,TRUE,0 ); - gtk_widget_set_usize( vseparator1,7,20 ); - - upstyle=gtk_widget_get_style( fsFileSelect ); - uppixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&upmask,&upstyle->bg[GTK_STATE_NORMAL],(gchar **)up_xpm ); - uppixmapwid=gtk_pixmap_new( uppixmap,upmask ); - gtk_widget_show( uppixmapwid ); - - fsUp=gtk_button_new(); - gtk_container_add( GTK_CONTAINER(fsUp ),uppixmapwid ); - gtk_widget_show( fsUp ); - gtk_box_pack_start( GTK_BOX( hbox4 ),fsUp,FALSE,FALSE,0 ); - gtk_widget_set_usize( fsUp,65,15 ); - - AddHSeparator( vbox4 ); - - hbox6=AddHBox( NULL,0 ); - gtk_box_pack_start( GTK_BOX( vbox4 ),hbox6,TRUE,TRUE,0 ); - - fsFNameListWindow=gtk_scrolled_window_new( NULL,NULL ); - gtk_widget_set_name( fsFNameListWindow,"fsFNameListWindow" ); - gtk_widget_show( fsFNameListWindow ); - gtk_box_pack_start( GTK_BOX( hbox6 ),fsFNameListWindow,TRUE,TRUE,0 ); - gtk_widget_set_usize( fsFNameListWindow,-2,145 ); - gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( fsFNameListWindow ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC ); - - fsFNameList=gtk_clist_new( 2 ); - gtk_widget_set_name( fsFNameList,"fsFNameList" ); - gtk_container_add( GTK_CONTAINER( fsFNameListWindow ),fsFNameList ); - gtk_clist_set_column_width( GTK_CLIST( fsFNameList ),0,80 ); - gtk_clist_set_selection_mode( GTK_CLIST( fsFNameList ),GTK_SELECTION_BROWSE ); - gtk_clist_column_titles_hide( GTK_CLIST( fsFNameList ) ); - gtk_clist_set_shadow_type( GTK_CLIST( fsFNameList ),GTK_SHADOW_ETCHED_OUT ); - - AddHSeparator( vbox4 ); - - List=gtk_combo_new(); - gtk_widget_set_name( List,"List" ); - gtk_widget_ref( List ); - gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"List",List,(GtkDestroyNotify)gtk_widget_unref ); - gtk_widget_show( List ); - gtk_box_pack_start( GTK_BOX( vbox4 ),List,FALSE,FALSE,0 ); - gtk_widget_set_usize( List,-2,20 ); - - fsFilterCombo=GTK_COMBO( List )->entry; - gtk_widget_set_name( fsFilterCombo,"fsFilterCombo" ); - gtk_widget_show( fsFilterCombo ); - gtk_entry_set_editable (GTK_ENTRY( fsFilterCombo ),FALSE ); - - AddHSeparator( vbox4 ); - - hbuttonbox3=AddHButtonBox( vbox4 ); - gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox3 ),GTK_BUTTONBOX_END ); - gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox3 ),10 ); - - fsOk=AddButton( MSGTR_Ok,hbuttonbox3 ); - fsCancel=AddButton( MSGTR_Cancel,hbuttonbox3 ); - - gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"destroy",GTK_SIGNAL_FUNC( fs_Destroy ), NULL ); - gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL ); - - gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsFilterCombo_changed ),fsFilterCombo ); - gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsFilterCombo_activate ),fsFilterCombo ); - gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsPathCombo_changed ),fsPathCombo ); - gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsPathCombo_activate ),fsPathCombo ); - gtk_signal_connect( GTK_OBJECT( fsUp ),"released",GTK_SIGNAL_FUNC( fs_Up_released ),fsFNameList ); - gtk_signal_connect( GTK_OBJECT( fsOk ),"released",GTK_SIGNAL_FUNC( fs_Ok_released ),fsCombo4 ); - gtk_signal_connect( GTK_OBJECT( fsCancel ),"released",GTK_SIGNAL_FUNC( fs_Cancel_released ),NULL ); - gtk_signal_connect( GTK_OBJECT( fsFNameList ),"select_row",(GtkSignalFunc)fs_fsFNameList_select_row,NULL ); - gtk_signal_connect( GTK_OBJECT( fsFNameList ),"event", (GtkSignalFunc)fs_fsFNameList_event,NULL ); - - gtk_widget_grab_focus( fsFNameList ); - - return fsFileSelect; -}
--- a/gui/ui/gtk/fs.h Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_GUI_FS_H -#define MPLAYER_GUI_FS_H - -#include <gtk/gtk.h> - -#define fsVideoSelector 0 -#define fsSubtitleSelector 1 -#define fsOtherSelector 2 -#define fsAudioSelector 3 -#define fsFontSelector 4 - -#include <errno.h> - -extern GtkWidget * fsFileSelect; - -void HideFileSelect( void ); -void ShowFileSelect( int type, int modal ); - -GtkWidget * create_FileSelect( void ); - -#endif /* MPLAYER_GUI_FS_H */
--- a/gui/ui/gtk/gtk_common.c Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <gdk/gdkkeysyms.h> -#include <gtk/gtk.h> - -#include "gtk_common.h" - -void WidgetDestroy( GtkWidget * widget,GtkWidget ** widget_pointer ) -{ - if ( !widget_pointer ) return; - gtk_widget_hide( *widget_pointer ); - gtk_widget_destroy( *widget_pointer ); - *widget_pointer=NULL; -} - -GtkWidget * AddDialogFrame( GtkWidget * parent ) -{ - GtkWidget * frame; - frame=AddFrame( NULL,GTK_SHADOW_IN,parent,1 ); - gtk_container_set_border_width( GTK_CONTAINER( frame ),1 ); - frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 ); - frame=AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,frame,1 ); - frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 ); - return frame; -} - -GtkWidget * AddFrame( const char * title,int type,GtkWidget * parent,int add ) -{ - GtkWidget * frame = NULL; - 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 ); - return frame; -} - -GtkWidget * AddLabel( const char * title,GtkWidget * parent ) -{ - GtkWidget * label; - label=gtk_label_new( title ); - gtk_widget_set_name( label,"label" ); - gtk_widget_show( label ); - if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 ); - gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 ); - gtk_misc_set_padding( GTK_MISC( label ),4,0 ); - return label; -} - -GtkWidget * AddVBox( GtkWidget * parent,int type ) -{ - GtkWidget * vbox; - vbox=gtk_vbox_new( FALSE,0 ); - gtk_widget_set_name( vbox,"vbox" ); - gtk_widget_show( vbox ); - if ( parent ) - { - if ( type ) gtk_box_pack_start( GTK_BOX( parent ),vbox,FALSE,FALSE,0 ); - else gtk_container_add( GTK_CONTAINER( parent ),vbox ); - } - return vbox; -} - -GtkWidget * AddHBox( GtkWidget * parent,int type ) -{ - GtkWidget * hbox; - hbox=gtk_hbox_new( FALSE,0 ); - gtk_widget_set_name( hbox,"hbox" ); - gtk_widget_show( hbox ); - if ( parent ) - { - if ( type ) gtk_box_pack_start( GTK_BOX( parent ),hbox,FALSE,FALSE,0 ); - else gtk_container_add( GTK_CONTAINER( parent ),hbox ); - } - return hbox; -} - -GtkWidget * AddCheckButton( const char * title, GtkWidget * parent ) -{ - GtkWidget * CB; - CB=gtk_check_button_new_with_label( title ); - gtk_widget_set_name( CB,"CB" ); - gtk_widget_show( CB ); - gtk_box_pack_start( GTK_BOX( parent ),CB,FALSE,FALSE,0 ); - return CB; -} - -GtkWidget * AddRadioButton( const char * title,GSList ** group,GtkWidget * parent ) -{ - GtkWidget * RB; - RB=gtk_radio_button_new_with_label( *group,title ); - *group=gtk_radio_button_group( GTK_RADIO_BUTTON( RB ) ); - gtk_widget_set_name( RB,"RB" ); - gtk_widget_show( RB ); - gtk_box_pack_start( GTK_BOX( parent ),RB,FALSE,FALSE,0 ); - return RB; -} - -GtkWidget * AddSpinButton( const char * title,GtkAdjustment * adj,GtkWidget * parent ) -{ - GtkWidget * SB; - GtkWidget * label; - label=gtk_label_new( title ); - gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 ); - gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 ); - gtk_widget_show( label ); - SB=gtk_spin_button_new( adj,0,0 ); - gtk_widget_set_name( SB,"SB" ); - gtk_box_pack_start( GTK_BOX( parent ),SB,FALSE,FALSE,0 ); - gtk_widget_show( SB ); - return SB; -} - -GtkWidget * AddButton( const char * title,GtkWidget * parent ) -{ - GtkWidget * B; - B=gtk_button_new_with_label( title ); - gtk_widget_set_name( B,"B" ); - gtk_widget_show( B ); - gtk_container_add( GTK_CONTAINER( parent ),B ); - return B; -} - -GtkWidget * AddHSeparator( GtkWidget * parent ) -{ - GtkWidget * hseparator; - hseparator=gtk_hseparator_new(); - gtk_widget_set_name( hseparator,"hseparator1" ); - gtk_widget_show( hseparator ); - gtk_box_pack_start( GTK_BOX( parent ),hseparator,FALSE,FALSE,0 ); - gtk_widget_set_usize( hseparator,-2,6 ); - return hseparator; -} - -GtkWidget * AddHButtonBox( GtkWidget * parent ) -{ - GtkWidget * hbuttonbox; - hbuttonbox=gtk_hbutton_box_new(); - gtk_widget_set_name( hbuttonbox,"hbuttonbox" ); - gtk_widget_show( hbuttonbox ); - gtk_box_pack_start( GTK_BOX( parent ),hbuttonbox,FALSE,FALSE,0 ); - gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox ),85,20 ); - return hbuttonbox; -} - -GtkWidget * AddHScaler( GtkAdjustment * adj,GtkWidget * parent,int digit ) -{ - GtkWidget * HS; - HS=gtk_hscale_new( adj ); - gtk_widget_set_name( HS,"HS" ); - gtk_widget_show( HS ); - if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),HS,TRUE,TRUE,0 ); - gtk_scale_set_value_pos( GTK_SCALE( HS ),GTK_POS_RIGHT ); - gtk_scale_set_digits( GTK_SCALE( HS ),digit ); - return HS; -} - -GtkWidget * AddVScaler( GtkAdjustment * adj,GtkWidget * parent,int digit ) -{ - GtkWidget * VS; - VS=gtk_vscale_new( adj ); - gtk_widget_set_name( VS,"VS" ); - gtk_widget_show( VS ); - if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),VS,TRUE,TRUE,0 ); -// gtk_scale_set_value_pos( GTK_SCALE( VS ),GTK_POS_RIGHT ); - if ( digit == -1 ) gtk_scale_set_draw_value( GTK_SCALE( VS ),FALSE ); - else gtk_scale_set_digits( GTK_SCALE( VS ),digit ); - return VS; -} - -GtkWidget * AddComboBox( GtkWidget * parent ) -{ - GtkWidget * CB; - CB=gtk_combo_new(); - gtk_widget_set_name( CB,"CB" ); - gtk_widget_show( CB ); - if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),CB,TRUE,TRUE,0 ); - return CB; -}
--- a/gui/ui/gtk/gtk_common.h Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_GUI_GTK_COMMON_H -#define MPLAYER_GUI_GTK_COMMON_H - -#include <gdk/gdkkeysyms.h> -#include <gtk/gtk.h> - -GtkWidget * AddDialogFrame( GtkWidget * parent ); -GtkWidget * AddFrame( const char * title, int type, GtkWidget * parent, int add ); -GtkWidget * AddLabel( const char * title, GtkWidget * parent ); -GtkWidget * AddVBox( GtkWidget * parent, int type ); -GtkWidget * AddHBox( GtkWidget * parent, int type ); -GtkWidget * AddCheckButton( const char * title, GtkWidget * parent ); -GtkWidget * AddRadioButton( const char * title, GSList ** group, GtkWidget * parent ); -GtkWidget * AddSpinButton( const char * title, GtkAdjustment * adj, GtkWidget * parent ); -GtkWidget * AddButton( const char * title, GtkWidget * parent ); -GtkWidget * AddHSeparator( GtkWidget * parent ); -GtkWidget * AddHButtonBox( GtkWidget * parent ); -GtkWidget * AddHScaler( GtkAdjustment * adj, GtkWidget * parent, int digit ); -GtkWidget * AddVScaler( GtkAdjustment * adj, GtkWidget * parent, int digit ); -GtkWidget * AddComboBox( GtkWidget * parent ); -void WidgetDestroy( GtkWidget * widget, GtkWidget ** widget_pointer ); - -#endif /* MPLAYER_GUI_GTK_COMMON_H */
--- a/gui/ui/gtk/gtk_menu.c Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,647 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "config.h" -#include "help_mp.h" -#include "access_mpcontext.h" -#include "mixer.h" -#include "mpcommon.h" - -#include "gtk_menu.h" -#include "gui/ui/widgets.h" -#include "gui/ui/gmplayer.h" -#include "gui/app.h" - -#include "stream/stream.h" -#include "libmpdemux/demuxer.h" -#include "libmpdemux/stheader.h" -#include "libavutil/avstring.h" - -#include "gui/ui/pixmaps/about.xpm" -#include "gui/ui/pixmaps/half.xpm" -#include "gui/ui/pixmaps/normal.xpm" -#include "gui/ui/pixmaps/double.xpm" -#include "gui/ui/pixmaps/full.xpm" -#include "gui/ui/pixmaps/exit.xpm" -#include "gui/ui/pixmaps/prefs.xpm" -#include "gui/ui/pixmaps/equalizer.xpm" -#include "gui/ui/pixmaps/playlist.xpm" -#include "gui/ui/pixmaps/skin.xpm" -#include "gui/ui/pixmaps/sound.xpm" -#include "gui/ui/pixmaps/open.xpm" -#include "gui/ui/pixmaps/play.xpm" -#include "gui/ui/pixmaps/stop.xpm" -#include "gui/ui/pixmaps/pause.xpm" -#include "gui/ui/pixmaps/prev.xpm" -#include "gui/ui/pixmaps/next.xpm" -#include "gui/ui/pixmaps/aspect.xpm" -#include "gui/ui/pixmaps/aspect11.xpm" -#include "gui/ui/pixmaps/aspect169.xpm" -#include "gui/ui/pixmaps/aspect235.xpm" -#include "gui/ui/pixmaps/aspect43.xpm" -#include "gui/ui/pixmaps/file2.xpm" -#include "gui/ui/pixmaps/url.xpm" -#include "gui/ui/pixmaps/sub.xpm" -#include "gui/ui/pixmaps/nosub.xpm" -#include "gui/ui/pixmaps/empty.xpm" -#include "gui/ui/pixmaps/loadeaf.xpm" -#include "gui/ui/pixmaps/title.xpm" -#ifdef CONFIG_DVDREAD -#include "gui/ui/pixmaps/dvd.xpm" -#include "gui/ui/pixmaps/playdvd.xpm" -#include "gui/ui/pixmaps/chapter.xpm" -#include "gui/ui/pixmaps/dolby.xpm" -#include "gui/ui/pixmaps/audiolang.xpm" -#include "gui/ui/pixmaps/sublang.xpm" -#include "gui/ui/pixmaps/empty1px.xpm" -#endif -#ifdef CONFIG_VCD -#include "gui/ui/pixmaps/vcd.xpm" -#include "gui/ui/pixmaps/playvcd.xpm" -#endif - -static void ActivateMenuItem( int Item ) -{ -// fprintf( stderr,"[menu] item: %d.%d\n",Item&0xffff,Item>>16 ); - gtkPopupMenu=Item & 0x0000ffff; - gtkPopupMenuParam=Item >> 16; - uiEventHandling( Item & 0x0000ffff,Item >> 16 ); -} - -static GtkWidget * AddMenuCheckItem(GtkWidget *window1, const char * immagine_xpm, GtkWidget* Menu,const char* label, gboolean state, int Number) -{ - GtkWidget * Label = NULL; - GtkWidget * Pixmap = NULL; - GtkWidget * hbox = NULL; - GtkWidget * Item = NULL; - - GdkPixmap *PixmapIcon = NULL; - GdkColor transparent; - GdkBitmap *MaskIcon = NULL; - - PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm ); - Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon); - gdk_pixmap_unref (PixmapIcon); - - Item=gtk_check_menu_item_new(); - Label = gtk_label_new (label); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0); - gtk_container_add (GTK_CONTAINER (Item), hbox); - - gtk_menu_append( GTK_MENU( Menu ),Item ); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(Item),state); - gtk_signal_connect_object( GTK_OBJECT(Item),"activate", - GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number ); - gtk_menu_item_right_justify (GTK_MENU_ITEM (Item)); - gtk_widget_show_all(Item); - - return Item; -} -GtkWidget * AddMenuItem( GtkWidget *window1, const char * immagine_xpm, GtkWidget * SubMenu,const char * label,int Number ) -{ - GtkWidget * Label = NULL; - GtkWidget * Pixmap = NULL; - GtkWidget * hbox = NULL; - GtkWidget * Item = NULL; - GdkPixmap * PixmapIcon = NULL; - GdkColor transparent; - GdkBitmap * MaskIcon = NULL; - - PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm ); - Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon); - gdk_pixmap_unref (PixmapIcon); - - Item=gtk_menu_item_new(); - Label = gtk_label_new (label); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0); - gtk_container_add (GTK_CONTAINER (Item), hbox); - - - gtk_menu_append( GTK_MENU( SubMenu ),Item ); - gtk_signal_connect_object( GTK_OBJECT(Item),"activate", - GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number ); - - gtk_menu_item_right_justify (GTK_MENU_ITEM (Item)); - gtk_widget_show_all(Item); - return Item; -} - - -GtkWidget * AddSubMenu( GtkWidget *window1, const char * immagine_xpm, GtkWidget * Menu,const char * label ) -{ - GtkWidget * Label = NULL; - GtkWidget * Pixmap = NULL; - GtkWidget * hbox = NULL; - GtkWidget * Item = NULL; - GtkWidget * SubItem = NULL; - GdkPixmap * PixmapIcon = NULL; - GdkColor transparent; - GdkBitmap * MaskIcon = NULL; - - PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm); - Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon); - gdk_pixmap_unref (PixmapIcon); - - SubItem=gtk_menu_item_new(); - Item=gtk_menu_new(); - Label = gtk_label_new (label); - - hbox = gtk_hbox_new (FALSE, 8); - gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0); - gtk_container_add (GTK_CONTAINER (SubItem), hbox); - - gtk_menu_append( GTK_MENU( Menu ),SubItem ); - gtk_menu_item_set_submenu( GTK_MENU_ITEM( SubItem ),Item ); - - gtk_widget_show_all( SubItem ); - return Item; -} - -GtkWidget * AddSeparator( GtkWidget * Menu ) -{ - GtkWidget * Item = NULL; - - Item=gtk_menu_item_new (); - gtk_widget_show( Item ); - gtk_container_add( GTK_CONTAINER( Menu ),Item ); - gtk_widget_set_sensitive( Item,FALSE ); - - return Item; -} - -typedef struct -{ - int id; - const char * name; -} Languages_t; - -#define lng( a,b ) ( (int)(a) * 256 + b ) -static Languages_t Languages[] = - { - { lng( 'a','b' ), "Abkhazian" }, - { lng( 'a','a' ), "Afar" }, - { lng( 'a','f' ), "Afrikaans" }, - { lng( 's','q' ), "Albanian" }, - { lng( 'a','m' ), "Amharic" }, - { lng( 'a','r' ), "Arabic" }, - { lng( 'h','y' ), "Armenian" }, - { lng( 'a','s' ), "Assamese" }, - { lng( 'a','e' ), "Avestan" }, - { lng( 'a','y' ), "Aymara" }, - { lng( 'a','z' ), "Azerbaijani" }, - { lng( 'b','a' ), "Bashkir" }, - { lng( 'e','u' ), "Basque" }, - { lng( 'b','e' ), "Belarusian" }, - { lng( 'b','n' ), "Bengali" }, - { lng( 'b','h' ), "Bihari" }, - { lng( 'b','i' ), "Bislama" }, - { lng( 'b','s' ), "Bosnian" }, - { lng( 'b','r' ), "Breton" }, - { lng( 'b','g' ), "Bulgarian" }, - { lng( 'm','y' ), "Burmese" }, - { lng( 'c','a' ), "Catalan" }, - { lng( 'c','h' ), "Chamorro" }, - { lng( 'c','e' ), "Chechen" }, - { lng( 'n','y' ), "Chichewa;Nyanja" }, - { lng( 'z','h' ), "Chinese" }, - { lng( 'c','u' ), "ChurchSlavic" }, - { lng( 'c','v' ), "Chuvash" }, - { lng( 'k','w' ), "Cornish" }, - { lng( 'c','o' ), "Corsican" }, - { lng( 'h','r' ), "Croatian" }, - { lng( 'c','s' ), "Czech" }, - { lng( 'd','a' ), "Danish" }, - { lng( 'n','l' ), "Dutch" }, - { lng( 'd','z' ), "Dzongkha" }, - { lng( 'e','n' ), "English" }, - { lng( 'e','o' ), "Esperanto" }, - { lng( 'e','t' ), "Estonian" }, - { lng( 'f','o' ), "Faroese" }, - { lng( 'f','j' ), "Fijian" }, - { lng( 'f','i' ), "Finnish" }, - { lng( 'f','r' ), "French" }, - { lng( 'f','y' ), "Frisian" }, - { lng( 'g','d' ), "Gaelic(Scots" }, - { lng( 'g','l' ), "Gallegan" }, - { lng( 'k','a' ), "Georgian" }, - { lng( 'd','e' ), "German" }, - { lng( 'e','l' ), "Greek" }, - { lng( 'g','n' ), "Guarani" }, - { lng( 'g','u' ), "Gujarati" }, - { lng( 'h','a' ), "Hausa" }, - { lng( 'h','e' ), "Hebrew" }, - { lng( 'i','w' ), "Hebrew" }, - { lng( 'h','z' ), "Herero" }, - { lng( 'h','i' ), "Hindi" }, - { lng( 'h','o' ), "HiriMotu" }, - { lng( 'h','u' ), "Hungarian" }, - { lng( 'i','s' ), "Icelandic" }, - { lng( 'i','d' ), "Indonesian" }, - { lng( 'i','n' ), "Indonesian" }, - { lng( 'i','a' ), "Interlingua" }, - { lng( 'i','e' ), "Interlingue" }, - { lng( 'i','u' ), "Inuktitut" }, - { lng( 'i','k' ), "Inupiaq" }, - { lng( 'g','a' ), "Irish" }, - { lng( 'i','t' ), "Italian" }, - { lng( 'j','a' ), "Japanese" }, - { lng( 'j','v' ), "Javanese" }, - { lng( 'j','w' ), "Javanese" }, - { lng( 'k','l' ), "Kalaallisut" }, - { lng( 'k','n' ), "Kannada" }, - { lng( 'k','s' ), "Kashmiri" }, - { lng( 'k','k' ), "Kazakh" }, - { lng( 'k','m' ), "Khmer" }, - { lng( 'k','i' ), "Kikuyu" }, - { lng( 'r','w' ), "Kinyarwanda" }, - { lng( 'k','y' ), "Kirghiz" }, - { lng( 'k','v' ), "Komi" }, - { lng( 'k','o' ), "Korean" }, - { lng( 'k','j' ), "Kuanyama" }, - { lng( 'k','u' ), "Kurdish" }, - { lng( 'l','o' ), "Lao" }, - { lng( 'l','a' ), "Latin" }, - { lng( 'l','v' ), "Latvian" }, - { lng( 'l','b' ), "Letzeburgesch" }, - { lng( 'l','n' ), "Lingala" }, - { lng( 'l','t' ), "Lithuanian" }, - { lng( 'm','k' ), "Macedonian" }, - { lng( 'm','g' ), "Malagasy" }, - { lng( 'm','s' ), "Malay" }, - { lng( 'm','l' ), "Malayalam" }, - { lng( 'm','t' ), "Maltese" }, - { lng( 'g','v' ), "Manx" }, - { lng( 'm','i' ), "Maori" }, - { lng( 'm','r' ), "Marathi" }, - { lng( 'm','h' ), "Marshall" }, - { lng( 'm','o' ), "Moldavian" }, - { lng( 'm','n' ), "Mongolian" }, - { lng( 'n','a' ), "Nauru" }, - { lng( 'n','v' ), "Navajo" }, - { lng( 'n','d' ), "North Ndebele" }, - { lng( 'n','r' ), "South Ndebele" }, - { lng( 'n','g' ), "Ndonga" }, - { lng( 'n','e' ), "Nepali" }, - { lng( 's','e' ), "NorthernSami" }, - { lng( 'n','o' ), "Norwegian" }, - { lng( 'n','b' ), "NorwegianBokmål" }, - { lng( 'n','n' ), "NorwegianNynorsk" }, - { lng( 'n','y' ), "Nyanja;Chichewa" }, - { lng( 'o','c' ), "Occitan(post1500;Provençal" }, - { lng( 'o','r' ), "Oriya" }, - { lng( 'o','m' ), "Oromo" }, - { lng( 'o','s' ), "Ossetian;Ossetic" }, - { lng( 'p','i' ), "Pali" }, - { lng( 'p','a' ), "Panjabi" }, - { lng( 'f','a' ), "Persian" }, - { lng( 'p','l' ), "Polish" }, - { lng( 'p','t' ), "Portuguese" }, - { lng( 'o','c' ), "Provençal;Occitan(post1500" }, - { lng( 'p','s' ), "Pushto" }, - { lng( 'q','u' ), "Quechua" }, - { lng( 'r','m' ), "Raeto-Romance" }, - { lng( 'r','o' ), "Romanian" }, - { lng( 'r','n' ), "Rundi" }, - { lng( 'r','u' ), "Russian" }, - { lng( 's','m' ), "Samoan" }, - { lng( 's','g' ), "Sango" }, - { lng( 's','a' ), "Sanskrit" }, - { lng( 's','c' ), "Sardinian" }, - { lng( 's','r' ), "Serbian" }, - { lng( 's','n' ), "Shona" }, - { lng( 's','d' ), "Sindhi" }, - { lng( 's','i' ), "Sinhalese" }, - { lng( 's','k' ), "Slovak" }, - { lng( 's','l' ), "Slovenian" }, - { lng( 's','o' ), "Somali" }, - { lng( 's','t' ), "Sotho" }, - { lng( 'e','s' ), "Spanish" }, - { lng( 's','u' ), "Sundanese" }, - { lng( 's','w' ), "Swahili" }, - { lng( 's','s' ), "Swati" }, - { lng( 's','v' ), "Swedish" }, - { lng( 't','l' ), "Tagalog" }, - { lng( 't','y' ), "Tahitian" }, - { lng( 't','g' ), "Tajik" }, - { lng( 't','a' ), "Tamil" }, - { lng( 't','t' ), "Tatar" }, - { lng( 't','e' ), "Telugu" }, - { lng( 't','h' ), "Thai" }, - { lng( 'b','o' ), "Tibetan" }, - { lng( 't','i' ), "Tigrinya" }, - { lng( 't','o' ), "Tonga" }, - { lng( 't','s' ), "Tsonga" }, - { lng( 't','n' ), "Tswana" }, - { lng( 't','r' ), "Turkish" }, - { lng( 't','k' ), "Turkmen" }, - { lng( 't','w' ), "Twi" }, - { lng( 'u','g' ), "Uighur" }, - { lng( 'u','k' ), "Ukrainian" }, - { lng( 'u','r' ), "Urdu" }, - { lng( 'u','z' ), "Uzbek" }, - { lng( 'v','i' ), "Vietnamese" }, - { lng( 'v','o' ), "Volapük" }, - { lng( 'c','y' ), "Welsh" }, - { lng( 'w','o' ), "Wolof" }, - { lng( 'x','h' ), "Xhosa" }, - { lng( 'y','i' ), "Yiddish" }, - { lng( 'j','i' ), "Yiddish" }, - { lng( 'y','o' ), "Yoruba" }, - { lng( 'z','a' ), "Zhuang" }, - { lng( 'z','u' ), "Zulu" }, - }; -#undef lng - -#ifdef CONFIG_DVDREAD -static char * ChannelTypes[] = - { "Dolby Digital","","Mpeg1","Mpeg2","PCM","","Digital Theatre System" }; -static char * ChannelNumbers[] = - { "","Stereo","","","","5.1" }; -#endif - -static const char * GetLanguage( int language ) -{ - unsigned int i; - for ( i=0;i<sizeof( Languages ) / sizeof( Languages_t );i++ ) - if ( Languages[i].id == language ) return Languages[i].name; - return NULL; -} - - -GtkWidget * DVDSubMenu; -GtkWidget * DVDTitleMenu; -GtkWidget * DVDChapterMenu; -GtkWidget * DVDAudioLanguageMenu; -GtkWidget * DVDSubtitleLanguageMenu; -GtkWidget * AspectMenu; -GtkWidget * VCDSubMenu; -GtkWidget * VCDTitleMenu; - -GtkWidget * create_PopUpMenu( void ) -{ - GtkWidget * window1; - GtkWidget * Menu = NULL; - GtkWidget * SubMenu = NULL; - GtkWidget * MenuItem = NULL; - GtkWidget * H, * N, * D, * F; - mixer_t *mixer = mpctx_get_mixer(guiInfo.mpcontext); - int global_sub_size = mpctx_get_global_sub_size(guiInfo.mpcontext); - - Menu=gtk_menu_new(); - gtk_widget_realize (Menu); - window1 = gtk_widget_get_toplevel(Menu); - - - AddMenuItem( window1, (const char*)about_xpm, Menu,MSGTR_MENU_AboutMPlayer" ", evAbout ); - AddSeparator( Menu ); - SubMenu=AddSubMenu( window1, (const char*)open_xpm, Menu,MSGTR_MENU_Open ); - AddMenuItem( window1, (const char*)file2_xpm, SubMenu,MSGTR_MENU_PlayFile" ", evLoadPlay ); -#ifdef CONFIG_VCD - AddMenuItem( window1, (const char*)playvcd_xpm, SubMenu,MSGTR_MENU_PlayVCD, evPlayVCD ); -#endif -#ifdef CONFIG_DVDREAD - AddMenuItem( window1, (const char*)playdvd_xpm, SubMenu,MSGTR_MENU_PlayDVD, evPlayDVD ); -#endif - AddMenuItem( window1, (const char*)url_xpm, SubMenu,MSGTR_MENU_PlayURL, evSetURL ); - AddMenuItem( window1, (const char*)sub_xpm, SubMenu,MSGTR_MENU_LoadSubtitle" ", evLoadSubtitle ); - AddMenuItem( window1, (const char*)nosub_xpm, SubMenu,MSGTR_MENU_DropSubtitle,evDropSubtitle ); - AddMenuItem( window1, (const char*)loadeaf_xpm, SubMenu,MSGTR_MENU_LoadExternAudioFile, evLoadAudioFile ); - SubMenu=AddSubMenu(window1, (const char*)play_xpm, Menu,MSGTR_MENU_Playing ); - AddMenuItem( window1, (const char*)play_xpm, SubMenu,MSGTR_MENU_Play" ", evPlay ); - AddMenuItem( window1, (const char*)pause_xpm, SubMenu,MSGTR_MENU_Pause, evPause ); - AddMenuItem( window1, (const char*)stop_xpm, SubMenu,MSGTR_MENU_Stop, evStop ); - AddMenuItem( window1, (const char*)next_xpm, SubMenu,MSGTR_MENU_NextStream, evNext ); - AddMenuItem( window1, (const char*)prev_xpm, SubMenu,MSGTR_MENU_PrevStream, evPrev ); -// AddSeparator( SubMenu ); -// AddMenuItem( SubMenu,"Back 10 sec", evBackward10sec ); -// AddMenuItem( SubMenu,"Fwd 10 sec", evForward10sec ); -// AddMenuItem( SubMenu,"Back 1 min", evBackward1min ); -// AddMenuItem( SubMenu,"Fwd 1 min", evForward1min ); -// SubMenu=AddSubMenu( Menu,MSGTR_MENU_Size ); -// AddMenuItem( SubMenu,MSGTR_MENU_NormalSize" ", evNormalSize ); -// AddMenuItem( SubMenu,MSGTR_MENU_DoubleSize, evDoubleSize ); -// AddMenuItem( SubMenu,MSGTR_MENU_FullScreen, evFullScreen ); -#ifdef CONFIG_VCD - VCDSubMenu=AddSubMenu( window1, (const char*)vcd_xpm, Menu,MSGTR_MENU_VCD ); - AddMenuItem( window1, (const char*)playvcd_xpm, VCDSubMenu,MSGTR_MENU_PlayDisc,evPlayVCD ); - AddSeparator( VCDSubMenu ); - VCDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, VCDSubMenu,MSGTR_MENU_Titles ); - if ( guiInfo.VCDTracks ) - { - char tmp[32]; int i; - for ( i=1;i < guiInfo.VCDTracks;i++ ) - { - snprintf( tmp,32,MSGTR_MENU_Title,i ); - //AddMenuItem( VCDTitleMenu,tmp,( i << 16 ) + evSetVCDTrack ); - AddMenuItem(window1, (const char*)empty_xpm, VCDTitleMenu,tmp,( i << 16 ) + evSetVCDTrack ); - } - } - else - { - MenuItem=AddMenuItem( window1, (const char*)empty_xpm, VCDTitleMenu,MSGTR_MENU_None,evNone ); - gtk_widget_set_sensitive( MenuItem,FALSE ); - } -#endif -#ifdef CONFIG_DVDREAD - DVDSubMenu=AddSubMenu( window1, (const char*)dvd_xpm, Menu,MSGTR_MENU_DVD ); - AddMenuItem( window1, (const char*)playdvd_xpm, DVDSubMenu,MSGTR_MENU_PlayDisc" ", evPlayDVD ); -// AddMenuItem( DVDSubMenu,MSGTR_MENU_ShowDVDMenu, evNone ); - AddSeparator( DVDSubMenu ); - DVDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, DVDSubMenu,MSGTR_MENU_Titles ); - if ( guiInfo.DVD.titles ) - { - char tmp[32]; int i; - for ( i=1 ; i<= guiInfo.DVD.titles;i++ ) - { - snprintf( tmp,32,MSGTR_MENU_Title,i); - AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDTitleMenu,tmp, - guiInfo.DVD.current_title == i, - (i << 16) + evSetDVDTitle ); - } - } - else - { - MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDTitleMenu,MSGTR_MENU_None,evNone ); - gtk_widget_set_sensitive( MenuItem,FALSE ); - } - DVDChapterMenu=AddSubMenu( window1, (const char*)chapter_xpm, DVDSubMenu,MSGTR_MENU_Chapters ); - if ( guiInfo.DVD.chapters ) - { - char tmp[32]; int i; - for ( i=1;i <= guiInfo.DVD.chapters;i++ ) - { - snprintf( tmp,32,MSGTR_MENU_Chapter,i ); - AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,tmp,guiInfo.DVD.current_chapter == i, - ( i << 16 ) + evSetDVDChapter ); - } - } - else - { - MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDChapterMenu,MSGTR_MENU_None,evNone ); - gtk_widget_set_sensitive( MenuItem,FALSE ); - } - DVDAudioLanguageMenu=AddSubMenu( window1, (const char*)audiolang_xpm, DVDSubMenu,MSGTR_MENU_AudioLanguages ); - if ( guiInfo.DVD.nr_of_audio_channels ) - { - char tmp[64]; int i, id = guiInfo.demuxer ? ((demuxer_t *)guiInfo.demuxer)->audio->id : audio_id; - for ( i=0;i < guiInfo.DVD.nr_of_audio_channels;i++ ) - { - snprintf( tmp,64,"%s - %s %s",GetLanguage( guiInfo.DVD.audio_streams[i].language ), - ChannelTypes[ guiInfo.DVD.audio_streams[i].type ], - ChannelNumbers[ guiInfo.DVD.audio_streams[i].channels ] ); -// if ( id == -1 ) id=audio_id; //guiInfo.DVD.audio_streams[i].id; - AddMenuCheckItem( window1, (const char*)dolby_xpm, DVDAudioLanguageMenu,tmp, - id == guiInfo.DVD.audio_streams[i].id, - ( guiInfo.DVD.audio_streams[i].id << 16 ) + evSetDVDAudio ); - } - } - else - { - MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDAudioLanguageMenu,MSGTR_MENU_None,evNone ); - gtk_widget_set_sensitive( MenuItem,FALSE ); - } - DVDSubtitleLanguageMenu=AddSubMenu( window1, (const char*)sublang_xpm, DVDSubMenu,MSGTR_MENU_SubtitleLanguages ); - if ( guiInfo.DVD.nr_of_subtitles ) - { - char tmp[64]; int i; - AddMenuItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,( (unsigned short)-1 << 16 ) + evSetDVDSubtitle ); - for ( i=0;i < guiInfo.DVD.nr_of_subtitles;i++ ) - { - av_strlcpy( tmp,GetLanguage( guiInfo.DVD.subtitles[i].language ),sizeof(tmp) ); - AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,tmp, - dvdsub_id == guiInfo.DVD.subtitles[i].id, - ( guiInfo.DVD.subtitles[i].id << 16 ) + evSetDVDSubtitle ); - } - } - else - { - MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,evNone ); - gtk_widget_set_sensitive( MenuItem,FALSE ); - } -#endif - -// if ( guiInfo.Playing ) - { - AspectMenu=AddSubMenu( window1, (const char*)aspect_xpm, Menu,MSGTR_MENU_AspectRatio ); - AddMenuItem( window1, (const char*)aspect11_xpm, AspectMenu,MSGTR_MENU_Original,( 1 << 16 ) + evSetAspect ); - AddMenuItem( window1, (const char*)aspect169_xpm, AspectMenu,"16:9",( 2 << 16 ) + evSetAspect ); - AddMenuItem( window1, (const char*)aspect43_xpm, AspectMenu,"4:3",( 3 << 16 ) + evSetAspect ); - AddMenuItem( window1, (const char*)aspect235_xpm, AspectMenu,"2.35",( 4 << 16 ) + evSetAspect ); - } - - if ( guiInfo.Playing && guiInfo.demuxer && guiInfo.StreamType != STREAMTYPE_DVD ) - { - int i,c = 0; - - for ( i=0;i < MAX_A_STREAMS;i++ ) - if ( ((demuxer_t *)guiInfo.demuxer)->a_streams[i] ) c++; - - if ( c > 1 ) - { - SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_AudioTrack ); - for ( i=0;i < MAX_A_STREAMS;i++ ) - if ( ((demuxer_t *)guiInfo.demuxer)->a_streams[i] ) - { - int aid = ((sh_audio_t *)((demuxer_t *)guiInfo.demuxer)->a_streams[i])->aid; - char tmp[32]; - snprintf( tmp,32,MSGTR_MENU_Track,aid ); - AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( aid << 16 ) + evSetAudio ); - } - } - - for ( c=0,i=0;i < MAX_V_STREAMS;i++ ) - if ( ((demuxer_t *)guiInfo.demuxer)->v_streams[i] ) c++; - - if ( c > 1 ) - { - SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_VideoTrack ); - for ( i=0;i < MAX_V_STREAMS;i++ ) - if ( ((demuxer_t *)guiInfo.demuxer)->v_streams[i] ) - { - int vid = ((sh_video_t *)((demuxer_t *)guiInfo.demuxer)->v_streams[i])->vid; - char tmp[32]; - snprintf( tmp,32,MSGTR_MENU_Track,vid ); - AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( vid << 16 ) + evSetVideo ); - } - } - } - - /* cheap subtitle switching for non-DVD streams */ - if ( global_sub_size && guiInfo.StreamType != STREAMTYPE_DVD ) - { - int i; - SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu, MSGTR_MENU_Subtitles ); - AddMenuItem( window1, (const char*)empty_xpm, SubMenu, MSGTR_MENU_None, (-1 << 16) + evSetSubtitle ); - for ( i=0;i < global_sub_size;i++ ) - { - char tmp[32]; - snprintf( tmp, 32, MSGTR_MENU_Track, i ); - AddMenuItem( window1,(const char*)empty_xpm,SubMenu,tmp,( i << 16 ) + evSetSubtitle ); - } - } - - AddSeparator( Menu ); - MenuItem=AddMenuCheckItem( window1, (const char*)sound_xpm, Menu,MSGTR_MENU_Mute,mixer->muted,evMute ); - if ( !guiInfo.AudioType ) gtk_widget_set_sensitive( MenuItem,FALSE ); - AddMenuItem( window1, (const char*)playlist_xpm, Menu,MSGTR_MENU_PlayList, evPlayList ); - AddMenuItem( window1, (const char*)skin_xpm, Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser ); - AddMenuItem( window1, (const char*)prefs_xpm, Menu,MSGTR_MENU_Preferences, evPreferences ); - AddMenuItem( window1, (const char*)equalizer_xpm, Menu,MSGTR_Equalizer, evEqualizer ); - - if ( guiInfo.NoWindow == False ) - { - int b1 = 0, b2 = 0, b_half = 0; - AddSeparator( Menu ); - if ( !guiApp.subWindow.isFullScreen && guiInfo.Playing ) - { - if ( ( guiApp.subWindow.Width == guiInfo.MovieWidth * 2 )&& - ( guiApp.subWindow.Height == guiInfo.MovieHeight * 2 ) ) b2=1; - else if ( ( guiApp.subWindow.Width == guiInfo.MovieWidth / 2 ) && - ( guiApp.subWindow.Height == guiInfo.MovieHeight / 2 ) ) b_half=1; - else b1=1; - } else b1=!guiApp.subWindow.isFullScreen; - H=AddMenuCheckItem( window1, (const char*)half_xpm, Menu,MSGTR_MENU_HalfSize,b_half,evHalfSize ); - N=AddMenuCheckItem( window1, (const char*)normal_xpm, Menu,MSGTR_MENU_NormalSize" ",b1,evNormalSize ); - D=AddMenuCheckItem( window1, (const char*)double_xpm, Menu,MSGTR_MENU_DoubleSize,b2,evDoubleSize ); - F=AddMenuCheckItem( window1, (const char*)full_xpm, Menu,MSGTR_MENU_FullScreen,guiApp.subWindow.isFullScreen,evFullScreen ); - if ( !gtkShowVideoWindow && !guiInfo.Playing ) - { - gtk_widget_set_sensitive( H,FALSE ); - gtk_widget_set_sensitive( N,FALSE ); - gtk_widget_set_sensitive( D,FALSE ); - gtk_widget_set_sensitive( F,FALSE ); - } - } - - AddSeparator( Menu ); - AddMenuItem( window1, (const char*)exit_xpm, Menu,MSGTR_MENU_Exit, evExit ); - - return Menu; -}
--- a/gui/ui/gtk/gtk_menu.h Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_GUI_MENU_H -#define MPLAYER_GUI_MENU_H - -#include <gtk/gtk.h> - -extern GtkWidget * DVDSubMenu; - -GtkWidget * AddMenuItem( GtkWidget *window1, const char * immagine_xpm, GtkWidget * SubMenu, const char * label, int Number ); -GtkWidget * AddSubMenu( GtkWidget *window1, const char * immagine_xpm, GtkWidget * Menu, const char * label ); -GtkWidget * AddSeparator( GtkWidget * Menu ); -GtkWidget * create_PopUpMenu( void ); - -#endif /* MPLAYER_GUI_MENU_H */
--- a/gui/ui/gtk/gtk_url.c Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -#include <gdk/gdkkeysyms.h> -#include <gtk/gtk.h> - -#include "gtk_url.h" -#include "gtk_common.h" -#include "gui/interface.h" -#include "gui/app.h" -#include "gui/ui/gmplayer.h" -#include "gui/ui/widgets.h" -#include "help_mp.h" - -GtkWidget * URL = NULL; - -static GtkWidget * URLCombo; -static GtkWidget * URLEntry; -static GList * URLComboEntrys = NULL; - -void ShowURLDialogBox( void ) -{ - if ( URL ) gtkActive( URL ); - else URL=create_URL(); - - if ( URLList ) - { - urlItem * item = URLList; - g_list_free( URLComboEntrys ); - URLComboEntrys=NULL; - while( item ) - { - URLComboEntrys=g_list_append( URLComboEntrys,(gchar *)item->url ); - item=item->next; - } - } - - if ( URLComboEntrys ) - { - gtk_entry_set_text( GTK_ENTRY( URLEntry ),URLComboEntrys->data ); - gtk_combo_set_popdown_strings( GTK_COMBO( URLCombo ),URLComboEntrys ); - } - - gtk_widget_show( URL ); -} - -static void HideURLDialogBox( void ) -{ - if ( !URL ) return; - gtk_widget_hide( URL ); - gtk_widget_destroy( URL ); - URL=0; -} - -static void on_Button_pressed( GtkButton * button,gpointer user_data ) -{ - urlItem * item; - - if ( (int)user_data ) - { - gchar * str= strdup( gtk_entry_get_text( GTK_ENTRY( URLEntry ) ) ); - - if ( str ) - { - if ( strncmp( str,"http://",7 ) - && strncmp( str,"ftp://",6 ) - && strncmp( str,"mms://",6 ) - && strncmp( str,"pnm://",6 ) - && strncmp( str,"rtsp://",7 ) ) - { - gchar * tmp; - tmp=malloc( strlen( str ) + 8 ); - sprintf( tmp,"http://%s",str ); - free( str ); str=tmp; - } - URLComboEntrys=g_list_prepend( URLComboEntrys,(gchar *)str ); - - item=calloc( 1,sizeof( urlItem ) ); - item->url=gstrdup( str ); - gtkSet( gtkAddURLItem,0,(void *)item ); - - guiSetFilename( guiInfo.Filename,str ); guiInfo.FilenameChanged=1; - uiEventHandling( evPlayNetwork,0 ); - } - } - HideURLDialogBox(); -} - -GtkWidget * create_URL( void ) -{ - GtkWidget * vbox1; - GtkWidget * hbox1; - GtkWidget * hbuttonbox1; - GtkWidget * Ok; - GtkWidget * Cancel; - GtkAccelGroup * accel_group; - - accel_group=gtk_accel_group_new(); - - URL=gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_widget_set_name( URL,"URL" ); - gtk_object_set_data( GTK_OBJECT( URL ),"URL",URL ); - gtk_widget_set_usize( URL,384,70 ); - GTK_WIDGET_SET_FLAGS( URL,GTK_CAN_DEFAULT ); - gtk_window_set_title( GTK_WINDOW( URL ),MSGTR_Network ); - gtk_window_set_position( GTK_WINDOW( URL ),GTK_WIN_POS_CENTER ); - gtk_window_set_policy( GTK_WINDOW( URL ),TRUE,TRUE,FALSE ); - gtk_window_set_wmclass( GTK_WINDOW( URL ),"Network","MPlayer" ); - - gtk_widget_realize( URL ); - gtkAddIcon( URL ); - - vbox1=AddVBox( AddDialogFrame( URL ),0 ); - hbox1=AddHBox( vbox1,1 ); - AddLabel( "URL: ",hbox1 ); - - URLCombo=AddComboBox( hbox1 ); -/* - gtk_combo_new(); - gtk_widget_set_name( URLCombo,"URLCombo" ); - gtk_widget_show( URLCombo ); - gtk_box_pack_start( GTK_BOX( hbox1 ),URLCombo,TRUE,TRUE,0 ); -*/ - URLEntry=GTK_COMBO( URLCombo )->entry; - gtk_widget_set_name( URLEntry,"URLEntry" ); - gtk_widget_show( URLEntry ); - - AddHSeparator( vbox1 ); - - hbuttonbox1=AddHButtonBox( vbox1 ); - gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); - gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); - - Ok=AddButton( MSGTR_Ok,hbuttonbox1 ); - Cancel=AddButton( MSGTR_Cancel,hbuttonbox1 ); - - gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); - gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); - - gtk_signal_connect( GTK_OBJECT( URL ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&URL ); - gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Button_pressed ),(void *)1 ); - gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( on_Button_pressed ),NULL ); - - gtk_widget_grab_focus( URLEntry ); - gtk_window_add_accel_group( GTK_WINDOW( URL ),accel_group ); - - return URL; -}
--- a/gui/ui/gtk/gtk_url.h Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_GUI_GTK_URL_H -#define MPLAYER_GUI_GTK_URL_H - -#include <gtk/gtk.h> - -extern GtkWidget * URL; -extern int gtkVURLDialogBox; - -void ShowURLDialogBox( void ); -GtkWidget * create_URL( void ); - -#endif /* MPLAYER_GUI_GTK_URL_H */
--- a/gui/ui/gtk/mb.c Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "config.h" -#include "gui/app.h" -#include "help_mp.h" - -#include "gui/ui/pixmaps/error.xpm" -#include "gui/ui/pixmaps/warning.xpm" - -#include "gui/ui/widgets.h" -#include "mb.h" -#include "gtk_common.h" - -GtkWidget * gtkMessageBoxText; -GtkWidget * MessageBox = NULL; - -void ShowMessageBox( const char * msg ) -{ - if ( MessageBox ) { gtk_widget_hide( MessageBox ); gtk_widget_destroy( MessageBox ); } - MessageBox=create_MessageBox( 0 ); - if ( strlen( msg ) < 20 ) gtk_widget_set_usize( MessageBox,196,-1 ); -} - -static void on_Ok_released( GtkButton * button,gpointer user_data ) -{ - gtk_widget_hide( MessageBox ); - gtk_widget_destroy( MessageBox ); - MessageBox=NULL; -} - -GtkWidget * create_MessageBox( int type ) -{ - GtkWidget * vbox1; - GtkWidget * hbox1; - GtkWidget * hbuttonbox1; - GtkWidget * Ok; - GtkAccelGroup * accel_group; - GtkStyle * pixmapstyle; - GdkPixmap * pixmapwid; - GdkBitmap * mask; - - accel_group=gtk_accel_group_new(); - - MessageBox=gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_widget_set_name( MessageBox,"MessageBox" ); - gtk_object_set_data( GTK_OBJECT( MessageBox ),"MessageBox",MessageBox ); - gtk_widget_set_events( MessageBox,GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_VISIBILITY_NOTIFY_MASK ); - gtk_window_set_title( GTK_WINDOW( MessageBox ),"MPlayer ..." ); - gtk_window_set_position( GTK_WINDOW( MessageBox ),GTK_WIN_POS_CENTER ); - gtk_window_set_modal( GTK_WINDOW( MessageBox ),TRUE ); - gtk_window_set_policy( GTK_WINDOW( MessageBox ),TRUE,TRUE,FALSE ); - gtk_window_set_wmclass( GTK_WINDOW( MessageBox ),"Message","MPlayer" ); - - gtk_widget_realize( MessageBox ); - gtkAddIcon( MessageBox ); - - vbox1=AddVBox( AddDialogFrame( MessageBox ),0 ); - hbox1=AddHBox( vbox1,1 ); - - pixmapstyle=gtk_widget_get_style( MessageBox ); - - pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )warning_xpm ); - WarningPixmap=gtk_pixmap_new( pixmapwid,mask ); - pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )error_xpm ); - ErrorPixmap=gtk_pixmap_new( pixmapwid,mask ); - - gtk_widget_set_name( WarningPixmap,"pixmap1" ); - gtk_widget_hide( WarningPixmap ); - gtk_box_pack_start( GTK_BOX( hbox1 ),WarningPixmap,FALSE,FALSE,0 ); - gtk_widget_set_usize( WarningPixmap,55,-2 ); - - gtk_widget_set_name( ErrorPixmap,"pixmap1" ); - gtk_widget_hide( ErrorPixmap ); - gtk_box_pack_start( GTK_BOX( hbox1 ),ErrorPixmap,FALSE,FALSE,0 ); - gtk_widget_set_usize( ErrorPixmap,55,-2 ); - - gtkMessageBoxText=gtk_label_new( "Text jol. Ha ezt megerted,akkor neked nagyon jo a magyar tudasod,te." ); - gtk_widget_set_name( gtkMessageBoxText,"gtkMessageBoxText" ); - gtk_widget_show( gtkMessageBoxText ); - gtk_box_pack_start( GTK_BOX( hbox1 ),gtkMessageBoxText,TRUE,TRUE,0 ); -// gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_FILL ); - gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_CENTER ); - gtk_label_set_line_wrap( GTK_LABEL( gtkMessageBoxText ),FALSE ); - - AddHSeparator( vbox1 ); - hbuttonbox1=AddHButtonBox( vbox1 ); - Ok=AddButton( MSGTR_Ok,hbuttonbox1 ); - - gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); - gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); - - gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&MessageBox ); - gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Ok_released ),NULL ); - - gtk_window_add_accel_group( GTK_WINDOW( MessageBox ),accel_group ); - - return MessageBox; -}
--- a/gui/ui/gtk/mb.h Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_GUI_MB_H -#define MPLAYER_GUI_MB_H - -#include <gtk/gtk.h> - -extern GtkWidget * MessageBox; - -GtkWidget * create_MessageBox( int type ); -void ShowMessageBox( const char * msg ); - -#endif /* MPLAYER_GUI_MB_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/menu.c Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,647 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "config.h" +#include "help_mp.h" +#include "access_mpcontext.h" +#include "mixer.h" +#include "mpcommon.h" + +#include "menu.h" +#include "gui/ui/widgets.h" +#include "gui/ui/gmplayer.h" +#include "gui/app.h" + +#include "stream/stream.h" +#include "libmpdemux/demuxer.h" +#include "libmpdemux/stheader.h" +#include "libavutil/avstring.h" + +#include "gui/ui/pixmaps/about.xpm" +#include "gui/ui/pixmaps/half.xpm" +#include "gui/ui/pixmaps/normal.xpm" +#include "gui/ui/pixmaps/double.xpm" +#include "gui/ui/pixmaps/full.xpm" +#include "gui/ui/pixmaps/exit.xpm" +#include "gui/ui/pixmaps/prefs.xpm" +#include "gui/ui/pixmaps/equalizer.xpm" +#include "gui/ui/pixmaps/playlist.xpm" +#include "gui/ui/pixmaps/skin.xpm" +#include "gui/ui/pixmaps/sound.xpm" +#include "gui/ui/pixmaps/open.xpm" +#include "gui/ui/pixmaps/play.xpm" +#include "gui/ui/pixmaps/stop.xpm" +#include "gui/ui/pixmaps/pause.xpm" +#include "gui/ui/pixmaps/prev.xpm" +#include "gui/ui/pixmaps/next.xpm" +#include "gui/ui/pixmaps/aspect.xpm" +#include "gui/ui/pixmaps/aspect11.xpm" +#include "gui/ui/pixmaps/aspect169.xpm" +#include "gui/ui/pixmaps/aspect235.xpm" +#include "gui/ui/pixmaps/aspect43.xpm" +#include "gui/ui/pixmaps/file2.xpm" +#include "gui/ui/pixmaps/url.xpm" +#include "gui/ui/pixmaps/sub.xpm" +#include "gui/ui/pixmaps/nosub.xpm" +#include "gui/ui/pixmaps/empty.xpm" +#include "gui/ui/pixmaps/loadeaf.xpm" +#include "gui/ui/pixmaps/title.xpm" +#ifdef CONFIG_DVDREAD +#include "gui/ui/pixmaps/dvd.xpm" +#include "gui/ui/pixmaps/playdvd.xpm" +#include "gui/ui/pixmaps/chapter.xpm" +#include "gui/ui/pixmaps/dolby.xpm" +#include "gui/ui/pixmaps/audiolang.xpm" +#include "gui/ui/pixmaps/sublang.xpm" +#include "gui/ui/pixmaps/empty1px.xpm" +#endif +#ifdef CONFIG_VCD +#include "gui/ui/pixmaps/vcd.xpm" +#include "gui/ui/pixmaps/playvcd.xpm" +#endif + +static void ActivateMenuItem( int Item ) +{ +// fprintf( stderr,"[menu] item: %d.%d\n",Item&0xffff,Item>>16 ); + gtkPopupMenu=Item & 0x0000ffff; + gtkPopupMenuParam=Item >> 16; + uiEventHandling( Item & 0x0000ffff,Item >> 16 ); +} + +static GtkWidget * AddMenuCheckItem(GtkWidget *window1, const char * immagine_xpm, GtkWidget* Menu,const char* label, gboolean state, int Number) +{ + GtkWidget * Label = NULL; + GtkWidget * Pixmap = NULL; + GtkWidget * hbox = NULL; + GtkWidget * Item = NULL; + + GdkPixmap *PixmapIcon = NULL; + GdkColor transparent; + GdkBitmap *MaskIcon = NULL; + + PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm ); + Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon); + gdk_pixmap_unref (PixmapIcon); + + Item=gtk_check_menu_item_new(); + Label = gtk_label_new (label); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0); + gtk_container_add (GTK_CONTAINER (Item), hbox); + + gtk_menu_append( GTK_MENU( Menu ),Item ); + + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(Item),state); + gtk_signal_connect_object( GTK_OBJECT(Item),"activate", + GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number ); + gtk_menu_item_right_justify (GTK_MENU_ITEM (Item)); + gtk_widget_show_all(Item); + + return Item; +} +GtkWidget * AddMenuItem( GtkWidget *window1, const char * immagine_xpm, GtkWidget * SubMenu,const char * label,int Number ) +{ + GtkWidget * Label = NULL; + GtkWidget * Pixmap = NULL; + GtkWidget * hbox = NULL; + GtkWidget * Item = NULL; + GdkPixmap * PixmapIcon = NULL; + GdkColor transparent; + GdkBitmap * MaskIcon = NULL; + + PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm ); + Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon); + gdk_pixmap_unref (PixmapIcon); + + Item=gtk_menu_item_new(); + Label = gtk_label_new (label); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0); + gtk_container_add (GTK_CONTAINER (Item), hbox); + + + gtk_menu_append( GTK_MENU( SubMenu ),Item ); + gtk_signal_connect_object( GTK_OBJECT(Item),"activate", + GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number ); + + gtk_menu_item_right_justify (GTK_MENU_ITEM (Item)); + gtk_widget_show_all(Item); + return Item; +} + + +GtkWidget * AddSubMenu( GtkWidget *window1, const char * immagine_xpm, GtkWidget * Menu,const char * label ) +{ + GtkWidget * Label = NULL; + GtkWidget * Pixmap = NULL; + GtkWidget * hbox = NULL; + GtkWidget * Item = NULL; + GtkWidget * SubItem = NULL; + GdkPixmap * PixmapIcon = NULL; + GdkColor transparent; + GdkBitmap * MaskIcon = NULL; + + PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm); + Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon); + gdk_pixmap_unref (PixmapIcon); + + SubItem=gtk_menu_item_new(); + Item=gtk_menu_new(); + Label = gtk_label_new (label); + + hbox = gtk_hbox_new (FALSE, 8); + gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0); + gtk_container_add (GTK_CONTAINER (SubItem), hbox); + + gtk_menu_append( GTK_MENU( Menu ),SubItem ); + gtk_menu_item_set_submenu( GTK_MENU_ITEM( SubItem ),Item ); + + gtk_widget_show_all( SubItem ); + return Item; +} + +GtkWidget * AddSeparator( GtkWidget * Menu ) +{ + GtkWidget * Item = NULL; + + Item=gtk_menu_item_new (); + gtk_widget_show( Item ); + gtk_container_add( GTK_CONTAINER( Menu ),Item ); + gtk_widget_set_sensitive( Item,FALSE ); + + return Item; +} + +typedef struct +{ + int id; + const char * name; +} Languages_t; + +#define lng( a,b ) ( (int)(a) * 256 + b ) +static Languages_t Languages[] = + { + { lng( 'a','b' ), "Abkhazian" }, + { lng( 'a','a' ), "Afar" }, + { lng( 'a','f' ), "Afrikaans" }, + { lng( 's','q' ), "Albanian" }, + { lng( 'a','m' ), "Amharic" }, + { lng( 'a','r' ), "Arabic" }, + { lng( 'h','y' ), "Armenian" }, + { lng( 'a','s' ), "Assamese" }, + { lng( 'a','e' ), "Avestan" }, + { lng( 'a','y' ), "Aymara" }, + { lng( 'a','z' ), "Azerbaijani" }, + { lng( 'b','a' ), "Bashkir" }, + { lng( 'e','u' ), "Basque" }, + { lng( 'b','e' ), "Belarusian" }, + { lng( 'b','n' ), "Bengali" }, + { lng( 'b','h' ), "Bihari" }, + { lng( 'b','i' ), "Bislama" }, + { lng( 'b','s' ), "Bosnian" }, + { lng( 'b','r' ), "Breton" }, + { lng( 'b','g' ), "Bulgarian" }, + { lng( 'm','y' ), "Burmese" }, + { lng( 'c','a' ), "Catalan" }, + { lng( 'c','h' ), "Chamorro" }, + { lng( 'c','e' ), "Chechen" }, + { lng( 'n','y' ), "Chichewa;Nyanja" }, + { lng( 'z','h' ), "Chinese" }, + { lng( 'c','u' ), "ChurchSlavic" }, + { lng( 'c','v' ), "Chuvash" }, + { lng( 'k','w' ), "Cornish" }, + { lng( 'c','o' ), "Corsican" }, + { lng( 'h','r' ), "Croatian" }, + { lng( 'c','s' ), "Czech" }, + { lng( 'd','a' ), "Danish" }, + { lng( 'n','l' ), "Dutch" }, + { lng( 'd','z' ), "Dzongkha" }, + { lng( 'e','n' ), "English" }, + { lng( 'e','o' ), "Esperanto" }, + { lng( 'e','t' ), "Estonian" }, + { lng( 'f','o' ), "Faroese" }, + { lng( 'f','j' ), "Fijian" }, + { lng( 'f','i' ), "Finnish" }, + { lng( 'f','r' ), "French" }, + { lng( 'f','y' ), "Frisian" }, + { lng( 'g','d' ), "Gaelic(Scots" }, + { lng( 'g','l' ), "Gallegan" }, + { lng( 'k','a' ), "Georgian" }, + { lng( 'd','e' ), "German" }, + { lng( 'e','l' ), "Greek" }, + { lng( 'g','n' ), "Guarani" }, + { lng( 'g','u' ), "Gujarati" }, + { lng( 'h','a' ), "Hausa" }, + { lng( 'h','e' ), "Hebrew" }, + { lng( 'i','w' ), "Hebrew" }, + { lng( 'h','z' ), "Herero" }, + { lng( 'h','i' ), "Hindi" }, + { lng( 'h','o' ), "HiriMotu" }, + { lng( 'h','u' ), "Hungarian" }, + { lng( 'i','s' ), "Icelandic" }, + { lng( 'i','d' ), "Indonesian" }, + { lng( 'i','n' ), "Indonesian" }, + { lng( 'i','a' ), "Interlingua" }, + { lng( 'i','e' ), "Interlingue" }, + { lng( 'i','u' ), "Inuktitut" }, + { lng( 'i','k' ), "Inupiaq" }, + { lng( 'g','a' ), "Irish" }, + { lng( 'i','t' ), "Italian" }, + { lng( 'j','a' ), "Japanese" }, + { lng( 'j','v' ), "Javanese" }, + { lng( 'j','w' ), "Javanese" }, + { lng( 'k','l' ), "Kalaallisut" }, + { lng( 'k','n' ), "Kannada" }, + { lng( 'k','s' ), "Kashmiri" }, + { lng( 'k','k' ), "Kazakh" }, + { lng( 'k','m' ), "Khmer" }, + { lng( 'k','i' ), "Kikuyu" }, + { lng( 'r','w' ), "Kinyarwanda" }, + { lng( 'k','y' ), "Kirghiz" }, + { lng( 'k','v' ), "Komi" }, + { lng( 'k','o' ), "Korean" }, + { lng( 'k','j' ), "Kuanyama" }, + { lng( 'k','u' ), "Kurdish" }, + { lng( 'l','o' ), "Lao" }, + { lng( 'l','a' ), "Latin" }, + { lng( 'l','v' ), "Latvian" }, + { lng( 'l','b' ), "Letzeburgesch" }, + { lng( 'l','n' ), "Lingala" }, + { lng( 'l','t' ), "Lithuanian" }, + { lng( 'm','k' ), "Macedonian" }, + { lng( 'm','g' ), "Malagasy" }, + { lng( 'm','s' ), "Malay" }, + { lng( 'm','l' ), "Malayalam" }, + { lng( 'm','t' ), "Maltese" }, + { lng( 'g','v' ), "Manx" }, + { lng( 'm','i' ), "Maori" }, + { lng( 'm','r' ), "Marathi" }, + { lng( 'm','h' ), "Marshall" }, + { lng( 'm','o' ), "Moldavian" }, + { lng( 'm','n' ), "Mongolian" }, + { lng( 'n','a' ), "Nauru" }, + { lng( 'n','v' ), "Navajo" }, + { lng( 'n','d' ), "North Ndebele" }, + { lng( 'n','r' ), "South Ndebele" }, + { lng( 'n','g' ), "Ndonga" }, + { lng( 'n','e' ), "Nepali" }, + { lng( 's','e' ), "NorthernSami" }, + { lng( 'n','o' ), "Norwegian" }, + { lng( 'n','b' ), "NorwegianBokmål" }, + { lng( 'n','n' ), "NorwegianNynorsk" }, + { lng( 'n','y' ), "Nyanja;Chichewa" }, + { lng( 'o','c' ), "Occitan(post1500;Provençal" }, + { lng( 'o','r' ), "Oriya" }, + { lng( 'o','m' ), "Oromo" }, + { lng( 'o','s' ), "Ossetian;Ossetic" }, + { lng( 'p','i' ), "Pali" }, + { lng( 'p','a' ), "Panjabi" }, + { lng( 'f','a' ), "Persian" }, + { lng( 'p','l' ), "Polish" }, + { lng( 'p','t' ), "Portuguese" }, + { lng( 'o','c' ), "Provençal;Occitan(post1500" }, + { lng( 'p','s' ), "Pushto" }, + { lng( 'q','u' ), "Quechua" }, + { lng( 'r','m' ), "Raeto-Romance" }, + { lng( 'r','o' ), "Romanian" }, + { lng( 'r','n' ), "Rundi" }, + { lng( 'r','u' ), "Russian" }, + { lng( 's','m' ), "Samoan" }, + { lng( 's','g' ), "Sango" }, + { lng( 's','a' ), "Sanskrit" }, + { lng( 's','c' ), "Sardinian" }, + { lng( 's','r' ), "Serbian" }, + { lng( 's','n' ), "Shona" }, + { lng( 's','d' ), "Sindhi" }, + { lng( 's','i' ), "Sinhalese" }, + { lng( 's','k' ), "Slovak" }, + { lng( 's','l' ), "Slovenian" }, + { lng( 's','o' ), "Somali" }, + { lng( 's','t' ), "Sotho" }, + { lng( 'e','s' ), "Spanish" }, + { lng( 's','u' ), "Sundanese" }, + { lng( 's','w' ), "Swahili" }, + { lng( 's','s' ), "Swati" }, + { lng( 's','v' ), "Swedish" }, + { lng( 't','l' ), "Tagalog" }, + { lng( 't','y' ), "Tahitian" }, + { lng( 't','g' ), "Tajik" }, + { lng( 't','a' ), "Tamil" }, + { lng( 't','t' ), "Tatar" }, + { lng( 't','e' ), "Telugu" }, + { lng( 't','h' ), "Thai" }, + { lng( 'b','o' ), "Tibetan" }, + { lng( 't','i' ), "Tigrinya" }, + { lng( 't','o' ), "Tonga" }, + { lng( 't','s' ), "Tsonga" }, + { lng( 't','n' ), "Tswana" }, + { lng( 't','r' ), "Turkish" }, + { lng( 't','k' ), "Turkmen" }, + { lng( 't','w' ), "Twi" }, + { lng( 'u','g' ), "Uighur" }, + { lng( 'u','k' ), "Ukrainian" }, + { lng( 'u','r' ), "Urdu" }, + { lng( 'u','z' ), "Uzbek" }, + { lng( 'v','i' ), "Vietnamese" }, + { lng( 'v','o' ), "Volapük" }, + { lng( 'c','y' ), "Welsh" }, + { lng( 'w','o' ), "Wolof" }, + { lng( 'x','h' ), "Xhosa" }, + { lng( 'y','i' ), "Yiddish" }, + { lng( 'j','i' ), "Yiddish" }, + { lng( 'y','o' ), "Yoruba" }, + { lng( 'z','a' ), "Zhuang" }, + { lng( 'z','u' ), "Zulu" }, + }; +#undef lng + +#ifdef CONFIG_DVDREAD +static char * ChannelTypes[] = + { "Dolby Digital","","Mpeg1","Mpeg2","PCM","","Digital Theatre System" }; +static char * ChannelNumbers[] = + { "","Stereo","","","","5.1" }; +#endif + +static const char * GetLanguage( int language ) +{ + unsigned int i; + for ( i=0;i<sizeof( Languages ) / sizeof( Languages_t );i++ ) + if ( Languages[i].id == language ) return Languages[i].name; + return NULL; +} + + +GtkWidget * DVDSubMenu; +GtkWidget * DVDTitleMenu; +GtkWidget * DVDChapterMenu; +GtkWidget * DVDAudioLanguageMenu; +GtkWidget * DVDSubtitleLanguageMenu; +GtkWidget * AspectMenu; +GtkWidget * VCDSubMenu; +GtkWidget * VCDTitleMenu; + +GtkWidget * create_PopUpMenu( void ) +{ + GtkWidget * window1; + GtkWidget * Menu = NULL; + GtkWidget * SubMenu = NULL; + GtkWidget * MenuItem = NULL; + GtkWidget * H, * N, * D, * F; + mixer_t *mixer = mpctx_get_mixer(guiInfo.mpcontext); + int global_sub_size = mpctx_get_global_sub_size(guiInfo.mpcontext); + + Menu=gtk_menu_new(); + gtk_widget_realize (Menu); + window1 = gtk_widget_get_toplevel(Menu); + + + AddMenuItem( window1, (const char*)about_xpm, Menu,MSGTR_MENU_AboutMPlayer" ", evAbout ); + AddSeparator( Menu ); + SubMenu=AddSubMenu( window1, (const char*)open_xpm, Menu,MSGTR_MENU_Open ); + AddMenuItem( window1, (const char*)file2_xpm, SubMenu,MSGTR_MENU_PlayFile" ", evLoadPlay ); +#ifdef CONFIG_VCD + AddMenuItem( window1, (const char*)playvcd_xpm, SubMenu,MSGTR_MENU_PlayVCD, evPlayVCD ); +#endif +#ifdef CONFIG_DVDREAD + AddMenuItem( window1, (const char*)playdvd_xpm, SubMenu,MSGTR_MENU_PlayDVD, evPlayDVD ); +#endif + AddMenuItem( window1, (const char*)url_xpm, SubMenu,MSGTR_MENU_PlayURL, evSetURL ); + AddMenuItem( window1, (const char*)sub_xpm, SubMenu,MSGTR_MENU_LoadSubtitle" ", evLoadSubtitle ); + AddMenuItem( window1, (const char*)nosub_xpm, SubMenu,MSGTR_MENU_DropSubtitle,evDropSubtitle ); + AddMenuItem( window1, (const char*)loadeaf_xpm, SubMenu,MSGTR_MENU_LoadExternAudioFile, evLoadAudioFile ); + SubMenu=AddSubMenu(window1, (const char*)play_xpm, Menu,MSGTR_MENU_Playing ); + AddMenuItem( window1, (const char*)play_xpm, SubMenu,MSGTR_MENU_Play" ", evPlay ); + AddMenuItem( window1, (const char*)pause_xpm, SubMenu,MSGTR_MENU_Pause, evPause ); + AddMenuItem( window1, (const char*)stop_xpm, SubMenu,MSGTR_MENU_Stop, evStop ); + AddMenuItem( window1, (const char*)next_xpm, SubMenu,MSGTR_MENU_NextStream, evNext ); + AddMenuItem( window1, (const char*)prev_xpm, SubMenu,MSGTR_MENU_PrevStream, evPrev ); +// AddSeparator( SubMenu ); +// AddMenuItem( SubMenu,"Back 10 sec", evBackward10sec ); +// AddMenuItem( SubMenu,"Fwd 10 sec", evForward10sec ); +// AddMenuItem( SubMenu,"Back 1 min", evBackward1min ); +// AddMenuItem( SubMenu,"Fwd 1 min", evForward1min ); +// SubMenu=AddSubMenu( Menu,MSGTR_MENU_Size ); +// AddMenuItem( SubMenu,MSGTR_MENU_NormalSize" ", evNormalSize ); +// AddMenuItem( SubMenu,MSGTR_MENU_DoubleSize, evDoubleSize ); +// AddMenuItem( SubMenu,MSGTR_MENU_FullScreen, evFullScreen ); +#ifdef CONFIG_VCD + VCDSubMenu=AddSubMenu( window1, (const char*)vcd_xpm, Menu,MSGTR_MENU_VCD ); + AddMenuItem( window1, (const char*)playvcd_xpm, VCDSubMenu,MSGTR_MENU_PlayDisc,evPlayVCD ); + AddSeparator( VCDSubMenu ); + VCDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, VCDSubMenu,MSGTR_MENU_Titles ); + if ( guiInfo.VCDTracks ) + { + char tmp[32]; int i; + for ( i=1;i < guiInfo.VCDTracks;i++ ) + { + snprintf( tmp,32,MSGTR_MENU_Title,i ); + //AddMenuItem( VCDTitleMenu,tmp,( i << 16 ) + evSetVCDTrack ); + AddMenuItem(window1, (const char*)empty_xpm, VCDTitleMenu,tmp,( i << 16 ) + evSetVCDTrack ); + } + } + else + { + MenuItem=AddMenuItem( window1, (const char*)empty_xpm, VCDTitleMenu,MSGTR_MENU_None,evNone ); + gtk_widget_set_sensitive( MenuItem,FALSE ); + } +#endif +#ifdef CONFIG_DVDREAD + DVDSubMenu=AddSubMenu( window1, (const char*)dvd_xpm, Menu,MSGTR_MENU_DVD ); + AddMenuItem( window1, (const char*)playdvd_xpm, DVDSubMenu,MSGTR_MENU_PlayDisc" ", evPlayDVD ); +// AddMenuItem( DVDSubMenu,MSGTR_MENU_ShowDVDMenu, evNone ); + AddSeparator( DVDSubMenu ); + DVDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, DVDSubMenu,MSGTR_MENU_Titles ); + if ( guiInfo.DVD.titles ) + { + char tmp[32]; int i; + for ( i=1 ; i<= guiInfo.DVD.titles;i++ ) + { + snprintf( tmp,32,MSGTR_MENU_Title,i); + AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDTitleMenu,tmp, + guiInfo.DVD.current_title == i, + (i << 16) + evSetDVDTitle ); + } + } + else + { + MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDTitleMenu,MSGTR_MENU_None,evNone ); + gtk_widget_set_sensitive( MenuItem,FALSE ); + } + DVDChapterMenu=AddSubMenu( window1, (const char*)chapter_xpm, DVDSubMenu,MSGTR_MENU_Chapters ); + if ( guiInfo.DVD.chapters ) + { + char tmp[32]; int i; + for ( i=1;i <= guiInfo.DVD.chapters;i++ ) + { + snprintf( tmp,32,MSGTR_MENU_Chapter,i ); + AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,tmp,guiInfo.DVD.current_chapter == i, + ( i << 16 ) + evSetDVDChapter ); + } + } + else + { + MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDChapterMenu,MSGTR_MENU_None,evNone ); + gtk_widget_set_sensitive( MenuItem,FALSE ); + } + DVDAudioLanguageMenu=AddSubMenu( window1, (const char*)audiolang_xpm, DVDSubMenu,MSGTR_MENU_AudioLanguages ); + if ( guiInfo.DVD.nr_of_audio_channels ) + { + char tmp[64]; int i, id = guiInfo.demuxer ? ((demuxer_t *)guiInfo.demuxer)->audio->id : audio_id; + for ( i=0;i < guiInfo.DVD.nr_of_audio_channels;i++ ) + { + snprintf( tmp,64,"%s - %s %s",GetLanguage( guiInfo.DVD.audio_streams[i].language ), + ChannelTypes[ guiInfo.DVD.audio_streams[i].type ], + ChannelNumbers[ guiInfo.DVD.audio_streams[i].channels ] ); +// if ( id == -1 ) id=audio_id; //guiInfo.DVD.audio_streams[i].id; + AddMenuCheckItem( window1, (const char*)dolby_xpm, DVDAudioLanguageMenu,tmp, + id == guiInfo.DVD.audio_streams[i].id, + ( guiInfo.DVD.audio_streams[i].id << 16 ) + evSetDVDAudio ); + } + } + else + { + MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDAudioLanguageMenu,MSGTR_MENU_None,evNone ); + gtk_widget_set_sensitive( MenuItem,FALSE ); + } + DVDSubtitleLanguageMenu=AddSubMenu( window1, (const char*)sublang_xpm, DVDSubMenu,MSGTR_MENU_SubtitleLanguages ); + if ( guiInfo.DVD.nr_of_subtitles ) + { + char tmp[64]; int i; + AddMenuItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,( (unsigned short)-1 << 16 ) + evSetDVDSubtitle ); + for ( i=0;i < guiInfo.DVD.nr_of_subtitles;i++ ) + { + av_strlcpy( tmp,GetLanguage( guiInfo.DVD.subtitles[i].language ),sizeof(tmp) ); + AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,tmp, + dvdsub_id == guiInfo.DVD.subtitles[i].id, + ( guiInfo.DVD.subtitles[i].id << 16 ) + evSetDVDSubtitle ); + } + } + else + { + MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,evNone ); + gtk_widget_set_sensitive( MenuItem,FALSE ); + } +#endif + +// if ( guiInfo.Playing ) + { + AspectMenu=AddSubMenu( window1, (const char*)aspect_xpm, Menu,MSGTR_MENU_AspectRatio ); + AddMenuItem( window1, (const char*)aspect11_xpm, AspectMenu,MSGTR_MENU_Original,( 1 << 16 ) + evSetAspect ); + AddMenuItem( window1, (const char*)aspect169_xpm, AspectMenu,"16:9",( 2 << 16 ) + evSetAspect ); + AddMenuItem( window1, (const char*)aspect43_xpm, AspectMenu,"4:3",( 3 << 16 ) + evSetAspect ); + AddMenuItem( window1, (const char*)aspect235_xpm, AspectMenu,"2.35",( 4 << 16 ) + evSetAspect ); + } + + if ( guiInfo.Playing && guiInfo.demuxer && guiInfo.StreamType != STREAMTYPE_DVD ) + { + int i,c = 0; + + for ( i=0;i < MAX_A_STREAMS;i++ ) + if ( ((demuxer_t *)guiInfo.demuxer)->a_streams[i] ) c++; + + if ( c > 1 ) + { + SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_AudioTrack ); + for ( i=0;i < MAX_A_STREAMS;i++ ) + if ( ((demuxer_t *)guiInfo.demuxer)->a_streams[i] ) + { + int aid = ((sh_audio_t *)((demuxer_t *)guiInfo.demuxer)->a_streams[i])->aid; + char tmp[32]; + snprintf( tmp,32,MSGTR_MENU_Track,aid ); + AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( aid << 16 ) + evSetAudio ); + } + } + + for ( c=0,i=0;i < MAX_V_STREAMS;i++ ) + if ( ((demuxer_t *)guiInfo.demuxer)->v_streams[i] ) c++; + + if ( c > 1 ) + { + SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_VideoTrack ); + for ( i=0;i < MAX_V_STREAMS;i++ ) + if ( ((demuxer_t *)guiInfo.demuxer)->v_streams[i] ) + { + int vid = ((sh_video_t *)((demuxer_t *)guiInfo.demuxer)->v_streams[i])->vid; + char tmp[32]; + snprintf( tmp,32,MSGTR_MENU_Track,vid ); + AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( vid << 16 ) + evSetVideo ); + } + } + } + + /* cheap subtitle switching for non-DVD streams */ + if ( global_sub_size && guiInfo.StreamType != STREAMTYPE_DVD ) + { + int i; + SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu, MSGTR_MENU_Subtitles ); + AddMenuItem( window1, (const char*)empty_xpm, SubMenu, MSGTR_MENU_None, (-1 << 16) + evSetSubtitle ); + for ( i=0;i < global_sub_size;i++ ) + { + char tmp[32]; + snprintf( tmp, 32, MSGTR_MENU_Track, i ); + AddMenuItem( window1,(const char*)empty_xpm,SubMenu,tmp,( i << 16 ) + evSetSubtitle ); + } + } + + AddSeparator( Menu ); + MenuItem=AddMenuCheckItem( window1, (const char*)sound_xpm, Menu,MSGTR_MENU_Mute,mixer->muted,evMute ); + if ( !guiInfo.AudioType ) gtk_widget_set_sensitive( MenuItem,FALSE ); + AddMenuItem( window1, (const char*)playlist_xpm, Menu,MSGTR_MENU_PlayList, evPlayList ); + AddMenuItem( window1, (const char*)skin_xpm, Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser ); + AddMenuItem( window1, (const char*)prefs_xpm, Menu,MSGTR_MENU_Preferences, evPreferences ); + AddMenuItem( window1, (const char*)equalizer_xpm, Menu,MSGTR_Equalizer, evEqualizer ); + + if ( guiInfo.NoWindow == False ) + { + int b1 = 0, b2 = 0, b_half = 0; + AddSeparator( Menu ); + if ( !guiApp.subWindow.isFullScreen && guiInfo.Playing ) + { + if ( ( guiApp.subWindow.Width == guiInfo.MovieWidth * 2 )&& + ( guiApp.subWindow.Height == guiInfo.MovieHeight * 2 ) ) b2=1; + else if ( ( guiApp.subWindow.Width == guiInfo.MovieWidth / 2 ) && + ( guiApp.subWindow.Height == guiInfo.MovieHeight / 2 ) ) b_half=1; + else b1=1; + } else b1=!guiApp.subWindow.isFullScreen; + H=AddMenuCheckItem( window1, (const char*)half_xpm, Menu,MSGTR_MENU_HalfSize,b_half,evHalfSize ); + N=AddMenuCheckItem( window1, (const char*)normal_xpm, Menu,MSGTR_MENU_NormalSize" ",b1,evNormalSize ); + D=AddMenuCheckItem( window1, (const char*)double_xpm, Menu,MSGTR_MENU_DoubleSize,b2,evDoubleSize ); + F=AddMenuCheckItem( window1, (const char*)full_xpm, Menu,MSGTR_MENU_FullScreen,guiApp.subWindow.isFullScreen,evFullScreen ); + if ( !gtkShowVideoWindow && !guiInfo.Playing ) + { + gtk_widget_set_sensitive( H,FALSE ); + gtk_widget_set_sensitive( N,FALSE ); + gtk_widget_set_sensitive( D,FALSE ); + gtk_widget_set_sensitive( F,FALSE ); + } + } + + AddSeparator( Menu ); + AddMenuItem( window1, (const char*)exit_xpm, Menu,MSGTR_MENU_Exit, evExit ); + + return Menu; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/menu.h Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,31 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_GUI_MENU_H +#define MPLAYER_GUI_MENU_H + +#include <gtk/gtk.h> + +extern GtkWidget * DVDSubMenu; + +GtkWidget * AddMenuItem( GtkWidget *window1, const char * immagine_xpm, GtkWidget * SubMenu, const char * label, int Number ); +GtkWidget * AddSubMenu( GtkWidget *window1, const char * immagine_xpm, GtkWidget * Menu, const char * label ); +GtkWidget * AddSeparator( GtkWidget * Menu ); +GtkWidget * create_PopUpMenu( void ); + +#endif /* MPLAYER_GUI_MENU_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/msgbox.c Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,114 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" +#include "gui/app.h" +#include "help_mp.h" + +#include "gui/ui/pixmaps/error.xpm" +#include "gui/ui/pixmaps/warning.xpm" + +#include "gui/ui/widgets.h" +#include "msgbox.h" +#include "tools.h" + +GtkWidget * gtkMessageBoxText; +GtkWidget * MessageBox = NULL; + +void ShowMessageBox( const char * msg ) +{ + if ( MessageBox ) { gtk_widget_hide( MessageBox ); gtk_widget_destroy( MessageBox ); } + MessageBox=create_MessageBox( 0 ); + if ( strlen( msg ) < 20 ) gtk_widget_set_usize( MessageBox,196,-1 ); +} + +static void on_Ok_released( GtkButton * button,gpointer user_data ) +{ + gtk_widget_hide( MessageBox ); + gtk_widget_destroy( MessageBox ); + MessageBox=NULL; +} + +GtkWidget * create_MessageBox( int type ) +{ + GtkWidget * vbox1; + GtkWidget * hbox1; + GtkWidget * hbuttonbox1; + GtkWidget * Ok; + GtkAccelGroup * accel_group; + GtkStyle * pixmapstyle; + GdkPixmap * pixmapwid; + GdkBitmap * mask; + + accel_group=gtk_accel_group_new(); + + MessageBox=gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_name( MessageBox,"MessageBox" ); + gtk_object_set_data( GTK_OBJECT( MessageBox ),"MessageBox",MessageBox ); + gtk_widget_set_events( MessageBox,GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_VISIBILITY_NOTIFY_MASK ); + gtk_window_set_title( GTK_WINDOW( MessageBox ),"MPlayer ..." ); + gtk_window_set_position( GTK_WINDOW( MessageBox ),GTK_WIN_POS_CENTER ); + gtk_window_set_modal( GTK_WINDOW( MessageBox ),TRUE ); + gtk_window_set_policy( GTK_WINDOW( MessageBox ),TRUE,TRUE,FALSE ); + gtk_window_set_wmclass( GTK_WINDOW( MessageBox ),"Message","MPlayer" ); + + gtk_widget_realize( MessageBox ); + gtkAddIcon( MessageBox ); + + vbox1=AddVBox( AddDialogFrame( MessageBox ),0 ); + hbox1=AddHBox( vbox1,1 ); + + pixmapstyle=gtk_widget_get_style( MessageBox ); + + pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )warning_xpm ); + WarningPixmap=gtk_pixmap_new( pixmapwid,mask ); + pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )error_xpm ); + ErrorPixmap=gtk_pixmap_new( pixmapwid,mask ); + + gtk_widget_set_name( WarningPixmap,"pixmap1" ); + gtk_widget_hide( WarningPixmap ); + gtk_box_pack_start( GTK_BOX( hbox1 ),WarningPixmap,FALSE,FALSE,0 ); + gtk_widget_set_usize( WarningPixmap,55,-2 ); + + gtk_widget_set_name( ErrorPixmap,"pixmap1" ); + gtk_widget_hide( ErrorPixmap ); + gtk_box_pack_start( GTK_BOX( hbox1 ),ErrorPixmap,FALSE,FALSE,0 ); + gtk_widget_set_usize( ErrorPixmap,55,-2 ); + + gtkMessageBoxText=gtk_label_new( "Text jol. Ha ezt megerted,akkor neked nagyon jo a magyar tudasod,te." ); + gtk_widget_set_name( gtkMessageBoxText,"gtkMessageBoxText" ); + gtk_widget_show( gtkMessageBoxText ); + gtk_box_pack_start( GTK_BOX( hbox1 ),gtkMessageBoxText,TRUE,TRUE,0 ); +// gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_FILL ); + gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_CENTER ); + gtk_label_set_line_wrap( GTK_LABEL( gtkMessageBoxText ),FALSE ); + + AddHSeparator( vbox1 ); + hbuttonbox1=AddHButtonBox( vbox1 ); + Ok=AddButton( MSGTR_Ok,hbuttonbox1 ); + + gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); + + gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&MessageBox ); + gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Ok_released ),NULL ); + + gtk_window_add_accel_group( GTK_WINDOW( MessageBox ),accel_group ); + + return MessageBox; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/msgbox.h Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,29 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_GUI_MSGBOX_H +#define MPLAYER_GUI_MSGBOX_H + +#include <gtk/gtk.h> + +extern GtkWidget * MessageBox; + +GtkWidget * create_MessageBox( int type ); +void ShowMessageBox( const char * msg ); + +#endif /* MPLAYER_GUI_MSGBOX_H */
--- a/gui/ui/gtk/opts.c Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1842 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <stdlib.h> -#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 "mpcommon.h" -#include "libao2/audio_out.h" -#include "sub/sub.h" -#include "libvo/video_out.h" -#include "libvo/x11_common.h" -#include "stream/stream.h" -#include "libmpdemux/demuxer.h" -#include "libmpdemux/stheader.h" -#include "libmpcodecs/dec_video.h" -#include "sub/font_load.h" - -#include "gui/app.h" -#include "gui/cfg.h" -#include "gui/interface.h" -#include "gui/ui/gmplayer.h" -#include "gui/ui/widgets.h" -#include "opts.h" -#include "fs.h" -#include "gtk_common.h" - -// 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; - GtkWidget * prEDVDDevice; - GtkWidget * prECDRomDevice; -static GtkWidget * EVFM; -static GtkWidget * EAFM; - -static GtkWidget * CBVFM; -static GtkWidget * CBAFM; -static GtkWidget * CBAudioEqualizer; -//static GtkWidget * CBSurround; -static GtkWidget * CBExtraStereo; -static GtkWidget * CBNormalize; -static GtkWidget * CBSoftwareMixer; -static GtkWidget * CBDoubleBuffer; -static GtkWidget * CBDR; -static GtkWidget * CBFramedrop; -static GtkWidget * CBHFramedrop; -//static GtkWidget * CBFullScreen; -static GtkWidget * CBShowVideoWindow; -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 * CBUseASS; -static GtkWidget * CBASSUseMargins; -static GtkWidget * SBASSTopMargin; -static GtkWidget * SBASSBottomMargin; -static GtkWidget * CBPostprocess; -static GtkWidget * CBCache; -static GtkWidget * CBLoadFullscreen; -static GtkWidget * CBSaveWinPos; -static GtkWidget * CBStopXScreenSaver; -static GtkWidget * CBPlayBar; -static GtkWidget * CBNoIdle; - -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 * RBOSDTPTT; - -static GtkWidget * HSAudioDelay; -static GtkWidget * HSExtraStereoMul; -static GtkWidget * HSPanscan; -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, * HSFPSadj; - -#ifndef CONFIG_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, * RBFontAutoScaleWidth, * RBFontAutoScaleHeight, * RBFontAutoScaleDiagonal; -//static GtkWidget * AutoScale; -#endif - -#ifdef CONFIG_ICONV -static GtkWidget * CBSubEncoding, * ESubEncoding; -#endif - -#if defined(CONFIG_FREETYPE) || defined(CONFIG_ICONV) -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 }, - { "cp1250", MSGTR_PREFERENCES_FontEncoding22}, - { "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 }, - { "cp1256", MSGTR_PREFERENCES_FontEncoding23 }, - { "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; -char * lSEncoding = 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 CONFIG_DXR3 - void ShowDXR3Config( void ); - void HideDXR3Config( void ); -#endif - void ShowAudioConfig( void ); - void HideAudioConfig( void ); - -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 ); -#if defined(CONFIG_FREETYPE) || defined(CONFIG_ICONV) -static void prEntry( GtkContainer * container,gpointer user_data ); -#endif - -void ShowPreferences( void ) -{ - if ( Preferences ) gtkActive( Preferences ); - else Preferences=create_Preferences(); - -// -- 1. page - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBAudioEqualizer ),gtkEnableAudioEqualizer ); -#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_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSoftwareMixer ),soft_vol ); - 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 ); - if ( !strncmp( ao_driver[0],"oss",3 ) || - !strncmp( ao_driver[0],"alsa",4 ) || - !strncmp( ao_driver[0],"esd",3 ) || - !strncmp( ao_driver[0],"sdl",3 ) ) - gtk_widget_set_sensitive( AConfig,TRUE ); - } - } - -// -- 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 ),flip ); - gtk_adjustment_set_value( HSPanscanadj,vo_panscan ); - - { - int i = 0, c = 0; - char * tmp[3]; tmp[2]=""; - old_video_driver=0; - if ( CLVDrivers ) gtk_clist_clear( GTK_CLIST( CLVDrivers ) ); - while ( video_out_drivers[i] ) - if ( video_out_drivers[i++]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) - { - if ( video_driver_list && !gstrcmp( video_driver_list[0],(char *)video_out_drivers[i - 1]->info->short_name ) ) old_video_driver=c; c++; - tmp[0]=(char *)video_out_drivers[i - 1]->info->short_name; tmp[1]=(char *)video_out_drivers[i - 1]->info->name; - gtk_clist_append( GTK_CLIST( CLVDrivers ),tmp ); - } - gtk_clist_select_row( GTK_CLIST( CLVDrivers ),old_video_driver,0 ); - gtk_clist_get_text( GTK_CLIST( CLVDrivers ),old_video_driver,0,(char **)&vo_driver ); - gtk_widget_set_sensitive( VConfig,FALSE ); -#ifdef CONFIG_DXR3 - if ( !gstrcmp( vo_driver[0],"dxr3" ) ) gtk_widget_set_sensitive( VConfig,TRUE ); -#endif - } - - gtk_adjustment_set_value( HSFPSadj,force_fps ); - -// -- 3. page - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSubOverlap ),suboverlap_enabled ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNoAutoSub ),!sub_auto ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBDumpMPSub ),gtkSubDumpMPSub ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBDumpSrt ),gtkSubDumpSrt ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSubUnicode ),sub_unicode ); -#ifdef CONFIG_ASS - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBUseASS ),gtkASS.enabled ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBASSUseMargins ),gtkASS.use_margins ); - gtk_spin_button_set_value( (GtkSpinButton *)SBASSTopMargin,(gdouble)gtkASS.top_margin ); - gtk_spin_button_set_value( (GtkSpinButton *)SBASSBottomMargin,(gdouble)gtkASS.bottom_margin ); - - if ( !gtkASS.enabled ) - { - gtk_widget_set_sensitive( CBASSUseMargins,FALSE ); - gtk_widget_set_sensitive( SBASSTopMargin,FALSE ); - gtk_widget_set_sensitive( SBASSBottomMargin,FALSE ); - } -#endif - - gtk_adjustment_set_value( HSSubDelayadj,sub_delay ); - gtk_adjustment_set_value( HSSubFPSadj,sub_fps ); - gtk_adjustment_set_value( HSSubPositionadj,sub_pos ); - switch ( osd_level ) - { - case 0: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBOSDNone ),TRUE ); break; - case 1: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBOSDIndicator ),TRUE ); break; - case 2: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBOSDTandP ),TRUE ); break; - case 3: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBOSDTPTT ),TRUE ); break; - } -#if 0 - if ( guiInfo.Subtitlename ) gtk_entry_set_text( GTK_ENTRY( ESubtitleName ),guiInfo.Subtitlename ); -#endif - -#ifdef CONFIG_ICONV - if ( sub_cp ) - { - int i; - for ( i=0;lEncoding[i].name;i++ ) - if ( !gstrcmp( sub_cp,lEncoding[i].name ) ) break; - if ( lEncoding[i].name ) lSEncoding=lEncoding[i].comment; - gtk_entry_set_text( GTK_ENTRY( ESubEncoding ),lSEncoding ); - } -#endif - -// --- 4. page - // font ... - if ( font_name ) gtk_entry_set_text( GTK_ENTRY( prEFontName ),font_name ); -#ifndef CONFIG_FREETYPE - gtk_adjustment_set_value( HSFontFactoradj,font_factor ); -#else - gtk_adjustment_set_value( HSFontBluradj,( subtitle_font_radius / 8.0f ) * 100.0f ); - gtk_adjustment_set_value( HSFontOutLineadj,( subtitle_font_thickness / 8.0f ) * 100.0f ); - gtk_adjustment_set_value( HSFontTextScaleadj,text_font_scale_factor ); - gtk_adjustment_set_value( HSFontOSDScaleadj,osd_font_scale_factor ); - if ( subtitle_font_encoding ) - { - int i; - for ( i=0;lEncoding[i].name;i++ ) - if ( !gstrcmp( subtitle_font_encoding,lEncoding[i].name ) ) break; - if ( lEncoding[i].name ) lCEncoding=lEncoding[i].comment; - gtk_entry_set_text( GTK_ENTRY( EFontEncoding ),lCEncoding ); - } - switch ( subtitle_autoscale ) - { - case 0: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBFontNoAutoScale ),TRUE ); break; - case 1: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleHeight ),TRUE ); break; - case 2: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleWidth ),TRUE ); break; - case 3: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleDiagonal ),TRUE ); break; - } -#endif - -// -- 5. page - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNonInterlaved ),force_ni ); - if ( index_mode == 1 ) gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBIndex ),1 ); - { - int i; - GList * Items = NULL; - char * name = NULL; - - Items=g_list_append( Items,MSGTR_PREFERENCES_None ); - for( i=0;mpcodecs_vd_drivers[i];i++ ) - { - Items=g_list_append( Items,(char *)mpcodecs_vd_drivers[i]->info->name ); - if ( video_fm_list && !gstrcmp( video_fm_list[0],(char *)mpcodecs_vd_drivers[i]->info->short_name ) ) name=(char *)mpcodecs_vd_drivers[i]->info->name; - } - gtk_combo_set_popdown_strings( GTK_COMBO( CBVFM ),Items ); - g_list_free( Items ); - if ( name ) gtk_entry_set_text( GTK_ENTRY( EVFM ),name ); - } - - { - int i; - GList * Items = NULL; - char * name = NULL; - - Items=g_list_append( Items,MSGTR_PREFERENCES_None ); - for( i=0;mpcodecs_ad_drivers[i];i++ ) - { - Items=g_list_append( Items,(char *)mpcodecs_ad_drivers[i]->info->name ); - if ( audio_fm_list && !gstrcmp( audio_fm_list[0],(char *)mpcodecs_ad_drivers[i]->info->short_name ) ) name=(char *)mpcodecs_ad_drivers[i]->info->name; - } - gtk_combo_set_popdown_strings( GTK_COMBO( CBAFM ),Items ); - g_list_free( Items ); - if ( name ) gtk_entry_set_text( GTK_ENTRY( EAFM ),name ); - } - -// --- 6. page - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBPostprocess ),gtkVfPP ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ),gtkLoadFullscreen ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSaveWinPos ),gui_save_pos ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBShowVideoWindow ),gtkShowVideoWindow ); - if ( !gtkShowVideoWindow ) - { - gtk_widget_set_sensitive( CBLoadFullscreen,FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ),0 ); - } - 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( CBPlayBar ),gtkEnablePlayBar ); - if ( !guiApp.playbarIsPresent ) - { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBPlayBar ),0 ); - gtk_widget_set_sensitive( CBPlayBar,FALSE ); - } - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNoIdle ),!player_idle_mode ); - - 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 ); - else gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBCache ),TRUE ); - - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBAutoSync ),0 ); - gtk_adjustment_set_value( SBAutoSyncadj,(float)gtkAutoSync ); - if ( !gtkAutoSyncOn ) gtk_widget_set_sensitive( SBAutoSync,FALSE ); - else gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBAutoSync ),TRUE ); - - if ( dvd_device ) gtk_entry_set_text( GTK_ENTRY( prEDVDDevice ),dvd_device ); - else gtk_entry_set_text( GTK_ENTRY( prEDVDDevice ),DEFAULT_DVD_DEVICE ); - if ( cdrom_device ) gtk_entry_set_text( GTK_ENTRY( prECDRomDevice ),cdrom_device ); - else gtk_entry_set_text( GTK_ENTRY( prECDRomDevice ),DEFAULT_CDROM_DEVICE ); - -// -- disables -#ifndef CONFIG_ASS - gtk_widget_set_sensitive( CBUseASS,FALSE ); - gtk_widget_set_sensitive( CBASSUseMargins,FALSE ); - gtk_widget_set_sensitive( SBASSTopMargin,FALSE ); - gtk_widget_set_sensitive( SBASSBottomMargin,FALSE ); -#endif - -// -- signals - gtk_signal_connect( GTK_OBJECT( CBExtraStereo ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)0 ); - gtk_signal_connect( GTK_OBJECT( CBNormalize ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)1 ); - gtk_signal_connect( GTK_OBJECT( CBSoftwareMixer ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)1 ); - gtk_signal_connect( GTK_OBJECT( CBAudioEqualizer ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)2 ); - gtk_signal_connect( GTK_OBJECT( CBShowVideoWindow ),"toggled",GTK_SIGNAL_FUNC( prToggled ), (void*)3 ); -#ifdef CONFIG_FREETYPE - gtk_signal_connect( GTK_OBJECT( RBFontNoAutoScale ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)4 ); - gtk_signal_connect( GTK_OBJECT( RBFontAutoScaleHeight ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)5 ); - gtk_signal_connect( GTK_OBJECT( RBFontAutoScaleWidth ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)6 ); - gtk_signal_connect( GTK_OBJECT( RBFontAutoScaleDiagonal ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)7 ); -#endif - gtk_signal_connect( GTK_OBJECT( CBCache ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)8); - gtk_signal_connect( GTK_OBJECT( CBAutoSync ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)9); -#ifdef CONFIG_ASS - gtk_signal_connect( GTK_OBJECT( CBUseASS ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)10); -#endif - - gtk_signal_connect( GTK_OBJECT( HSExtraStereoMul ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)0 ); - gtk_signal_connect( GTK_OBJECT( HSAudioDelay ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)1 ); - gtk_signal_connect( GTK_OBJECT( HSPanscan ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)2 ); - gtk_signal_connect( GTK_OBJECT( HSSubDelay ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)3 ); - gtk_signal_connect( GTK_OBJECT( HSSubPosition ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)4 ); -#ifndef CONFIG_FREETYPE - gtk_signal_connect( GTK_OBJECT( HSFontFactor ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)5 ); -#else - gtk_signal_connect( GTK_OBJECT( HSFontBlur ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)6 ); - gtk_signal_connect( GTK_OBJECT( HSFontOutLine ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)7 ); - gtk_signal_connect( GTK_OBJECT( HSFontTextScale ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)8 ); - gtk_signal_connect( GTK_OBJECT( HSFontOSDScale ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)9 ); - gtk_signal_connect( GTK_OBJECT( EFontEncoding ),"changed",GTK_SIGNAL_FUNC( prEntry ),(void *)0 ); -#endif -#ifdef CONFIG_ICONV - gtk_signal_connect( GTK_OBJECT( ESubEncoding ),"changed",GTK_SIGNAL_FUNC( prEntry ),(void *)1 ); -#endif - gtk_signal_connect( GTK_OBJECT( HSPPQuality ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)10 ); - - gtk_signal_connect( GTK_OBJECT( CLADrivers ),"select_row",GTK_SIGNAL_FUNC( prCListRow ),(void*)0 ); - gtk_signal_connect( GTK_OBJECT( CLVDrivers ),"select_row",GTK_SIGNAL_FUNC( prCListRow ),(void*)1 ); - - gtk_widget_show( Preferences ); - gtkSetLayer( Preferences ); - { - static int visible = 1; - if ( visible ) - { - gtkMessageBox( GTK_MB_WARNING,MSGTR_PREFERENCES_Message ); - visible=0; - } - } -} - -static void HidePreferences( void ) -{ - if ( !Preferences ) return; - gtk_widget_hide( Preferences ); - gtk_widget_destroy( Preferences ); - Preferences=NULL; - HideAudioConfig(); -#ifdef CONFIG_DXR3 - HideDXR3Config(); -#endif -} - -#if defined(CONFIG_FREETYPE) || defined(CONFIG_ICONV) -static void prEntry( GtkContainer * container,gpointer user_data ) -{ - const char * comment; - int i; - - switch( (int)user_data ) - { -#ifdef CONFIG_FREETYPE - case 0: // font encoding - comment=gtk_entry_get_text( GTK_ENTRY( EFontEncoding ) ); - for ( i=0;lEncoding[i].name;i++ ) - if ( !gstrcmp( lEncoding[i].comment,comment ) ) break; - if ( lEncoding[i].comment ) gtkSet( gtkSetFontEncoding,0,lEncoding[i].name ); - break; -#endif -#ifdef CONFIG_ICONV - case 1: // sub encoding - comment=gtk_entry_get_text( GTK_ENTRY( ESubEncoding ) ); - for ( i=0;lEncoding[i].name;i++ ) - if ( !gstrcmp( lEncoding[i].comment,comment ) ) break; - if ( lEncoding[i].comment ) gtkSet( gtkSetSubEncoding,0,lEncoding[i].name ); - else gtkSet( gtkSetSubEncoding,0,NULL ); - break; -#endif - } -} -#endif - -#define bAConfig 0 -#define bVconfig 1 -#define bOk 2 -#define bCancel 3 -#define bLSubtitle 4 -#define bLFont 5 - -static void prButton( GtkButton * button, gpointer user_data ) -{ - switch ( (int)user_data ) - { - case bOk: - // -- 1. page - gtkEnableAudioEqualizer=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBAudioEqualizer ) ); - gtkAOExtraStereo=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBExtraStereo ) ); - gtkAONorm=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNormalize ) ); - soft_vol=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSoftwareMixer ) ); - gtkSet( gtkSetExtraStereo,HSExtraStereoMuladj->value,NULL ); - audio_delay=HSAudioDelayadj->value; - - gaddlist( &audio_driver_list,ao_driver[0] ); - gaddlist( &video_driver_list,vo_driver[0] ); - - // -- 2. page - vo_doublebuffering=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDoubleBuffer ) ); - vo_directrendering=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDR ) ); - - frame_dropping=0; - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBFramedrop ) ) == TRUE ) frame_dropping=1; - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBHFramedrop ) ) == TRUE ) frame_dropping=2; - - flip=-1; - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBFlip ) ) ) flip=1; - - force_fps=HSFPSadj->value; - - // -- 3. page - suboverlap_enabled=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSubOverlap ) ); - sub_auto=!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNoAutoSub ) ); - gtkSubDumpMPSub=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDumpMPSub ) ); - gtkSubDumpSrt=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDumpSrt ) ); - sub_unicode=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSubUnicode ) ); -#ifdef CONFIG_ASS - gtkASS.enabled=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBUseASS ) ); - gtkASS.use_margins=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBASSUseMargins ) ); - gtkASS.top_margin=gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( SBASSTopMargin ) ); - gtkASS.bottom_margin=gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( SBASSBottomMargin ) ); -#endif - sub_delay=HSSubDelayadj->value; - sub_fps=HSSubFPSadj->value; - sub_pos=(int)HSSubPositionadj->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; - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDTPTT ) ) ) osd_level=3; - - - // --- 4. page - guiSetFilename( font_name,gtk_entry_get_text( GTK_ENTRY( prEFontName ) ) ); -#ifndef CONFIG_FREETYPE - gtkSet( gtkSetFontFactor,HSFontFactoradj->value,NULL ); -#else - gtkSet( gtkSetFontBlur,HSFontBluradj->value,NULL ); - gtkSet( gtkSetFontOutLine,HSFontOutLineadj->value,NULL ); - gtkSet( gtkSetFontTextScale,HSFontTextScaleadj->value,NULL ); - gtkSet( gtkSetFontOSDScale,HSFontOSDScaleadj->value,NULL ); - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontNoAutoScale ) ) ) gtkSet( gtkSetFontAutoScale,0,NULL ); - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleHeight ) ) ) gtkSet( gtkSetFontAutoScale,1,NULL ); - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleWidth ) ) ) gtkSet( gtkSetFontAutoScale,2,NULL ); - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleDiagonal ) ) ) gtkSet( gtkSetFontAutoScale,3,NULL ); -#endif - - // -- 5. page - force_ni=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNonInterlaved ) ); - index_mode=-1; - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBIndex ) ) ) index_mode=1; - - { - int i; - const char * tmp = gtk_entry_get_text( GTK_ENTRY( EVFM ) ); - for( i=0;mpcodecs_vd_drivers[i];i++ ) - if ( !gstrcmp( tmp,(char *)mpcodecs_vd_drivers[i]->info->name ) ) - { gaddlist( &video_fm_list,(char *)mpcodecs_vd_drivers[i]->info->short_name ); break; } - } - - { - int i; - const char * tmp = gtk_entry_get_text( GTK_ENTRY( EAFM ) ); - for( i=0;mpcodecs_ad_drivers[i];i++ ) - if ( !gstrcmp( tmp,(char *)mpcodecs_ad_drivers[i]->info->name ) ) - { gaddlist( &audio_fm_list,(char *)mpcodecs_ad_drivers[i]->info->short_name ); break; } - } - - // --- 6. page - gtkVfPP=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBPostprocess ) ); - gtkLoadFullscreen=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ) ); - gui_save_pos=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSaveWinPos ) ); - gtkShowVideoWindow=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBShowVideoWindow ) ); - stop_xscreensaver=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBStopXScreenSaver ) ); - gtkEnablePlayBar=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBPlayBar ) ); - player_idle_mode=!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNoIdle ) ); - 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 ) ) ); - - case bCancel: - HidePreferences(); - break; - case bAConfig: - if ( !ao_driver[0] ) break; - gtk_widget_set_sensitive( AConfig,FALSE ); - if ( !strncmp( ao_driver[0],"oss",3 ) || - !strncmp( ao_driver[0],"alsa",4 ) || - !strncmp( ao_driver[0],"esd",3 ) || - !strncmp( ao_driver[0],"sdl",3 ) ) { - ShowAudioConfig(); - gtk_widget_set_sensitive( AConfig,TRUE ); - } - break; - case bVconfig: - if ( !vo_driver[0] ) break; - gtk_widget_set_sensitive( VConfig,FALSE ); -#ifdef CONFIG_DXR3 - if ( !gstrcmp( vo_driver[0],"dxr3" ) ) { ShowDXR3Config(); gtk_widget_set_sensitive( VConfig,TRUE ); } -#endif - break; -#if 0 - case bLSubtitle: - break; -#endif - case bLFont: - ShowFileSelect( fsFontSelector,FALSE ); - gtkSetLayer( fsFileSelect ); - break; - } -} - -static gboolean prHScaler( GtkWidget * widget,GdkEventMotion * event,gpointer user_data ) -{ - switch ( (int)user_data ) - { - case 0: // extra stereo coefficient - if ( !guiInfo.Playing ) break; - gtkSet( gtkSetExtraStereo,HSExtraStereoMuladj->value,NULL ); - break; - case 1: // audio delay - audio_delay=HSAudioDelayadj->value; - break; - case 2: // panscan - gtkSet( gtkSetPanscan,HSPanscanadj->value,NULL ); - break; - case 3: // sub delay - sub_delay=HSSubDelayadj->value; - break; - case 4: // sub position - sub_pos=(int)HSSubPositionadj->value; - break; -#ifndef CONFIG_FREETYPE - case 5: // font factor - gtkSet( gtkSetFontFactor,HSFontFactoradj->value,NULL ); - break; -#else - case 6: // font blur - gtkSet( gtkSetFontBlur,HSFontBluradj->value,NULL ); - break; - case 7: // font outline - gtkSet( gtkSetFontOutLine,HSFontOutLineadj->value,NULL ); - break; - case 8: // text scale - gtkSet( gtkSetFontTextScale,HSFontTextScaleadj->value,NULL ); - break; - case 9: // osd scale - gtkSet( gtkSetFontOSDScale,HSFontOSDScaleadj->value,NULL ); - break; -#endif - case 10: // auto quality - gtkSet( gtkSetAutoq,HSPPQualityadj->value,NULL ); - break; - } - return FALSE; -} - -static void prToggled( GtkToggleButton * togglebutton,gpointer user_data ) -{ - int window; - switch ( (int)user_data ) - { - case 0: // extra stereo coefficient - if ( guiInfo.Playing ) - gtk_widget_set_sensitive( HSExtraStereoMul,gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBExtraStereo ) ) ); - break; -// case 1: // normalize -// case 2: // equalizer -// if ( guiInfo.Playing ) gtkMessageBox( GTK_MB_WARNING,"Please remember, this function need restart the playing." ); -// break; - case 3: - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBShowVideoWindow ) ) ) gtk_widget_set_sensitive( CBLoadFullscreen,TRUE ); - else - { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ),0 ); - gtk_widget_set_sensitive( CBLoadFullscreen,FALSE ); - } - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBShowVideoWindow ) ) ) - { - window=wsShowWindow; - gtkActive( Preferences ); - } else window=wsHideWindow; - - if ( !guiInfo.Playing ) wsVisibleWindow( &guiApp.subWindow,window ); - break; - case 4: - case 5: - case 6: - case 7: - gtkSet( gtkSetFontAutoScale,(float)((int)user_data - 4 ),NULL ); - break; - case 8: - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBCache ) ) ) gtk_widget_set_sensitive( SBCache,TRUE ); - else gtk_widget_set_sensitive( SBCache,FALSE ); - break; - case 9: - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBAutoSync ) ) ) gtk_widget_set_sensitive( SBAutoSync,TRUE ); - else gtk_widget_set_sensitive( SBAutoSync,FALSE ); - break; -#ifdef CONFIG_ASS - case 10: - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBUseASS ) ) ) - { - gtk_widget_set_sensitive( CBASSUseMargins,TRUE ); - gtk_widget_set_sensitive( SBASSTopMargin,TRUE ); - gtk_widget_set_sensitive( SBASSBottomMargin,TRUE ); - } - else - { - gtk_widget_set_sensitive( CBASSUseMargins,FALSE ); - gtk_widget_set_sensitive( SBASSTopMargin,FALSE ); - gtk_widget_set_sensitive( SBASSBottomMargin,FALSE ); - } - break; -#endif - } -} - -static void prCListRow( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data ) -{ - switch ( (int)user_data ) - { - case 0: // audio driver - gtk_clist_get_text( GTK_CLIST( CLADrivers ),row,0,(char **)&ao_driver ); - gtk_widget_set_sensitive( AConfig,FALSE ); - if ( !strncmp( ao_driver[0],"oss",3 ) || - !strncmp( ao_driver[0],"alsa",4 ) || - !strncmp( ao_driver[0],"esd",3 ) || - !strncmp( ao_driver[0],"sdl",3 ) ) - gtk_widget_set_sensitive( AConfig,TRUE ); -#ifndef CONFIG_GTK2 - if ( !strncmp( ao_driver[0],"arts",4 ) ) - gtkMessageBox(GTK_MB_WARNING|GTK_MB_SIMPLE, MSGTR_PREFERENCES_ArtsBroken); -#endif - break; - case 1: // video driver - gtk_clist_get_text( GTK_CLIST( CLVDrivers ),row,0,(char **)&vo_driver ); - gtk_widget_set_sensitive( VConfig,FALSE ); -#ifdef CONFIG_DXR3 - if ( !gstrcmp( vo_driver[0],"dxr3" ) ) gtk_widget_set_sensitive( VConfig,TRUE ); -#endif - break; - } -} - -GtkWidget * create_Preferences( void ) -{ - GtkWidget * label; - GtkWidget * frame; - - GtkWidget * vbox1; - GtkWidget * notebook1; - GtkWidget * hbox1; - GtkWidget * vbox2; - GtkWidget * scrolledwindow3; - GtkWidget * vbox3; - GtkWidget * hbox8; - GtkWidget * hbox2; - GtkWidget * vbox4; - GtkWidget * scrolledwindow2; - GtkWidget * hbuttonbox3; - GtkWidget * vbox5; - GtkWidget * vbox6; - GtkWidget * vbox600; - GSList * OSD_group = NULL; -#ifdef CONFIG_ICONV - GSList * Font_group = NULL; - GList * CBFontEncoding_items = NULL; - GList * CBSubEncoding_items = NULL; -#endif - GtkWidget * vbox7; - GtkWidget * vbox8; - GtkWidget * table1; - GtkWidget * vbox9; - GtkWidget * vbox603; - GtkWidget * hbox6; - GtkWidget * hbuttonbox5; -#ifndef CONFIG_FREETYPE - GtkWidget * hbox7; -#endif - GtkWidget * vbox601; - GtkWidget * vbox602; - GtkWidget * hbox5; - GtkWidget * hbuttonbox1; - GtkAccelGroup * accel_group; - - GtkWidget * hbox9; - GtkWidget * hbox91; - GtkWidget * hbox92; - - accel_group=gtk_accel_group_new(); - - Preferences=gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_widget_set_name( Preferences,"Preferences" ); - gtk_object_set_data( GTK_OBJECT( Preferences ),"Preferences",Preferences ); - gtk_window_set_title( GTK_WINDOW( Preferences ),MSGTR_Preferences ); - gtk_window_set_position( GTK_WINDOW( Preferences ),GTK_WIN_POS_CENTER ); -// gtk_window_set_policy( GTK_WINDOW( Preferences ),FALSE,FALSE,FALSE ); - gtk_window_set_wmclass( GTK_WINDOW( Preferences ),"Preferences","MPlayer" ); - - gtk_widget_realize( Preferences ); - gtkAddIcon( Preferences ); - - vbox1=AddVBox( AddDialogFrame( Preferences ),0 ); - notebook1=gtk_notebook_new(); - gtk_widget_set_name( notebook1,"notebook1" ); - gtk_widget_show( notebook1 ); - gtk_box_pack_start( GTK_BOX( vbox1 ),notebook1,TRUE,TRUE,0 ); - - hbox1=AddVBox( notebook1,0 ); - - frame=AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,hbox1,1 ); - frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 ); - -// --- 1. page - - vbox2=AddVBox( frame,0 ); - - scrolledwindow3=gtk_scrolled_window_new( NULL,NULL ); - gtk_widget_set_name( scrolledwindow3,"scrolledwindow3" ); - gtk_widget_show( scrolledwindow3 ); - gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow3,TRUE,TRUE,0 ); - gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow3 ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC ); - - CLADrivers=gtk_clist_new( 2 ); - gtk_widget_set_name( CLADrivers,"CLADrivers" ); - gtk_widget_show( CLADrivers ); - gtk_container_add( GTK_CONTAINER( scrolledwindow3 ),CLADrivers ); - gtk_clist_set_column_width( GTK_CLIST( CLADrivers ),0,50 ); - gtk_clist_column_titles_show( GTK_CLIST( CLADrivers ) ); - gtk_clist_set_shadow_type( GTK_CLIST( CLADrivers ),GTK_SHADOW_NONE ); - gtk_widget_set_usize( CLADrivers,250,-2 ); - gtk_clist_set_column_widget( GTK_CLIST( CLADrivers ),0, - AddLabel( MSGTR_PREFERENCES_AvailableDrivers,NULL ) ); - - AConfig=AddButton( MSGTR_ConfigDriver, - AddHButtonBox( vbox2 ) ); - - vbox3=AddVBox( - AddFrame( NULL,GTK_SHADOW_NONE, - AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,hbox1,0 ),1 ),0 ); - gtk_widget_set_usize( vbox3,250,-2 ); - - CBNormalize=AddCheckButton( MSGTR_PREFERENCES_NormalizeSound,vbox3 ); - CBAudioEqualizer=AddCheckButton( MSGTR_PREFERENCES_EnableEqualizer,vbox3 ); - CBSoftwareMixer=AddCheckButton( MSGTR_PREFERENCES_SoftwareMixer,vbox3 ); -#if 0 - CBSurround=AddCheckButton( "Enable surround",vbox3 ); -#endif - - AddHSeparator( vbox3 ); - CBExtraStereo=AddCheckButton( MSGTR_PREFERENCES_ExtraStereo,vbox3 ); - hbox8=AddHBox( vbox3,1 ); - label=AddLabel( MSGTR_PREFERENCES_Coefficient,hbox8 ); -// gtk_misc_set_padding( GTK_MISC( label ),20,0 ); - HSExtraStereoMuladj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-10,10,0.1,0,0 ) ); - HSExtraStereoMul=AddHScaler( HSExtraStereoMuladj,hbox8,1 ); - AddHSeparator( vbox3 ); - - hbox8=AddHBox( vbox3,1 ); - AddLabel( MSGTR_PREFERENCES_AudioDelay,hbox8 ); - - HSAudioDelayadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-10,10,0.01,0,0 ) ); - HSAudioDelay=AddHScaler( HSAudioDelayadj,hbox8,2 ); - 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. page - - hbox2=AddVBox( notebook1,0 ); - - vbox4=AddVBox( - AddFrame( NULL,GTK_SHADOW_NONE, - AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,hbox2,1 ),1 ),0 ); - - scrolledwindow2=gtk_scrolled_window_new( NULL,NULL ); - gtk_widget_set_name( scrolledwindow2,"scrolledwindow2" ); - gtk_widget_show( scrolledwindow2 ); - gtk_box_pack_start( GTK_BOX( vbox4 ),scrolledwindow2,TRUE,TRUE,0 ); - gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow2 ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC ); - - CLVDrivers=gtk_clist_new( 2 ); - gtk_widget_set_name( CLVDrivers,"CLVDrivers" ); - gtk_widget_show( CLVDrivers ); - gtk_container_add( GTK_CONTAINER( scrolledwindow2 ),CLVDrivers ); - gtk_clist_set_column_width( GTK_CLIST( CLVDrivers ),0,50 ); - gtk_clist_column_titles_show( GTK_CLIST( CLVDrivers ) ); - gtk_clist_set_shadow_type( GTK_CLIST( CLVDrivers ),GTK_SHADOW_NONE ); - gtk_widget_set_usize( CLVDrivers,250,-2 ); - - label=AddLabel( MSGTR_PREFERENCES_AvailableDrivers,NULL ); - gtk_clist_set_column_widget( GTK_CLIST( CLVDrivers ),0,label ); - - hbuttonbox3=AddHButtonBox( vbox4 ); - VConfig=AddButton( MSGTR_ConfigDriver,hbuttonbox3 ); - - vbox5=AddVBox( - AddFrame( NULL,GTK_SHADOW_NONE, - AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,hbox2,0 ),1 ),0 ); - gtk_widget_set_usize( vbox5,250,-2 ); - - CBDoubleBuffer=AddCheckButton( MSGTR_PREFERENCES_DoubleBuffer,vbox5 ); - CBDR=AddCheckButton( MSGTR_PREFERENCES_DirectRender,vbox5 ); - CBFramedrop=AddCheckButton( MSGTR_PREFERENCES_FrameDrop,vbox5 ); - CBHFramedrop=AddCheckButton( MSGTR_PREFERENCES_HFrameDrop,vbox5 ); - CBFlip=AddCheckButton( MSGTR_PREFERENCES_Flip,vbox5 ); - - 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 ); - - 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,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 ); - -// --- 3. page - - vbox6=AddVBox( notebook1,0 ); - - vbox600=AddVBox( - AddFrame( NULL,GTK_SHADOW_NONE, - AddFrame( MSGTR_PREFERENCES_FRAME_OSD_Level,GTK_SHADOW_ETCHED_OUT,vbox6,0 ),1 ),0 ); - - RBOSDNone=AddRadioButton( MSGTR_PREFERENCES_None,&OSD_group,vbox600 ); - RBOSDTandP=AddRadioButton( MSGTR_PREFERENCES_OSDTimer,&OSD_group,vbox600 ); - RBOSDIndicator=AddRadioButton( MSGTR_PREFERENCES_OSDProgress,&OSD_group,vbox600 ); - RBOSDTPTT=AddRadioButton( MSGTR_PREFERENCES_OSDTimerPercentageTotalTime,&OSD_group,vbox600 ); - - vbox7=AddVBox( - AddFrame( NULL,GTK_SHADOW_NONE, - AddFrame( MSGTR_PREFERENCES_FRAME_Subtitle,GTK_SHADOW_ETCHED_OUT,vbox6,0 ),1 ),0 ); - -#if 0 - hbox4=AddHBox( vbox7,1 ); - - AddLabel( MSGTR_PREFERENCES_Subtitle,hbox4 ); - - ESubtitleName=gtk_entry_new(); - gtk_widget_set_name( ESubtitleName,"ESubtitleName" ); - gtk_widget_show( ESubtitleName ); - gtk_box_pack_start( GTK_BOX( hbox4 ),ESubtitleName,TRUE,TRUE,0 ); - - hbuttonbox4=AddHButtonBox( hbuttonbox4 ); - gtk_container_set_border_width( GTK_CONTAINER( hbuttonbox4 ),3 ); - BLoadSubtitle=AddButton( MSGTR_Browse,hbuttonbox4 ); -#endif - - vbox8=AddVBox( vbox7,0 ); - - table1=gtk_table_new( 3,2,FALSE ); - gtk_widget_set_name( table1,"table1" ); - gtk_widget_show( table1 ); - gtk_box_pack_start( GTK_BOX( vbox8 ),table1,FALSE,FALSE,0 ); - - 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,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - -#ifdef CONFIG_ICONV - label=AddLabel( MSGTR_PREFERENCES_FontEncoding,NULL ); - gtk_table_attach( GTK_TABLE( table1 ),label,0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); -#endif - - 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 ); - - 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,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=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 ); - -#ifdef CONFIG_ICONV - CBSubEncoding=gtk_combo_new(); - gtk_widget_set_name( CBSubEncoding,"CBSubEncoding" ); - gtk_widget_show( CBSubEncoding ); - gtk_table_attach( GTK_TABLE( table1 ),CBSubEncoding,1,2,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - CBSubEncoding_items=g_list_append( CBSubEncoding_items,MSGTR_PREFERENCES_None ); - { - int i; - for ( i=0;lEncoding[i].name;i++ ) CBSubEncoding_items=g_list_append( CBSubEncoding_items,lEncoding[i].comment ); - } - gtk_combo_set_popdown_strings( GTK_COMBO( CBSubEncoding ),CBSubEncoding_items ); - g_list_free( CBSubEncoding_items ); - - ESubEncoding=GTK_COMBO( CBSubEncoding )->entry; - gtk_widget_set_name( ESubEncoding,"ESubEncoding" ); - gtk_entry_set_editable( GTK_ENTRY( ESubEncoding ),FALSE ); - gtk_widget_show( ESubEncoding ); -#endif - - vbox9=AddVBox( vbox8,0 ); - - CBSubOverlap=AddCheckButton( MSGTR_PREFERENCES_SUB_Overlap,vbox9 ); - CBNoAutoSub=AddCheckButton( MSGTR_PREFERENCES_SUB_AutoLoad,vbox9 ); - CBSubUnicode=AddCheckButton( MSGTR_PREFERENCES_SUB_Unicode,vbox9 ); - CBDumpMPSub=AddCheckButton( MSGTR_PREFERENCES_SUB_MPSUB,vbox9 ); - CBDumpSrt=AddCheckButton( MSGTR_PREFERENCES_SUB_SRT,vbox9 ); - - AddHSeparator( vbox9 ); - CBUseASS=AddCheckButton( MSGTR_PREFERENCES_SUB_USE_ASS,vbox9 ); - hbox9=AddHBox( vbox9,0 ); - CBASSUseMargins=AddCheckButton( MSGTR_PREFERENCES_SUB_ASS_USE_MARGINS,hbox9 ); - - hbox91=gtk_hbox_new( FALSE,0 ); - gtk_widget_set_name( hbox91,"hbox91" ); - gtk_box_pack_start( GTK_BOX( hbox9 ),hbox91,TRUE,FALSE,0 ); - gtk_widget_show( hbox91 ); - SBASSTopMargin=AddSpinButton( MSGTR_PREFERENCES_SUB_ASS_TOP_MARGIN, - (GtkAdjustment *)gtk_adjustment_new(0,0,512,1,8,0),hbox91 ); - - hbox92=gtk_hbox_new( FALSE,0 ); - gtk_widget_set_name( hbox92,"hbox92" ); - gtk_box_pack_start( GTK_BOX( hbox9 ),hbox92,TRUE,FALSE,0 ); - gtk_widget_show( hbox92 ); - SBASSBottomMargin=AddSpinButton( MSGTR_PREFERENCES_SUB_ASS_BOTTOM_MARGIN, - (GtkAdjustment *)gtk_adjustment_new(0,0,512,1,8,0),hbox92 ); - - label=AddLabel( MSGTR_PREFERENCES_SubtitleOSD,NULL ); - gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),2 ),label ); - vbox601=AddVBox( notebook1,0 ); - -// --- 4. page - - vbox603=AddVBox( - AddFrame( NULL,GTK_SHADOW_NONE, - AddFrame( MSGTR_PREFERENCES_FRAME_Font,GTK_SHADOW_ETCHED_OUT,vbox601,0 ),1 ),0 ); - - hbox6=AddHBox( vbox603,1 ); - AddLabel( MSGTR_PREFERENCES_Font,hbox6 ); - prEFontName=gtk_entry_new(); - gtk_widget_set_name( prEFontName,"prEFontName" ); - gtk_widget_show( prEFontName ); - gtk_box_pack_start( GTK_BOX( hbox6 ),prEFontName,TRUE,TRUE,0 ); - hbuttonbox5=AddHButtonBox( hbox6 ); - gtk_container_set_border_width( GTK_CONTAINER( hbuttonbox5 ),3 ); - BLoadFont=AddButton( MSGTR_Browse,hbuttonbox5 ); - -#ifndef CONFIG_FREETYPE - hbox7=AddHBox( vbox603,1 ); - AddLabel( MSGTR_PREFERENCES_FontFactor,hbox7 ); - HSFontFactoradj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,10,0.05,0,0 ) ); - HSFontFactor=AddHScaler( HSFontFactoradj,hbox7,2 ); -#else - - RBFontNoAutoScale=AddRadioButton( MSGTR_PREFERENCES_FontNoAutoScale,&Font_group,vbox603 ); - RBFontAutoScaleHeight=AddRadioButton( MSGTR_PREFERENCES_FontPropHeight,&Font_group,vbox603 ); - RBFontAutoScaleWidth=AddRadioButton( MSGTR_PREFERENCES_FontPropWidth,&Font_group,vbox603 ); - RBFontAutoScaleDiagonal=AddRadioButton( MSGTR_PREFERENCES_FontPropDiagonal,&Font_group,vbox603 ); - - table1=gtk_table_new( 3,2,FALSE ); - gtk_widget_set_name( table1,"table1" ); - gtk_widget_show( table1 ); - gtk_box_pack_start( GTK_BOX( vbox603 ),table1,FALSE,FALSE,0 ); - - label=AddLabel( MSGTR_PREFERENCES_FontEncoding,NULL ); - gtk_table_attach( GTK_TABLE( table1 ),label,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - CBFontEncoding=gtk_combo_new(); - gtk_widget_set_name( CBFontEncoding,"CBFontEncoding" ); - gtk_widget_show( CBFontEncoding ); - gtk_table_attach( GTK_TABLE( table1 ),CBFontEncoding,1,2,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - { - int i; - for ( i=0;lEncoding[i].name;i++ ) CBFontEncoding_items=g_list_append( CBFontEncoding_items,lEncoding[i].comment ); - } - gtk_combo_set_popdown_strings( GTK_COMBO( CBFontEncoding ),CBFontEncoding_items ); - g_list_free( CBFontEncoding_items ); - - EFontEncoding=GTK_COMBO( CBFontEncoding )->entry; - gtk_widget_set_name( EFontEncoding,"EFontEncoding" ); - gtk_entry_set_editable( GTK_ENTRY( EFontEncoding ),FALSE ); - gtk_widget_show( EFontEncoding ); - - label=AddLabel( MSGTR_PREFERENCES_FontBlur,NULL ); - gtk_table_attach( GTK_TABLE( table1 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - HSFontBluradj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.1,0,0 ) ); - HSFontBlur=AddHScaler( HSFontBluradj,NULL,2 ); - gtk_table_attach( GTK_TABLE( table1 ),HSFontBlur,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - label=AddLabel( MSGTR_PREFERENCES_FontOutLine,NULL ); - gtk_table_attach( GTK_TABLE( table1 ),label,0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - HSFontOutLineadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.1,0,0 ) ); - HSFontOutLine=AddHScaler( HSFontOutLineadj,NULL,2 ); - gtk_table_attach( GTK_TABLE( table1 ),HSFontOutLine,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - label=AddLabel( MSGTR_PREFERENCES_FontTextScale,NULL ); - gtk_table_attach( GTK_TABLE( table1 ),label,0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - HSFontTextScaleadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.1,0,0 ) ); - HSFontTextScale=AddHScaler( HSFontTextScaleadj,NULL,2 ); - gtk_table_attach( GTK_TABLE( table1 ),HSFontTextScale,1,2,3,4,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - label=AddLabel( MSGTR_PREFERENCES_FontOSDScale,NULL ); - gtk_table_attach( GTK_TABLE( table1 ),label,0,1,4,5,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - HSFontOSDScaleadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.1,0,0 ) ); - HSFontOSDScale=AddHScaler( HSFontOSDScaleadj,NULL,2 ); - gtk_table_attach( GTK_TABLE( table1 ),HSFontOSDScale,1,2,4,5,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); -#endif - - 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. page - - vbox601=AddVBox( notebook1,0 ); - - vbox602=AddVBox( - AddFrame( NULL,GTK_SHADOW_NONE, - AddFrame( MSGTR_PREFERENCES_FRAME_CodecDemuxer,GTK_SHADOW_ETCHED_OUT,vbox601,0 ),1 ),0 ); - - CBNonInterlaved=AddCheckButton( MSGTR_PREFERENCES_NI,vbox602 ); - CBIndex=AddCheckButton( MSGTR_PREFERENCES_IDX,vbox602 ); - - hbox5=AddHBox( vbox602,1 ); - - AddLabel( MSGTR_PREFERENCES_VideoCodecFamily,hbox5 ); - - CBVFM=gtk_combo_new(); - gtk_widget_set_name( CBVFM,"CBVFM" ); - gtk_widget_show( CBVFM ); - gtk_box_pack_start( GTK_BOX( hbox5 ),CBVFM,TRUE,TRUE,0 ); - - EVFM=GTK_COMBO( CBVFM )->entry; - gtk_widget_set_name( EVFM,"CEVFM" ); - gtk_entry_set_editable( GTK_ENTRY( EVFM ),FALSE ); - gtk_widget_show( EVFM ); - - hbox5=AddHBox( vbox602,1 ); - - AddLabel( MSGTR_PREFERENCES_AudioCodecFamily,hbox5 ); - - CBAFM=gtk_combo_new(); - gtk_widget_set_name( CBAFM,"CBAFM" ); - gtk_widget_show( CBAFM ); - gtk_box_pack_start( GTK_BOX( hbox5 ),CBAFM,TRUE,TRUE,0 ); - - EAFM=GTK_COMBO( CBAFM )->entry; - gtk_widget_set_name( EAFM,"EAFM" ); - gtk_entry_set_editable( GTK_ENTRY( EAFM ),FALSE ); - gtk_widget_show( EAFM ); - - label=AddLabel( MSGTR_PREFERENCES_Codecs,NULL ); - gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),4 ),label ); - - vbox601=AddVBox( notebook1,0 ); - -// --- 6. page - - vbox602=AddVBox( - AddFrame( NULL,GTK_SHADOW_NONE, - AddFrame( MSGTR_PREFERENCES_FRAME_PostProcess,GTK_SHADOW_ETCHED_OUT,vbox601,0 ),1 ),0 ); - - CBPostprocess=AddCheckButton( MSGTR_PREFERENCES_PostProcess,vbox602 ); - - hbox5=AddHBox( vbox602,1 ); - - AddLabel( MSGTR_PREFERENCES_AutoQuality,hbox5 ); - - if ( guiInfo.sh_video && guiInfo.Playing ) HSPPQualityadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,get_video_quality_max( guiInfo.sh_video ),0,0,0 ) ); - else HSPPQualityadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0,0,0 ) ); - HSPPQuality=AddHScaler( HSPPQualityadj,hbox5,0 ); - - vbox602=AddVBox( - AddFrame( NULL,GTK_SHADOW_NONE, - AddFrame( MSGTR_PREFERENCES_FRAME_Cache,GTK_SHADOW_ETCHED_OUT,vbox601,0 ),1 ),0 ); - - CBCache=AddCheckButton( MSGTR_PREFERENCES_Cache,vbox602 ); - - hbox5=AddHBox( vbox602,1 ); - - AddLabel( MSGTR_PREFERENCES_CacheSize,hbox5 ); - - SBCacheadj=GTK_ADJUSTMENT( gtk_adjustment_new( gtkCacheSize,32,1048576,1,32,0 ) ); - SBCache=gtk_spin_button_new( GTK_ADJUSTMENT( SBCacheadj ),1,0 ); - gtk_widget_show( SBCache ); - gtk_box_pack_start( GTK_BOX( hbox5 ),SBCache,TRUE,TRUE,0 ); - - vbox602=AddVBox( - AddFrame( NULL,GTK_SHADOW_NONE, - AddFrame( MSGTR_PREFERENCES_FRAME_Misc,GTK_SHADOW_ETCHED_OUT,vbox601,1 ),1 ),0 ); - - CBShowVideoWindow=AddCheckButton( MSGTR_PREFERENCES_ShowVideoWindow,vbox602 ); - CBLoadFullscreen=AddCheckButton( MSGTR_PREFERENCES_LoadFullscreen,vbox602 ); - CBSaveWinPos=AddCheckButton( MSGTR_PREFERENCES_SaveWinPos,vbox602 ); - CBStopXScreenSaver=AddCheckButton( MSGTR_PREFERENCES_XSCREENSAVER,vbox602 ); - CBPlayBar=AddCheckButton( MSGTR_PREFERENCES_PlayBar,vbox602 ); - CBNoIdle=AddCheckButton( MSGTR_PREFERENCES_NoIdle,vbox602 ); - - AddHSeparator( vbox602 ); - - CBAutoSync=AddCheckButton( MSGTR_PREFERENCES_AutoSync,vbox602 ); - hbox5=AddHBox( vbox602,1 ); - AddLabel( MSGTR_PREFERENCES_AutoSyncValue,hbox5 ); - SBAutoSyncadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,10000,1,10,10 ) ); - SBAutoSync=gtk_spin_button_new( GTK_ADJUSTMENT( SBAutoSyncadj ),1,0 ); - gtk_widget_show( SBAutoSync ); - gtk_box_pack_start( GTK_BOX( hbox5 ),SBAutoSync,TRUE,TRUE,0 ); - - AddHSeparator( vbox602 ); - - table1=gtk_table_new( 2,2,FALSE ); - gtk_widget_set_name( table1,"table1" ); - gtk_widget_show( table1 ); - gtk_box_pack_start( GTK_BOX( vbox602 ),table1,FALSE,FALSE,0 ); - - label=AddLabel( MSGTR_PREFERENCES_DVDDevice,NULL ); - gtk_table_attach( GTK_TABLE( table1 ),label,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - prEDVDDevice=gtk_entry_new(); - gtk_widget_set_name( prEDVDDevice,"prEDVDDevice" ); - gtk_widget_show( prEDVDDevice ); - gtk_table_attach( GTK_TABLE( table1 ),prEDVDDevice,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - - label=AddLabel( MSGTR_PREFERENCES_CDROMDevice,NULL ); - gtk_table_attach( GTK_TABLE( table1 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - prECDRomDevice=gtk_entry_new(); - gtk_widget_set_name( prECDRomDevice,"prECDRomDevice" ); - gtk_widget_show( prECDRomDevice ); - gtk_table_attach( GTK_TABLE( table1 ),prECDRomDevice,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); - -// AddHSeparator( vbox602 ); - - label=AddLabel( MSGTR_PREFERENCES_Misc,NULL ); - gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),5 ),label ); - -// --- - - AddHSeparator( vbox1 ); - - hbuttonbox1=AddHButtonBox( vbox1 ); - gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); - gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); - BOk=AddButton( MSGTR_Ok,hbuttonbox1 ); - BCancel=AddButton( MSGTR_Cancel,hbuttonbox1 ); - - gtk_widget_add_accelerator( BOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); - gtk_widget_add_accelerator( BCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); - - gtk_signal_connect( GTK_OBJECT( Preferences ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&Preferences ); - - gtk_signal_connect( GTK_OBJECT( AConfig ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bAConfig ); - gtk_signal_connect( GTK_OBJECT( BOk ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bOk ); - gtk_signal_connect( GTK_OBJECT( BCancel ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bCancel ); - gtk_signal_connect( GTK_OBJECT( VConfig ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bVconfig ); -#if 0 - gtk_signal_connect( GTK_OBJECT( BLoadSubtitle ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bLSubtitle ); -#endif - gtk_signal_connect( GTK_OBJECT( BLoadFont ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bLFont ); - -#if 0 - gtk_signal_connect( GTK_OBJECT( CBNormalize ),"toggled",GTK_SIGNAL_FUNC( on_CBNormalize_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBSoftwareMixer ),"toggled",GTK_SIGNAL_FUNC( on_CBSoftwareMixer_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBSurround ),"toggled",GTK_SIGNAL_FUNC( on_CBSurround_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBExtraStereo ),"toggled",GTK_SIGNAL_FUNC( on_CBExtraStereo_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBDoubleBuffer ),"toggled",GTK_SIGNAL_FUNC( on_CBDoubleBuffer_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBDR ),"toggled",GTK_SIGNAL_FUNC( on_CBDR_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBFramedrop ),"toggled",GTK_SIGNAL_FUNC( on_CBFramedrop_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBHFramedrop ),"toggled",GTK_SIGNAL_FUNC( on_CBHFramedrop_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBFullScreen ),"toggled",GTK_SIGNAL_FUNC( on_CBFullScreen_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBNonInterlaved ),"toggled",GTK_SIGNAL_FUNC( on_CBNonInterlaved_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBFlip ),"toggled",GTK_SIGNAL_FUNC( on_CBFlip_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBPostprocess ),"toggled",GTK_SIGNAL_FUNC( on_CBPostprocess_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBNoAutoSub ),"toggled",GTK_SIGNAL_FUNC( on_CBNoAutoSub_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBSubUnicode ),"toggled",GTK_SIGNAL_FUNC( on_CNSubUnicode_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBDumpMPSub ),"toggled",GTK_SIGNAL_FUNC( on_CBDumpMPSub_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBDumpSrt ),"toggled",GTK_SIGNAL_FUNC( on_CBDumpSrt_toggled ),NULL ); -#endif -#if 0 - gtk_signal_connect( GTK_OBJECT( RBOSDNone ),"toggled",GTK_SIGNAL_FUNC( on_RBOSDNone_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( RBOSDTandP ),"toggled",GTK_SIGNAL_FUNC( on_RBOSDTandP_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( RBOSDIndicator ),"toggled",GTK_SIGNAL_FUNC( on_RBOSDIndicator_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( RBOSDTPTT ),"toggled",GTK_SIGNAL_FUNC( on_RBOSDIndicator_toggled ),NULL ); - gtk_signal_connect( GTK_OBJECT( CBAudioEqualizer ),"toggled",GTK_SIGNAL_FUNC( on_CBAudioEqualizer_toggled ),NULL ); -#endif -#if 0 - gtk_signal_connect( GTK_OBJECT( HSAudioDelay ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSAudioDelay_motion_notify_event ),NULL ); - gtk_signal_connect( GTK_OBJECT( HSPanscan ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSPanscan_motion_notify_event ),NULL ); - gtk_signal_connect( GTK_OBJECT( label2 ),"motion_notify_event",GTK_SIGNAL_FUNC( on_label2_motion_notify_event ),NULL ); - gtk_signal_connect( GTK_OBJECT( HSSubDelay ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSSubDelay_motion_notify_event ),NULL ); - gtk_signal_connect( GTK_OBJECT( HSSubPosition ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSSubPosition_motion_notify_event ),NULL ); - gtk_signal_connect( GTK_OBJECT( HSSubFPS ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSSubFPS_motion_notify_event ),NULL ); - gtk_signal_connect( GTK_OBJECT( HSFontFactor ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSFontFactor_motion_notify_event ),NULL ); - gtk_signal_connect( GTK_OBJECT( HSPPQuality ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSPPQuality_motion_notify_event ),NULL ); -#endif - - gtk_notebook_set_page( GTK_NOTEBOOK( notebook1 ),2 ); - - gtk_window_add_accel_group( GTK_WINDOW( Preferences ),accel_group ); - - return Preferences; -} - -#ifdef CONFIG_OSS_AUDIO -static GList *appendOSSDevices(GList *l) -{ - // careful! the current implementation allows only string constants! - l = g_list_append(l, (gpointer)"/dev/dsp"); - if (gtkAOOSSDevice && strncmp(gtkAOOSSDevice, "/dev/sound", 10) == 0) { - l = g_list_append(l, (gpointer)"/dev/sound/dsp0"); - l = g_list_append(l, (gpointer)"/dev/sound/dsp1"); - l = g_list_append(l, (gpointer)"/dev/sound/dsp2"); - l = g_list_append(l, (gpointer)"/dev/sound/dsp3"); - } else { - l = g_list_append(l, (gpointer)"/dev/dsp0"); - l = g_list_append(l, (gpointer)"/dev/dsp1"); - l = g_list_append(l, (gpointer)"/dev/dsp2"); - l = g_list_append(l, (gpointer)"/dev/dsp3"); - } -#ifdef CONFIG_DXR3 - l = g_list_append(l, (gpointer)"/dev/em8300_ma"); - l = g_list_append(l, (gpointer)"/dev/em8300_ma-0"); - l = g_list_append(l, (gpointer)"/dev/em8300_ma-1"); - l = g_list_append(l, (gpointer)"/dev/em8300_ma-2"); - l = g_list_append(l, (gpointer)"/dev/em8300_ma-3"); -#endif - return l; -} - -static GList *appendOSSMixers(GList *l) -{ - // careful! the current implementation allows only string constants! - l = g_list_append(l, (gpointer)"/dev/mixer"); - if (gtkAOOSSMixer && strncmp(gtkAOOSSMixer, "/dev/sound", 10) == 0) { - l = g_list_append(l, (gpointer)"/dev/sound/mixer0"); - l = g_list_append(l, (gpointer)"/dev/sound/mixer1"); - l = g_list_append(l, (gpointer)"/dev/sound/mixer2"); - l = g_list_append(l, (gpointer)"/dev/sound/mixer3"); - } else { - l = g_list_append(l, (gpointer)"/dev/mixer0"); - l = g_list_append(l, (gpointer)"/dev/mixer1"); - l = g_list_append(l, (gpointer)"/dev/mixer2"); - l = g_list_append(l, (gpointer)"/dev/mixer3"); - } - return l; -} - -static GList *appendOSSMixerChannels(GList *l) -{ - l = g_list_append(l, (gpointer)"vol"); - l = g_list_append(l, (gpointer)"pcm"); - l = g_list_append(l, (gpointer)"line"); - return l; -} -#endif - -#ifdef CONFIG_ALSA -static GList *appendALSADevices(GList *l) -{ - l = g_list_append(l, (gpointer)"default"); - l = g_list_append(l, (gpointer)"hw=0.0"); - l = g_list_append(l, (gpointer)"hw=0.1"); - l = g_list_append(l, (gpointer)"hw=0.2"); - l = g_list_append(l, (gpointer)"surround40"); - l = g_list_append(l, (gpointer)"surround51"); - l = g_list_append(l, (gpointer)"plug=surround40"); - l = g_list_append(l, (gpointer)"plug=surround51"); - return l; -} - -static GList *appendALSAMixers(GList *l) -{ - l = g_list_append(l, (gpointer)"default"); - return l; -} - -static GList *appendALSAMixerChannels(GList *l) -{ - l = g_list_append(l, (gpointer)"Master"); - l = g_list_append(l, (gpointer)"Line"); - l = g_list_append(l, (gpointer)"PCM"); - l = g_list_append(l, (gpointer)"PCM,1"); - return l; -} -#endif - -#ifdef CONFIG_SDL -static GList *appendSDLDevices(GList *l) -{ - l = g_list_append(l, (gpointer)"alsa"); - l = g_list_append(l, (gpointer)"arts"); - l = g_list_append(l, (gpointer)"esd"); - l = g_list_append(l, (gpointer)"jack"); - l = g_list_append(l, (gpointer)"oss"); - l = g_list_append(l, (gpointer)"nas"); - return l; -} -#endif - -#ifdef CONFIG_ESD -static GList *appendESDDevices(GList *l) -{ - l = g_list_append(l, (gpointer)"Enter Remote IP"); - l = g_list_append(l, (gpointer)"Use Software Mixer"); - return l; -} -#endif - -// Gets text string from a gtk entry, interpreting -// MSGTR_PREFERENCES_DriverDefault as null string. -static const char *getGtkEntryText(GtkWidget *from) -{ - const char *tmp = gtk_entry_get_text(GTK_ENTRY(from)); - if (strcmp(tmp, MSGTR_PREFERENCES_DriverDefault) == 0) { - tmp = NULL; - } - return tmp; -} - -// Sets text string of a gtk entry, interpreting -// null string as MSGTR_PREFERENCES_DriverDefault. -static void setGtkEntryText(GtkWidget *dest, char *to) -{ - if (!to) { - to = MSGTR_PREFERENCES_DriverDefault; - } - gtk_entry_set_text(GTK_ENTRY(dest),to); -} - - GtkWidget *AudioConfig; -static GtkWidget *CEAudioDevice; -static GtkWidget *CBAudioDevice; -static GtkWidget *CEAudioMixer; -static GtkWidget *CBAudioMixer; -static GtkWidget *CEAudioMixerChannel; -static GtkWidget *CBAudioMixerChannel; -static GtkWidget *BAudioOk; -static GtkWidget *BAudioCancel; - -void ShowAudioConfig( void ) { - if (AudioConfig) gtkActive(AudioConfig); - else AudioConfig = create_AudioConfig(); - -#ifdef CONFIG_OSS_AUDIO - if (strncmp(ao_driver[0], "oss", 3) == 0) { - setGtkEntryText(CEAudioDevice, gtkAOOSSDevice); - setGtkEntryText(CEAudioMixer, gtkAOOSSMixer); - setGtkEntryText(CEAudioMixerChannel, gtkAOOSSMixerChannel); - } -#endif -#ifdef CONFIG_ALSA - if (strncmp(ao_driver[0], "alsa", 4) == 0) { - setGtkEntryText(CEAudioDevice, gtkAOALSADevice); - setGtkEntryText(CEAudioMixer, gtkAOALSAMixer); - setGtkEntryText(CEAudioMixerChannel, gtkAOALSAMixerChannel); - } -#endif -#ifdef CONFIG_SDL - if (strncmp(ao_driver[0], "sdl", 3) == 0) { - setGtkEntryText(CEAudioDevice, gtkAOSDLDriver); - } -#endif -#ifdef CONFIG_ESD - if (strncmp(ao_driver[0], "esd", 3) == 0) { - setGtkEntryText(CEAudioDevice, gtkAOESDDevice); - } -#endif - - gtk_widget_show(AudioConfig); - gtkSetLayer(AudioConfig); -} - -void HideAudioConfig( void ) { - if (!AudioConfig) return; - gtk_widget_hide(AudioConfig); - gtk_widget_destroy(AudioConfig); - AudioConfig=NULL; -} - -static void audioButton(GtkButton *button, gpointer user_data) { - switch( (int)user_data ) { - case 1: -#ifdef CONFIG_OSS_AUDIO - if (strncmp(ao_driver[0], "oss", 3) == 0) { - gfree((void **) >kAOOSSDevice); - gtkAOOSSDevice = gstrdup(getGtkEntryText(CEAudioDevice)); - gfree((void **) >kAOOSSMixer); - gtkAOOSSMixer = gstrdup(getGtkEntryText(CEAudioMixer)); - gfree((void **) >kAOOSSMixerChannel); - gtkAOOSSMixerChannel = gstrdup(getGtkEntryText(CEAudioMixerChannel)); - } -#endif -#ifdef CONFIG_ALSA - if (strncmp(ao_driver[0], "alsa", 4) == 0) { - gfree((void **) >kAOALSADevice); - gtkAOALSADevice = gstrdup(getGtkEntryText(CEAudioDevice)); - gfree((void **) >kAOALSAMixer); - gtkAOALSAMixer = gstrdup(getGtkEntryText(CEAudioMixer)); - gfree((void **) >kAOALSAMixerChannel); - gtkAOALSAMixerChannel = gstrdup(getGtkEntryText(CEAudioMixerChannel)); - } -#endif -#ifdef CONFIG_SDL - if (strncmp(ao_driver[0], "sdl", 3) == 0) { - gfree((void **) >kAOSDLDriver); - gtkAOSDLDriver = gstrdup(getGtkEntryText(CEAudioDevice)); - } -#endif -#ifdef CONFIG_ESD - if (strncmp(ao_driver[0], "esd", 3) == 0) { - gfree((void **) >kAOESDDevice); - gtkAOESDDevice = gstrdup(getGtkEntryText(CEAudioDevice)); - } -#endif - case 0: - HideAudioConfig(); - break; - } -} - -GtkWidget *create_AudioConfig( void ) { - GList *items = NULL; - GtkWidget *vbox; - GtkWidget *table; - GtkWidget *label; - GtkWidget *hbuttonbox; - GtkAccelGroup *accel_group; - - AudioConfig = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_widget_set_name(AudioConfig, "AudioConfig"); - gtk_object_set_data(GTK_OBJECT(AudioConfig), "AudioConfig", AudioConfig); - gtk_window_set_title(GTK_WINDOW(AudioConfig), MSGTR_AudioPreferences); - gtk_window_set_position(GTK_WINDOW(AudioConfig), GTK_WIN_POS_CENTER); - gtk_window_set_policy(GTK_WINDOW(AudioConfig), FALSE, FALSE, FALSE); - gtk_window_set_wmclass(GTK_WINDOW(AudioConfig), "Audio Config", "MPlayer"); - - gtk_widget_realize(AudioConfig); - gtkAddIcon(AudioConfig); - - vbox = AddVBox(AddDialogFrame(AudioConfig), 0); - - table = gtk_table_new(2, 3, FALSE); - gtk_widget_set_name(table, "table"); - gtk_widget_show(table); - gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0); - - label = AddLabel(MSGTR_PREFERENCES_Audio_Device, NULL); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); - - CBAudioDevice = AddComboBox(NULL); - gtk_table_attach(GTK_TABLE(table), CBAudioDevice, 1, 2, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0); - items = g_list_append(items,(gpointer)MSGTR_PREFERENCES_DriverDefault); -#ifdef CONFIG_OSS_AUDIO - if (strncmp(ao_driver[0], "oss", 3) == 0) - items = appendOSSDevices(items); -#endif -#ifdef CONFIG_ALSA - if (strncmp(ao_driver[0], "alsa", 4) == 0) - items = appendALSADevices(items); -#endif -#ifdef CONFIG_SDL - if (strncmp(ao_driver[0], "sdl", 3) == 0) - items = appendSDLDevices(items); -#endif -#ifdef CONFIG_ESD - if (strncmp(ao_driver[0], "esd", 3) == 0) - items = appendESDDevices(items); -#endif - gtk_combo_set_popdown_strings(GTK_COMBO(CBAudioDevice), items); - g_list_free(items); - items = NULL; - - CEAudioDevice = GTK_COMBO(CBAudioDevice)->entry; - gtk_widget_set_name(CEAudioDevice, "CEAudioDevice"); - gtk_widget_show(CEAudioDevice); - - label = AddLabel(MSGTR_PREFERENCES_Audio_Mixer, NULL); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); - - CBAudioMixer = AddComboBox(NULL); - gtk_table_attach(GTK_TABLE(table), CBAudioMixer, 1, 2, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0); - items = g_list_append(items, (gpointer)MSGTR_PREFERENCES_DriverDefault); -#ifdef CONFIG_OSS_AUDIO - if (strncmp(ao_driver[0], "oss", 3) == 0) - items = appendOSSMixers(items); -#endif -#ifdef CONFIG_ALSA - if (strncmp(ao_driver[0], "alsa", 4) == 0) - items = appendALSAMixers(items); -#endif - gtk_combo_set_popdown_strings(GTK_COMBO(CBAudioMixer), items); - g_list_free(items); - items = NULL; - - CEAudioMixer = GTK_COMBO(CBAudioMixer)->entry; - gtk_widget_set_name(CEAudioMixer, "CEAudioMixer"); - gtk_widget_show(CEAudioMixer); - - label = AddLabel(MSGTR_PREFERENCES_Audio_MixerChannel, NULL); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); - - CBAudioMixerChannel = AddComboBox(NULL); - gtk_table_attach(GTK_TABLE(table), CBAudioMixerChannel, 1, 2, 2, 3, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0); - items = g_list_append(items, (gpointer)MSGTR_PREFERENCES_DriverDefault); -#ifdef CONFIG_OSS_AUDIO - if (strncmp(ao_driver[0], "oss", 3) == 0) - items = appendOSSMixerChannels(items); -#endif -#ifdef CONFIG_ALSA - if (strncmp(ao_driver[0], "alsa", 4) == 0) - items = appendALSAMixerChannels(items); -#endif - gtk_combo_set_popdown_strings(GTK_COMBO(CBAudioMixerChannel), items); - g_list_free(items); - items = NULL; - - CEAudioMixerChannel = GTK_COMBO(CBAudioMixerChannel)->entry; - gtk_widget_set_name(CEAudioMixerChannel, "CEAudioMixerChannel"); - gtk_widget_show(CEAudioMixerChannel); - - AddHSeparator(vbox); - - hbuttonbox = AddHButtonBox(vbox); - gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox), GTK_BUTTONBOX_END); - gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbuttonbox), 10); - BAudioOk = AddButton(MSGTR_Ok, hbuttonbox); - BAudioCancel = AddButton(MSGTR_Cancel, hbuttonbox); - - gtk_signal_connect(GTK_OBJECT(AudioConfig), "destroy", GTK_SIGNAL_FUNC(WidgetDestroy), &AudioConfig); - gtk_signal_connect(GTK_OBJECT(BAudioOk), "clicked", GTK_SIGNAL_FUNC(audioButton), (void*)1); - gtk_signal_connect(GTK_OBJECT(BAudioCancel), "clicked", GTK_SIGNAL_FUNC(audioButton), (void*)0); - - accel_group = gtk_accel_group_new(); - gtk_widget_add_accelerator(BAudioOk, "clicked", accel_group, GDK_Return, 0, GTK_ACCEL_VISIBLE); - gtk_widget_add_accelerator(BAudioCancel, "clicked", accel_group, GDK_Escape, 0, GTK_ACCEL_VISIBLE); - gtk_window_add_accel_group(GTK_WINDOW(AudioConfig), accel_group); - - return AudioConfig; -} - -#ifdef CONFIG_DXR3 -// --- dxr3 config box - -static GtkWidget * DXR3Config; -static GtkWidget * CBDevice; -static GtkWidget * CEDXR3Device; -static GtkWidget * RBVNone; -static GtkWidget * RBVLavc; -static GtkWidget * dxr3BOk; -static GtkWidget * dxr3BCancel; - -GtkWidget * create_DXR3Config( void ); - -void ShowDXR3Config( void ) -{ - if ( DXR3Config ) gtkActive( DXR3Config ); - else DXR3Config=create_DXR3Config(); - - gtk_entry_set_text( GTK_ENTRY( CEDXR3Device ),gtkDXR3Device ); - - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBVNone ),TRUE ); - if ( gtkVfLAVC ) gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBVLavc ),TRUE ); - - gtk_widget_show( DXR3Config ); - gtkSetLayer( DXR3Config ); -} - -void HideDXR3Config( void ) -{ - if ( !DXR3Config ) return; - gtk_widget_hide( DXR3Config ); - gtk_widget_destroy( DXR3Config ); - DXR3Config=NULL; -} - -static void dxr3Button( GtkButton * button,gpointer user_data ) -{ - switch ( (int)user_data ) - { - case 0: // Ok - gfree( (void **)>kDXR3Device ); gtkDXR3Device=strdup( gtk_entry_get_text( GTK_ENTRY( CEDXR3Device ) ) ); - gtkVfLAVC=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBVLavc ) ); - case 1: // Cancel - HideDXR3Config(); - break; - } -} - -GtkWidget * create_DXR3Config( void ) -{ - GtkWidget * vbox1; - GtkWidget * vbox2; - GtkWidget * hbox1; - GList * CBDevice_items = NULL; - GtkWidget * vbox3; - GSList * VEncoder_group = NULL; - GtkWidget * hbuttonbox1; - GtkAccelGroup * accel_group; - - accel_group=gtk_accel_group_new(); - - DXR3Config=gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_widget_set_name( DXR3Config,"DXR3Config" ); - gtk_object_set_data( GTK_OBJECT( DXR3Config ),"DXR3Config",DXR3Config ); -// gtk_widget_set_usize( DXR3Config,300,156 ); - GTK_WIDGET_SET_FLAGS( DXR3Config,GTK_CAN_DEFAULT ); - gtk_window_set_title( GTK_WINDOW( DXR3Config ),"DXR3/H+" ); - gtk_window_set_position( GTK_WINDOW( DXR3Config ),GTK_WIN_POS_CENTER ); - gtk_window_set_policy( GTK_WINDOW( DXR3Config ),FALSE,FALSE,FALSE ); - gtk_window_set_wmclass( GTK_WINDOW( DXR3Config ),"DXR3","MPlayer" ); - - gtk_widget_realize( DXR3Config ); - gtkAddIcon( DXR3Config ); - - vbox1=AddVBox( AddDialogFrame( DXR3Config ),0 ); - vbox2=AddVBox( vbox1,0 ); - hbox1=AddHBox( vbox2,1 ); - AddLabel( MSGTR_PREFERENCES_Audio_Device,hbox1 ); - - CBDevice=AddComboBox( hbox1 ); - - CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300" ); - CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300-0" ); - CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300-1" ); - CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300-2" ); - CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300-3" ); - gtk_combo_set_popdown_strings( GTK_COMBO( CBDevice ),CBDevice_items ); - g_list_free( CBDevice_items ); - - CEDXR3Device=GTK_COMBO( CBDevice )->entry; - gtk_widget_set_name( CEDXR3Device,"CEDXR3Device" ); - gtk_widget_show( CEDXR3Device ); - gtk_entry_set_text( GTK_ENTRY( CEDXR3Device ),"/dev/em8300" ); - - AddHSeparator( vbox2 ); - vbox3=AddVBox( vbox2,0 ); - AddLabel( MSGTR_PREFERENCES_DXR3_VENC,vbox3 ); - RBVNone=AddRadioButton( MSGTR_PREFERENCES_None,&VEncoder_group,vbox3 ); - RBVLavc=AddRadioButton( MSGTR_PREFERENCES_DXR3_LAVC,&VEncoder_group,vbox3 ); - - AddHSeparator( vbox1 ); - - hbuttonbox1=AddHButtonBox( vbox1 ); - gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); - gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); - dxr3BOk=AddButton( MSGTR_Ok,hbuttonbox1 ); - dxr3BCancel=AddButton( MSGTR_Cancel,hbuttonbox1 ); - - gtk_widget_add_accelerator( dxr3BOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); - gtk_widget_add_accelerator( dxr3BCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); - - gtk_signal_connect( GTK_OBJECT( DXR3Config ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&DXR3Config ); - - gtk_signal_connect( GTK_OBJECT( dxr3BOk ),"clicked",GTK_SIGNAL_FUNC( dxr3Button ),(void *)0 ); - gtk_signal_connect( GTK_OBJECT( dxr3BCancel ),"clicked",GTK_SIGNAL_FUNC( dxr3Button ),(void *)1 ); - - gtk_window_add_accel_group( GTK_WINDOW( DXR3Config ),accel_group ); - - return DXR3Config; -} - -#endif
--- a/gui/ui/gtk/opts.h Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_GUI_OPTS_H -#define MPLAYER_GUI_OPTS_H - -#include <gtk/gtk.h> - -extern GtkWidget * AudioConfig; -extern GtkWidget * Preferences; -extern GtkWidget * prEFontName; - -GtkWidget * create_Preferences( void ); -GtkWidget * create_AudioConfig( void ); - -void ShowPreferences( void ); - -#endif /* MPLAYER_GUI_OPTS_H */
--- a/gui/ui/gtk/pl.c Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,611 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> -#include <dirent.h> -#include <unistd.h> -#include <stdio.h> -#include <stdlib.h> - -#include <gdk/gdkkeysyms.h> -#include <gtk/gtk.h> - -#include "config.h" -#include "help_mp.h" -#include "stream/stream.h" - -#include "gui/interface.h" -#include "gui/ui/widgets.h" -#include "pl.h" -#include "gtk_common.h" - -static char * book_open_xpm[] = { - "16 16 4 1", - " c None s None", - ". c black", - "X c #808080", - "o c white", - " ", - " .. ", - " .Xo. ... ", - " .Xoo. ..oo. ", - " .Xooo.Xooo... ", - " .Xooo.oooo.X. ", - " .Xooo.Xooo.X. ", - " .Xooo.oooo.X. ", - " .Xooo.Xooo.X. ", - " .Xooo.oooo.X. ", - " .Xoo.Xoo..X. ", - " .Xo.o..ooX. ", - " .X..XXXXX. ", - " ..X....... ", - " .. ", - " "}; - -static char * book_closed_xpm[] = { - "16 16 6 1", - " c None s None", - ". c black", - "X c blue", - "o c yellow", - "O c #007FEA", - "# c white", - " ", - " .. ", - " ..XX. ", - " ..XXXXX. ", - " ..XXXXXXXX. ", - ".ooXXXXXXXXX. ", - "..ooXXXXXXXXX. ", - ".X.ooXXXXXXXXX. ", - ".XX.ooXXXXXX.. ", - " .XX.ooXXX..#O ", - " .XX.oo..##OO. ", - " .XX..##OO.. ", - " .X.#OO.. ", - " ..O.. ", - " .. ", - " "}; - - GtkWidget * PlayList = NULL; -static GtkWidget * CTDirTree; -static GtkWidget * CLFiles; -static GtkWidget * CLSelected; -static GtkWidget * Add; -static GtkWidget * Remove; -static GtkWidget * Ok; -static GtkWidget * Cancel; -static GdkPixmap * pxOpenedBook; -static GdkPixmap * pxClosedBook; -static GdkBitmap * msOpenedBook; -static GdkBitmap * msClosedBook; - -static int NrOfEntrys = 0; -static int NrOfSelected = 0; -static int * CLFileSelected = NULL; -static int * CLListSelected = NULL; - -static int sigSel; -static int sigUnsel; -static int sigEvent; - -typedef struct -{ - int scaned; - char * path; -} DirNodeType; - -static GtkCTreeNode * sibling; -static GtkCTreeNode * parent; -static gchar * current_path; -static gchar * old_path = NULL; - -static int compare_func(const void *a, const void *b) -{ - char * tmp; - int i; - if ( !a || !b || !( (DirNodeType *)a )->path ) return -1; - tmp=strdup( (char *)b ); tmp[strlen( tmp )-1]=0; - i=strcmp( ( (DirNodeType *)a )->path,tmp ); - free( tmp ); - return i; -} - -static void scan_dir( char * path ); - -void ShowPlayList( void ) -{ - if ( PlayList ) gtkActive( PlayList ); - else PlayList=create_PlayList(); - - if ( old_path && *old_path ) - { - char * currentdir = strdup( old_path ); - char * tpath,* pos; - GtkCTreeNode * node,* nextnode; - gboolean leaf; - tpath=strdup( "/" ); - pos=strtok( currentdir,"/" ); - node=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),NULL,"/",compare_func ); - do - { - char * tpathnew = g_strconcat( tpath,pos,"/",NULL ); - free( tpath ); tpath=tpathnew; - nextnode=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),node,tpath,compare_func ); - if ( !nextnode ) break; - node=nextnode; - pos=strtok( NULL,"/" ); - gtk_ctree_get_node_info( GTK_CTREE( CTDirTree ),node,NULL,NULL,NULL,NULL,NULL,NULL,&leaf,NULL ); - if ( !leaf && pos ) gtk_ctree_expand( GTK_CTREE( CTDirTree ),node ); - else - { - DirNodeType * DirNode; - gtk_ctree_select( GTK_CTREE( CTDirTree ),node ); - DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( CTDirTree ),node ); - current_path=DirNode->path; - scan_dir( DirNode->path ); - free( CLFileSelected ); - CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) ); - break; - } - } while( pos ); - free( tpath ); - free( currentdir ); - } - else gtk_ctree_select( GTK_CTREE( CTDirTree ),parent ); - - gtk_clist_freeze( GTK_CLIST( CLSelected ) ); - gtk_clist_clear( GTK_CLIST( CLSelected ) ); - if ( plList ) - { - gchar * name, * path; - plItem * next = plList; - while ( next || next->next ) - { - char * text[1][3]; text[0][2]=""; - name = g_filename_to_utf8( next->name, -1, NULL, NULL, NULL ); - path = g_filename_to_utf8( next->path, -1, NULL, NULL, NULL ); - text[0][0]=name ? name : next->name; - text[0][1]=path ? path : next->path; - gtk_clist_append( GTK_CLIST( CLSelected ),text[0] ); - g_free( path ); - g_free( name ); - NrOfSelected++; - if ( next->next ) next=next->next; else break; - } - CLListSelected=calloc( 1,NrOfSelected * sizeof( int ) ); - } - gtk_clist_thaw( GTK_CLIST( CLSelected ) ); - - gtk_widget_show( PlayList ); -} - -void HidePlayList( void ) -{ - if ( !PlayList ) return; - NrOfSelected=NrOfEntrys=0; - gfree( (void **)&CLListSelected ); gfree( (void **)&CLFileSelected ); - free( old_path ); - old_path=strdup( current_path ); - gtk_widget_hide( PlayList ); - gtk_widget_destroy( PlayList ); - PlayList=NULL; -} - -static void plRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data ) -{ - switch ( (int) user_data ) - { - case 0: CLFileSelected[row]=1; break; - case 1: CLListSelected[row]=1; break; - } -} - -static void plUnRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data ) -{ - switch ( (int) user_data ) - { - case 0: CLFileSelected[row]=0; break; - case 1: CLListSelected[row]=0; break; - } -} - -static void plButtonReleased( GtkButton * button,gpointer user_data ) -{ - switch ( (int) user_data ) - { - case 1: // ok - { - int i; - if ( plList ) gtkSet( gtkDelPl,0,NULL ); - for ( i=0;i<NrOfSelected;i++ ) - { - plItem * item; - char * text[3]; - item=calloc( 1,sizeof( plItem ) ); - gtk_clist_get_text( GTK_CLIST( CLSelected ),i,0,&text[0] ); - gtk_clist_get_text( GTK_CLIST( CLSelected ),i,1,&text[1] ); - item->name=g_filename_from_utf8( text[0], -1, NULL, NULL, NULL ); - if ( !item->name ) item->name = strdup( text[0] ); - item->path=g_filename_from_utf8( text[1], -1, NULL, NULL, NULL ); - if ( !item->path ) item->path = strdup( text[1] ); - gtkSet( gtkAddPlItem,0,(void*)item ); - } - if ( plCurrent ) - { - uiSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE ); -// guiSetDF( guiInfo.Filename,plCurrent->path,plCurrent->name ); -// guiInfo.FilenameChanged=1; -// guiInfo.StreamType=STREAMTYPE_FILE; - } - } - case 0: // cancel - HidePlayList(); - break; - case 2: // remove - { - int i; int j; int c=0; - - gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigSel ); - gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigUnsel ); - gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigEvent ); - - gtk_clist_freeze( GTK_CLIST( CLSelected ) ); - for ( i=0;i<NrOfSelected-c;i++ ) - if ( CLListSelected[i] ) - { - gtk_clist_remove( GTK_CLIST( CLSelected ),i - c ); - c++; - for ( j=i;j<NrOfSelected-c;j++ ) - CLListSelected[i] = CLListSelected[i+1]; - } - NrOfSelected-=c; - gtk_clist_thaw( GTK_CLIST( CLSelected ) ); - - gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigSel ); - gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigUnsel ); - gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigEvent ); - - } - break; - case 3: // add - { - int i; - void *p; - char * itext[1][2]; - gchar * cpath; - char * text[1][3]; text[0][2]=""; - gtk_clist_freeze( GTK_CLIST( CLSelected ) ); - for ( i=0;i<NrOfEntrys;i++ ) - { - if ( CLFileSelected[i] ) - { - NrOfSelected++; - p=realloc( CLListSelected,NrOfSelected * sizeof( int ) ); - if ( !p ) NrOfSelected--; - else - { - CLListSelected=p; - CLListSelected[NrOfSelected - 1]=0; - gtk_clist_get_text( GTK_CLIST( CLFiles ),i,0,(char **)&itext ); - cpath=g_filename_to_utf8( current_path, -1, NULL, NULL, NULL ); - text[0][0]=itext[0][0]; text[0][1]=cpath ? cpath : current_path; - gtk_clist_append( GTK_CLIST( CLSelected ),text[0] ); - g_free( cpath ); - } - } - } - gtk_clist_thaw( GTK_CLIST( CLSelected ) ); - } - break; - } -} - -static gboolean plEvent ( GtkWidget * widget, - GdkEvent * event, - gpointer user_data ) -{ - GdkEventButton *bevent; - gint row, col; - - (void) user_data; - - bevent = (GdkEventButton *) event; - - if ( event->type == GDK_BUTTON_RELEASE && bevent->button == 2 ) - { - if ( gtk_clist_get_selection_info( GTK_CLIST( widget ), bevent->x, bevent->y, &row, &col ) ) - { - switch ( (int) user_data ) - { - case 0: - CLFileSelected[row] = 1; - plButtonReleased( NULL, (void *) 3 ); - CLFileSelected[row] = 0; - return TRUE; - - case 1: - CLListSelected[row] = 1; - plButtonReleased( NULL, (void *) 2 ); - return TRUE; - } - } - } - - return FALSE; -} - -static int check_for_subdir( gchar * path ) -{ - DIR * dir; - struct dirent * dirent; - struct stat statbuf; - gchar * npath; - - if ( (dir=opendir( path )) ) - { - while ( (dirent=readdir( dir )) ) - { - if ( dirent->d_name[0] != '.' ) - { - npath=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 ); - sprintf( npath,"%s/%s",path,dirent->d_name ); - if ( stat( npath,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) ) - { free( npath ); closedir( dir ); return 1; } - free( npath ); - } - } - closedir( dir ); - } - return 0; -} - -static void plCTree( GtkCTree * ctree,GtkCTreeNode * parent_node,gpointer user_data ) -{ - GtkCTreeNode * node; - DirNodeType * DirNode; - gchar * text, * name = NULL; - gchar * dummy = "dummy"; - int subdir = 1; - DIR * dir = NULL; - struct dirent * dirent; - gchar * path; - struct stat statbuf; - - DirNode=gtk_ctree_node_get_row_data( ctree,parent_node ); - if ( !DirNode->scaned ) - { - DirNode->scaned=1; current_path=DirNode->path; - gtk_clist_freeze( GTK_CLIST( ctree ) ); - node=gtk_ctree_find_by_row_data( ctree,parent_node,NULL ); - gtk_ctree_remove_node( ctree,node ); - - if ( (dir=opendir( DirNode->path ) ) ) - { - while( (dirent=readdir( dir )) ) - { - path=calloc( 1,strlen( DirNode->path ) + strlen( dirent->d_name ) + 2 ); - if ( !strcmp( current_path,"/" ) ) sprintf( path,"/%s",dirent->d_name ); - else sprintf( path,"%s/%s",current_path,dirent->d_name ); - text=dirent->d_name; - g_free( name ); - name=g_filename_to_utf8( text, -1, NULL, NULL, NULL ); - - if ( stat( path,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) && dirent->d_name[0] != '.' ) - { - DirNode=malloc( sizeof( DirNodeType ) ); DirNode->scaned=0; DirNode->path=strdup( path ); - subdir=check_for_subdir( path ); - node=gtk_ctree_insert_node( ctree,parent_node,NULL,(name ? &name : &text ),4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,!subdir,FALSE ); - gtk_ctree_node_set_row_data_full( ctree,node,DirNode,NULL ); - if ( subdir ) node=gtk_ctree_insert_node( ctree,node,NULL,&dummy,4,NULL,NULL,NULL,NULL,FALSE,FALSE ); - } - free( path ); path=NULL; - } - closedir( dir ); - } - - gtk_ctree_sort_node( ctree,parent_node ); - gtk_clist_thaw( GTK_CLIST( ctree ) ); - } - - g_free( name ); -} - -static void scan_dir( char * path ) -{ - DIR * dir = NULL; - char * curr; - struct dirent * dirent; - struct stat statbuf; - gchar * name; - char * text[1][2]; text[0][1]=""; - - gtk_clist_clear( GTK_CLIST( CLFiles ) ); - if ( (dir=opendir( path )) ) - { - NrOfEntrys=0; - while( (dirent=readdir( dir )) ) - { - curr=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 ); sprintf( curr,"%s/%s",path,dirent->d_name ); - if ( stat( curr,&statbuf ) != -1 && ( S_ISREG( statbuf.st_mode ) || S_ISLNK( statbuf.st_mode ) ) ) - { - name=g_filename_to_utf8( dirent->d_name, -1, NULL, NULL, NULL ); - text[0][0]=name ? name : dirent->d_name; - gtk_clist_append( GTK_CLIST( CLFiles ), text[0] ); - g_free( name ); - NrOfEntrys++; - } - free( curr ); - } - closedir( dir ); - gtk_clist_sort( GTK_CLIST( CLFiles ) ); - } -} - -static void plCTRow(GtkWidget * widget, gint row, gint column, GdkEventButton * bevent, gpointer data) -{ - DirNodeType * DirNode; - GtkCTreeNode * node; - node=gtk_ctree_node_nth( GTK_CTREE( widget ),row ); - DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( widget ),node ); - current_path=DirNode->path; - gtk_ctree_expand( GTK_CTREE( widget ),node ); - scan_dir( DirNode->path ); - free( CLFileSelected ); - CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) ); -} - -GtkWidget * create_PlayList( void ) -{ - GtkWidget * vbox1; - GtkWidget * hbox1; - GtkWidget * scrolledwindow1; - GtkWidget * vbox2; - GtkWidget * scrolledwindow2; - GtkWidget * scrolledwindow3; - GtkWidget * hbuttonbox1; - GtkAccelGroup * accel_group; - GdkColor transparent = { 0,0,0,0 }; - gchar * root = "/"; - gchar * dummy = "dummy"; - DirNodeType * DirNode; - - accel_group=gtk_accel_group_new(); - - PlayList=gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_object_set_data( GTK_OBJECT( PlayList ),"PlayList",PlayList ); - gtk_widget_set_usize( PlayList,512,384 ); - gtk_window_set_title( GTK_WINDOW( PlayList ),MSGTR_PlayList ); - gtk_window_set_position( GTK_WINDOW( PlayList ),GTK_WIN_POS_CENTER ); -// gtk_window_set_policy( GTK_WINDOW( PlayList ),FALSE,FALSE,FALSE ); - gtk_window_set_wmclass( GTK_WINDOW( PlayList ),"Playlist","MPlayer" ); - - gtk_widget_realize( PlayList ); - gtkAddIcon( PlayList ); - - vbox1=AddVBox( AddDialogFrame( PlayList ),0 ); - hbox1=AddHBox( NULL,1 ); - gtk_box_pack_start( GTK_BOX( vbox1 ),hbox1,TRUE,TRUE,0 ); - - scrolledwindow1=gtk_scrolled_window_new( NULL,NULL ); - gtk_widget_show( scrolledwindow1 ); - gtk_container_add( GTK_CONTAINER( - AddFrame( NULL,0,hbox1,1 ) ),scrolledwindow1 ); - gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC ); - - CTDirTree=gtk_ctree_new( 1,0 ); - gtk_signal_connect( GTK_OBJECT( CTDirTree ),"tree_expand",GTK_SIGNAL_FUNC( plCTree ),(void*)0 ); - gtk_signal_connect( GTK_OBJECT( CTDirTree ),"select_row",GTK_SIGNAL_FUNC( plCTRow ),(void *)0 ); - gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),CTDirTree ); - gtk_clist_set_column_auto_resize( GTK_CLIST( CTDirTree ),0,TRUE ); - gtk_clist_set_column_width( GTK_CLIST( CTDirTree ),0,80 ); - gtk_clist_set_selection_mode( GTK_CLIST( CTDirTree ),GTK_SELECTION_SINGLE ); - gtk_ctree_set_line_style( GTK_CTREE( CTDirTree ),GTK_CTREE_LINES_SOLID ); - gtk_clist_column_titles_show( GTK_CLIST( CTDirTree ) ); - gtk_clist_set_shadow_type( GTK_CLIST( CTDirTree ),GTK_SHADOW_NONE ); - - if ( !pxOpenedBook ) pxOpenedBook=gdk_pixmap_create_from_xpm_d( PlayList->window,&msOpenedBook,&transparent,book_closed_xpm ); - if ( !pxClosedBook ) pxClosedBook=gdk_pixmap_create_from_xpm_d( PlayList->window,&msClosedBook,&transparent,book_open_xpm ); - - parent=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),NULL,NULL,&root,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,FALSE,FALSE ); - DirNode=malloc( sizeof( DirNodeType ) ); - DirNode->scaned=0; DirNode->path=strdup( root ); - gtk_ctree_node_set_row_data_full(GTK_CTREE( CTDirTree ),parent,DirNode,NULL ); - sibling=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),parent,NULL,&dummy,4,NULL,NULL,NULL,NULL,TRUE,TRUE ); - gtk_ctree_expand( GTK_CTREE( CTDirTree ),parent ); - gtk_widget_show( CTDirTree ); - - old_path = fsHistory[0]; - - gtk_clist_set_column_widget( GTK_CLIST( CTDirTree ),0, - AddLabel( MSGTR_PLAYLIST_DirectoryTree,NULL ) ); - - vbox2=AddVBox( - AddFrame( NULL,1,hbox1,1 ),0 ); - - scrolledwindow2=gtk_scrolled_window_new( NULL,NULL ); - gtk_widget_show( scrolledwindow2 ); - gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow2,TRUE,TRUE,0 ); - gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow2 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC ); - - CLFiles=gtk_clist_new( 1 ); - gtk_widget_show( CLFiles ); - gtk_container_add( GTK_CONTAINER( scrolledwindow2 ),CLFiles ); - gtk_clist_set_column_width( GTK_CLIST( CLFiles ),0,80 ); - gtk_clist_set_selection_mode( GTK_CLIST( CLFiles ),GTK_SELECTION_EXTENDED ); - gtk_clist_column_titles_show( GTK_CLIST( CLFiles ) ); - gtk_clist_set_shadow_type( GTK_CLIST( CLFiles ),GTK_SHADOW_NONE ); - - gtk_clist_set_column_widget( GTK_CLIST( CLFiles ),0, - AddLabel( MSGTR_PLAYLIST_Files,NULL ) ); - - AddHSeparator( vbox2 ); - - scrolledwindow3=gtk_scrolled_window_new( NULL,NULL ); - gtk_widget_show( scrolledwindow3 ); - gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow3,TRUE,TRUE,0 ); - gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow3 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC ); - - CLSelected=gtk_clist_new( 2 ); - gtk_widget_show( CLSelected ); - gtk_container_add( GTK_CONTAINER( scrolledwindow3 ),CLSelected ); - gtk_clist_set_column_width( GTK_CLIST( CLSelected ),0,295 ); - gtk_clist_set_column_width( GTK_CLIST( CLSelected ),1,295 ); - gtk_clist_set_selection_mode( GTK_CLIST( CLSelected ),GTK_SELECTION_MULTIPLE ); - gtk_clist_column_titles_show( GTK_CLIST( CLSelected ) ); - gtk_clist_set_shadow_type( GTK_CLIST( CLSelected ),GTK_SHADOW_NONE ); - - gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),0, - AddLabel( MSGTR_PLAYLIST_Selected,NULL ) ); - - gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),1, - AddLabel( MSGTR_PLAYLIST_Path,NULL ) ); - - AddHSeparator( vbox1 ); - - hbuttonbox1=AddHButtonBox( vbox1 ); - gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); - gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); - - Add=AddButton( MSGTR_Add,hbuttonbox1 ); - Remove=AddButton( MSGTR_Remove,hbuttonbox1 ); - Ok=AddButton( MSGTR_Ok,hbuttonbox1 ); - Cancel=AddButton( MSGTR_Cancel,hbuttonbox1 ); - - gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); - - gtk_signal_connect( GTK_OBJECT( PlayList ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&PlayList ); - - gtk_signal_connect( GTK_OBJECT( CLFiles ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void *)0 ); - gtk_signal_connect( GTK_OBJECT( CLFiles ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void *)0 ); - gtk_signal_connect( GTK_OBJECT( CLFiles ),"event",GTK_SIGNAL_FUNC( plEvent ),(void *)0 ); - sigSel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void*)1 ); - sigUnsel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void*)1 ); - sigEvent=gtk_signal_connect( GTK_OBJECT( CLSelected ),"event",GTK_SIGNAL_FUNC( plEvent ),(void *)1 ); - - gtk_signal_connect( GTK_OBJECT( Add ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)3 ); - gtk_signal_connect( GTK_OBJECT( Remove ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)2 ); - gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)1 ); - gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)0 ); - - gtk_window_add_accel_group( GTK_WINDOW( PlayList ),accel_group ); - - return PlayList; -}
--- a/gui/ui/gtk/pl.h Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_GUI_PL_H -#define MPLAYER_GUI_PL_H - -#include <gtk/gtk.h> - -void ShowPlayList( void ); -void HidePlayList( void ); - -GtkWidget * create_PlayList (void); - -#endif /* MPLAYER_GUI_PL_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/playlist.c Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,611 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <string.h> +#include <dirent.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> + +#include <gdk/gdkkeysyms.h> +#include <gtk/gtk.h> + +#include "config.h" +#include "help_mp.h" +#include "stream/stream.h" + +#include "gui/interface.h" +#include "gui/ui/widgets.h" +#include "playlist.h" +#include "tools.h" + +static char * book_open_xpm[] = { + "16 16 4 1", + " c None s None", + ". c black", + "X c #808080", + "o c white", + " ", + " .. ", + " .Xo. ... ", + " .Xoo. ..oo. ", + " .Xooo.Xooo... ", + " .Xooo.oooo.X. ", + " .Xooo.Xooo.X. ", + " .Xooo.oooo.X. ", + " .Xooo.Xooo.X. ", + " .Xooo.oooo.X. ", + " .Xoo.Xoo..X. ", + " .Xo.o..ooX. ", + " .X..XXXXX. ", + " ..X....... ", + " .. ", + " "}; + +static char * book_closed_xpm[] = { + "16 16 6 1", + " c None s None", + ". c black", + "X c blue", + "o c yellow", + "O c #007FEA", + "# c white", + " ", + " .. ", + " ..XX. ", + " ..XXXXX. ", + " ..XXXXXXXX. ", + ".ooXXXXXXXXX. ", + "..ooXXXXXXXXX. ", + ".X.ooXXXXXXXXX. ", + ".XX.ooXXXXXX.. ", + " .XX.ooXXX..#O ", + " .XX.oo..##OO. ", + " .XX..##OO.. ", + " .X.#OO.. ", + " ..O.. ", + " .. ", + " "}; + + GtkWidget * PlayList = NULL; +static GtkWidget * CTDirTree; +static GtkWidget * CLFiles; +static GtkWidget * CLSelected; +static GtkWidget * Add; +static GtkWidget * Remove; +static GtkWidget * Ok; +static GtkWidget * Cancel; +static GdkPixmap * pxOpenedBook; +static GdkPixmap * pxClosedBook; +static GdkBitmap * msOpenedBook; +static GdkBitmap * msClosedBook; + +static int NrOfEntrys = 0; +static int NrOfSelected = 0; +static int * CLFileSelected = NULL; +static int * CLListSelected = NULL; + +static int sigSel; +static int sigUnsel; +static int sigEvent; + +typedef struct +{ + int scaned; + char * path; +} DirNodeType; + +static GtkCTreeNode * sibling; +static GtkCTreeNode * parent; +static gchar * current_path; +static gchar * old_path = NULL; + +static int compare_func(const void *a, const void *b) +{ + char * tmp; + int i; + if ( !a || !b || !( (DirNodeType *)a )->path ) return -1; + tmp=strdup( (char *)b ); tmp[strlen( tmp )-1]=0; + i=strcmp( ( (DirNodeType *)a )->path,tmp ); + free( tmp ); + return i; +} + +static void scan_dir( char * path ); + +void ShowPlayList( void ) +{ + if ( PlayList ) gtkActive( PlayList ); + else PlayList=create_PlayList(); + + if ( old_path && *old_path ) + { + char * currentdir = strdup( old_path ); + char * tpath,* pos; + GtkCTreeNode * node,* nextnode; + gboolean leaf; + tpath=strdup( "/" ); + pos=strtok( currentdir,"/" ); + node=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),NULL,"/",compare_func ); + do + { + char * tpathnew = g_strconcat( tpath,pos,"/",NULL ); + free( tpath ); tpath=tpathnew; + nextnode=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),node,tpath,compare_func ); + if ( !nextnode ) break; + node=nextnode; + pos=strtok( NULL,"/" ); + gtk_ctree_get_node_info( GTK_CTREE( CTDirTree ),node,NULL,NULL,NULL,NULL,NULL,NULL,&leaf,NULL ); + if ( !leaf && pos ) gtk_ctree_expand( GTK_CTREE( CTDirTree ),node ); + else + { + DirNodeType * DirNode; + gtk_ctree_select( GTK_CTREE( CTDirTree ),node ); + DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( CTDirTree ),node ); + current_path=DirNode->path; + scan_dir( DirNode->path ); + free( CLFileSelected ); + CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) ); + break; + } + } while( pos ); + free( tpath ); + free( currentdir ); + } + else gtk_ctree_select( GTK_CTREE( CTDirTree ),parent ); + + gtk_clist_freeze( GTK_CLIST( CLSelected ) ); + gtk_clist_clear( GTK_CLIST( CLSelected ) ); + if ( plList ) + { + gchar * name, * path; + plItem * next = plList; + while ( next || next->next ) + { + char * text[1][3]; text[0][2]=""; + name = g_filename_to_utf8( next->name, -1, NULL, NULL, NULL ); + path = g_filename_to_utf8( next->path, -1, NULL, NULL, NULL ); + text[0][0]=name ? name : next->name; + text[0][1]=path ? path : next->path; + gtk_clist_append( GTK_CLIST( CLSelected ),text[0] ); + g_free( path ); + g_free( name ); + NrOfSelected++; + if ( next->next ) next=next->next; else break; + } + CLListSelected=calloc( 1,NrOfSelected * sizeof( int ) ); + } + gtk_clist_thaw( GTK_CLIST( CLSelected ) ); + + gtk_widget_show( PlayList ); +} + +void HidePlayList( void ) +{ + if ( !PlayList ) return; + NrOfSelected=NrOfEntrys=0; + gfree( (void **)&CLListSelected ); gfree( (void **)&CLFileSelected ); + free( old_path ); + old_path=strdup( current_path ); + gtk_widget_hide( PlayList ); + gtk_widget_destroy( PlayList ); + PlayList=NULL; +} + +static void plRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data ) +{ + switch ( (int) user_data ) + { + case 0: CLFileSelected[row]=1; break; + case 1: CLListSelected[row]=1; break; + } +} + +static void plUnRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data ) +{ + switch ( (int) user_data ) + { + case 0: CLFileSelected[row]=0; break; + case 1: CLListSelected[row]=0; break; + } +} + +static void plButtonReleased( GtkButton * button,gpointer user_data ) +{ + switch ( (int) user_data ) + { + case 1: // ok + { + int i; + if ( plList ) gtkSet( gtkDelPl,0,NULL ); + for ( i=0;i<NrOfSelected;i++ ) + { + plItem * item; + char * text[3]; + item=calloc( 1,sizeof( plItem ) ); + gtk_clist_get_text( GTK_CLIST( CLSelected ),i,0,&text[0] ); + gtk_clist_get_text( GTK_CLIST( CLSelected ),i,1,&text[1] ); + item->name=g_filename_from_utf8( text[0], -1, NULL, NULL, NULL ); + if ( !item->name ) item->name = strdup( text[0] ); + item->path=g_filename_from_utf8( text[1], -1, NULL, NULL, NULL ); + if ( !item->path ) item->path = strdup( text[1] ); + gtkSet( gtkAddPlItem,0,(void*)item ); + } + if ( plCurrent ) + { + uiSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE ); +// guiSetDF( guiInfo.Filename,plCurrent->path,plCurrent->name ); +// guiInfo.FilenameChanged=1; +// guiInfo.StreamType=STREAMTYPE_FILE; + } + } + case 0: // cancel + HidePlayList(); + break; + case 2: // remove + { + int i; int j; int c=0; + + gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigSel ); + gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigUnsel ); + gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigEvent ); + + gtk_clist_freeze( GTK_CLIST( CLSelected ) ); + for ( i=0;i<NrOfSelected-c;i++ ) + if ( CLListSelected[i] ) + { + gtk_clist_remove( GTK_CLIST( CLSelected ),i - c ); + c++; + for ( j=i;j<NrOfSelected-c;j++ ) + CLListSelected[i] = CLListSelected[i+1]; + } + NrOfSelected-=c; + gtk_clist_thaw( GTK_CLIST( CLSelected ) ); + + gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigSel ); + gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigUnsel ); + gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigEvent ); + + } + break; + case 3: // add + { + int i; + void *p; + char * itext[1][2]; + gchar * cpath; + char * text[1][3]; text[0][2]=""; + gtk_clist_freeze( GTK_CLIST( CLSelected ) ); + for ( i=0;i<NrOfEntrys;i++ ) + { + if ( CLFileSelected[i] ) + { + NrOfSelected++; + p=realloc( CLListSelected,NrOfSelected * sizeof( int ) ); + if ( !p ) NrOfSelected--; + else + { + CLListSelected=p; + CLListSelected[NrOfSelected - 1]=0; + gtk_clist_get_text( GTK_CLIST( CLFiles ),i,0,(char **)&itext ); + cpath=g_filename_to_utf8( current_path, -1, NULL, NULL, NULL ); + text[0][0]=itext[0][0]; text[0][1]=cpath ? cpath : current_path; + gtk_clist_append( GTK_CLIST( CLSelected ),text[0] ); + g_free( cpath ); + } + } + } + gtk_clist_thaw( GTK_CLIST( CLSelected ) ); + } + break; + } +} + +static gboolean plEvent ( GtkWidget * widget, + GdkEvent * event, + gpointer user_data ) +{ + GdkEventButton *bevent; + gint row, col; + + (void) user_data; + + bevent = (GdkEventButton *) event; + + if ( event->type == GDK_BUTTON_RELEASE && bevent->button == 2 ) + { + if ( gtk_clist_get_selection_info( GTK_CLIST( widget ), bevent->x, bevent->y, &row, &col ) ) + { + switch ( (int) user_data ) + { + case 0: + CLFileSelected[row] = 1; + plButtonReleased( NULL, (void *) 3 ); + CLFileSelected[row] = 0; + return TRUE; + + case 1: + CLListSelected[row] = 1; + plButtonReleased( NULL, (void *) 2 ); + return TRUE; + } + } + } + + return FALSE; +} + +static int check_for_subdir( gchar * path ) +{ + DIR * dir; + struct dirent * dirent; + struct stat statbuf; + gchar * npath; + + if ( (dir=opendir( path )) ) + { + while ( (dirent=readdir( dir )) ) + { + if ( dirent->d_name[0] != '.' ) + { + npath=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 ); + sprintf( npath,"%s/%s",path,dirent->d_name ); + if ( stat( npath,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) ) + { free( npath ); closedir( dir ); return 1; } + free( npath ); + } + } + closedir( dir ); + } + return 0; +} + +static void plCTree( GtkCTree * ctree,GtkCTreeNode * parent_node,gpointer user_data ) +{ + GtkCTreeNode * node; + DirNodeType * DirNode; + gchar * text, * name = NULL; + gchar * dummy = "dummy"; + int subdir = 1; + DIR * dir = NULL; + struct dirent * dirent; + gchar * path; + struct stat statbuf; + + DirNode=gtk_ctree_node_get_row_data( ctree,parent_node ); + if ( !DirNode->scaned ) + { + DirNode->scaned=1; current_path=DirNode->path; + gtk_clist_freeze( GTK_CLIST( ctree ) ); + node=gtk_ctree_find_by_row_data( ctree,parent_node,NULL ); + gtk_ctree_remove_node( ctree,node ); + + if ( (dir=opendir( DirNode->path ) ) ) + { + while( (dirent=readdir( dir )) ) + { + path=calloc( 1,strlen( DirNode->path ) + strlen( dirent->d_name ) + 2 ); + if ( !strcmp( current_path,"/" ) ) sprintf( path,"/%s",dirent->d_name ); + else sprintf( path,"%s/%s",current_path,dirent->d_name ); + text=dirent->d_name; + g_free( name ); + name=g_filename_to_utf8( text, -1, NULL, NULL, NULL ); + + if ( stat( path,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) && dirent->d_name[0] != '.' ) + { + DirNode=malloc( sizeof( DirNodeType ) ); DirNode->scaned=0; DirNode->path=strdup( path ); + subdir=check_for_subdir( path ); + node=gtk_ctree_insert_node( ctree,parent_node,NULL,(name ? &name : &text ),4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,!subdir,FALSE ); + gtk_ctree_node_set_row_data_full( ctree,node,DirNode,NULL ); + if ( subdir ) node=gtk_ctree_insert_node( ctree,node,NULL,&dummy,4,NULL,NULL,NULL,NULL,FALSE,FALSE ); + } + free( path ); path=NULL; + } + closedir( dir ); + } + + gtk_ctree_sort_node( ctree,parent_node ); + gtk_clist_thaw( GTK_CLIST( ctree ) ); + } + + g_free( name ); +} + +static void scan_dir( char * path ) +{ + DIR * dir = NULL; + char * curr; + struct dirent * dirent; + struct stat statbuf; + gchar * name; + char * text[1][2]; text[0][1]=""; + + gtk_clist_clear( GTK_CLIST( CLFiles ) ); + if ( (dir=opendir( path )) ) + { + NrOfEntrys=0; + while( (dirent=readdir( dir )) ) + { + curr=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 ); sprintf( curr,"%s/%s",path,dirent->d_name ); + if ( stat( curr,&statbuf ) != -1 && ( S_ISREG( statbuf.st_mode ) || S_ISLNK( statbuf.st_mode ) ) ) + { + name=g_filename_to_utf8( dirent->d_name, -1, NULL, NULL, NULL ); + text[0][0]=name ? name : dirent->d_name; + gtk_clist_append( GTK_CLIST( CLFiles ), text[0] ); + g_free( name ); + NrOfEntrys++; + } + free( curr ); + } + closedir( dir ); + gtk_clist_sort( GTK_CLIST( CLFiles ) ); + } +} + +static void plCTRow(GtkWidget * widget, gint row, gint column, GdkEventButton * bevent, gpointer data) +{ + DirNodeType * DirNode; + GtkCTreeNode * node; + node=gtk_ctree_node_nth( GTK_CTREE( widget ),row ); + DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( widget ),node ); + current_path=DirNode->path; + gtk_ctree_expand( GTK_CTREE( widget ),node ); + scan_dir( DirNode->path ); + free( CLFileSelected ); + CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) ); +} + +GtkWidget * create_PlayList( void ) +{ + GtkWidget * vbox1; + GtkWidget * hbox1; + GtkWidget * scrolledwindow1; + GtkWidget * vbox2; + GtkWidget * scrolledwindow2; + GtkWidget * scrolledwindow3; + GtkWidget * hbuttonbox1; + GtkAccelGroup * accel_group; + GdkColor transparent = { 0,0,0,0 }; + gchar * root = "/"; + gchar * dummy = "dummy"; + DirNodeType * DirNode; + + accel_group=gtk_accel_group_new(); + + PlayList=gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_object_set_data( GTK_OBJECT( PlayList ),"PlayList",PlayList ); + gtk_widget_set_usize( PlayList,512,384 ); + gtk_window_set_title( GTK_WINDOW( PlayList ),MSGTR_PlayList ); + gtk_window_set_position( GTK_WINDOW( PlayList ),GTK_WIN_POS_CENTER ); +// gtk_window_set_policy( GTK_WINDOW( PlayList ),FALSE,FALSE,FALSE ); + gtk_window_set_wmclass( GTK_WINDOW( PlayList ),"Playlist","MPlayer" ); + + gtk_widget_realize( PlayList ); + gtkAddIcon( PlayList ); + + vbox1=AddVBox( AddDialogFrame( PlayList ),0 ); + hbox1=AddHBox( NULL,1 ); + gtk_box_pack_start( GTK_BOX( vbox1 ),hbox1,TRUE,TRUE,0 ); + + scrolledwindow1=gtk_scrolled_window_new( NULL,NULL ); + gtk_widget_show( scrolledwindow1 ); + gtk_container_add( GTK_CONTAINER( + AddFrame( NULL,0,hbox1,1 ) ),scrolledwindow1 ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC ); + + CTDirTree=gtk_ctree_new( 1,0 ); + gtk_signal_connect( GTK_OBJECT( CTDirTree ),"tree_expand",GTK_SIGNAL_FUNC( plCTree ),(void*)0 ); + gtk_signal_connect( GTK_OBJECT( CTDirTree ),"select_row",GTK_SIGNAL_FUNC( plCTRow ),(void *)0 ); + gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),CTDirTree ); + gtk_clist_set_column_auto_resize( GTK_CLIST( CTDirTree ),0,TRUE ); + gtk_clist_set_column_width( GTK_CLIST( CTDirTree ),0,80 ); + gtk_clist_set_selection_mode( GTK_CLIST( CTDirTree ),GTK_SELECTION_SINGLE ); + gtk_ctree_set_line_style( GTK_CTREE( CTDirTree ),GTK_CTREE_LINES_SOLID ); + gtk_clist_column_titles_show( GTK_CLIST( CTDirTree ) ); + gtk_clist_set_shadow_type( GTK_CLIST( CTDirTree ),GTK_SHADOW_NONE ); + + if ( !pxOpenedBook ) pxOpenedBook=gdk_pixmap_create_from_xpm_d( PlayList->window,&msOpenedBook,&transparent,book_closed_xpm ); + if ( !pxClosedBook ) pxClosedBook=gdk_pixmap_create_from_xpm_d( PlayList->window,&msClosedBook,&transparent,book_open_xpm ); + + parent=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),NULL,NULL,&root,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,FALSE,FALSE ); + DirNode=malloc( sizeof( DirNodeType ) ); + DirNode->scaned=0; DirNode->path=strdup( root ); + gtk_ctree_node_set_row_data_full(GTK_CTREE( CTDirTree ),parent,DirNode,NULL ); + sibling=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),parent,NULL,&dummy,4,NULL,NULL,NULL,NULL,TRUE,TRUE ); + gtk_ctree_expand( GTK_CTREE( CTDirTree ),parent ); + gtk_widget_show( CTDirTree ); + + old_path = fsHistory[0]; + + gtk_clist_set_column_widget( GTK_CLIST( CTDirTree ),0, + AddLabel( MSGTR_PLAYLIST_DirectoryTree,NULL ) ); + + vbox2=AddVBox( + AddFrame( NULL,1,hbox1,1 ),0 ); + + scrolledwindow2=gtk_scrolled_window_new( NULL,NULL ); + gtk_widget_show( scrolledwindow2 ); + gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow2,TRUE,TRUE,0 ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow2 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC ); + + CLFiles=gtk_clist_new( 1 ); + gtk_widget_show( CLFiles ); + gtk_container_add( GTK_CONTAINER( scrolledwindow2 ),CLFiles ); + gtk_clist_set_column_width( GTK_CLIST( CLFiles ),0,80 ); + gtk_clist_set_selection_mode( GTK_CLIST( CLFiles ),GTK_SELECTION_EXTENDED ); + gtk_clist_column_titles_show( GTK_CLIST( CLFiles ) ); + gtk_clist_set_shadow_type( GTK_CLIST( CLFiles ),GTK_SHADOW_NONE ); + + gtk_clist_set_column_widget( GTK_CLIST( CLFiles ),0, + AddLabel( MSGTR_PLAYLIST_Files,NULL ) ); + + AddHSeparator( vbox2 ); + + scrolledwindow3=gtk_scrolled_window_new( NULL,NULL ); + gtk_widget_show( scrolledwindow3 ); + gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow3,TRUE,TRUE,0 ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow3 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC ); + + CLSelected=gtk_clist_new( 2 ); + gtk_widget_show( CLSelected ); + gtk_container_add( GTK_CONTAINER( scrolledwindow3 ),CLSelected ); + gtk_clist_set_column_width( GTK_CLIST( CLSelected ),0,295 ); + gtk_clist_set_column_width( GTK_CLIST( CLSelected ),1,295 ); + gtk_clist_set_selection_mode( GTK_CLIST( CLSelected ),GTK_SELECTION_MULTIPLE ); + gtk_clist_column_titles_show( GTK_CLIST( CLSelected ) ); + gtk_clist_set_shadow_type( GTK_CLIST( CLSelected ),GTK_SHADOW_NONE ); + + gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),0, + AddLabel( MSGTR_PLAYLIST_Selected,NULL ) ); + + gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),1, + AddLabel( MSGTR_PLAYLIST_Path,NULL ) ); + + AddHSeparator( vbox1 ); + + hbuttonbox1=AddHButtonBox( vbox1 ); + gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); + gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); + + Add=AddButton( MSGTR_Add,hbuttonbox1 ); + Remove=AddButton( MSGTR_Remove,hbuttonbox1 ); + Ok=AddButton( MSGTR_Ok,hbuttonbox1 ); + Cancel=AddButton( MSGTR_Cancel,hbuttonbox1 ); + + gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); + + gtk_signal_connect( GTK_OBJECT( PlayList ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&PlayList ); + + gtk_signal_connect( GTK_OBJECT( CLFiles ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void *)0 ); + gtk_signal_connect( GTK_OBJECT( CLFiles ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void *)0 ); + gtk_signal_connect( GTK_OBJECT( CLFiles ),"event",GTK_SIGNAL_FUNC( plEvent ),(void *)0 ); + sigSel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void*)1 ); + sigUnsel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void*)1 ); + sigEvent=gtk_signal_connect( GTK_OBJECT( CLSelected ),"event",GTK_SIGNAL_FUNC( plEvent ),(void *)1 ); + + gtk_signal_connect( GTK_OBJECT( Add ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)3 ); + gtk_signal_connect( GTK_OBJECT( Remove ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)2 ); + gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)1 ); + gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)0 ); + + gtk_window_add_accel_group( GTK_WINDOW( PlayList ),accel_group ); + + return PlayList; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/playlist.h Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,29 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_GUI_PLAYLIST_H +#define MPLAYER_GUI_PLAYLIST_H + +#include <gtk/gtk.h> + +void ShowPlayList( void ); +void HidePlayList( void ); + +GtkWidget * create_PlayList (void); + +#endif /* MPLAYER_GUI_PLAYLIST_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/preferences.c Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,1842 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <stdlib.h> +#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 "mpcommon.h" +#include "libao2/audio_out.h" +#include "sub/sub.h" +#include "libvo/video_out.h" +#include "libvo/x11_common.h" +#include "stream/stream.h" +#include "libmpdemux/demuxer.h" +#include "libmpdemux/stheader.h" +#include "libmpcodecs/dec_video.h" +#include "sub/font_load.h" + +#include "gui/app.h" +#include "gui/cfg.h" +#include "gui/interface.h" +#include "gui/ui/gmplayer.h" +#include "gui/ui/widgets.h" +#include "preferences.h" +#include "fileselect.h" +#include "tools.h" + +// 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; + GtkWidget * prEDVDDevice; + GtkWidget * prECDRomDevice; +static GtkWidget * EVFM; +static GtkWidget * EAFM; + +static GtkWidget * CBVFM; +static GtkWidget * CBAFM; +static GtkWidget * CBAudioEqualizer; +//static GtkWidget * CBSurround; +static GtkWidget * CBExtraStereo; +static GtkWidget * CBNormalize; +static GtkWidget * CBSoftwareMixer; +static GtkWidget * CBDoubleBuffer; +static GtkWidget * CBDR; +static GtkWidget * CBFramedrop; +static GtkWidget * CBHFramedrop; +//static GtkWidget * CBFullScreen; +static GtkWidget * CBShowVideoWindow; +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 * CBUseASS; +static GtkWidget * CBASSUseMargins; +static GtkWidget * SBASSTopMargin; +static GtkWidget * SBASSBottomMargin; +static GtkWidget * CBPostprocess; +static GtkWidget * CBCache; +static GtkWidget * CBLoadFullscreen; +static GtkWidget * CBSaveWinPos; +static GtkWidget * CBStopXScreenSaver; +static GtkWidget * CBPlayBar; +static GtkWidget * CBNoIdle; + +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 * RBOSDTPTT; + +static GtkWidget * HSAudioDelay; +static GtkWidget * HSExtraStereoMul; +static GtkWidget * HSPanscan; +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, * HSFPSadj; + +#ifndef CONFIG_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, * RBFontAutoScaleWidth, * RBFontAutoScaleHeight, * RBFontAutoScaleDiagonal; +//static GtkWidget * AutoScale; +#endif + +#ifdef CONFIG_ICONV +static GtkWidget * CBSubEncoding, * ESubEncoding; +#endif + +#if defined(CONFIG_FREETYPE) || defined(CONFIG_ICONV) +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 }, + { "cp1250", MSGTR_PREFERENCES_FontEncoding22}, + { "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 }, + { "cp1256", MSGTR_PREFERENCES_FontEncoding23 }, + { "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; +char * lSEncoding = 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 CONFIG_DXR3 + void ShowDXR3Config( void ); + void HideDXR3Config( void ); +#endif + void ShowAudioConfig( void ); + void HideAudioConfig( void ); + +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 ); +#if defined(CONFIG_FREETYPE) || defined(CONFIG_ICONV) +static void prEntry( GtkContainer * container,gpointer user_data ); +#endif + +void ShowPreferences( void ) +{ + if ( Preferences ) gtkActive( Preferences ); + else Preferences=create_Preferences(); + +// -- 1. page + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBAudioEqualizer ),gtkEnableAudioEqualizer ); +#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_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSoftwareMixer ),soft_vol ); + 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 ); + if ( !strncmp( ao_driver[0],"oss",3 ) || + !strncmp( ao_driver[0],"alsa",4 ) || + !strncmp( ao_driver[0],"esd",3 ) || + !strncmp( ao_driver[0],"sdl",3 ) ) + gtk_widget_set_sensitive( AConfig,TRUE ); + } + } + +// -- 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 ),flip ); + gtk_adjustment_set_value( HSPanscanadj,vo_panscan ); + + { + int i = 0, c = 0; + char * tmp[3]; tmp[2]=""; + old_video_driver=0; + if ( CLVDrivers ) gtk_clist_clear( GTK_CLIST( CLVDrivers ) ); + while ( video_out_drivers[i] ) + if ( video_out_drivers[i++]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) + { + if ( video_driver_list && !gstrcmp( video_driver_list[0],(char *)video_out_drivers[i - 1]->info->short_name ) ) old_video_driver=c; c++; + tmp[0]=(char *)video_out_drivers[i - 1]->info->short_name; tmp[1]=(char *)video_out_drivers[i - 1]->info->name; + gtk_clist_append( GTK_CLIST( CLVDrivers ),tmp ); + } + gtk_clist_select_row( GTK_CLIST( CLVDrivers ),old_video_driver,0 ); + gtk_clist_get_text( GTK_CLIST( CLVDrivers ),old_video_driver,0,(char **)&vo_driver ); + gtk_widget_set_sensitive( VConfig,FALSE ); +#ifdef CONFIG_DXR3 + if ( !gstrcmp( vo_driver[0],"dxr3" ) ) gtk_widget_set_sensitive( VConfig,TRUE ); +#endif + } + + gtk_adjustment_set_value( HSFPSadj,force_fps ); + +// -- 3. page + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSubOverlap ),suboverlap_enabled ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNoAutoSub ),!sub_auto ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBDumpMPSub ),gtkSubDumpMPSub ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBDumpSrt ),gtkSubDumpSrt ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSubUnicode ),sub_unicode ); +#ifdef CONFIG_ASS + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBUseASS ),gtkASS.enabled ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBASSUseMargins ),gtkASS.use_margins ); + gtk_spin_button_set_value( (GtkSpinButton *)SBASSTopMargin,(gdouble)gtkASS.top_margin ); + gtk_spin_button_set_value( (GtkSpinButton *)SBASSBottomMargin,(gdouble)gtkASS.bottom_margin ); + + if ( !gtkASS.enabled ) + { + gtk_widget_set_sensitive( CBASSUseMargins,FALSE ); + gtk_widget_set_sensitive( SBASSTopMargin,FALSE ); + gtk_widget_set_sensitive( SBASSBottomMargin,FALSE ); + } +#endif + + gtk_adjustment_set_value( HSSubDelayadj,sub_delay ); + gtk_adjustment_set_value( HSSubFPSadj,sub_fps ); + gtk_adjustment_set_value( HSSubPositionadj,sub_pos ); + switch ( osd_level ) + { + case 0: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBOSDNone ),TRUE ); break; + case 1: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBOSDIndicator ),TRUE ); break; + case 2: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBOSDTandP ),TRUE ); break; + case 3: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBOSDTPTT ),TRUE ); break; + } +#if 0 + if ( guiInfo.Subtitlename ) gtk_entry_set_text( GTK_ENTRY( ESubtitleName ),guiInfo.Subtitlename ); +#endif + +#ifdef CONFIG_ICONV + if ( sub_cp ) + { + int i; + for ( i=0;lEncoding[i].name;i++ ) + if ( !gstrcmp( sub_cp,lEncoding[i].name ) ) break; + if ( lEncoding[i].name ) lSEncoding=lEncoding[i].comment; + gtk_entry_set_text( GTK_ENTRY( ESubEncoding ),lSEncoding ); + } +#endif + +// --- 4. page + // font ... + if ( font_name ) gtk_entry_set_text( GTK_ENTRY( prEFontName ),font_name ); +#ifndef CONFIG_FREETYPE + gtk_adjustment_set_value( HSFontFactoradj,font_factor ); +#else + gtk_adjustment_set_value( HSFontBluradj,( subtitle_font_radius / 8.0f ) * 100.0f ); + gtk_adjustment_set_value( HSFontOutLineadj,( subtitle_font_thickness / 8.0f ) * 100.0f ); + gtk_adjustment_set_value( HSFontTextScaleadj,text_font_scale_factor ); + gtk_adjustment_set_value( HSFontOSDScaleadj,osd_font_scale_factor ); + if ( subtitle_font_encoding ) + { + int i; + for ( i=0;lEncoding[i].name;i++ ) + if ( !gstrcmp( subtitle_font_encoding,lEncoding[i].name ) ) break; + if ( lEncoding[i].name ) lCEncoding=lEncoding[i].comment; + gtk_entry_set_text( GTK_ENTRY( EFontEncoding ),lCEncoding ); + } + switch ( subtitle_autoscale ) + { + case 0: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBFontNoAutoScale ),TRUE ); break; + case 1: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleHeight ),TRUE ); break; + case 2: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleWidth ),TRUE ); break; + case 3: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleDiagonal ),TRUE ); break; + } +#endif + +// -- 5. page + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNonInterlaved ),force_ni ); + if ( index_mode == 1 ) gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBIndex ),1 ); + { + int i; + GList * Items = NULL; + char * name = NULL; + + Items=g_list_append( Items,MSGTR_PREFERENCES_None ); + for( i=0;mpcodecs_vd_drivers[i];i++ ) + { + Items=g_list_append( Items,(char *)mpcodecs_vd_drivers[i]->info->name ); + if ( video_fm_list && !gstrcmp( video_fm_list[0],(char *)mpcodecs_vd_drivers[i]->info->short_name ) ) name=(char *)mpcodecs_vd_drivers[i]->info->name; + } + gtk_combo_set_popdown_strings( GTK_COMBO( CBVFM ),Items ); + g_list_free( Items ); + if ( name ) gtk_entry_set_text( GTK_ENTRY( EVFM ),name ); + } + + { + int i; + GList * Items = NULL; + char * name = NULL; + + Items=g_list_append( Items,MSGTR_PREFERENCES_None ); + for( i=0;mpcodecs_ad_drivers[i];i++ ) + { + Items=g_list_append( Items,(char *)mpcodecs_ad_drivers[i]->info->name ); + if ( audio_fm_list && !gstrcmp( audio_fm_list[0],(char *)mpcodecs_ad_drivers[i]->info->short_name ) ) name=(char *)mpcodecs_ad_drivers[i]->info->name; + } + gtk_combo_set_popdown_strings( GTK_COMBO( CBAFM ),Items ); + g_list_free( Items ); + if ( name ) gtk_entry_set_text( GTK_ENTRY( EAFM ),name ); + } + +// --- 6. page + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBPostprocess ),gtkVfPP ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ),gtkLoadFullscreen ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSaveWinPos ),gui_save_pos ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBShowVideoWindow ),gtkShowVideoWindow ); + if ( !gtkShowVideoWindow ) + { + gtk_widget_set_sensitive( CBLoadFullscreen,FALSE ); + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ),0 ); + } + 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( CBPlayBar ),gtkEnablePlayBar ); + if ( !guiApp.playbarIsPresent ) + { + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBPlayBar ),0 ); + gtk_widget_set_sensitive( CBPlayBar,FALSE ); + } + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNoIdle ),!player_idle_mode ); + + 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 ); + else gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBCache ),TRUE ); + + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBAutoSync ),0 ); + gtk_adjustment_set_value( SBAutoSyncadj,(float)gtkAutoSync ); + if ( !gtkAutoSyncOn ) gtk_widget_set_sensitive( SBAutoSync,FALSE ); + else gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBAutoSync ),TRUE ); + + if ( dvd_device ) gtk_entry_set_text( GTK_ENTRY( prEDVDDevice ),dvd_device ); + else gtk_entry_set_text( GTK_ENTRY( prEDVDDevice ),DEFAULT_DVD_DEVICE ); + if ( cdrom_device ) gtk_entry_set_text( GTK_ENTRY( prECDRomDevice ),cdrom_device ); + else gtk_entry_set_text( GTK_ENTRY( prECDRomDevice ),DEFAULT_CDROM_DEVICE ); + +// -- disables +#ifndef CONFIG_ASS + gtk_widget_set_sensitive( CBUseASS,FALSE ); + gtk_widget_set_sensitive( CBASSUseMargins,FALSE ); + gtk_widget_set_sensitive( SBASSTopMargin,FALSE ); + gtk_widget_set_sensitive( SBASSBottomMargin,FALSE ); +#endif + +// -- signals + gtk_signal_connect( GTK_OBJECT( CBExtraStereo ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)0 ); + gtk_signal_connect( GTK_OBJECT( CBNormalize ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)1 ); + gtk_signal_connect( GTK_OBJECT( CBSoftwareMixer ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)1 ); + gtk_signal_connect( GTK_OBJECT( CBAudioEqualizer ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)2 ); + gtk_signal_connect( GTK_OBJECT( CBShowVideoWindow ),"toggled",GTK_SIGNAL_FUNC( prToggled ), (void*)3 ); +#ifdef CONFIG_FREETYPE + gtk_signal_connect( GTK_OBJECT( RBFontNoAutoScale ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)4 ); + gtk_signal_connect( GTK_OBJECT( RBFontAutoScaleHeight ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)5 ); + gtk_signal_connect( GTK_OBJECT( RBFontAutoScaleWidth ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)6 ); + gtk_signal_connect( GTK_OBJECT( RBFontAutoScaleDiagonal ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)7 ); +#endif + gtk_signal_connect( GTK_OBJECT( CBCache ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)8); + gtk_signal_connect( GTK_OBJECT( CBAutoSync ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)9); +#ifdef CONFIG_ASS + gtk_signal_connect( GTK_OBJECT( CBUseASS ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)10); +#endif + + gtk_signal_connect( GTK_OBJECT( HSExtraStereoMul ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)0 ); + gtk_signal_connect( GTK_OBJECT( HSAudioDelay ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)1 ); + gtk_signal_connect( GTK_OBJECT( HSPanscan ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)2 ); + gtk_signal_connect( GTK_OBJECT( HSSubDelay ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)3 ); + gtk_signal_connect( GTK_OBJECT( HSSubPosition ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)4 ); +#ifndef CONFIG_FREETYPE + gtk_signal_connect( GTK_OBJECT( HSFontFactor ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)5 ); +#else + gtk_signal_connect( GTK_OBJECT( HSFontBlur ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)6 ); + gtk_signal_connect( GTK_OBJECT( HSFontOutLine ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)7 ); + gtk_signal_connect( GTK_OBJECT( HSFontTextScale ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)8 ); + gtk_signal_connect( GTK_OBJECT( HSFontOSDScale ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)9 ); + gtk_signal_connect( GTK_OBJECT( EFontEncoding ),"changed",GTK_SIGNAL_FUNC( prEntry ),(void *)0 ); +#endif +#ifdef CONFIG_ICONV + gtk_signal_connect( GTK_OBJECT( ESubEncoding ),"changed",GTK_SIGNAL_FUNC( prEntry ),(void *)1 ); +#endif + gtk_signal_connect( GTK_OBJECT( HSPPQuality ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)10 ); + + gtk_signal_connect( GTK_OBJECT( CLADrivers ),"select_row",GTK_SIGNAL_FUNC( prCListRow ),(void*)0 ); + gtk_signal_connect( GTK_OBJECT( CLVDrivers ),"select_row",GTK_SIGNAL_FUNC( prCListRow ),(void*)1 ); + + gtk_widget_show( Preferences ); + gtkSetLayer( Preferences ); + { + static int visible = 1; + if ( visible ) + { + gtkMessageBox( GTK_MB_WARNING,MSGTR_PREFERENCES_Message ); + visible=0; + } + } +} + +static void HidePreferences( void ) +{ + if ( !Preferences ) return; + gtk_widget_hide( Preferences ); + gtk_widget_destroy( Preferences ); + Preferences=NULL; + HideAudioConfig(); +#ifdef CONFIG_DXR3 + HideDXR3Config(); +#endif +} + +#if defined(CONFIG_FREETYPE) || defined(CONFIG_ICONV) +static void prEntry( GtkContainer * container,gpointer user_data ) +{ + const char * comment; + int i; + + switch( (int)user_data ) + { +#ifdef CONFIG_FREETYPE + case 0: // font encoding + comment=gtk_entry_get_text( GTK_ENTRY( EFontEncoding ) ); + for ( i=0;lEncoding[i].name;i++ ) + if ( !gstrcmp( lEncoding[i].comment,comment ) ) break; + if ( lEncoding[i].comment ) gtkSet( gtkSetFontEncoding,0,lEncoding[i].name ); + break; +#endif +#ifdef CONFIG_ICONV + case 1: // sub encoding + comment=gtk_entry_get_text( GTK_ENTRY( ESubEncoding ) ); + for ( i=0;lEncoding[i].name;i++ ) + if ( !gstrcmp( lEncoding[i].comment,comment ) ) break; + if ( lEncoding[i].comment ) gtkSet( gtkSetSubEncoding,0,lEncoding[i].name ); + else gtkSet( gtkSetSubEncoding,0,NULL ); + break; +#endif + } +} +#endif + +#define bAConfig 0 +#define bVconfig 1 +#define bOk 2 +#define bCancel 3 +#define bLSubtitle 4 +#define bLFont 5 + +static void prButton( GtkButton * button, gpointer user_data ) +{ + switch ( (int)user_data ) + { + case bOk: + // -- 1. page + gtkEnableAudioEqualizer=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBAudioEqualizer ) ); + gtkAOExtraStereo=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBExtraStereo ) ); + gtkAONorm=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNormalize ) ); + soft_vol=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSoftwareMixer ) ); + gtkSet( gtkSetExtraStereo,HSExtraStereoMuladj->value,NULL ); + audio_delay=HSAudioDelayadj->value; + + gaddlist( &audio_driver_list,ao_driver[0] ); + gaddlist( &video_driver_list,vo_driver[0] ); + + // -- 2. page + vo_doublebuffering=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDoubleBuffer ) ); + vo_directrendering=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDR ) ); + + frame_dropping=0; + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBFramedrop ) ) == TRUE ) frame_dropping=1; + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBHFramedrop ) ) == TRUE ) frame_dropping=2; + + flip=-1; + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBFlip ) ) ) flip=1; + + force_fps=HSFPSadj->value; + + // -- 3. page + suboverlap_enabled=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSubOverlap ) ); + sub_auto=!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNoAutoSub ) ); + gtkSubDumpMPSub=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDumpMPSub ) ); + gtkSubDumpSrt=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDumpSrt ) ); + sub_unicode=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSubUnicode ) ); +#ifdef CONFIG_ASS + gtkASS.enabled=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBUseASS ) ); + gtkASS.use_margins=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBASSUseMargins ) ); + gtkASS.top_margin=gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( SBASSTopMargin ) ); + gtkASS.bottom_margin=gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( SBASSBottomMargin ) ); +#endif + sub_delay=HSSubDelayadj->value; + sub_fps=HSSubFPSadj->value; + sub_pos=(int)HSSubPositionadj->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; + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDTPTT ) ) ) osd_level=3; + + + // --- 4. page + guiSetFilename( font_name,gtk_entry_get_text( GTK_ENTRY( prEFontName ) ) ); +#ifndef CONFIG_FREETYPE + gtkSet( gtkSetFontFactor,HSFontFactoradj->value,NULL ); +#else + gtkSet( gtkSetFontBlur,HSFontBluradj->value,NULL ); + gtkSet( gtkSetFontOutLine,HSFontOutLineadj->value,NULL ); + gtkSet( gtkSetFontTextScale,HSFontTextScaleadj->value,NULL ); + gtkSet( gtkSetFontOSDScale,HSFontOSDScaleadj->value,NULL ); + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontNoAutoScale ) ) ) gtkSet( gtkSetFontAutoScale,0,NULL ); + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleHeight ) ) ) gtkSet( gtkSetFontAutoScale,1,NULL ); + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleWidth ) ) ) gtkSet( gtkSetFontAutoScale,2,NULL ); + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleDiagonal ) ) ) gtkSet( gtkSetFontAutoScale,3,NULL ); +#endif + + // -- 5. page + force_ni=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNonInterlaved ) ); + index_mode=-1; + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBIndex ) ) ) index_mode=1; + + { + int i; + const char * tmp = gtk_entry_get_text( GTK_ENTRY( EVFM ) ); + for( i=0;mpcodecs_vd_drivers[i];i++ ) + if ( !gstrcmp( tmp,(char *)mpcodecs_vd_drivers[i]->info->name ) ) + { gaddlist( &video_fm_list,(char *)mpcodecs_vd_drivers[i]->info->short_name ); break; } + } + + { + int i; + const char * tmp = gtk_entry_get_text( GTK_ENTRY( EAFM ) ); + for( i=0;mpcodecs_ad_drivers[i];i++ ) + if ( !gstrcmp( tmp,(char *)mpcodecs_ad_drivers[i]->info->name ) ) + { gaddlist( &audio_fm_list,(char *)mpcodecs_ad_drivers[i]->info->short_name ); break; } + } + + // --- 6. page + gtkVfPP=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBPostprocess ) ); + gtkLoadFullscreen=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ) ); + gui_save_pos=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSaveWinPos ) ); + gtkShowVideoWindow=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBShowVideoWindow ) ); + stop_xscreensaver=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBStopXScreenSaver ) ); + gtkEnablePlayBar=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBPlayBar ) ); + player_idle_mode=!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNoIdle ) ); + 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 ) ) ); + + case bCancel: + HidePreferences(); + break; + case bAConfig: + if ( !ao_driver[0] ) break; + gtk_widget_set_sensitive( AConfig,FALSE ); + if ( !strncmp( ao_driver[0],"oss",3 ) || + !strncmp( ao_driver[0],"alsa",4 ) || + !strncmp( ao_driver[0],"esd",3 ) || + !strncmp( ao_driver[0],"sdl",3 ) ) { + ShowAudioConfig(); + gtk_widget_set_sensitive( AConfig,TRUE ); + } + break; + case bVconfig: + if ( !vo_driver[0] ) break; + gtk_widget_set_sensitive( VConfig,FALSE ); +#ifdef CONFIG_DXR3 + if ( !gstrcmp( vo_driver[0],"dxr3" ) ) { ShowDXR3Config(); gtk_widget_set_sensitive( VConfig,TRUE ); } +#endif + break; +#if 0 + case bLSubtitle: + break; +#endif + case bLFont: + ShowFileSelect( fsFontSelector,FALSE ); + gtkSetLayer( fsFileSelect ); + break; + } +} + +static gboolean prHScaler( GtkWidget * widget,GdkEventMotion * event,gpointer user_data ) +{ + switch ( (int)user_data ) + { + case 0: // extra stereo coefficient + if ( !guiInfo.Playing ) break; + gtkSet( gtkSetExtraStereo,HSExtraStereoMuladj->value,NULL ); + break; + case 1: // audio delay + audio_delay=HSAudioDelayadj->value; + break; + case 2: // panscan + gtkSet( gtkSetPanscan,HSPanscanadj->value,NULL ); + break; + case 3: // sub delay + sub_delay=HSSubDelayadj->value; + break; + case 4: // sub position + sub_pos=(int)HSSubPositionadj->value; + break; +#ifndef CONFIG_FREETYPE + case 5: // font factor + gtkSet( gtkSetFontFactor,HSFontFactoradj->value,NULL ); + break; +#else + case 6: // font blur + gtkSet( gtkSetFontBlur,HSFontBluradj->value,NULL ); + break; + case 7: // font outline + gtkSet( gtkSetFontOutLine,HSFontOutLineadj->value,NULL ); + break; + case 8: // text scale + gtkSet( gtkSetFontTextScale,HSFontTextScaleadj->value,NULL ); + break; + case 9: // osd scale + gtkSet( gtkSetFontOSDScale,HSFontOSDScaleadj->value,NULL ); + break; +#endif + case 10: // auto quality + gtkSet( gtkSetAutoq,HSPPQualityadj->value,NULL ); + break; + } + return FALSE; +} + +static void prToggled( GtkToggleButton * togglebutton,gpointer user_data ) +{ + int window; + switch ( (int)user_data ) + { + case 0: // extra stereo coefficient + if ( guiInfo.Playing ) + gtk_widget_set_sensitive( HSExtraStereoMul,gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBExtraStereo ) ) ); + break; +// case 1: // normalize +// case 2: // equalizer +// if ( guiInfo.Playing ) gtkMessageBox( GTK_MB_WARNING,"Please remember, this function need restart the playing." ); +// break; + case 3: + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBShowVideoWindow ) ) ) gtk_widget_set_sensitive( CBLoadFullscreen,TRUE ); + else + { + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ),0 ); + gtk_widget_set_sensitive( CBLoadFullscreen,FALSE ); + } + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBShowVideoWindow ) ) ) + { + window=wsShowWindow; + gtkActive( Preferences ); + } else window=wsHideWindow; + + if ( !guiInfo.Playing ) wsVisibleWindow( &guiApp.subWindow,window ); + break; + case 4: + case 5: + case 6: + case 7: + gtkSet( gtkSetFontAutoScale,(float)((int)user_data - 4 ),NULL ); + break; + case 8: + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBCache ) ) ) gtk_widget_set_sensitive( SBCache,TRUE ); + else gtk_widget_set_sensitive( SBCache,FALSE ); + break; + case 9: + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBAutoSync ) ) ) gtk_widget_set_sensitive( SBAutoSync,TRUE ); + else gtk_widget_set_sensitive( SBAutoSync,FALSE ); + break; +#ifdef CONFIG_ASS + case 10: + if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBUseASS ) ) ) + { + gtk_widget_set_sensitive( CBASSUseMargins,TRUE ); + gtk_widget_set_sensitive( SBASSTopMargin,TRUE ); + gtk_widget_set_sensitive( SBASSBottomMargin,TRUE ); + } + else + { + gtk_widget_set_sensitive( CBASSUseMargins,FALSE ); + gtk_widget_set_sensitive( SBASSTopMargin,FALSE ); + gtk_widget_set_sensitive( SBASSBottomMargin,FALSE ); + } + break; +#endif + } +} + +static void prCListRow( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data ) +{ + switch ( (int)user_data ) + { + case 0: // audio driver + gtk_clist_get_text( GTK_CLIST( CLADrivers ),row,0,(char **)&ao_driver ); + gtk_widget_set_sensitive( AConfig,FALSE ); + if ( !strncmp( ao_driver[0],"oss",3 ) || + !strncmp( ao_driver[0],"alsa",4 ) || + !strncmp( ao_driver[0],"esd",3 ) || + !strncmp( ao_driver[0],"sdl",3 ) ) + gtk_widget_set_sensitive( AConfig,TRUE ); +#ifndef CONFIG_GTK2 + if ( !strncmp( ao_driver[0],"arts",4 ) ) + gtkMessageBox(GTK_MB_WARNING|GTK_MB_SIMPLE, MSGTR_PREFERENCES_ArtsBroken); +#endif + break; + case 1: // video driver + gtk_clist_get_text( GTK_CLIST( CLVDrivers ),row,0,(char **)&vo_driver ); + gtk_widget_set_sensitive( VConfig,FALSE ); +#ifdef CONFIG_DXR3 + if ( !gstrcmp( vo_driver[0],"dxr3" ) ) gtk_widget_set_sensitive( VConfig,TRUE ); +#endif + break; + } +} + +GtkWidget * create_Preferences( void ) +{ + GtkWidget * label; + GtkWidget * frame; + + GtkWidget * vbox1; + GtkWidget * notebook1; + GtkWidget * hbox1; + GtkWidget * vbox2; + GtkWidget * scrolledwindow3; + GtkWidget * vbox3; + GtkWidget * hbox8; + GtkWidget * hbox2; + GtkWidget * vbox4; + GtkWidget * scrolledwindow2; + GtkWidget * hbuttonbox3; + GtkWidget * vbox5; + GtkWidget * vbox6; + GtkWidget * vbox600; + GSList * OSD_group = NULL; +#ifdef CONFIG_ICONV + GSList * Font_group = NULL; + GList * CBFontEncoding_items = NULL; + GList * CBSubEncoding_items = NULL; +#endif + GtkWidget * vbox7; + GtkWidget * vbox8; + GtkWidget * table1; + GtkWidget * vbox9; + GtkWidget * vbox603; + GtkWidget * hbox6; + GtkWidget * hbuttonbox5; +#ifndef CONFIG_FREETYPE + GtkWidget * hbox7; +#endif + GtkWidget * vbox601; + GtkWidget * vbox602; + GtkWidget * hbox5; + GtkWidget * hbuttonbox1; + GtkAccelGroup * accel_group; + + GtkWidget * hbox9; + GtkWidget * hbox91; + GtkWidget * hbox92; + + accel_group=gtk_accel_group_new(); + + Preferences=gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_name( Preferences,"Preferences" ); + gtk_object_set_data( GTK_OBJECT( Preferences ),"Preferences",Preferences ); + gtk_window_set_title( GTK_WINDOW( Preferences ),MSGTR_Preferences ); + gtk_window_set_position( GTK_WINDOW( Preferences ),GTK_WIN_POS_CENTER ); +// gtk_window_set_policy( GTK_WINDOW( Preferences ),FALSE,FALSE,FALSE ); + gtk_window_set_wmclass( GTK_WINDOW( Preferences ),"Preferences","MPlayer" ); + + gtk_widget_realize( Preferences ); + gtkAddIcon( Preferences ); + + vbox1=AddVBox( AddDialogFrame( Preferences ),0 ); + notebook1=gtk_notebook_new(); + gtk_widget_set_name( notebook1,"notebook1" ); + gtk_widget_show( notebook1 ); + gtk_box_pack_start( GTK_BOX( vbox1 ),notebook1,TRUE,TRUE,0 ); + + hbox1=AddVBox( notebook1,0 ); + + frame=AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,hbox1,1 ); + frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 ); + +// --- 1. page + + vbox2=AddVBox( frame,0 ); + + scrolledwindow3=gtk_scrolled_window_new( NULL,NULL ); + gtk_widget_set_name( scrolledwindow3,"scrolledwindow3" ); + gtk_widget_show( scrolledwindow3 ); + gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow3,TRUE,TRUE,0 ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow3 ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC ); + + CLADrivers=gtk_clist_new( 2 ); + gtk_widget_set_name( CLADrivers,"CLADrivers" ); + gtk_widget_show( CLADrivers ); + gtk_container_add( GTK_CONTAINER( scrolledwindow3 ),CLADrivers ); + gtk_clist_set_column_width( GTK_CLIST( CLADrivers ),0,50 ); + gtk_clist_column_titles_show( GTK_CLIST( CLADrivers ) ); + gtk_clist_set_shadow_type( GTK_CLIST( CLADrivers ),GTK_SHADOW_NONE ); + gtk_widget_set_usize( CLADrivers,250,-2 ); + gtk_clist_set_column_widget( GTK_CLIST( CLADrivers ),0, + AddLabel( MSGTR_PREFERENCES_AvailableDrivers,NULL ) ); + + AConfig=AddButton( MSGTR_ConfigDriver, + AddHButtonBox( vbox2 ) ); + + vbox3=AddVBox( + AddFrame( NULL,GTK_SHADOW_NONE, + AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,hbox1,0 ),1 ),0 ); + gtk_widget_set_usize( vbox3,250,-2 ); + + CBNormalize=AddCheckButton( MSGTR_PREFERENCES_NormalizeSound,vbox3 ); + CBAudioEqualizer=AddCheckButton( MSGTR_PREFERENCES_EnableEqualizer,vbox3 ); + CBSoftwareMixer=AddCheckButton( MSGTR_PREFERENCES_SoftwareMixer,vbox3 ); +#if 0 + CBSurround=AddCheckButton( "Enable surround",vbox3 ); +#endif + + AddHSeparator( vbox3 ); + CBExtraStereo=AddCheckButton( MSGTR_PREFERENCES_ExtraStereo,vbox3 ); + hbox8=AddHBox( vbox3,1 ); + label=AddLabel( MSGTR_PREFERENCES_Coefficient,hbox8 ); +// gtk_misc_set_padding( GTK_MISC( label ),20,0 ); + HSExtraStereoMuladj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-10,10,0.1,0,0 ) ); + HSExtraStereoMul=AddHScaler( HSExtraStereoMuladj,hbox8,1 ); + AddHSeparator( vbox3 ); + + hbox8=AddHBox( vbox3,1 ); + AddLabel( MSGTR_PREFERENCES_AudioDelay,hbox8 ); + + HSAudioDelayadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-10,10,0.01,0,0 ) ); + HSAudioDelay=AddHScaler( HSAudioDelayadj,hbox8,2 ); + 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. page + + hbox2=AddVBox( notebook1,0 ); + + vbox4=AddVBox( + AddFrame( NULL,GTK_SHADOW_NONE, + AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,hbox2,1 ),1 ),0 ); + + scrolledwindow2=gtk_scrolled_window_new( NULL,NULL ); + gtk_widget_set_name( scrolledwindow2,"scrolledwindow2" ); + gtk_widget_show( scrolledwindow2 ); + gtk_box_pack_start( GTK_BOX( vbox4 ),scrolledwindow2,TRUE,TRUE,0 ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow2 ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC ); + + CLVDrivers=gtk_clist_new( 2 ); + gtk_widget_set_name( CLVDrivers,"CLVDrivers" ); + gtk_widget_show( CLVDrivers ); + gtk_container_add( GTK_CONTAINER( scrolledwindow2 ),CLVDrivers ); + gtk_clist_set_column_width( GTK_CLIST( CLVDrivers ),0,50 ); + gtk_clist_column_titles_show( GTK_CLIST( CLVDrivers ) ); + gtk_clist_set_shadow_type( GTK_CLIST( CLVDrivers ),GTK_SHADOW_NONE ); + gtk_widget_set_usize( CLVDrivers,250,-2 ); + + label=AddLabel( MSGTR_PREFERENCES_AvailableDrivers,NULL ); + gtk_clist_set_column_widget( GTK_CLIST( CLVDrivers ),0,label ); + + hbuttonbox3=AddHButtonBox( vbox4 ); + VConfig=AddButton( MSGTR_ConfigDriver,hbuttonbox3 ); + + vbox5=AddVBox( + AddFrame( NULL,GTK_SHADOW_NONE, + AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,hbox2,0 ),1 ),0 ); + gtk_widget_set_usize( vbox5,250,-2 ); + + CBDoubleBuffer=AddCheckButton( MSGTR_PREFERENCES_DoubleBuffer,vbox5 ); + CBDR=AddCheckButton( MSGTR_PREFERENCES_DirectRender,vbox5 ); + CBFramedrop=AddCheckButton( MSGTR_PREFERENCES_FrameDrop,vbox5 ); + CBHFramedrop=AddCheckButton( MSGTR_PREFERENCES_HFrameDrop,vbox5 ); + CBFlip=AddCheckButton( MSGTR_PREFERENCES_Flip,vbox5 ); + + 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 ); + + 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,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 ); + +// --- 3. page + + vbox6=AddVBox( notebook1,0 ); + + vbox600=AddVBox( + AddFrame( NULL,GTK_SHADOW_NONE, + AddFrame( MSGTR_PREFERENCES_FRAME_OSD_Level,GTK_SHADOW_ETCHED_OUT,vbox6,0 ),1 ),0 ); + + RBOSDNone=AddRadioButton( MSGTR_PREFERENCES_None,&OSD_group,vbox600 ); + RBOSDTandP=AddRadioButton( MSGTR_PREFERENCES_OSDTimer,&OSD_group,vbox600 ); + RBOSDIndicator=AddRadioButton( MSGTR_PREFERENCES_OSDProgress,&OSD_group,vbox600 ); + RBOSDTPTT=AddRadioButton( MSGTR_PREFERENCES_OSDTimerPercentageTotalTime,&OSD_group,vbox600 ); + + vbox7=AddVBox( + AddFrame( NULL,GTK_SHADOW_NONE, + AddFrame( MSGTR_PREFERENCES_FRAME_Subtitle,GTK_SHADOW_ETCHED_OUT,vbox6,0 ),1 ),0 ); + +#if 0 + hbox4=AddHBox( vbox7,1 ); + + AddLabel( MSGTR_PREFERENCES_Subtitle,hbox4 ); + + ESubtitleName=gtk_entry_new(); + gtk_widget_set_name( ESubtitleName,"ESubtitleName" ); + gtk_widget_show( ESubtitleName ); + gtk_box_pack_start( GTK_BOX( hbox4 ),ESubtitleName,TRUE,TRUE,0 ); + + hbuttonbox4=AddHButtonBox( hbuttonbox4 ); + gtk_container_set_border_width( GTK_CONTAINER( hbuttonbox4 ),3 ); + BLoadSubtitle=AddButton( MSGTR_Browse,hbuttonbox4 ); +#endif + + vbox8=AddVBox( vbox7,0 ); + + table1=gtk_table_new( 3,2,FALSE ); + gtk_widget_set_name( table1,"table1" ); + gtk_widget_show( table1 ); + gtk_box_pack_start( GTK_BOX( vbox8 ),table1,FALSE,FALSE,0 ); + + 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,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + +#ifdef CONFIG_ICONV + label=AddLabel( MSGTR_PREFERENCES_FontEncoding,NULL ); + gtk_table_attach( GTK_TABLE( table1 ),label,0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); +#endif + + 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 ); + + 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,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=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 ); + +#ifdef CONFIG_ICONV + CBSubEncoding=gtk_combo_new(); + gtk_widget_set_name( CBSubEncoding,"CBSubEncoding" ); + gtk_widget_show( CBSubEncoding ); + gtk_table_attach( GTK_TABLE( table1 ),CBSubEncoding,1,2,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + CBSubEncoding_items=g_list_append( CBSubEncoding_items,MSGTR_PREFERENCES_None ); + { + int i; + for ( i=0;lEncoding[i].name;i++ ) CBSubEncoding_items=g_list_append( CBSubEncoding_items,lEncoding[i].comment ); + } + gtk_combo_set_popdown_strings( GTK_COMBO( CBSubEncoding ),CBSubEncoding_items ); + g_list_free( CBSubEncoding_items ); + + ESubEncoding=GTK_COMBO( CBSubEncoding )->entry; + gtk_widget_set_name( ESubEncoding,"ESubEncoding" ); + gtk_entry_set_editable( GTK_ENTRY( ESubEncoding ),FALSE ); + gtk_widget_show( ESubEncoding ); +#endif + + vbox9=AddVBox( vbox8,0 ); + + CBSubOverlap=AddCheckButton( MSGTR_PREFERENCES_SUB_Overlap,vbox9 ); + CBNoAutoSub=AddCheckButton( MSGTR_PREFERENCES_SUB_AutoLoad,vbox9 ); + CBSubUnicode=AddCheckButton( MSGTR_PREFERENCES_SUB_Unicode,vbox9 ); + CBDumpMPSub=AddCheckButton( MSGTR_PREFERENCES_SUB_MPSUB,vbox9 ); + CBDumpSrt=AddCheckButton( MSGTR_PREFERENCES_SUB_SRT,vbox9 ); + + AddHSeparator( vbox9 ); + CBUseASS=AddCheckButton( MSGTR_PREFERENCES_SUB_USE_ASS,vbox9 ); + hbox9=AddHBox( vbox9,0 ); + CBASSUseMargins=AddCheckButton( MSGTR_PREFERENCES_SUB_ASS_USE_MARGINS,hbox9 ); + + hbox91=gtk_hbox_new( FALSE,0 ); + gtk_widget_set_name( hbox91,"hbox91" ); + gtk_box_pack_start( GTK_BOX( hbox9 ),hbox91,TRUE,FALSE,0 ); + gtk_widget_show( hbox91 ); + SBASSTopMargin=AddSpinButton( MSGTR_PREFERENCES_SUB_ASS_TOP_MARGIN, + (GtkAdjustment *)gtk_adjustment_new(0,0,512,1,8,0),hbox91 ); + + hbox92=gtk_hbox_new( FALSE,0 ); + gtk_widget_set_name( hbox92,"hbox92" ); + gtk_box_pack_start( GTK_BOX( hbox9 ),hbox92,TRUE,FALSE,0 ); + gtk_widget_show( hbox92 ); + SBASSBottomMargin=AddSpinButton( MSGTR_PREFERENCES_SUB_ASS_BOTTOM_MARGIN, + (GtkAdjustment *)gtk_adjustment_new(0,0,512,1,8,0),hbox92 ); + + label=AddLabel( MSGTR_PREFERENCES_SubtitleOSD,NULL ); + gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),2 ),label ); + vbox601=AddVBox( notebook1,0 ); + +// --- 4. page + + vbox603=AddVBox( + AddFrame( NULL,GTK_SHADOW_NONE, + AddFrame( MSGTR_PREFERENCES_FRAME_Font,GTK_SHADOW_ETCHED_OUT,vbox601,0 ),1 ),0 ); + + hbox6=AddHBox( vbox603,1 ); + AddLabel( MSGTR_PREFERENCES_Font,hbox6 ); + prEFontName=gtk_entry_new(); + gtk_widget_set_name( prEFontName,"prEFontName" ); + gtk_widget_show( prEFontName ); + gtk_box_pack_start( GTK_BOX( hbox6 ),prEFontName,TRUE,TRUE,0 ); + hbuttonbox5=AddHButtonBox( hbox6 ); + gtk_container_set_border_width( GTK_CONTAINER( hbuttonbox5 ),3 ); + BLoadFont=AddButton( MSGTR_Browse,hbuttonbox5 ); + +#ifndef CONFIG_FREETYPE + hbox7=AddHBox( vbox603,1 ); + AddLabel( MSGTR_PREFERENCES_FontFactor,hbox7 ); + HSFontFactoradj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,10,0.05,0,0 ) ); + HSFontFactor=AddHScaler( HSFontFactoradj,hbox7,2 ); +#else + + RBFontNoAutoScale=AddRadioButton( MSGTR_PREFERENCES_FontNoAutoScale,&Font_group,vbox603 ); + RBFontAutoScaleHeight=AddRadioButton( MSGTR_PREFERENCES_FontPropHeight,&Font_group,vbox603 ); + RBFontAutoScaleWidth=AddRadioButton( MSGTR_PREFERENCES_FontPropWidth,&Font_group,vbox603 ); + RBFontAutoScaleDiagonal=AddRadioButton( MSGTR_PREFERENCES_FontPropDiagonal,&Font_group,vbox603 ); + + table1=gtk_table_new( 3,2,FALSE ); + gtk_widget_set_name( table1,"table1" ); + gtk_widget_show( table1 ); + gtk_box_pack_start( GTK_BOX( vbox603 ),table1,FALSE,FALSE,0 ); + + label=AddLabel( MSGTR_PREFERENCES_FontEncoding,NULL ); + gtk_table_attach( GTK_TABLE( table1 ),label,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + CBFontEncoding=gtk_combo_new(); + gtk_widget_set_name( CBFontEncoding,"CBFontEncoding" ); + gtk_widget_show( CBFontEncoding ); + gtk_table_attach( GTK_TABLE( table1 ),CBFontEncoding,1,2,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + { + int i; + for ( i=0;lEncoding[i].name;i++ ) CBFontEncoding_items=g_list_append( CBFontEncoding_items,lEncoding[i].comment ); + } + gtk_combo_set_popdown_strings( GTK_COMBO( CBFontEncoding ),CBFontEncoding_items ); + g_list_free( CBFontEncoding_items ); + + EFontEncoding=GTK_COMBO( CBFontEncoding )->entry; + gtk_widget_set_name( EFontEncoding,"EFontEncoding" ); + gtk_entry_set_editable( GTK_ENTRY( EFontEncoding ),FALSE ); + gtk_widget_show( EFontEncoding ); + + label=AddLabel( MSGTR_PREFERENCES_FontBlur,NULL ); + gtk_table_attach( GTK_TABLE( table1 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + HSFontBluradj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.1,0,0 ) ); + HSFontBlur=AddHScaler( HSFontBluradj,NULL,2 ); + gtk_table_attach( GTK_TABLE( table1 ),HSFontBlur,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + label=AddLabel( MSGTR_PREFERENCES_FontOutLine,NULL ); + gtk_table_attach( GTK_TABLE( table1 ),label,0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + HSFontOutLineadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.1,0,0 ) ); + HSFontOutLine=AddHScaler( HSFontOutLineadj,NULL,2 ); + gtk_table_attach( GTK_TABLE( table1 ),HSFontOutLine,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + label=AddLabel( MSGTR_PREFERENCES_FontTextScale,NULL ); + gtk_table_attach( GTK_TABLE( table1 ),label,0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + HSFontTextScaleadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.1,0,0 ) ); + HSFontTextScale=AddHScaler( HSFontTextScaleadj,NULL,2 ); + gtk_table_attach( GTK_TABLE( table1 ),HSFontTextScale,1,2,3,4,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + label=AddLabel( MSGTR_PREFERENCES_FontOSDScale,NULL ); + gtk_table_attach( GTK_TABLE( table1 ),label,0,1,4,5,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + HSFontOSDScaleadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.1,0,0 ) ); + HSFontOSDScale=AddHScaler( HSFontOSDScaleadj,NULL,2 ); + gtk_table_attach( GTK_TABLE( table1 ),HSFontOSDScale,1,2,4,5,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); +#endif + + 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. page + + vbox601=AddVBox( notebook1,0 ); + + vbox602=AddVBox( + AddFrame( NULL,GTK_SHADOW_NONE, + AddFrame( MSGTR_PREFERENCES_FRAME_CodecDemuxer,GTK_SHADOW_ETCHED_OUT,vbox601,0 ),1 ),0 ); + + CBNonInterlaved=AddCheckButton( MSGTR_PREFERENCES_NI,vbox602 ); + CBIndex=AddCheckButton( MSGTR_PREFERENCES_IDX,vbox602 ); + + hbox5=AddHBox( vbox602,1 ); + + AddLabel( MSGTR_PREFERENCES_VideoCodecFamily,hbox5 ); + + CBVFM=gtk_combo_new(); + gtk_widget_set_name( CBVFM,"CBVFM" ); + gtk_widget_show( CBVFM ); + gtk_box_pack_start( GTK_BOX( hbox5 ),CBVFM,TRUE,TRUE,0 ); + + EVFM=GTK_COMBO( CBVFM )->entry; + gtk_widget_set_name( EVFM,"CEVFM" ); + gtk_entry_set_editable( GTK_ENTRY( EVFM ),FALSE ); + gtk_widget_show( EVFM ); + + hbox5=AddHBox( vbox602,1 ); + + AddLabel( MSGTR_PREFERENCES_AudioCodecFamily,hbox5 ); + + CBAFM=gtk_combo_new(); + gtk_widget_set_name( CBAFM,"CBAFM" ); + gtk_widget_show( CBAFM ); + gtk_box_pack_start( GTK_BOX( hbox5 ),CBAFM,TRUE,TRUE,0 ); + + EAFM=GTK_COMBO( CBAFM )->entry; + gtk_widget_set_name( EAFM,"EAFM" ); + gtk_entry_set_editable( GTK_ENTRY( EAFM ),FALSE ); + gtk_widget_show( EAFM ); + + label=AddLabel( MSGTR_PREFERENCES_Codecs,NULL ); + gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),4 ),label ); + + vbox601=AddVBox( notebook1,0 ); + +// --- 6. page + + vbox602=AddVBox( + AddFrame( NULL,GTK_SHADOW_NONE, + AddFrame( MSGTR_PREFERENCES_FRAME_PostProcess,GTK_SHADOW_ETCHED_OUT,vbox601,0 ),1 ),0 ); + + CBPostprocess=AddCheckButton( MSGTR_PREFERENCES_PostProcess,vbox602 ); + + hbox5=AddHBox( vbox602,1 ); + + AddLabel( MSGTR_PREFERENCES_AutoQuality,hbox5 ); + + if ( guiInfo.sh_video && guiInfo.Playing ) HSPPQualityadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,get_video_quality_max( guiInfo.sh_video ),0,0,0 ) ); + else HSPPQualityadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0,0,0 ) ); + HSPPQuality=AddHScaler( HSPPQualityadj,hbox5,0 ); + + vbox602=AddVBox( + AddFrame( NULL,GTK_SHADOW_NONE, + AddFrame( MSGTR_PREFERENCES_FRAME_Cache,GTK_SHADOW_ETCHED_OUT,vbox601,0 ),1 ),0 ); + + CBCache=AddCheckButton( MSGTR_PREFERENCES_Cache,vbox602 ); + + hbox5=AddHBox( vbox602,1 ); + + AddLabel( MSGTR_PREFERENCES_CacheSize,hbox5 ); + + SBCacheadj=GTK_ADJUSTMENT( gtk_adjustment_new( gtkCacheSize,32,1048576,1,32,0 ) ); + SBCache=gtk_spin_button_new( GTK_ADJUSTMENT( SBCacheadj ),1,0 ); + gtk_widget_show( SBCache ); + gtk_box_pack_start( GTK_BOX( hbox5 ),SBCache,TRUE,TRUE,0 ); + + vbox602=AddVBox( + AddFrame( NULL,GTK_SHADOW_NONE, + AddFrame( MSGTR_PREFERENCES_FRAME_Misc,GTK_SHADOW_ETCHED_OUT,vbox601,1 ),1 ),0 ); + + CBShowVideoWindow=AddCheckButton( MSGTR_PREFERENCES_ShowVideoWindow,vbox602 ); + CBLoadFullscreen=AddCheckButton( MSGTR_PREFERENCES_LoadFullscreen,vbox602 ); + CBSaveWinPos=AddCheckButton( MSGTR_PREFERENCES_SaveWinPos,vbox602 ); + CBStopXScreenSaver=AddCheckButton( MSGTR_PREFERENCES_XSCREENSAVER,vbox602 ); + CBPlayBar=AddCheckButton( MSGTR_PREFERENCES_PlayBar,vbox602 ); + CBNoIdle=AddCheckButton( MSGTR_PREFERENCES_NoIdle,vbox602 ); + + AddHSeparator( vbox602 ); + + CBAutoSync=AddCheckButton( MSGTR_PREFERENCES_AutoSync,vbox602 ); + hbox5=AddHBox( vbox602,1 ); + AddLabel( MSGTR_PREFERENCES_AutoSyncValue,hbox5 ); + SBAutoSyncadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,10000,1,10,10 ) ); + SBAutoSync=gtk_spin_button_new( GTK_ADJUSTMENT( SBAutoSyncadj ),1,0 ); + gtk_widget_show( SBAutoSync ); + gtk_box_pack_start( GTK_BOX( hbox5 ),SBAutoSync,TRUE,TRUE,0 ); + + AddHSeparator( vbox602 ); + + table1=gtk_table_new( 2,2,FALSE ); + gtk_widget_set_name( table1,"table1" ); + gtk_widget_show( table1 ); + gtk_box_pack_start( GTK_BOX( vbox602 ),table1,FALSE,FALSE,0 ); + + label=AddLabel( MSGTR_PREFERENCES_DVDDevice,NULL ); + gtk_table_attach( GTK_TABLE( table1 ),label,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + prEDVDDevice=gtk_entry_new(); + gtk_widget_set_name( prEDVDDevice,"prEDVDDevice" ); + gtk_widget_show( prEDVDDevice ); + gtk_table_attach( GTK_TABLE( table1 ),prEDVDDevice,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + + label=AddLabel( MSGTR_PREFERENCES_CDROMDevice,NULL ); + gtk_table_attach( GTK_TABLE( table1 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + prECDRomDevice=gtk_entry_new(); + gtk_widget_set_name( prECDRomDevice,"prECDRomDevice" ); + gtk_widget_show( prECDRomDevice ); + gtk_table_attach( GTK_TABLE( table1 ),prECDRomDevice,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 ); + +// AddHSeparator( vbox602 ); + + label=AddLabel( MSGTR_PREFERENCES_Misc,NULL ); + gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),5 ),label ); + +// --- + + AddHSeparator( vbox1 ); + + hbuttonbox1=AddHButtonBox( vbox1 ); + gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); + gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); + BOk=AddButton( MSGTR_Ok,hbuttonbox1 ); + BCancel=AddButton( MSGTR_Cancel,hbuttonbox1 ); + + gtk_widget_add_accelerator( BOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( BCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); + + gtk_signal_connect( GTK_OBJECT( Preferences ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&Preferences ); + + gtk_signal_connect( GTK_OBJECT( AConfig ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bAConfig ); + gtk_signal_connect( GTK_OBJECT( BOk ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bOk ); + gtk_signal_connect( GTK_OBJECT( BCancel ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bCancel ); + gtk_signal_connect( GTK_OBJECT( VConfig ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bVconfig ); +#if 0 + gtk_signal_connect( GTK_OBJECT( BLoadSubtitle ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bLSubtitle ); +#endif + gtk_signal_connect( GTK_OBJECT( BLoadFont ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bLFont ); + +#if 0 + gtk_signal_connect( GTK_OBJECT( CBNormalize ),"toggled",GTK_SIGNAL_FUNC( on_CBNormalize_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBSoftwareMixer ),"toggled",GTK_SIGNAL_FUNC( on_CBSoftwareMixer_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBSurround ),"toggled",GTK_SIGNAL_FUNC( on_CBSurround_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBExtraStereo ),"toggled",GTK_SIGNAL_FUNC( on_CBExtraStereo_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBDoubleBuffer ),"toggled",GTK_SIGNAL_FUNC( on_CBDoubleBuffer_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBDR ),"toggled",GTK_SIGNAL_FUNC( on_CBDR_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBFramedrop ),"toggled",GTK_SIGNAL_FUNC( on_CBFramedrop_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBHFramedrop ),"toggled",GTK_SIGNAL_FUNC( on_CBHFramedrop_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBFullScreen ),"toggled",GTK_SIGNAL_FUNC( on_CBFullScreen_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBNonInterlaved ),"toggled",GTK_SIGNAL_FUNC( on_CBNonInterlaved_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBFlip ),"toggled",GTK_SIGNAL_FUNC( on_CBFlip_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBPostprocess ),"toggled",GTK_SIGNAL_FUNC( on_CBPostprocess_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBNoAutoSub ),"toggled",GTK_SIGNAL_FUNC( on_CBNoAutoSub_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBSubUnicode ),"toggled",GTK_SIGNAL_FUNC( on_CNSubUnicode_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBDumpMPSub ),"toggled",GTK_SIGNAL_FUNC( on_CBDumpMPSub_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBDumpSrt ),"toggled",GTK_SIGNAL_FUNC( on_CBDumpSrt_toggled ),NULL ); +#endif +#if 0 + gtk_signal_connect( GTK_OBJECT( RBOSDNone ),"toggled",GTK_SIGNAL_FUNC( on_RBOSDNone_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( RBOSDTandP ),"toggled",GTK_SIGNAL_FUNC( on_RBOSDTandP_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( RBOSDIndicator ),"toggled",GTK_SIGNAL_FUNC( on_RBOSDIndicator_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( RBOSDTPTT ),"toggled",GTK_SIGNAL_FUNC( on_RBOSDIndicator_toggled ),NULL ); + gtk_signal_connect( GTK_OBJECT( CBAudioEqualizer ),"toggled",GTK_SIGNAL_FUNC( on_CBAudioEqualizer_toggled ),NULL ); +#endif +#if 0 + gtk_signal_connect( GTK_OBJECT( HSAudioDelay ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSAudioDelay_motion_notify_event ),NULL ); + gtk_signal_connect( GTK_OBJECT( HSPanscan ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSPanscan_motion_notify_event ),NULL ); + gtk_signal_connect( GTK_OBJECT( label2 ),"motion_notify_event",GTK_SIGNAL_FUNC( on_label2_motion_notify_event ),NULL ); + gtk_signal_connect( GTK_OBJECT( HSSubDelay ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSSubDelay_motion_notify_event ),NULL ); + gtk_signal_connect( GTK_OBJECT( HSSubPosition ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSSubPosition_motion_notify_event ),NULL ); + gtk_signal_connect( GTK_OBJECT( HSSubFPS ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSSubFPS_motion_notify_event ),NULL ); + gtk_signal_connect( GTK_OBJECT( HSFontFactor ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSFontFactor_motion_notify_event ),NULL ); + gtk_signal_connect( GTK_OBJECT( HSPPQuality ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSPPQuality_motion_notify_event ),NULL ); +#endif + + gtk_notebook_set_page( GTK_NOTEBOOK( notebook1 ),2 ); + + gtk_window_add_accel_group( GTK_WINDOW( Preferences ),accel_group ); + + return Preferences; +} + +#ifdef CONFIG_OSS_AUDIO +static GList *appendOSSDevices(GList *l) +{ + // careful! the current implementation allows only string constants! + l = g_list_append(l, (gpointer)"/dev/dsp"); + if (gtkAOOSSDevice && strncmp(gtkAOOSSDevice, "/dev/sound", 10) == 0) { + l = g_list_append(l, (gpointer)"/dev/sound/dsp0"); + l = g_list_append(l, (gpointer)"/dev/sound/dsp1"); + l = g_list_append(l, (gpointer)"/dev/sound/dsp2"); + l = g_list_append(l, (gpointer)"/dev/sound/dsp3"); + } else { + l = g_list_append(l, (gpointer)"/dev/dsp0"); + l = g_list_append(l, (gpointer)"/dev/dsp1"); + l = g_list_append(l, (gpointer)"/dev/dsp2"); + l = g_list_append(l, (gpointer)"/dev/dsp3"); + } +#ifdef CONFIG_DXR3 + l = g_list_append(l, (gpointer)"/dev/em8300_ma"); + l = g_list_append(l, (gpointer)"/dev/em8300_ma-0"); + l = g_list_append(l, (gpointer)"/dev/em8300_ma-1"); + l = g_list_append(l, (gpointer)"/dev/em8300_ma-2"); + l = g_list_append(l, (gpointer)"/dev/em8300_ma-3"); +#endif + return l; +} + +static GList *appendOSSMixers(GList *l) +{ + // careful! the current implementation allows only string constants! + l = g_list_append(l, (gpointer)"/dev/mixer"); + if (gtkAOOSSMixer && strncmp(gtkAOOSSMixer, "/dev/sound", 10) == 0) { + l = g_list_append(l, (gpointer)"/dev/sound/mixer0"); + l = g_list_append(l, (gpointer)"/dev/sound/mixer1"); + l = g_list_append(l, (gpointer)"/dev/sound/mixer2"); + l = g_list_append(l, (gpointer)"/dev/sound/mixer3"); + } else { + l = g_list_append(l, (gpointer)"/dev/mixer0"); + l = g_list_append(l, (gpointer)"/dev/mixer1"); + l = g_list_append(l, (gpointer)"/dev/mixer2"); + l = g_list_append(l, (gpointer)"/dev/mixer3"); + } + return l; +} + +static GList *appendOSSMixerChannels(GList *l) +{ + l = g_list_append(l, (gpointer)"vol"); + l = g_list_append(l, (gpointer)"pcm"); + l = g_list_append(l, (gpointer)"line"); + return l; +} +#endif + +#ifdef CONFIG_ALSA +static GList *appendALSADevices(GList *l) +{ + l = g_list_append(l, (gpointer)"default"); + l = g_list_append(l, (gpointer)"hw=0.0"); + l = g_list_append(l, (gpointer)"hw=0.1"); + l = g_list_append(l, (gpointer)"hw=0.2"); + l = g_list_append(l, (gpointer)"surround40"); + l = g_list_append(l, (gpointer)"surround51"); + l = g_list_append(l, (gpointer)"plug=surround40"); + l = g_list_append(l, (gpointer)"plug=surround51"); + return l; +} + +static GList *appendALSAMixers(GList *l) +{ + l = g_list_append(l, (gpointer)"default"); + return l; +} + +static GList *appendALSAMixerChannels(GList *l) +{ + l = g_list_append(l, (gpointer)"Master"); + l = g_list_append(l, (gpointer)"Line"); + l = g_list_append(l, (gpointer)"PCM"); + l = g_list_append(l, (gpointer)"PCM,1"); + return l; +} +#endif + +#ifdef CONFIG_SDL +static GList *appendSDLDevices(GList *l) +{ + l = g_list_append(l, (gpointer)"alsa"); + l = g_list_append(l, (gpointer)"arts"); + l = g_list_append(l, (gpointer)"esd"); + l = g_list_append(l, (gpointer)"jack"); + l = g_list_append(l, (gpointer)"oss"); + l = g_list_append(l, (gpointer)"nas"); + return l; +} +#endif + +#ifdef CONFIG_ESD +static GList *appendESDDevices(GList *l) +{ + l = g_list_append(l, (gpointer)"Enter Remote IP"); + l = g_list_append(l, (gpointer)"Use Software Mixer"); + return l; +} +#endif + +// Gets text string from a gtk entry, interpreting +// MSGTR_PREFERENCES_DriverDefault as null string. +static const char *getGtkEntryText(GtkWidget *from) +{ + const char *tmp = gtk_entry_get_text(GTK_ENTRY(from)); + if (strcmp(tmp, MSGTR_PREFERENCES_DriverDefault) == 0) { + tmp = NULL; + } + return tmp; +} + +// Sets text string of a gtk entry, interpreting +// null string as MSGTR_PREFERENCES_DriverDefault. +static void setGtkEntryText(GtkWidget *dest, char *to) +{ + if (!to) { + to = MSGTR_PREFERENCES_DriverDefault; + } + gtk_entry_set_text(GTK_ENTRY(dest),to); +} + + GtkWidget *AudioConfig; +static GtkWidget *CEAudioDevice; +static GtkWidget *CBAudioDevice; +static GtkWidget *CEAudioMixer; +static GtkWidget *CBAudioMixer; +static GtkWidget *CEAudioMixerChannel; +static GtkWidget *CBAudioMixerChannel; +static GtkWidget *BAudioOk; +static GtkWidget *BAudioCancel; + +void ShowAudioConfig( void ) { + if (AudioConfig) gtkActive(AudioConfig); + else AudioConfig = create_AudioConfig(); + +#ifdef CONFIG_OSS_AUDIO + if (strncmp(ao_driver[0], "oss", 3) == 0) { + setGtkEntryText(CEAudioDevice, gtkAOOSSDevice); + setGtkEntryText(CEAudioMixer, gtkAOOSSMixer); + setGtkEntryText(CEAudioMixerChannel, gtkAOOSSMixerChannel); + } +#endif +#ifdef CONFIG_ALSA + if (strncmp(ao_driver[0], "alsa", 4) == 0) { + setGtkEntryText(CEAudioDevice, gtkAOALSADevice); + setGtkEntryText(CEAudioMixer, gtkAOALSAMixer); + setGtkEntryText(CEAudioMixerChannel, gtkAOALSAMixerChannel); + } +#endif +#ifdef CONFIG_SDL + if (strncmp(ao_driver[0], "sdl", 3) == 0) { + setGtkEntryText(CEAudioDevice, gtkAOSDLDriver); + } +#endif +#ifdef CONFIG_ESD + if (strncmp(ao_driver[0], "esd", 3) == 0) { + setGtkEntryText(CEAudioDevice, gtkAOESDDevice); + } +#endif + + gtk_widget_show(AudioConfig); + gtkSetLayer(AudioConfig); +} + +void HideAudioConfig( void ) { + if (!AudioConfig) return; + gtk_widget_hide(AudioConfig); + gtk_widget_destroy(AudioConfig); + AudioConfig=NULL; +} + +static void audioButton(GtkButton *button, gpointer user_data) { + switch( (int)user_data ) { + case 1: +#ifdef CONFIG_OSS_AUDIO + if (strncmp(ao_driver[0], "oss", 3) == 0) { + gfree((void **) >kAOOSSDevice); + gtkAOOSSDevice = gstrdup(getGtkEntryText(CEAudioDevice)); + gfree((void **) >kAOOSSMixer); + gtkAOOSSMixer = gstrdup(getGtkEntryText(CEAudioMixer)); + gfree((void **) >kAOOSSMixerChannel); + gtkAOOSSMixerChannel = gstrdup(getGtkEntryText(CEAudioMixerChannel)); + } +#endif +#ifdef CONFIG_ALSA + if (strncmp(ao_driver[0], "alsa", 4) == 0) { + gfree((void **) >kAOALSADevice); + gtkAOALSADevice = gstrdup(getGtkEntryText(CEAudioDevice)); + gfree((void **) >kAOALSAMixer); + gtkAOALSAMixer = gstrdup(getGtkEntryText(CEAudioMixer)); + gfree((void **) >kAOALSAMixerChannel); + gtkAOALSAMixerChannel = gstrdup(getGtkEntryText(CEAudioMixerChannel)); + } +#endif +#ifdef CONFIG_SDL + if (strncmp(ao_driver[0], "sdl", 3) == 0) { + gfree((void **) >kAOSDLDriver); + gtkAOSDLDriver = gstrdup(getGtkEntryText(CEAudioDevice)); + } +#endif +#ifdef CONFIG_ESD + if (strncmp(ao_driver[0], "esd", 3) == 0) { + gfree((void **) >kAOESDDevice); + gtkAOESDDevice = gstrdup(getGtkEntryText(CEAudioDevice)); + } +#endif + case 0: + HideAudioConfig(); + break; + } +} + +GtkWidget *create_AudioConfig( void ) { + GList *items = NULL; + GtkWidget *vbox; + GtkWidget *table; + GtkWidget *label; + GtkWidget *hbuttonbox; + GtkAccelGroup *accel_group; + + AudioConfig = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_widget_set_name(AudioConfig, "AudioConfig"); + gtk_object_set_data(GTK_OBJECT(AudioConfig), "AudioConfig", AudioConfig); + gtk_window_set_title(GTK_WINDOW(AudioConfig), MSGTR_AudioPreferences); + gtk_window_set_position(GTK_WINDOW(AudioConfig), GTK_WIN_POS_CENTER); + gtk_window_set_policy(GTK_WINDOW(AudioConfig), FALSE, FALSE, FALSE); + gtk_window_set_wmclass(GTK_WINDOW(AudioConfig), "Audio Config", "MPlayer"); + + gtk_widget_realize(AudioConfig); + gtkAddIcon(AudioConfig); + + vbox = AddVBox(AddDialogFrame(AudioConfig), 0); + + table = gtk_table_new(2, 3, FALSE); + gtk_widget_set_name(table, "table"); + gtk_widget_show(table); + gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0); + + label = AddLabel(MSGTR_PREFERENCES_Audio_Device, NULL); + gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); + + CBAudioDevice = AddComboBox(NULL); + gtk_table_attach(GTK_TABLE(table), CBAudioDevice, 1, 2, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0); + items = g_list_append(items,(gpointer)MSGTR_PREFERENCES_DriverDefault); +#ifdef CONFIG_OSS_AUDIO + if (strncmp(ao_driver[0], "oss", 3) == 0) + items = appendOSSDevices(items); +#endif +#ifdef CONFIG_ALSA + if (strncmp(ao_driver[0], "alsa", 4) == 0) + items = appendALSADevices(items); +#endif +#ifdef CONFIG_SDL + if (strncmp(ao_driver[0], "sdl", 3) == 0) + items = appendSDLDevices(items); +#endif +#ifdef CONFIG_ESD + if (strncmp(ao_driver[0], "esd", 3) == 0) + items = appendESDDevices(items); +#endif + gtk_combo_set_popdown_strings(GTK_COMBO(CBAudioDevice), items); + g_list_free(items); + items = NULL; + + CEAudioDevice = GTK_COMBO(CBAudioDevice)->entry; + gtk_widget_set_name(CEAudioDevice, "CEAudioDevice"); + gtk_widget_show(CEAudioDevice); + + label = AddLabel(MSGTR_PREFERENCES_Audio_Mixer, NULL); + gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); + + CBAudioMixer = AddComboBox(NULL); + gtk_table_attach(GTK_TABLE(table), CBAudioMixer, 1, 2, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0); + items = g_list_append(items, (gpointer)MSGTR_PREFERENCES_DriverDefault); +#ifdef CONFIG_OSS_AUDIO + if (strncmp(ao_driver[0], "oss", 3) == 0) + items = appendOSSMixers(items); +#endif +#ifdef CONFIG_ALSA + if (strncmp(ao_driver[0], "alsa", 4) == 0) + items = appendALSAMixers(items); +#endif + gtk_combo_set_popdown_strings(GTK_COMBO(CBAudioMixer), items); + g_list_free(items); + items = NULL; + + CEAudioMixer = GTK_COMBO(CBAudioMixer)->entry; + gtk_widget_set_name(CEAudioMixer, "CEAudioMixer"); + gtk_widget_show(CEAudioMixer); + + label = AddLabel(MSGTR_PREFERENCES_Audio_MixerChannel, NULL); + gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0); + + CBAudioMixerChannel = AddComboBox(NULL); + gtk_table_attach(GTK_TABLE(table), CBAudioMixerChannel, 1, 2, 2, 3, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0); + items = g_list_append(items, (gpointer)MSGTR_PREFERENCES_DriverDefault); +#ifdef CONFIG_OSS_AUDIO + if (strncmp(ao_driver[0], "oss", 3) == 0) + items = appendOSSMixerChannels(items); +#endif +#ifdef CONFIG_ALSA + if (strncmp(ao_driver[0], "alsa", 4) == 0) + items = appendALSAMixerChannels(items); +#endif + gtk_combo_set_popdown_strings(GTK_COMBO(CBAudioMixerChannel), items); + g_list_free(items); + items = NULL; + + CEAudioMixerChannel = GTK_COMBO(CBAudioMixerChannel)->entry; + gtk_widget_set_name(CEAudioMixerChannel, "CEAudioMixerChannel"); + gtk_widget_show(CEAudioMixerChannel); + + AddHSeparator(vbox); + + hbuttonbox = AddHButtonBox(vbox); + gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox), GTK_BUTTONBOX_END); + gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbuttonbox), 10); + BAudioOk = AddButton(MSGTR_Ok, hbuttonbox); + BAudioCancel = AddButton(MSGTR_Cancel, hbuttonbox); + + gtk_signal_connect(GTK_OBJECT(AudioConfig), "destroy", GTK_SIGNAL_FUNC(WidgetDestroy), &AudioConfig); + gtk_signal_connect(GTK_OBJECT(BAudioOk), "clicked", GTK_SIGNAL_FUNC(audioButton), (void*)1); + gtk_signal_connect(GTK_OBJECT(BAudioCancel), "clicked", GTK_SIGNAL_FUNC(audioButton), (void*)0); + + accel_group = gtk_accel_group_new(); + gtk_widget_add_accelerator(BAudioOk, "clicked", accel_group, GDK_Return, 0, GTK_ACCEL_VISIBLE); + gtk_widget_add_accelerator(BAudioCancel, "clicked", accel_group, GDK_Escape, 0, GTK_ACCEL_VISIBLE); + gtk_window_add_accel_group(GTK_WINDOW(AudioConfig), accel_group); + + return AudioConfig; +} + +#ifdef CONFIG_DXR3 +// --- dxr3 config box + +static GtkWidget * DXR3Config; +static GtkWidget * CBDevice; +static GtkWidget * CEDXR3Device; +static GtkWidget * RBVNone; +static GtkWidget * RBVLavc; +static GtkWidget * dxr3BOk; +static GtkWidget * dxr3BCancel; + +GtkWidget * create_DXR3Config( void ); + +void ShowDXR3Config( void ) +{ + if ( DXR3Config ) gtkActive( DXR3Config ); + else DXR3Config=create_DXR3Config(); + + gtk_entry_set_text( GTK_ENTRY( CEDXR3Device ),gtkDXR3Device ); + + gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBVNone ),TRUE ); + if ( gtkVfLAVC ) gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBVLavc ),TRUE ); + + gtk_widget_show( DXR3Config ); + gtkSetLayer( DXR3Config ); +} + +void HideDXR3Config( void ) +{ + if ( !DXR3Config ) return; + gtk_widget_hide( DXR3Config ); + gtk_widget_destroy( DXR3Config ); + DXR3Config=NULL; +} + +static void dxr3Button( GtkButton * button,gpointer user_data ) +{ + switch ( (int)user_data ) + { + case 0: // Ok + gfree( (void **)>kDXR3Device ); gtkDXR3Device=strdup( gtk_entry_get_text( GTK_ENTRY( CEDXR3Device ) ) ); + gtkVfLAVC=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBVLavc ) ); + case 1: // Cancel + HideDXR3Config(); + break; + } +} + +GtkWidget * create_DXR3Config( void ) +{ + GtkWidget * vbox1; + GtkWidget * vbox2; + GtkWidget * hbox1; + GList * CBDevice_items = NULL; + GtkWidget * vbox3; + GSList * VEncoder_group = NULL; + GtkWidget * hbuttonbox1; + GtkAccelGroup * accel_group; + + accel_group=gtk_accel_group_new(); + + DXR3Config=gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_name( DXR3Config,"DXR3Config" ); + gtk_object_set_data( GTK_OBJECT( DXR3Config ),"DXR3Config",DXR3Config ); +// gtk_widget_set_usize( DXR3Config,300,156 ); + GTK_WIDGET_SET_FLAGS( DXR3Config,GTK_CAN_DEFAULT ); + gtk_window_set_title( GTK_WINDOW( DXR3Config ),"DXR3/H+" ); + gtk_window_set_position( GTK_WINDOW( DXR3Config ),GTK_WIN_POS_CENTER ); + gtk_window_set_policy( GTK_WINDOW( DXR3Config ),FALSE,FALSE,FALSE ); + gtk_window_set_wmclass( GTK_WINDOW( DXR3Config ),"DXR3","MPlayer" ); + + gtk_widget_realize( DXR3Config ); + gtkAddIcon( DXR3Config ); + + vbox1=AddVBox( AddDialogFrame( DXR3Config ),0 ); + vbox2=AddVBox( vbox1,0 ); + hbox1=AddHBox( vbox2,1 ); + AddLabel( MSGTR_PREFERENCES_Audio_Device,hbox1 ); + + CBDevice=AddComboBox( hbox1 ); + + CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300" ); + CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300-0" ); + CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300-1" ); + CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300-2" ); + CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300-3" ); + gtk_combo_set_popdown_strings( GTK_COMBO( CBDevice ),CBDevice_items ); + g_list_free( CBDevice_items ); + + CEDXR3Device=GTK_COMBO( CBDevice )->entry; + gtk_widget_set_name( CEDXR3Device,"CEDXR3Device" ); + gtk_widget_show( CEDXR3Device ); + gtk_entry_set_text( GTK_ENTRY( CEDXR3Device ),"/dev/em8300" ); + + AddHSeparator( vbox2 ); + vbox3=AddVBox( vbox2,0 ); + AddLabel( MSGTR_PREFERENCES_DXR3_VENC,vbox3 ); + RBVNone=AddRadioButton( MSGTR_PREFERENCES_None,&VEncoder_group,vbox3 ); + RBVLavc=AddRadioButton( MSGTR_PREFERENCES_DXR3_LAVC,&VEncoder_group,vbox3 ); + + AddHSeparator( vbox1 ); + + hbuttonbox1=AddHButtonBox( vbox1 ); + gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); + gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); + dxr3BOk=AddButton( MSGTR_Ok,hbuttonbox1 ); + dxr3BCancel=AddButton( MSGTR_Cancel,hbuttonbox1 ); + + gtk_widget_add_accelerator( dxr3BOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( dxr3BCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); + + gtk_signal_connect( GTK_OBJECT( DXR3Config ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&DXR3Config ); + + gtk_signal_connect( GTK_OBJECT( dxr3BOk ),"clicked",GTK_SIGNAL_FUNC( dxr3Button ),(void *)0 ); + gtk_signal_connect( GTK_OBJECT( dxr3BCancel ),"clicked",GTK_SIGNAL_FUNC( dxr3Button ),(void *)1 ); + + gtk_window_add_accel_group( GTK_WINDOW( DXR3Config ),accel_group ); + + return DXR3Config; +} + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/preferences.h Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,33 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_GUI_PREFERENCES_H +#define MPLAYER_GUI_PREFERENCES_H + +#include <gtk/gtk.h> + +extern GtkWidget * AudioConfig; +extern GtkWidget * Preferences; +extern GtkWidget * prEFontName; + +GtkWidget * create_Preferences( void ); +GtkWidget * create_AudioConfig( void ); + +void ShowPreferences( void ); + +#endif /* MPLAYER_GUI_PREFERENCES_H */
--- a/gui/ui/gtk/sb.c Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <sys/stat.h> -#include <glob.h> -#include <unistd.h> -#include <string.h> -#include <stdlib.h> -#include <stdio.h> - -#include "config.h" -#include "sb.h" -#include "gtk_common.h" - -#include "gui/app.h" -#include "help_mp.h" - -#include "gui/ui/widgets.h" - -GtkWidget * SkinList = NULL; -char * sbSelectedSkin=NULL; -char * sbMPlayerDirInHome=NULL; -char * sbMPlayerPrefixDir=NULL; - -char * gtkOldSkin=NULL; -static char * prev=NULL; - -GtkWidget * SkinBrowser = NULL; - -void ShowSkinBrowser( void ) -{ - if ( SkinBrowser ) gtkActive( SkinBrowser ); - else SkinBrowser=create_SkinBrowser(); -} - -static void HideSkinBrowser( void ) -{ - if ( !SkinBrowser ) return; - gtk_widget_hide( SkinBrowser ); - gtk_widget_destroy( SkinBrowser ); - SkinBrowser=NULL; -} - -int gtkFillSkinList( gchar * mdir ) -{ - gchar * str[2]; - gchar * tmp; - int i; - glob_t gg; - struct stat fs; - - gtkOldSkin=strdup( skinName ); - prev=gtkOldSkin; - - str[0]="default"; - str[1]=""; - if ( gtkFindCList( SkinList,str[0] ) == -1 ) gtk_clist_append( GTK_CLIST( SkinList ),str ); - - glob( mdir,GLOB_NOSORT,NULL,&gg ); - for( i=0;i<(int)gg.gl_pathc;i++ ) - { - if ( !strcmp( gg.gl_pathv[i],"." ) || !strcmp( gg.gl_pathv[i],".." ) ) continue; - stat( gg.gl_pathv[i],&fs ); - if ( S_ISDIR( fs.st_mode ) ) - { - tmp=strrchr( gg.gl_pathv[i],'/' ); tmp++; - if ( !strcmp( tmp,"default" ) ) continue; - str[0]=tmp; - if ( gtkFindCList( SkinList,str[0] ) == -1 ) gtk_clist_append( GTK_CLIST( SkinList ),str ); - } - } - globfree( &gg ); - return 1; -} - -static void prButton( GtkObject * object,gpointer user_data ) -{ - if ( sbSelectedSkin ) - { - switch ( (int)user_data ) - { - case 0: // cancel - if ( strcmp( sbSelectedSkin,gtkOldSkin ) ) uiChangeSkin( gtkOldSkin ); - break; - case 1: // ok - uiChangeSkin( sbSelectedSkin ); // NOTE TO MYSELF: skin already changed! - free( skinName ); - skinName=strdup( sbSelectedSkin ); - break; - } - } - HideSkinBrowser(); -} - -static void on_SkinList_select_row( GtkCList * clist,gint row,gint column,GdkEvent * bevent,gpointer user_data ) -{ - gtk_clist_get_text( clist,row,0,&sbSelectedSkin ); - if ( strcmp( prev,sbSelectedSkin ) ) - { - prev=sbSelectedSkin; - uiChangeSkin( sbSelectedSkin ); - gtkActive( SkinBrowser ); - } - if( !bevent ) return; - if( bevent->type == GDK_2BUTTON_PRESS ) - { - free( skinName ); - skinName=strdup( sbSelectedSkin ); - HideSkinBrowser(); - } -} - -GtkWidget * create_SkinBrowser( void ) -{ - GtkWidget * vbox5; - GtkWidget * scrolledwindow1; - GtkWidget * hbuttonbox4; - GtkWidget * Cancel; - GtkWidget * Ok; - GtkAccelGroup * accel_group; - - accel_group = gtk_accel_group_new (); - - SkinBrowser=gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_widget_set_name( SkinBrowser,MSGTR_SkinBrowser ); - gtk_object_set_data( GTK_OBJECT( SkinBrowser ),MSGTR_SkinBrowser,SkinBrowser ); - gtk_widget_set_usize( SkinBrowser,256,320 ); - gtk_container_set_border_width( GTK_CONTAINER( SkinBrowser ),1 ); - GTK_WIDGET_SET_FLAGS( SkinBrowser,GTK_CAN_DEFAULT ); - gtk_widget_set_events( SkinBrowser,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK ); - gtk_window_set_title( GTK_WINDOW( SkinBrowser ),MSGTR_SkinBrowser ); - gtk_window_set_position( GTK_WINDOW( SkinBrowser ),GTK_WIN_POS_CENTER ); - gtk_window_set_policy( GTK_WINDOW( SkinBrowser ),FALSE,FALSE,TRUE ); - gtk_window_set_wmclass( GTK_WINDOW( SkinBrowser ),"SkinBrowser","MPlayer" ); - - gtk_widget_realize( SkinBrowser ); - gtkAddIcon( SkinBrowser ); - - vbox5=AddVBox( AddDialogFrame( SkinBrowser ),0 ); - AddLabel( MSGTR_SKIN_LABEL,vbox5 ); - AddHSeparator( vbox5 ); - - scrolledwindow1=gtk_scrolled_window_new( NULL,NULL ); - gtk_widget_set_name( scrolledwindow1,"scrolledwindow1" ); - gtk_widget_ref( scrolledwindow1 ); - gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"scrolledwindow1",scrolledwindow1,(GtkDestroyNotify)gtk_widget_unref ); - gtk_widget_show( scrolledwindow1 ); - gtk_box_pack_start( GTK_BOX( vbox5 ),scrolledwindow1,TRUE,TRUE,0 ); - gtk_container_set_border_width( GTK_CONTAINER( scrolledwindow1 ),2 ); - gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC ); - - SkinList=gtk_clist_new( 1 ); - gtk_widget_set_name( SkinList,"SkinList" ); - gtk_widget_ref( SkinList ); - gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"SkinList",SkinList,(GtkDestroyNotify)gtk_widget_unref ); - gtk_widget_show( SkinList ); - gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),SkinList ); - gtk_clist_set_column_width( GTK_CLIST( SkinList ),0,80 ); - gtk_clist_set_selection_mode( GTK_CLIST( SkinList ),GTK_SELECTION_SINGLE ); - gtk_clist_column_titles_hide( GTK_CLIST( SkinList ) ); - gtk_clist_set_shadow_type( GTK_CLIST( SkinList ),GTK_SHADOW_ETCHED_OUT ); - - AddHSeparator( vbox5 ); - - hbuttonbox4=AddHButtonBox( vbox5 ); - gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox4 ),GTK_BUTTONBOX_SPREAD ); - gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox4 ),10 ); - - Ok=AddButton( MSGTR_Ok,hbuttonbox4 ); - Cancel=AddButton( MSGTR_Cancel,hbuttonbox4 ); - - gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); - gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); - - gtk_signal_connect( GTK_OBJECT( SkinBrowser ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&SkinBrowser ); - gtk_signal_connect( GTK_OBJECT( SkinList ),"select_row",GTK_SIGNAL_FUNC( on_SkinList_select_row ),NULL ); - gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)1 ); - gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)0 ); - - if ( ( sbMPlayerDirInHome=calloc( 1,strlen( skinDirInHome ) + 4 ) ) != NULL ) - { strcpy( sbMPlayerDirInHome,skinDirInHome ); strcat( sbMPlayerDirInHome,"/*" ); } - if ( ( sbMPlayerPrefixDir=calloc( 1,strlen( skinMPlayerDir ) + 4 ) ) != NULL ) - { strcpy( sbMPlayerPrefixDir,skinMPlayerDir ); strcat( sbMPlayerPrefixDir,"/*" ); } - - gtk_window_add_accel_group( GTK_WINDOW( SkinBrowser ),accel_group ); - gtk_widget_grab_focus( SkinList ); - - return SkinBrowser; -}
--- a/gui/ui/gtk/sb.h Sun Jun 19 13:58:45 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPLAYER_GUI_SB_H -#define MPLAYER_GUI_SB_H - -#include <gtk/gtk.h> - -extern char * sbSelectedSkin; -extern GtkWidget * SkinBrowser; - -void ShowSkinBrowser( void ); -GtkWidget * create_SkinBrowser( void ); - -#endif /* MPLAYER_GUI_SB_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/skinbrowser.c Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,204 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <sys/stat.h> +#include <glob.h> +#include <unistd.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> + +#include "config.h" +#include "skinbrowser.h" +#include "tools.h" + +#include "gui/app.h" +#include "help_mp.h" + +#include "gui/ui/widgets.h" + +GtkWidget * SkinList = NULL; +char * sbSelectedSkin=NULL; +char * sbMPlayerDirInHome=NULL; +char * sbMPlayerPrefixDir=NULL; + +char * gtkOldSkin=NULL; +static char * prev=NULL; + +GtkWidget * SkinBrowser = NULL; + +void ShowSkinBrowser( void ) +{ + if ( SkinBrowser ) gtkActive( SkinBrowser ); + else SkinBrowser=create_SkinBrowser(); +} + +static void HideSkinBrowser( void ) +{ + if ( !SkinBrowser ) return; + gtk_widget_hide( SkinBrowser ); + gtk_widget_destroy( SkinBrowser ); + SkinBrowser=NULL; +} + +int gtkFillSkinList( gchar * mdir ) +{ + gchar * str[2]; + gchar * tmp; + int i; + glob_t gg; + struct stat fs; + + gtkOldSkin=strdup( skinName ); + prev=gtkOldSkin; + + str[0]="default"; + str[1]=""; + if ( gtkFindCList( SkinList,str[0] ) == -1 ) gtk_clist_append( GTK_CLIST( SkinList ),str ); + + glob( mdir,GLOB_NOSORT,NULL,&gg ); + for( i=0;i<(int)gg.gl_pathc;i++ ) + { + if ( !strcmp( gg.gl_pathv[i],"." ) || !strcmp( gg.gl_pathv[i],".." ) ) continue; + stat( gg.gl_pathv[i],&fs ); + if ( S_ISDIR( fs.st_mode ) ) + { + tmp=strrchr( gg.gl_pathv[i],'/' ); tmp++; + if ( !strcmp( tmp,"default" ) ) continue; + str[0]=tmp; + if ( gtkFindCList( SkinList,str[0] ) == -1 ) gtk_clist_append( GTK_CLIST( SkinList ),str ); + } + } + globfree( &gg ); + return 1; +} + +static void prButton( GtkObject * object,gpointer user_data ) +{ + if ( sbSelectedSkin ) + { + switch ( (int)user_data ) + { + case 0: // cancel + if ( strcmp( sbSelectedSkin,gtkOldSkin ) ) uiChangeSkin( gtkOldSkin ); + break; + case 1: // ok + uiChangeSkin( sbSelectedSkin ); // NOTE TO MYSELF: skin already changed! + free( skinName ); + skinName=strdup( sbSelectedSkin ); + break; + } + } + HideSkinBrowser(); +} + +static void on_SkinList_select_row( GtkCList * clist,gint row,gint column,GdkEvent * bevent,gpointer user_data ) +{ + gtk_clist_get_text( clist,row,0,&sbSelectedSkin ); + if ( strcmp( prev,sbSelectedSkin ) ) + { + prev=sbSelectedSkin; + uiChangeSkin( sbSelectedSkin ); + gtkActive( SkinBrowser ); + } + if( !bevent ) return; + if( bevent->type == GDK_2BUTTON_PRESS ) + { + free( skinName ); + skinName=strdup( sbSelectedSkin ); + HideSkinBrowser(); + } +} + +GtkWidget * create_SkinBrowser( void ) +{ + GtkWidget * vbox5; + GtkWidget * scrolledwindow1; + GtkWidget * hbuttonbox4; + GtkWidget * Cancel; + GtkWidget * Ok; + GtkAccelGroup * accel_group; + + accel_group = gtk_accel_group_new (); + + SkinBrowser=gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_name( SkinBrowser,MSGTR_SkinBrowser ); + gtk_object_set_data( GTK_OBJECT( SkinBrowser ),MSGTR_SkinBrowser,SkinBrowser ); + gtk_widget_set_usize( SkinBrowser,256,320 ); + gtk_container_set_border_width( GTK_CONTAINER( SkinBrowser ),1 ); + GTK_WIDGET_SET_FLAGS( SkinBrowser,GTK_CAN_DEFAULT ); + gtk_widget_set_events( SkinBrowser,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK ); + gtk_window_set_title( GTK_WINDOW( SkinBrowser ),MSGTR_SkinBrowser ); + gtk_window_set_position( GTK_WINDOW( SkinBrowser ),GTK_WIN_POS_CENTER ); + gtk_window_set_policy( GTK_WINDOW( SkinBrowser ),FALSE,FALSE,TRUE ); + gtk_window_set_wmclass( GTK_WINDOW( SkinBrowser ),"SkinBrowser","MPlayer" ); + + gtk_widget_realize( SkinBrowser ); + gtkAddIcon( SkinBrowser ); + + vbox5=AddVBox( AddDialogFrame( SkinBrowser ),0 ); + AddLabel( MSGTR_SKIN_LABEL,vbox5 ); + AddHSeparator( vbox5 ); + + scrolledwindow1=gtk_scrolled_window_new( NULL,NULL ); + gtk_widget_set_name( scrolledwindow1,"scrolledwindow1" ); + gtk_widget_ref( scrolledwindow1 ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"scrolledwindow1",scrolledwindow1,(GtkDestroyNotify)gtk_widget_unref ); + gtk_widget_show( scrolledwindow1 ); + gtk_box_pack_start( GTK_BOX( vbox5 ),scrolledwindow1,TRUE,TRUE,0 ); + gtk_container_set_border_width( GTK_CONTAINER( scrolledwindow1 ),2 ); + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC ); + + SkinList=gtk_clist_new( 1 ); + gtk_widget_set_name( SkinList,"SkinList" ); + gtk_widget_ref( SkinList ); + gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"SkinList",SkinList,(GtkDestroyNotify)gtk_widget_unref ); + gtk_widget_show( SkinList ); + gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),SkinList ); + gtk_clist_set_column_width( GTK_CLIST( SkinList ),0,80 ); + gtk_clist_set_selection_mode( GTK_CLIST( SkinList ),GTK_SELECTION_SINGLE ); + gtk_clist_column_titles_hide( GTK_CLIST( SkinList ) ); + gtk_clist_set_shadow_type( GTK_CLIST( SkinList ),GTK_SHADOW_ETCHED_OUT ); + + AddHSeparator( vbox5 ); + + hbuttonbox4=AddHButtonBox( vbox5 ); + gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox4 ),GTK_BUTTONBOX_SPREAD ); + gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox4 ),10 ); + + Ok=AddButton( MSGTR_Ok,hbuttonbox4 ); + Cancel=AddButton( MSGTR_Cancel,hbuttonbox4 ); + + gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); + + gtk_signal_connect( GTK_OBJECT( SkinBrowser ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&SkinBrowser ); + gtk_signal_connect( GTK_OBJECT( SkinList ),"select_row",GTK_SIGNAL_FUNC( on_SkinList_select_row ),NULL ); + gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)1 ); + gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)0 ); + + if ( ( sbMPlayerDirInHome=calloc( 1,strlen( skinDirInHome ) + 4 ) ) != NULL ) + { strcpy( sbMPlayerDirInHome,skinDirInHome ); strcat( sbMPlayerDirInHome,"/*" ); } + if ( ( sbMPlayerPrefixDir=calloc( 1,strlen( skinMPlayerDir ) + 4 ) ) != NULL ) + { strcpy( sbMPlayerPrefixDir,skinMPlayerDir ); strcat( sbMPlayerPrefixDir,"/*" ); } + + gtk_window_add_accel_group( GTK_WINDOW( SkinBrowser ),accel_group ); + gtk_widget_grab_focus( SkinList ); + + return SkinBrowser; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/skinbrowser.h Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,30 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_GUI_SKINBROWSER_H +#define MPLAYER_GUI_SKINBROWSER_H + +#include <gtk/gtk.h> + +extern char * sbSelectedSkin; +extern GtkWidget * SkinBrowser; + +void ShowSkinBrowser( void ); +GtkWidget * create_SkinBrowser( void ); + +#endif /* MPLAYER_GUI_SKINBROWSER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/tools.c Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,197 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <gdk/gdkkeysyms.h> +#include <gtk/gtk.h> + +#include "tools.h" + +void WidgetDestroy( GtkWidget * widget,GtkWidget ** widget_pointer ) +{ + if ( !widget_pointer ) return; + gtk_widget_hide( *widget_pointer ); + gtk_widget_destroy( *widget_pointer ); + *widget_pointer=NULL; +} + +GtkWidget * AddDialogFrame( GtkWidget * parent ) +{ + GtkWidget * frame; + frame=AddFrame( NULL,GTK_SHADOW_IN,parent,1 ); + gtk_container_set_border_width( GTK_CONTAINER( frame ),1 ); + frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 ); + frame=AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,frame,1 ); + frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 ); + return frame; +} + +GtkWidget * AddFrame( const char * title,int type,GtkWidget * parent,int add ) +{ + GtkWidget * frame = NULL; + 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 ); + return frame; +} + +GtkWidget * AddLabel( const char * title,GtkWidget * parent ) +{ + GtkWidget * label; + label=gtk_label_new( title ); + gtk_widget_set_name( label,"label" ); + gtk_widget_show( label ); + if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 ); + gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 ); + gtk_misc_set_padding( GTK_MISC( label ),4,0 ); + return label; +} + +GtkWidget * AddVBox( GtkWidget * parent,int type ) +{ + GtkWidget * vbox; + vbox=gtk_vbox_new( FALSE,0 ); + gtk_widget_set_name( vbox,"vbox" ); + gtk_widget_show( vbox ); + if ( parent ) + { + if ( type ) gtk_box_pack_start( GTK_BOX( parent ),vbox,FALSE,FALSE,0 ); + else gtk_container_add( GTK_CONTAINER( parent ),vbox ); + } + return vbox; +} + +GtkWidget * AddHBox( GtkWidget * parent,int type ) +{ + GtkWidget * hbox; + hbox=gtk_hbox_new( FALSE,0 ); + gtk_widget_set_name( hbox,"hbox" ); + gtk_widget_show( hbox ); + if ( parent ) + { + if ( type ) gtk_box_pack_start( GTK_BOX( parent ),hbox,FALSE,FALSE,0 ); + else gtk_container_add( GTK_CONTAINER( parent ),hbox ); + } + return hbox; +} + +GtkWidget * AddCheckButton( const char * title, GtkWidget * parent ) +{ + GtkWidget * CB; + CB=gtk_check_button_new_with_label( title ); + gtk_widget_set_name( CB,"CB" ); + gtk_widget_show( CB ); + gtk_box_pack_start( GTK_BOX( parent ),CB,FALSE,FALSE,0 ); + return CB; +} + +GtkWidget * AddRadioButton( const char * title,GSList ** group,GtkWidget * parent ) +{ + GtkWidget * RB; + RB=gtk_radio_button_new_with_label( *group,title ); + *group=gtk_radio_button_group( GTK_RADIO_BUTTON( RB ) ); + gtk_widget_set_name( RB,"RB" ); + gtk_widget_show( RB ); + gtk_box_pack_start( GTK_BOX( parent ),RB,FALSE,FALSE,0 ); + return RB; +} + +GtkWidget * AddSpinButton( const char * title,GtkAdjustment * adj,GtkWidget * parent ) +{ + GtkWidget * SB; + GtkWidget * label; + label=gtk_label_new( title ); + gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 ); + gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 ); + gtk_widget_show( label ); + SB=gtk_spin_button_new( adj,0,0 ); + gtk_widget_set_name( SB,"SB" ); + gtk_box_pack_start( GTK_BOX( parent ),SB,FALSE,FALSE,0 ); + gtk_widget_show( SB ); + return SB; +} + +GtkWidget * AddButton( const char * title,GtkWidget * parent ) +{ + GtkWidget * B; + B=gtk_button_new_with_label( title ); + gtk_widget_set_name( B,"B" ); + gtk_widget_show( B ); + gtk_container_add( GTK_CONTAINER( parent ),B ); + return B; +} + +GtkWidget * AddHSeparator( GtkWidget * parent ) +{ + GtkWidget * hseparator; + hseparator=gtk_hseparator_new(); + gtk_widget_set_name( hseparator,"hseparator1" ); + gtk_widget_show( hseparator ); + gtk_box_pack_start( GTK_BOX( parent ),hseparator,FALSE,FALSE,0 ); + gtk_widget_set_usize( hseparator,-2,6 ); + return hseparator; +} + +GtkWidget * AddHButtonBox( GtkWidget * parent ) +{ + GtkWidget * hbuttonbox; + hbuttonbox=gtk_hbutton_box_new(); + gtk_widget_set_name( hbuttonbox,"hbuttonbox" ); + gtk_widget_show( hbuttonbox ); + gtk_box_pack_start( GTK_BOX( parent ),hbuttonbox,FALSE,FALSE,0 ); + gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox ),85,20 ); + return hbuttonbox; +} + +GtkWidget * AddHScaler( GtkAdjustment * adj,GtkWidget * parent,int digit ) +{ + GtkWidget * HS; + HS=gtk_hscale_new( adj ); + gtk_widget_set_name( HS,"HS" ); + gtk_widget_show( HS ); + if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),HS,TRUE,TRUE,0 ); + gtk_scale_set_value_pos( GTK_SCALE( HS ),GTK_POS_RIGHT ); + gtk_scale_set_digits( GTK_SCALE( HS ),digit ); + return HS; +} + +GtkWidget * AddVScaler( GtkAdjustment * adj,GtkWidget * parent,int digit ) +{ + GtkWidget * VS; + VS=gtk_vscale_new( adj ); + gtk_widget_set_name( VS,"VS" ); + gtk_widget_show( VS ); + if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),VS,TRUE,TRUE,0 ); +// gtk_scale_set_value_pos( GTK_SCALE( VS ),GTK_POS_RIGHT ); + if ( digit == -1 ) gtk_scale_set_draw_value( GTK_SCALE( VS ),FALSE ); + else gtk_scale_set_digits( GTK_SCALE( VS ),digit ); + return VS; +} + +GtkWidget * AddComboBox( GtkWidget * parent ) +{ + GtkWidget * CB; + CB=gtk_combo_new(); + gtk_widget_set_name( CB,"CB" ); + gtk_widget_show( CB ); + if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),CB,TRUE,TRUE,0 ); + return CB; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/tools.h Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,41 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_GUI_TOOLS_H +#define MPLAYER_GUI_TOOLS_H + +#include <gdk/gdkkeysyms.h> +#include <gtk/gtk.h> + +GtkWidget * AddDialogFrame( GtkWidget * parent ); +GtkWidget * AddFrame( const char * title, int type, GtkWidget * parent, int add ); +GtkWidget * AddLabel( const char * title, GtkWidget * parent ); +GtkWidget * AddVBox( GtkWidget * parent, int type ); +GtkWidget * AddHBox( GtkWidget * parent, int type ); +GtkWidget * AddCheckButton( const char * title, GtkWidget * parent ); +GtkWidget * AddRadioButton( const char * title, GSList ** group, GtkWidget * parent ); +GtkWidget * AddSpinButton( const char * title, GtkAdjustment * adj, GtkWidget * parent ); +GtkWidget * AddButton( const char * title, GtkWidget * parent ); +GtkWidget * AddHSeparator( GtkWidget * parent ); +GtkWidget * AddHButtonBox( GtkWidget * parent ); +GtkWidget * AddHScaler( GtkAdjustment * adj, GtkWidget * parent, int digit ); +GtkWidget * AddVScaler( GtkAdjustment * adj, GtkWidget * parent, int digit ); +GtkWidget * AddComboBox( GtkWidget * parent ); +void WidgetDestroy( GtkWidget * widget, GtkWidget ** widget_pointer ); + +#endif /* MPLAYER_GUI_TOOLS_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/url.c Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,170 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <gdk/gdkkeysyms.h> +#include <gtk/gtk.h> + +#include "url.h" +#include "tools.h" +#include "gui/interface.h" +#include "gui/app.h" +#include "gui/ui/gmplayer.h" +#include "gui/ui/widgets.h" +#include "help_mp.h" + +GtkWidget * URL = NULL; + +static GtkWidget * URLCombo; +static GtkWidget * URLEntry; +static GList * URLComboEntrys = NULL; + +void ShowURLDialogBox( void ) +{ + if ( URL ) gtkActive( URL ); + else URL=create_URL(); + + if ( URLList ) + { + urlItem * item = URLList; + g_list_free( URLComboEntrys ); + URLComboEntrys=NULL; + while( item ) + { + URLComboEntrys=g_list_append( URLComboEntrys,(gchar *)item->url ); + item=item->next; + } + } + + if ( URLComboEntrys ) + { + gtk_entry_set_text( GTK_ENTRY( URLEntry ),URLComboEntrys->data ); + gtk_combo_set_popdown_strings( GTK_COMBO( URLCombo ),URLComboEntrys ); + } + + gtk_widget_show( URL ); +} + +static void HideURLDialogBox( void ) +{ + if ( !URL ) return; + gtk_widget_hide( URL ); + gtk_widget_destroy( URL ); + URL=0; +} + +static void on_Button_pressed( GtkButton * button,gpointer user_data ) +{ + urlItem * item; + + if ( (int)user_data ) + { + gchar * str= strdup( gtk_entry_get_text( GTK_ENTRY( URLEntry ) ) ); + + if ( str ) + { + if ( strncmp( str,"http://",7 ) + && strncmp( str,"ftp://",6 ) + && strncmp( str,"mms://",6 ) + && strncmp( str,"pnm://",6 ) + && strncmp( str,"rtsp://",7 ) ) + { + gchar * tmp; + tmp=malloc( strlen( str ) + 8 ); + sprintf( tmp,"http://%s",str ); + free( str ); str=tmp; + } + URLComboEntrys=g_list_prepend( URLComboEntrys,(gchar *)str ); + + item=calloc( 1,sizeof( urlItem ) ); + item->url=gstrdup( str ); + gtkSet( gtkAddURLItem,0,(void *)item ); + + guiSetFilename( guiInfo.Filename,str ); guiInfo.FilenameChanged=1; + uiEventHandling( evPlayNetwork,0 ); + } + } + HideURLDialogBox(); +} + +GtkWidget * create_URL( void ) +{ + GtkWidget * vbox1; + GtkWidget * hbox1; + GtkWidget * hbuttonbox1; + GtkWidget * Ok; + GtkWidget * Cancel; + GtkAccelGroup * accel_group; + + accel_group=gtk_accel_group_new(); + + URL=gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_set_name( URL,"URL" ); + gtk_object_set_data( GTK_OBJECT( URL ),"URL",URL ); + gtk_widget_set_usize( URL,384,70 ); + GTK_WIDGET_SET_FLAGS( URL,GTK_CAN_DEFAULT ); + gtk_window_set_title( GTK_WINDOW( URL ),MSGTR_Network ); + gtk_window_set_position( GTK_WINDOW( URL ),GTK_WIN_POS_CENTER ); + gtk_window_set_policy( GTK_WINDOW( URL ),TRUE,TRUE,FALSE ); + gtk_window_set_wmclass( GTK_WINDOW( URL ),"Network","MPlayer" ); + + gtk_widget_realize( URL ); + gtkAddIcon( URL ); + + vbox1=AddVBox( AddDialogFrame( URL ),0 ); + hbox1=AddHBox( vbox1,1 ); + AddLabel( "URL: ",hbox1 ); + + URLCombo=AddComboBox( hbox1 ); +/* + gtk_combo_new(); + gtk_widget_set_name( URLCombo,"URLCombo" ); + gtk_widget_show( URLCombo ); + gtk_box_pack_start( GTK_BOX( hbox1 ),URLCombo,TRUE,TRUE,0 ); +*/ + URLEntry=GTK_COMBO( URLCombo )->entry; + gtk_widget_set_name( URLEntry,"URLEntry" ); + gtk_widget_show( URLEntry ); + + AddHSeparator( vbox1 ); + + hbuttonbox1=AddHButtonBox( vbox1 ); + gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END ); + gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 ); + + Ok=AddButton( MSGTR_Ok,hbuttonbox1 ); + Cancel=AddButton( MSGTR_Cancel,hbuttonbox1 ); + + gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); + gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); + + gtk_signal_connect( GTK_OBJECT( URL ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&URL ); + gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Button_pressed ),(void *)1 ); + gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( on_Button_pressed ),NULL ); + + gtk_widget_grab_focus( URLEntry ); + gtk_window_add_accel_group( GTK_WINDOW( URL ),accel_group ); + + return URL; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/ui/gtk/url.h Sun Jun 19 15:34:08 2011 +0000 @@ -0,0 +1,30 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_GUI_URL_H +#define MPLAYER_GUI_URL_H + +#include <gtk/gtk.h> + +extern GtkWidget * URL; +extern int gtkVURLDialogBox; + +void ShowURLDialogBox( void ); +GtkWidget * create_URL( void ); + +#endif /* MPLAYER_GUI_URL_H */
--- a/gui/ui/widgets.c Sun Jun 19 13:58:45 2011 +0000 +++ b/gui/ui/widgets.c Sun Jun 19 15:34:08 2011 +0000 @@ -44,7 +44,7 @@ #include "gui/wm/ws.h" #include "actions.h" -#include "gtk/fs.h" +#include "gtk/fileselect.h" GtkWidget *PopUpMenu = NULL; @@ -55,15 +55,14 @@ int gtkPopupMenuParam = 0; int gtkInitialized = 0; -#include "gtk/sb.h" -#include "gtk/pl.h" -#include "gtk/fs.h" -#include "gtk/mb.h" +#include "gtk/skinbrowser.h" +#include "gtk/playlist.h" +#include "gtk/msgbox.h" #include "gtk/about.h" -#include "gtk/opts.h" -#include "gtk/gtk_menu.h" -#include "gtk/gtk_url.h" -#include "gtk/eq.h" +#include "gtk/preferences.h" +#include "gtk/menu.h" +#include "gtk/url.h" +#include "gtk/equalizer.h" #include "pixmaps/mplayer.xpm"