Move timer used by SCH_EDITOR_CONTROL to member variable

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2430
This commit is contained in:
Barabas Raffai 2022-12-08 17:33:19 +00:00 committed by Ian McInerney
parent 966f7bfa4c
commit add082548d
2 changed files with 6 additions and 6 deletions

View File

@ -476,9 +476,6 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
{ {
} }
// A timer during which a subsequent FindNext will result in a wrap-around
static wxTimer wrapAroundTimer;
if( aEvent.IsAction( &ACTIONS::findNextMarker ) ) if( aEvent.IsAction( &ACTIONS::findNextMarker ) )
data.markersOnly = true; data.markersOnly = true;
else if( data.findString.IsEmpty() ) else if( data.findString.IsEmpty() )
@ -490,11 +487,11 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
SCH_SHEET_PATH* afterSheet = &m_frame->GetCurrentSheet(); SCH_SHEET_PATH* afterSheet = &m_frame->GetCurrentSheet();
if( wrapAroundTimer.IsRunning() ) if( m_wrapAroundTimer.IsRunning() )
{ {
afterSheet = nullptr; afterSheet = nullptr;
afterItem = nullptr; afterItem = nullptr;
wrapAroundTimer.Stop(); m_wrapAroundTimer.Stop();
m_frame->ClearFindReplaceStatus(); m_frame->ClearFindReplaceStatus();
} }
@ -566,7 +563,7 @@ int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
// Show the popup during the time period the user can wrap the search // Show the popup during the time period the user can wrap the search
m_frame->ShowFindReplaceStatus( msg + wxS( " " ) + m_frame->ShowFindReplaceStatus( msg + wxS( " " ) +
_( "Find again to wrap around to the start." ), 4000 ); _( "Find again to wrap around to the start." ), 4000 );
wrapAroundTimer.StartOnce( 4000 ); m_wrapAroundTimer.StartOnce( 4000 );
} }
return 0; return 0;

View File

@ -239,6 +239,9 @@ private:
// A map of KIID_PATH --> sheet instances for the clipboard contents. // A map of KIID_PATH --> sheet instances for the clipboard contents.
std::map<KIID_PATH, SCH_SHEET_INSTANCE> m_clipboardSheetInstances; std::map<KIID_PATH, SCH_SHEET_INSTANCE> m_clipboardSheetInstances;
// A timer during which a subsequent FindNext will result in a wrap-around
wxTimer m_wrapAroundTimer;
}; };