/* Create slider */
slider = new wxSlider( this, SliderScroll_Event, 0, 0, SLIDER_MAX_POS );
+ /* Add mouse click on slider */
+ slider->Connect( wxEVT_LEFT_DOWN,
+ wxMouseEventHandler( InputManager::OnSliderClick ),
+ NULL, this );
/* Create disc buttons */
disc_frame = new wxPanel( this );
void InputManager::UpdateNowPlaying()
{
- char *psz_now_playing = vlc_input_item_GetInfo( p_input->input.p_item,
- _(VLC_META_INFO_CAT), _(VLC_META_NOW_PLAYING) );
+ char *psz_now_playing = p_input->input.p_item->p_meta->psz_nowplaying ?
+ strdup( p_input->input.p_item->p_meta->psz_nowplaying ):
+ strdup( "" );
if( psz_now_playing && *psz_now_playing )
{
p_main_intf->statusbar->SetStatusText(
vlc_mutex_unlock( &p_intf->change_lock );
}
+void InputManager::OnSliderClick( wxMouseEvent& event )
+{
+ wxSlider* slider = wxStaticCast( event.GetEventObject(), wxSlider );
+ int i_min = slider->GetMin();
+ int i_max = slider->GetMax();
+ int i_pos = event.GetPosition().x;
+ int i_dim = slider->GetClientSize().x;
+ int i_val = i_min + ( i_pos * ( i_max - i_min + 1 ) ) / i_dim;
+
+ if( i_pos < 0 || i_pos >= i_dim ) return;
+
+ vlc_mutex_lock( &p_intf->change_lock );
+
+ slider->SetValue( i_val );
+
+ if( i_slider_pos != i_val && p_intf->p_sys->p_input )
+ {
+ vlc_value_t pos;
+ pos.f_float = (float)i_val / (float)SLIDER_MAX_POS;
+ var_Set( p_intf->p_sys->p_input, "position", pos );
+ }
+
+ vlc_mutex_unlock( &p_intf->change_lock );
+
+ event.Skip();
+}
+
void InputManager::ShowSlider( bool show )
{
if( !!show == !!slider->IsShown() ) return;