Don't allow DIALOG_SHIM to reduce size below min.

This should fix a bunch of bugs with run-time generated sizes
that can grow larger than their minimums in other configurations.

Also fixes a related bug in the WX_HTML_REPORT_PANEL where the
min size was set in the wrong place.

Fixes: lp:1692442
* https://bugs.launchpad.net/kicad/+bug/1692442
This commit is contained in:
Jeff Young 2018-02-19 01:15:30 +00:00 committed by Wayne Stambaugh
parent c27ee1ece3
commit 5c6b19c55d
3 changed files with 18 additions and 13 deletions

View File

@ -168,16 +168,21 @@ bool DIALOG_SHIM::Show( bool show )
ret = wxDialog::Show( show ); ret = wxDialog::Show( show );
// classname is key, returns a zeroed out default EDA_RECT if none existed before. // classname is key, returns a zeroed out default EDA_RECT if none existed before.
EDA_RECT r = class_map[ hash_key ]; EDA_RECT savedDialogRect = class_map[ hash_key ];
if( r.GetSize().x != 0 && r.GetSize().y != 0 ) if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
SetSize( r.GetPosition().x, r.GetPosition().y, r.GetSize().x, r.GetSize().y, 0 ); {
SetSize( savedDialogRect.GetPosition().x,
savedDialogRect.GetPosition().y,
std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
0 );
}
} }
else else
{ {
// Save the dialog's position & size before hiding, using classname as key // Save the dialog's position & size before hiding, using classname as key
EDA_RECT r( wxDialog::GetPosition(), wxDialog::GetSize() ); class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() );
class_map[ hash_key ] = r;
#ifdef __WXMAC__ #ifdef __WXMAC__
if ( m_eventLoop ) if ( m_eventLoop )

View File

@ -13,6 +13,7 @@ WX_HTML_REPORT_PANEL_BASE::WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindow
{ {
m_box = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Output messages:") ), wxVERTICAL ); m_box = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Output messages:") ), wxVERTICAL );
m_box->SetMinSize( wxSize( -1,130 ) );
m_fgSizer = new wxFlexGridSizer( 2, 1, 0, 0 ); m_fgSizer = new wxFlexGridSizer( 2, 1, 0, 0 );
m_fgSizer->AddGrowableCol( 0 ); m_fgSizer->AddGrowableCol( 0 );
m_fgSizer->AddGrowableRow( 0 ); m_fgSizer->AddGrowableRow( 0 );
@ -21,9 +22,8 @@ WX_HTML_REPORT_PANEL_BASE::WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindow
m_htmlView = new wxHtmlWindow( m_box->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO ); m_htmlView = new wxHtmlWindow( m_box->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
m_htmlView->SetFont( wxFont( 10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) ); m_htmlView->SetFont( wxFont( 10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
m_htmlView->SetMinSize( wxSize( -1,100 ) );
m_fgSizer->Add( m_htmlView, 1, wxEXPAND, 5 ); m_fgSizer->Add( m_htmlView, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 2 );
wxFlexGridSizer* fgSizer3; wxFlexGridSizer* fgSizer3;
fgSizer3 = new wxFlexGridSizer( 1, 7, 0, 0 ); fgSizer3 = new wxFlexGridSizer( 1, 7, 0, 0 );
@ -66,7 +66,7 @@ WX_HTML_REPORT_PANEL_BASE::WX_HTML_REPORT_PANEL_BASE( wxWindow* parent, wxWindow
m_fgSizer->Add( fgSizer3, 1, wxEXPAND, 5 ); m_fgSizer->Add( fgSizer3, 1, wxEXPAND, 5 );
m_box->Add( m_fgSizer, 1, wxEXPAND|wxALL, 5 ); m_box->Add( m_fgSizer, 1, wxEXPAND, 5 );
this->SetSizer( m_box ); this->SetSizer( m_box );

View File

@ -81,7 +81,7 @@
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Output messages:</property> <property name="label">Output messages:</property>
<property name="minimum_size"></property> <property name="minimum_size">-1,130</property>
<property name="name">m_box</property> <property name="name">m_box</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property> <property name="parent">1</property>
@ -89,7 +89,7 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1"> <object class="wxFlexGridSizer" expanded="1">
<property name="cols">1</property> <property name="cols">1</property>
@ -104,8 +104,8 @@
<property name="rows">2</property> <property name="rows">2</property>
<property name="vgap">0</property> <property name="vgap">0</property>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">2</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxHtmlWindow" expanded="0"> <object class="wxHtmlWindow" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -140,7 +140,7 @@
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property> <property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size">-1,100</property> <property name="minimum_size">-1,-1</property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_htmlView</property> <property name="name">m_htmlView</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>