PcbNew: Fix layer alpha overrides being overwritten by color changes
Fixes: lp:1827518 * https://bugs.launchpad.net/kicad/+bug/1827518
This commit is contained in:
parent
720b26d11e
commit
cb3edf2607
|
@ -488,17 +488,19 @@ int PCBNEW_CONTROL::LayerToggle( const TOOL_EVENT& aEvent )
|
|||
|
||||
int PCBNEW_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
|
||||
auto settings = painter->GetSettings();
|
||||
auto& settings = m_frame->Settings().Colors();
|
||||
|
||||
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
|
||||
KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
|
||||
KIGFX::COLOR4D currentColor = settings.GetLayerColor( currentLayer );
|
||||
|
||||
if( currentColor.a <= ALPHA_MAX - ALPHA_STEP )
|
||||
{
|
||||
currentColor.a += ALPHA_STEP;
|
||||
settings->SetLayerColor( currentLayer, currentColor );
|
||||
m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
|
||||
settings.SetLayerColor( currentLayer, currentColor );
|
||||
|
||||
KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
|
||||
view->GetPainter()->GetSettings()->ImportLegacyColors( &settings );
|
||||
view->UpdateLayerColor( currentLayer );
|
||||
|
||||
wxUpdateUIEvent dummy;
|
||||
static_cast<PCB_EDIT_FRAME*>( m_frame )->OnUpdateLayerAlpha( dummy );
|
||||
|
@ -512,17 +514,19 @@ int PCBNEW_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent )
|
|||
|
||||
int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
auto painter = static_cast<KIGFX::PCB_PAINTER*>( getView()->GetPainter() );
|
||||
auto settings = painter->GetSettings();
|
||||
auto& settings = m_frame->Settings().Colors();
|
||||
|
||||
LAYER_NUM currentLayer = m_frame->GetActiveLayer();
|
||||
KIGFX::COLOR4D currentColor = settings->GetLayerColor( currentLayer );
|
||||
KIGFX::COLOR4D currentColor = settings.GetLayerColor( currentLayer );
|
||||
|
||||
if( currentColor.a >= ALPHA_MIN + ALPHA_STEP )
|
||||
{
|
||||
currentColor.a -= ALPHA_STEP;
|
||||
settings->SetLayerColor( currentLayer, currentColor );
|
||||
m_frame->GetGalCanvas()->GetView()->UpdateLayerColor( currentLayer );
|
||||
settings.SetLayerColor( currentLayer, currentColor );
|
||||
|
||||
KIGFX::VIEW* view = m_frame->GetGalCanvas()->GetView();
|
||||
view->GetPainter()->GetSettings()->ImportLegacyColors( &settings );
|
||||
view->UpdateLayerColor( currentLayer );
|
||||
|
||||
wxUpdateUIEvent dummy;
|
||||
static_cast<PCB_BASE_FRAME*>( m_frame )->OnUpdateLayerAlpha( dummy );
|
||||
|
|
Loading…
Reference in New Issue