]> git.sesse.net Git - vlc/commitdiff
* modules/gui/wxwindows: small cleanup + renamed wxwin-size-to-video into wxwin-autosize.
authorGildas Bazin <gbazin@videolan.org>
Fri, 15 Apr 2005 09:58:33 +0000 (09:58 +0000)
committerGildas Bazin <gbazin@videolan.org>
Fri, 15 Apr 2005 09:58:33 +0000 (09:58 +0000)
modules/gui/wxwindows/interface.cpp
modules/gui/wxwindows/timer.cpp
modules/gui/wxwindows/video.cpp
modules/gui/wxwindows/wxwindows.cpp
modules/gui/wxwindows/wxwindows.h

index 5fc069b75757110cf94581fdad0740e2699d4e20..f95153b02e00a73fd94a8cb921dc8970e56d6a6d 100644 (file)
@@ -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 );
index 1428a549c6abe7a190036a00bea54846aa53f70c..781768a136ff72730c4f781043b1e9d1a234f8af 100644 (file)
@@ -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;
 
index 1eafb75ed9d3846578c03b1f706bde795eb28e81..db13ec4457a3284f9d2f9817e50ca285e8cf82ce 100644 (file)
@@ -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) );
index 8388d6fee5b6433405cbbb35e22ef94ad71d6c4d..8c99cd3ce17ae10081f23a70f1422ad9cc21a241 100644 (file)
@@ -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;
 }
 
index 8782b765265c50347ff06552be054db9e515afb4..ee6eeb037e213c23f359333031c342b0cd3b3de2 100644 (file)
@@ -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;