]> git.sesse.net Git - vlc/blobdiff - plugins/gtk/gtk_display.c
*Removed an occurance of former angle item in gtk.
[vlc] / plugins / gtk / gtk_display.c
index 63d1b8c6c41b663ada94f534b3d145c7e7da4a56..96fdc442a6306f42d8bed38f6e1b8bfa2f6bba7f 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_display.c: Gtk+ tools for main interface
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: gtk_display.c,v 1.4 2001/05/30 23:02:03 stef Exp $
+ * $Id: gtk_display.c,v 1.18 2002/03/06 01:20:56 stef Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include "defs.h"
-
 #include <errno.h>                                                 /* ENOMEM */
 #include <stdlib.h>                                                /* free() */
 #include <string.h>                                            /* strerror() */
 #include <stdio.h>
 
-#include <gtk/gtk.h>
+#include <videolan/vlc.h>
 
-#include "config.h"
-#include "common.h"
-#include "threads.h"
-#include "mtime.h"
-#include "tests.h"
-#include "modules.h"
+#ifdef MODULE_NAME_IS_gnome
+#   include <gnome.h>
+#else
+#   include <gtk/gtk.h>
+#endif
 
 #include "stream_control.h"
 #include "input_ext-intf.h"
 
 #include "interface.h"
-#include "intf_msg.h"
 #include "intf_playlist.h"
 
 #include "video.h"
 #include "gtk_support.h"
 #include "gtk_menu.h"
 #include "gtk_display.h"
-#include "intf_gtk.h"
-
-#include "main.h"
-
-#include "modules_export.h"
+#include "gtk_common.h"
 
 /*****************************************************************************
  * GtkDisplayDate: display stream date
@@ -75,13 +67,13 @@ void GtkDisplayDate( GtkAdjustment *p_adj )
    
     p_intf = gtk_object_get_data( GTK_OBJECT( p_adj ), "p_intf" );
 
-    if( p_intf->p_input != NULL )
+    if( p_input_bank->pp_input[0] != NULL )
     {
-#define p_area p_intf->p_input->stream.p_selected_area
+#define p_area p_input_bank->pp_input[0]->stream.p_selected_area
         char psz_time[ OFFSETTOTIME_MAX_SIZE ];
 
         gtk_frame_set_label( GTK_FRAME( p_intf->p_sys->p_slider_frame ),
-                            input_OffsetToTime( p_intf->p_input, psz_time,
+                            input_OffsetToTime( p_input_bank->pp_input[0], psz_time,
                                    ( p_area->i_size * p_adj->value ) / 100 ) );
 #undef p_area
      }
@@ -128,9 +120,9 @@ gint GtkModeManage( intf_thread_t * p_intf )
     b_control = 0;
 
     /* show the box related to current input mode */
-    if( p_intf->p_input != NULL )
+    if( p_input_bank->pp_input[0] != NULL )
     {
-        switch( p_intf->p_input->stream.i_method & 0xf0 )
+        switch( p_input_bank->pp_input[0]->stream.i_method & 0xf0 )
         {
             case INPUT_METHOD_FILE:
 //intf_WarnMsg( 2, "intf info: file method" );
@@ -139,7 +131,7 @@ gint GtkModeManage( intf_thread_t * p_intf )
                             p_intf->p_sys->p_window ),
                             "label_status" );
                 gtk_label_set_text( GTK_LABEL( p_label ),
-                                    p_intf->p_input->p_source );
+                                    p_input_bank->pp_input[0]->psz_source );
                 break;
             case INPUT_METHOD_DISC:
 //intf_WarnMsg( 2, "intf info: disc method" );
@@ -152,11 +144,10 @@ gint GtkModeManage( intf_thread_t * p_intf )
                             p_intf->p_sys->p_window ),
                             "network_address_label" );
                 gtk_label_set_text( GTK_LABEL( p_label ),
-                                    p_intf->p_input->p_source );
+                                    p_input_bank->pp_input[0]->psz_source );
                 p_channel = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
                            p_intf->p_sys->p_window ), "network_channel_box" ) );
-                if( main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR,
-                                         INPUT_NETWORK_CHANNEL_DEFAULT  ) )
+                if( config_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR ) )
                 {
                     gtk_widget_show( GTK_WIDGET( p_channel ) );
                 }
@@ -167,58 +158,78 @@ gint GtkModeManage( intf_thread_t * p_intf )
 
                 break;
             default:
