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