ADDED constraints reporter for diagnosing constraints.
Also fixes an issue with via type property and makes property comparisons in rule case-insensitive. Fixes https://gitlab.com/kicad/code/kicad/issues/5754
This commit is contained in:
parent
fb7f98b51d
commit
6d18f20093
|
@ -208,7 +208,7 @@ public:
|
|||
if( m_type == VT_NUMERIC && b.m_type == VT_NUMERIC )
|
||||
return m_valueDbl == b.m_valueDbl;
|
||||
else if( m_type == VT_STRING && b.m_type == VT_STRING )
|
||||
return m_valueStr == b.m_valueStr;
|
||||
return m_valueStr.CmpNoCase( b.m_valueStr ) == 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,8 @@ set( PCBNEW_DIALOGS
|
|||
dialogs/dialog_cleanup_graphics_base.cpp
|
||||
dialogs/dialog_cleanup_tracks_and_vias.cpp
|
||||
dialogs/dialog_cleanup_tracks_and_vias_base.cpp
|
||||
dialogs/dialog_constraints_reporter.cpp
|
||||
dialogs/dialog_constraints_reporter_base.cpp
|
||||
dialogs/dialog_copper_zones.cpp
|
||||
dialogs/dialog_copper_zones_base.cpp
|
||||
dialogs/dialog_create_array.cpp
|
||||
|
|
|
@ -1046,8 +1046,8 @@ static struct TRACK_VIA_DESC
|
|||
ENUM_MAP<VIATYPE>::Instance()
|
||||
.Undefined( VIATYPE::NOT_DEFINED )
|
||||
.Map( VIATYPE::THROUGH, _( "Through" ) )
|
||||
.Map( VIATYPE::BLIND_BURIED, _( "Blind/Buried" ) )
|
||||
.Map( VIATYPE::MICROVIA, _( "Microvia" ) );
|
||||
.Map( VIATYPE::BLIND_BURIED, _( "Buried_via" ) )
|
||||
.Map( VIATYPE::MICROVIA, _( "Micro_via" ) );
|
||||
|
||||
ENUM_MAP<PCB_LAYER_ID>& layerEnum = ENUM_MAP<PCB_LAYER_ID>::Instance();
|
||||
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <dialog_constraints_reporter.h>
|
||||
#include <pcb_base_frame.h>
|
||||
#include <wx_html_report_box.h>
|
||||
|
||||
|
||||
DIALOG_CONSTRAINTS_REPORTER::DIALOG_CONSTRAINTS_REPORTER( PCB_BASE_FRAME* aParent ) :
|
||||
DIALOG_CONSTRAINTS_REPORTER_BASE( aParent ),
|
||||
m_frame( aParent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_CONSTRAINTS_REPORTER::FinishInitialization()
|
||||
{
|
||||
FinishDialogSettings();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_CONSTRAINTS_REPORTER::DeleteAllPages()
|
||||
{
|
||||
m_notebook->DeleteAllPages();
|
||||
}
|
||||
|
||||
|
||||
WX_HTML_REPORT_BOX* DIALOG_CONSTRAINTS_REPORTER::AddPage( const wxString& aTitle )
|
||||
{
|
||||
wxPanel* panel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||
wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
WX_HTML_REPORT_BOX* reporter = new WX_HTML_REPORT_BOX( panel, wxID_ANY, wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxHW_SCROLLBAR_AUTO|wxBORDER_SIMPLE );
|
||||
|
||||
sizer->Add( reporter, 1, wxEXPAND|wxALL, 5 );
|
||||
panel->SetSizer( sizer );
|
||||
panel->Layout();
|
||||
m_notebook->AddPage( panel, aTitle );
|
||||
|
||||
reporter->SetUnits( m_frame->GetUserUnits() );
|
||||
|
||||
return reporter;
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef DIALOG_CONSTRAINTS_REPORTER_H
|
||||
#define DIALOG_CONSTRAINTS_REPORTER_H
|
||||
|
||||
#include <dialog_constraints_reporter_base.h>
|
||||
|
||||
class PCB_BASE_FRAME;
|
||||
class WX_HTML_REPORT_BOX;
|
||||
|
||||
|
||||
class DIALOG_CONSTRAINTS_REPORTER : public DIALOG_CONSTRAINTS_REPORTER_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_CONSTRAINTS_REPORTER( PCB_BASE_FRAME* aParent );
|
||||
|
||||
void FinishInitialization();
|
||||
|
||||
void DeleteAllPages();
|
||||
WX_HTML_REPORT_BOX* AddPage( const wxString& pageTitle );
|
||||
|
||||
protected:
|
||||
PCB_BASE_FRAME* m_frame;
|
||||
};
|
||||
|
||||
#endif // DIALOG_CONSTRAINTS_REPORTER_H
|
|
@ -0,0 +1,42 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_constraints_reporter_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_CONSTRAINTS_REPORTER_BASE::DIALOG_CONSTRAINTS_REPORTER_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), 0 );
|
||||
m_notebook->SetMinSize( wxSize( 480,360 ) );
|
||||
|
||||
|
||||
bMainSizer->Add( m_notebook, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
m_sdbSizer = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer->AddButton( m_sdbSizerOK );
|
||||
m_sdbSizer->Realize();
|
||||
|
||||
bMainSizer->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
bMainSizer->Fit( this );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
}
|
||||
|
||||
DIALOG_CONSTRAINTS_REPORTER_BASE::~DIALOG_CONSTRAINTS_REPORTER_BASE()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="15" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">dialog_constraints_reporter_base</property>
|
||||
<property name="first_id">2240</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">DialogConstraintsReporterBase</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_lua_events">1</property>
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="center">wxBOTH</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_CONSTRAINTS_REPORTER_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h; forward_declare</property>
|
||||
<property name="title">Constraints Resolution Report</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bMainSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxNotebook" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmapsize"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">480,360</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_notebook</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="1">
|
||||
<property name="Apply">0</property>
|
||||
<property name="Cancel">0</property>
|
||||
<property name="ContextHelp">0</property>
|
||||
<property name="Help">0</property>
|
||||
<property name="No">0</property>
|
||||
<property name="OK">1</property>
|
||||
<property name="Save">0</property>
|
||||
<property name="Yes">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_sdbSizer</property>
|
||||
<property name="permission">protected</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
|
@ -0,0 +1,45 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_CONSTRAINTS_REPORTER_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_CONSTRAINTS_REPORTER_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxNotebook* m_notebook;
|
||||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
wxButton* m_sdbSizerOK;
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_CONSTRAINTS_REPORTER_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Constraints Resolution Report"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_CONSTRAINTS_REPORTER_BASE();
|
||||
|
||||
};
|
||||
|
|
@ -129,7 +129,7 @@ void DRC_ENGINE::loadImplicitRules()
|
|||
|
||||
// 2) micro-via specific defaults (new DRC doesn't treat microvias in any special way)
|
||||
|
||||
DRC_RULE* uViaRule = createImplicitRule( _( "board setup constraints" ));
|
||||
DRC_RULE* uViaRule = createImplicitRule( _( "board setup micro-via constraints" ));
|
||||
|
||||
uViaRule->m_Condition = new DRC_RULE_CONDITION ( "A.Via_Type == 'micro_via'" );
|
||||
|
||||
|
|
|
@ -375,6 +375,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
inspectMenu->AppendSeparator();
|
||||
inspectMenu->Add( PCB_ACTIONS::runDRC );
|
||||
inspectMenu->Add( PCB_ACTIONS::inspectClearance );
|
||||
inspectMenu->Add( PCB_ACTIONS::inspectConstraints );
|
||||
|
||||
|
||||
//-- Tools menu ----------------------------------------------------------
|
||||
|
|
|
@ -1046,6 +1046,12 @@ TOOL_ACTION PCB_ACTIONS::inspectClearance( "pcbnew.InspectionTool.InspectClearan
|
|||
_( "Show clearance resolution for the active layer between two selected objects" ),
|
||||
mw_add_gap_xpm );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::inspectConstraints( "pcbnew.InspectionTool.InspectConstraints",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Constraints Resolution..." ),
|
||||
_( "Show constraints resolution for the selected object" ),
|
||||
mw_add_gap_xpm );
|
||||
|
||||
//Geographic re-annotation tool
|
||||
TOOL_ACTION PCB_ACTIONS::boardReannotate( "pcbnew.ReannotateTool.ShowReannotateDialog",
|
||||
AS_GLOBAL, 0, "",
|
||||
|
|
|
@ -424,6 +424,8 @@ public:
|
|||
static TOOL_ACTION boardReannotate;
|
||||
static TOOL_ACTION repairBoard;
|
||||
static TOOL_ACTION inspectClearance;
|
||||
static TOOL_ACTION inspectConstraints;
|
||||
|
||||
|
||||
// Appearance controls
|
||||
static TOOL_ACTION clearHighlight;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <dialogs/wx_html_report_box.h>
|
||||
#include <drc/drc_engine.h>
|
||||
#include <dialogs/panel_setup_rules_base.h>
|
||||
#include <dialogs/dialog_constraints_reporter.h>
|
||||
#include "pcb_inspection_tool.h"
|
||||
|
||||
|
||||
|
@ -308,6 +309,154 @@ int PCB_INSPECTION_TOOL::InspectClearance( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int PCB_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
|
||||
const PCBNEW_SELECTION& selection = selTool->GetSelection();
|
||||
|
||||
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" ) );
|
||||
|
||||
m_inspectConstraintsDialog->Connect( wxEVT_CLOSE_WINDOW,
|
||||
wxCommandEventHandler( PCB_INSPECTION_TOOL::onInspectConstraintsDialogClosed ),
|
||||
nullptr, this );
|
||||
}
|
||||
|
||||
m_inspectConstraintsDialog->DeleteAllPages();
|
||||
|
||||
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.GetItem( 0 ) );
|
||||
DRC_ENGINE drcEngine( m_frame->GetBoard(), &m_frame->GetBoard()->GetDesignSettings() );
|
||||
|
||||
try
|
||||
{
|
||||
drcEngine.InitEngine( m_frame->Prj().AbsolutePath( "drc-rules" ) );
|
||||
}
|
||||
catch( PARSE_ERROR& pe )
|
||||
{
|
||||
m_frame->ShowBoardSetupDialog( _( "Rules" ), pe.What(), ID_RULES_EDITOR,
|
||||
pe.lineNumber, pe.byteIndex );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( item->Type() == PCB_TRACE_T )
|
||||
{
|
||||
WX_HTML_REPORT_BOX* r = m_inspectConstraintsDialog->AddPage( "Track Width" );
|
||||
|
||||
r->Report( _( "<h7>Track width resolution for:</h7>" ) );
|
||||
r->Report( wxString::Format( _( "<ul><li>%s</li></ul>" ),
|
||||
item->GetSelectMenuText( r->GetUnits() ) ) );
|
||||
r->Report( "" );
|
||||
|
||||
auto constraint = drcEngine.EvalRulesForItems( DRC_CONSTRAINT_TYPE_TRACK_WIDTH, item,
|
||||
nullptr, UNDEFINED_LAYER, r );
|
||||
|
||||
wxString min = _( "undefined" );
|
||||
wxString max = _( "undefined" );
|
||||
|
||||
if( constraint.m_Value.HasMin() )
|
||||
min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true );
|
||||
|
||||
if( constraint.m_Value.HasMax() )
|
||||
max = StringFromValue( r->GetUnits(), constraint.m_Value.Max(), true );
|
||||
|
||||
r->Report( "" );
|
||||
r->Report( wxString::Format( _( "Width constraints: min %s max %s." ),
|
||||
min,
|
||||
max ) );
|
||||
r->Flush();
|
||||
}
|
||||
|
||||
if( item->Type() == PCB_VIA_T )
|
||||
{
|
||||
WX_HTML_REPORT_BOX* r = m_inspectConstraintsDialog->AddPage( "Via Diameter" );
|
||||
|
||||
r->Report( _( "<h7>Via diameter resolution for:</h7>" ) );
|
||||
r->Report( wxString::Format( _( "<ul><li>%s</li></ul>" ),
|
||||
item->GetSelectMenuText( r->GetUnits() ) ) );
|
||||
r->Report( "" );
|
||||
|
||||
auto constraint = drcEngine.EvalRulesForItems( DRC_CONSTRAINT_TYPE_VIA_DIAMETER, item,
|
||||
nullptr, UNDEFINED_LAYER, r );
|
||||
|
||||
wxString min = _( "undefined" );
|
||||
wxString max = _( "undefined" );
|
||||
|
||||
if( constraint.m_Value.HasMin() )
|
||||
min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true );
|
||||
|
||||
if( constraint.m_Value.HasMax() )
|
||||
max = StringFromValue( r->GetUnits(), constraint.m_Value.Max(), true );
|
||||
|
||||
r->Report( "" );
|
||||
r->Report( wxString::Format( _( "Diameter constraints: min %s max %s." ),
|
||||
min,
|
||||
max ) );
|
||||
r->Flush();
|
||||
|
||||
|
||||
r = m_inspectConstraintsDialog->AddPage( "Via Annular Width" );
|
||||
|
||||
r->Report( _( "<h7>Via annular width resolution for:</h7>" ) );
|
||||
r->Report( wxString::Format( _( "<ul><li>%s</li></ul>" ),
|
||||
item->GetSelectMenuText( r->GetUnits() ) ) );
|
||||
r->Report( "" );
|
||||
|
||||
constraint = drcEngine.EvalRulesForItems( DRC_CONSTRAINT_TYPE_ANNULUS_WIDTH, item,
|
||||
nullptr, UNDEFINED_LAYER, r );
|
||||
|
||||
min = _( "undefined" );
|
||||
max = _( "undefined" );
|
||||
|
||||
if( constraint.m_Value.HasMin() )
|
||||
min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true );
|
||||
|
||||
if( constraint.m_Value.HasMax() )
|
||||
max = StringFromValue( r->GetUnits(), constraint.m_Value.Max(), true );
|
||||
|
||||
r->Report( "" );
|
||||
r->Report( wxString::Format( _( "Annular width constraints: min %s max %s." ),
|
||||
min,
|
||||
max ) );
|
||||
r->Flush();
|
||||
}
|
||||
|
||||
if( ( item->Type() == PCB_PAD_T && static_cast<D_PAD*>( item )->GetDrillSize().x > 0 )
|
||||
|| item->Type() == PCB_VIA_T )
|
||||
{
|
||||
WX_HTML_REPORT_BOX* r = m_inspectConstraintsDialog->AddPage( "Hole Size" );
|
||||
|
||||
r->Report( _( "<h7>Hole diameter resolution for:</h7>" ) );
|
||||
r->Report( wxString::Format( _( "<ul><li>%s</li></ul>" ),
|
||||
item->GetSelectMenuText( r->GetUnits() ) ) );
|
||||
r->Report( "" );
|
||||
|
||||
auto constraint = drcEngine.EvalRulesForItems( DRC_CONSTRAINT_TYPE_HOLE_SIZE, item,
|
||||
nullptr, UNDEFINED_LAYER, r );
|
||||
|
||||
wxString min = _( "undefined" );
|
||||
|
||||
if( constraint.m_Value.HasMin() )
|
||||
min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true );
|
||||
|
||||
r->Report( "" );
|
||||
r->Report( wxString::Format( _( "Hole constraint: min %s." ), min ) );
|
||||
r->Flush();
|
||||
}
|
||||
|
||||
m_inspectConstraintsDialog->FinishInitialization();
|
||||
m_inspectConstraintsDialog->Show( true );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int PCB_INSPECTION_TOOL::CrossProbePcbToSch( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
// Don't get in an infinite loop PCB -> SCH -> PCB -> SCH -> ...
|
||||
|
@ -751,13 +900,23 @@ void PCB_INSPECTION_TOOL::onListNetsDialogClosed( wxCommandEvent& event )
|
|||
void PCB_INSPECTION_TOOL::onInspectClearanceDialogClosed( wxCommandEvent& event )
|
||||
{
|
||||
m_inspectClearanceDialog->Disconnect( wxEVT_CLOSE_WINDOW,
|
||||
wxCommandEventHandler( PCB_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr, this );
|
||||
wxCommandEventHandler( PCB_INSPECTION_TOOL::onInspectClearanceDialogClosed ), nullptr, this );
|
||||
|
||||
m_inspectClearanceDialog->Destroy();
|
||||
m_inspectClearanceDialog.release();
|
||||
}
|
||||
|
||||
|
||||
void PCB_INSPECTION_TOOL::onInspectConstraintsDialogClosed( wxCommandEvent& event )
|
||||
{
|
||||
m_inspectConstraintsDialog->Disconnect( wxEVT_CLOSE_WINDOW,
|
||||
wxCommandEventHandler( PCB_INSPECTION_TOOL::onInspectConstraintsDialogClosed ), nullptr, this );
|
||||
|
||||
m_inspectConstraintsDialog->Destroy();
|
||||
m_inspectConstraintsDialog.release();
|
||||
}
|
||||
|
||||
|
||||
int PCB_INSPECTION_TOOL::HideNet( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
doHideNet( aEvent.Parameter<intptr_t>(), true );
|
||||
|
@ -817,6 +976,7 @@ void PCB_INSPECTION_TOOL::setTransitions()
|
|||
Go( &PCB_INSPECTION_TOOL::ListNets, PCB_ACTIONS::listNets.MakeEvent() );
|
||||
Go( &PCB_INSPECTION_TOOL::ShowStatisticsDialog, PCB_ACTIONS::boardStatistics.MakeEvent() );
|
||||
Go( &PCB_INSPECTION_TOOL::InspectClearance, PCB_ACTIONS::inspectClearance.MakeEvent() );
|
||||
Go( &PCB_INSPECTION_TOOL::InspectConstraints, PCB_ACTIONS::inspectConstraints.MakeEvent() );
|
||||
|
||||
Go( &PCB_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::highlightNet.MakeEvent() );
|
||||
Go( &PCB_INSPECTION_TOOL::HighlightNet, PCB_ACTIONS::highlightNetSelection.MakeEvent() );
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <dialogs/dialog_board_statistics.h>
|
||||
#include <dialogs/dialog_select_net_from_list.h>
|
||||
#include <dialogs/dialog_HTML_reporter_base.h>
|
||||
#include <dialogs/dialog_constraints_reporter.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <tools/pcb_tool_base.h>
|
||||
|
@ -93,6 +94,8 @@ public:
|
|||
///> Show the clearance resolution for two selected items
|
||||
int InspectClearance( const TOOL_EVENT& aEvent );
|
||||
|
||||
int InspectConstraints( const TOOL_EVENT& aEvent );
|
||||
|
||||
private:
|
||||
///> Event handler to recalculate dynamic ratsnest
|
||||
void ratsnestTimer( wxTimerEvent& aEvent );
|
||||
|
@ -109,6 +112,7 @@ private:
|
|||
|
||||
void onListNetsDialogClosed( wxCommandEvent& aEvent );
|
||||
void onInspectClearanceDialogClosed( wxCommandEvent& aEvent );
|
||||
void onInspectConstraintsDialogClosed( wxCommandEvent& aEvent );
|
||||
|
||||
void reportZoneConnection( ZONE_CONTAINER* aZone, D_PAD* aPad, REPORTER* r );
|
||||
|
||||
|
@ -127,6 +131,7 @@ private:
|
|||
DIALOG_SELECT_NET_FROM_LIST::SETTINGS m_listNetsDialogSettings;
|
||||
|
||||
std::unique_ptr<DIALOG_HTML_REPORTER> m_inspectClearanceDialog;
|
||||
std::unique_ptr<DIALOG_CONSTRAINTS_REPORTER> m_inspectConstraintsDialog;
|
||||
};
|
||||
|
||||
#endif //__BOARD_STATISTICS_TOOL_H
|
||||
|
|
Loading…
Reference in New Issue