Allow selection of Footprint Checker markers.
(And do a cross-probe to the Footprint Checker dialog.)
This commit is contained in:
parent
8b0efa8ac4
commit
28f7221cc3
|
@ -84,6 +84,7 @@ const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::BoardLevelItems = {
|
|||
|
||||
|
||||
const std::initializer_list<KICAD_T> GENERAL_COLLECTOR::FootprintItems = {
|
||||
PCB_MARKER_T,
|
||||
PCB_FP_TEXT_T,
|
||||
PCB_FP_TEXTBOX_T,
|
||||
PCB_FP_SHAPE_T,
|
||||
|
|
|
@ -39,6 +39,7 @@ DIALOG_FOOTPRINT_CHECKER::DIALOG_FOOTPRINT_CHECKER( FOOTPRINT_EDIT_FRAME* aParen
|
|||
m_frame( aParent ),
|
||||
m_checksRun( false ),
|
||||
m_markersProvider( nullptr ),
|
||||
m_centerMarkerOnIdle( nullptr ),
|
||||
m_severities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING )
|
||||
{
|
||||
m_markersTreeModel = new RC_TREE_MODEL( m_frame, m_markersDataView );
|
||||
|
@ -179,6 +180,25 @@ void DIALOG_FOOTPRINT_CHECKER::SetMarkersProvider( RC_ITEMS_PROVIDER* aProvider
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_FOOTPRINT_CHECKER::SelectMarker( const PCB_MARKER* aMarker )
|
||||
{
|
||||
m_markersTreeModel->SelectMarker( aMarker );
|
||||
|
||||
// wxWidgets on some platforms fails to correctly ensure that a selected item is
|
||||
// visible, so we have to do it in a separate idle event.
|
||||
m_centerMarkerOnIdle = aMarker;
|
||||
Bind( wxEVT_IDLE, &DIALOG_FOOTPRINT_CHECKER::centerMarkerIdleHandler, this );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FOOTPRINT_CHECKER::centerMarkerIdleHandler( wxIdleEvent& aEvent )
|
||||
{
|
||||
m_markersTreeModel->CenterMarker( m_centerMarkerOnIdle );
|
||||
m_centerMarkerOnIdle = nullptr;
|
||||
Unbind( wxEVT_IDLE, &DIALOG_FOOTPRINT_CHECKER::centerMarkerIdleHandler, this );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FOOTPRINT_CHECKER::OnRunChecksClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_checksRun = false;
|
||||
|
@ -194,6 +214,15 @@ void DIALOG_FOOTPRINT_CHECKER::OnSelectItem( wxDataViewEvent& aEvent )
|
|||
const KIID& itemID = node ? RC_TREE_MODEL::ToUUID( aEvent.GetItem() ) : niluuid;
|
||||
BOARD_ITEM* item = board->GetItem( itemID );
|
||||
|
||||
if( m_centerMarkerOnIdle )
|
||||
{
|
||||
// we already came from a cross-probe of the marker in the document; don't go
|
||||
// around in circles
|
||||
|
||||
aEvent.Skip();
|
||||
return;
|
||||
}
|
||||
|
||||
if( node && item )
|
||||
{
|
||||
PCB_LAYER_ID principalLayer = UNDEFINED_LAYER;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <rc_item.h>
|
||||
|
||||
class FOOTPRINT_EDIT_FRAME;
|
||||
class PCB_MARKER;
|
||||
|
||||
|
||||
class DIALOG_FOOTPRINT_CHECKER: public DIALOG_FOOTPRINT_CHECKER_BASE
|
||||
|
@ -39,12 +40,16 @@ public:
|
|||
|
||||
void SetMarkersProvider( RC_ITEMS_PROVIDER* aProvider );
|
||||
|
||||
void SelectMarker( const PCB_MARKER* aMarker );
|
||||
|
||||
private:
|
||||
void syncCheckboxes();
|
||||
void updateDisplayedCounts();
|
||||
|
||||
void runChecks();
|
||||
|
||||
void centerMarkerIdleHandler( wxIdleEvent& aEvent );
|
||||
|
||||
void deleteAllMarkers();
|
||||
void refreshEditor();
|
||||
|
||||
|
@ -69,6 +74,8 @@ private:
|
|||
RC_TREE_MODEL* m_markersTreeModel;
|
||||
RC_ITEMS_PROVIDER* m_markersProvider;
|
||||
|
||||
const PCB_MARKER* m_centerMarkerOnIdle;
|
||||
|
||||
int m_severities;
|
||||
};
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <settings/color_settings.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <tools/footprint_editor_control.h>
|
||||
#include <widgets/appearance_controls.h>
|
||||
#include <widgets/lib_tree.h>
|
||||
#include <pcb_layer_box_selector.h>
|
||||
|
@ -254,6 +255,10 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
|
|||
m_toolManager->RunAction( PCB_ACTIONS::groupProperties, true, aItem );
|
||||
break;
|
||||
|
||||
case PCB_MARKER_T:
|
||||
m_toolManager->GetTool<FOOTPRINT_EDITOR_CONTROL>()->CrossProbe( static_cast<PCB_MARKER*>( aItem ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( wxT( "FOOTPRINT_EDIT_FRAME::OnEditItemRequest: unsupported item type " )
|
||||
+ aItem->GetClass() );
|
||||
|
|
|
@ -653,10 +653,23 @@ int FOOTPRINT_EDITOR_CONTROL::CheckFootprint( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_checkerDialog->Show( true );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDITOR_CONTROL::CrossProbe( const PCB_MARKER* aMarker )
|
||||
{
|
||||
if( !m_checkerDialog )
|
||||
m_checkerDialog = new DIALOG_FOOTPRINT_CHECKER( m_frame );
|
||||
|
||||
if( !m_checkerDialog->IsShown() )
|
||||
m_checkerDialog->Show( true );
|
||||
|
||||
m_checkerDialog->SelectMarker( aMarker );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDITOR_CONTROL::DestroyCheckerDialog()
|
||||
{
|
||||
if( m_checkerDialog )
|
||||
|
|
|
@ -73,6 +73,7 @@ public:
|
|||
int EditTextAndGraphics( const TOOL_EVENT& aEvent );
|
||||
|
||||
int CheckFootprint( const TOOL_EVENT& aEvent );
|
||||
void CrossProbe( const PCB_MARKER* aMarker );
|
||||
void DestroyCheckerDialog();
|
||||
|
||||
int CleanupGraphics( const TOOL_EVENT& aEvent );
|
||||
|
|
Loading…
Reference in New Issue