Pcbnew: fix minor bug in find dialog.

Repeating find with the same search string would result in a not found
error for absolute search strings.  Don't clear the found item if the
search string did not change from the previous search..

Fix another minor bug where the do not warp mouse pointer option was
always checked when the find dialog was called from one of the gal
canvases.

Fixes lp:1793300

https://bugs.launchpad.net/kicad/+bug/1793300
This commit is contained in:
Wayne Stambaugh 2018-09-19 12:30:04 -04:00
parent e3d5734f76
commit a055916f92
2 changed files with 5 additions and 2 deletions

View File

@ -58,18 +58,21 @@ DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aParent ) : DIALOG_FIND_BASE( aParent
Center();
}
void DIALOG_FIND::OnInitDialog( wxInitDialogEvent& event )
{
m_SearchTextCtrl->SetFocus();
m_SearchTextCtrl->SetSelection( -1, -1 );
}
void DIALOG_FIND::EnableWarp( bool aEnabled )
{
m_NoMouseWarpCheckBox->SetValue( !aEnabled );
warpMouse = aEnabled;
}
void DIALOG_FIND::onButtonCloseClick( wxCommandEvent& aEvent )
{
Close( true );
@ -81,13 +84,14 @@ void DIALOG_FIND::onButtonFindItemClick( wxCommandEvent& aEvent )
PCB_SCREEN* screen = parent->GetScreen();
wxPoint pos;
foundItem = NULL;
wxString searchString = m_SearchTextCtrl->GetValue();
if( !searchString.IsSameAs( prevSearchString, false ) )
{
itemCount = 0;
foundItem = NULL;
}
prevSearchString = searchString;
parent->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y );

View File

@ -1215,7 +1215,6 @@ void SELECTION_TOOL::findCallback( BOARD_ITEM* aItem )
int SELECTION_TOOL::find( const TOOL_EVENT& aEvent )
{
DIALOG_FIND dlg( m_frame );
dlg.EnableWarp( false );
dlg.SetCallback( std::bind( &SELECTION_TOOL::findCallback, this, _1 ) );
dlg.ShowModal();