From 3b7fbad1b9a2df51f48092fc5a56c5db6bacf34a Mon Sep 17 00:00:00 2001 From: Seppe Stas Date: Mon, 18 Sep 2017 15:48:00 +0200 Subject: [PATCH] Improve template selector for macOS Fixes: lp:1492577 (and probably also lp:1672116). *https://bugs.launchpad.net/kicad/+bug/1492577 *https://bugs.launchpad.net/kicad/+bug/1672116 - Fixes a race condition causing the wrong page to be selected in `OnPageChange` - Allows the validate path and browse button to refresh the template page even when the path was not changed. This is needed since on OSX the page needs to be active for the templates to be rendered. --- kicad/dialogs/dialog_template_selector.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/kicad/dialogs/dialog_template_selector.cpp b/kicad/dialogs/dialog_template_selector.cpp index f36f66d978..b2fa1e4530 100644 --- a/kicad/dialogs/dialog_template_selector.cpp +++ b/kicad/dialogs/dialog_template_selector.cpp @@ -107,7 +107,7 @@ void DIALOG_TEMPLATE_SELECTOR::onNotebookResize(wxSizeEvent& event) void DIALOG_TEMPLATE_SELECTOR::OnPageChange( wxNotebookEvent& event ) { - int page = m_notebook->GetSelection(); + int page = event.GetSelection(); if( page != wxNOT_FOUND && (unsigned)page < m_panels.size() ) m_tcTemplatePath->SetValue( m_panels[page]->GetPath() ); @@ -219,9 +219,6 @@ void DIALOG_TEMPLATE_SELECTOR::onDirectoryBrowseClicked( wxCommandEvent& event ) m_tcTemplatePath->SetValue( dirName.GetFullPath() ); - if( currPath == m_tcTemplatePath->GetValue() ) - return; // No change - // Rebuild the page from the new templates path: replaceCurrentPage(); } @@ -236,9 +233,6 @@ void DIALOG_TEMPLATE_SELECTOR::onValidatePath( wxCommandEvent& event ) wxString currPath = m_tcTemplatePath->GetValue(); - if( currPath == m_panels[page]->GetPath() ) // No change - return; - wxFileName fn; fn.AssignDir( m_tcTemplatePath->GetValue() ); fn.Normalize();