Skip to content

Commit

Permalink
implement some minimum size of wx interface at all times. closes tick…
Browse files Browse the repository at this point in the history
…et #360.
  • Loading branch information
Scott Caudle committed Nov 21, 2005
1 parent 9342d5e commit 826fad1
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 22 deletions.
2 changes: 1 addition & 1 deletion doc/developer/configure.ac
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion doc/intf-cdda.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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$
2 changes: 1 addition & 1 deletion doc/intf-vcd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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$
2 changes: 1 addition & 1 deletion doc/subtitles/cvd-subtitles.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion doc/subtitles/svcd-ogt-subtitles.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion modules/gui/skins2/commands/cmd_minimize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
*
Expand Down
2 changes: 1 addition & 1 deletion modules/gui/skins2/commands/cmd_minimize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
*
Expand Down
2 changes: 1 addition & 1 deletion modules/gui/skins2/commands/cmd_playtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
*
Expand Down
2 changes: 1 addition & 1 deletion modules/gui/skins2/commands/cmd_playtree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
*
Expand Down
69 changes: 56 additions & 13 deletions modules/gui/wxwidgets/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 */

Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions modules/gui/wxwidgets/interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};


Expand Down

0 comments on commit 826fad1

Please sign in to comment.