From 826fad102b8560afb4a3b344bdc29c2eba57cb04 Mon Sep 17 00:00:00 2001 From: Scott Caudle Date: Mon, 21 Nov 2005 03:15:46 +0000 Subject: [PATCH] implement some minimum size of wx interface at all times. closes ticket #360. --- doc/developer/configure.ac | 2 +- doc/intf-cdda.txt | 2 +- doc/intf-vcd.txt | 2 +- doc/subtitles/cvd-subtitles.txt | 2 +- doc/subtitles/svcd-ogt-subtitles.txt | 2 +- modules/gui/skins2/commands/cmd_minimize.cpp | 2 +- modules/gui/skins2/commands/cmd_minimize.hpp | 2 +- modules/gui/skins2/commands/cmd_playtree.cpp | 2 +- modules/gui/skins2/commands/cmd_playtree.hpp | 2 +- modules/gui/wxwidgets/interface.cpp | 69 ++++++++++++++++---- modules/gui/wxwidgets/interface.hpp | 5 ++ 11 files changed, 70 insertions(+), 22 deletions(-) diff --git a/doc/developer/configure.ac b/doc/developer/configure.ac index f485f2dac7..b49dd1459a 100644 --- a/doc/developer/configure.ac +++ b/doc/developer/configure.ac @@ -1,4 +1,4 @@ -dnl $Id: configure.ac,v 1.2 2004/02/13 11:33:38 rocky Exp $ +dnl $Id$ dnl Process this file with autoconf to produce a configure script. AC_INIT(manual.xml.in,0.0.1) diff --git a/doc/intf-cdda.txt b/doc/intf-cdda.txt index 4a753e80fd..47a0669c47 100644 --- a/doc/intf-cdda.txt +++ b/doc/intf-cdda.txt @@ -447,4 +447,4 @@ analyze the contents of a CD. The tool cd-read from libcdio can be used to show the sectors of the CD or CD image or extract sectors. -$Id: intf-cdda.txt,v 1.6 2004/02/11 12:37:28 rocky Exp $ +$Id$ diff --git a/doc/intf-vcd.txt b/doc/intf-vcd.txt index 98e1473b90..9aecac2911 100644 --- a/doc/intf-vcd.txt +++ b/doc/intf-vcd.txt @@ -544,4 +544,4 @@ http://www.vcdhelp.com/ http://www.vcdimager.org/ http://www.vcdimager.org/guides/#guides -$Id: intf-vcd.txt,v 1.5 2004/02/11 12:37:28 rocky Exp $ +$Id$ diff --git a/doc/subtitles/cvd-subtitles.txt b/doc/subtitles/cvd-subtitles.txt index 055f0cb315..c471bbfe12 100644 --- a/doc/subtitles/cvd-subtitles.txt +++ b/doc/subtitles/cvd-subtitles.txt @@ -1,4 +1,4 @@ -$Id: cvd-subtitles.txt,v 1.4 2004/02/13 00:57:03 rocky Exp $ +$Id$ The following information is culled from information from Julio Sanchez Fernandez (http://subhandler.sourceforge.net) by Rocky Bernstein. diff --git a/doc/subtitles/svcd-ogt-subtitles.txt b/doc/subtitles/svcd-ogt-subtitles.txt index b2f3c5e0cc..ecde936b42 100644 --- a/doc/subtitles/svcd-ogt-subtitles.txt +++ b/doc/subtitles/svcd-ogt-subtitles.txt @@ -1,4 +1,4 @@ -$Id: svcd-ogt-subtitles.txt,v 1.2 2004/02/13 00:57:03 rocky Exp $ +$Id$ The following information is culled from information from Julio Sanchez Fernandez (http://subhandler.sourceforge.net) by Rocky Bernstein. diff --git a/modules/gui/skins2/commands/cmd_minimize.cpp b/modules/gui/skins2/commands/cmd_minimize.cpp index 2439b0e2c2..558d5de1c5 100644 --- a/modules/gui/skins2/commands/cmd_minimize.cpp +++ b/modules/gui/skins2/commands/cmd_minimize.cpp @@ -2,7 +2,7 @@ * cmd_minimize.cpp ***************************************************************************** * Copyright (C) 2003 the VideoLAN team - * $Id: cmd_fullscreen.cpp 6961 2004-03-05 17:34:23Z sam $ + * $Id$ * * Authors: Mohammed Adnène Trojette * diff --git a/modules/gui/skins2/commands/cmd_minimize.hpp b/modules/gui/skins2/commands/cmd_minimize.hpp index 23b8351928..f2de84adcf 100644 --- a/modules/gui/skins2/commands/cmd_minimize.hpp +++ b/modules/gui/skins2/commands/cmd_minimize.hpp @@ -2,7 +2,7 @@ * cmd_minimize.hpp ***************************************************************************** * Copyright (C) 2003 the VideoLAN team - * $Id: cmd_fullscreen.hpp 6961 2004-03-05 17:34:23Z sam $ + * $Id$ * * Authors: Mohammed Adnène Trojette * diff --git a/modules/gui/skins2/commands/cmd_playtree.cpp b/modules/gui/skins2/commands/cmd_playtree.cpp index 5504e3496f..f908f95267 100644 --- a/modules/gui/skins2/commands/cmd_playtree.cpp +++ b/modules/gui/skins2/commands/cmd_playtree.cpp @@ -2,7 +2,7 @@ * cmd_playtree.cpp ***************************************************************************** * Copyright (C) 2005 VideoLAN - * $Id: cmd_playlist.cpp 10101 2005-03-02 16:47:31Z robux4 $ + * $Id$ * * Authors: Antoine Cellerier * diff --git a/modules/gui/skins2/commands/cmd_playtree.hpp b/modules/gui/skins2/commands/cmd_playtree.hpp index eb3d2a45a3..ff9e796d85 100644 --- a/modules/gui/skins2/commands/cmd_playtree.hpp +++ b/modules/gui/skins2/commands/cmd_playtree.hpp @@ -2,7 +2,7 @@ * cmd_playtree.hpp ***************************************************************************** * Copyright (C) 2005 VideoLAN - * $Id: cmd_playlist.hpp 9934 2005-02-15 13:55:08Z courmisch $ + * $Id$ * * Authors: Antoine Cellerier * diff --git a/modules/gui/wxwidgets/interface.cpp b/modules/gui/wxwidgets/interface.cpp index 3318f175cb..8e119b6e5d 100644 --- a/modules/gui/wxwidgets/interface.cpp +++ b/modules/gui/wxwidgets/interface.cpp @@ -336,13 +336,32 @@ Interface::Interface( intf_thread_t *_p_intf, long style ): Move( p ); /* Set minimum window size to prevent user from glitching it */ + wxSize s2; s = GetSize(); + + /* save smallest possible default minimum size */ + default_size = GetSize(); + + /* save slider size for height only for MinSizing */ + slider_size = slider_sizer->GetSize(); + + /* and save extended gui size for MinSize scheme */ + s2 = extra_frame->GetSize(); + s2.SetWidth( s2.GetWidth() + + 2 * wxSystemSettings::GetMetric( wxSYS_FRAMESIZE_X ) ); + extended_size = s2; + + /* Set initial minimum window size */ if( config_GetInt( p_intf, "wx-embed" ) ) { - wxSize s2; s2 = video_window->GetSize(); s.SetHeight( s.GetHeight() - s2.GetHeight() ); } + if( config_GetInt( p_intf, "wx-extended" ) ) + { + s.SetWidth( extended_size.GetWidth() ); + s.SetHeight( s.GetHeight() + extended_size.GetHeight() ); + } #if (wxCHECK_VERSION(2,5,4)) SetMinSize( s ); #else @@ -506,22 +525,14 @@ void Interface::CreateOurMenuBar() HDC hdc = GetDC( NULL ); for( unsigned int i = 0; i < menubar->GetMenuCount(); i++ ) { - // [ MENU BUTTON WIDTH CALCULATION ] - // [ SM_CXDLGFRAME + pixels + textextent + pixels + SM_CXDLGFRAME ] GetTextExtentPoint32( hdc, menubar->GetLabelTop(i).c_str(), menubar->GetLabelTop(i).Length(), &sizing ); - // + text size.. - i_size += sizing.cx; - // +1 more pixel on each size - i_size += 2; - // width of 2 DLGFRAME - i_size += GetSystemMetrics( SM_CXDLGFRAME ) * 2; + + // [ SM_CXDLGFRAME + pixels + textextent + pixels + SM_CXDLGFRAME ] + i_size += sizing.cx + 2 + GetSystemMetrics( SM_CXDLGFRAME ) * 2; } ReleaseDC( NULL, hdc ); - // Width of 2 edges of app window - i_size += GetSystemMetrics( SM_CXSIZEFRAME ) * 2; - // + 2 more pixels on each side.. - i_size += 4; + i_size += GetSystemMetrics( SM_CXSIZEFRAME ) * 2 + 4; #endif /* End patch by zcot */ @@ -762,11 +773,27 @@ void Interface::ShowSlider( bool show, bool layout ) //prevent continuous layout if( slider_frame->IsShown() ) return; + + wxSize ms = GetMinSize(); + ms.SetHeight( ms.GetHeight() + slider_size.GetHeight() ); +#if ( wxCHECK_VERSION( 2,5,4 ) ) + SetMinSize( ms ); +#else + frame_sizer->SetMinSize( ms ); +#endif } else { //prevent continuous layout if( !slider_frame->IsShown() ) return; + + wxSize ms = GetMinSize(); + ms.SetHeight( ms.GetHeight() - slider_size.GetHeight() ); +#if ( wxCHECK_VERSION( 2,5,4 ) ) + SetMinSize( ms ); +#else + frame_sizer->SetMinSize( ms ); +#endif } if( layout && p_intf->p_sys->b_video_autosize ) @@ -1009,11 +1036,27 @@ void Interface::OnExtended(wxCommandEvent& event) { extra_frame->Hide(); frame_sizer->Hide( extra_frame ); + wxSize ms = GetMinSize(); + ms.SetHeight( ms.GetHeight() - extended_size.GetHeight() ); + ms.SetWidth( default_size.GetWidth() ); +#if ( wxCHECK_VERSION( 2,5,4 ) ) + SetMinSize( ms ); +#else + frame_sizer->SetMinSize( ms ); +#endif } else { extra_frame->Show(); frame_sizer->Show( extra_frame ); + wxSize ms = GetMinSize(); + ms.SetHeight( ms.GetHeight() + extended_size.GetHeight() ); + ms.SetWidth( extended_size.GetWidth() ); +#if ( wxCHECK_VERSION( 2,5,4 ) ) + SetMinSize( ms ); +#else + frame_sizer->SetMinSize( ms ); +#endif } frame_sizer->Layout(); frame_sizer->Fit(this); diff --git a/modules/gui/wxwidgets/interface.hpp b/modules/gui/wxwidgets/interface.hpp index f1f58fbff2..c9e0b2b790 100644 --- a/modules/gui/wxwidgets/interface.hpp +++ b/modules/gui/wxwidgets/interface.hpp @@ -187,6 +187,11 @@ namespace wxvlc wxMenu *p_audio_menu; wxMenu *p_video_menu; wxMenu *p_navig_menu; + + /* utility dimensions */ + wxSize default_size; + wxSize extended_size; + wxSize slider_size; }; -- 2.39.2