← Back to team overview

kicad-developers team mailing list archive

[PATCH] Remove dependence on LAYER_ID from EDA_DRAW_PANEL_GAL

 

Hi all,

Another refactoring of the GAL base classes, this time to not depend on
LAYER_ID, which is specific to pcbnew.

Best,
Jon
From 3862fa138b5b60204617cc065e972857fd2fd1b9 Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Thu, 16 Feb 2017 19:59:31 -0500
Subject: [PATCH] Remove dependence on LAYER_ID from EDA_DRAW_PANEL_GAL

---
 common/draw_panel_gal.cpp      |  4 ++--
 include/class_draw_panel_gal.h |  5 ++---
 pcbnew/pcb_draw_panel_gal.h    | 17 +++++++++++++++--
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp
index 69002a6..98c1b00 100644
--- a/common/draw_panel_gal.cpp
+++ b/common/draw_panel_gal.cpp
@@ -302,7 +302,7 @@ void EDA_DRAW_PANEL_GAL::StopDrawing()
 }
 
 
-void EDA_DRAW_PANEL_GAL::SetHighContrastLayer( LAYER_ID aLayer )
+void EDA_DRAW_PANEL_GAL::SetHighContrastLayer( int aLayer )
 {
     // Set display settings for high contrast mode
     KIGFX::RENDER_SETTINGS* rSettings = m_view->GetPainter()->GetSettings();
@@ -316,7 +316,7 @@ void EDA_DRAW_PANEL_GAL::SetHighContrastLayer( LAYER_ID aLayer )
 }
 
 
-void EDA_DRAW_PANEL_GAL::SetTopLayer( LAYER_ID aLayer )
+void EDA_DRAW_PANEL_GAL::SetTopLayer( int aLayer )
 {
     m_view->ClearTopLayers();
     m_view->SetTopLayer( aLayer );
diff --git a/include/class_draw_panel_gal.h b/include/class_draw_panel_gal.h
index f1828b8..13e7671 100644
--- a/include/class_draw_panel_gal.h
+++ b/include/class_draw_panel_gal.h
@@ -33,7 +33,6 @@
 
 #include <wx/window.h>
 #include <wx/timer.h>
-#include <layers_id_colors_and_visibility.h>
 #include <math/vector2d.h>
 #include <msgpanel.h>
 
@@ -150,13 +149,13 @@ public:
      * Function SetHighContrastLayer
      * Takes care of display settings for the given layer to be displayed in high contrast mode.
      */
-    virtual void SetHighContrastLayer( LAYER_ID aLayer );
+    virtual void SetHighContrastLayer( int aLayer );
 
     /**
      * Function SetTopLayer
      * Moves the selected layer to the top, so it is displayed above all others.
      */
-    virtual void SetTopLayer( LAYER_ID aLayer );
+    virtual void SetTopLayer( int aLayer );
 
     virtual void GetMsgPanelInfo( std::vector<MSG_PANEL_ITEM>& aList )
     {
diff --git a/pcbnew/pcb_draw_panel_gal.h b/pcbnew/pcb_draw_panel_gal.h
index 6e1f724..db84a47 100644
--- a/pcbnew/pcb_draw_panel_gal.h
+++ b/pcbnew/pcb_draw_panel_gal.h
@@ -26,6 +26,7 @@
 #define PCB_DRAW_PANEL_GAL_H_
 
 #include <class_draw_panel_gal.h>
+#include <layers_id_colors_and_visibility.h>
 
 namespace KIGFX
 {
@@ -66,10 +67,22 @@ public:
     void UseColorScheme( const COLORS_DESIGN_SETTINGS* aSettings );
 
     ///> @copydoc EDA_DRAW_PANEL_GAL::SetHighContrastLayer()
-    virtual void SetHighContrastLayer( LAYER_ID aLayer ) override;
+    virtual void SetHighContrastLayer( int aLayer ) override
+    {
+        SetHighContrastLayer( static_cast< LAYER_ID >( aLayer ) );
+    }
+
+    ///> SetHighContrastLayer(), with some extra smarts for PCB
+    void SetHighContrastLayer( LAYER_ID aLayer );
 
     ///> @copydoc EDA_DRAW_PANEL_GAL::SetTopLayer()
-    virtual void SetTopLayer( LAYER_ID aLayer ) override;
+    virtual void SetTopLayer( int aLayer ) override
+    {
+        SetTopLayer( static_cast< LAYER_ID >( aLayer ) );
+    }
+
+    ///> SetTopLayer(), with some extra smarts for PCB
+    void SetTopLayer( LAYER_ID aLayer );
 
     /**
      * Function SyncLayersVisibility
-- 
2.7.4


Follow ups