Make the "No Net" mark color editable (mark for pads having no net name)

Note: this mark is currently drawn only in legacy canvas.
This commit is contained in:
jean-pierre charras 2017-10-05 20:11:55 +02:00
parent acccb10ca5
commit 1164eaab72
7 changed files with 54 additions and 43 deletions

View File

@ -68,6 +68,7 @@ static const EDA_COLOR_T default_layer_color[] = {
};
// for color order, see enum GAL_LAYER_ID
static const EDA_COLOR_T default_items_color[] = {
LIGHTGRAY, // unused
CYAN, // LAYER_VIA_MICROVIA
@ -82,7 +83,9 @@ static const EDA_COLOR_T default_items_color[] = {
GREEN, // LAYER_PAD_BK
LIGHTGRAY, // LAYER_RATSNEST
DARKGRAY, // LAYER_GRID
LIGHTRED, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTRED, // LAYER_GRID_AXES
BLUE, // LAYER_NO_CONNECTS
LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY,
@ -224,6 +227,7 @@ void COLORS_DESIGN_SETTINGS::setupConfigParams()
Add( "Color4DViaBBlindEx", ITEM_COLOR( LAYER_VIA_BBLIND ), BROWN );
Add( "Color4DViaMicroEx", ITEM_COLOR( LAYER_VIA_MICROVIA ), CYAN );
Add( "Color4DRatsEx", ITEM_COLOR( LAYER_RATSNEST ), WHITE );
Add( "Color4DNoNetPadMarker", ITEM_COLOR( LAYER_NO_CONNECTS ), BLUE );
}
SetConfigPrefix( currprefix );

View File

@ -739,17 +739,17 @@ int BOARD::GetVisibleElements() const
}
bool BOARD::IsElementVisible( GAL_LAYER_ID LAYER_aPCB ) const
bool BOARD::IsElementVisible( GAL_LAYER_ID aLayer ) const
{
return m_designSettings.IsElementVisible( LAYER_aPCB );
return m_designSettings.IsElementVisible( aLayer );
}
void BOARD::SetElementVisibility( GAL_LAYER_ID LAYER_aPCB, bool isEnabled )
void BOARD::SetElementVisibility( GAL_LAYER_ID aLayer, bool isEnabled )
{
m_designSettings.SetElementVisibility( LAYER_aPCB, isEnabled );
m_designSettings.SetElementVisibility( aLayer, isEnabled );
switch( LAYER_aPCB )
switch( aLayer )
{
case LAYER_RATSNEST:
{
@ -791,9 +791,9 @@ void BOARD::SetElementVisibility( GAL_LAYER_ID LAYER_aPCB, bool isEnabled )
}
bool BOARD::IsModuleLayerVisible( PCB_LAYER_ID layer )
bool BOARD::IsModuleLayerVisible( PCB_LAYER_ID aLayer )
{
switch( layer )
switch( aLayer )
{
case F_Cu:
return IsElementVisible( LAYER_MOD_FR );

View File

@ -501,29 +501,29 @@ public:
* Function IsElementVisible
* tests whether a given element category is visible. Keep this as an
* inline function.
* @param LAYER_aPCB is from the enum by the same name
* @param aLayer is from the enum by the same name
* @return bool - true if the element is visible.
* @see enum GAL_LAYER_ID
*/
bool IsElementVisible( GAL_LAYER_ID LAYER_aPCB ) const;
bool IsElementVisible( GAL_LAYER_ID aLayer ) const;
/**
* Function SetElementVisibility
* changes the visibility of an element category
* @param LAYER_aPCB is from the enum by the same name
* @param aLayer is from the enum by the same name
* @param aNewState = The new visibility state of the element category
* @see enum GAL_LAYER_ID
*/
void SetElementVisibility( GAL_LAYER_ID LAYER_aPCB, bool aNewState );
void SetElementVisibility( GAL_LAYER_ID aLayer, bool aNewState );
/**
* Function IsModuleLayerVisible
* expects either of the two layers on which a module can reside, and returns
* whether that layer is visible.
* @param layer One of the two allowed layers for modules: F_Cu or B_Cu
* @param aLayer One of the two allowed layers for modules: F_Cu or B_Cu
* @return bool - true if the layer is visible, else false.
*/
bool IsModuleLayerVisible( PCB_LAYER_ID layer );
bool IsModuleLayerVisible( PCB_LAYER_ID aLayer );
/**
* Function GetDesignSettings

View File

@ -68,6 +68,7 @@ public:
// visible layers
COLOR4D m_HoleColor; // color used to draw the pad hole
COLOR4D m_NPHoleColor; // color used to draw a pad Not Plated hole
COLOR4D m_NoNetMarkColor; // color used to draw a mark on pads having no net
int m_PadClearance; // clearance value, used to draw the pad area outlines
wxSize m_Mask_margin; // margin, used to draw solder paste when only one layer is shown
bool m_Display_padnum; // true to show pad number

View File

@ -1,10 +1,10 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2017 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2017 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
@ -63,6 +63,7 @@ PAD_DRAWINFO::PAD_DRAWINFO()
m_Color = BLACK;
m_HoleColor = BLACK; // could be DARKGRAY;
m_NPHoleColor = YELLOW;
m_NoNetMarkColor = BLUE;
m_PadClearance = 0;
m_Display_padnum = true;
m_Display_netname = true;
@ -285,6 +286,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
drawInfo.m_DrawMode = aDraw_mode;
drawInfo.m_Color = color;
drawInfo.m_NoNetMarkColor = cds.GetItemColor( LAYER_NO_CONNECTS );
drawInfo.m_DrawPanel = aPanel;
drawInfo.m_Mask_margin = mask_margin;
drawInfo.m_ShowNCMark = brd->IsElementVisible( LAYER_NO_CONNECTS );
@ -612,15 +614,14 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
if( GetNetCode() == 0 && aDrawInfo.m_ShowNCMark )
{
int dx0 = std::min( halfsize.x, halfsize.y );
COLOR4D nc_color = COLOR4D( BLUE );
if( m_layerMask[F_Cu] ) /* Draw \ */
GRLine( aClipBox, aDC, holepos.x - dx0, holepos.y - dx0,
holepos.x + dx0, holepos.y + dx0, 0, nc_color );
holepos.x + dx0, holepos.y + dx0, 0, aDrawInfo.m_NoNetMarkColor );
if( m_layerMask[B_Cu] ) // Draw /
GRLine( aClipBox, aDC, holepos.x + dx0, holepos.y - dx0,
holepos.x - dx0, holepos.y + dx0, 0, nc_color );
holepos.x - dx0, holepos.y + dx0, 0, aDrawInfo.m_NoNetMarkColor );
}
if( !aDrawInfo.m_IsPrinting )

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2016 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
* Copyright (C) 2004-2017 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr
* Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010-2016 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2010-2017 KiCad Developers, see change_log.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
@ -56,6 +56,7 @@
const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
#define RR LAYER_WIDGET::ROW // Render Row abbreviation to reduce source width
#define NOCOLOR COLOR4D::UNSPECIFIED // specify rows that do not have a color selector icon
// text id color tooltip
RR( _( "Through Via" ), LAYER_VIA_THROUGH, WHITE, _( "Show through vias" ) ),
@ -64,20 +65,20 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
RR( _( "Non Plated Holes" ),LAYER_NON_PLATED, WHITE, _( "Show non plated holes in specific color") ),
RR( _( "Ratsnest" ), LAYER_RATSNEST, WHITE, _( "Show unconnected nets as a ratsnest") ),
RR( _( "No-Connects" ), LAYER_NO_CONNECTS, BLUE, _( "Show a marker on pads which have no net connected" ) ),
RR( _( "Pads Front" ), LAYER_PAD_FR, WHITE, _( "Show footprint pads on board's front" ) ),
RR( _( "Pads Back" ), LAYER_PAD_BK, WHITE, _( "Show footprint pads on board's back" ) ),
RR( _( "Text Front" ), LAYER_MOD_TEXT_FR, COLOR4D::UNSPECIFIED, _( "Show footprint text on board's front" ) ),
RR( _( "Text Back" ), LAYER_MOD_TEXT_BK, COLOR4D::UNSPECIFIED, _( "Show footprint text on board's back" ) ),
RR( _( "Text Front" ), LAYER_MOD_TEXT_FR, NOCOLOR, _( "Show footprint text on board's front" ) ),
RR( _( "Text Back" ), LAYER_MOD_TEXT_BK, NOCOLOR, _( "Show footprint text on board's back" ) ),
RR( _( "Hidden Text" ), LAYER_MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ),
RR( _( "Anchors" ), LAYER_ANCHOR, WHITE, _( "Show footprint and text origins as a cross" ) ),
RR( _( "Grid" ), LAYER_GRID, WHITE, _( "Show the (x,y) grid dots" ) ),
RR( _( "No-Connects" ), LAYER_NO_CONNECTS, COLOR4D::UNSPECIFIED, _( "Show a marker on pads which have no net connected" ) ),
RR( _( "Footprints Front" ),LAYER_MOD_FR, COLOR4D::UNSPECIFIED, _( "Show footprints that are on board's front") ),
RR( _( "Footprints Back" ), LAYER_MOD_BK, COLOR4D::UNSPECIFIED, _( "Show footprints that are on board's back") ),
RR( _( "Values" ), LAYER_MOD_VALUES, COLOR4D::UNSPECIFIED, _( "Show footprint's values") ),
RR( _( "References" ), LAYER_MOD_REFERENCES, COLOR4D::UNSPECIFIED, _( "Show footprint's references") ),
RR( _( "Footprints Front" ),LAYER_MOD_FR, NOCOLOR, _( "Show footprints that are on board's front") ),
RR( _( "Footprints Back" ), LAYER_MOD_BK, NOCOLOR, _( "Show footprints that are on board's back") ),
RR( _( "Values" ), LAYER_MOD_VALUES, NOCOLOR, _( "Show footprint's values") ),
RR( _( "References" ), LAYER_MOD_REFERENCES, NOCOLOR, _( "Show footprint's references") ),
RR( _( "Worksheet" ), LAYER_WORKSHEET, DARKRED, _( "Show worksheet") ),
RR( _( "Cursor" ), LAYER_CURSOR, WHITE, _( "PCB Cursor" ), true, false ),
RR( _( "Aux items" ), LAYER_AUX_ITEMS, WHITE, _( "Auxillary items (rulers, assistants, axes, etc.)" ), true, false ),

View File

@ -261,6 +261,10 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// to edit a bad layer
GetBoard()->SetVisibleAlls();
// However the "no net" mark on pads is useless, because there is
// no net in footprint editor: make it non visible
GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false );
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), font.GetPointSize(), true );