]> git.sesse.net Git - vlc/blobdiff - plugins/gtk/intf_gtk.c
* Fixed the BeOS compile typo.
[vlc] / plugins / gtk / intf_gtk.c
index b79ab9ba690bb188c0a6158b4a29cb5b37c7df03..3398b810df73f4624466ae83f4f4f0bdaff6e2b3 100644 (file)
@@ -2,7 +2,7 @@
  * intf_gtk.c: Gtk+ interface
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: intf_gtk.c,v 1.20 2001/05/19 00:39:30 stef Exp $
+ * $Id: intf_gtk.c,v 1.22 2001/05/30 17:03:12 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -42,7 +42,6 @@
 #include "threads.h"
 #include "mtime.h"
 #include "tests.h"
-#include "modules.h"
 
 #include "stream_control.h"
 #include "input_ext-intf.h"
 #include "gtk_interface.h"
 #include "gtk_support.h"
 #include "gtk_menu.h"
+#include "gtk_display.h"
 #include "intf_gtk.h"
 
 #include "main.h"
 
+#include "modules.h"
+#include "modules_export.h"
+
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
@@ -71,8 +74,6 @@ static void intf_Close      ( intf_thread_t *p_intf );
 static void intf_Run        ( intf_thread_t *p_intf );
 
 static gint GtkManage       ( gpointer p_data );
-static gint GtkModeManage   ( intf_thread_t * p_intf );
-static void GtkDisplayDate  ( GtkAdjustment *p_adj );
 
 /*****************************************************************************
  * g_atexit: kludge to avoid the Gtk+ thread to segfault at exit
@@ -149,6 +150,7 @@ static int intf_Open( intf_thread_t *p_intf )
     p_intf->p_sys->b_window_changed = 0;
     p_intf->p_sys->b_playlist_changed = 0;
 
+    p_intf->p_sys->i_playing = -1;
     p_intf->p_sys->b_slider_free = 1;
 
     p_intf->p_sys->pf_gtk_callback = NULL;
@@ -290,7 +292,6 @@ static void intf_Run( intf_thread_t *p_intf )
  * In this function, called approx. 10 times a second, we check what the
  * main program wanted to tell us.
  *****************************************************************************/
-
 static gint GtkManage( gpointer p_data )
 {
 #define p_intf ((intf_thread_t *)p_data)
@@ -312,7 +313,7 @@ static gint GtkManage( gpointer p_data )
     }
 
     /* update the playlist */
-//    GtkPlayListManage( p_data );
+    GtkPlayListManage( p_data );
 
     if( p_intf->p_input != NULL && !p_intf->b_die )
     {
@@ -392,157 +393,3 @@ static gint GtkManage( gpointer p_data )
 
 #undef p_intf
 }
-
-/*****************************************************************************
- * GtkDisplayDate: display stream date
- *****************************************************************************
- * This function displays the current date related to the position in
- * the stream. It is called whenever the slider changes its value.
- * The lock has to be taken before you call the function.
- *****************************************************************************/
-void GtkDisplayDate( GtkAdjustment *p_adj )
-{
-    intf_thread_t *p_intf;
-   
-    p_intf = gtk_object_get_data( GTK_OBJECT( p_adj ), "p_intf" );
-
-    if( p_intf->p_input != NULL )
-    {
-#define p_area p_intf->p_input->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,
-                                   ( p_area->i_size * p_adj->value ) / 100 ) );
-#undef p_area
-     }
-}
-
-
-/*****************************************************************************
- * GtkModeManage: actualise the aspect of the interface whenever the input
- *                changes.
- *****************************************************************************
- * The lock has to be taken before you call the function.
- *****************************************************************************/
-static gint GtkModeManage( intf_thread_t * p_intf )
-{
-    GtkWidget *     p_dvd_box;
-    GtkWidget *     p_file_box;
-    GtkWidget *     p_network_box;
-    GtkWidget *     p_slider;
-    GtkWidget *     p_label;
-    boolean_t       b_control;
-
-#define GETWIDGET( ptr, name ) GTK_WIDGET( gtk_object_get_data( GTK_OBJECT( \
-                           p_intf->p_sys->ptr ) , ( name ) ) )
-    /* hide all boxes except default file box */
-    p_file_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
-                 p_intf->p_sys->p_window ), "file_box" ) );
-    gtk_widget_hide( GTK_WIDGET( p_file_box ) );
-
-    p_network_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
-                 p_intf->p_sys->p_window ), "network_box" ) );
-    gtk_widget_hide( GTK_WIDGET( p_network_box ) );
-
-    p_dvd_box = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
-                 p_intf->p_sys->p_window ), "dvd_box" ) );
-    gtk_widget_hide( GTK_WIDGET( p_dvd_box ) );
-
-    /* hide slider */
-    p_slider = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
-                           p_intf->p_sys->p_window ), "slider_frame" ) );
-    gtk_widget_hide( GTK_WIDGET( p_slider ) );
-
-    /* controls unavailable */
-    b_control = 0;
-
-    /* show the box related to current input mode */
-    if( p_intf->p_input != NULL )
-    {
-        switch( p_intf->p_input->stream.i_method & 0xf0 )
-        {
-            case INPUT_METHOD_FILE:
-                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_intf->p_input->p_source );
-                break;
-            case INPUT_METHOD_DISC:
-                gtk_widget_show( GTK_WIDGET( p_dvd_box ) );
-                break;
-            case INPUT_METHOD_NETWORK:
-                gtk_widget_show( GTK_WIDGET( p_network_box ) );
-                p_label = gtk_object_get_data( GTK_OBJECT(
-                            p_intf->p_sys->p_window ),
-                            "network_address_label" );
-                gtk_label_set_text( GTK_LABEL( p_label ),
-                                    p_intf->p_input->p_source );
-                break;
-            default:
-                intf_ErrMsg( "intf error: can't determine input method" );
-                break;
-        }
-    
-        /* slider for seekable streams */
-        if( p_intf->p_input->stream.b_seekable )
-        {
-            gtk_widget_show( GTK_WIDGET( p_slider ) );
-        }
-    
-        /* control buttons for free pace streams */
-        b_control = p_intf->p_input->stream.b_pace_control;
-
-        /* get ready for menu regeneration */
-        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" );
-    }
-    else
-    {
-        /* 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 );
-    }
-
-    /* set control items */
-    gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_back"), FALSE );
-    gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_stop"), 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 );
-    gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_back"), FALSE );
-    gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_stop"), b_control );
-    gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_pause"), b_control );
-    gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_slow"), b_control );
-    gtk_widget_set_sensitive( GETWIDGET(p_popup, "popup_fast"), b_control );
-
-#undef GETWIDGET
-    return TRUE;
-}