Add bidirectional net highlight cross-probing
Fixes: lp:1738875 * https://bugs.launchpad.net/kicad/+bug/1738875
This commit is contained in:
parent
a4bb6ec3e4
commit
ca264f8982
|
@ -56,6 +56,7 @@
|
||||||
* \li \c \$PART: \c "reference" \c \$REF: \c "ref" Put cursor on component reference.
|
* \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 \$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 \$PART: \c "reference" \c \$PAD: \c "pin name" Put cursor on the component pin.
|
||||||
|
* \li \c \$NET: \c "netname" Highlight a specified net
|
||||||
* <p>
|
* <p>
|
||||||
* @param cmdline = received command from Pcbnew
|
* @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* idcmd = strtok( line, " \n\r" );
|
||||||
char* text = strtok( NULL, "\"\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;
|
return;
|
||||||
|
|
||||||
if( strcmp( idcmd, "$PART:" ) != 0 )
|
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 )
|
void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
||||||
{
|
{
|
||||||
const std::string& payload = mail.GetPayload();
|
const std::string& payload = mail.GetPayload();
|
||||||
|
|
|
@ -66,6 +66,7 @@ bool SCH_EDIT_FRAME::HighlightConnectionAtPosition( wxPoint aPosition )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SendCrossProbeNetName( m_SelectedNetName );
|
||||||
SetStatusText( "selected net: " + m_SelectedNetName );
|
SetStatusText( "selected net: " + m_SelectedNetName );
|
||||||
SetCurrentSheetHighlightFlags();
|
SetCurrentSheetHighlightFlags();
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
|
|
|
@ -511,6 +511,13 @@ public:
|
||||||
*/
|
*/
|
||||||
void SendMessageToPCBNEW( EDA_ITEM* aObjectToSync, SCH_COMPONENT* aPart );
|
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.
|
* Create a flat list which stores all connected objects.
|
||||||
*
|
*
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tools/selection_tool.h>
|
#include <tools/selection_tool.h>
|
||||||
#include <pcb_draw_panel_gal.h>
|
#include <pcb_draw_panel_gal.h>
|
||||||
|
#include <pcb_painter.h>
|
||||||
|
|
||||||
/* Execute a remote command send by Eeschema via a socket,
|
/* Execute a remote command send by Eeschema via a socket,
|
||||||
* port KICAD_PCB_PORT_SERVICE_NUMBER
|
* port KICAD_PCB_PORT_SERVICE_NUMBER
|
||||||
|
@ -39,6 +40,7 @@
|
||||||
* Commands are
|
* Commands are
|
||||||
* $PART: "reference" put cursor on component
|
* $PART: "reference" put cursor on component
|
||||||
* $PIN: "pin name" $PART: "reference" put cursor on the footprint pin
|
* $PIN: "pin name" $PART: "reference" put cursor on the footprint pin
|
||||||
|
* $NET: "net name" highlight the given net (if highlight tool is active)
|
||||||
*/
|
*/
|
||||||
void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
||||||
{
|
{
|
||||||
|
@ -58,7 +60,46 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
||||||
idcmd = strtok( line, " \n\r" );
|
idcmd = strtok( line, " \n\r" );
|
||||||
text = strtok( NULL, " \n\r" );
|
text = strtok( NULL, " \n\r" );
|
||||||
|
|
||||||
if( !idcmd || !text )
|
if( idcmd == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( strcmp( idcmd, "$NET:" ) == 0 )
|
||||||
|
{
|
||||||
|
if( GetToolId() == ID_PCB_HIGHLIGHT_BUTT )
|
||||||
|
{
|
||||||
|
wxString net_name = FROM_UTF8( text );
|
||||||
|
NETINFO_ITEM* netinfo = pcb->FindNet( net_name );
|
||||||
|
int netcode = 0;
|
||||||
|
|
||||||
|
if( netinfo )
|
||||||
|
netcode = netinfo->GetNet();
|
||||||
|
|
||||||
|
if( IsGalCanvasActive() )
|
||||||
|
{
|
||||||
|
auto rs = m_toolManager->GetView()->GetPainter()->GetSettings();
|
||||||
|
rs->SetHighlight( true, netcode );
|
||||||
|
m_toolManager->GetView()->UpdateAllLayersColor();
|
||||||
|
GetGalCanvas()->Refresh();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( netcode > 0 )
|
||||||
|
{
|
||||||
|
pcb->HighLightON();
|
||||||
|
pcb->SetHighLightNet( netcode );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pcb->HighLightOFF();
|
||||||
|
pcb->SetHighLightNet( -1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( text == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( strcmp( idcmd, "$PART:" ) == 0 )
|
if( strcmp( idcmd, "$PART:" ) == 0 )
|
||||||
|
@ -246,6 +287,25 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* aSyncItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PCB_EDIT_FRAME::SendCrossProbeNetName( const wxString& aNetName )
|
||||||
|
{
|
||||||
|
std::string packet = StrPrintf( "$NET: \"%s\"", TO_UTF8( aNetName ) );
|
||||||
|
|
||||||
|
if( packet.size() )
|
||||||
|
{
|
||||||
|
if( Kiface().IsSingle() )
|
||||||
|
SendCommand( MSG_TO_SCH, 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_SCH, MAIL_CROSS_PROBE, packet, this );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
||||||
{
|
{
|
||||||
const std::string& payload = mail.GetPayload();
|
const std::string& payload = mail.GetPayload();
|
||||||
|
|
|
@ -902,12 +902,14 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
|
||||||
MSG_PANEL_ITEMS items;
|
MSG_PANEL_ITEMS items;
|
||||||
netinfo->GetMsgPanelInfo( items );
|
netinfo->GetMsgPanelInfo( items );
|
||||||
frame->SetMsgPanel( items );
|
frame->SetMsgPanel( items );
|
||||||
|
frame->SendCrossProbeNetName( netinfo->GetNetname() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
board->ResetHighLight();
|
board->ResetHighLight();
|
||||||
frame->SetMsgPanel( board );
|
frame->SetMsgPanel( board );
|
||||||
|
frame->SendCrossProbeNetName( "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1667,6 +1667,13 @@ public:
|
||||||
*/
|
*/
|
||||||
void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync );
|
void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Edit_Gap
|
* Function Edit_Gap
|
||||||
* edits the GAP module if it has changed the position and/or size of the pads that
|
* edits the GAP module if it has changed the position and/or size of the pads that
|
||||||
|
|
Loading…
Reference in New Issue