Clean up redundant dynamic casts
This commit is contained in:
parent
94f8aafec5
commit
36f6b4a9b4
|
@ -247,18 +247,14 @@ void PAGED_DIALOG::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
|
||||
DisplayErrorMessage( this, m_errorMessage );
|
||||
|
||||
auto textCtrl = dynamic_cast<wxTextCtrl*>( ctrl );
|
||||
if( textCtrl )
|
||||
if( auto textCtrl = dynamic_cast<wxTextCtrl*>( ctrl ) )
|
||||
{
|
||||
auto textEntry = dynamic_cast<wxTextEntry*>( textCtrl );
|
||||
textEntry->SetSelection( -1, -1 );
|
||||
textCtrl->SetSelection( -1, -1 );
|
||||
textCtrl->SetFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
auto grid = dynamic_cast<wxGrid*>( ctrl );
|
||||
|
||||
if( grid )
|
||||
if( auto grid = dynamic_cast<wxGrid*>( ctrl ) )
|
||||
{
|
||||
grid->SetFocus();
|
||||
grid->MakeCellVisible( m_errorRow, m_errorCol );
|
||||
|
|
|
@ -671,8 +671,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
{
|
||||
m_delayedFocusCtrl->SetFocus();
|
||||
|
||||
if( dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl ) )
|
||||
dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl )->SelectAll();
|
||||
if( auto textEntry = dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl ) )
|
||||
textEntry->SelectAll();
|
||||
|
||||
m_delayedFocusCtrl = nullptr;
|
||||
}
|
||||
|
|
|
@ -834,8 +834,8 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
{
|
||||
m_delayedFocusCtrl->SetFocus();
|
||||
|
||||
if( dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl ) )
|
||||
dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl )->SelectAll();
|
||||
if( auto textEntry = dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl ) )
|
||||
textEntry->SelectAll();
|
||||
|
||||
m_delayedFocusCtrl = nullptr;
|
||||
}
|
||||
|
|
|
@ -285,8 +285,8 @@ void PANEL_SETUP_LAYERS::showBoardLayerNames()
|
|||
{
|
||||
wxString lname = m_pcb->GetLayerName( layer );
|
||||
|
||||
if( dynamic_cast<wxTextCtrl*>( ctl ) )
|
||||
dynamic_cast<wxTextCtrl*>( ctl )->SetValue( lname ); // wxTextCtrl
|
||||
if( auto textCtl = dynamic_cast<wxTextCtrl*>( ctl ) )
|
||||
textCtl->SetValue( lname ); // wxTextCtrl
|
||||
else
|
||||
ctl->SetLabel( lname ); // wxStaticText
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue