]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/timer.cpp
* modules/gui/wxwindows/*: enable popup menu support in the "dialogs provider".
[vlc] / modules / gui / wxwindows / timer.cpp
index afc2b0cd14d219478cede173cd04270d5242f7a2..aca90bfa5ce0fce5c38201e47d3bf8829801ea9d 100644 (file)
@@ -2,7 +2,7 @@
  * timer.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: timer.cpp,v 1.21 2003/06/04 16:03:34 gbazin Exp $
+ * $Id: timer.cpp,v 1.27 2003/07/17 18:58:23 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -30,6 +30,7 @@
 #include <stdio.h>
 
 #include <vlc/vlc.h>
+#include <vlc/aout.h>
 
 #ifdef WIN32                                                 /* mingw32 hack */
 #undef Yield
@@ -50,8 +51,8 @@
 void DisplayStreamDate( wxControl *, intf_thread_t *, int );
 
 /* Callback prototype */
-int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
-                 vlc_value_t old_val, vlc_value_t new_val, void *param );
+static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
+                       vlc_value_t old_val, vlc_value_t new_val, void *param );
 
 /*****************************************************************************
  * Constructor.
@@ -69,8 +70,7 @@ Timer::Timer( intf_thread_t *_p_intf, Interface *_p_main_interface )
                                        FIND_ANYWHERE );
     if( p_playlist != NULL )
     {
-        var_AddCallback( p_playlist, "intf-popupmenu", PopupMenuCB,
-                        p_main_interface );
+        var_AddCallback( p_playlist, "intf-popupmenu", PopupMenuCB, p_intf );
         vlc_object_release( p_playlist );
     }
 
@@ -84,27 +84,6 @@ Timer::~Timer()
 /*****************************************************************************
  * Private methods.
  *****************************************************************************/
-/*****************************************************************************
- * wxModeManage: actualise the aspect of the interface whenever the input
- * changes.
- *****************************************************************************
- * The lock has to be taken before you call the function.
- *****************************************************************************/
-static int wxModeManage( intf_thread_t * p_intf )
-{
-    return 0;
-}
-
-/*****************************************************************************
- * wxSetupMenus: function that generates title/chapter/audio/subpic
- * menus with help from preceding functions
- *****************************************************************************
- * Function called with the lock on stream
- *****************************************************************************/
-static int wxSetupMenus( intf_thread_t * p_intf )
-{
-    return 0;
-}
 
 /*****************************************************************************
  * Manage: manage main thread messages
@@ -119,8 +98,9 @@ void Timer::Notify()
     vlc_mutex_lock( &p_intf->change_lock );
 
     /* If the "display popup" flag has changed */
-    if( p_main_interface->b_popup_change )
+    if( p_intf->p_sys->b_popup_change )
     {
+#if 0
         wxPoint mousepos = wxGetMousePosition();
 
         wxMouseEvent event = wxMouseEvent( wxEVT_RIGHT_UP );
@@ -128,19 +108,13 @@ void Timer::Notify()
         event.m_y = p_main_interface->ScreenToClient(mousepos).y;
 
         p_main_interface->AddPendingEvent(event);
+#endif
+        if( p_intf->p_sys->pf_show_dialog )
+            p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU, 0 );
 
-        p_main_interface->b_popup_change = VLC_FALSE;
+        p_intf->p_sys->b_popup_change = VLC_FALSE;
     }
 
-    /* Update the log window */
-    p_intf->p_sys->p_messages_window->UpdateLog();
-
-    /* Update the playlist */
-    p_intf->p_sys->p_playlist_window->UpdatePlaylist();
-
-    /* Update the fileinfo windows */
-    p_intf->p_sys->p_fileinfo_window->UpdateFileInfo();
-
     /* Update the input */
     if( p_intf->p_sys->p_input == NULL )
     {
@@ -165,11 +139,19 @@ void Timer::Notify()
 
             p_main_interface->TogglePlayButton( PLAYING_S );
             i_old_playing_status = PLAYING_S;
-        }
-
-        /* control buttons for free pace streams */
-        b_pace_control = p_intf->p_sys->p_input->stream.b_pace_control;
 
+            /* Take care of the volume */
+            audio_volume_t i_volume;
+            aout_VolumeGet( p_intf, &i_volume );
+            p_main_interface->volctrl->SetValue( i_volume * 200 /
+                                                 AOUT_VOLUME_MAX );
+            p_main_interface->volctrl->SetToolTip(
+                wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"),
+                i_volume * 200 / AOUT_VOLUME_MAX ) );
+
+            /* control buttons for free pace streams */
+            b_pace_control = p_intf->p_sys->p_input->stream.b_pace_control;
+        }
     }
     else if( p_intf->p_sys->p_input->b_dead )
     {
@@ -242,13 +224,6 @@ void Timer::Notify()
                 }
             }
 
-            if( p_intf->p_sys->i_part !=
-                p_input->stream.p_selected_area->i_part )
-            {
-                p_intf->p_sys->b_chapter_update = 1;
-                wxSetupMenus( p_intf );
-            }
-
             /* Manage Playing status */
             if( i_old_playing_status != p_input->stream.control.i_status )
             {
@@ -277,7 +252,6 @@ void Timer::Notify()
     }
     else if( p_intf->p_sys->b_playing && !p_intf->b_die )
     {
-        wxModeManage( p_intf );
         p_intf->p_sys->b_playing = 0;
         p_main_interface->TogglePlayButton( PAUSE_S );
         i_old_playing_status = PAUSE_S;
@@ -322,12 +296,12 @@ void DisplayStreamDate( wxControl *p_slider_frame, intf_thread_t * p_intf ,
  *  We don't show the menu directly here because we don't want the
  *  caller to block for a too long time.
  *****************************************************************************/
-int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
-                 vlc_value_t old_val, vlc_value_t new_val, void *param )
+static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
+                        vlc_value_t old_val, vlc_value_t new_val, void *param )
 {
-    Interface *p_main_interface = (Interface *)param;
+    intf_thread_t *p_intf = (intf_thread_t *)param;
 
-    p_main_interface->b_popup_change = VLC_TRUE;
+    p_intf->p_sys->b_popup_change = VLC_TRUE;
 
     return VLC_SUCCESS;
 }