From d53c6f8abe7a043b028d90c9739963261bb384e2 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 11 Jul 2022 20:39:32 +0200 Subject: [PATCH] Eeschema, DIALOG_SCH_FIND: ensure the search flags actually used are up to date. Flags are encoded using internal wx values, that can change with wxWidgets versions. They need to be always rebuilt from the displayed options in dialog. From master branch. --- eeschema/dialogs/dialog_schematic_find.cpp | 15 +++++++++++++-- eeschema/dialogs/dialog_schematic_find.h | 5 ++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/eeschema/dialogs/dialog_schematic_find.cpp b/eeschema/dialogs/dialog_schematic_find.cpp index 37e57443ea..09f86eb026 100644 --- a/eeschema/dialogs/dialog_schematic_find.cpp +++ b/eeschema/dialogs/dialog_schematic_find.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2010 Wayne Stambaugh - * Copyright (C) 2010-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2010-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -196,6 +196,14 @@ void DIALOG_SCH_FIND::OnReplaceWithEnter( wxCommandEvent& aEvent ) void DIALOG_SCH_FIND::OnOptions( wxCommandEvent& aEvent ) { + updateFlags(); + m_findDirty = true; +} + + +void DIALOG_SCH_FIND::updateFlags() +{ + // Rebuild the search flags in m_findReplaceData from dialog settings int flags = 0; if( m_radioForward->GetValue() ) @@ -223,12 +231,13 @@ void DIALOG_SCH_FIND::OnOptions( wxCommandEvent& aEvent ) flags |= FR_REPLACE_REFERENCES; m_findReplaceData->SetFlags( flags ); - m_findDirty = true; } void DIALOG_SCH_FIND::OnFind( wxCommandEvent& aEvent ) { + updateFlags(); // Ensure search flags are up to date + int index = m_comboFind->FindString( m_comboFind->GetValue(), true ); if( index == wxNOT_FOUND ) @@ -250,6 +259,8 @@ void DIALOG_SCH_FIND::OnFind( wxCommandEvent& aEvent ) void DIALOG_SCH_FIND::OnReplace( wxCommandEvent& aEvent ) { + updateFlags(); // Ensure search flags are up to date + int index = m_comboReplace->FindString( m_comboReplace->GetValue(), true ); if( index == wxNOT_FOUND ) diff --git a/eeschema/dialogs/dialog_schematic_find.h b/eeschema/dialogs/dialog_schematic_find.h index a438b4f640..59305971df 100644 --- a/eeschema/dialogs/dialog_schematic_find.h +++ b/eeschema/dialogs/dialog_schematic_find.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2010 Wayne Stambaugh - * Copyright (C) 2010-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2010-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -75,6 +75,9 @@ protected: void OnFind( wxCommandEvent& aEvent ) override; void OnReplace( wxCommandEvent& aEvent ) override; + // Rebuild the search flags from dialog settings + void updateFlags(); + SCH_EDIT_FRAME* m_frame; SCH_EDITOR_CONTROL* m_editorControl; wxFindReplaceData* m_findReplaceData;