diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index 1bd7e003a9..9c95569ee1 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -38,14 +38,15 @@ */ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) { - char line[1024]; - wxString msg; - wxString modName; - char* idcmd; - char* text; - MODULE* module = 0; - BOARD* pcb = GetBoard(); - wxPoint pos; + char line[1024]; + wxString msg; + wxString modName; + char* idcmd; + char* text; + MODULE* module = NULL; + D_PAD* pad = NULL; + BOARD* pcb = GetBoard(); + wxPoint pos; strncpy( line, cmdline, sizeof(line) - 1 ); line[sizeof(line) - 1] = 0; @@ -75,7 +76,6 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) else if( strcmp( idcmd, "$PIN:" ) == 0 ) { wxString pinName; - D_PAD* pad = NULL; int netcode = -1; pinName = FROM_UTF8( text ); @@ -132,7 +132,12 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) { if( IsGalCanvasActive() ) { - GetToolManager()->RunAction( COMMON_ACTIONS::crossProbeSchToPcb, true, module ); + GetToolManager()->RunAction( COMMON_ACTIONS::crossProbeSchToPcb, + true, + pad ? + static_cast( pad ) : + static_cast( module ) + ); } else { diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 75b37bae44..15a0fc67b6 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -642,7 +642,18 @@ int PCB_EDITOR_CONTROL::CrossProbeSchToPcb( const TOOL_EVENT& aEvent ) m_probingSchToPcb = true; getView()->SetCenter( VECTOR2D( item->GetPosition() ) ); m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true ); - m_toolMgr->RunAction( COMMON_ACTIONS::selectItem, true, item ); + + // If it is a pad and the net highlighting tool is enabled, highlight the net + if( item->Type() == PCB_PAD_T && m_frame->GetToolId() == ID_PCB_HIGHLIGHT_BUTT ) + { + int net = static_cast( item )->GetNetCode(); + m_toolMgr->RunAction( COMMON_ACTIONS::highlightNet, false, net ); + } + else + // Otherwise simply select the corresponding item + { + m_toolMgr->RunAction( COMMON_ACTIONS::selectItem, true, item ); + } } return 0; @@ -714,7 +725,19 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition ) int PCB_EDITOR_CONTROL::HighlightNet( const TOOL_EVENT& aEvent ) { - highlightNet( m_toolMgr, getView()->ToWorld( getViewControls()->GetMousePosition() ) ); + int netcode = aEvent.Parameter(); + + if( netcode > 0 ) + { + KIGFX::RENDER_SETTINGS* render = m_toolMgr->GetView()->GetPainter()->GetSettings(); + render->SetHighlight( true, netcode ); + m_toolMgr->GetView()->UpdateAllLayersColor(); + } + else + { + // No net code specified, pick the net code belonging to the item under the cursor + highlightNet( m_toolMgr, getView()->ToWorld( getViewControls()->GetMousePosition() ) ); + } return 0; } diff --git a/pcbnew/tools/picker_tool.cpp b/pcbnew/tools/picker_tool.cpp index 42bbd98f8a..62343468d3 100644 --- a/pcbnew/tools/picker_tool.cpp +++ b/pcbnew/tools/picker_tool.cpp @@ -69,11 +69,14 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent ) if( !getNext ) break; else - setControls(); + m_toolMgr->PassEvent(); } else if( evt->IsCancel() || evt->IsActivate() ) break; + + else + m_toolMgr->PassEvent(); } reset();