add and extended Gregory Kovriga's <gkovriga@techunix.technion.ac.il> patch

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7822 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
pontscho 2002-10-21 11:11:39 +00:00
parent 0ace4805b1
commit e06bb680b4
3 changed files with 56 additions and 12 deletions

View File

@ -5,11 +5,13 @@
#include "../../../config.h" #include "../../../config.h"
#include "../../../help_mp.h" #include "../../../help_mp.h"
#include "../../../mplayer.h"
#include "../../events.h" #include "../../events.h"
#include "menu.h" #include "menu.h"
#include "../widgets.h" #include "../widgets.h"
#include "../app.h"
void ActivateMenuItem( int Item ) void ActivateMenuItem( int Item )
{ {
@ -19,6 +21,19 @@ void ActivateMenuItem( int Item )
mplEventHandling( Item & 0x0000ffff,Item >> 16 ); mplEventHandling( Item & 0x0000ffff,Item >> 16 );
} }
GtkWidget * AddMenuCheckItem(GtkWidget* Menu,char* label, gboolean state, int Number)
{
GtkWidget * Item = NULL;
Item=gtk_check_menu_item_new_with_label( label );
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_widget_show( Item );
return Item;
}
GtkWidget * AddMenuItem( GtkWidget * Menu,char * label,int Number ) GtkWidget * AddMenuItem( GtkWidget * Menu,char * label,int Number )
{ {
GtkWidget * Item = NULL; GtkWidget * Item = NULL;
@ -328,10 +343,12 @@ GtkWidget * create_PopUpMenu( void )
if ( guiIntfStruct.DVD.titles ) if ( guiIntfStruct.DVD.titles )
{ {
char tmp[32]; int i; char tmp[32]; int i;
for ( i=0;i < guiIntfStruct.DVD.titles;i++ ) for ( i=1 ; i<= guiIntfStruct.DVD.titles;i++ )
{ {
snprintf( tmp,32,MSGTR_MENU_Title,i+1 ); snprintf( tmp,32,MSGTR_MENU_Title,i);
AddMenuItem( DVDTitleMenu,tmp,( (i+1) << 16 ) + evSetDVDTitle ); AddMenuCheckItem( DVDTitleMenu,tmp,
guiIntfStruct.DVD.current_title == i,
(i << 16) + evSetDVDTitle );
} }
} }
else else
@ -343,10 +360,11 @@ GtkWidget * create_PopUpMenu( void )
if ( guiIntfStruct.DVD.chapters ) if ( guiIntfStruct.DVD.chapters )
{ {
char tmp[32]; int i; char tmp[32]; int i;
for ( i=0;i < guiIntfStruct.DVD.chapters;i++ ) for ( i=1;i <= guiIntfStruct.DVD.chapters;i++ )
{ {
snprintf( tmp,32,MSGTR_MENU_Chapter,i+1 ); snprintf( tmp,32,MSGTR_MENU_Chapter,i );
AddMenuItem( DVDChapterMenu,tmp,( (i+1) << 16 ) + evSetDVDChapter ); AddMenuCheckItem( DVDChapterMenu,tmp,guiIntfStruct.DVD.current_chapter == i,
( i << 16 ) + evSetDVDChapter );
} }
} }
else else
@ -363,7 +381,9 @@ GtkWidget * create_PopUpMenu( void )
snprintf( tmp,64,"%s - %s %s",GetLanguage( guiIntfStruct.DVD.audio_streams[i].language ), snprintf( tmp,64,"%s - %s %s",GetLanguage( guiIntfStruct.DVD.audio_streams[i].language ),
ChannelTypes[ guiIntfStruct.DVD.audio_streams[i].type ], ChannelTypes[ guiIntfStruct.DVD.audio_streams[i].type ],
ChannelNumbers[ guiIntfStruct.DVD.audio_streams[i].channels ] ); ChannelNumbers[ guiIntfStruct.DVD.audio_streams[i].channels ] );
AddMenuItem( DVDAudioLanguageMenu,tmp,( guiIntfStruct.DVD.audio_streams[i].id << 16 ) + evSetDVDAudio ); AddMenuCheckItem( DVDAudioLanguageMenu,tmp,
audio_id == guiIntfStruct.DVD.audio_streams[i].id,
( guiIntfStruct.DVD.audio_streams[i].id << 16 ) + evSetDVDAudio );
} }
} }
else else
@ -375,11 +395,13 @@ GtkWidget * create_PopUpMenu( void )
if ( guiIntfStruct.DVD.nr_of_subtitles ) if ( guiIntfStruct.DVD.nr_of_subtitles )
{ {
char tmp[64]; int i; char tmp[64]; int i;
AddMenuItem( DVDSubtitleLanguageMenu,"None",( (unsigned short)-1 << 16 ) + evSetDVDSubtitle ); AddMenuItem( DVDSubtitleLanguageMenu,MSGTR_MENU_None,( (unsigned short)-1 << 16 ) + evSetDVDSubtitle );
for ( i=0;i < guiIntfStruct.DVD.nr_of_subtitles;i++ ) for ( i=0;i < guiIntfStruct.DVD.nr_of_subtitles;i++ )
{ {
snprintf( tmp,64,"%s",GetLanguage( guiIntfStruct.DVD.subtitles[i].language ) ); snprintf( tmp,64,"%s",GetLanguage( guiIntfStruct.DVD.subtitles[i].language ) );
AddMenuItem( DVDSubtitleLanguageMenu,tmp,( guiIntfStruct.DVD.subtitles[i].id << 16 ) + evSetDVDSubtitle ); AddMenuCheckItem( DVDSubtitleLanguageMenu,tmp,
dvdsub_id == guiIntfStruct.DVD.subtitles[i].id,
( guiIntfStruct.DVD.subtitles[i].id << 16 ) + evSetDVDSubtitle );
} }
} }
else else
@ -388,22 +410,37 @@ GtkWidget * create_PopUpMenu( void )
gtk_widget_set_sensitive( MenuItem,FALSE ); gtk_widget_set_sensitive( MenuItem,FALSE );
} }
#endif #endif
AspectMenu=AddSubMenu( Menu,"Aspect ratio" ); AspectMenu=AddSubMenu( Menu,MSGTR_MENU_AspectRatio );
AddMenuItem( AspectMenu,"Original",( 1 << 16 ) + evSetAspect ); AddMenuItem( AspectMenu,MSGTR_MENU_Original,( 1 << 16 ) + evSetAspect );
AddMenuItem( AspectMenu,"16:9",( 2 << 16 ) + evSetAspect ); AddMenuItem( AspectMenu,"16:9",( 2 << 16 ) + evSetAspect );
AddMenuItem( AspectMenu,"4:3",( 3 << 16 ) + evSetAspect ); AddMenuItem( AspectMenu,"4:3",( 3 << 16 ) + evSetAspect );
AddMenuItem( AspectMenu,"2.35",( 4 << 16 ) + evSetAspect ); AddMenuItem( AspectMenu,"2.35",( 4 << 16 ) + evSetAspect );
AddSeparator( Menu ); AddSeparator( Menu );
AddMenuItem( Menu,"Mute", evMute ); AddMenuItem( Menu,MSGTR_MENU_Mute, evMute );
AddMenuItem( Menu,MSGTR_MENU_PlayList, evPlayList ); AddMenuItem( Menu,MSGTR_MENU_PlayList, evPlayList );
AddMenuItem( Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser ); AddMenuItem( Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser );
AddMenuItem( Menu,MSGTR_MENU_Preferences, evPreferences ); AddMenuItem( Menu,MSGTR_MENU_Preferences, evPreferences );
AddMenuItem( Menu,MSGTR_Equalizer, evEqualizer ); AddMenuItem( Menu,MSGTR_Equalizer, evEqualizer );
AddSeparator( Menu ); AddSeparator( Menu );
#if 0
AddMenuItem( Menu,MSGTR_MENU_NormalSize" ", evNormalSize ); AddMenuItem( Menu,MSGTR_MENU_NormalSize" ", evNormalSize );
AddMenuItem( Menu,MSGTR_MENU_DoubleSize, evDoubleSize ); AddMenuItem( Menu,MSGTR_MENU_DoubleSize, evDoubleSize );
AddMenuItem( Menu,MSGTR_MENU_FullScreen, evFullScreen ); AddMenuItem( Menu,MSGTR_MENU_FullScreen, evFullScreen );
#else
{
int b1 = 0, b2 = 0;
if ( !appMPlayer.subWindow.isFullScreen && guiIntfStruct.Playing )
{
if ( ( appMPlayer.subWindow.Width == guiIntfStruct.MovieWidth * 2 )&&
( appMPlayer.subWindow.Height == guiIntfStruct.MovieHeight * 2 ) ) b2=1;
else b1=1;
} else b1=!appMPlayer.subWindow.isFullScreen;
AddMenuCheckItem( Menu,MSGTR_MENU_NormalSize" ",b1,evNormalSize );
AddMenuCheckItem( Menu,MSGTR_MENU_DoubleSize,b2,evDoubleSize );
}
AddMenuCheckItem( Menu,MSGTR_MENU_FullScreen,appMPlayer.subWindow.isFullScreen,evFullScreen );
#endif
AddSeparator( Menu ); AddSeparator( Menu );
AddMenuItem( Menu,MSGTR_MENU_Exit, evExit ); AddMenuItem( Menu,MSGTR_MENU_Exit, evExit );

View File

@ -382,6 +382,9 @@ static char help_text[]=
#define MSGTR_MENU_SkinBrowser "Skin browser" #define MSGTR_MENU_SkinBrowser "Skin browser"
#define MSGTR_MENU_Preferences "Preferences" #define MSGTR_MENU_Preferences "Preferences"
#define MSGTR_MENU_Exit "Exit ..." #define MSGTR_MENU_Exit "Exit ..."
#define MSGTR_MENU_Mute "Mute"
#define MSGTR_MENU_Original "Original"
#define MSGTR_MENU_AspectRatio "Aspect ratio"
// --- equalizer // --- equalizer
#define MSGTR_EQU_Audio "Audio" #define MSGTR_EQU_Audio "Audio"

View File

@ -47,6 +47,10 @@ extern int frame_dropping;
extern int auto_quality; extern int auto_quality;
extern int audio_id;
extern int video_id;
extern int dvdsub_id;
extern void exit_player(char* how); extern void exit_player(char* how);
#endif #endif