DIALOG_EXPORT_2581:fix incorrect size of widgets when a very long field name exists

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17911
This commit is contained in:
jean-pierre charras 2024-04-30 18:16:05 +02:00
parent 17891f7a1d
commit 966051ff4a
5 changed files with 32 additions and 15 deletions

View File

@ -58,6 +58,10 @@ DIALOG_EXPORT_2581::DIALOG_EXPORT_2581( PCB_EDIT_FRAME* aParent ) :
m_textDistributor->SetSize( m_choiceDistPN->GetSize() );
// Fill wxChoice (and others) items with data before calling finishDialogSettings()
// to calculate suitable widgets sizes
Init();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}
@ -209,7 +213,7 @@ void DIALOG_EXPORT_2581::onDistPNChange( wxCommandEvent& event )
}
bool DIALOG_EXPORT_2581::TransferDataToWindow()
bool DIALOG_EXPORT_2581::Init()
{
PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();

View File

@ -48,8 +48,8 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_EXPORT_2581_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE</property>
<property name="size">531,358</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Export IPC-2581</property>
<property name="tooltip"></property>
@ -287,7 +287,7 @@
<object class="sizeritem" expanded="true">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">1</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="true">
<property name="id">wxID_ANY</property>
<property name="label">File Format</property>
@ -764,7 +764,7 @@
<object class="sizeritem" expanded="true">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
<property name="proportion">0</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="true">
<property name="id">wxID_ANY</property>
<property name="label">BOM Columns</property>
@ -780,7 +780,7 @@
<object class="wxFlexGridSizer" expanded="true">
<property name="cols">2</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
@ -1434,7 +1434,17 @@
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="true">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="true">
<property name="Apply">0</property>

View File

@ -104,7 +104,7 @@ private:
void onDistPNChange( wxCommandEvent& event ) override;
bool TransferDataToWindow() override;
bool Init();
bool TransferDataFromWindow() override;
PCB_EDIT_FRAME* m_parent;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf02)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -88,13 +88,14 @@ DIALOG_EXPORT_2581_BASE::DIALOG_EXPORT_2581_BASE( wxWindow* parent, wxWindowID i
sbSizer1->Add( fgSizer, 3, wxEXPAND|wxALL, 5 );
bSizer3->Add( sbSizer1, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 10 );
bSizer3->Add( sbSizer1, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 10 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("BOM Columns") ), wxVERTICAL );
wxFlexGridSizer* fgSizer4;
fgSizer4 = new wxFlexGridSizer( 0, 2, 5, 0 );
fgSizer4->AddGrowableCol( 1 );
fgSizer4->SetFlexibleDirection( wxBOTH );
fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
@ -161,11 +162,14 @@ DIALOG_EXPORT_2581_BASE::DIALOG_EXPORT_2581_BASE( wxWindow* parent, wxWindowID i
sbSizer2->Add( fgSizer4, 1, wxBOTTOM|wxEXPAND|wxRIGHT, 5 );
bSizer3->Add( sbSizer2, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 10 );
bSizer3->Add( sbSizer2, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 10 );
bMainSizer->Add( bSizer3, 0, wxEXPAND, 5 );
bMainSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_stdButtons = new wxStdDialogButtonSizer();
m_stdButtonsOK = new wxButton( this, wxID_OK );
m_stdButtons->AddButton( m_stdButtonsOK );
@ -173,12 +177,11 @@ DIALOG_EXPORT_2581_BASE::DIALOG_EXPORT_2581_BASE( wxWindow* parent, wxWindowID i
m_stdButtons->AddButton( m_stdButtonsCancel );
m_stdButtons->Realize();
bMainSizer->Add( m_stdButtons, 0, wxEXPAND|wxALL, 5 );
bMainSizer->Add( m_stdButtons, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
this->Centre( wxBOTH );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf02)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -78,7 +78,7 @@ class DIALOG_EXPORT_2581_BASE : public DIALOG_SHIM
public:
DIALOG_EXPORT_2581_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Export IPC-2581"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
DIALOG_EXPORT_2581_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Export IPC-2581"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 531,358 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EXPORT_2581_BASE();