Commit a791789c authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows: small cleanup + renamed wxwin-size-to-video into wxwin-autosize.

parent 76f22c11
......@@ -363,9 +363,7 @@ void Interface::OnControlEvent( wxCommandEvent& event )
{
case 0:
{
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
if (size_to_video)
if( p_intf->p_sys->b_video_autosize )
{
frame_sizer->Layout();
frame_sizer->Fit(this);
......@@ -686,8 +684,6 @@ void Interface::HideSlider(bool layout)
void Interface::ShowSlider(bool show, bool layout)
{
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
if (show)
{
//prevent the hide timers from hiding it now
......@@ -719,7 +715,7 @@ void Interface::ShowSlider(bool show, bool layout)
if (layout)
{
frame_sizer->Layout();
if (size_to_video)
if ( p_intf->p_sys->b_video_autosize )
{
frame_sizer->Fit( this );
}
......@@ -733,8 +729,6 @@ void Interface::HideDiscFrame(bool layout)
void Interface::ShowDiscFrame(bool show, bool layout)
{
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
if (show)
{
//prevent the hide timer from hiding it now
......@@ -765,7 +759,7 @@ void Interface::ShowDiscFrame(bool show, bool layout)
if (layout)
{
slider_sizer->Layout();
if (size_to_video)
if ( p_intf->p_sys->b_video_autosize )
{
slider_sizer->Fit( slider_frame );
}
......@@ -778,15 +772,13 @@ void Interface::ShowDiscFrame(bool show, bool layout)
void Interface::OnControlsTimer(wxTimerEvent& WXUNUSED(event))
{
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
/* Hide slider and Disc Buttons */
//postpone layout, we'll do it ourselves
HideDiscFrame(false);
HideSlider(false);
slider_sizer->Layout();
if (size_to_video)
if ( p_intf->p_sys->b_video_autosize )
{
slider_sizer->Fit( slider_frame );
frame_sizer->Fit( this );
......
......@@ -161,8 +161,6 @@ void Timer::Notify()
}
else if( p_intf->p_sys->p_input->b_dead )
{
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
//controls auto-hide after a timer
p_main_interface->m_controls_timer.Start(1000, wxTIMER_ONE_SHOT);
......@@ -184,7 +182,6 @@ void Timer::Notify()
if( p_intf->p_sys->p_input )
{
int size_to_video = config_GetInt( p_intf, "wxwin-size-to-video" );
input_thread_t *p_input = p_intf->p_sys->p_input;
vlc_value_t val;
......
......@@ -111,7 +111,7 @@ VideoWindow::VideoWindow( intf_thread_t *_p_intf, wxWindow *_p_parent ):
vlc_mutex_init( p_intf, &lock );
b_auto_size = config_GetInt( p_intf, "wxwin-size-to-video" );
b_auto_size = config_GetInt( p_intf, "wxwin-autosize" );
p_vout = NULL;
......@@ -248,18 +248,16 @@ static void ReleaseWindow( intf_thread_t *p_intf, void *p_window )
void VideoWindow::ReleaseWindow( void *p_window )
{
if( !b_auto_size ) return;
vlc_mutex_lock( &lock );
p_vout = NULL;
vlc_mutex_unlock( &lock );
if( !b_auto_size ) return;
#if defined(__WXGTK__) || defined(WIN32)
wxSizeEvent event( wxSize(0, 0), UpdateHide_Event );
AddPendingEvent( event );
#endif
vlc_mutex_unlock( &lock );
}
void VideoWindow::UpdateSize( wxEvent &_event )
......@@ -297,7 +295,7 @@ void VideoWindow::OnHideTimer( wxTimerEvent& WXUNUSED(event))
b_shown = VLC_FALSE;
SetSize(0,0);
Hide();
Show();
}
//ok I cheat here, but is it ever not 0,0?
p_intf->p_sys->p_video_sizer->SetMinSize( wxSize(0,0) );
......
......@@ -123,7 +123,7 @@ vlc_module_begin();
TASKBAR_TEXT, TASKBAR_LONGTEXT, VLC_FALSE );
add_bool( "wxwin-minimal", 0, NULL,
MINIMAL_TEXT, MINIMAL_LONGTEXT, VLC_TRUE );
add_bool( "wxwin-size-to-video", 1, NULL,
add_bool( "wxwin-autosize", 1, NULL,
SIZE_TO_VIDEO_TEXT, SIZE_TO_VIDEO_LONGTEXT, VLC_TRUE );
#ifdef wxHAS_TASK_BAR_ICON
add_bool( "wxwin-systray", 0, NULL,
......@@ -178,9 +178,12 @@ static int Open( vlc_object_t *p_this )
/* We support play on start */
p_intf->b_play = VLC_TRUE;
/* */
/* Load saved window settings */
p_intf->p_sys->p_window_settings = new WindowSettings( p_intf );
p_intf->p_sys->b_video_autosize =
config_GetInt( p_intf, "wxwin-autosize" );
return VLC_SUCCESS;
}
......
......@@ -143,6 +143,7 @@ struct intf_sys_t
/* Embedded vout */
VideoWindow *p_video_window;
wxBoxSizer *p_video_sizer;
vlc_bool_t b_video_autosize;
/* Aout */
aout_instance_t *p_aout;
......
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