diff --git a/eeschema/cross-probing.cpp b/eeschema/cross-probing.cpp index 3175038aed..d0e71d2fca 100644 --- a/eeschema/cross-probing.cpp +++ b/eeschema/cross-probing.cpp @@ -56,6 +56,7 @@ * \li \c \$PART: \c "reference" \c \$REF: \c "ref" Put cursor on component reference. * \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 *
* @param cmdline = received command from Pcbnew
*/
@@ -69,7 +70,24 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
char* idcmd = strtok( line, " \n\r" );
char* text = strtok( NULL, "\"\n\r" );
- if( (idcmd == NULL) || (text == NULL) )
+ if( idcmd == NULL )
+ return;
+
+ if( strcmp( idcmd, "$NET:" ) == 0 )
+ {
+ if( GetToolId() == ID_HIGHLIGHT )
+ {
+ m_SelectedNetName = FROM_UTF8( text );
+
+ SetStatusText( _( "Selected net: " ) + m_SelectedNetName );
+ SetCurrentSheetHighlightFlags();
+ m_canvas->Refresh();
+ }
+
+ return;
+ }
+
+ if( text == NULL )
return;
if( strcmp( idcmd, "$PART:" ) != 0 )
@@ -185,6 +203,25 @@ void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* aObjectToSync, SCH_COMPONENT
}
+void SCH_EDIT_FRAME::SendCrossProbeNetName( const wxString& aNetName )
+{
+ std::string packet = StrPrintf( "$NET: %s", TO_UTF8( aNetName ) );
+
+ if( packet.size() )
+ {
+ if( Kiface().IsSingle() )
+ SendCommand( MSG_TO_PCB, packet.c_str() );
+ else
+ {
+ // Typically ExpressMail is going to be s-expression packets, but since
+ // we have existing interpreter of the cross probe packet on the other
+ // side in place, we use that here.
+ Kiway().ExpressMail( FRAME_PCB, MAIL_CROSS_PROBE, packet, this );
+ }
+ }
+}
+
+
void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
{
const std::string& payload = mail.GetPayload();
diff --git a/eeschema/highlight_connection.cpp b/eeschema/highlight_connection.cpp
index 367bd3e354..78f50b2d23 100644
--- a/eeschema/highlight_connection.cpp
+++ b/eeschema/highlight_connection.cpp
@@ -66,6 +66,7 @@ bool SCH_EDIT_FRAME::HighlightConnectionAtPosition( wxPoint aPosition )
}
}
+ SendCrossProbeNetName( m_SelectedNetName );
SetStatusText( "selected net: " + m_SelectedNetName );
SetCurrentSheetHighlightFlags();
m_canvas->Refresh();
diff --git a/eeschema/schframe.h b/eeschema/schframe.h
index 78410407ba..bee8da0f11 100644
--- a/eeschema/schframe.h
+++ b/eeschema/schframe.h
@@ -511,6 +511,13 @@ public:
*/
void SendMessageToPCBNEW( EDA_ITEM* aObjectToSync, SCH_COMPONENT* aPart );
+ /**
+ * Sends a net name to eeschema for highlighting
+ *
+ * @param aNetName is the name of a net, or empty string to clear highlight
+ */
+ void SendCrossProbeNetName( const wxString& aNetName );
+
/**
* Create a flat list which stores all connected objects.
*
diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp
index e552482ae1..b914cd3105 100644
--- a/pcbnew/cross-probing.cpp
+++ b/pcbnew/cross-probing.cpp
@@ -32,6 +32,7 @@
#include