From ba0c772b64c14dac6114d1a834458bb2bc437f23 Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Mon, 20 Jan 2003 20:07:07 +0000 Subject: [PATCH] * all: begin to up to date the gtk/gnome interface. All comments are welcome, and please reports bugs :) --- modules/gui/gtk/common.h | 9 +- modules/gui/gtk/display.c | 7 +- modules/gui/gtk/gnome.c | 49 +++- modules/gui/gtk/gnome.glade | 164 +++++++++++ modules/gui/gtk/gnome_interface.c | 266 ++++++++++++++++-- modules/gui/gtk/gtk.c | 49 +++- modules/gui/gtk/gtk.glade | 164 +++++++++++ modules/gui/gtk/gtk_callbacks.c | 96 ++++++- modules/gui/gtk/gtk_callbacks.h | 23 +- modules/gui/gtk/gtk_interface.c | 192 ++++++++++++- modules/gui/gtk/gtk_support.h | 2 +- modules/gui/gtk/menu.c | 443 +++++++++++++++++++++++++++++- 12 files changed, 1424 insertions(+), 40 deletions(-) diff --git a/modules/gui/gtk/common.h b/modules/gui/gtk/common.h index 9c95f472d9..58861f4eef 100644 --- a/modules/gui/gtk/common.h +++ b/modules/gui/gtk/common.h @@ -2,7 +2,7 @@ * gtk_common.h: private Gtk+ interface description ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: common.h,v 1.5 2003/01/03 14:44:46 sam Exp $ + * $Id: common.h,v 1.6 2003/01/20 20:07:06 fenrir Exp $ * * Authors: Samuel Hocevar * @@ -44,8 +44,12 @@ struct intf_sys_t vlc_bool_t b_window_changed; /* window display toggled ? */ vlc_bool_t b_playlist_changed; /* playlist display toggled ? */ vlc_bool_t b_slider_free; /* slider status */ + vlc_bool_t b_deinterlace_update; /* menus handlers */ + vlc_bool_t b_aout_update; + vlc_bool_t b_vout_update; + vlc_bool_t b_program_update; /* do we need to update programs menu */ vlc_bool_t b_title_update; /* do we need to update title menus */ @@ -85,6 +89,9 @@ struct intf_sys_t GtkLabel * p_label_title; GtkLabel * p_label_chapter; guint i_part; /* current chapter */ + + /* audio part */ + vlc_bool_t b_mute; }; /***************************************************************************** diff --git a/modules/gui/gtk/display.c b/modules/gui/gtk/display.c index aea0438b90..eb33d7663d 100644 --- a/modules/gui/gtk/display.c +++ b/modules/gui/gtk/display.c @@ -2,7 +2,7 @@ * display.c: Gtk+ tools for main interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: display.c,v 1.6 2002/12/18 14:17:11 sam Exp $ + * $Id: display.c,v 1.7 2003/01/20 20:07:06 fenrir Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -177,7 +177,10 @@ gint E_(GtkModeManage)( intf_thread_t * p_intf ) p_intf->p_sys->b_audio_update = 1; p_intf->p_sys->b_spu_update = 1; p_intf->p_sys->i_part = 0; - +#if 0 + p_intf->p_sys->b_aout_update = 1; + p_intf->p_sys->b_vout_update = 1; +#endif p_intf->p_sys->p_input->stream.b_changed = 0; msg_Dbg( p_intf, "stream has changed, refreshing interface" ); } diff --git a/modules/gui/gtk/gnome.c b/modules/gui/gtk/gnome.c index 2c8cd51ad8..73e572f80e 100644 --- a/modules/gui/gtk/gnome.c +++ b/modules/gui/gtk/gnome.c @@ -2,7 +2,7 @@ * gnome.c : Gnome plugin for vlc ***************************************************************************** * Copyright (C) 2000 VideoLAN - * $Id: gnome.c,v 1.5 2003/01/03 14:44:46 sam Exp $ + * $Id: gnome.c,v 1.6 2003/01/20 20:07:06 fenrir Exp $ * * Authors: Samuel Hocevar * @@ -111,6 +111,11 @@ static int Open( vlc_object_t *p_this ) /* Initialize Gnome thread */ p_intf->p_sys->b_playing = 0; + p_intf->p_sys->b_deinterlace_update = 0; + + p_intf->p_sys->b_aout_update = 0; + p_intf->p_sys->b_vout_update = 0; + p_intf->p_sys->b_popup_changed = 0; p_intf->p_sys->b_window_changed = 0; p_intf->p_sys->b_playlist_changed = 0; @@ -120,6 +125,7 @@ static int Open( vlc_object_t *p_this ) p_intf->p_sys->b_slider_free = 1; p_intf->p_sys->i_part = 0; + p_intf->p_sys->b_mute = 0; return VLC_SUCCESS; } @@ -367,6 +373,9 @@ static void Manage( intf_thread_t *p_intf ) if( p_intf->p_sys->p_input ) { input_thread_t *p_input = p_intf->p_sys->p_input; + aout_instance_t *p_aout = NULL; + vout_thread_t *p_vout = NULL; + vlc_bool_t b_need_menus = VLC_FALSE; vlc_mutex_lock( &p_input->stream.stream_lock ); @@ -421,6 +430,44 @@ static void Manage( intf_thread_t *p_intf ) p_input->stream.p_selected_area->i_part ) { p_intf->p_sys->b_chapter_update = 1; + b_need_menus = VLC_TRUE; + } + + /* Does the audio output require to update the menus ? */ + p_aout = (aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT, + FIND_ANYWHERE ); + if( p_aout != NULL ) + { + vlc_value_t val; + if( var_Get( (vlc_object_t *)p_aout, "intf-change", &val ) >= 0 + && val.b_bool ) + { + p_intf->p_sys->b_aout_update = 1; + b_need_menus = 1; + } + + vlc_object_release( (vlc_object_t *)p_aout ); + } + + + /* Does the video output require to update the menus ? */ + p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, + FIND_ANYWHERE ); + if( p_vout != NULL ) + { + vlc_value_t val; + if( var_Get( (vlc_object_t *)p_vout, "intf-change", &val ) >= 0 + && val.b_bool ) + { + p_intf->p_sys->b_vout_update = 1; + b_need_menus = 1; + } + + vlc_object_release( (vlc_object_t *)p_vout ); + } + + if( b_need_menus ) + { GtkSetupMenus( p_intf ); } } diff --git a/modules/gui/gtk/gnome.glade b/modules/gui/gtk/gnome.glade index 6637106c8f..2194d4255c 100644 --- a/modules/gui/gtk/gnome.glade +++ b/modules/gui/gtk/gnome.glade @@ -338,6 +338,100 @@ + + GtkMenuItem + menubar_config_audio + + False + + + GtkMenu + menubar_config_audio_menu + + + GtkMenuItem + menubar_volume_up + + activate + GtkVolumeUp + Mon, 20 Jan 2003 16:30:55 GMT + + + False + + + + GtkMenuItem + menubar_volume_down + + activate + GtkVolumeDown + Mon, 20 Jan 2003 16:30:55 GMT + + + False + + + + GtkMenuItem + menubar_volume_mute + + activate + GtkVolumeMute + Mon, 20 Jan 2003 16:30:55 GMT + + + False + + + + GtkMenuItem + separator16 + False + + + + GtkMenuItem + menubar_audio_channels + + False + + + + GtkMenuItem + menubar_audio_device + + False + + + + + + GtkMenuItem + menubar_config_video_menu + + False + + + GtkMenu + menubar_config_video_menu_menu + + + GtkMenuItem + menubar_video_device + + False + + + + GtkMenuItem + menubar_deinterlace + + False + + + + GtkMenuItem menubar_help @@ -1113,12 +1207,82 @@ False + + GtkMenuItem + popup_video_device + + False + + + + GtkMenuItem + popup_deinterlace + + False + + GtkMenuItem separator8 False + + GtkMenuItem + popup_volume_up + + activate + GtkVolumeUp + Mon, 20 Jan 2003 16:33:43 GMT + + + False + + + + GtkMenuItem + popup_volume_down + + activate + GtkVolumeDown + Mon, 20 Jan 2003 16:33:43 GMT + + + False + + + + GtkMenuItem + popup_volume_mute + + activate + GtkVolumeMute + Mon, 20 Jan 2003 16:33:43 GMT + + + False + + + + GtkMenuItem + popup_audio_channels + + False + + + + GtkMenuItem + popup_audio_device + + False + + + + GtkMenuItem + separator17 + False + + GtkMenuItem popup_next diff --git a/modules/gui/gtk/gnome_interface.c b/modules/gui/gtk/gnome_interface.c index e7a7a37af4..0e63ca3075 100644 --- a/modules/gui/gtk/gnome_interface.c +++ b/modules/gui/gtk/gnome_interface.c @@ -1,4 +1,4 @@ -/* This file was created automatically by glade and fixed by bootstrap.sh */ +/* This file was created automatically by glade and fixed by bootstrap */ #include @@ -134,6 +134,66 @@ static GnomeUIInfo menubar_settings_menu_uiinfo[] = GNOMEUIINFO_END }; +static GnomeUIInfo menubar_config_audio_menu_uiinfo[] = +{ + { + GNOME_APP_UI_ITEM, N_("Volume Up"), + NULL, + (gpointer) GtkVolumeUp, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, + { + GNOME_APP_UI_ITEM, N_("Volume Down"), + NULL, + (gpointer) GtkVolumeDown, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, + { + GNOME_APP_UI_ITEM, N_("Mute"), + NULL, + (gpointer) GtkVolumeMute, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, + GNOMEUIINFO_SEPARATOR, + { + GNOME_APP_UI_ITEM, N_("Channels"), + NULL, + (gpointer) NULL, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, + { + GNOME_APP_UI_ITEM, N_("Device"), + NULL, + (gpointer) NULL, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, + GNOMEUIINFO_END +}; + +static GnomeUIInfo menubar_config_video_menu_menu_uiinfo[] = +{ + { + GNOME_APP_UI_ITEM, N_("Screen"), + NULL, + (gpointer) NULL, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, + { + GNOME_APP_UI_ITEM, N_("Deinterlace"), + NULL, + (gpointer) NULL, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, + GNOMEUIINFO_END +}; + static GnomeUIInfo menubar_help_menu_uiinfo[] = { GNOMEUIINFO_MENU_ABOUT_ITEM (GtkAboutShow, NULL), @@ -145,6 +205,20 @@ static GnomeUIInfo menubar_uiinfo[] = GNOMEUIINFO_MENU_FILE_TREE (menubar_file_menu_uiinfo), GNOMEUIINFO_MENU_VIEW_TREE (menubar_view_menu_uiinfo), GNOMEUIINFO_MENU_SETTINGS_TREE (menubar_settings_menu_uiinfo), + { + GNOME_APP_UI_SUBTREE, N_("_Audio"), + NULL, + menubar_config_audio_menu_uiinfo, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, + { + GNOME_APP_UI_SUBTREE, N_("_Video"), + NULL, + menubar_config_video_menu_menu_uiinfo, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, GNOMEUIINFO_MENU_HELP_TREE (menubar_help_menu_uiinfo), GNOMEUIINFO_END }; @@ -344,10 +418,60 @@ create_intf_window (void) (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (menubar_uiinfo[3].widget); - gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_help", + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_config_audio", menubar_uiinfo[3].widget, (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_ref (menubar_config_audio_menu_uiinfo[0].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_volume_up", + menubar_config_audio_menu_uiinfo[0].widget, + (GtkDestroyNotify) gtk_widget_unref); + + gtk_widget_ref (menubar_config_audio_menu_uiinfo[1].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_volume_down", + menubar_config_audio_menu_uiinfo[1].widget, + (GtkDestroyNotify) gtk_widget_unref); + + gtk_widget_ref (menubar_config_audio_menu_uiinfo[2].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_volume_mute", + menubar_config_audio_menu_uiinfo[2].widget, + (GtkDestroyNotify) gtk_widget_unref); + + gtk_widget_ref (menubar_config_audio_menu_uiinfo[3].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator16", + menubar_config_audio_menu_uiinfo[3].widget, + (GtkDestroyNotify) gtk_widget_unref); + + gtk_widget_ref (menubar_config_audio_menu_uiinfo[4].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_audio_channels", + menubar_config_audio_menu_uiinfo[4].widget, + (GtkDestroyNotify) gtk_widget_unref); + + gtk_widget_ref (menubar_config_audio_menu_uiinfo[5].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_audio_device", + menubar_config_audio_menu_uiinfo[5].widget, + (GtkDestroyNotify) gtk_widget_unref); + + gtk_widget_ref (menubar_uiinfo[4].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_config_video_menu", + menubar_uiinfo[4].widget, + (GtkDestroyNotify) gtk_widget_unref); + + gtk_widget_ref (menubar_config_video_menu_menu_uiinfo[0].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_video_device", + menubar_config_video_menu_menu_uiinfo[0].widget, + (GtkDestroyNotify) gtk_widget_unref); + + gtk_widget_ref (menubar_config_video_menu_menu_uiinfo[1].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_deinterlace", + menubar_config_video_menu_menu_uiinfo[1].widget, + (GtkDestroyNotify) gtk_widget_unref); + + gtk_widget_ref (menubar_uiinfo[5].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_help", + menubar_uiinfo[5].widget, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_ref (menubar_help_menu_uiinfo[0].widget); gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_about", menubar_help_menu_uiinfo[0].widget, @@ -619,7 +743,6 @@ create_intf_window (void) gtk_widget_show (button_title_prev); gtk_box_pack_start (GTK_BOX (title_chapter_box), button_title_prev, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, button_title_prev, _("Select previous title"), NULL); - gtk_button_set_relief (GTK_BUTTON (button_title_prev), GTK_RELIEF_NONE); button_title_next = gnome_stock_button (GNOME_STOCK_BUTTON_NEXT); gtk_widget_ref (button_title_next); @@ -627,7 +750,6 @@ create_intf_window (void) (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (button_title_next); gtk_box_pack_start (GTK_BOX (title_chapter_box), button_title_next, FALSE, FALSE, 0); - gtk_button_set_relief (GTK_BUTTON (button_title_next), GTK_RELIEF_NONE); vseparator1 = gtk_vseparator_new (); gtk_widget_ref (vseparator1); @@ -664,7 +786,6 @@ create_intf_window (void) gtk_widget_show (button_chapter_prev); gtk_box_pack_start (GTK_BOX (dvd_chapter_box), button_chapter_prev, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, button_chapter_prev, _("Select previous chapter"), NULL); - gtk_button_set_relief (GTK_BUTTON (button_chapter_prev), GTK_RELIEF_NONE); button_chapter_next = gnome_stock_button (GNOME_STOCK_BUTTON_UP); gtk_widget_ref (button_chapter_next); @@ -673,7 +794,6 @@ create_intf_window (void) gtk_widget_show (button_chapter_next); gtk_box_pack_start (GTK_BOX (dvd_chapter_box), button_chapter_next, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, button_chapter_next, _("Select next chapter"), NULL); - gtk_button_set_relief (GTK_BUTTON (button_chapter_next), GTK_RELIEF_NONE); network_box = gtk_hbox_new (TRUE, 0); gtk_widget_ref (network_box); @@ -891,6 +1011,56 @@ static GnomeUIInfo intf_popup_uiinfo[] = GNOME_APP_PIXMAP_NONE, NULL, 0, (GdkModifierType) 0, NULL }, + { + GNOME_APP_UI_ITEM, N_("Screen"), + NULL, + (gpointer) NULL, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, + { + GNOME_APP_UI_ITEM, N_("Deinterlace"), + NULL, + (gpointer) NULL, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, + GNOMEUIINFO_SEPARATOR, + { + GNOME_APP_UI_ITEM, N_("Volume Up"), + NULL, + (gpointer) GtkVolumeUp, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, + { + GNOME_APP_UI_ITEM, N_("Volume Down"), + NULL, + (gpointer) GtkVolumeDown, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, + { + GNOME_APP_UI_ITEM, N_("Mute"), + NULL, + (gpointer) GtkVolumeMute, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, + { + GNOME_APP_UI_ITEM, N_("Channels"), + NULL, + (gpointer) NULL, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, + { + GNOME_APP_UI_ITEM, N_("Device"), + NULL, + (gpointer) NULL, NULL, NULL, + GNOME_APP_PIXMAP_NONE, NULL, + 0, (GdkModifierType) 0, NULL + }, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, N_("Next"), @@ -1013,59 +1183,99 @@ create_intf_popup (void) (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (intf_popup_uiinfo[9].widget); - gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator8", + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_video_device", intf_popup_uiinfo[9].widget, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (intf_popup_uiinfo[10].widget); - gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_next", + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_deinterlace", intf_popup_uiinfo[10].widget, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (intf_popup_uiinfo[11].widget); - gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_prev", + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator8", intf_popup_uiinfo[11].widget, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (intf_popup_uiinfo[12].widget); - gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_jump", + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_volume_up", intf_popup_uiinfo[12].widget, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (intf_popup_uiinfo[13].widget); - gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_program", + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_volume_down", intf_popup_uiinfo[13].widget, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_set_sensitive (intf_popup_uiinfo[13].widget, FALSE); gtk_widget_ref (intf_popup_uiinfo[14].widget); - gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_navigation", + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_volume_mute", intf_popup_uiinfo[14].widget, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_set_sensitive (intf_popup_uiinfo[14].widget, FALSE); gtk_widget_ref (intf_popup_uiinfo[15].widget); - gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_audio", + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_audio_channels", intf_popup_uiinfo[15].widget, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_set_sensitive (intf_popup_uiinfo[15].widget, FALSE); gtk_widget_ref (intf_popup_uiinfo[16].widget); - gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_subpictures", + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_audio_device", intf_popup_uiinfo[16].widget, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_set_sensitive (intf_popup_uiinfo[16].widget, FALSE); gtk_widget_ref (intf_popup_uiinfo[17].widget); - gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator13", + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator17", intf_popup_uiinfo[17].widget, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (intf_popup_uiinfo[18].widget); - gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_file", + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_next", intf_popup_uiinfo[18].widget, (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_ref (intf_popup_uiinfo[19].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_prev", + intf_popup_uiinfo[19].widget, + (GtkDestroyNotify) gtk_widget_unref); + + gtk_widget_ref (intf_popup_uiinfo[20].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_jump", + intf_popup_uiinfo[20].widget, + (GtkDestroyNotify) gtk_widget_unref); + + gtk_widget_ref (intf_popup_uiinfo[21].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_program", + intf_popup_uiinfo[21].widget, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_set_sensitive (intf_popup_uiinfo[21].widget, FALSE); + + gtk_widget_ref (intf_popup_uiinfo[22].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_navigation", + intf_popup_uiinfo[22].widget, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_set_sensitive (intf_popup_uiinfo[22].widget, FALSE); + + gtk_widget_ref (intf_popup_uiinfo[23].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_audio", + intf_popup_uiinfo[23].widget, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_set_sensitive (intf_popup_uiinfo[23].widget, FALSE); + + gtk_widget_ref (intf_popup_uiinfo[24].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_subpictures", + intf_popup_uiinfo[24].widget, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_set_sensitive (intf_popup_uiinfo[24].widget, FALSE); + + gtk_widget_ref (intf_popup_uiinfo[25].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator13", + intf_popup_uiinfo[25].widget, + (GtkDestroyNotify) gtk_widget_unref); + + gtk_widget_ref (intf_popup_uiinfo[26].widget); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_file", + intf_popup_uiinfo[26].widget, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_ref (popup_file_menu_uiinfo[0].widget); gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_open", popup_file_menu_uiinfo[0].widget, @@ -1091,24 +1301,24 @@ create_intf_popup (void) popup_file_menu_uiinfo[4].widget, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_ref (intf_popup_uiinfo[19].widget); + gtk_widget_ref (intf_popup_uiinfo[27].widget); gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_playlist", - intf_popup_uiinfo[19].widget, + intf_popup_uiinfo[27].widget, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_ref (intf_popup_uiinfo[20].widget); + gtk_widget_ref (intf_popup_uiinfo[28].widget); gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_preferences", - intf_popup_uiinfo[20].widget, + intf_popup_uiinfo[28].widget, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_ref (intf_popup_uiinfo[21].widget); + gtk_widget_ref (intf_popup_uiinfo[29].widget); gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator2", - intf_popup_uiinfo[21].widget, + intf_popup_uiinfo[29].widget, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_ref (intf_popup_uiinfo[22].widget); + gtk_widget_ref (intf_popup_uiinfo[30].widget); gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_exit", - intf_popup_uiinfo[22].widget, + intf_popup_uiinfo[30].widget, (GtkDestroyNotify) gtk_widget_unref); return intf_popup; diff --git a/modules/gui/gtk/gtk.c b/modules/gui/gtk/gtk.c index e91901ee80..ee46858047 100644 --- a/modules/gui/gtk/gtk.c +++ b/modules/gui/gtk/gtk.c @@ -2,7 +2,7 @@ * gtk.c : Gtk+ plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: gtk.c,v 1.10 2003/01/03 14:44:46 sam Exp $ + * $Id: gtk.c,v 1.11 2003/01/20 20:07:06 fenrir Exp $ * * Authors: Samuel Hocevar * @@ -111,6 +111,11 @@ static int Open( vlc_object_t *p_this ) /* Initialize Gtk+ thread */ p_intf->p_sys->b_playing = 0; + p_intf->p_sys->b_deinterlace_update = 0; + + p_intf->p_sys->b_aout_update = 0; + p_intf->p_sys->b_vout_update = 0; + p_intf->p_sys->b_popup_changed = 0; p_intf->p_sys->b_window_changed = 0; p_intf->p_sys->b_playlist_changed = 0; @@ -126,6 +131,7 @@ static int Open( vlc_object_t *p_this ) p_intf->p_sys->i_part = 0; + p_intf->p_sys->b_mute = 0; return VLC_SUCCESS; } @@ -383,7 +389,10 @@ static int Manage( intf_thread_t *p_intf ) if( p_intf->p_sys->p_input ) { - input_thread_t *p_input = p_intf->p_sys->p_input; + input_thread_t *p_input = p_intf->p_sys->p_input; + aout_instance_t *p_aout = NULL; + vout_thread_t *p_vout = NULL; + vlc_bool_t b_need_menus = VLC_FALSE; vlc_mutex_lock( &p_input->stream.stream_lock ); @@ -436,6 +445,42 @@ static int Manage( intf_thread_t *p_intf ) p_input->stream.p_selected_area->i_part ) { p_intf->p_sys->b_chapter_update = 1; + b_need_menus = VLC_TRUE; + } + + /* Does the audio output require to update the menus ? */ + p_aout = (aout_instance_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT, + FIND_ANYWHERE ); + if( p_aout != NULL ) + { + vlc_value_t val; + if( var_Get( (vlc_object_t *)p_aout, "intf-change", &val ) >= 0 + && val.b_bool ) + { + p_intf->p_sys->b_aout_update = 1; + b_need_menus = 1; + } + + vlc_object_release( (vlc_object_t *)p_aout ); + } + + /* Does the video output require to update the menus ? */ + p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, + FIND_ANYWHERE ); + if( p_vout != NULL ) + { + vlc_value_t val; + if( var_Get( (vlc_object_t *)p_vout, "intf-change", &val ) >= 0 + && val.b_bool ) + { + p_intf->p_sys->b_vout_update = 1; + b_need_menus = 1; + } + + vlc_object_release( (vlc_object_t *)p_vout ); + } + if( b_need_menus ) + { GtkSetupMenus( p_intf ); } } diff --git a/modules/gui/gtk/gtk.glade b/modules/gui/gtk/gtk.glade index c56ccc6c85..16d9189142 100644 --- a/modules/gui/gtk/gtk.glade +++ b/modules/gui/gtk/gtk.glade @@ -356,6 +356,100 @@ + + GtkMenuItem + menubar_config_audio + + False + + + GtkMenu + menubar_config_audio_menu + + + GtkMenuItem + menubar_volume_up + + activate + GtkVolumeUp + Mon, 20 Jan 2003 10:11:53 GMT + + + False + + + + GtkMenuItem + menubar_volume_down + + activate + GtkVolumeDown + Mon, 20 Jan 2003 10:11:53 GMT + + + False + + + + GtkMenuItem + menubar_volume_mute + + activate + GtkVolumeMute + Mon, 20 Jan 2003 10:11:53 GMT + + + False + + + + GtkMenuItem + separator15 + False + + + + GtkMenuItem + menubar_audio_channels + + False + + + + GtkMenuItem + menubar_audio_device + + False + + + + + + GtkMenuItem + menubar_config_video + + False + + + GtkMenu + menubar_config_video_menu + + + GtkMenuItem + menubar_video_device + + False + + + + GtkMenuItem + menubar_deinterlace + + False + + + + GtkMenuItem menubar_help @@ -1107,12 +1201,82 @@ False + + GtkMenuItem + popup_video_device + + False + + + + GtkMenuItem + popup_deinterlace + + False + + GtkMenuItem separator5 False + + GtkMenuItem + popup_volume_up + + activate + GtkVolumeUp + Mon, 20 Jan 2003 10:16:02 GMT + + + False + + + + GtkMenuItem + popup_volume_down + + activate + GtkVolumeDown + Mon, 20 Jan 2003 10:18:25 GMT + + + False + + + + GtkMenuItem + popup_volume_mute + + activate + GtkVolumeMute + Mon, 20 Jan 2003 10:18:25 GMT + + + False + + + + GtkMenuItem + popup_audio_channels + + False + + + + GtkMenuItem + popup_audio_device + + False + + + + GtkMenuItem + separator16 + False + + GtkMenuItem popup_next diff --git a/modules/gui/gtk/gtk_callbacks.c b/modules/gui/gtk/gtk_callbacks.c index 89a0ca29ea..500983cb7d 100644 --- a/modules/gui/gtk/gtk_callbacks.c +++ b/modules/gui/gtk/gtk_callbacks.c @@ -2,7 +2,7 @@ * gtk_callbacks.c : Callbacks for the Gtk+ plugin. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: gtk_callbacks.c,v 1.7 2003/01/17 19:17:09 sam Exp $ + * $Id: gtk_callbacks.c,v 1.8 2003/01/20 20:07:06 fenrir Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -32,6 +32,7 @@ #include #include #include +#include #include @@ -568,7 +569,6 @@ gboolean GtkMessagesShow( GtkWidget *widget, return TRUE; } - void GtkMessagesOk (GtkButton *button, gpointer user_data) @@ -598,3 +598,95 @@ GtkOpenNotebookChanged (GtkNotebook *notebook, GtkOpenChanged( GTK_WIDGET( notebook ), user_data ); } +/**************************************************************************** + * Audio management + ****************************************************************************/ +void GtkVolumeUp ( GtkMenuItem *menuitem, + gpointer user_data ) +{ + intf_thread_t *p_intf = GtkGetIntf( menuitem ); + aout_instance_t *p_aout; + + p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE ); + if( p_aout != NULL ) + { + if( p_intf->p_sys->b_mute ) + { + audio_volume_t i_volume; + + aout_VolumeMute( p_aout, &i_volume ); + p_intf->p_sys->b_mute = ( i_volume == 0 ) ? 1 : 0; + + } + aout_VolumeUp( p_aout, 1, NULL ); + vlc_object_release( (vlc_object_t *)p_aout ); + } +} + + +void GtkVolumeDown ( GtkMenuItem *menuitem, + gpointer user_data ) +{ + intf_thread_t *p_intf = GtkGetIntf( menuitem ); + aout_instance_t *p_aout; + + p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE ); + if( p_aout != NULL ) + { + if( p_intf->p_sys->b_mute ) + { + audio_volume_t i_volume; + + aout_VolumeMute( p_aout, &i_volume ); + p_intf->p_sys->b_mute = ( i_volume == 0 ) ? 1 : 0; + } + aout_VolumeDown( p_aout, 1, NULL ); + vlc_object_release( (vlc_object_t *)p_aout ); + } +} + + +void GtkVolumeMute ( GtkMenuItem *menuitem, + gpointer user_data ) +{ + intf_thread_t *p_intf = GtkGetIntf( menuitem ); + aout_instance_t *p_aout; + audio_volume_t i_volume; + + p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE ); + + if( p_aout != NULL ) + { + aout_VolumeMute( p_aout, &i_volume ); + + p_intf->p_sys->b_mute = ( i_volume == 0 ) ? 1 : 0; + + vlc_object_release( (vlc_object_t *)p_aout ); + } +} + +void +GtkMenubarDeinterlace ( GtkMenuItem *menuitem, + gpointer user_data) +{ + intf_thread_t *p_intf = GtkGetIntf( menuitem ); + + if( p_intf ) + msg_Dbg( p_intf, "GtkMenubarDeinterlace" ); + + +} + + +void +GtkPopupDeinterlace (GtkRadioMenuItem *radiomenuitem, + gpointer user_data) +{ + intf_thread_t *p_intf = GtkGetIntf( radiomenuitem ); + + if( p_intf ) + msg_Dbg( p_intf, "GtkPopupDeinterlace" ); +} + + + diff --git a/modules/gui/gtk/gtk_callbacks.h b/modules/gui/gtk/gtk_callbacks.h index cb49b9b261..c0df488edd 100644 --- a/modules/gui/gtk/gtk_callbacks.h +++ b/modules/gui/gtk/gtk_callbacks.h @@ -2,7 +2,7 @@ * gtk_callbacks.h : Callbacks for the gtk plugin. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: gtk_callbacks.h,v 1.2 2002/09/30 11:05:39 sam Exp $ + * $Id: gtk_callbacks.h,v 1.3 2003/01/20 20:07:06 fenrir Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -153,3 +153,24 @@ GtkFileCancel (GtkButton *button, void GtkClose (GtkMenuItem *menuitem, gpointer user_data); + +void +GtkVolumeUp (GtkMenuItem *menuitem, + gpointer user_data); + +void +GtkVolumeDown (GtkMenuItem *menuitem, + gpointer user_data); + +void +GtkVolumeMute (GtkMenuItem *menuitem, + gpointer user_data); + +void +GtkMenubarDeinterlace (GtkMenuItem *menuitem, + gpointer user_data); + +void +GtkPopupDeinterlace (GtkRadioMenuItem *radiomenuitem, + gpointer user_data); + diff --git a/modules/gui/gtk/gtk_interface.c b/modules/gui/gtk/gtk_interface.c index ece3d7afc0..03b0ded9a7 100644 --- a/modules/gui/gtk/gtk_interface.c +++ b/modules/gui/gtk/gtk_interface.c @@ -1,4 +1,4 @@ -/* This file was created automatically by glade and fixed by bootstrap.sh */ +/* This file was created automatically by glade and fixed by bootstrap */ #include @@ -53,6 +53,20 @@ create_intf_window (void) GtkWidget *menubar_subpictures; GtkWidget *separator8; GtkWidget *menubar_preferences; + GtkWidget *menubar_config_audio; + GtkWidget *menubar_config_audio_menu; + GtkAccelGroup *menubar_config_audio_menu_accels; + GtkWidget *menubar_volume_up; + GtkWidget *menubar_volume_down; + GtkWidget *menubar_volume_mute; + GtkWidget *separator15; + GtkWidget *menubar_audio_channels; + GtkWidget *menubar_audio_device; + GtkWidget *menubar_config_video; + GtkWidget *menubar_config_video_menu; + GtkAccelGroup *menubar_config_video_menu_accels; + GtkWidget *menubar_video_device; + GtkWidget *menubar_deinterlace; GtkWidget *menubar_help; GtkWidget *menubar_help_menu; GtkAccelGroup *menubar_help_menu_accels; @@ -444,6 +458,99 @@ create_intf_window (void) gtk_container_add (GTK_CONTAINER (menubar_settings_menu), menubar_preferences); gtk_tooltips_set_tip (tooltips, menubar_preferences, _("Configure the application"), NULL); + menubar_config_audio = gtk_menu_item_new_with_label (""); + tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_config_audio)->child), + _("_Audio")); + gtk_widget_add_accelerator (menubar_config_audio, "activate_item", accel_group, + tmp_key, GDK_MOD1_MASK, (GtkAccelFlags) 0); + gtk_widget_ref (menubar_config_audio); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_config_audio", menubar_config_audio, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (menubar_config_audio); + gtk_container_add (GTK_CONTAINER (menubar), menubar_config_audio); + + menubar_config_audio_menu = gtk_menu_new (); + gtk_widget_ref (menubar_config_audio_menu); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_config_audio_menu", menubar_config_audio_menu, + (GtkDestroyNotify) gtk_widget_unref); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menubar_config_audio), menubar_config_audio_menu); + menubar_config_audio_menu_accels = gtk_menu_ensure_uline_accel_group (GTK_MENU (menubar_config_audio_menu)); + + menubar_volume_up = gtk_menu_item_new_with_label (_("Volume Up")); + gtk_widget_ref (menubar_volume_up); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_volume_up", menubar_volume_up, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (menubar_volume_up); + gtk_container_add (GTK_CONTAINER (menubar_config_audio_menu), menubar_volume_up); + + menubar_volume_down = gtk_menu_item_new_with_label (_("Volume Down")); + gtk_widget_ref (menubar_volume_down); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_volume_down", menubar_volume_down, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (menubar_volume_down); + gtk_container_add (GTK_CONTAINER (menubar_config_audio_menu), menubar_volume_down); + + menubar_volume_mute = gtk_menu_item_new_with_label (_("Mute")); + gtk_widget_ref (menubar_volume_mute); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_volume_mute", menubar_volume_mute, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (menubar_volume_mute); + gtk_container_add (GTK_CONTAINER (menubar_config_audio_menu), menubar_volume_mute); + + separator15 = gtk_menu_item_new (); + gtk_widget_ref (separator15); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "separator15", separator15, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (separator15); + gtk_container_add (GTK_CONTAINER (menubar_config_audio_menu), separator15); + gtk_widget_set_sensitive (separator15, FALSE); + + menubar_audio_channels = gtk_menu_item_new_with_label (_("Channels")); + gtk_widget_ref (menubar_audio_channels); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_audio_channels", menubar_audio_channels, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (menubar_audio_channels); + gtk_container_add (GTK_CONTAINER (menubar_config_audio_menu), menubar_audio_channels); + + menubar_audio_device = gtk_menu_item_new_with_label (_("Device")); + gtk_widget_ref (menubar_audio_device); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_audio_device", menubar_audio_device, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (menubar_audio_device); + gtk_container_add (GTK_CONTAINER (menubar_config_audio_menu), menubar_audio_device); + + menubar_config_video = gtk_menu_item_new_with_label (""); + tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_config_video)->child), + _("_Video")); + gtk_widget_add_accelerator (menubar_config_video, "activate_item", accel_group, + tmp_key, GDK_MOD1_MASK, (GtkAccelFlags) 0); + gtk_widget_ref (menubar_config_video); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_config_video", menubar_config_video, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (menubar_config_video); + gtk_container_add (GTK_CONTAINER (menubar), menubar_config_video); + + menubar_config_video_menu = gtk_menu_new (); + gtk_widget_ref (menubar_config_video_menu); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_config_video_menu", menubar_config_video_menu, + (GtkDestroyNotify) gtk_widget_unref); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menubar_config_video), menubar_config_video_menu); + menubar_config_video_menu_accels = gtk_menu_ensure_uline_accel_group (GTK_MENU (menubar_config_video_menu)); + + menubar_video_device = gtk_menu_item_new_with_label (_("Screen")); + gtk_widget_ref (menubar_video_device); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_video_device", menubar_video_device, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (menubar_video_device); + gtk_container_add (GTK_CONTAINER (menubar_config_video_menu), menubar_video_device); + + menubar_deinterlace = gtk_menu_item_new_with_label (_("Deinterlace")); + gtk_widget_ref (menubar_deinterlace); + gtk_object_set_data_full (GTK_OBJECT (intf_window), "menubar_deinterlace", menubar_deinterlace, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (menubar_deinterlace); + gtk_container_add (GTK_CONTAINER (menubar_config_video_menu), menubar_deinterlace); + menubar_help = gtk_menu_item_new_with_label (""); tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menubar_help)->child), _("_Help")); @@ -874,6 +981,15 @@ create_intf_window (void) gtk_signal_connect (GTK_OBJECT (menubar_preferences), "activate", GTK_SIGNAL_FUNC (GtkPreferencesShow), NULL); + gtk_signal_connect (GTK_OBJECT (menubar_volume_up), "activate", + GTK_SIGNAL_FUNC (GtkVolumeUp), + NULL); + gtk_signal_connect (GTK_OBJECT (menubar_volume_down), "activate", + GTK_SIGNAL_FUNC (GtkVolumeDown), + NULL); + gtk_signal_connect (GTK_OBJECT (menubar_volume_mute), "activate", + GTK_SIGNAL_FUNC (GtkVolumeMute), + NULL); gtk_signal_connect (GTK_OBJECT (menubar_about), "activate", GTK_SIGNAL_FUNC (GtkAboutShow), NULL); @@ -966,7 +1082,15 @@ create_intf_popup (void) GtkWidget *separator6; GtkWidget *popup_interface_toggle; GtkWidget *popup_fullscreen; + GtkWidget *popup_video_device; + GtkWidget *popup_deinterlace; GtkWidget *separator5; + GtkWidget *popup_volume_up; + GtkWidget *popup_volume_down; + GtkWidget *popup_volume_mute; + GtkWidget *popup_audio_channels; + GtkWidget *popup_audio_device; + GtkWidget *separator16; GtkWidget *popup_next; GtkWidget *popup_prev; GtkWidget *popup_jump; @@ -1074,6 +1198,20 @@ create_intf_popup (void) gtk_widget_show (popup_fullscreen); gtk_container_add (GTK_CONTAINER (intf_popup), popup_fullscreen); + popup_video_device = gtk_menu_item_new_with_label (_("Screen")); + gtk_widget_ref (popup_video_device); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_video_device", popup_video_device, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (popup_video_device); + gtk_container_add (GTK_CONTAINER (intf_popup), popup_video_device); + + popup_deinterlace = gtk_menu_item_new_with_label (_("Deinterlace")); + gtk_widget_ref (popup_deinterlace); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_deinterlace", popup_deinterlace, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (popup_deinterlace); + gtk_container_add (GTK_CONTAINER (intf_popup), popup_deinterlace); + separator5 = gtk_menu_item_new (); gtk_widget_ref (separator5); gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator5", separator5, @@ -1082,6 +1220,49 @@ create_intf_popup (void) gtk_container_add (GTK_CONTAINER (intf_popup), separator5); gtk_widget_set_sensitive (separator5, FALSE); + popup_volume_up = gtk_menu_item_new_with_label (_("Volume Up")); + gtk_widget_ref (popup_volume_up); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_volume_up", popup_volume_up, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (popup_volume_up); + gtk_container_add (GTK_CONTAINER (intf_popup), popup_volume_up); + + popup_volume_down = gtk_menu_item_new_with_label (_("Volume Down")); + gtk_widget_ref (popup_volume_down); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_volume_down", popup_volume_down, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (popup_volume_down); + gtk_container_add (GTK_CONTAINER (intf_popup), popup_volume_down); + + popup_volume_mute = gtk_menu_item_new_with_label (_("Mute")); + gtk_widget_ref (popup_volume_mute); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_volume_mute", popup_volume_mute, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (popup_volume_mute); + gtk_container_add (GTK_CONTAINER (intf_popup), popup_volume_mute); + + popup_audio_channels = gtk_menu_item_new_with_label (_("Channels")); + gtk_widget_ref (popup_audio_channels); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_audio_channels", popup_audio_channels, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (popup_audio_channels); + gtk_container_add (GTK_CONTAINER (intf_popup), popup_audio_channels); + + popup_audio_device = gtk_menu_item_new_with_label (_("Device")); + gtk_widget_ref (popup_audio_device); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_audio_device", popup_audio_device, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (popup_audio_device); + gtk_container_add (GTK_CONTAINER (intf_popup), popup_audio_device); + + separator16 = gtk_menu_item_new (); + gtk_widget_ref (separator16); + gtk_object_set_data_full (GTK_OBJECT (intf_popup), "separator16", separator16, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (separator16); + gtk_container_add (GTK_CONTAINER (intf_popup), separator16); + gtk_widget_set_sensitive (separator16, FALSE); + popup_next = gtk_menu_item_new_with_label (_("Next")); gtk_widget_ref (popup_next); gtk_object_set_data_full (GTK_OBJECT (intf_popup), "popup_next", popup_next, @@ -1285,6 +1466,15 @@ create_intf_popup (void) gtk_signal_connect (GTK_OBJECT (popup_fullscreen), "activate", GTK_SIGNAL_FUNC (GtkFullscreen), NULL); + gtk_signal_connect (GTK_OBJECT (popup_volume_up), "activate", + GTK_SIGNAL_FUNC (GtkVolumeUp), + NULL); + gtk_signal_connect (GTK_OBJECT (popup_volume_down), "activate", + GTK_SIGNAL_FUNC (GtkVolumeDown), + NULL); + gtk_signal_connect (GTK_OBJECT (popup_volume_mute), "activate", + GTK_SIGNAL_FUNC (GtkVolumeMute), + NULL); gtk_signal_connect (GTK_OBJECT (popup_next), "activate", GTK_SIGNAL_FUNC (GtkPlaylistNext), NULL); diff --git a/modules/gui/gtk/gtk_support.h b/modules/gui/gtk/gtk_support.h index 9439da3598..0045c6fcdf 100644 --- a/modules/gui/gtk/gtk_support.h +++ b/modules/gui/gtk/gtk_support.h @@ -1,5 +1,5 @@ /* - * This file was created automatically by glade and fixed by bootstrap.sh + * This file was created automatically by glade and fixed by bootstrap */ #ifdef HAVE_CONFIG_H diff --git a/modules/gui/gtk/menu.c b/modules/gui/gtk/menu.c index 6a14bfd08d..f2049de0c4 100644 --- a/modules/gui/gtk/menu.c +++ b/modules/gui/gtk/menu.c @@ -2,11 +2,12 @@ * menu.c : functions to handle menu items. ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: menu.c,v 1.3 2003/01/17 19:17:09 sam Exp $ + * $Id: menu.c,v 1.4 2003/01/20 20:07:07 fenrir Exp $ * * Authors: Samuel Hocevar * Stéphane Borel * Johan Bilien + * Laurent Aimar * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +32,8 @@ #include #include +#include +#include #ifdef MODULE_NAME_IS_gnome # include @@ -63,6 +66,12 @@ static gint GtkRadioMenu( intf_thread_t *, GtkWidget *, GSList *, char *, int, int, int, void( *pf_toggle )( GtkCheckMenuItem *, gpointer ) ); +static void GtkMenubarDeinterlaceToggle( GtkCheckMenuItem * menuitem, gpointer user_data ); +static void GtkPopupDeinterlaceToggle( GtkCheckMenuItem * menuitem, gpointer user_data ); +static gint GtkDeinterlaceMenus( gpointer p_data, + GtkWidget * p_root, + void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) ); + gint GtkSetupMenus( intf_thread_t * p_intf ); /**************************************************************************** @@ -284,6 +293,152 @@ void GtkMenubarChapterToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) } +static void GtkPopupObjectToggle( GtkCheckMenuItem * menuitem, gpointer user_data, + int i_object_type, char *psz_variable ) +{ + intf_thread_t *p_intf = GtkGetIntf( menuitem ); + GtkLabel *p_label; + + p_label = GTK_LABEL( ( GTK_BIN( menuitem )->child ) ); + + if( menuitem->active && !p_intf->p_sys->b_aout_update && !p_intf->p_sys->b_vout_update ) + { + vlc_object_t * p_obj; + + p_obj = (vlc_object_t *)vlc_object_find( p_intf, i_object_type, + FIND_ANYWHERE ); + if( p_obj ) + { + vlc_value_t val; + + gtk_label_get( p_label, &val.psz_string ); + + if( var_Set( p_obj, psz_variable, val ) < 0 ) + { + msg_Warn( p_obj, "cannot set variable (%s)", val.psz_string ); + } + vlc_object_release( p_obj ); + } + } +} +static void GtkPopupAoutChannelsToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) +{ + GtkPopupObjectToggle( menuitem, user_data, VLC_OBJECT_AOUT, "audio-channels" ); +} + +static void GtkPopupAoutDeviceToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) +{ + GtkPopupObjectToggle( menuitem, user_data, VLC_OBJECT_AOUT, "audio-device" ); +} + + +static void GtkPopupVoutDeviceToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) +{ + GtkPopupObjectToggle( menuitem, user_data, VLC_OBJECT_VOUT, "video-device" ); +} + + +static void GtkDeinterlaceUpdate( intf_thread_t *p_intf, char *psz_mode ) +{ + char *psz_filter; + int i; + + psz_filter = config_GetPsz( p_intf, "filter" ); + + if( !strcmp( psz_mode, "None" ) ) + { + config_PutPsz( p_intf, "filter", "" ); + } + else + { + if( !psz_filter || !*psz_filter ) + { + config_PutPsz( p_intf, "filter", "deinterlace" ); + } + else + { + if( strstr( psz_filter, "deinterlace" ) == NULL ) + { + psz_filter = realloc( psz_filter, strlen( psz_filter ) + 20 ); + strcat( psz_filter, ",deinterlace" ); + } + config_PutPsz( p_intf, "filter", psz_filter ); + } + + config_PutPsz( p_intf, "deinterlace-mode", psz_mode ); + } + + if( psz_filter ) + free( psz_filter ); + + /* now restart all video stream */ + vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); +#define ES p_intf->p_sys->p_input->stream.pp_es[i] + /* create a set of language buttons and append them to the container */ + for( i = 0 ; i < p_intf->p_sys->p_input->stream.i_es_number ; i++ ) + { + if( ( ES->i_cat == VIDEO_ES ) && + ES->p_decoder_fifo != NULL ) + { + input_UnselectES( p_intf->p_sys->p_input, ES ); + input_SelectES( p_intf->p_sys->p_input, ES ); + } +#undef ES + } + vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); +} + +static void GtkMenubarDeinterlaceToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) +{ + intf_thread_t *p_intf = GtkGetIntf( menuitem ); + GtkLabel *p_label; + char *psz_mode; + GtkWidget *p_popup_menu; + + p_label = GTK_LABEL( ( GTK_BIN( menuitem )->child ) ); + + if( !p_intf->p_sys->b_deinterlace_update && menuitem->active ) + { + gtk_label_get( p_label, &psz_mode ); + GtkDeinterlaceUpdate( p_intf, psz_mode ); + + p_intf->p_sys->b_deinterlace_update = VLC_TRUE; + + p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_popup ), "popup_deinterlace" ) ); + + GtkDeinterlaceMenus( p_intf, p_popup_menu, GtkPopupDeinterlaceToggle ); + + p_intf->p_sys->b_deinterlace_update = VLC_FALSE; + + } +} + +static void GtkPopupDeinterlaceToggle( GtkCheckMenuItem * menuitem, gpointer user_data ) +{ + intf_thread_t *p_intf = GtkGetIntf( menuitem ); + GtkLabel *p_label; + char *psz_mode; + GtkWidget *p_menubar_menu; + + p_label = GTK_LABEL( ( GTK_BIN( menuitem )->child ) ); + + if( !p_intf->p_sys->b_deinterlace_update && menuitem->active ) + { + gtk_label_get( p_label, &psz_mode ); + GtkDeinterlaceUpdate( p_intf, psz_mode ); + + p_intf->p_sys->b_deinterlace_update = VLC_TRUE; + + p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_window ), "menubar_deinterlace" ) ); + + GtkDeinterlaceMenus( p_intf, p_menubar_menu, GtkMenubarDeinterlaceToggle ); + + p_intf->p_sys->b_deinterlace_update = VLC_FALSE; + } +} + /**************************************************************************** * Functions to generate menus ****************************************************************************/ @@ -869,6 +1024,211 @@ static gint GtkTitleMenu( gpointer p_data, return TRUE; } +/***************************************************************************** + * GtkSetupVarMenu : + ***************************************************************************** + * + *****************************************************************************/ +static gint GtkSetupVarMenu( intf_thread_t * p_intf, + vlc_object_t * p_object, + GtkWidget *p_root, + char * psz_variable, + void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) ) +{ + vlc_value_t val; + char * psz_value; + GtkWidget * p_menu; + GSList * p_group = NULL; + GtkWidget * p_item; + GtkWidget * p_item_active = NULL; + + int i_item; + + /* temporary hack to avoid blank menu when an open menu is removed */ + if( GTK_MENU_ITEM(p_root)->submenu != NULL ) + { + gtk_menu_popdown( GTK_MENU( GTK_MENU_ITEM(p_root)->submenu ) ); + } + /* removes previous menu */ + gtk_menu_item_remove_submenu( GTK_MENU_ITEM( p_root ) ); + gtk_widget_set_sensitive( p_root, FALSE ); + + /* get the current value */ + if( var_Get( p_object, psz_variable, &val ) < 0 ) + { + return FALSE; + } + psz_value = val.psz_string; + + if( var_Change( p_object, psz_variable, VLC_VAR_GETLIST, &val ) < 0 ) + { + free( psz_value ); + return FALSE; + } + + /* menu container */ + p_menu = gtk_menu_new(); + gtk_object_set_data( GTK_OBJECT( p_menu ), "p_intf", p_intf ); + + for( i_item = 0; i_item < val.p_list->i_count; i_item++ ) + { + p_item = gtk_radio_menu_item_new_with_label( p_group, + val.p_list->p_values[i_item].psz_string ); + p_group = gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) ); + + if( !strcmp( psz_value, val.p_list->p_values[i_item].psz_string ) ) + { + p_item_active = p_item; + } + + gtk_widget_show( p_item ); + + /* signal hanling for off */ + gtk_signal_connect( GTK_OBJECT( p_item ), "toggled", + GTK_SIGNAL_FUNC ( pf_toggle ), NULL ); + + gtk_menu_append( GTK_MENU( p_menu ), p_item ); + + } + /* link the new menu to the menubar item */ + gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu ); + + if( p_item_active ) + { + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (p_item_active), TRUE); + } + + if( val.p_list->i_count > 0 ) + { + gtk_widget_set_sensitive( p_root, TRUE ); + } + + /* clean up everything */ + var_Change( p_object, psz_variable, VLC_VAR_FREELIST, &val ); + + return TRUE; +} + +/***************************************************************************** + * GtkDeinterlaceMenus: update interactive menus of the interface + ***************************************************************************** + *****************************************************************************/ +static gint GtkDeinterlaceMenus( gpointer p_data, + GtkWidget * p_root, + void(*pf_toggle )( GtkCheckMenuItem *, gpointer ) ) +{ + intf_thread_t * p_intf; + GtkWidget * p_menu; + GtkWidget * p_separator; + GtkWidget * p_item; + GtkWidget * p_item_active; + GSList * p_group; + guint i_item; + guint i; + char *ppsz_deinterlace_mode[] = { "discard", "blend", "mean", "bob", "linear", NULL }; + char *psz_deinterlace_option; + char *psz_filter; + + p_intf = (intf_thread_t *)p_data; + + /* temporary hack to avoid blank menu when an open menu is removed */ + if( GTK_MENU_ITEM(p_root)->submenu != NULL ) + { + gtk_menu_popdown( GTK_MENU( GTK_MENU_ITEM(p_root)->submenu ) ); + } + /* removes previous menu */ + gtk_menu_item_remove_submenu( GTK_MENU_ITEM( p_root ) ); + gtk_widget_set_sensitive( p_root, FALSE ); + + p_group = NULL; + + /* menu container */ + p_menu = gtk_menu_new(); + gtk_object_set_data( GTK_OBJECT( p_menu ), "p_intf", p_intf ); + + /* special case for "off" item */ + p_item = gtk_radio_menu_item_new_with_label( p_group, "None" ); + p_group = gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) ); + + gtk_widget_show( p_item ); + + /* signal hanling for off */ + gtk_signal_connect( GTK_OBJECT( p_item ), "toggled", + GTK_SIGNAL_FUNC ( pf_toggle ), NULL ); + + gtk_menu_append( GTK_MENU( p_menu ), p_item ); + + p_separator = gtk_menu_item_new(); + gtk_widget_set_sensitive( p_separator, FALSE ); + gtk_widget_show( p_separator ); + gtk_menu_append( GTK_MENU( p_menu ), p_separator ); + + + /* search actual deinterlace mode */ + psz_filter = config_GetPsz( p_intf, "filter" ); + psz_deinterlace_option = strdup( "None" ); + + if( psz_filter && *psz_filter ) + { + if( strstr ( psz_filter, "deinterlace" ) ) + { + free( psz_deinterlace_option ); + psz_deinterlace_option = config_GetPsz( p_intf, "deinterlace-mode" ); + if( !psz_deinterlace_option ) + psz_deinterlace_option = strdup( "None" ); + } + } + if( psz_filter ) + free( psz_filter ); + + p_item_active = NULL; + i_item = 0; + + /* create a set of deinteralce buttons and append them to the container */ + for( i = 0; ppsz_deinterlace_mode[i] != NULL; i++ ) + { + i_item++; + + p_item = gtk_radio_menu_item_new_with_label( p_group, ppsz_deinterlace_mode[i] ); + p_group = gtk_radio_menu_item_group( GTK_RADIO_MENU_ITEM( p_item ) ); + gtk_widget_show( p_item ); + + if( !strcmp( ppsz_deinterlace_mode[i], psz_deinterlace_option ) ) + { + p_item_active = p_item; + } + /* setup signal hanling */ + gtk_signal_connect( GTK_OBJECT( p_item ), "toggled", + GTK_SIGNAL_FUNC( pf_toggle ), + NULL ); + + gtk_menu_append( GTK_MENU( p_menu ), p_item ); + + } + + /* link the new menu to the menubar item */ + gtk_menu_item_set_submenu( GTK_MENU_ITEM( p_root ), p_menu ); + + /* acitvation will call signals so we can only do it + * when submenu is attached to menu - to get intf_window + * We have to release the lock since input_ToggleES needs it */ + if( p_item_active != NULL ) + { + gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( p_item_active ), + TRUE ); + } + + /* be sure that menu is sensitive if non empty */ + if( i_item > 0 ) + { + gtk_widget_set_sensitive( p_root, TRUE ); + } + + return TRUE; +} + + + /***************************************************************************** * GtkSetupMenus: function that generates title/chapter/audio/subpic * menus with help from preceding functions @@ -889,6 +1249,21 @@ gint GtkSetupMenus( intf_thread_t * p_intf ) p_intf->p_sys->b_spu_update |= p_intf->p_sys->b_title_update | p_intf->p_sys->b_program_update; + if( 1 ) + { + p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_window ), "menubar_deinterlace" ) ); + p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_popup ), "popup_deinterlace" ) ); + + p_intf->p_sys->b_deinterlace_update = VLC_TRUE; + GtkDeinterlaceMenus( p_intf, p_menubar_menu, GtkMenubarDeinterlaceToggle ); + p_intf->p_sys->b_deinterlace_update = VLC_TRUE; + GtkDeinterlaceMenus( p_intf, p_popup_menu, GtkPopupDeinterlaceToggle ); + + p_intf->p_sys->b_deinterlace_update = VLC_FALSE; + } + if( p_intf->p_sys->b_program_update ) { pgrm_descriptor_t * p_pgrm; @@ -1027,7 +1402,73 @@ gint GtkSetupMenus( intf_thread_t * p_intf ) p_intf->p_sys->b_spu_update = VLC_FALSE; } + /* create audio channels and device menu (in menubar _and_ popup */ + if( p_intf->p_sys->b_aout_update ) + { + aout_instance_t *p_aout; + + p_aout = (aout_instance_t*)vlc_object_find( p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE ); + + if( p_aout != NULL ) + { + vlc_value_t val; + val.b_bool = VLC_FALSE; + + var_Set( (vlc_object_t *)p_aout, "intf-change", val ); + + /* audio-channels */ + p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_window ), "menubar_audio_channels" ) ); + p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_popup ), "popup_audio_channels" ) ); + GtkSetupVarMenu( p_intf, (vlc_object_t *)p_aout, p_popup_menu, + "audio-channels", GtkPopupAoutChannelsToggle ); + GtkSetupVarMenu( p_intf, (vlc_object_t *)p_aout, p_menubar_menu, + "audio-channels", GtkPopupAoutChannelsToggle ); + + /* audio-device */ + p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_window ), "menubar_audio_device" ) ); + p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_popup ), "popup_audio_device" ) ); + GtkSetupVarMenu( p_intf, (vlc_object_t *)p_aout, p_popup_menu, + "audio-device", GtkPopupAoutDeviceToggle ); + GtkSetupVarMenu( p_intf, (vlc_object_t *)p_aout, p_menubar_menu, + "audio-device", GtkPopupAoutDeviceToggle ); + + vlc_object_release( (vlc_object_t *)p_aout ); + } + p_intf->p_sys->b_aout_update = VLC_FALSE; + } + + if( p_intf->p_sys->b_vout_update ) + { + vout_thread_t *p_vout; + + p_vout = (vout_thread_t*)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE ); + if( p_vout != NULL ) + { + vlc_value_t val; + val.b_bool = VLC_FALSE; + + var_Set( (vlc_object_t *)p_vout, "intf-change", val ); + + /* video-device */ + p_menubar_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_window ), "menubar_video_device" ) ); + p_popup_menu = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( + p_intf->p_sys->p_popup ), "popup_video_device" ) ); + GtkSetupVarMenu( p_intf, (vlc_object_t *)p_vout, p_popup_menu, + "video-device", GtkPopupVoutDeviceToggle ); + GtkSetupVarMenu( p_intf, (vlc_object_t *)p_vout, p_menubar_menu, + "video-device", GtkPopupVoutDeviceToggle ); + + + vlc_object_release( (vlc_object_t *)p_vout ); + } + p_intf->p_sys->b_vout_update = VLC_FALSE; + } vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); return TRUE;