Add cross-probing between PCB (markers) and DRC marker list.

Fixes https://gitlab.com/kicad/code/kicad/issues/7246
This commit is contained in:
Jeff Young 2021-07-11 18:04:57 +01:00
parent da79a3dd69
commit e2baacec21
6 changed files with 49 additions and 0 deletions

View File

@ -594,6 +594,19 @@ void RC_TREE_MODEL::NextMarker()
}
void RC_TREE_MODEL::SelectMarker( MARKER_BASE* aMarker )
{
for( RC_TREE_NODE* candidate : m_tree )
{
if( candidate->m_RcItem->GetParent() == aMarker )
{
m_view->Select( ToItem( candidate ) );
break;
}
}
}
void RC_TREE_MODEL::onSizeView( wxSizeEvent& aEvent )
{
int width = m_view->GetMainWindow()->GetRect().GetWidth() - WX_DATAVIEW_WINDOW_PADDING;

View File

@ -227,6 +227,7 @@ public:
void PrevMarker();
void NextMarker();
void SelectMarker( MARKER_BASE* aMarker );
bool IsContainer( wxDataViewItem const& aItem ) const override;

View File

@ -743,6 +743,16 @@ void DIALOG_DRC::NextMarker()
}
void DIALOG_DRC::SelectMarker( PCB_MARKER* aMarker )
{
if( m_Notebook->IsShown() )
{
m_Notebook->SetSelection( 0 );
m_markersTreeModel->SelectMarker( aMarker );
}
}
void DIALOG_DRC::ExcludeMarker()
{
if( !m_Notebook->IsShown() || m_Notebook->GetSelection() != 0 )

View File

@ -57,6 +57,8 @@ public:
void PrevMarker();
void NextMarker();
void SelectMarker( PCB_MARKER* aMarker );
void ExcludeMarker();
private:

View File

@ -27,6 +27,7 @@
#include <tools/pcb_actions.h>
#include <tools/pcb_tool_base.h>
#include <tools/zone_filler_tool.h>
#include <tools/pcb_selection_tool.h>
#include <tools/drc_tool.h>
#include <kiface_base.h>
#include <dialog_drc.h>
@ -265,6 +266,25 @@ int DRC_TOOL::NextMarker( const TOOL_EVENT& aEvent )
}
int DRC_TOOL::CrossProbe( const TOOL_EVENT& aEvent )
{
if( m_drcDialog )
{
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
PCB_SELECTION& selection = selectionTool->GetSelection();
if( selection.GetSize() == 1 && selection.Front()->Type() == PCB_MARKER_T )
{
m_drcDialog->Show( true );
m_drcDialog->Raise();
m_drcDialog->SelectMarker( static_cast<PCB_MARKER*>( selection.Front() ) );
}
}
return 0;
}
int DRC_TOOL::ExcludeMarker( const TOOL_EVENT& aEvent )
{
if( m_drcDialog )
@ -280,6 +300,7 @@ void DRC_TOOL::setTransitions()
Go( &DRC_TOOL::PrevMarker, ACTIONS::prevMarker.MakeEvent() );
Go( &DRC_TOOL::NextMarker, ACTIONS::nextMarker.MakeEvent() );
Go( &DRC_TOOL::ExcludeMarker, ACTIONS::excludeMarker.MakeEvent() );
Go( &DRC_TOOL::CrossProbe, EVENTS::SelectedEvent );
}

View File

@ -96,6 +96,8 @@ public:
int PrevMarker( const TOOL_EVENT& aEvent );
int NextMarker( const TOOL_EVENT& aEvent );
int CrossProbe( const TOOL_EVENT& aEvent );
int ExcludeMarker( const TOOL_EVENT& aEvent );
private: