Commit e214f2c2 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/*: new --wxwin-keep-size option to remember the size...

* modules/gui/wxwindows/*: new --wxwin-keep-size option to remember the size of the last embedded video.
parent a942c6c5
...@@ -69,10 +69,13 @@ private: ...@@ -69,10 +69,13 @@ private:
wxWindow *p_child_window; wxWindow *p_child_window;
vlc_bool_t b_remember_size;
wxSize video_size;
void UpdateSize( wxSizeEvent & ); void UpdateSize( wxSizeEvent & );
void UpdateHide( wxSizeEvent & ); void UpdateHide( wxSizeEvent & );
void OnControlEvent( wxCommandEvent & ); void OnControlEvent( wxCommandEvent & );
void OnSizeEvent( wxSizeEvent& );
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
}; };
...@@ -81,6 +84,7 @@ DEFINE_LOCAL_EVENT_TYPE( wxEVT_VLC_VIDEO ); ...@@ -81,6 +84,7 @@ DEFINE_LOCAL_EVENT_TYPE( wxEVT_VLC_VIDEO );
BEGIN_EVENT_TABLE(VideoWindow, wxWindow) BEGIN_EVENT_TABLE(VideoWindow, wxWindow)
EVT_CUSTOM( wxEVT_SIZE, UpdateSize_Event, VideoWindow::UpdateSize ) EVT_CUSTOM( wxEVT_SIZE, UpdateSize_Event, VideoWindow::UpdateSize )
EVT_CUSTOM( wxEVT_SIZE, UpdateHide_Event, VideoWindow::UpdateHide ) EVT_CUSTOM( wxEVT_SIZE, UpdateHide_Event, VideoWindow::UpdateHide )
EVT_SIZE( VideoWindow::OnSizeEvent )
EVT_COMMAND( SetStayOnTop_Event, wxEVT_VLC_VIDEO, EVT_COMMAND( SetStayOnTop_Event, wxEVT_VLC_VIDEO,
VideoWindow::OnControlEvent ) VideoWindow::OnControlEvent )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -119,7 +123,10 @@ VideoWindow::VideoWindow( intf_thread_t *_p_intf, wxWindow *_p_parent ): ...@@ -119,7 +123,10 @@ VideoWindow::VideoWindow( intf_thread_t *_p_intf, wxWindow *_p_parent ):
p_intf->p_sys->p_video_sizer = new wxBoxSizer( wxHORIZONTAL ); p_intf->p_sys->p_video_sizer = new wxBoxSizer( wxHORIZONTAL );
p_intf->p_sys->p_video_sizer->Add( this, 1, wxEXPAND ); p_intf->p_sys->p_video_sizer->Add( this, 1, wxEXPAND );
b_remember_size = VLC_FALSE;
ReleaseWindow( NULL ); ReleaseWindow( NULL );
b_remember_size = config_GetInt( p_intf, "wxwin-keep-size" );
} }
VideoWindow::~VideoWindow() VideoWindow::~VideoWindow()
...@@ -176,6 +183,14 @@ void *VideoWindow::GetWindow( vout_thread_t *_p_vout, ...@@ -176,6 +183,14 @@ void *VideoWindow::GetWindow( vout_thread_t *_p_vout,
p_vout = _p_vout; p_vout = _p_vout;
/* Force old size */
if( b_remember_size &&
video_size.GetWidth() && video_size.GetHeight() )
{
*pi_width_hint = video_size.GetWidth();
*pi_height_hint = video_size.GetHeight();
}
wxSizeEvent event( wxSize(*pi_width_hint, *pi_height_hint), wxSizeEvent event( wxSize(*pi_width_hint, *pi_height_hint),
UpdateSize_Event ); UpdateSize_Event );
AddPendingEvent( event ); AddPendingEvent( event );
...@@ -214,6 +229,8 @@ void VideoWindow::ReleaseWindow( void *p_window ) ...@@ -214,6 +229,8 @@ void VideoWindow::ReleaseWindow( void *p_window )
p_vout = NULL; p_vout = NULL;
if( b_remember_size ) video_size = GetClientSize();
#if defined(__WXGTK__) || defined(WIN32) #if defined(__WXGTK__) || defined(WIN32)
wxSizeEvent event( wxSize(0, 0), UpdateHide_Event ); wxSizeEvent event( wxSize(0, 0), UpdateHide_Event );
AddPendingEvent( event ); AddPendingEvent( event );
...@@ -230,6 +247,7 @@ void VideoWindow::UpdateSize( wxSizeEvent &event ) ...@@ -230,6 +247,7 @@ void VideoWindow::UpdateSize( wxSizeEvent &event )
p_intf->p_sys->p_video_sizer->Layout(); p_intf->p_sys->p_video_sizer->Layout();
SetFocus(); SetFocus();
} }
p_intf->p_sys->p_video_sizer->SetMinSize( event.GetSize() ); p_intf->p_sys->p_video_sizer->SetMinSize( event.GetSize() );
wxCommandEvent intf_event( wxEVT_INTF, 0 ); wxCommandEvent intf_event( wxEVT_INTF, 0 );
...@@ -261,6 +279,18 @@ void VideoWindow::OnControlEvent( wxCommandEvent &event ) ...@@ -261,6 +279,18 @@ void VideoWindow::OnControlEvent( wxCommandEvent &event )
} }
} }
void VideoWindow::OnSizeEvent( wxSizeEvent &event )
{
/* Ignore if no vout */
if( p_vout )
p_intf->p_sys->p_video_sizer->SetMinSize( event.GetSize() );
if( b_remember_size )
video_size = GetClientSize();
event.Skip();
}
static int ControlWindow( intf_thread_t *p_intf, void *p_window, static int ControlWindow( intf_thread_t *p_intf, void *p_window,
int i_query, va_list args ) int i_query, va_list args )
{ {
......
...@@ -83,6 +83,10 @@ private: ...@@ -83,6 +83,10 @@ private:
#define EMBED_TEXT N_("Embed video in interface") #define EMBED_TEXT N_("Embed video in interface")
#define EMBED_LONGTEXT N_("Embed the video inside the interface instead " \ #define EMBED_LONGTEXT N_("Embed the video inside the interface instead " \
"of having it in a separate window.") "of having it in a separate window.")
#define KEEP_SIZE_TEXT N_("Remember the size of the embedded video")
#define KEEP_SIZE_LONGTEXT N_("Remember the size of the last embedded " \
"video and apply it to new videos. The default behaviour is to adjust " \
"the size of the embedded video to match the resolution of the video.")
#define BOOKMARKS_TEXT N_("Show bookmarks dialog") #define BOOKMARKS_TEXT N_("Show bookmarks dialog")
#define BOOKMARKS_LONGTEXT N_("Show bookmarks dialog when the interface " \ #define BOOKMARKS_LONGTEXT N_("Show bookmarks dialog when the interface " \
"starts.") "starts.")
...@@ -103,6 +107,8 @@ vlc_module_begin(); ...@@ -103,6 +107,8 @@ vlc_module_begin();
add_bool( "wxwin-embed", 1, NULL, add_bool( "wxwin-embed", 1, NULL,
EMBED_TEXT, EMBED_LONGTEXT, VLC_FALSE ); EMBED_TEXT, EMBED_LONGTEXT, VLC_FALSE );
add_bool( "wxwin-keep-size", 0, NULL,
KEEP_SIZE_TEXT, KEEP_SIZE_LONGTEXT, VLC_FALSE );
add_bool( "wxwin-bookmarks", 0, NULL, add_bool( "wxwin-bookmarks", 0, NULL,
BOOKMARKS_TEXT, BOOKMARKS_LONGTEXT, VLC_FALSE ); BOOKMARKS_TEXT, BOOKMARKS_LONGTEXT, VLC_FALSE );
......
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