From 5e30e4d47524dcf314b51a66e59cfeba9ccc9467 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 18 May 2018 00:43:03 +0100 Subject: [PATCH] Don't allow replace on Power Symbol value fields. Fixes: lp:1771398 * https://bugs.launchpad.net/kicad/+bug/1771398 --- eeschema/sch_field.cpp | 13 +++++++++++++ eeschema/sch_field.h | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index eb58c531a6..4db543e60a 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -368,6 +368,19 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint } +bool SCH_FIELD::IsReplaceable() const +{ + if( m_id != VALUE ) + return true; + + SCH_COMPONENT* component = dynamic_cast( GetParent() ); + LIB_PART* part = component ? component->GetPartRef().lock().get() : nullptr; + bool isPower = part ? part->IsPower() : false; + + return !isPower; +} + + bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData ) { bool isReplaced; diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h index 030b1c8aea..9d8285bb27 100644 --- a/eeschema/sch_field.h +++ b/eeschema/sch_field.h @@ -182,7 +182,7 @@ public: BITMAP_DEF GetMenuImage() const override; - bool IsReplaceable() const override { return true; } + bool IsReplaceable() const override; wxPoint GetLibPosition() const { return EDA_TEXT::GetTextPos(); }