Allow clearing PcbNew highlight through cross-probing
Fixes: lp:1821486 * https://bugs.launchpad.net/kicad/+bug/1821486
This commit is contained in:
parent
3e4913adce
commit
e0ada1379f
|
@ -244,6 +244,22 @@ void SCH_EDIT_FRAME::SendCrossProbeNetName( const wxString& aNetName )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_EDIT_FRAME::SendCrossProbeClearHighlight()
|
||||||
|
{
|
||||||
|
std::string packet = "$CLEAR\n";
|
||||||
|
|
||||||
|
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 )
|
||||||
{
|
{
|
||||||
std::string& payload = mail.GetPayload();
|
std::string& payload = mail.GetPayload();
|
||||||
|
|
|
@ -465,6 +465,11 @@ public:
|
||||||
*/
|
*/
|
||||||
void SendCrossProbeNetName( const wxString& aNetName );
|
void SendCrossProbeNetName( const wxString& aNetName );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells PcbNew to clear the existing highlighted net, if one exists
|
||||||
|
*/
|
||||||
|
void SendCrossProbeClearHighlight();
|
||||||
|
|
||||||
const wxString& GetSelectedNetName() const { return m_SelectedNetName; }
|
const wxString& GetSelectedNetName() const { return m_SelectedNetName; }
|
||||||
void SetSelectedNetName( const wxString& aNetName ) { m_SelectedNetName = aNetName; }
|
void SetSelectedNetName( const wxString& aNetName ) { m_SelectedNetName = aNetName; }
|
||||||
|
|
||||||
|
|
|
@ -310,9 +310,19 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( netName.empty() )
|
||||||
|
{
|
||||||
|
editFrame->SetStatusText( wxT( "" ) );
|
||||||
|
editFrame->SendCrossProbeClearHighlight();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
editFrame->SendCrossProbeNetName( netName );
|
||||||
|
editFrame->SetStatusText( wxString::Format( _( "Selected net: %s" ),
|
||||||
|
UnescapeString( netName ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
editFrame->SetSelectedNetName( netName );
|
editFrame->SetSelectedNetName( netName );
|
||||||
editFrame->SendCrossProbeNetName( netName );
|
|
||||||
editFrame->SetStatusText( wxString::Format( _( "Selected net: %s" ), UnescapeString( netName ) ) );
|
|
||||||
|
|
||||||
aToolMgr->RunAction( SCH_ACTIONS::highlightNetSelection, true );
|
aToolMgr->RunAction( SCH_ACTIONS::highlightNetSelection, true );
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
* $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)
|
* $NET: "net name" highlight the given net (if highlight tool is active)
|
||||||
|
* $CLEAR Clear existing highlight
|
||||||
* They are a keyword followed by a quoted string.
|
* They are a keyword followed by a quoted string.
|
||||||
*/
|
*/
|
||||||
void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
||||||
|
@ -95,16 +96,28 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
||||||
{
|
{
|
||||||
wxString net_name = FROM_UTF8( text );
|
wxString net_name = FROM_UTF8( text );
|
||||||
NETINFO_ITEM* netinfo = pcb->FindNet( net_name );
|
NETINFO_ITEM* netinfo = pcb->FindNet( net_name );
|
||||||
int netcode = 0;
|
int netcode = -1;
|
||||||
|
|
||||||
if( netinfo )
|
if( netinfo )
|
||||||
netcode = netinfo->GetNet();
|
netcode = netinfo->GetNet();
|
||||||
|
|
||||||
|
if( netcode > 0 )
|
||||||
|
{
|
||||||
|
pcb->SetHighLightNet( netcode );
|
||||||
|
|
||||||
|
if( netinfo )
|
||||||
|
{
|
||||||
|
MSG_PANEL_ITEMS items;
|
||||||
|
netinfo->GetMsgPanelInfo( GetUserUnits(), items );
|
||||||
|
SetMsgPanel( items );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( IsGalCanvasActive() )
|
if( IsGalCanvasActive() )
|
||||||
{
|
{
|
||||||
auto view = m_toolManager->GetView();
|
auto view = m_toolManager->GetView();
|
||||||
auto rs = view->GetPainter()->GetSettings();
|
auto rs = view->GetPainter()->GetSettings();
|
||||||
rs->SetHighlight( true, netcode );
|
rs->SetHighlight( ( netcode >= 0 ), netcode );
|
||||||
view->UpdateAllLayersColor();
|
view->UpdateAllLayersColor();
|
||||||
|
|
||||||
BOX2I bbox;
|
BOX2I bbox;
|
||||||
|
@ -167,6 +180,18 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if( strcmp( idcmd, "$CLEAR" ) == 0 )
|
||||||
|
{
|
||||||
|
auto view = m_toolManager->GetView();
|
||||||
|
auto rs = view->GetPainter()->GetSettings();
|
||||||
|
rs->SetHighlight( false );
|
||||||
|
view->UpdateAllLayersColor();
|
||||||
|
|
||||||
|
pcb->ResetHighLight();
|
||||||
|
SetMsgPanel( pcb );
|
||||||
|
|
||||||
|
GetGalCanvas()->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
if( text == NULL )
|
if( text == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue