Pcb calculator panels: ensure sizer are correctly updated.

On wxWidgets 3.0, SetSizeHints must be called once the panel is fully populated.
On wxWidgets 3.1.5, SetSizeHints is not mandatory but can be called to ensure
right sizes once the panel is fully populated.
This commit is contained in:
jean-pierre charras 2021-10-09 09:07:18 +02:00
parent 895f4ca989
commit 2662433374
9 changed files with 35 additions and 6 deletions

View File

@ -47,6 +47,7 @@ PANEL_ATTENUATORS::PANEL_ATTENUATORS( wxWindow* parent, wxWindowID id,
m_AttenuatorList.push_back( new ATTENUATOR_BRIDGE() );
m_AttenuatorList.push_back( new ATTENUATOR_SPLITTER() );
m_CurrAttenuator = m_AttenuatorList[0];
SetAttenuator( 0 ); // Ensure an attenuator and especially its bitmap are set
m_staticTextAttMsg->SetFont( KIUI::GetInfoFont( this ).Italic() );
@ -55,6 +56,9 @@ PANEL_ATTENUATORS::PANEL_ATTENUATORS( wxWindow* parent, wxWindowID id,
m_attR1Unit->SetLabel( wxT( "" ) );
m_attR2Unit->SetLabel( wxT( "" ) );
m_attR3Unit->SetLabel( wxT( "" ) );
// Needed on wxWidgets 3.0 to ensure sizers are correctly set
GetSizer()->SetSizeHints( this );
}

View File

@ -30,6 +30,9 @@ PANEL_BOARD_CLASS::PANEL_BOARD_CLASS( wxWindow* parent, wxWindowID id,
{
// Autosize the row label column to be sure label are not truncated
m_gridClassesValuesDisplay->SetRowLabelSize( wxGRID_AUTOSIZE );
// Needed on wxWidgets 3.0 to ensure sizers are correctly set
GetSizer()->SetSizeHints( this );
}

View File

@ -30,6 +30,9 @@ PANEL_COLOR_CODE::PANEL_COLOR_CODE( wxWindow* parent, wxWindowID id,
{
initColorCodePanel();
ToleranceSelection( m_rbToleranceSelection->GetSelection() );
// Needed on wxWidgets 3.0 to ensure sizers are correctly set
GetSizer()->SetSizeHints( this );
}

View File

@ -115,6 +115,9 @@ PANEL_ELECTRICAL_SPACING::PANEL_ELECTRICAL_SPACING( wxWindow* parent, wxWindowID
{
// Autosize the row label column to be sure label are not truncated
m_gridElectricalSpacingValues->SetRowLabelSize( wxGRID_AUTOSIZE );
// Needed on wxWidgets 3.0 to ensure sizers are correctly set
GetSizer()->SetSizeHints( this );
}

View File

@ -41,6 +41,14 @@ PANEL_E_SERIE::PANEL_E_SERIE( wxWindow* parent, wxWindowID id,
m_reqResUnits->SetLabel( wxT( "kΩ" ) );
m_exclude1Units->SetLabel( wxT( "kΩ" ) );
m_exclude2Units->SetLabel( wxT( "kΩ" ) );
// show markdown formula explanation in lower help panel
wxString msg;
ConvertMarkdown2Html( wxGetTranslation( eseries_help ), msg );
m_panelESeriesHelp->SetPage( msg );
// Needed on wxWidgets 3.0 to ensure sizers are correctly set
GetSizer()->SetSizeHints( this );
}
@ -63,10 +71,4 @@ void PANEL_E_SERIE::SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg )
void PANEL_E_SERIE::LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg )
{
// initialize ESeries tab at each pcb-calculator start
wxString msg;
// show markdown formula explanation in lower help panel
ConvertMarkdown2Html( wxGetTranslation( eseries_help ), msg );
m_panelESeriesHelp->SetPage( msg );
}

View File

@ -53,6 +53,9 @@ PANEL_REGULATOR::PANEL_REGULATOR( wxWindow* parent, wxWindowID id,
m_choiceRegulatorSelector->Append( m_RegulatorList.GetRegList() );
SelectLastSelectedRegulator();
// Needed on wxWidgets 3.0 to ensure sizers are correctly set
GetSizer()->SetSizeHints( this );
}
PANEL_REGULATOR::~PANEL_REGULATOR()

View File

@ -58,6 +58,9 @@ PANEL_TRACK_WIDTH::PANEL_TRACK_WIDTH( wxWindow* parent, wxWindowID id,
m_TWMode = TW_MASTER_CURRENT;
m_TWNested = false;
// Needed on wxWidgets 3.0 to ensure sizers are correctly set
GetSizer()->SetSizeHints( this );
}

View File

@ -90,6 +90,11 @@ void PANEL_TRANSLINE::LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg )
TranslineTypeSelection( m_currTransLineType );
m_TranslineSelection->SetSelection( m_currTransLineType );
// Needed on wxWidgets 3.0 to ensure sizers are correctly set
// It also remove a minor cosmetic issue on wxWidgets 3.5 on MSW
// Called here after the current selected transline bitmaps are enabled/disabled
GetSizer()->SetSizeHints( this );
}

View File

@ -67,6 +67,9 @@ PANEL_VIA_SIZE::PANEL_VIA_SIZE( wxWindow* parent, wxWindowID id,
m_viaReactanceUnits->SetLabel( wxT( "" ) );
m_viaBitmap->SetBitmap( KiBitmap( BITMAPS::viacalc ) );
// Needed on wxWidgets 3.0 to ensure sizers are correctly set
GetSizer()->SetSizeHints( this );
}