From 33e05ae557845136e31eed9c319b58d0fcecff2c Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 4 Aug 2017 09:45:10 +0200 Subject: [PATCH] Avoid to change the alpha channel color value initially set in GAL mode when modifying a color in legacy mode. --- pcbnew/class_pcb_layer_widget.cpp | 9 +++++++++ pcbnew/pcbnew_config.cpp | 9 +++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 97e870e229..6adf67cdf4 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -541,6 +541,15 @@ void PCB_LAYER_WIDGET::ReFill() void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor ) { + // Avoid setting the alpha channel, when we are in legacy mode, + // because in legacy mode the alpha channel is not used, but changing it + // destroys the GAL color setup + if( !myframe->IsGalCanvasActive() ) + { + COLOR4D oldColor = myframe->GetBoard()->GetLayerColor( ToLAYER_ID( aLayer ) ); + aColor.a = oldColor.a; + } + myframe->GetBoard()->SetLayerColor( ToLAYER_ID( aLayer ), aColor ); if( myframe->IsGalCanvasActive() ) diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 23bfd90a8a..ec888800b4 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -365,13 +365,14 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() // layer colors: wxASSERT( DIM( cds.m_LayersColors ) >= PCB_LAYER_ID_COUNT ); + for( int i = 0; i