Commit cc0f6d1a authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows: bunch of small improvements to the embedded mode +...

* modules/gui/wxwindows: bunch of small improvements to the embedded mode + enabled saving size with --wxwin-autosize.
parent 6e7434a1
......@@ -278,10 +278,11 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
statusbar->SetStatusText( wxString::Format(wxT("x%.2f"), 1.0), 1 );
/* Video window */
video_window = 0;
if( config_GetInt( p_intf, "wxwin-embed" ) )
{
CreateVideoWindow( p_intf, this );
frame_sizer->Add( p_intf->p_sys->p_video_sizer, 1, wxEXPAND , 0 );
video_window = CreateVideoWindow( p_intf, this );
frame_sizer->Add( p_intf->p_sys->p_video_sizer, 1, wxEXPAND, 0 );
}
/* Creation of the slider sub-window */
......@@ -329,17 +330,13 @@ Interface::~Interface()
ws->SetSettings( WindowSettings::ID_MAIN, true,
GetPosition(), GetSize() );
if( video_window ) delete video_window;
#ifdef wxHAS_TASK_BAR_ICON
if( p_systray )
{
delete p_systray;
}
if( p_systray ) delete p_systray;
#endif
if( p_intf->p_sys->p_wxwindow )
{
delete p_intf->p_sys->p_wxwindow;
}
if( p_intf->p_sys->p_wxwindow ) delete p_intf->p_sys->p_wxwindow;
/* Clean up */
delete timer;
......@@ -677,120 +674,108 @@ void Interface::SetupHotkeys()
delete [] p_entries;
}
void Interface::HideSlider(bool layout)
void Interface::HideSlider( bool layout )
{
ShowSlider(false, layout);
ShowSlider( false, layout );
}
void Interface::ShowSlider(bool show, bool layout)
void Interface::ShowSlider( bool show, bool layout )
{
if (show)
{
//prevent the hide timers from hiding it now
m_slider_timer.Stop();
m_controls_timer.Stop();
//prevent continuous layout
if (slider_frame->IsShown())
if( show )
{
return;
}
//prevent the hide timers from hiding it now
m_slider_timer.Stop();
m_controls_timer.Stop();
slider_frame->Show();
frame_sizer->Show( slider_frame );
}
else
{
//prevent continuous layout
if( slider_frame->IsShown() ) return;
//prevent continuous layout
if (!slider_frame->IsShown())
{
return;
slider_frame->Show();
frame_sizer->Show( slider_frame );
}
else
{
//prevent continuous layout
if( !slider_frame->IsShown() ) return;
slider_frame->Hide();
frame_sizer->Hide( slider_frame );
}
slider_frame->Hide();
frame_sizer->Hide( slider_frame );
}
if (layout)
{
frame_sizer->Layout();
if ( p_intf->p_sys->b_video_autosize )
if( layout )
{
frame_sizer->Fit( this );
frame_sizer->Layout();
if( p_intf->p_sys->b_video_autosize )
{
UpdateVideoWindow( p_intf, video_window );
frame_sizer->Fit( this );
}
}
}
}
void Interface::HideDiscFrame(bool layout)
void Interface::HideDiscFrame( bool layout )
{
ShowDiscFrame(false, layout);
ShowDiscFrame( false, layout );
}
void Interface::ShowDiscFrame(bool show, bool layout)
void Interface::ShowDiscFrame( bool show, bool layout )
{
if (show)
{
//prevent the hide timer from hiding it now
m_controls_timer.Stop();
//prevent continuous layout
if (disc_frame->IsShown())
if( show )
{
return;
}
//prevent the hide timer from hiding it now
m_controls_timer.Stop();
disc_frame->Show();
slider_sizer->Show( disc_frame );
}
else
{
//prevent continuous layout
if( disc_frame->IsShown() ) return;
//prevent continuous layout
if (!disc_frame->IsShown())
{
return;
disc_frame->Show();
slider_sizer->Show( disc_frame );
}
else
{
//prevent continuous layout
if( !disc_frame->IsShown() ) return;
disc_frame->Hide();
slider_sizer->Hide( disc_frame );
}
disc_frame->Hide();
slider_sizer->Hide( disc_frame );
}
if (layout)
{
slider_sizer->Layout();
if ( p_intf->p_sys->b_video_autosize )
if( layout )
{
slider_sizer->Fit( slider_frame );
slider_sizer->Layout();
if( p_intf->p_sys->b_video_autosize )
{
UpdateVideoWindow( p_intf, video_window );
slider_sizer->Fit( slider_frame );
}
}
}
}
/*****************************************************************************
* Event Handlers.
*****************************************************************************/
void Interface::OnControlsTimer(wxTimerEvent& WXUNUSED(event))
void Interface::OnControlsTimer( wxTimerEvent& WXUNUSED(event) )
{
/* Hide slider and Disc Buttons */
//postpone layout, we'll do it ourselves
HideDiscFrame(false);
HideSlider(false);
slider_sizer->Layout();
if ( p_intf->p_sys->b_video_autosize )
{
slider_sizer->Fit( slider_frame );
frame_sizer->Fit( this );
}
/* Hide slider and Disc Buttons */
//postpone layout, we'll do it ourselves
HideDiscFrame( false );
HideSlider( false );
slider_sizer->Layout();
if( p_intf->p_sys->b_video_autosize )
{
slider_sizer->Fit( slider_frame );
UpdateVideoWindow( p_intf, video_window );
frame_sizer->Fit( this );
}
}
void Interface::OnSliderTimer(wxTimerEvent& WXUNUSED(event))
{
HideSlider();
void Interface::OnSliderTimer( wxTimerEvent& WXUNUSED(event) )
{
HideSlider();
}
void Interface::OnMenuOpen(wxMenuEvent& event)
void Interface::OnMenuOpen( wxMenuEvent& event )
{
#if defined( __WXMSW__ )
# define GetEventObject GetMenu
......
......@@ -99,6 +99,14 @@ wxWindow *CreateVideoWindow( intf_thread_t *p_intf, wxWindow *p_parent )
return new VideoWindow( p_intf, p_parent );
}
void UpdateVideoWindow( intf_thread_t *p_intf, wxWindow *p_window )
{
#if (wxCHECK_VERSION(2,5,0))
if( p_window && p_intf->p_sys->p_video_sizer && p_window->IsShown() )
p_intf->p_sys->p_video_sizer->SetMinSize( p_window->GetSize() );
#endif
}
/*****************************************************************************
* Constructor.
*****************************************************************************/
......@@ -144,7 +152,11 @@ VideoWindow::VideoWindow( intf_thread_t *_p_intf, wxWindow *_p_parent ):
b_shown = VLC_TRUE;
p_intf->p_sys->p_video_sizer = new wxBoxSizer( wxHORIZONTAL );
#if (wxCHECK_VERSION(2,5,0))
p_intf->p_sys->p_video_sizer->Add( this, 1, wxEXPAND|wxFIXED_MINSIZE );
#else
p_intf->p_sys->p_video_sizer->Add( this, 1, wxEXPAND );
#endif
ReleaseWindow( NULL );
}
......@@ -171,14 +183,12 @@ VideoWindow::~VideoWindow()
p_intf->pf_control_window = NULL;
vlc_mutex_unlock( &lock );
#if 0
if( !b_auto_size )
{
WindowSettings *ws = p_intf->p_sys->p_window_settings;
ws->SetSettings( WindowSettings::ID_VIDEO, true,
GetPosition(), GetSize() );
}
#endif
vlc_mutex_destroy( &lock );
}
......@@ -296,22 +306,18 @@ void VideoWindow::UpdateSize( wxEvent &_event )
void VideoWindow::UpdateHide( wxEvent &_event )
{
if( b_auto_size) m_hide_timer.Start( 200, wxTIMER_ONE_SHOT );
if( b_auto_size ) m_hide_timer.Start( 200, wxTIMER_ONE_SHOT );
}
void VideoWindow::OnHideTimer( wxTimerEvent& WXUNUSED(event))
{
//wxSizeEvent * event = (wxSizeEvent*)(&_event);
if( b_shown )
{
p_intf->p_sys->p_video_sizer->Show( this, FALSE );
Hide();
p_intf->p_sys->p_video_sizer->Layout();
b_shown = VLC_FALSE;
SetSize(0,0);
Show();
}
//ok I cheat here, but is it ever not 0,0?
p_intf->p_sys->p_video_sizer->SetMinSize( wxSize(0,0) );
wxCommandEvent intf_event( wxEVT_INTF, 0 );
......
......@@ -410,6 +410,9 @@ static void ShowDialog( intf_thread_t *p_intf, int i_dialog_event, int i_arg,
}
}
/*****************************************************************************
* WindowSettings utility class
*****************************************************************************/
WindowSettings::WindowSettings( intf_thread_t *_p_intf )
{
char *psz_org = NULL;
......@@ -539,6 +542,7 @@ WindowSettings::~WindowSettings( )
config_PutPsz( p_intf, "wxwin-config-last", sCfg.mb_str() );
}
void WindowSettings::SetScreen( int i_screen_w, int i_screen_h )
{
int i;
......
......@@ -154,6 +154,7 @@ struct intf_sys_t
*****************************************************************************/
wxArrayString SeparateEntries( wxString );
wxWindow *CreateVideoWindow( intf_thread_t *p_intf, wxWindow *p_parent );
void UpdateVideoWindow( intf_thread_t *p_intf, wxWindow *p_window );
wxWindow *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent );
wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
......@@ -420,7 +421,8 @@ private:
Timer *timer;
intf_thread_t *p_intf;
private:
wxWindow *video_window;
int i_old_playing_status;
/* For auto-generated menus */
......
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