diff --git a/eeschema/tools/ee_inspection_tool.cpp b/eeschema/tools/ee_inspection_tool.cpp index 33a1a70d27..ad8c5de8cb 100644 --- a/eeschema/tools/ee_inspection_tool.cpp +++ b/eeschema/tools/ee_inspection_tool.cpp @@ -164,16 +164,8 @@ int EE_INSPECTION_TOOL::CrossProbe( const TOOL_EVENT& aEvent ) SCH_EDIT_FRAME* frame = dynamic_cast( m_frame ); DIALOG_ERC* dlg = frame ? frame->GetErcDialog() : nullptr; - if( dlg ) - { - if( !dlg->IsShownOnScreen() ) - { - dlg->Show( true ); - dlg->Raise(); - } - + if( dlg && dlg->IsShownOnScreen() ) dlg->SelectMarker( static_cast( selection.Front() ) ); - } } // Show the item info on a left click on this item @@ -183,6 +175,27 @@ int EE_INSPECTION_TOOL::CrossProbe( const TOOL_EVENT& aEvent ) } +void EE_INSPECTION_TOOL::CrossProbe( const SCH_MARKER* aMarker ) +{ + SCH_EDIT_FRAME* frame = dynamic_cast( m_frame ); + + wxCHECK( frame, /* void */ ); + + DIALOG_ERC* dlg = frame->GetErcDialog(); + + if( dlg ) + { + if( !dlg->IsShownOnScreen() ) + { + dlg->Show( true ); + dlg->Raise(); + } + + dlg->SelectMarker( aMarker ); + } +} + + wxString EE_INSPECTION_TOOL::InspectERCErrorMenuText( const std::shared_ptr& aERCItem ) { auto menuDescription = diff --git a/eeschema/tools/ee_inspection_tool.h b/eeschema/tools/ee_inspection_tool.h index 80b1331d3e..c7b8615195 100644 --- a/eeschema/tools/ee_inspection_tool.h +++ b/eeschema/tools/ee_inspection_tool.h @@ -56,6 +56,8 @@ public: /// Called when clicking on a item: int CrossProbe( const TOOL_EVENT& aEvent ); + void CrossProbe( const SCH_MARKER* aMarker ); + wxString InspectERCErrorMenuText( const std::shared_ptr& aERCItem ); void InspectERCError( const std::shared_ptr& aERCItem ); diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 1d251d8bc0..591b7142ec 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -26,13 +26,21 @@ #include #include #include +#include #include #include #include #include #include #include +#include +#include +#include +#include #include +#include +#include +#include #include #include #include @@ -41,14 +49,8 @@ #include #include #include -#include #include -#include -#include -#include -#include #include -#include #include #include #include @@ -1750,7 +1752,7 @@ int SCH_EDIT_TOOL::ChangeBodyStyle( const TOOL_EVENT& aEvent ) int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) { - EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::EditableItems ); + EE_SELECTION& selection = m_selectionTool->RequestSelection(); bool clearSelection = selection.IsHover(); if( selection.Empty() ) @@ -2041,7 +2043,16 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) break; - case SCH_MARKER_T: // These items have no properties to edit + case SCH_MARKER_T: + if( SELECTION_CONDITIONS::OnlyTypes( { SCH_MARKER_T } )( selection ) ) + { + EE_INSPECTION_TOOL* inspectionTool = m_toolMgr->GetTool(); + + if( inspectionTool ) + inspectionTool->CrossProbe( static_cast ( selection.Front() ) ); + } + break; + case SCH_NO_CONNECT_T: break; diff --git a/pcbnew/tools/drc_tool.cpp b/pcbnew/tools/drc_tool.cpp index 1d548b10f8..abcb7cf657 100644 --- a/pcbnew/tools/drc_tool.cpp +++ b/pcbnew/tools/drc_tool.cpp @@ -250,18 +250,13 @@ int DRC_TOOL::NextMarker( const TOOL_EVENT& aEvent ) int DRC_TOOL::CrossProbe( const TOOL_EVENT& aEvent ) { - if( m_drcDialog ) + if( m_drcDialog && m_drcDialog->IsShownOnScreen() ) { PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); PCB_SELECTION& selection = selectionTool->GetSelection(); if( selection.GetSize() == 1 && selection.Front()->Type() == PCB_MARKER_T ) - { - if( !m_drcDialog->IsShownOnScreen() ) - m_drcDialog->Show( true ); - m_drcDialog->SelectMarker( static_cast( selection.Front() ) ); - } } return 0;