← Back to team overview

kicad-developers team mailing list archive

[PATCH] Don't force grid color to LAYER_GRID in EDA_DRAW_PANEL_GAL

 

Hi,

This patch removes a call that prevents other children of
EDA_DRAW_PANEL_GAL from using layers other than LAYER_GRID to specify grid
color, and instead set the grid color in the GAL when it is changed or
updated.

-Jon
From 36efe44e896e34423246d3b541a97703b0a5e0d4 Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Mon, 11 Sep 2017 23:00:41 -0400
Subject: [PATCH] Don't force grid color to LAYER_GRID in EDA_DRAW_PANEL_GAL

---
 common/draw_panel_gal.cpp         | 3 ---
 pcbnew/class_pcb_layer_widget.cpp | 3 +++
 pcbnew/pcbframe.cpp               | 6 ++++++
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp
index bcfb0d2b8..2a769ddcd 100644
--- a/common/draw_panel_gal.cpp
+++ b/common/draw_panel_gal.cpp
@@ -183,9 +183,6 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
         m_gal->SetCursorColor( settings->GetLayerColor( LAYER_CURSOR ) );
         m_gal->ClearScreen( );

-        KIGFX::COLOR4D gridColor = settings->GetLayerColor( LAYER_GRID );
-        m_gal->SetGridColor( gridColor );
-
         if( m_view->IsDirty() )
         {
             m_view->ClearTargets();
diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp
index 56ff74a5d..8c39e20a6 100644
--- a/pcbnew/class_pcb_layer_widget.cpp
+++ b/pcbnew/class_pcb_layer_widget.cpp
@@ -634,6 +634,9 @@ void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )

     if( galCanvas && myframe->IsGalCanvasActive() )
     {
+        if( aId == LAYER_GRID )
+            galCanvas->GetGAL()->SetGridColor( aColor );
+
         KIGFX::VIEW* view = galCanvas->GetView();
         view->GetPainter()->GetSettings()->ImportLegacyColors( &myframe->Settings().Colors() );
         view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );   // useful to update rastnest
diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp
index 6463a76cd..8f6a55769 100644
--- a/pcbnew/pcbframe.cpp
+++ b/pcbnew/pcbframe.cpp
@@ -714,6 +714,12 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )

     PCB_BASE_EDIT_FRAME::UseGalCanvas( aEnable );

+    if( aEnable )
+    {
+        COLORS_DESIGN_SETTINGS& cds = Settings().Colors();
+        GetGalCanvas()->GetGAL()->SetGridColor( cds.GetLayerColor( LAYER_GRID ) );
+    }
+
     enableGALSpecificMenus();

     // Force colors to be legacy-compatible in case they were changed in GAL
--
2.11.0


Follow ups