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 );
|
DisplayErrorMessage( this, m_errorMessage );
|
||||||
|
|
||||||
auto textCtrl = dynamic_cast<wxTextCtrl*>( ctrl );
|
if( auto textCtrl = dynamic_cast<wxTextCtrl*>( ctrl ) )
|
||||||
if( textCtrl )
|
|
||||||
{
|
{
|
||||||
auto textEntry = dynamic_cast<wxTextEntry*>( textCtrl );
|
textCtrl->SetSelection( -1, -1 );
|
||||||
textEntry->SetSelection( -1, -1 );
|
|
||||||
textCtrl->SetFocus();
|
textCtrl->SetFocus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto grid = dynamic_cast<wxGrid*>( ctrl );
|
if( auto grid = dynamic_cast<wxGrid*>( ctrl ) )
|
||||||
|
|
||||||
if( grid )
|
|
||||||
{
|
{
|
||||||
grid->SetFocus();
|
grid->SetFocus();
|
||||||
grid->MakeCellVisible( m_errorRow, m_errorCol );
|
grid->MakeCellVisible( m_errorRow, m_errorCol );
|
||||||
|
|
|
@ -671,8 +671,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnUpdateUI( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
m_delayedFocusCtrl->SetFocus();
|
m_delayedFocusCtrl->SetFocus();
|
||||||
|
|
||||||
if( dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl ) )
|
if( auto textEntry = dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl ) )
|
||||||
dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl )->SelectAll();
|
textEntry->SelectAll();
|
||||||
|
|
||||||
m_delayedFocusCtrl = nullptr;
|
m_delayedFocusCtrl = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -834,8 +834,8 @@ void DIALOG_FOOTPRINT_FP_EDITOR::OnUpdateUI( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
m_delayedFocusCtrl->SetFocus();
|
m_delayedFocusCtrl->SetFocus();
|
||||||
|
|
||||||
if( dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl ) )
|
if( auto textEntry = dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl ) )
|
||||||
dynamic_cast<wxTextEntry*>( m_delayedFocusCtrl )->SelectAll();
|
textEntry->SelectAll();
|
||||||
|
|
||||||
m_delayedFocusCtrl = nullptr;
|
m_delayedFocusCtrl = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,10 +285,10 @@ void PANEL_SETUP_LAYERS::showBoardLayerNames()
|
||||||
{
|
{
|
||||||
wxString lname = m_pcb->GetLayerName( layer );
|
wxString lname = m_pcb->GetLayerName( layer );
|
||||||
|
|
||||||
if( dynamic_cast<wxTextCtrl*>( ctl ) )
|
if( auto textCtl = dynamic_cast<wxTextCtrl*>( ctl ) )
|
||||||
dynamic_cast<wxTextCtrl*>( ctl )->SetValue( lname ); // wxTextCtrl
|
textCtl->SetValue( lname ); // wxTextCtrl
|
||||||
else
|
else
|
||||||
ctl->SetLabel( lname ); // wxStaticText
|
ctl->SetLabel( lname ); // wxStaticText
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue