Force re-word-wrapping of PCM package descriptions on Mac.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13328
(cherry picked from commit c7730eae3f
)
This commit is contained in:
parent
6d996e31b8
commit
3c4286c98b
|
@ -51,7 +51,8 @@ PANEL_PACKAGE::PANEL_PACKAGE( wxWindow* parent, const ActionCallback& aCallback,
|
||||||
m_minHeight = GetMinHeight();
|
m_minHeight = GetMinHeight();
|
||||||
|
|
||||||
double descLineHeight = m_desc->GetTextExtent( wxT( "X" ) ).GetHeight() * 1.2 /* leading */;
|
double descLineHeight = m_desc->GetTextExtent( wxT( "X" ) ).GetHeight() * 1.2 /* leading */;
|
||||||
m_desc->SetLabel( m_data.package.description );
|
m_desc->SetLabelText( m_data.package.description );
|
||||||
|
m_desc->Wrap( m_descSizer->GetSize().GetWidth() );
|
||||||
descLineHeight = wxSplit( m_desc->GetLabel(), '\n' ).size() * descLineHeight;
|
descLineHeight = wxSplit( m_desc->GetLabel(), '\n' ).size() * descLineHeight;
|
||||||
|
|
||||||
int nameLineHeight = m_name->GetTextExtent( wxT( "X" ) ).GetHeight();
|
int nameLineHeight = m_name->GetTextExtent( wxT( "X" ) ).GetHeight();
|
||||||
|
@ -80,6 +81,16 @@ PANEL_PACKAGE::PANEL_PACKAGE( wxWindow* parent, const ActionCallback& aCallback,
|
||||||
void PANEL_PACKAGE::OnSize( wxSizeEvent& event )
|
void PANEL_PACKAGE::OnSize( wxSizeEvent& event )
|
||||||
{
|
{
|
||||||
Layout();
|
Layout();
|
||||||
|
|
||||||
|
double descLineHeight = m_desc->GetTextExtent( wxT( "X" ) ).GetHeight() * 1.2 /* leading */;
|
||||||
|
m_desc->SetLabelText( m_data.package.description );
|
||||||
|
m_desc->Wrap( m_descSizer->GetSize().GetWidth() );
|
||||||
|
descLineHeight = wxSplit( m_desc->GetLabel(), '\n' ).size() * descLineHeight;
|
||||||
|
|
||||||
|
int nameLineHeight = m_name->GetTextExtent( wxT( "X" ) ).GetHeight();
|
||||||
|
wxSize minSize = GetMinSize();
|
||||||
|
minSize.y = std::max( nameLineHeight + KiROUND( descLineHeight ) + 15, m_minHeight );
|
||||||
|
SetMinSize( minSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -54,9 +54,14 @@ PANEL_PACKAGE_BASE::PANEL_PACKAGE_BASE( wxWindow* parent, wxWindowID id, const w
|
||||||
wxBoxSizer* bSizer3;
|
wxBoxSizer* bSizer3;
|
||||||
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
|
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
|
m_descSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
m_desc = new wxStaticText( this, wxID_ANY, _("Description"), wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE );
|
m_desc = new wxStaticText( this, wxID_ANY, _("Description"), wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE );
|
||||||
m_desc->Wrap( -1 );
|
m_desc->Wrap( -1 );
|
||||||
bSizer3->Add( m_desc, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
m_descSizer->Add( m_desc, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizer3->Add( m_descSizer, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
wxBoxSizer* bSizer4;
|
wxBoxSizer* bSizer4;
|
||||||
bSizer4 = new wxBoxSizer( wxVERTICAL );
|
bSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
|
@ -259,6 +259,15 @@
|
||||||
<property name="name">bSizer3</property>
|
<property name="name">bSizer3</property>
|
||||||
<property name="orient">wxHORIZONTAL</property>
|
<property name="orient">wxHORIZONTAL</property>
|
||||||
<property name="permission">none</property>
|
<property name="permission">none</property>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxEXPAND</property>
|
||||||
|
<property name="proportion">1</property>
|
||||||
|
<object class="wxBoxSizer" expanded="1">
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="name">m_descSizer</property>
|
||||||
|
<property name="orient">wxVERTICAL</property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
|
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxLEFT</property>
|
||||||
|
@ -320,6 +329,8 @@
|
||||||
<property name="wrap">-1</property>
|
<property name="wrap">-1</property>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxEXPAND</property>
|
<property name="flag">wxEXPAND</property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -38,6 +38,7 @@ class PANEL_PACKAGE_BASE : public wxPanel
|
||||||
protected:
|
protected:
|
||||||
wxStaticBitmap* m_bitmap;
|
wxStaticBitmap* m_bitmap;
|
||||||
wxStaticText* m_name;
|
wxStaticText* m_name;
|
||||||
|
wxBoxSizer* m_descSizer;
|
||||||
wxStaticText* m_desc;
|
wxStaticText* m_desc;
|
||||||
wxButton* m_button;
|
wxButton* m_button;
|
||||||
SPLIT_BUTTON* m_splitButton;
|
SPLIT_BUTTON* m_splitButton;
|
||||||
|
|
Loading…
Reference in New Issue