diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp index a5422dde8b..12502b92e5 100644 --- a/cvpcb/cvpcb_mainframe.cpp +++ b/cvpcb/cvpcb_mainframe.cpp @@ -728,7 +728,7 @@ void CVPCB_MAINFRAME::SendMessageToEESCHEMA( bool aClearHighligntOnly ) // clear highlight of previously selected components (if any): // Selecting a non existing symbol clears any previously highlighted symbols - std::string packet = "$PART: \"$DUMMY$\""; + std::string packet = "$CLEAR: \"HIGHLIGHTED\""; if( Kiface().IsSingle() ) SendCommand( MSG_TO_SCH, packet.c_str() ); diff --git a/eeschema/cross-probing.cpp b/eeschema/cross-probing.cpp index d0da2c80f9..022a0f5291 100644 --- a/eeschema/cross-probing.cpp +++ b/eeschema/cross-probing.cpp @@ -58,6 +58,7 @@ * \li \c \$PART: \c "reference" \c \$VAL: \c "value" Put cursor on component value. * \li \c \$PART: \c "reference" \c \$PAD: \c "pin name" Put cursor on the component pin. * \li \c \$NET: \c "netname" Highlight a specified net + * \li \c \$CLEAR: \c "HIGHLIGHTED" Clear components highlight *
* @param cmdline = received command from Pcbnew
*/
@@ -97,6 +98,14 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
return;
}
+ if( strcmp( idcmd, "$CLEAR:" ) == 0 )
+ {
+ if( text && strcmp( text, "HIGHLIGHTED" ) == 0 )
+ GetCanvas()->GetView()->HighlightItem( nullptr, nullptr );
+
+ return;
+ }
+
if( text == NULL )
return;
diff --git a/eeschema/find.cpp b/eeschema/find.cpp
index 83f645b67b..30b41d5c3a 100644
--- a/eeschema/find.cpp
+++ b/eeschema/find.cpp
@@ -235,7 +235,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
SetStatusText( msg );
- // highlight selection if foundItem is not null, or clear any highlight selection
+ // highlight selection if foundItem is not null, or clear any highlighted selection
GetCanvas()->GetView()->HighlightItem( foundItem, pin );
GetCanvas()->Refresh();
diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp
index 268e9380d8..200785c27a 100644
--- a/eeschema/sch_component.cpp
+++ b/eeschema/sch_component.cpp
@@ -1975,6 +1975,7 @@ void SCH_COMPONENT::Plot( PLOTTER* aPlotter )
}
}
+
void SCH_COMPONENT::ClearHighlightedPins()
{
m_highlightedPins.clear();
@@ -1991,3 +1992,16 @@ bool SCH_COMPONENT::IsPinHighlighted( const LIB_PIN* aPin )
{
return m_highlightedPins.find( aPin->GetNumber() ) != m_highlightedPins.end();
}
+
+
+void SCH_COMPONENT::ClearAllHighlightFlags()
+{
+ ClearFlags( HIGHLIGHTED );
+
+ // Clear the HIGHLIGHTED flag of pins
+ ClearHighlightedPins();
+
+ // Clear the HIGHLIGHTED flag of other items, currently only fields
+ for( SCH_FIELD& each_field : m_Fields )
+ each_field.ClearFlags( HIGHLIGHTED );
+}
diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h
index 5ef4400e51..e935c01f9a 100644
--- a/eeschema/sch_component.h
+++ b/eeschema/sch_component.h
@@ -329,6 +329,12 @@ public:
*/
void SetTimeStamp( timestamp_t aNewTimeStamp );
+ /**
+ * Clear the HIGHLIGHTED flag of all items of the component
+ * (fields, pins ...)
+ */
+ void ClearAllHighlightFlags();
+
const EDA_RECT GetBoundingBox() const override;
/**
diff --git a/eeschema/sch_view.cpp b/eeschema/sch_view.cpp
index 2e5da60a0c..40817fcd97 100644
--- a/eeschema/sch_view.cpp
+++ b/eeschema/sch_view.cpp
@@ -194,12 +194,19 @@ void SCH_VIEW::HighlightItem( EDA_ITEM *aItem, LIB_PIN* aPin )
{
for( auto item : *m_allItems )
{
- auto eitem = static_cast