2019-07-16 19:34:07 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2021-03-02 13:10:37 +00:00
|
|
|
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2019-07-16 19:34:07 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2020-07-11 01:06:17 +00:00
|
|
|
#include <bitmaps.h>
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <pcb_group.h>
|
2019-08-12 14:41:45 +00:00
|
|
|
#include <tool/tool_manager.h>
|
2020-12-16 13:31:32 +00:00
|
|
|
#include <tools/pcb_selection_tool.h>
|
|
|
|
#include <tools/pcb_picker_tool.h>
|
2019-08-12 14:41:45 +00:00
|
|
|
#include <tools/edit_tool.h>
|
2020-07-11 01:06:17 +00:00
|
|
|
#include <pcb_painter.h>
|
2019-08-12 14:41:45 +00:00
|
|
|
#include <connectivity/connectivity_data.h>
|
2020-09-10 19:58:05 +00:00
|
|
|
#include <dialogs/wx_html_report_box.h>
|
2020-09-11 23:25:10 +00:00
|
|
|
#include <drc/drc_engine.h>
|
2020-09-16 20:38:23 +00:00
|
|
|
#include <dialogs/panel_setup_rules_base.h>
|
2020-09-22 23:16:02 +00:00
|
|
|
#include <dialogs/dialog_constraints_reporter.h>
|
2021-07-29 09:56:22 +00:00
|
|
|
#include <string_utils.h>
|
2020-12-16 13:31:32 +00:00
|
|
|
#include "board_inspection_tool.h"
|
2021-04-09 02:09:06 +00:00
|
|
|
#include <pcbnew_settings.h>
|
2021-01-14 09:37:08 +00:00
|
|
|
#include <widgets/appearance_controls.h>
|
2021-05-20 22:59:23 +00:00
|
|
|
#include <drc/drc_item.h>
|
2021-06-06 19:03:10 +00:00
|
|
|
#include <pad.h>
|
2019-07-16 19:34:07 +00:00
|
|
|
|
2020-10-16 23:15:44 +00:00
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
BOARD_INSPECTION_TOOL::BOARD_INSPECTION_TOOL() :
|
2019-08-12 14:41:45 +00:00
|
|
|
PCB_TOOL_BASE( "pcbnew.InspectionTool" ),
|
|
|
|
m_frame( nullptr )
|
2019-07-16 19:34:07 +00:00
|
|
|
{
|
2019-08-12 14:41:45 +00:00
|
|
|
m_probingSchToPcb = false;
|
2021-05-29 15:53:55 +00:00
|
|
|
m_dynamicData = nullptr;
|
2019-07-16 19:34:07 +00:00
|
|
|
}
|
|
|
|
|
2019-08-12 14:41:45 +00:00
|
|
|
|
2020-07-11 01:06:17 +00:00
|
|
|
class NET_CONTEXT_MENU : public ACTION_MENU
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NET_CONTEXT_MENU() : ACTION_MENU( true )
|
|
|
|
{
|
2021-03-08 02:59:07 +00:00
|
|
|
SetIcon( BITMAPS::show_ratsnest );
|
2020-07-11 01:06:17 +00:00
|
|
|
SetTitle( _( "Net Tools" ) );
|
|
|
|
|
|
|
|
Add( PCB_ACTIONS::showNet );
|
|
|
|
Add( PCB_ACTIONS::hideNet );
|
2021-05-29 15:53:55 +00:00
|
|
|
Add( PCB_ACTIONS::highlightNetSelection );
|
|
|
|
Add( PCB_ACTIONS::clearHighlight );
|
2020-07-11 01:06:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
ACTION_MENU* create() const override
|
|
|
|
{
|
|
|
|
return new NET_CONTEXT_MENU();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
bool BOARD_INSPECTION_TOOL::Init()
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
2020-07-11 01:06:17 +00:00
|
|
|
|
|
|
|
auto netSubMenu = std::make_shared<NET_CONTEXT_MENU>();
|
|
|
|
netSubMenu->SetTool( this );
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
static KICAD_T connectedTypes[] = { PCB_TRACE_T, PCB_VIA_T, PCB_ARC_T, PCB_PAD_T, PCB_ZONE_T,
|
|
|
|
EOT };
|
2020-07-11 01:06:17 +00:00
|
|
|
|
|
|
|
CONDITIONAL_MENU& menu = selectionTool->GetToolMenu().GetMenu();
|
|
|
|
|
|
|
|
selectionTool->GetToolMenu().AddSubMenu( netSubMenu );
|
2020-09-10 19:58:05 +00:00
|
|
|
|
|
|
|
menu.AddMenu( netSubMenu.get(), SELECTION_CONDITIONS::OnlyTypes( connectedTypes ), 200 );
|
|
|
|
menu.AddItem( PCB_ACTIONS::inspectClearance, SELECTION_CONDITIONS::Count( 2 ), 200 );
|
2020-07-11 01:06:17 +00:00
|
|
|
|
2019-08-12 14:41:45 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
void BOARD_INSPECTION_TOOL::Reset( RESET_REASON aReason )
|
2019-07-16 19:34:07 +00:00
|
|
|
{
|
2019-08-12 14:41:45 +00:00
|
|
|
m_frame = getEditFrame<PCB_EDIT_FRAME>();
|
|
|
|
}
|
|
|
|
|
2019-07-16 19:34:07 +00:00
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
int BOARD_INSPECTION_TOOL::ShowStatisticsDialog( const TOOL_EVENT& aEvent )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
|
|
|
DIALOG_BOARD_STATISTICS dialog( m_frame );
|
2019-07-16 19:34:07 +00:00
|
|
|
dialog.ShowModal();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-08-12 14:41:45 +00:00
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
wxString BOARD_INSPECTION_TOOL::getItemDescription( BOARD_ITEM* aItem )
|
2020-12-03 23:02:41 +00:00
|
|
|
{
|
2020-12-16 23:54:53 +00:00
|
|
|
// Null items have no description
|
|
|
|
if( !aItem )
|
|
|
|
return wxString();
|
|
|
|
|
2020-12-03 23:02:41 +00:00
|
|
|
wxString s = aItem->GetSelectMenuText( m_frame->GetUserUnits() );
|
|
|
|
|
|
|
|
if( aItem->IsConnected() )
|
|
|
|
{
|
|
|
|
BOARD_CONNECTED_ITEM* cItem = static_cast<BOARD_CONNECTED_ITEM*>( aItem );
|
|
|
|
s += wxS( " " ) + wxString::Format( _( "[netclass %s]" ),
|
|
|
|
cItem->GetNetClass()->GetName() );
|
|
|
|
}
|
|
|
|
|
|
|
|
return s;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
void reportCompileError( REPORTER* r )
|
2020-09-10 19:58:05 +00:00
|
|
|
{
|
|
|
|
r->Report( "" );
|
2021-08-15 17:23:54 +00:00
|
|
|
r->Report( _( "Report incomplete: could not compile custom design rules. " )
|
2022-02-05 13:25:43 +00:00
|
|
|
+ wxT( "<a href='boardsetup'>" ) + _( "Show design rules." ) + wxT( "</a>" ) );
|
2020-09-10 19:58:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-01 22:29:15 +00:00
|
|
|
void BOARD_INSPECTION_TOOL::reportClearance( DRC_CONSTRAINT_T aClearanceType, PCB_LAYER_ID aLayer,
|
|
|
|
BOARD_ITEM* aA, BOARD_ITEM* aB, REPORTER* r )
|
2020-09-10 19:58:05 +00:00
|
|
|
{
|
|
|
|
r->Report( "" );
|
|
|
|
|
2020-09-11 23:25:10 +00:00
|
|
|
DRC_ENGINE drcEngine( m_frame->GetBoard(), &m_frame->GetBoard()->GetDesignSettings() );
|
2020-09-16 20:38:23 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2020-09-25 01:26:23 +00:00
|
|
|
drcEngine.InitEngine( m_frame->GetDesignRulesPath() );
|
2020-09-16 20:38:23 +00:00
|
|
|
}
|
2021-02-20 19:29:11 +00:00
|
|
|
catch( PARSE_ERROR& )
|
2020-09-16 20:38:23 +00:00
|
|
|
{
|
2021-08-15 17:23:54 +00:00
|
|
|
reportCompileError( r );
|
2020-09-16 20:38:23 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-09-11 23:25:10 +00:00
|
|
|
|
2020-12-04 20:47:29 +00:00
|
|
|
for( ZONE* zone : m_frame->GetBoard()->Zones() )
|
|
|
|
zone->CacheBoundingBox();
|
|
|
|
|
|
|
|
for( FOOTPRINT* footprint : m_frame->GetBoard()->Footprints() )
|
|
|
|
{
|
|
|
|
for( ZONE* zone : footprint->Zones() )
|
|
|
|
zone->CacheBoundingBox();
|
|
|
|
|
2022-07-31 21:14:24 +00:00
|
|
|
footprint->BuildCourtyardCaches();
|
2020-12-04 20:47:29 +00:00
|
|
|
}
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
DRC_CONSTRAINT constraint = drcEngine.EvalRules( aClearanceType, aA, aB, aLayer, r );
|
|
|
|
int clearance = constraint.m_Value.Min();
|
|
|
|
wxString clearanceStr = StringFromValue( r->GetUnits(), clearance, true );
|
2020-10-12 17:29:54 +00:00
|
|
|
|
|
|
|
r->Report( "" );
|
|
|
|
r->Report( wxString::Format( _( "Resolved clearance: %s." ), clearanceStr ) );
|
2020-09-10 19:58:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-05-20 22:59:23 +00:00
|
|
|
void BOARD_INSPECTION_TOOL::InspectDRCError( const std::shared_ptr<RC_ITEM>& aDRCItem )
|
|
|
|
{
|
|
|
|
BOARD_ITEM* a = m_frame->GetBoard()->GetItem( aDRCItem->GetMainItemID() );
|
|
|
|
BOARD_ITEM* b = m_frame->GetBoard()->GetItem( aDRCItem->GetAuxItemID() );
|
|
|
|
PCB_LAYER_ID layer = m_frame->GetActiveLayer();
|
|
|
|
|
|
|
|
if( !a || !b )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( m_inspectClearanceDialog == nullptr )
|
|
|
|
{
|
2021-08-15 17:23:54 +00:00
|
|
|
m_inspectClearanceDialog = std::make_unique<DIALOG_CONSTRAINTS_REPORTER>( m_frame );
|
2021-05-20 22:59:23 +00:00
|
|
|
m_inspectClearanceDialog->SetTitle( _( "Clearance Report" ) );
|
|
|
|
|
|
|
|
m_inspectClearanceDialog->Connect( wxEVT_CLOSE_WINDOW,
|
|
|
|
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onInspectClearanceDialogClosed ),
|
|
|
|
nullptr, this );
|
|
|
|
}
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
WX_HTML_REPORT_BOX* r = m_inspectClearanceDialog->AddPage( _( "Clearance" ) );
|
2021-05-20 22:59:23 +00:00
|
|
|
|
|
|
|
switch( aDRCItem->GetErrorCode() )
|
|
|
|
{
|
2021-08-15 17:23:54 +00:00
|
|
|
case DRCE_EDGE_CLEARANCE:
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxT( "<h7>" ) + _( "Edge clearance resolution for:" ) + wxT( "</h7>" ) );
|
2021-05-20 22:59:23 +00:00
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxString::Format( wxT( "<ul><li>%s</li><li>%s</li></ul>" ),
|
2021-05-20 22:59:23 +00:00
|
|
|
EscapeHTML( getItemDescription( a ) ),
|
|
|
|
EscapeHTML( getItemDescription( b ) ) ) );
|
|
|
|
|
|
|
|
reportClearance( EDGE_CLEARANCE_CONSTRAINT, layer, a, b, r );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DRCE_CLEARANCE:
|
|
|
|
if( a->Type() == PCB_TRACE_T || a->Type() == PCB_ARC_T )
|
|
|
|
{
|
|
|
|
layer = a->GetLayer();
|
|
|
|
}
|
|
|
|
else if( b->Type() == PCB_TRACE_T || b->Type() == PCB_ARC_T )
|
|
|
|
{
|
|
|
|
layer = b->GetLayer();
|
|
|
|
}
|
|
|
|
else if( a->Type() == PCB_PAD_T && static_cast<PAD*>( a )->GetAttribute() == PAD_ATTRIB::SMD )
|
|
|
|
{
|
|
|
|
PAD* pad = static_cast<PAD*>( a );
|
|
|
|
|
|
|
|
if( pad->IsOnLayer( F_Cu ) )
|
|
|
|
layer = F_Cu;
|
|
|
|
else
|
|
|
|
layer = B_Cu;
|
|
|
|
}
|
|
|
|
else if( b->Type() == PCB_PAD_T && static_cast<PAD*>( a )->GetAttribute() == PAD_ATTRIB::SMD )
|
|
|
|
{
|
|
|
|
PAD* pad = static_cast<PAD*>( b );
|
|
|
|
|
|
|
|
if( pad->IsOnLayer( F_Cu ) )
|
|
|
|
layer = F_Cu;
|
|
|
|
else
|
|
|
|
layer = B_Cu;
|
|
|
|
}
|
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxT( "<h7>" ) + _( "Clearance resolution for:" ) + wxT( "</h7>" ) );
|
2021-05-20 22:59:23 +00:00
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxString::Format( wxT( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>" ),
|
2021-05-20 22:59:23 +00:00
|
|
|
_( "Layer" ),
|
|
|
|
EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
|
|
|
|
EscapeHTML( getItemDescription( a ) ),
|
|
|
|
EscapeHTML( getItemDescription( b ) ) ) );
|
|
|
|
|
|
|
|
reportClearance( CLEARANCE_CONSTRAINT, layer, a, b, r );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
r->Flush();
|
|
|
|
|
|
|
|
m_inspectClearanceDialog->Raise();
|
|
|
|
m_inspectClearanceDialog->Show( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
int BOARD_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent )
|
2020-09-10 19:58:05 +00:00
|
|
|
{
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
|
|
|
const PCB_SELECTION& selection = selTool->GetSelection();
|
2020-09-10 19:58:05 +00:00
|
|
|
|
|
|
|
if( selection.Size() != 2 )
|
|
|
|
{
|
|
|
|
m_frame->ShowInfoBarError( _( "Select two items for a clearance resolution report." ) );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOARD_ITEM* a = static_cast<BOARD_ITEM*>( selection.GetItem( 0 ) );
|
|
|
|
BOARD_ITEM* b = static_cast<BOARD_ITEM*>( selection.GetItem( 1 ) );
|
|
|
|
|
2020-12-20 18:23:50 +00:00
|
|
|
wxCHECK( a && b, 0 );
|
|
|
|
|
2020-12-04 20:47:29 +00:00
|
|
|
if( a->Type() == PCB_GROUP_T )
|
|
|
|
{
|
|
|
|
PCB_GROUP* ag = static_cast<PCB_GROUP*>( a );
|
|
|
|
|
|
|
|
if( ag->GetItems().empty() )
|
|
|
|
{
|
|
|
|
m_frame->ShowInfoBarError( _( "Cannot generate clearance report on empty group." ) );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
a = *ag->GetItems().begin();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( b->Type() == PCB_GROUP_T )
|
|
|
|
{
|
2020-12-16 23:54:53 +00:00
|
|
|
PCB_GROUP* bg = static_cast<PCB_GROUP*>( b );
|
2020-12-04 20:47:29 +00:00
|
|
|
|
|
|
|
if( bg->GetItems().empty() )
|
|
|
|
{
|
|
|
|
m_frame->ShowInfoBarError( _( "Cannot generate clearance report on empty group." ) );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-12-16 23:54:53 +00:00
|
|
|
b = *bg->GetItems().begin();
|
2020-12-04 20:47:29 +00:00
|
|
|
}
|
|
|
|
|
2021-03-02 13:10:37 +00:00
|
|
|
// a and b could be null after group tests above.
|
|
|
|
wxCHECK( a && b, 0 );
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
if( m_inspectClearanceDialog == nullptr )
|
|
|
|
{
|
|
|
|
m_inspectClearanceDialog = std::make_unique<DIALOG_CONSTRAINTS_REPORTER>( m_frame );
|
|
|
|
m_inspectClearanceDialog->SetTitle( _( "Clearance Report" ) );
|
2020-10-15 19:18:49 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
m_inspectClearanceDialog->Connect( wxEVT_CLOSE_WINDOW,
|
|
|
|
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onInspectClearanceDialogClosed ),
|
|
|
|
nullptr, this );
|
|
|
|
}
|
|
|
|
|
|
|
|
WX_HTML_REPORT_BOX* r = nullptr;
|
|
|
|
EDA_UNITS units = m_frame->GetUserUnits();
|
|
|
|
|
|
|
|
m_inspectClearanceDialog->DeleteAllPages();
|
2020-10-15 19:18:49 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
if( a->Type() != PCB_ZONE_T && b->Type() == PCB_ZONE_T )
|
2020-09-10 19:58:05 +00:00
|
|
|
std::swap( a, b );
|
|
|
|
else if( !a->IsConnected() && b->IsConnected() )
|
|
|
|
std::swap( a, b );
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
PCB_LAYER_ID active = m_frame->GetActiveLayer();
|
|
|
|
LSET layerIntersection = a->GetLayerSet() & b->GetLayerSet();
|
|
|
|
LSET copperIntersection = layerIntersection & LSET::AllCuMask();
|
|
|
|
BOARD_CONNECTED_ITEM* ac = dynamic_cast<BOARD_CONNECTED_ITEM*>( a );
|
|
|
|
BOARD_CONNECTED_ITEM* bc = dynamic_cast<BOARD_CONNECTED_ITEM*>( b );
|
|
|
|
ZONE* zone = dynamic_cast<ZONE*>( a );
|
|
|
|
PAD* pad = dynamic_cast<PAD*>( b );
|
|
|
|
FOOTPRINT* aFP = dynamic_cast<FOOTPRINT*>( a );
|
|
|
|
FOOTPRINT* bFP = dynamic_cast<FOOTPRINT*>( b );
|
|
|
|
|
|
|
|
DRC_ENGINE drcEngine( m_frame->GetBoard(), &m_frame->GetBoard()->GetDesignSettings() );
|
|
|
|
bool compileError = false;
|
|
|
|
DRC_CONSTRAINT constraint;
|
|
|
|
int clearance = 0;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
drcEngine.InitEngine( m_frame->GetDesignRulesPath() );
|
|
|
|
}
|
|
|
|
catch( PARSE_ERROR& )
|
|
|
|
{
|
|
|
|
compileError = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
for( ZONE* z : m_frame->GetBoard()->Zones() )
|
|
|
|
z->CacheBoundingBox();
|
|
|
|
|
|
|
|
for( FOOTPRINT* f : m_frame->GetBoard()->Footprints() )
|
2020-10-11 13:15:22 +00:00
|
|
|
{
|
2021-08-15 17:23:54 +00:00
|
|
|
for( ZONE* z : f->Zones() )
|
|
|
|
z->CacheBoundingBox();
|
|
|
|
|
2022-07-31 21:14:24 +00:00
|
|
|
f->BuildCourtyardCaches();
|
2021-08-15 17:23:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto hasHole =
|
|
|
|
[]( BOARD_ITEM* aItem )
|
|
|
|
{
|
2021-08-17 16:54:14 +00:00
|
|
|
PAD* tmpPad = dynamic_cast<PAD*>( aItem );
|
2021-08-15 17:23:54 +00:00
|
|
|
|
2021-08-17 16:54:14 +00:00
|
|
|
if( tmpPad && tmpPad->GetDrillSizeX() > 0 && tmpPad->GetDrillSizeY() > 0 )
|
2021-08-15 17:23:54 +00:00
|
|
|
return true;
|
2020-10-11 13:15:22 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
PCB_VIA* via = dynamic_cast<PCB_VIA*>( aItem );
|
|
|
|
|
|
|
|
if( via )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
if( copperIntersection.any() && zone && pad && zone->GetNetCode() == pad->GetNetCode() )
|
|
|
|
{
|
|
|
|
PCB_LAYER_ID layer = active;
|
|
|
|
wxString source;
|
|
|
|
|
|
|
|
if( !zone->IsOnLayer( active ) )
|
|
|
|
layer = zone->GetLayerSet().Seq().front();
|
|
|
|
|
|
|
|
r = m_inspectClearanceDialog->AddPage( _( "Zone" ) );
|
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxT( "<h7>" ) + _( "Zone connection resolution for:" ) + wxT( "</h7>" ) );
|
|
|
|
r->Report( wxString::Format( wxT( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>" ),
|
2020-10-11 13:15:22 +00:00
|
|
|
_( "Layer" ),
|
2020-11-30 12:14:22 +00:00
|
|
|
EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
|
|
|
|
EscapeHTML( getItemDescription( a ) ),
|
|
|
|
EscapeHTML( getItemDescription( b ) ) ) );
|
2020-10-11 13:15:22 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
ZONE_CONNECTION zoneConnection = zone->GetPadConnection( pad );
|
|
|
|
|
|
|
|
if( zoneConnection == ZONE_CONNECTION::THERMAL )
|
2021-01-31 00:30:40 +00:00
|
|
|
{
|
2021-08-15 17:23:54 +00:00
|
|
|
int gap = zone->GetThermalReliefGap();
|
2021-01-31 00:30:40 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
r->Report( "" );
|
|
|
|
r->Report( wxString::Format( _( "Zone thermal relief: %s." ),
|
|
|
|
StringFromValue( r->GetUnits(), gap, true ) ) );
|
2021-01-31 00:30:40 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
gap = zone->GetThermalReliefGap( pad, &source );
|
|
|
|
|
|
|
|
if( source != _( "zone" ) )
|
|
|
|
{
|
|
|
|
r->Report( wxString::Format( _( "Overridden by %s; thermal relief: %s." ),
|
|
|
|
source,
|
|
|
|
StringFromValue( r->GetUnits(), gap, true ) ) );
|
|
|
|
}
|
2021-01-31 00:30:40 +00:00
|
|
|
}
|
2021-08-15 17:23:54 +00:00
|
|
|
else if( zoneConnection == ZONE_CONNECTION::NONE )
|
2021-01-31 00:30:40 +00:00
|
|
|
{
|
2021-08-15 17:23:54 +00:00
|
|
|
clearance = zone->GetLocalClearance();
|
2021-01-31 00:30:40 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
r->Report( "" );
|
|
|
|
r->Report( wxString::Format( _( "Zone clearance: %s." ),
|
|
|
|
StringFromValue( r->GetUnits(), clearance, true ) ) );
|
2021-01-31 00:30:40 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
if( zone->GetThermalReliefGap( pad ) > clearance )
|
|
|
|
{
|
|
|
|
clearance = zone->GetThermalReliefGap( pad, &source );
|
|
|
|
|
|
|
|
if( source != _( "zone" ) )
|
|
|
|
{
|
|
|
|
r->Report( wxString::Format( _( "Overridden by larger thermal relief from %s;"
|
|
|
|
"clearance: %s." ),
|
|
|
|
source,
|
|
|
|
StringFromValue( r->GetUnits(), clearance, true ) ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( compileError )
|
|
|
|
reportCompileError( r );
|
|
|
|
|
|
|
|
r->Report( "" );
|
|
|
|
r->Report( wxString::Format( _( "Clearance: %s." ),
|
|
|
|
StringFromValue( units, 0, true ) ) );
|
2021-01-31 00:30:40 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-08-15 17:23:54 +00:00
|
|
|
if( compileError )
|
|
|
|
reportCompileError( r );
|
|
|
|
|
|
|
|
// Report a 0 clearance for solid connections
|
|
|
|
r->Report( "" );
|
|
|
|
r->Report( wxString::Format( _( "Clearance: %s." ),
|
|
|
|
StringFromValue( units, 0, true ) ) );
|
2021-01-31 00:30:40 +00:00
|
|
|
}
|
2021-08-15 17:23:54 +00:00
|
|
|
|
|
|
|
r->Flush();
|
2020-09-10 19:58:05 +00:00
|
|
|
}
|
2021-08-15 17:23:54 +00:00
|
|
|
else if( copperIntersection.any() && !aFP && !bFP )
|
2021-01-09 16:43:13 +00:00
|
|
|
{
|
2021-08-15 17:23:54 +00:00
|
|
|
PCB_LAYER_ID layer = active;
|
2021-01-09 16:43:13 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
if( !copperIntersection.test( layer ) )
|
|
|
|
layer = copperIntersection.Seq().front();
|
2021-01-09 16:43:13 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
r = m_inspectClearanceDialog->AddPage( m_frame->GetBoard()->GetLayerName( layer ) );
|
2020-09-10 19:58:05 +00:00
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxT( "<h7>" ) + _( "Clearance resolution for:" ) + wxT( "</h7>" ) );
|
|
|
|
r->Report( wxString::Format( wxT( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>" ),
|
2020-10-08 22:40:11 +00:00
|
|
|
_( "Layer" ),
|
2020-11-30 12:14:22 +00:00
|
|
|
EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
|
|
|
|
EscapeHTML( getItemDescription( a ) ),
|
|
|
|
EscapeHTML( getItemDescription( b ) ) ) );
|
2020-09-10 19:58:05 +00:00
|
|
|
|
|
|
|
if( ac && bc && ac->GetNetCode() > 0 && ac->GetNetCode() == bc->GetNetCode() )
|
|
|
|
{
|
|
|
|
// Same nets....
|
2021-08-15 17:23:54 +00:00
|
|
|
r->Report( _( "Items belong to the same net. Clearance is 0." ) );
|
2020-09-10 19:58:05 +00:00
|
|
|
}
|
2020-10-12 17:29:54 +00:00
|
|
|
else
|
2020-09-10 19:58:05 +00:00
|
|
|
{
|
2020-10-12 17:29:54 +00:00
|
|
|
// Different nets (or one or both unconnected)....
|
2021-08-15 17:23:54 +00:00
|
|
|
constraint = drcEngine.EvalRules( CLEARANCE_CONSTRAINT, a, b, layer, r );
|
|
|
|
clearance = constraint.m_Value.Min();
|
|
|
|
|
|
|
|
if( compileError )
|
|
|
|
reportCompileError( r );
|
|
|
|
|
|
|
|
r->Report( "" );
|
|
|
|
r->Report( wxString::Format( _( "Resolved clearance: %s." ),
|
|
|
|
StringFromValue( units, clearance, true ) ) );
|
2020-09-10 19:58:05 +00:00
|
|
|
}
|
2021-08-15 17:23:54 +00:00
|
|
|
|
|
|
|
r->Flush();
|
2020-09-10 19:58:05 +00:00
|
|
|
}
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
for( PCB_LAYER_ID layer : { F_SilkS, B_SilkS } )
|
|
|
|
{
|
2021-08-17 14:37:33 +00:00
|
|
|
PCB_LAYER_ID correspondingMask = IsFrontLayer( layer ) ? F_Mask : B_Mask;
|
|
|
|
|
|
|
|
if( ( a->IsOnLayer( layer ) && b->IsOnLayer( layer ) )
|
|
|
|
|| ( a->IsOnLayer( layer ) && b->IsOnLayer( correspondingMask ) )
|
|
|
|
|| ( b->IsOnLayer( layer ) && a->IsOnLayer( correspondingMask ) ) )
|
2021-08-15 17:23:54 +00:00
|
|
|
{
|
|
|
|
r = m_inspectClearanceDialog->AddPage( m_frame->GetBoard()->GetLayerName( layer ) );
|
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxT( "<h7>" ) + _( "Silkscreen clearance resolution for:" ) + wxT( "</h7>" ) );
|
|
|
|
r->Report( wxString::Format( wxT( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>" ),
|
2021-08-15 17:23:54 +00:00
|
|
|
_( "Layer" ),
|
|
|
|
EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
|
|
|
|
EscapeHTML( getItemDescription( a ) ),
|
|
|
|
EscapeHTML( getItemDescription( b ) ) ) );
|
|
|
|
|
|
|
|
constraint = drcEngine.EvalRules( SILK_CLEARANCE_CONSTRAINT, a, b, layer, r );
|
|
|
|
clearance = constraint.m_Value.Min();
|
|
|
|
|
|
|
|
if( compileError )
|
|
|
|
reportCompileError( r );
|
|
|
|
|
|
|
|
r->Report( "" );
|
|
|
|
r->Report( wxString::Format( _( "Resolved clearance: %s." ),
|
|
|
|
StringFromValue( units, clearance, true ) ) );
|
|
|
|
|
|
|
|
r->Flush();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for( PCB_LAYER_ID layer : { F_CrtYd, B_CrtYd } )
|
|
|
|
{
|
2022-07-31 21:14:24 +00:00
|
|
|
bool aCourtyard = aFP && !aFP->GetCourtyard( layer ).IsEmpty();
|
|
|
|
bool bCourtyard = bFP && !bFP->GetCourtyard( layer ).IsEmpty();
|
2021-08-15 17:23:54 +00:00
|
|
|
|
|
|
|
if( aCourtyard && bCourtyard )
|
|
|
|
{
|
|
|
|
r = m_inspectClearanceDialog->AddPage( m_frame->GetBoard()->GetLayerName( layer ) );
|
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxT( "<h7>" ) + _( "Courtyard clearance resolution for:" ) + wxT( "</h7>" ) );
|
|
|
|
r->Report( wxString::Format( wxT( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>" ),
|
2021-08-15 17:23:54 +00:00
|
|
|
_( "Layer" ),
|
|
|
|
EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
|
|
|
|
EscapeHTML( getItemDescription( a ) ),
|
|
|
|
EscapeHTML( getItemDescription( b ) ) ) );
|
|
|
|
|
|
|
|
constraint = drcEngine.EvalRules( COURTYARD_CLEARANCE_CONSTRAINT, a, b, layer, r );
|
|
|
|
clearance = constraint.m_Value.Min();
|
|
|
|
|
|
|
|
if( compileError )
|
|
|
|
reportCompileError( r );
|
|
|
|
|
|
|
|
r->Report( "" );
|
|
|
|
r->Report( wxString::Format( _( "Resolved clearance: %s." ),
|
|
|
|
StringFromValue( units, clearance, true ) ) );
|
|
|
|
|
|
|
|
r->Flush();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( hasHole( a ) || hasHole( b ) )
|
|
|
|
{
|
|
|
|
PCB_LAYER_ID layer = UNDEFINED_LAYER;
|
|
|
|
|
|
|
|
if( hasHole( a ) && b->IsOnLayer( active ) && IsCopperLayer( active ) )
|
|
|
|
layer = active;
|
|
|
|
else if( hasHole( b ) && a->IsOnLayer( active ) && IsCopperLayer( active ) )
|
|
|
|
layer = active;
|
|
|
|
else if( hasHole( a ) && IsCopperLayer( b->GetLayer() ) )
|
|
|
|
layer = b->GetLayer();
|
|
|
|
else if( hasHole( b ) && IsCopperLayer( a->GetLayer() ) )
|
|
|
|
layer = a->GetLayer();
|
|
|
|
|
|
|
|
if( layer >= 0 )
|
|
|
|
{
|
|
|
|
r = m_inspectClearanceDialog->AddPage( _( "Hole" ) );
|
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxT( "<h7>" ) + _( "Hole clearance resolution for:" ) + wxT( "</h7>" ) );
|
|
|
|
r->Report( wxString::Format( wxT( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>" ),
|
2021-08-15 17:23:54 +00:00
|
|
|
_( "Layer" ),
|
|
|
|
EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
|
|
|
|
EscapeHTML( getItemDescription( a ) ),
|
|
|
|
EscapeHTML( getItemDescription( b ) ) ) );
|
|
|
|
|
|
|
|
constraint = drcEngine.EvalRules( HOLE_CLEARANCE_CONSTRAINT, a, b, layer, r );
|
|
|
|
clearance = constraint.m_Value.Min();
|
|
|
|
|
|
|
|
if( compileError )
|
|
|
|
reportCompileError( r );
|
|
|
|
|
|
|
|
r->Report( "" );
|
|
|
|
r->Report( wxString::Format( _( "Resolved clearance: %s." ),
|
|
|
|
StringFromValue( units, clearance, true ) ) );
|
|
|
|
|
|
|
|
r->Flush();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for( PCB_LAYER_ID edgeLayer : { Edge_Cuts, Margin } )
|
|
|
|
{
|
|
|
|
PCB_LAYER_ID layer = UNDEFINED_LAYER;
|
|
|
|
|
|
|
|
if( a->IsOnLayer( edgeLayer ) && b->IsOnLayer( active ) && IsCopperLayer( active ) )
|
|
|
|
layer = active;
|
|
|
|
else if( b->IsOnLayer( edgeLayer ) && a->IsOnLayer( active ) && IsCopperLayer( active ) )
|
|
|
|
layer = active;
|
|
|
|
else if( a->IsOnLayer( edgeLayer ) && IsCopperLayer( b->GetLayer() ) )
|
|
|
|
layer = b->GetLayer();
|
|
|
|
else if( b->IsOnLayer( edgeLayer ) && IsCopperLayer( a->GetLayer() ) )
|
|
|
|
layer = a->GetLayer();
|
|
|
|
|
|
|
|
if( layer >= 0 )
|
|
|
|
{
|
|
|
|
wxString layerName = m_frame->GetBoard()->GetLayerName( edgeLayer );
|
|
|
|
r = m_inspectClearanceDialog->AddPage( layerName + wxS( " " ) + _( "Clearance" ) );
|
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxT( "<h7>" ) + _( "Edge clearance resolution for:" ) + wxT( "</h7>" ) );
|
|
|
|
r->Report( wxString::Format( wxT( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>" ),
|
2021-08-15 17:23:54 +00:00
|
|
|
_( "Layer" ),
|
|
|
|
EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
|
|
|
|
EscapeHTML( getItemDescription( a ) ),
|
|
|
|
EscapeHTML( getItemDescription( b ) ) ) );
|
|
|
|
|
|
|
|
constraint = drcEngine.EvalRules( EDGE_CLEARANCE_CONSTRAINT, a, b, layer, r );
|
|
|
|
clearance = constraint.m_Value.Min();
|
|
|
|
|
|
|
|
if( compileError )
|
|
|
|
reportCompileError( r );
|
|
|
|
|
|
|
|
r->Report( "" );
|
|
|
|
r->Report( wxString::Format( _( "Resolved clearance: %s." ),
|
|
|
|
StringFromValue( units, clearance, true ) ) );
|
|
|
|
|
|
|
|
r->Flush();
|
|
|
|
}
|
|
|
|
}
|
2020-09-10 19:58:05 +00:00
|
|
|
|
2021-08-17 14:37:33 +00:00
|
|
|
if( m_inspectClearanceDialog->GetPageCount() == 0 )
|
|
|
|
{
|
|
|
|
r = m_inspectClearanceDialog->AddPage( _( "Clearance" ) );
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxT( "<h7>" ) + _( "Items share no relevant layers:" ) + wxT( "</h7>" ) );
|
|
|
|
r->Report( wxString::Format( wxT( "<ul><li>%s</li><li>%s</li></ul>" ),
|
2021-08-17 14:37:33 +00:00
|
|
|
EscapeHTML( getItemDescription( a ) ),
|
|
|
|
EscapeHTML( getItemDescription( b ) ) ) );
|
|
|
|
r->Flush();
|
|
|
|
}
|
|
|
|
|
2020-10-15 20:21:34 +00:00
|
|
|
m_inspectClearanceDialog->Raise();
|
2020-09-10 19:58:05 +00:00
|
|
|
m_inspectClearanceDialog->Show( true );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-08-09 21:25:16 +00:00
|
|
|
wxString reportMin( EDA_UNITS aUnits, DRC_CONSTRAINT& aConstraint )
|
|
|
|
{
|
|
|
|
if( aConstraint.m_Value.HasMin() )
|
|
|
|
return StringFromValue( aUnits, aConstraint.m_Value.Min(), true );
|
|
|
|
else
|
|
|
|
return wxT( "<i>" ) + _( "undefined" ) + wxT( "</i>" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString reportOpt( EDA_UNITS aUnits, DRC_CONSTRAINT& aConstraint )
|
|
|
|
{
|
|
|
|
if( aConstraint.m_Value.HasOpt() )
|
|
|
|
return StringFromValue( aUnits, aConstraint.m_Value.Opt(), true );
|
|
|
|
else
|
|
|
|
return wxT( "<i>" ) + _( "undefined" ) + wxT( "</i>" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxString reportMax( EDA_UNITS aUnits, DRC_CONSTRAINT& aConstraint )
|
|
|
|
{
|
|
|
|
if( aConstraint.m_Value.HasMax() )
|
|
|
|
return StringFromValue( aUnits, aConstraint.m_Value.Max(), true );
|
|
|
|
else
|
|
|
|
return wxT( "<i>" ) + _( "undefined" ) + wxT( "</i>" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
int BOARD_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent )
|
2020-09-22 23:16:02 +00:00
|
|
|
{
|
2021-08-15 17:23:54 +00:00
|
|
|
#define EVAL_RULES( constraint, a, b, layer, r ) drcEngine.EvalRules( constraint, a, b, layer, r )
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
|
|
|
const PCB_SELECTION& selection = selTool->GetSelection();
|
2020-09-22 23:16:02 +00:00
|
|
|
|
|
|
|
if( selection.Size() != 1 )
|
|
|
|
{
|
|
|
|
m_frame->ShowInfoBarError( _( "Select an item for a constraints resolution report." ) );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_inspectConstraintsDialog == nullptr )
|
|
|
|
{
|
|
|
|
m_inspectConstraintsDialog = std::make_unique<DIALOG_CONSTRAINTS_REPORTER>( m_frame );
|
|
|
|
m_inspectConstraintsDialog->SetTitle( _( "Constraints Report" ) );
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
m_inspectConstraintsDialog->Connect( wxEVT_CLOSE_WINDOW,
|
2021-03-02 13:10:37 +00:00
|
|
|
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onInspectConstraintsDialogClosed ),
|
|
|
|
nullptr, this );
|
2020-09-22 23:16:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_inspectConstraintsDialog->DeleteAllPages();
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.GetItem( 0 ) );
|
|
|
|
DRC_ENGINE drcEngine( m_frame->GetBoard(), &m_frame->GetBoard()->GetDesignSettings() );
|
|
|
|
DRC_CONSTRAINT constraint;
|
|
|
|
bool courtyardError = false;
|
|
|
|
bool compileError = false;
|
2020-09-22 23:16:02 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2020-09-25 01:26:23 +00:00
|
|
|
drcEngine.InitEngine( m_frame->GetDesignRulesPath() );
|
2020-09-22 23:16:02 +00:00
|
|
|
}
|
2021-02-20 19:29:11 +00:00
|
|
|
catch( PARSE_ERROR& )
|
2020-09-22 23:16:02 +00:00
|
|
|
{
|
2020-10-16 23:15:44 +00:00
|
|
|
compileError = true;
|
2020-09-22 23:16:02 +00:00
|
|
|
}
|
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
for( ZONE* zone : m_frame->GetBoard()->Zones() )
|
2020-10-25 15:02:13 +00:00
|
|
|
zone->CacheBoundingBox();
|
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
for( FOOTPRINT* footprint : m_frame->GetBoard()->Footprints() )
|
2020-10-25 15:02:13 +00:00
|
|
|
{
|
2020-11-13 15:15:52 +00:00
|
|
|
for( ZONE* zone : footprint->Zones() )
|
2020-10-25 15:02:13 +00:00
|
|
|
zone->CacheBoundingBox();
|
2020-10-25 15:02:49 +00:00
|
|
|
|
2022-07-31 21:14:24 +00:00
|
|
|
footprint->BuildCourtyardCaches();
|
2020-11-20 13:55:10 +00:00
|
|
|
|
|
|
|
if( ( footprint->GetFlags() & MALFORMED_COURTYARDS ) != 0 )
|
|
|
|
courtyardError = true;
|
2020-10-25 15:02:13 +00:00
|
|
|
}
|
|
|
|
|
2020-11-30 12:14:22 +00:00
|
|
|
WX_HTML_REPORT_BOX* r = nullptr;
|
2022-07-31 21:14:24 +00:00
|
|
|
|
2020-09-22 23:16:02 +00:00
|
|
|
if( item->Type() == PCB_TRACE_T )
|
|
|
|
{
|
2020-11-30 12:14:22 +00:00
|
|
|
r = m_inspectConstraintsDialog->AddPage( _( "Track Width" ) );
|
2020-09-22 23:16:02 +00:00
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxT( "<h7>" ) + _( "Track width resolution for:" ) + wxT( "</h7>" ) );
|
|
|
|
r->Report( wxT( "<ul><li>" ) + EscapeHTML( getItemDescription( item ) ) + wxT( "</li></ul>" ) );
|
2020-09-22 23:16:02 +00:00
|
|
|
r->Report( "" );
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
constraint = EVAL_RULES( TRACK_WIDTH_CONSTRAINT, item, nullptr, item->GetLayer(), r );
|
|
|
|
|
2020-10-16 23:15:44 +00:00
|
|
|
if( compileError )
|
2021-08-15 17:23:54 +00:00
|
|
|
reportCompileError( r );
|
2020-09-22 23:16:02 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
r->Report( "" );
|
|
|
|
r->Report( wxString::Format( _( "Width constraints: min %s; opt %s; max %s." ),
|
|
|
|
reportMin( r->GetUnits(), constraint ),
|
|
|
|
reportOpt( r->GetUnits(), constraint ),
|
|
|
|
reportMax( r->GetUnits(), constraint ) ) );
|
2020-09-22 23:16:02 +00:00
|
|
|
|
|
|
|
r->Flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( item->Type() == PCB_VIA_T )
|
|
|
|
{
|
2020-11-30 12:14:22 +00:00
|
|
|
r = m_inspectConstraintsDialog->AddPage( _( "Via Diameter" ) );
|
2020-09-22 23:16:02 +00:00
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxT( "<h7>" ) + _( "Via diameter resolution for:" ) + wxT( "</h7>" ) );
|
|
|
|
r->Report( wxT( "<ul><li>" ) + EscapeHTML( getItemDescription( item ) ) + wxT( "</li></ul>" ) );
|
2020-09-22 23:16:02 +00:00
|
|
|
r->Report( "" );
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
// PADSTACKS TODO: once we have padstacks we'll need to run this per-layer....
|
|
|
|
constraint = EVAL_RULES( VIA_DIAMETER_CONSTRAINT, item, nullptr, UNDEFINED_LAYER, r );
|
|
|
|
|
2020-10-16 23:15:44 +00:00
|
|
|
if( compileError )
|
2021-08-15 17:23:54 +00:00
|
|
|
reportCompileError( r );
|
2020-09-22 23:16:02 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
r->Report( "" );
|
|
|
|
r->Report( wxString::Format( _( "Diameter constraints: min %s; opt %s; max %s." ),
|
|
|
|
reportMin( r->GetUnits(), constraint ),
|
|
|
|
reportOpt( r->GetUnits(), constraint ),
|
|
|
|
reportMax( r->GetUnits(), constraint ) ) );
|
2020-09-22 23:16:02 +00:00
|
|
|
|
2020-10-16 23:15:44 +00:00
|
|
|
r->Flush();
|
2020-09-22 23:16:02 +00:00
|
|
|
|
2020-10-25 15:02:13 +00:00
|
|
|
r = m_inspectConstraintsDialog->AddPage( _( "Via Annular Width" ) );
|
2020-09-22 23:16:02 +00:00
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxT( "<h7>" ) + _( "Via annular width resolution for:" ) + wxT( "</h7>" ) );
|
|
|
|
r->Report( wxT( "<ul><li>" ) + EscapeHTML( getItemDescription( item ) ) + wxT( "</li></ul>" ) );
|
2020-09-22 23:16:02 +00:00
|
|
|
r->Report( "" );
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
// PADSTACKS TODO: once we have padstacks we'll need to run this per-layer....
|
|
|
|
constraint = EVAL_RULES( ANNULAR_WIDTH_CONSTRAINT, item, nullptr, UNDEFINED_LAYER, r );
|
|
|
|
|
2020-10-16 23:15:44 +00:00
|
|
|
if( compileError )
|
2021-08-15 17:23:54 +00:00
|
|
|
reportCompileError( r );
|
2020-09-22 23:16:02 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
r->Report( "" );
|
|
|
|
r->Report( wxString::Format( _( "Annular width constraints: min %s; opt %s; max %s." ),
|
|
|
|
reportMin( r->GetUnits(), constraint ),
|
|
|
|
reportOpt( r->GetUnits(), constraint ),
|
|
|
|
reportMax( r->GetUnits(), constraint ) ) );
|
2020-09-22 23:16:02 +00:00
|
|
|
|
|
|
|
r->Flush();
|
|
|
|
}
|
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
if( ( item->Type() == PCB_PAD_T && static_cast<PAD*>( item )->GetDrillSize().x > 0 )
|
2020-09-22 23:16:02 +00:00
|
|
|
|| item->Type() == PCB_VIA_T )
|
|
|
|
{
|
2020-11-30 12:14:22 +00:00
|
|
|
r = m_inspectConstraintsDialog->AddPage( _( "Hole Size" ) );
|
2020-09-22 23:16:02 +00:00
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxT( "<h7>" ) + _( "Hole diameter resolution for:" ) + wxT( "</h7>" ) );
|
|
|
|
r->Report( wxT( "<ul><li>" ) + EscapeHTML( getItemDescription( item ) ) + wxT( "</li></ul>" ) );
|
2020-09-22 23:16:02 +00:00
|
|
|
r->Report( "" );
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
// PADSTACKS TODO: once we have padstacks we'll need to run this per-layer....
|
|
|
|
constraint = EVAL_RULES( HOLE_SIZE_CONSTRAINT, item, nullptr, UNDEFINED_LAYER, r );
|
|
|
|
|
2020-10-16 23:15:44 +00:00
|
|
|
if( compileError )
|
2021-08-15 17:23:54 +00:00
|
|
|
reportCompileError( r );
|
2020-10-16 23:15:44 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
wxString min = _( "undefined" );
|
2020-09-22 23:16:02 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
if( constraint.m_Value.HasMin() )
|
|
|
|
min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true );
|
2020-09-22 23:16:02 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
r->Report( "" );
|
|
|
|
r->Report( wxString::Format( _( "Hole constraint: min %s." ), min ) );
|
2020-09-22 23:16:02 +00:00
|
|
|
|
|
|
|
r->Flush();
|
|
|
|
}
|
|
|
|
|
2020-11-30 12:14:22 +00:00
|
|
|
r = m_inspectConstraintsDialog->AddPage( _( "Keepouts" ) );
|
2020-10-25 15:02:13 +00:00
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
r->Report( wxT( "<h7>" ) + _( "Keepout resolution for:" ) + wxT( "</h7>" ) );
|
|
|
|
r->Report( wxT( "<ul><li>" ) + EscapeHTML( getItemDescription( item ) ) + wxT( "</li></ul>" ) );
|
2020-10-25 15:02:13 +00:00
|
|
|
r->Report( "" );
|
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
constraint = EVAL_RULES( DISALLOW_CONSTRAINT, item, nullptr, item->GetLayer(), r );
|
|
|
|
|
2020-10-25 15:02:13 +00:00
|
|
|
if( compileError )
|
2021-08-15 17:23:54 +00:00
|
|
|
reportCompileError( r );
|
|
|
|
|
|
|
|
if( courtyardError )
|
2020-10-25 15:02:13 +00:00
|
|
|
{
|
|
|
|
r->Report( "" );
|
2021-08-15 17:23:54 +00:00
|
|
|
r->Report( _( "Report may be incomplete: some footprint courtyards are malformed." )
|
2022-02-05 13:25:43 +00:00
|
|
|
+ wxT( " <a href='drc'>" ) + _( "Run DRC for a full analysis." ) + wxT( "</a>" ) );
|
2020-10-25 15:02:13 +00:00
|
|
|
}
|
2020-11-20 13:55:10 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
r->Report( "" );
|
2020-10-25 15:02:13 +00:00
|
|
|
|
2021-08-15 17:23:54 +00:00
|
|
|
if( constraint.m_DisallowFlags )
|
|
|
|
r->Report( _( "Item <b>disallowed</b> at current location." ) );
|
|
|
|
else
|
|
|
|
r->Report( _( "Item allowed at current location." ) );
|
2020-10-25 15:02:13 +00:00
|
|
|
|
|
|
|
r->Flush();
|
|
|
|
|
2020-09-22 23:16:02 +00:00
|
|
|
m_inspectConstraintsDialog->FinishInitialization();
|
2020-10-15 20:21:34 +00:00
|
|
|
m_inspectConstraintsDialog->Raise();
|
2020-09-22 23:16:02 +00:00
|
|
|
m_inspectConstraintsDialog->Show( true );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
int BOARD_INSPECTION_TOOL::CrossProbePcbToSch( const TOOL_EVENT& aEvent )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
|
|
|
// Don't get in an infinite loop PCB -> SCH -> PCB -> SCH -> ...
|
|
|
|
if( m_probingSchToPcb )
|
|
|
|
return 0;
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
|
|
|
const PCB_SELECTION& selection = selTool->GetSelection();
|
2019-08-12 14:41:45 +00:00
|
|
|
|
|
|
|
if( selection.Size() == 1 )
|
|
|
|
m_frame->SendMessageToEESCHEMA( static_cast<BOARD_ITEM*>( selection.Front() ) );
|
|
|
|
else
|
|
|
|
m_frame->SendMessageToEESCHEMA( nullptr );
|
|
|
|
|
2021-04-09 02:09:06 +00:00
|
|
|
// Update 3D viewer highlighting
|
2021-05-11 13:44:21 +00:00
|
|
|
m_frame->Update3DView( false, frame()->GetDisplayOptions().m_Live3DRefresh );
|
2020-09-02 16:54:57 +00:00
|
|
|
|
2019-08-12 14:41:45 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
int BOARD_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
|
|
|
BOARD_ITEM* item = aEvent.Parameter<BOARD_ITEM*>();
|
|
|
|
|
|
|
|
m_probingSchToPcb = true; // recursion guard
|
|
|
|
{
|
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
|
|
|
|
|
|
|
if( item )
|
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, (void*) item );
|
|
|
|
}
|
|
|
|
m_probingSchToPcb = false;
|
|
|
|
|
2021-05-11 13:44:21 +00:00
|
|
|
bool request3DviewRedraw = frame()->GetDisplayOptions().m_Live3DRefresh;
|
2020-09-02 17:16:36 +00:00
|
|
|
|
2020-11-13 12:21:02 +00:00
|
|
|
if( item && item->Type() != PCB_FOOTPRINT_T )
|
|
|
|
request3DviewRedraw = false;
|
2020-09-02 17:16:36 +00:00
|
|
|
|
2021-04-09 02:09:06 +00:00
|
|
|
// Update 3D viewer highlighting
|
2020-09-02 17:16:36 +00:00
|
|
|
if( request3DviewRedraw )
|
2021-04-09 02:09:06 +00:00
|
|
|
m_frame->Update3DView( false, true );
|
2020-09-02 17:16:36 +00:00
|
|
|
|
2019-08-12 14:41:45 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
bool BOARD_INSPECTION_TOOL::highlightNet( const VECTOR2D& aPosition, bool aUseSelection )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-10-13 01:07:57 +00:00
|
|
|
BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
|
|
|
|
KIGFX::RENDER_SETTINGS* settings = getView()->GetPainter()->GetSettings();
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
2019-08-12 14:41:45 +00:00
|
|
|
|
|
|
|
int net = -1;
|
|
|
|
bool enableHighlight = false;
|
|
|
|
|
|
|
|
if( aUseSelection )
|
|
|
|
{
|
2020-12-16 13:31:32 +00:00
|
|
|
const PCB_SELECTION& selection = selectionTool->GetSelection();
|
2021-05-29 15:53:55 +00:00
|
|
|
std::set<int> netcodes;
|
2019-08-12 14:41:45 +00:00
|
|
|
|
2021-09-26 18:25:49 +00:00
|
|
|
for( EDA_ITEM* item : selection )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2021-09-26 18:25:49 +00:00
|
|
|
if( BOARD_CONNECTED_ITEM* ci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
|
2021-05-29 15:53:55 +00:00
|
|
|
netcodes.insert( ci->GetNetCode() );
|
2019-08-12 14:41:45 +00:00
|
|
|
}
|
|
|
|
|
2021-05-29 15:53:55 +00:00
|
|
|
enableHighlight = !netcodes.empty();
|
|
|
|
|
|
|
|
if( enableHighlight && netcodes.size() > 1 )
|
|
|
|
{
|
|
|
|
// If we are doing a multi-highlight, cross-probing back and other stuff is not
|
|
|
|
// yet supported
|
|
|
|
settings->SetHighlight( netcodes );
|
|
|
|
board->ResetNetHighLight();
|
|
|
|
|
|
|
|
for( int multiNet : netcodes )
|
|
|
|
board->SetHighLightNet( multiNet, true );
|
|
|
|
|
|
|
|
board->HighLightON();
|
|
|
|
m_toolMgr->GetView()->UpdateAllLayersColor();
|
|
|
|
m_currentlyHighlighted = netcodes;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if( enableHighlight )
|
|
|
|
{
|
|
|
|
net = *netcodes.begin();
|
|
|
|
}
|
2019-08-12 14:41:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// If we didn't get a net to highlight from the selection, use the cursor
|
|
|
|
if( net < 0 )
|
|
|
|
{
|
2020-10-13 01:07:57 +00:00
|
|
|
GENERAL_COLLECTORS_GUIDE guide = m_frame->GetCollectorsGuide();
|
2021-09-26 18:25:49 +00:00
|
|
|
guide.SetIgnoreZoneFills( false );
|
2019-08-12 14:41:45 +00:00
|
|
|
|
2020-10-13 01:07:57 +00:00
|
|
|
PCB_LAYER_ID activeLayer = static_cast<PCB_LAYER_ID>( view()->GetTopLayer() );
|
|
|
|
guide.SetPreferredLayer( activeLayer );
|
|
|
|
|
2021-09-26 18:25:49 +00:00
|
|
|
GENERAL_COLLECTOR collector;
|
2019-08-12 14:41:45 +00:00
|
|
|
collector.Collect( board, GENERAL_COLLECTOR::PadsOrTracks, (wxPoint) aPosition, guide );
|
|
|
|
|
|
|
|
if( collector.GetCount() == 0 )
|
|
|
|
collector.Collect( board, GENERAL_COLLECTOR::Zones, (wxPoint) aPosition, guide );
|
|
|
|
|
2020-12-20 16:24:19 +00:00
|
|
|
// Apply the active selection filter, except we want to allow picking locked items for
|
|
|
|
// highlighting even if the user has disabled them for selection
|
|
|
|
SELECTION_FILTER_OPTIONS& filter = selectionTool->GetFilter();
|
|
|
|
|
|
|
|
bool saved = filter.lockedItems;
|
|
|
|
filter.lockedItems = true;
|
|
|
|
|
2021-09-24 17:57:22 +00:00
|
|
|
selectionTool->FilterCollectedItems( collector, true );
|
2020-10-13 01:07:57 +00:00
|
|
|
|
2020-12-20 16:24:19 +00:00
|
|
|
filter.lockedItems = saved;
|
|
|
|
|
2019-08-12 14:41:45 +00:00
|
|
|
// Clear the previous highlight
|
|
|
|
m_frame->SendMessageToEESCHEMA( nullptr );
|
|
|
|
|
2020-10-13 01:07:57 +00:00
|
|
|
bool highContrast = settings->GetHighContrast();
|
|
|
|
PCB_LAYER_ID contrastLayer = settings->GetPrimaryHighContrastLayer();
|
|
|
|
|
2020-10-14 01:45:09 +00:00
|
|
|
for( int i = collector.GetCount() - 1; i >= 0; i-- )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-10-13 01:07:57 +00:00
|
|
|
LSET itemLayers = collector[i]->GetLayerSet();
|
|
|
|
|
2020-10-14 01:45:09 +00:00
|
|
|
if( ( itemLayers & LSET::AllCuMask() ).none() ||
|
|
|
|
( highContrast && !itemLayers.Contains( contrastLayer ) ) )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-10-14 01:45:09 +00:00
|
|
|
collector.Remove( i );
|
|
|
|
continue;
|
2019-08-12 14:41:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enableHighlight = ( collector.GetCount() > 0 );
|
|
|
|
|
|
|
|
// Obtain net code for the clicked item
|
|
|
|
if( enableHighlight )
|
2020-10-14 01:45:09 +00:00
|
|
|
{
|
|
|
|
BOARD_CONNECTED_ITEM* targetItem = static_cast<BOARD_CONNECTED_ITEM*>( collector[0] );
|
|
|
|
|
|
|
|
if( targetItem->Type() == PCB_PAD_T )
|
|
|
|
m_frame->SendMessageToEESCHEMA( targetItem );
|
|
|
|
|
|
|
|
net = targetItem->GetNetCode();
|
|
|
|
}
|
2019-08-12 14:41:45 +00:00
|
|
|
}
|
|
|
|
|
2022-04-13 23:14:46 +00:00
|
|
|
const std::set<int>& netcodes = settings->GetHighlightNetCodes();
|
2020-06-24 03:36:05 +00:00
|
|
|
|
2019-08-12 14:41:45 +00:00
|
|
|
// Toggle highlight when the same net was picked
|
2022-04-13 23:14:46 +00:00
|
|
|
if( netcodes.count( net ) )
|
2019-08-12 14:41:45 +00:00
|
|
|
enableHighlight = !settings->IsHighlightEnabled();
|
|
|
|
|
2021-03-02 13:10:37 +00:00
|
|
|
if( enableHighlight != settings->IsHighlightEnabled() || !netcodes.count( net ) )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-06-24 03:36:05 +00:00
|
|
|
if( !netcodes.empty() )
|
2021-05-29 15:53:55 +00:00
|
|
|
m_lastHighlighted = netcodes;
|
2020-06-24 03:36:05 +00:00
|
|
|
|
2019-08-12 14:41:45 +00:00
|
|
|
settings->SetHighlight( enableHighlight, net );
|
|
|
|
m_toolMgr->GetView()->UpdateAllLayersColor();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Store the highlighted netcode in the current board (for dialogs for instance)
|
|
|
|
if( enableHighlight && net >= 0 )
|
|
|
|
{
|
2021-05-29 15:53:55 +00:00
|
|
|
m_currentlyHighlighted = netcodes;
|
2019-08-12 14:41:45 +00:00
|
|
|
board->SetHighLightNet( net );
|
2020-04-13 11:37:42 +00:00
|
|
|
board->HighLightON();
|
2019-08-12 14:41:45 +00:00
|
|
|
|
|
|
|
NETINFO_ITEM* netinfo = board->FindNet( net );
|
|
|
|
|
|
|
|
if( netinfo )
|
|
|
|
{
|
2021-09-26 23:22:32 +00:00
|
|
|
std::vector<MSG_PANEL_ITEM> items;
|
2020-04-24 13:36:10 +00:00
|
|
|
netinfo->GetMsgPanelInfo( m_frame, items );
|
2019-08-12 14:41:45 +00:00
|
|
|
m_frame->SetMsgPanel( items );
|
|
|
|
m_frame->SendCrossProbeNetName( netinfo->GetNetname() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-05-29 15:53:55 +00:00
|
|
|
m_currentlyHighlighted.clear();
|
2019-08-12 14:41:45 +00:00
|
|
|
board->ResetNetHighLight();
|
|
|
|
m_frame->SetMsgPanel( board );
|
|
|
|
m_frame->SendCrossProbeNetName( "" );
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
int BOARD_INSPECTION_TOOL::HighlightNet( const TOOL_EVENT& aEvent )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-07-11 17:42:00 +00:00
|
|
|
int netcode = aEvent.Parameter<intptr_t>();
|
|
|
|
KIGFX::RENDER_SETTINGS* settings = m_toolMgr->GetView()->GetPainter()->GetSettings();
|
|
|
|
const std::set<int>& highlighted = settings->GetHighlightNetCodes();
|
2019-08-12 14:41:45 +00:00
|
|
|
|
|
|
|
if( netcode > 0 )
|
|
|
|
{
|
2021-05-29 15:53:55 +00:00
|
|
|
m_lastHighlighted = highlighted;
|
2019-08-12 14:41:45 +00:00
|
|
|
settings->SetHighlight( true, netcode );
|
|
|
|
m_toolMgr->GetView()->UpdateAllLayersColor();
|
2021-05-29 15:53:55 +00:00
|
|
|
m_currentlyHighlighted.clear();
|
|
|
|
m_currentlyHighlighted.insert( netcode );
|
|
|
|
}
|
|
|
|
else if( aEvent.IsAction( &PCB_ACTIONS::highlightNetSelection ) )
|
|
|
|
{
|
|
|
|
// Highlight selection (cursor position will be ignored)
|
|
|
|
highlightNet( getViewControls()->GetMousePosition(), true );
|
2019-08-12 14:41:45 +00:00
|
|
|
}
|
|
|
|
else if( aEvent.IsAction( &PCB_ACTIONS::toggleLastNetHighlight ) )
|
|
|
|
{
|
2021-05-29 15:53:55 +00:00
|
|
|
std::set<int> temp = highlighted;
|
|
|
|
settings->SetHighlight( m_lastHighlighted );
|
|
|
|
m_toolMgr->GetView()->UpdateAllLayersColor();
|
|
|
|
m_currentlyHighlighted = m_lastHighlighted;
|
|
|
|
m_lastHighlighted = temp;
|
|
|
|
}
|
|
|
|
else if( aEvent.IsAction( &PCB_ACTIONS::toggleNetHighlight ) )
|
|
|
|
{
|
|
|
|
bool turnOn = highlighted.empty() && !m_currentlyHighlighted.empty();
|
|
|
|
settings->SetHighlight( m_currentlyHighlighted, turnOn );
|
2019-08-12 14:41:45 +00:00
|
|
|
m_toolMgr->GetView()->UpdateAllLayersColor();
|
|
|
|
}
|
|
|
|
else // Highlight the net belonging to the item under the cursor
|
|
|
|
{
|
|
|
|
highlightNet( getViewControls()->GetMousePosition(), false );
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
int BOARD_INSPECTION_TOOL::ClearHighlight( const TOOL_EVENT& aEvent )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
|
|
|
BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
|
|
|
|
KIGFX::RENDER_SETTINGS* settings = m_toolMgr->GetView()->GetPainter()->GetSettings();
|
|
|
|
|
2021-05-29 15:53:55 +00:00
|
|
|
m_currentlyHighlighted.clear();
|
|
|
|
m_lastHighlighted.clear();
|
|
|
|
|
2019-08-12 14:41:45 +00:00
|
|
|
board->ResetNetHighLight();
|
|
|
|
settings->SetHighlight( false );
|
|
|
|
m_toolMgr->GetView()->UpdateAllLayersColor();
|
|
|
|
m_frame->SetMsgPanel( board );
|
|
|
|
m_frame->SendCrossProbeNetName( "" );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-05-29 15:53:55 +00:00
|
|
|
#if 0
|
2020-12-16 13:31:32 +00:00
|
|
|
int BOARD_INSPECTION_TOOL::HighlightNetTool( const TOOL_EVENT& aEvent )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-12-16 13:31:32 +00:00
|
|
|
std::string tool = aEvent.GetCommandStr().get();
|
|
|
|
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
|
2019-08-12 14:41:45 +00:00
|
|
|
|
|
|
|
// Deactivate other tools; particularly important if another PICKER is currently running
|
|
|
|
Activate();
|
|
|
|
|
|
|
|
// If the keyboard hotkey was triggered and we are already in the highlight tool, behave
|
|
|
|
// the same as a left-click. Otherwise highlight the net of the selected item(s), or if
|
|
|
|
// there is no selection, then behave like a ctrl-left-click.
|
|
|
|
if( aEvent.IsAction( &PCB_ACTIONS::highlightNetSelection ) )
|
|
|
|
{
|
|
|
|
bool use_selection = m_frame->IsCurrentTool( PCB_ACTIONS::highlightNetTool );
|
|
|
|
highlightNet( getViewControls()->GetMousePosition(), use_selection );
|
|
|
|
}
|
|
|
|
|
|
|
|
picker->SetClickHandler(
|
|
|
|
[this] ( const VECTOR2D& pt ) -> bool
|
|
|
|
{
|
|
|
|
highlightNet( pt, false );
|
|
|
|
return true;
|
|
|
|
} );
|
|
|
|
|
|
|
|
picker->SetLayerSet( LSET::AllCuMask() );
|
2020-12-28 22:26:39 +00:00
|
|
|
picker->SetSnapping( false );
|
2019-08-12 14:41:45 +00:00
|
|
|
|
|
|
|
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2021-05-29 15:53:55 +00:00
|
|
|
#endif
|
2019-08-12 14:41:45 +00:00
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
int BOARD_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-12-16 13:31:32 +00:00
|
|
|
std::string tool = aEvent.GetCommandStr().get();
|
|
|
|
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
|
|
|
|
BOARD* board = getModel<BOARD>();
|
2019-08-12 14:41:45 +00:00
|
|
|
|
|
|
|
// Deactivate other tools; particularly important if another PICKER is currently running
|
|
|
|
Activate();
|
|
|
|
|
|
|
|
picker->SetClickHandler(
|
2021-04-13 02:12:48 +00:00
|
|
|
[this, board]( const VECTOR2D& pt ) -> bool
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2021-04-13 02:12:48 +00:00
|
|
|
const PCB_DISPLAY_OPTIONS& opt = displayOptions();
|
|
|
|
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
2019-08-12 14:41:45 +00:00
|
|
|
|
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, EDIT_TOOL::PadFilter );
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION& selection = selectionTool->GetSelection();
|
2019-08-12 14:41:45 +00:00
|
|
|
|
|
|
|
if( selection.Empty() )
|
|
|
|
{
|
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true,
|
|
|
|
EDIT_TOOL::FootprintFilter );
|
|
|
|
selection = selectionTool->GetSelection();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( selection.Empty() )
|
|
|
|
{
|
|
|
|
// Clear the previous local ratsnest if we click off all items
|
2020-11-13 15:15:52 +00:00
|
|
|
for( FOOTPRINT* fp : board->Footprints() )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-11-12 22:30:02 +00:00
|
|
|
for( PAD* pad : fp->Pads() )
|
2019-11-07 14:23:09 +00:00
|
|
|
pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest );
|
2019-08-12 14:41:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-14 23:37:26 +00:00
|
|
|
for( EDA_ITEM* item : selection )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-11-12 22:30:02 +00:00
|
|
|
if( PAD* pad = dyn_cast<PAD*>( item) )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
|
|
|
pad->SetLocalRatsnestVisible( !pad->GetLocalRatsnestVisible() );
|
|
|
|
}
|
2020-11-13 15:15:52 +00:00
|
|
|
else if( FOOTPRINT* fp = dyn_cast<FOOTPRINT*>( item) )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-10-14 23:37:26 +00:00
|
|
|
if( !fp->Pads().empty() )
|
2020-06-01 07:09:40 +00:00
|
|
|
{
|
2020-10-14 23:37:26 +00:00
|
|
|
bool enable = !fp->Pads()[0]->GetLocalRatsnestVisible();
|
2019-08-12 14:41:45 +00:00
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
for( PAD* childPad : fp->Pads() )
|
2020-10-14 23:37:26 +00:00
|
|
|
childPad->SetLocalRatsnestVisible( enable );
|
2020-06-01 07:09:40 +00:00
|
|
|
}
|
2019-08-12 14:41:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_toolMgr->GetView()->MarkTargetDirty( KIGFX::TARGET_OVERLAY );
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} );
|
|
|
|
|
|
|
|
picker->SetFinalizeHandler(
|
2021-04-13 02:12:48 +00:00
|
|
|
[this, board]( int aCondition )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2021-04-13 02:12:48 +00:00
|
|
|
const PCB_DISPLAY_OPTIONS& opt = displayOptions();
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
if( aCondition != PCB_PICKER_TOOL::END_ACTIVATE )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-11-13 15:15:52 +00:00
|
|
|
for( FOOTPRINT* fp : board->Footprints() )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-11-12 22:30:02 +00:00
|
|
|
for( PAD* pad : fp->Pads() )
|
2019-11-07 14:23:09 +00:00
|
|
|
pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest );
|
2019-08-12 14:41:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
|
|
|
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
int BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest( const TOOL_EVENT& aEvent )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-08-16 20:30:05 +00:00
|
|
|
VECTOR2I delta;
|
|
|
|
|
|
|
|
// If we have passed the simple move vector, we can update without recalculation
|
|
|
|
if( aEvent.Parameter<VECTOR2I*>() )
|
|
|
|
{
|
|
|
|
delta = *aEvent.Parameter<VECTOR2I*>();
|
|
|
|
delete aEvent.Parameter<VECTOR2I*>();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// We can delete the existing map to force a recalculation
|
|
|
|
delete m_dynamicData;
|
|
|
|
m_dynamicData = nullptr;
|
|
|
|
}
|
2020-08-15 00:33:27 +00:00
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
auto selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
2019-08-12 14:41:45 +00:00
|
|
|
auto& selection = selectionTool->GetSelection();
|
|
|
|
auto connectivity = getModel<BOARD>()->GetConnectivity();
|
|
|
|
|
|
|
|
if( selection.Empty() )
|
|
|
|
{
|
|
|
|
connectivity->ClearDynamicRatsnest();
|
2020-08-15 00:33:27 +00:00
|
|
|
delete m_dynamicData;
|
|
|
|
m_dynamicData = nullptr;
|
2019-08-12 14:41:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-08-16 20:30:05 +00:00
|
|
|
calculateSelectionRatsnest( delta );
|
2019-08-12 14:41:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
int BOARD_INSPECTION_TOOL::HideDynamicRatsnest( const TOOL_EVENT& aEvent )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-08-15 00:33:27 +00:00
|
|
|
getModel<BOARD>()->GetConnectivity()->ClearDynamicRatsnest();
|
|
|
|
delete m_dynamicData;
|
|
|
|
m_dynamicData = nullptr;
|
2020-06-25 00:16:07 +00:00
|
|
|
|
2020-08-15 00:33:27 +00:00
|
|
|
return 0;
|
2019-08-12 14:41:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
void BOARD_INSPECTION_TOOL::calculateSelectionRatsnest( const VECTOR2I& aDelta )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
|
|
|
SELECTION& selection = selectionTool->GetSelection();
|
2019-08-12 14:41:45 +00:00
|
|
|
std::shared_ptr<CONNECTIVITY_DATA> connectivity = board()->GetConnectivity();
|
|
|
|
std::vector<BOARD_ITEM*> items;
|
2020-12-16 13:31:32 +00:00
|
|
|
std::deque<EDA_ITEM*> queued_items( selection.begin(), selection.end() );
|
2019-08-12 14:41:45 +00:00
|
|
|
|
2020-08-15 02:45:56 +00:00
|
|
|
for( std::size_t i = 0; i < queued_items.size(); ++i )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-08-15 02:45:56 +00:00
|
|
|
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( queued_items[i] );
|
|
|
|
|
2020-11-13 12:21:02 +00:00
|
|
|
if( item->Type() == PCB_FOOTPRINT_T )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-11-13 15:15:52 +00:00
|
|
|
for( PAD* pad : static_cast<FOOTPRINT*>( item )->Pads() )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2019-11-07 14:23:09 +00:00
|
|
|
if( pad->GetLocalRatsnestVisible() || displayOptions().m_ShowModuleRatsnest )
|
2019-08-12 14:41:45 +00:00
|
|
|
items.push_back( pad );
|
|
|
|
}
|
|
|
|
}
|
2020-08-15 02:45:56 +00:00
|
|
|
else if( item->Type() == PCB_GROUP_T )
|
|
|
|
{
|
|
|
|
PCB_GROUP *group = static_cast<PCB_GROUP*>( item );
|
|
|
|
group->RunOnDescendants( [ &queued_items ]( BOARD_ITEM *aItem )
|
2020-10-31 17:25:08 +00:00
|
|
|
{
|
|
|
|
queued_items.push_back( aItem );
|
|
|
|
} );
|
2020-08-15 02:45:56 +00:00
|
|
|
}
|
2020-08-10 17:59:23 +00:00
|
|
|
else if( BOARD_CONNECTED_ITEM* boardItem = dyn_cast<BOARD_CONNECTED_ITEM*>( item ) )
|
2019-08-12 14:41:45 +00:00
|
|
|
{
|
2020-08-10 17:59:23 +00:00
|
|
|
if( boardItem->GetLocalRatsnestVisible() || displayOptions().m_ShowModuleRatsnest )
|
|
|
|
items.push_back( boardItem );
|
2019-08-12 14:41:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-31 17:25:08 +00:00
|
|
|
if( items.empty() || std::none_of( items.begin(), items.end(),
|
|
|
|
[]( const BOARD_ITEM* aItem )
|
|
|
|
{
|
|
|
|
return( aItem->Type() == PCB_TRACE_T
|
|
|
|
|| aItem->Type() == PCB_PAD_T
|
|
|
|
|| aItem->Type() == PCB_ARC_T
|
2020-11-11 23:05:59 +00:00
|
|
|
|| aItem->Type() == PCB_ZONE_T
|
2020-11-13 12:21:02 +00:00
|
|
|
|| aItem->Type() == PCB_FOOTPRINT_T
|
2020-10-31 17:25:08 +00:00
|
|
|
|| aItem->Type() == PCB_VIA_T );
|
|
|
|
} ) )
|
2020-08-15 00:33:27 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !m_dynamicData )
|
|
|
|
{
|
|
|
|
m_dynamicData = new CONNECTIVITY_DATA( items, true );
|
|
|
|
connectivity->BlockRatsnestItems( items );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_dynamicData->Move( aDelta );
|
|
|
|
}
|
|
|
|
|
|
|
|
connectivity->ComputeDynamicRatsnest( items, m_dynamicData );
|
2019-08-12 14:41:45 +00:00
|
|
|
}
|
|
|
|
|
2020-07-11 01:06:17 +00:00
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
int BOARD_INSPECTION_TOOL::ListNets( const TOOL_EVENT& aEvent )
|
2020-04-12 19:20:30 +00:00
|
|
|
{
|
2020-04-13 11:37:42 +00:00
|
|
|
if( m_listNetsDialog == nullptr )
|
2020-04-13 11:54:35 +00:00
|
|
|
{
|
|
|
|
m_listNetsDialog =
|
2020-11-11 12:59:59 +00:00
|
|
|
std::make_unique<DIALOG_NET_INSPECTOR>( m_frame, m_listNetsDialogSettings );
|
2020-04-12 19:20:30 +00:00
|
|
|
|
2020-04-13 11:54:35 +00:00
|
|
|
m_listNetsDialog->Connect( wxEVT_CLOSE_WINDOW,
|
2020-12-16 13:31:32 +00:00
|
|
|
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr,
|
2020-04-13 11:54:35 +00:00
|
|
|
this );
|
|
|
|
|
|
|
|
m_listNetsDialog->Connect( wxEVT_BUTTON,
|
2020-12-16 13:31:32 +00:00
|
|
|
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr,
|
2020-04-13 11:54:35 +00:00
|
|
|
this );
|
|
|
|
}
|
2020-04-12 19:20:30 +00:00
|
|
|
|
2020-10-15 20:21:34 +00:00
|
|
|
m_listNetsDialog->Raise();
|
2020-04-13 11:54:35 +00:00
|
|
|
m_listNetsDialog->Show( true );
|
2020-04-12 19:20:30 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2019-08-12 14:41:45 +00:00
|
|
|
|
2020-07-11 01:06:17 +00:00
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
void BOARD_INSPECTION_TOOL::onListNetsDialogClosed( wxCommandEvent& event )
|
2020-04-13 11:54:35 +00:00
|
|
|
{
|
|
|
|
m_listNetsDialogSettings = m_listNetsDialog->Settings();
|
|
|
|
|
|
|
|
m_listNetsDialog->Disconnect( wxEVT_CLOSE_WINDOW,
|
2020-12-16 13:31:32 +00:00
|
|
|
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr, this );
|
2020-04-13 11:54:35 +00:00
|
|
|
|
|
|
|
m_listNetsDialog->Disconnect( wxEVT_BUTTON,
|
2020-12-16 13:31:32 +00:00
|
|
|
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr, this );
|
2020-04-13 11:54:35 +00:00
|
|
|
|
|
|
|
m_listNetsDialog->Destroy();
|
|
|
|
m_listNetsDialog.release();
|
|
|
|
}
|
|
|
|
|
2020-07-11 01:06:17 +00:00
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
void BOARD_INSPECTION_TOOL::onInspectClearanceDialogClosed( wxCommandEvent& event )
|
2020-09-10 19:58:05 +00:00
|
|
|
{
|
|
|
|
m_inspectClearanceDialog->Disconnect( wxEVT_CLOSE_WINDOW,
|
2021-03-02 13:10:37 +00:00
|
|
|
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onInspectClearanceDialogClosed ),
|
|
|
|
nullptr, this );
|
2020-09-10 19:58:05 +00:00
|
|
|
|
|
|
|
m_inspectClearanceDialog->Destroy();
|
|
|
|
m_inspectClearanceDialog.release();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
void BOARD_INSPECTION_TOOL::onInspectConstraintsDialogClosed( wxCommandEvent& event )
|
2020-09-22 23:16:02 +00:00
|
|
|
{
|
|
|
|
m_inspectConstraintsDialog->Disconnect( wxEVT_CLOSE_WINDOW,
|
2021-03-02 13:10:37 +00:00
|
|
|
wxCommandEventHandler( BOARD_INSPECTION_TOOL::onInspectConstraintsDialogClosed ),
|
|
|
|
nullptr, this );
|
2020-09-22 23:16:02 +00:00
|
|
|
|
|
|
|
m_inspectConstraintsDialog->Destroy();
|
|
|
|
m_inspectConstraintsDialog.release();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
int BOARD_INSPECTION_TOOL::HideNet( const TOOL_EVENT& aEvent )
|
2020-07-11 01:06:17 +00:00
|
|
|
{
|
|
|
|
doHideNet( aEvent.Parameter<intptr_t>(), true );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
int BOARD_INSPECTION_TOOL::ShowNet( const TOOL_EVENT& aEvent )
|
2020-07-11 01:06:17 +00:00
|
|
|
{
|
|
|
|
doHideNet( aEvent.Parameter<intptr_t>(), false );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
void BOARD_INSPECTION_TOOL::doHideNet( int aNetCode, bool aHide )
|
2020-07-11 01:06:17 +00:00
|
|
|
{
|
|
|
|
KIGFX::PCB_RENDER_SETTINGS* rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>(
|
|
|
|
m_toolMgr->GetView()->GetPainter()->GetSettings() );
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
|
|
|
SELECTION& selection = selectionTool->GetSelection();
|
2020-07-11 01:06:17 +00:00
|
|
|
|
|
|
|
if( aNetCode <= 0 && !selection.Empty() )
|
|
|
|
{
|
|
|
|
for( EDA_ITEM* item : selection )
|
|
|
|
{
|
|
|
|
if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
|
|
|
|
{
|
|
|
|
if( bci->GetNetCode() > 0 )
|
|
|
|
doHideNet( bci->GetNetCode(), aHide );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aHide )
|
|
|
|
rs->GetHiddenNets().insert( aNetCode );
|
|
|
|
else
|
|
|
|
rs->GetHiddenNets().erase( aNetCode );
|
|
|
|
|
|
|
|
m_frame->GetCanvas()->RedrawRatsnest();
|
|
|
|
m_frame->GetCanvas()->Refresh();
|
2021-01-14 09:37:08 +00:00
|
|
|
|
2021-02-17 03:31:09 +00:00
|
|
|
m_frame->GetAppearancePanel()->OnNetVisibilityChanged( aNetCode, !aHide );
|
2020-07-11 01:06:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
void BOARD_INSPECTION_TOOL::setTransitions()
|
2019-07-16 19:34:07 +00:00
|
|
|
{
|
2020-12-16 13:31:32 +00:00
|
|
|
Go( &BOARD_INSPECTION_TOOL::CrossProbePcbToSch, EVENTS::SelectedEvent );
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::CrossProbePcbToSch, EVENTS::UnselectedEvent );
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::CrossProbePcbToSch, EVENTS::ClearedEvent );
|
|
|
|
|
2021-03-02 13:10:37 +00:00
|
|
|
Go( &BOARD_INSPECTION_TOOL::LocalRatsnestTool,
|
|
|
|
PCB_ACTIONS::localRatsnestTool.MakeEvent() );
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::HideDynamicRatsnest,
|
|
|
|
PCB_ACTIONS::hideDynamicRatsnest.MakeEvent() );
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest,
|
|
|
|
PCB_ACTIONS::updateLocalRatsnest.MakeEvent() );
|
2020-12-16 13:31:32 +00:00
|
|
|
|
2021-05-29 15:53:55 +00:00
|
|
|
Go( &BOARD_INSPECTION_TOOL::ListNets, PCB_ACTIONS::listNets.MakeEvent() );
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::ShowStatisticsDialog, PCB_ACTIONS::boardStatistics.MakeEvent() );
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::InspectClearance, PCB_ACTIONS::inspectClearance.MakeEvent() );
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::InspectConstraints, PCB_ACTIONS::inspectConstraints.MakeEvent() );
|
|
|
|
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::highlightNet.MakeEvent() );
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::highlightNetSelection.MakeEvent() );
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::toggleLastNetHighlight.MakeEvent() );
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::ClearHighlight, PCB_ACTIONS::clearHighlight.MakeEvent() );
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::toggleNetHighlight.MakeEvent() );
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::HighlightItem, PCB_ACTIONS::highlightItem.MakeEvent() );
|
|
|
|
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::HideNet, PCB_ACTIONS::hideNet.MakeEvent() );
|
|
|
|
Go( &BOARD_INSPECTION_TOOL::ShowNet, PCB_ACTIONS::showNet.MakeEvent() );
|
2019-07-16 19:34:07 +00:00
|
|
|
}
|