/*****************************************************************************
* timer.cpp : wxWindows plugin for vlc
*****************************************************************************
- * Copyright (C) 2000-2003 VideoLAN
+ * Copyright (C) 2000-2005 VideoLAN
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
#include <vlc/aout.h>
#include <vlc/intf.h>
+#include "vlc_meta.h"
+
#include "wxwindows.h"
#include <wx/timer.h>
var_DelCallback( p_playlist, "intf-show", IntfShowCB, p_intf );
vlc_object_release( p_playlist );
}
+
+ vlc_mutex_lock( &p_intf->change_lock );
+ if( p_intf->p_sys->p_input ) vlc_object_release( p_intf->p_sys->p_input );
+ p_intf->p_sys->p_input = NULL;
+ vlc_mutex_unlock( &p_intf->change_lock );
}
/*****************************************************************************
/* Update the input */
if( p_intf->p_sys->p_input == NULL )
{
- p_intf->p_sys->p_input =
- (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
- FIND_ANYWHERE );
+ playlist_t *p_playlist =
+ (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+ FIND_ANYWHERE );
+ if( p_playlist != NULL )
+ {
+ LockPlaylist( p_intf->p_sys, p_playlist );
+ p_intf->p_sys->p_input = p_playlist->p_input;
+ if( p_intf->p_sys->p_input )
+ vlc_object_yield( p_intf->p_sys->p_input );
+ UnlockPlaylist( p_intf->p_sys, p_playlist );
+ vlc_object_release( p_playlist );
+ }
/* Refresh interface */
if( p_intf->p_sys->p_input )
{
p_main_interface->slider->SetValue( 0 );
- b_old_seekable = VLC_FALSE;
- p_main_interface->statusbar->SetStatusText(
- wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 );
+ char *psz_now_playing = vlc_input_item_GetInfo(
+ p_intf->p_sys->p_input->input.p_item,
+ _("Meta-information"), _( "Now Playing" ) );
+ if( psz_now_playing && *psz_now_playing )
+ {
+ p_main_interface->statusbar->SetStatusText(
+ wxString(wxU(psz_now_playing)) + wxT( " - " ) +
+ wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 );
+ }
+ else
+ {
+ p_main_interface->statusbar->SetStatusText(
+ wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 );
+ }
+ free( psz_now_playing );
p_main_interface->TogglePlayButton( PLAYING_S );
+#ifdef wxHAS_TASK_BAR_ICON
+ if( p_main_interface->p_systray )
+ {
+ p_main_interface->p_systray->UpdateTooltip( wxU(p_intf->p_sys->p_input->input.p_item->psz_name) + wxString(wxT(" - ")) + wxU(_("Playing")));
+ }
+#endif
i_old_playing_status = PLAYING_S;
}
}
else if( p_intf->p_sys->p_input->b_dead )
{
- /* Hide slider */
- p_main_interface->slider_frame->Hide();
- p_main_interface->frame_sizer->Hide(
- p_main_interface->slider_frame );
- p_main_interface->frame_sizer->Layout();
- p_main_interface->frame_sizer->Fit( p_main_interface );
+ //controls auto-hide after a timer
+ p_main_interface->m_controls_timer.Start(200, wxTIMER_ONE_SHOT);
p_main_interface->TogglePlayButton( PAUSE_S );
i_old_playing_status = PAUSE_S;
p_main_interface->statusbar->SetStatusText( wxT(""), 0 );
p_main_interface->statusbar->SetStatusText( wxT(""), 2 );
+#ifdef wxHAS_TASK_BAR_ICON
+ if( p_main_interface->p_systray )
+ {
+ p_main_interface->p_systray->UpdateTooltip( wxString(wxT("VLC media player - ")) + wxU(_("Stopped")) );
+ }
+#endif
vlc_object_release( p_intf->p_sys->p_input );
p_intf->p_sys->p_input = NULL;
}
-
if( p_intf->p_sys->p_input )
{
input_thread_t *p_input = p_intf->p_sys->p_input;
{
vlc_value_t pos;
+ //prevent the controls from auto-hiding
+ p_main_interface->m_controls_timer.Stop();
+
/* New input or stream map change */
p_intf->p_sys->b_playing = 1;
/* Update the item name */
- p_main_interface->statusbar->SetStatusText(
- wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 );
+ char *psz_now_playing = vlc_input_item_GetInfo(
+ p_intf->p_sys->p_input->input.p_item,
+ _("Meta-information"), _( "Now Playing" ) );
+ if( psz_now_playing && *psz_now_playing )
+ {
+ p_main_interface->statusbar->SetStatusText(
+ wxString(wxU(psz_now_playing)) + wxT( " - " ) +
+ wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 );
+ }
+ else
+ {
+ p_main_interface->statusbar->SetStatusText(
+ wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 );
+ }
+ free( psz_now_playing );
/* Manage the slider */
- /* FIXME --fenrir */
- /* Change the name of b_old_seekable into b_show_bar or something like that */
var_Get( p_input, "position", &pos );
- if( !b_old_seekable )
+ var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL );
+ if( val.i_int > 0 && !p_main_interface->disc_menu_button->IsShown() )
{
- if( pos.f_float > 0.0 )
- {
- /* Done like this, as it's the only way to know if the slider
- * has to be displayed */
- b_old_seekable = VLC_TRUE;
- p_main_interface->slider_frame->Show();
- p_main_interface->frame_sizer->Show(
- p_main_interface->slider_frame );
- p_main_interface->frame_sizer->Layout();
- p_main_interface->frame_sizer->Fit( p_main_interface );
+ vlc_value_t val;
+ #define HELP_MENU N_("Menu")
+ #define HELP_PCH N_("Previous chapter")
+ #define HELP_NCH N_("Next chapter")
+ #define HELP_PTR N_("Previous track")
+ #define HELP_NTR N_("Next track")
+
+ var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &val,
+ NULL );
+
+ if( val.i_int > 0 )
+ {
+ p_main_interface->disc_menu_button->Show();
+ p_main_interface->disc_sizer->Show(
+ p_main_interface->disc_menu_button );
+ p_main_interface->disc_sizer->Layout();
+ p_main_interface->disc_sizer->Fit(
+ p_main_interface->disc_frame );
+ p_main_interface->disc_menu_button->SetToolTip(
+ wxU(_( HELP_MENU ) ) );
+ p_main_interface->disc_prev_button->SetToolTip(
+ wxU(_( HELP_PCH ) ) );
+ p_main_interface->disc_next_button->SetToolTip(
+ wxU(_( HELP_NCH ) ) );
}
+ else
+ {
+ p_main_interface->disc_menu_button->Hide();
+ p_main_interface->disc_sizer->Hide(
+ p_main_interface->disc_menu_button );
+
+ p_main_interface->disc_prev_button->SetToolTip(
+ wxU(_( HELP_PTR ) ) );
+ p_main_interface->disc_next_button->SetToolTip(
+ wxU(_( HELP_NTR ) ) );
+ }
+
+ p_main_interface->ShowDiscFrame();
+ }
+
+
+ if( pos.f_float > 0.0 )
+ {
+ /* Show the slider if it's position is significant */
+ p_main_interface->ShowSlider();
+ }
+ else
+ {
+ p_main_interface->m_slider_timer.Start(200, wxTIMER_ONE_SHOT);
}
- if( p_intf->p_sys->b_playing && b_old_seekable )
+ if( p_intf->p_sys->b_playing &&
+ p_main_interface->slider_frame->IsShown() )
{
/* Update the slider if the user isn't dragging it. */
if( p_intf->p_sys->b_slider_free )
}
#if 0
vlc_mutex_lock( &p_input->stream.stream_lock );
- if( p_intf->p_sys->p_input->stream.b_seekable && !b_old_seekable )
+ if( p_intf->p_sys->p_input->stream.b_seekable &&
+ !p_main_interface->slider_frame->IsShown() )
{
/* Done like this because b_seekable is set slightly after
* the new input object is available. */
- b_old_seekable = VLC_TRUE;
- p_main_interface->slider_frame->Show();
- p_main_interface->frame_sizer->Show(
- p_main_interface->slider_frame );
- p_main_interface->frame_sizer->Layout();
- p_main_interface->frame_sizer->Fit( p_main_interface );
+ p_main_interface->ShowSlider();
}
if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
{
{
p_main_interface->TogglePlayButton( PLAYING_S );
}
+#ifdef wxHAS_TASK_BAR_ICON
+ if( p_main_interface->p_systray )
+ {
+ if( val.i_int == PAUSE_S )
+ {
+ p_main_interface->p_systray->UpdateTooltip( wxU(p_intf->p_sys->p_input->input.p_item->psz_name) + wxString(wxT(" - ")) + wxU(_("Paused")));
+ }
+ else
+ {
+ p_main_interface->p_systray->UpdateTooltip( wxU(p_intf->p_sys->p_input->input.p_item->psz_name) + wxString(wxT(" - ")) + wxU(_("Playing")));
+ }
+ }
+#endif
i_old_playing_status = val.i_int;
}
i_old_rate = val.i_int;
}
}
-
}
else if( p_intf->p_sys->b_playing && !p_intf->b_die )
{
return VLC_SUCCESS;
}
+
/*****************************************************************************
* IntfShowCB: callback triggered by the intf-show playlist variable.
*****************************************************************************/