From 0a01277808890ce662ffd80ad34af9475abaf504 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 30 May 2019 14:39:31 +0100 Subject: [PATCH] Fix issues with schematic find/change. Fixes: lp:1831006 * https://bugs.launchpad.net/kicad/+bug/1831006 --- eeschema/sch_field.cpp | 9 +++++---- eeschema/sch_pin.cpp | 6 ++++++ eeschema/sch_pin.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index b246c72f1a..436a888f52 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -321,13 +321,14 @@ void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) { wxString text = GetFullyQualifiedText(); + int flags = aSearchData.GetFlags(); // User defined fields have an ID of -1. - if( ((m_id > VALUE || m_id < REFERENCE) && !(aSearchData.GetFlags() & FR_SEARCH_ALL_FIELDS)) - || ((m_id == REFERENCE) && !(aSearchData.GetFlags() & FR_REPLACE_REFERENCES)) ) - { + if( m_id != REFERENCE && m_id != VALUE && !( flags & FR_SEARCH_ALL_FIELDS ) ) + return false; + + if( ( flags & FR_SEARCH_REPLACE ) && m_id == REFERENCE && !( flags & FR_REPLACE_REFERENCES ) ) return false; - } wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText( MILLIMETRES ) ); diff --git a/eeschema/sch_pin.cpp b/eeschema/sch_pin.cpp index 12ca89e934..b5f1059399 100644 --- a/eeschema/sch_pin.cpp +++ b/eeschema/sch_pin.cpp @@ -55,6 +55,12 @@ SCH_PIN& SCH_PIN::operator=( const SCH_PIN& aPin ) } +bool SCH_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) +{ + return m_libPin->Matches( aSearchData, aAuxData ); +} + + SCH_COMPONENT* SCH_PIN::GetParentComponent() const { return static_cast( GetParent() ); diff --git a/eeschema/sch_pin.h b/eeschema/sch_pin.h index ff9216f0ee..2e8edc5301 100644 --- a/eeschema/sch_pin.h +++ b/eeschema/sch_pin.h @@ -84,6 +84,7 @@ public: /// Returns the pin's position in global coordinates wxPoint GetTransformedPosition() const; + bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override; /* * While many of these are currently simply covers for the equivalent LIB_PIN methods,