-                intf_ErrMsg( "intf error: can't determine input method" );
+                intf_WarnMsg( 3, "intf: can't determine input method" );
+                gtk_widget_show( GTK_WIDGET( p_file_box ) );
+                p_label = gtk_object_get_data( GTK_OBJECT(
+                            p_intf->p_sys->p_window ),
+                            "label_status" );
+                gtk_label_set_text( GTK_LABEL( p_label ),
+                                    p_input_bank->pp_input[0]->psz_source );
                 break;
         }
     
-        /* slider for seekable streams */
-        if( p_intf->p_input->stream.b_seekable )
+        /* initialize and show slider for seekable streams */
+        if( p_input_bank->pp_input[0]->stream.b_seekable )
         {
+            p_intf->p_sys->p_adj->value = p_intf->p_sys->f_adj_oldvalue = 0;
+            gtk_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),
+                                     "value_changed" );
             gtk_widget_show( GTK_WIDGET( p_slider ) );
         }
     
         /* control buttons for free pace streams */
-        b_control = p_intf->p_input->stream.b_pace_control;
+        b_control = p_input_bank->pp_input[0]->stream.b_pace_control;
 
         /* get ready for menu regeneration */
+        p_intf->p_sys->b_program_update = 1;
         p_intf->p_sys->b_title_update = 1;
         p_intf->p_sys->b_chapter_update = 1;
-        p_intf->p_sys->b_angle_update = 1;
         p_intf->p_sys->b_audio_update = 1;
         p_intf->p_sys->b_spu_update = 1;
         p_intf->p_sys->i_part = 0;
     
-        p_intf->p_input->stream.b_changed = 0;
-        intf_WarnMsg( 3, 
-                      "intf info: menus refreshed as stream has changed" );
+        p_input_bank->pp_input[0]->stream.b_changed = 0;
+        intf_WarnMsg( 3, "intf: stream has changed, refreshing interface" );
     }
     else
     {
+        if( config_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR ) )
+        {
+            gtk_widget_show( GTK_WIDGET( p_network_box ) );
+
+            p_channel = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
+                       p_intf->p_sys->p_window ), "network_channel_box" ) );
+            gtk_widget_show( GTK_WIDGET( p_channel ) );
+        }
+        else
+        {
 //intf_WarnMsg( 2, "intf info: default to file method" );
-        /* default mode */
-        p_label = gtk_object_get_data( GTK_OBJECT( p_intf->p_sys->p_window ),
-                        "label_status" );
-        gtk_label_set_text( GTK_LABEL( p_label ), "" );
-        gtk_widget_show( GTK_WIDGET( p_file_box ) );
-
-        /* unsensitize menus */
-        gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_title"), FALSE );
-        gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_chapter"),
-                                  FALSE );
-        gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_angle"), FALSE );
-        gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_audio"), FALSE );
-        gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_subpictures"),
-                                  FALSE );
-        gtk_widget_set_sensitive( GETWIDGET(p_popup,"popup_navigation"),
-                                  FALSE );
-        gtk_widget_set_sensitive( GETWIDGET(p_popup,"popup_angle"), FALSE );
-        gtk_widget_set_sensitive( GETWIDGET(p_popup,"popup_audio"), FALSE );
-        gtk_widget_set_sensitive( GETWIDGET(p_popup,"popup_subpictures"),
-                                  FALSE );
+            /* default mode */
+            p_label = gtk_object_get_data(
+                    GTK_OBJECT( p_intf->p_sys->p_window ), "label_status" );
+            gtk_label_set_text( GTK_LABEL( p_label ), "" );
+            gtk_widget_show( GTK_WIDGET( p_file_box ) );
+
+            /* unsensitize menus */
+            gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_program"),
+                    FALSE );
+            gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_title"), FALSE );
+            gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_chapter"),
+                                      FALSE );
+            gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_audio"), FALSE );
+            gtk_widget_set_sensitive( GETWIDGET(p_window,"menubar_subpictures"),
+                                      FALSE );
+            gtk_widget_set_sensitive( GETWIDGET(p_popup,"popup_navigation"),
+                                      FALSE );
+            gtk_widget_set_sensitive( GETWIDGET(p_popup,"popup_audio"), FALSE );
+            gtk_widget_set_sensitive( GETWIDGET(p_popup,"popup_subpictures"),
+                                      FALSE );
+        }
     }
 
     /* set control items */
     gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_back"), FALSE );
+    gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_eject"), !b_control);
     gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_pause"), b_control );
     gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_slow"), b_control );
     gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_fast"), b_control );