From 3827f495ca0da2b019f13b5b65e1c35d96327e57 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Fri, 31 Jan 2014 11:16:01 +0100 Subject: [PATCH] Ratsnest color is saved in RENDER_SETTINGS. Temporary ratsnest is drawn using a brightened color. --- include/gal/color4d.h | 2 +- pcbnew/pcb_painter.cpp | 1 + pcbnew/ratsnest_viewitem.cpp | 10 ++++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/gal/color4d.h b/include/gal/color4d.h index c476f10e0e..fb4d9d9cf3 100644 --- a/include/gal/color4d.h +++ b/include/gal/color4d.h @@ -136,7 +136,7 @@ public: * Function Brightened * Returns a color that is brighter by a given factor, without modifying object. * @param aFactor Specifies how bright the color should become (valid values: 0.0 .. 1.0). - * @return COLOR4D Highlightedd color. + * @return COLOR4D Highlighted color. */ COLOR4D Brightened( double aFactor ) const { diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 105362f83c..4ffdfa4667 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -75,6 +75,7 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( COLORS_DESIGN_SETTINGS* aSettings m_layerColors[ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE )] = COLOR4D( 0.8, 0.8, 0.8, 0.7 ); m_layerColors[ITEM_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE )] = COLOR4D( 0.8, 0.8, 0.8, 0.7 ); m_layerColors[ITEM_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE )] = COLOR4D( 0.8, 0.8, 0.8, 0.7 ); + m_layerColors[ITEM_GAL_LAYER( RATSNEST_VISIBLE )] = COLOR4D( 0.4, 0.4, 0.4, 0.7 ); m_layerColors[ITEM_GAL_LAYER( WORKSHEET )] = COLOR4D( 0.5, 0.0, 0.0, 1.0 ); // Netnames for copper layers diff --git a/pcbnew/ratsnest_viewitem.cpp b/pcbnew/ratsnest_viewitem.cpp index 0e23b00306..7bf9d79568 100644 --- a/pcbnew/ratsnest_viewitem.cpp +++ b/pcbnew/ratsnest_viewitem.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -57,9 +58,9 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, GAL* aGal ) const aGal->SetIsStroke( true ); aGal->SetIsFill( false ); aGal->SetLineWidth( 1.0 ); - aGal->SetStrokeColor( COLOR4D( 0.8, 0.8, 0.8, 0.2 ) ); + RENDER_SETTINGS* rs = m_view->GetPainter()->GetSettings(); + COLOR4D color = rs->GetColor( NULL, ITEM_GAL_LAYER( RATSNEST_VISIBLE ) ); - // Draw the temporary ratsnest (skip the unconnected net [net code == 0]) for( int i = 1; i < m_data->GetNetCount(); ++i ) { const RN_NET& net = m_data->GetNet( i ); @@ -70,6 +71,9 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, GAL* aGal ) const // Avoid duplicate destinations for ratsnest lines by storing already used nodes boost::unordered_set usedDestinations; + // Set brighter color for the temporary ratsnest + aGal->SetStrokeColor( color.Brightened( 0.8 ) ); + // Draw the "dynamic" ratsnest (ie. for objects that may be currently being moved) BOOST_FOREACH( const RN_NODE_PTR& node, net.GetSimpleNodes() ) { @@ -86,6 +90,8 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, GAL* aGal ) const } // Draw the "static" ratsnest + aGal->SetStrokeColor( color ); // using the default ratsnest color + const std::vector* edges = net.GetUnconnected(); if( edges == NULL ) continue;