From 1164eaab727dd486305b94ca07aa8120ae879fe4 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 5 Oct 2017 20:11:55 +0200 Subject: [PATCH] Make the "No Net" mark color editable (mark for pads having no net name) Note: this mark is currently drawn only in legacy canvas. --- common/class_colors_design_settings.cpp | 6 ++- pcbnew/class_board.cpp | 14 +++---- pcbnew/class_board.h | 12 +++--- pcbnew/class_pad.h | 1 + pcbnew/class_pad_draw_functions.cpp | 11 +++--- pcbnew/class_pcb_layer_widget.cpp | 49 +++++++++++++------------ pcbnew/moduleframe.cpp | 4 ++ 7 files changed, 54 insertions(+), 43 deletions(-) diff --git a/common/class_colors_design_settings.cpp b/common/class_colors_design_settings.cpp index 1f9e03261b..ebb3295280 100644 --- a/common/class_colors_design_settings.cpp +++ b/common/class_colors_design_settings.cpp @@ -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 ); diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index f9e9eb0925..cc04450a52 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -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 ); diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 0e02fb9880..8160747252 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -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 diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index b472c3ca73..c1ac8b0c68 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -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 diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index d13d462907..9d270b056d 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -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 * Copyright (C) 2012 Wayne Stambaugh - * 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 ) diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index eec013be23..7a25f4e462 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -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 - * 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,32 +56,33 @@ 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" ) ), - RR( _( "Bl/Buried Via" ), LAYER_VIA_BBLIND, WHITE, _( "Show blind or buried vias" ) ), - RR( _( "Micro Via" ), LAYER_VIA_MICROVIA, WHITE, _( "Show micro vias") ), - 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( _( "Through Via" ), LAYER_VIA_THROUGH, WHITE, _( "Show through vias" ) ), + RR( _( "Bl/Buried Via" ), LAYER_VIA_BBLIND, WHITE, _( "Show blind or buried vias" ) ), + RR( _( "Micro Via" ), LAYER_VIA_MICROVIA, WHITE, _( "Show micro vias") ), + 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( _( "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( _( "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( _( "Hidden Text" ), LAYER_MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ), + 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( _( "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 ), - RR( _( "Background" ), LAYER_PCB_BACKGROUND, BLACK, _( "PCB Background" ), true, false ) + 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( _( "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 ), + RR( _( "Background" ), LAYER_PCB_BACKGROUND, BLACK, _( "PCB Background" ), true, false ) }; static int s_allowed_in_FpEditor[] = @@ -188,7 +189,7 @@ void PCB_LAYER_WIDGET::AddRightClickMenuItems( wxMenu& menu ) void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event ) { - wxMenu menu; + wxMenu menu; AddRightClickMenuItems( menu ); PopupMenu( &menu ); diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 9b8cb1d65b..038fdf28b1 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -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 );