From 5c6b19c55dc61f73f9473ce0e11eb15979d5235f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 19 Feb 2018 01:15:30 +0000 Subject: [PATCH] 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 --- common/dialog_shim.cpp | 15 ++++++++++----- common/dialogs/wx_html_report_panel_base.cpp | 6 +++--- common/dialogs/wx_html_report_panel_base.fbp | 10 +++++----- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/common/dialog_shim.cpp b/common/dialog_shim.cpp index 4d598cd039..d1c0e352d0 100644 --- a/common/dialog_shim.cpp +++ b/common/dialog_shim.cpp @@ -168,16 +168,21 @@ bool DIALOG_SHIM::Show( bool show ) ret = wxDialog::Show( show ); // 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 ) - SetSize( r.GetPosition().x, r.GetPosition().y, r.GetSize().x, r.GetSize().y, 0 ); + if( savedDialogRect.GetSize().x != 0 && savedDialogRect.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 { // Save the dialog's position & size before hiding, using classname as key - EDA_RECT r( wxDialog::GetPosition(), wxDialog::GetSize() ); - class_map[ hash_key ] = r; + class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() ); #ifdef __WXMAC__ if ( m_eventLoop ) diff --git a/common/dialogs/wx_html_report_panel_base.cpp b/common/dialogs/wx_html_report_panel_base.cpp index fc6636b82c..acf9eb9be5 100644 --- a/common/dialogs/wx_html_report_panel_base.cpp +++ b/common/dialogs/wx_html_report_panel_base.cpp @@ -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->SetMinSize( wxSize( -1,130 ) ); m_fgSizer = new wxFlexGridSizer( 2, 1, 0, 0 ); m_fgSizer->AddGrowableCol( 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->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; 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_box->Add( m_fgSizer, 1, wxEXPAND|wxALL, 5 ); + m_box->Add( m_fgSizer, 1, wxEXPAND, 5 ); this->SetSizer( m_box ); diff --git a/common/dialogs/wx_html_report_panel_base.fbp b/common/dialogs/wx_html_report_panel_base.fbp index 8fcd9c7de5..abdf17dc12 100644 --- a/common/dialogs/wx_html_report_panel_base.fbp +++ b/common/dialogs/wx_html_report_panel_base.fbp @@ -81,7 +81,7 @@ wxID_ANY Output messages: - + -1,130 m_box wxVERTICAL 1 @@ -89,7 +89,7 @@ 5 - wxEXPAND|wxALL + wxEXPAND 1 1 @@ -104,8 +104,8 @@ 2 0 - 5 - wxEXPAND + 2 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT 1 1 @@ -140,7 +140,7 @@ 0 - -1,100 + -1,-1 1 m_htmlView 1