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.
This commit is contained in:
jean-pierre charras 2022-07-11 20:39:32 +02:00
parent 2512375988
commit d53c6f8abe
2 changed files with 17 additions and 3 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 Wayne Stambaugh <stambaughw@verizon.net>
* 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 )

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 Wayne Stambaugh <stambaughw@gmail.com>
* 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;