From 4d773882160e4cc0252755347ac45fd770211f43 Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Sun, 10 Apr 2016 18:28:06 -0400 Subject: [PATCH] Clean up wxValidator window association wxValidator::SetWindow was used too many times due to me being a dunderhead who can't read the docs. --- pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp | 3 +-- pcbnew/dialogs/dialog_edit_module_text.cpp | 4 +--- pcbnew/dialogs/dialog_pad_properties.cpp | 3 +-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index 5571c1c111..42113b1b67 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -73,6 +73,7 @@ DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR( PCB_EDIT_FRAME* aParent m_OrientValidator.SetRange( -360.0, 360.0 ); m_OrientValueCtrl->SetValidator( m_OrientValidator ); + m_OrientValidator.SetWindow( m_OrientValueCtrl ); m_PreviewPane = new PANEL_PREV_3D( m_Panel3D, aParent->Prj().Get3DCacheManager() ); bLowerSizer3D->Add( m_PreviewPane, 1, wxEXPAND, 5 ); @@ -147,7 +148,6 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties() m_OrientValueCtrl->Enable( custom_orientation ); m_OrientValue = m_CurrentModule->GetOrientation() / 10.0; - m_OrientValidator.SetWindow( m_OrientValueCtrl ); m_OrientValidator.TransferToWindow(); // Initialize dialog relative to masks clearances @@ -245,7 +245,6 @@ void DIALOG_MODULE_BOARD_EDITOR::ModuleOrientEvent( wxCommandEvent& event ) break; } - m_OrientValidator.SetWindow( m_OrientValueCtrl ); m_OrientValidator.TransferToWindow(); m_OrientValueCtrl->Enable( custom_orientation ); } diff --git a/pcbnew/dialogs/dialog_edit_module_text.cpp b/pcbnew/dialogs/dialog_edit_module_text.cpp index 8089821e51..6e3c939c57 100644 --- a/pcbnew/dialogs/dialog_edit_module_text.cpp +++ b/pcbnew/dialogs/dialog_edit_module_text.cpp @@ -75,6 +75,7 @@ DialogEditModuleText::DialogEditModuleText( PCB_BASE_FRAME* aParent, m_OrientValidator.SetRange( -90.0, 90.0 ); m_OrientValueCtrl->SetValidator( m_OrientValidator ); + m_OrientValidator.SetWindow( m_OrientValueCtrl ); if( m_currentText ) m_module = (MODULE*) m_currentText->GetParent(); @@ -182,7 +183,6 @@ bool DialogEditModuleText::TransferDataToWindow() m_OrientValueCtrl->Enable( custom_orientation ); m_OrientValue = text_orient / 10.0; - m_OrientValidator.SetWindow( m_OrientValueCtrl ); m_OrientValidator.TransferToWindow(); // Configure the layers list selector @@ -309,7 +309,6 @@ bool DialogEditModuleText::TransferDataFromWindow() } m_OrientValue = 10.0 * m_currentText->GetOrientation(); m_OrientValueCtrl->Enable( custom_orientation ); - m_OrientValidator.SetWindow( m_OrientValueCtrl ); m_OrientValidator.TransferToWindow(); m_currentText->SetDrawCoord(); @@ -360,7 +359,6 @@ void DialogEditModuleText::ModuleOrientEvent( wxCommandEvent& event ) break; } - m_OrientValidator.SetWindow( m_OrientValueCtrl ); m_OrientValidator.TransferToWindow(); m_OrientValueCtrl->Enable( custom_orientation ); } diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index a3b5e897a5..af605ff623 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -111,6 +111,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP m_OrientValidator.SetRange( -360.0, 360.0 ); m_PadOrientCtrl->SetValidator( m_OrientValidator ); + m_OrientValidator.SetWindow( m_PadOrientCtrl ); m_padMaster = &m_parent->GetDesignSettings().m_Pad_Master; m_dummyPad = new D_PAD( (MODULE*) NULL ); @@ -674,7 +675,6 @@ void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event ) } m_OrientValue = m_dummyPad->GetOrientation() / 10.0; - m_OrientValidator.SetWindow( m_PadOrientCtrl ); m_OrientValidator.TransferToWindow(); transferDataToPad( m_dummyPad ); @@ -1059,7 +1059,6 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad ) if( !m_localSettingsPanel->Validate() ) return true; - m_OrientValidator.SetWindow( m_PadOrientCtrl ); m_OrientValidator.TransferFromWindow(); aPad->SetAttribute( code_type[m_PadType->GetSelection()] );