Improve SNR.

This commit is contained in:
Jeff Young 2022-02-12 16:32:55 +00:00
parent 8dcc933fc3
commit a2ca8cf413
10 changed files with 65 additions and 75 deletions

View File

@ -28,11 +28,11 @@
static const UTIL::CFG_MAP<TRACK_CLEARANCE_MODE> clearanceModeMap =
{
{ SHOW_TRACK_CLEARANCE_WITH_VIA_WHILE_ROUTING, 2 }, // Default
{ DO_NOT_SHOW_CLEARANCE, 0 },
{ SHOW_TRACK_CLEARANCE_WHILE_ROUTING, 1 },
{ SHOW_WHILE_ROUTING_OR_DRAGGING, 3 },
{ SHOW_TRACK_CLEARANCE_WITH_VIA_ALWAYS, 4 },
{ SHOW_WITH_VIA_WHILE_ROUTING, 2 }, // Default
{ DO_NOT_SHOW_CLEARANCE, 0 },
{ SHOW_WHILE_ROUTING, 1 },
{ SHOW_WITH_VIA_WHILE_ROUTING_OR_DRAGGING, 3 },
{ SHOW_WITH_VIA_ALWAYS, 4 },
};
@ -49,13 +49,13 @@ PANEL_DISPLAY_OPTIONS::PANEL_DISPLAY_OPTIONS( wxWindow* aParent, APP_SETTINGS_BA
void PANEL_DISPLAY_OPTIONS::loadPCBSettings( PCBNEW_SETTINGS* aCfg )
{
int i = UTIL::GetConfigForVal( clearanceModeMap, aCfg->m_Display.m_ShowTrackClearanceMode );
int i = UTIL::GetConfigForVal( clearanceModeMap, aCfg->m_Display.m_TrackClearance );
m_OptDisplayTracksClearance->SetSelection( i );
m_OptDisplayPadClearence->SetValue( aCfg->m_Display.m_DisplayPadClearance );
m_OptDisplayPadNumber->SetValue( aCfg->m_Display.m_DisplayPadNum );
m_OptDisplayPadNoConn->SetValue( aCfg->m_Display.m_DisplayPadNoConnects );
m_ShowNetNamesOption->SetSelection( aCfg->m_Display.m_DisplayNetNamesMode );
m_OptDisplayPadClearence->SetValue( aCfg->m_Display.m_PadClearance );
m_OptDisplayPadNumber->SetValue( aCfg->m_Display.m_PadNumbers );
m_OptDisplayPadNoConn->SetValue( aCfg->m_Display.m_PadNoConnects );
m_ShowNetNamesOption->SetSelection( aCfg->m_Display.m_NetNames );
m_live3Drefresh->SetValue( aCfg->m_Display.m_Live3DRefresh );
m_checkCrossProbeOnSelection->SetValue( aCfg->m_CrossProbing.on_selection );
m_checkCrossProbeCenter->SetValue( aCfg->m_CrossProbing.center_on_items );
@ -93,12 +93,12 @@ bool PANEL_DISPLAY_OPTIONS::TransferDataFromWindow()
PCBNEW_SETTINGS* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>();
int i = m_OptDisplayTracksClearance->GetSelection();
cfg->m_Display.m_ShowTrackClearanceMode = UTIL::GetValFromConfig( clearanceModeMap, i );
cfg->m_Display.m_TrackClearance = UTIL::GetValFromConfig( clearanceModeMap, i );
cfg->m_Display.m_DisplayPadClearance = m_OptDisplayPadClearence->GetValue();
cfg->m_Display.m_DisplayPadNum = m_OptDisplayPadNumber->GetValue();
cfg->m_Display.m_DisplayPadNoConnects = m_OptDisplayPadNoConn->GetValue();
cfg->m_Display.m_DisplayNetNamesMode = m_ShowNetNamesOption->GetSelection();
cfg->m_Display.m_PadClearance = m_OptDisplayPadClearence->GetValue();
cfg->m_Display.m_PadNumbers = m_OptDisplayPadNumber->GetValue();
cfg->m_Display.m_PadNoConnects = m_OptDisplayPadNoConn->GetValue();
cfg->m_Display.m_NetNames = m_ShowNetNamesOption->GetSelection();
cfg->m_Display.m_Live3DRefresh = m_live3Drefresh->GetValue();
cfg->m_CrossProbing.on_selection = m_checkCrossProbeOnSelection->GetValue();
cfg->m_CrossProbing.zoom_to_fit = m_checkCrossProbeZoom->GetValue();

View File

@ -1043,11 +1043,11 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
}
else if( dynamic_cast<PCB_TRACK*>( aItem ) )
{
return CHANGED( m_DisplayPadClearance );
return CHANGED( m_PadClearance );
}
else if( dynamic_cast<PAD*>( aItem ) )
{
return CHANGED( m_ShowTrackClearanceMode );
return CHANGED( m_TrackClearance );
}
else if( dynamic_cast<EDA_TEXT*>( aItem ) )
{
@ -1155,7 +1155,7 @@ void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
{
// Clearances could be layer-dependent so redraw them when the active layer
// is changed
if( Settings().m_Display.m_DisplayPadClearance )
if( Settings().m_Display.m_PadClearance )
{
// Round-corner rects are expensive to draw, but are mostly found on
// SMD pads which only need redrawing on an active-to-not-active
@ -1176,7 +1176,7 @@ void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
{
// Clearances could be layer-dependent so redraw them when the active layer
// is changed
if( Settings().m_Display.m_ShowTrackClearanceMode )
if( Settings().m_Display.m_TrackClearance )
{
// Tracks aren't particularly expensive to draw, but it's an easy check.
return track->IsOnLayer( oldLayer ) || track->IsOnLayer( aLayer );
@ -1781,7 +1781,7 @@ void PCB_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
auto* painter = static_cast<KIGFX::PCB_PAINTER*>( GetCanvas()->GetView()->GetPainter() );
auto* renderSettings = painter->GetSettings();
renderSettings->LoadDisplayOptions( GetDisplayOptions() );
SetElementVisibility( LAYER_NO_CONNECTS, Settings().m_Display.m_DisplayPadNoConnects );
SetElementVisibility( LAYER_NO_CONNECTS, Settings().m_Display.m_PadNoConnects );
SetElementVisibility( LAYER_RATSNEST, Settings().m_Display.m_ShowGlobalRatsnest );
auto cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();

View File

@ -77,7 +77,6 @@ PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS()
m_padOpacity = 1.0;
m_zoneOpacity = 1.0;
m_ForceClearanceDisplayOff = false;
m_ForcePadSketchModeOff = false;
m_ForcePadSketchModeOn = false;
@ -563,7 +562,7 @@ void PCB_PAINTER::draw( const PCB_TRACK* aTrack, int aLayer )
if( IsNetnameLayer( aLayer ) )
{
if( !pcbconfig() || pcbconfig()->m_Display.m_DisplayNetNamesMode < 2 )
if( !pcbconfig() || pcbconfig()->m_Display.m_NetNames < 2 )
return;
if( aTrack->GetNetCode() <= NETINFO_LIST::UNCONNECTED )
@ -640,9 +639,7 @@ void PCB_PAINTER::draw( const PCB_TRACK* aTrack, int aLayer )
}
// Clearance lines
if( pcbconfig()
&& pcbconfig()->m_Display.m_ShowTrackClearanceMode == SHOW_TRACK_CLEARANCE_WITH_VIA_ALWAYS
&& !m_pcbSettings.m_ForceClearanceDisplayOff )
if( pcbconfig() && pcbconfig()->m_Display.m_TrackClearance == SHOW_WITH_VIA_ALWAYS )
{
int clearance = aTrack->GetOwnClearance( m_pcbSettings.GetActiveLayer() );
@ -684,9 +681,7 @@ void PCB_PAINTER::draw( const PCB_ARC* aArc, int aLayer )
}
// Clearance lines
if( pcbconfig()
&& pcbconfig()->m_Display.m_ShowTrackClearanceMode == SHOW_TRACK_CLEARANCE_WITH_VIA_ALWAYS
&& !m_pcbSettings.m_ForceClearanceDisplayOff )
if( pcbconfig() && pcbconfig()->m_Display.m_TrackClearance == SHOW_WITH_VIA_ALWAYS )
{
int clearance = aArc->GetOwnClearance( m_pcbSettings.GetActiveLayer() );
@ -747,8 +742,8 @@ void PCB_PAINTER::draw( const PCB_VIA* aVia, int aLayer )
if( !pcbconfig() )
return;
if( pcbconfig()->m_Display.m_DisplayNetNamesMode == 0
|| pcbconfig()->m_Display.m_DisplayNetNamesMode == 2
if( pcbconfig()->m_Display.m_NetNames == 0
|| pcbconfig()->m_Display.m_NetNames == 2
|| aVia->GetNetname().empty() )
{
return;
@ -856,10 +851,8 @@ void PCB_PAINTER::draw( const PCB_VIA* aVia, int aLayer )
}
// Clearance lines
if( pcbconfig()
&& pcbconfig()->m_Display.m_ShowTrackClearanceMode == SHOW_TRACK_CLEARANCE_WITH_VIA_ALWAYS
&& aLayer != LAYER_VIA_HOLES
&& !m_pcbSettings.m_ForceClearanceDisplayOff )
if( pcbconfig() && pcbconfig()->m_Display.m_TrackClearance == SHOW_WITH_VIA_ALWAYS
&& aLayer != LAYER_VIA_HOLES )
{
PCB_LAYER_ID activeLayer = m_pcbSettings.GetActiveLayer();
double radius;
@ -885,11 +878,11 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
if( IsNetnameLayer( aLayer ) )
{
// Is anything that we can display enabled?
bool displayNetname = ( (pcbconfig() && pcbconfig()->m_Display.m_DisplayNetNamesMode == 1)
|| (pcbconfig() && pcbconfig()->m_Display.m_DisplayNetNamesMode == 3 ) )
bool displayNetname = ( (pcbconfig() && pcbconfig()->m_Display.m_NetNames == 1)
|| (pcbconfig() && pcbconfig()->m_Display.m_NetNames == 3 ) )
&& !aPad->GetNetname().empty();
bool displayPadNumber = !pcbconfig() || pcbconfig()->m_Display.m_DisplayPadNum;
bool displayPadNumber = !pcbconfig() || pcbconfig()->m_Display.m_PadNumbers;
if( displayNetname || displayPadNumber )
{
@ -1266,10 +1259,8 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
}
}
if( pcbconfig()
&& pcbconfig()->m_Display.m_DisplayPadClearance
&& ( aLayer == LAYER_PAD_FR || aLayer == LAYER_PAD_BK || aLayer == LAYER_PADS_TH )
&& !m_pcbSettings.m_ForceClearanceDisplayOff )
if( pcbconfig() && pcbconfig()->m_Display.m_PadClearance
&& ( aLayer == LAYER_PAD_FR || aLayer == LAYER_PAD_BK || aLayer == LAYER_PADS_TH ) )
{
/* Showing the clearance area is not obvious.
* - A pad can be removed from some copper layers.

View File

@ -115,7 +115,6 @@ public:
const std::set<int>& GetHiddenNets() const { return m_hiddenNets; }
public:
bool m_ForceClearanceDisplayOff;
bool m_ForcePadSketchModeOff;
bool m_ForcePadSketchModeOn;

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2022 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
@ -157,19 +157,19 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
&m_Display.m_DisplayTextFill, true ) );
m_params.emplace_back( new PARAM<int>( "pcb_display.net_names_mode",
&m_Display.m_DisplayNetNamesMode, 3, 0, 3 ) );
&m_Display.m_NetNames, 3, 0, 3 ) );
m_params.emplace_back( new PARAM<bool>( "pcb_display.pad_clearance",
&m_Display.m_DisplayPadClearance, true ) );
&m_Display.m_PadClearance, true ) );
m_params.emplace_back( new PARAM<bool>( "pcb_display.pad_no_connects",
&m_Display.m_DisplayPadNoConnects, true ) );
&m_Display.m_PadNoConnects, true ) );
m_params.emplace_back( new PARAM<bool>( "pcb_display.pad_fill",
&m_Display.m_DisplayPadFill, true ) );
m_params.emplace_back( new PARAM<bool>( "pcb_display.pad_numbers",
&m_Display.m_DisplayPadNum, true ) );
&m_Display.m_PadNumbers, true ) );
m_params.emplace_back( new PARAM<bool>( "pcb_display.ratsnest_global",
&m_Display.m_ShowGlobalRatsnest, true ) );
@ -181,8 +181,7 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
&m_Display.m_DisplayRatsnestLinesCurved, false ) );
m_params.emplace_back( new PARAM<int>( "pcb_display.track_clearance_mode",
reinterpret_cast<int*>( &m_Display.m_ShowTrackClearanceMode ),
SHOW_TRACK_CLEARANCE_WITH_VIA_WHILE_ROUTING ) );
reinterpret_cast<int*>( &m_Display.m_TrackClearance ), SHOW_WITH_VIA_WHILE_ROUTING ) );
m_params.emplace_back( new PARAM<bool>( "pcb_display.track_fill",
&m_Display.m_DisplayPcbTrackFill, true ) );

View File

@ -64,10 +64,10 @@ enum class TRACK_DRAG_ACTION
enum TRACK_CLEARANCE_MODE
{
DO_NOT_SHOW_CLEARANCE = 0,
SHOW_TRACK_CLEARANCE_WHILE_ROUTING,
SHOW_TRACK_CLEARANCE_WITH_VIA_WHILE_ROUTING,
SHOW_WHILE_ROUTING_OR_DRAGGING,
SHOW_TRACK_CLEARANCE_WITH_VIA_ALWAYS
SHOW_WHILE_ROUTING,
SHOW_WITH_VIA_WHILE_ROUTING,
SHOW_WITH_VIA_WHILE_ROUTING_OR_DRAGGING,
SHOW_WITH_VIA_ALWAYS
};
@ -257,12 +257,12 @@ public:
bool m_DisplayTextFill;
bool m_DisplayPcbTrackFill;
TRACK_CLEARANCE_MODE m_ShowTrackClearanceMode;
bool m_DisplayPadClearance;
TRACK_CLEARANCE_MODE m_TrackClearance;
bool m_PadClearance;
int m_DisplayNetNamesMode;
bool m_DisplayPadNum;
bool m_DisplayPadNoConnects;
int m_NetNames;
bool m_PadNumbers;
bool m_PadNoConnects;
RATSNEST_MODE m_RatsnestMode;

View File

@ -1408,18 +1408,18 @@ void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aClearance, bool
auto* settings = static_cast<PCBNEW_SETTINGS*>( m_tool->GetManager()->GetSettings() );
switch( settings->m_Display.m_ShowTrackClearanceMode )
switch( settings->m_Display.m_TrackClearance )
{
case SHOW_TRACK_CLEARANCE_WITH_VIA_ALWAYS:
case SHOW_WHILE_ROUTING_OR_DRAGGING:
case SHOW_WITH_VIA_ALWAYS:
case SHOW_WITH_VIA_WHILE_ROUTING_OR_DRAGGING:
pitem->ShowClearance( aItem->OfKind( tracksOrVias ) );
break;
case SHOW_TRACK_CLEARANCE_WITH_VIA_WHILE_ROUTING:
case SHOW_WITH_VIA_WHILE_ROUTING:
pitem->ShowClearance( aItem->OfKind( tracksOrVias ) && !aEdit );
break;
case SHOW_TRACK_CLEARANCE_WHILE_ROUTING:
case SHOW_WHILE_ROUTING:
pitem->ShowClearance( aItem->OfKind( tracks ) && !aEdit );
break;

View File

@ -2,7 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
* Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* Author: Maciej Suminski <maciej.suminski@cern.ch>
*
@ -39,7 +39,8 @@ class PCB_GRID_HELPER;
class PNS_KICAD_IFACE;
class PNS_TUNE_STATUS_POPUP;
namespace PNS {
namespace PNS
{
class APIEXPORT TOOL_BASE : public PCB_TOOL_BASE
{
@ -73,7 +74,7 @@ protected:
ITEM* m_endItem;
VECTOR2I m_endSnapPoint;
PCB_GRID_HELPER* m_gridHelper;
PCB_GRID_HELPER* m_gridHelper;
PNS_KICAD_IFACE* m_iface;
ROUTER* m_router;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 Ian McInerney <ian.s.mcinerney at ieee.org>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2022 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
@ -146,7 +146,7 @@ bool PCB_EDITOR_CONDITIONS::hasItemsFunc( const SELECTION& aSelection, PCB_BASE_
bool PCB_EDITOR_CONDITIONS::padNumberDisplayFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame )
{
return aFrame->Settings().m_Display.m_DisplayPadNum;
return aFrame->Settings().m_Display.m_PadNumbers;
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2022 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
@ -41,12 +41,12 @@ bool PCB_VIEWER_TOOLS::Init()
{
// Populate the context menu displayed during the tool (primarily the measure tool)
auto activeToolCondition =
[ this ] ( const SELECTION& aSel )
{
return !frame()->ToolStackIsEmpty();
};
[ this ] ( const SELECTION& aSel )
{
return !frame()->ToolStackIsEmpty();
};
auto& ctxMenu = m_menu.GetMenu();
CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
// "Cancel" goes at the top of the context menu when a tool is active
ctxMenu.AddItem( ACTIONS::cancelInteractive, activeToolCondition, 1 );
@ -90,7 +90,7 @@ template<class T> void Flip( T& aValue )
int PCB_VIEWER_TOOLS::ShowPadNumbers( const TOOL_EVENT& aEvent )
{
Flip( displayOptions().m_DisplayPadNum );
Flip( displayOptions().m_PadNumbers );
for( FOOTPRINT* fp : board()->Footprints() )
{