Ratsnest color is saved in RENDER_SETTINGS. Temporary ratsnest is drawn using a brightened color.

This commit is contained in:
Maciej Suminski 2014-01-31 11:16:01 +01:00
parent 5fea60d20f
commit 3827f495ca
3 changed files with 10 additions and 3 deletions

View File

@ -136,7 +136,7 @@ public:
* Function Brightened * Function Brightened
* Returns a color that is brighter by a given factor, without modifying object. * 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). * @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 COLOR4D Brightened( double aFactor ) const
{ {

View File

@ -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( 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_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( 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 ); m_layerColors[ITEM_GAL_LAYER( WORKSHEET )] = COLOR4D( 0.5, 0.0, 0.0, 1.0 );
// Netnames for copper layers // Netnames for copper layers

View File

@ -30,6 +30,7 @@
#include <ratsnest_viewitem.h> #include <ratsnest_viewitem.h>
#include <ratsnest_data.h> #include <ratsnest_data.h>
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <pcb_painter.h>
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
@ -57,9 +58,9 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, GAL* aGal ) const
aGal->SetIsStroke( true ); aGal->SetIsStroke( true );
aGal->SetIsFill( false ); aGal->SetIsFill( false );
aGal->SetLineWidth( 1.0 ); 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 ) for( int i = 1; i < m_data->GetNetCount(); ++i )
{ {
const RN_NET& net = m_data->GetNet( 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 // Avoid duplicate destinations for ratsnest lines by storing already used nodes
boost::unordered_set<RN_NODE_PTR> usedDestinations; boost::unordered_set<RN_NODE_PTR> 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) // Draw the "dynamic" ratsnest (ie. for objects that may be currently being moved)
BOOST_FOREACH( const RN_NODE_PTR& node, net.GetSimpleNodes() ) 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 // Draw the "static" ratsnest
aGal->SetStrokeColor( color ); // using the default ratsnest color
const std::vector<RN_EDGE_PTR>* edges = net.GetUnconnected(); const std::vector<RN_EDGE_PTR>* edges = net.GetUnconnected();
if( edges == NULL ) if( edges == NULL )
continue; continue;