Commit d1ba6299 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wince: better volume slider behaviour.

parent 80fcc80f
......@@ -108,7 +108,7 @@ Interface::Interface()
: hwndMain(0), hwndCB(0), hwndTB(0), hwndSlider(0), hwndLabel(0),
hwndVol(0), hwndSB(0),
fileinfo(0), messages(0), preferences(0), playlist(0),
timer(0), open(0), video(0)
timer(0), open(0), video(0), b_volume_hold(0)
{
}
......@@ -915,17 +915,34 @@ void Interface::OnChange( int wp )
if( LOWORD(wp) == SB_THUMBPOSITION || LOWORD(wp) == SB_ENDSCROLL )
{
Change( 200 - (int)dwPos );
VolumeChange( 200 - (int)dwPos );
b_volume_hold = VLC_FALSE;
}
else
{
b_volume_hold = VLC_TRUE;
}
}
void Interface::Change( int i_volume )
void Interface::VolumeChange( int i_volume )
{
aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_MAX / 200 / 2 );
#if 0
SetToolTip( wxString::Format((wxString)wxU(_("Volume")) + wxT(" %d"),
i_volume ) );
#endif
}
void Interface::VolumeUpdate()
{
audio_volume_t i_volume;
if( b_volume_hold ) return;
aout_VolumeGet( p_intf, &i_volume );
int i_volume_ctrl = 200 - i_volume * 200 * 2 / AOUT_VOLUME_MAX;
DWORD dwPos = SendMessage( hwndVol, TBM_GETPOS, 0, 0 );
if( i_volume_ctrl == (int)dwPos ) return;
SendMessage( hwndVol, TBM_SETPOS, 1, i_volume_ctrl );
}
void Interface::OnStopStream( void )
......@@ -982,3 +999,9 @@ void Interface::OnFastStream( void )
var_Set( p_input, "rate-faster", val );
vlc_object_release( p_input );
}
void Interface::Update()
{
/* Misc updates */
VolumeUpdate();
}
......@@ -118,12 +118,6 @@ void Timer::Notify( void )
p_main_interface->TogglePlayButton( PLAYING_S );
i_old_playing_status = PLAYING_S;
/* Take care of the volume */
audio_volume_t i_volume;
aout_VolumeGet( p_intf, &i_volume );
SendMessage( p_main_interface->hwndVol, TBM_SETPOS, 1,
200 - (i_volume * 200 * 2 / AOUT_VOLUME_MAX ) );
}
}
else if( p_intf->p_sys->p_input->b_dead )
......@@ -183,6 +177,9 @@ void Timer::Notify( void )
}
}
/* Take care of the volume, etc... */
p_main_interface->Update();
/* Manage Playing status */
var_Get( p_input, "state", &val );
if( i_old_playing_status != val.i_int )
......
......@@ -141,6 +141,7 @@ public:
HWND CreateMenuBar( HWND, HINSTANCE );
void TogglePlayButton( int i_playing_status );
void Update();
HWND hwndMain; // Handle to the main window.
......@@ -171,7 +172,8 @@ protected:
void OnSliderUpdate( int wp );
void OnChange( int wp );
void Change( int i_volume );
void VolumeChange( int i_volume );
void VolumeUpdate( void );
void OnStopStream( void );
void OnPrevStream( void );
void OnNextStream( void );
......@@ -185,6 +187,8 @@ private:
HMENU menu_video;
HMENU menu_audio;
HMENU menu_navigation;
vlc_bool_t b_volume_hold;
};
/* File Info */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment