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.
Fixes #11960
https://gitlab.com/kicad/code/kicad/issues/11960
This commit is contained in:
jean-pierre charras 2022-07-09 10:28:53 +02:00
parent 70aec5d576
commit fb5604022c
3 changed files with 15 additions and 2 deletions

View File

@ -196,6 +196,13 @@ 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 +230,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 +258,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

@ -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;

View File

@ -93,7 +93,7 @@ public:
* @param aEdgeOnly indicates only edges should be generated (even if 0 width), and no fill
* shapes.
*/
virtual std::vector<SHAPE*> MakeEffectiveShapes( bool aEdgeOnly = false ) const
virtual std::vector<SHAPE*> MakeEffectiveShapes( bool aEdgeOnly = false ) const override
{
return makeEffectiveShapes( aEdgeOnly, true );
}