From 6310f84a57a00e4d64e7da174a20eefe4915536e Mon Sep 17 00:00:00 2001
From: Ian McInerney <ian.s.mcinerney@ieee.org>
Date: Sat, 24 Sep 2022 00:08:32 +0100
Subject: [PATCH] Fix shadowed definition of EAGLE constant

---
 common/eda_tools.cpp                  |  4 ++--
 include/eda_tools.h                   |  4 ++--
 kicad/tools/kicad_manager_control.cpp | 23 +++++++++++------------
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/common/eda_tools.cpp b/common/eda_tools.cpp
index 99cf40165d..3de85578f9 100644
--- a/common/eda_tools.cpp
+++ b/common/eda_tools.cpp
@@ -34,7 +34,7 @@ bool IsFileFromEDATool( const wxFileName& aFileName, const EDA_TOOLS aTool )
     {
         switch( aTool )
         {
-        case EAGLE:
+        case EDA_TOOLS::EAGLE:
             if( textFile.GetLineCount() > 2
                 && textFile[1].StartsWith( wxT( "<!DOCTYPE eagle SYSTEM" ) )
                 && textFile[2].StartsWith( wxT( "<eagle version" ) ) )
@@ -50,4 +50,4 @@ bool IsFileFromEDATool( const wxFileName& aFileName, const EDA_TOOLS aTool )
     }
 
     return false;
-}
\ No newline at end of file
+}
diff --git a/include/eda_tools.h b/include/eda_tools.h
index 20785e8cd7..48a3f81250 100644
--- a/include/eda_tools.h
+++ b/include/eda_tools.h
@@ -37,7 +37,7 @@
 /**
  * Enumeration of tools
  */
-enum EDA_TOOLS
+enum class EDA_TOOLS
 {
     EAGLE
 };
@@ -52,4 +52,4 @@ enum EDA_TOOLS
  */
 bool IsFileFromEDATool( const wxFileName& aFileName, const EDA_TOOLS aTool );
 
-#endif
\ No newline at end of file
+#endif
diff --git a/kicad/tools/kicad_manager_control.cpp b/kicad/tools/kicad_manager_control.cpp
index 3d450e9906..2723f9f63d 100644
--- a/kicad/tools/kicad_manager_control.cpp
+++ b/kicad/tools/kicad_manager_control.cpp
@@ -359,7 +359,7 @@ int KICAD_MANAGER_CONTROL::ImportNonKicadProj( const TOOL_EVENT& aEvent )
     {
         // Check if droppedFile is an eagle file.
         // If not, return and do not import files.
-        if( !IsFileFromEDATool( droppedFileName, EAGLE ) )
+        if( !IsFileFromEDATool( droppedFileName, EDA_TOOLS::EAGLE ) )
             return -1;
 
         schFileExtension = EagleSchematicFileExtension;
@@ -367,19 +367,18 @@ int KICAD_MANAGER_CONTROL::ImportNonKicadProj( const TOOL_EVENT& aEvent )
         schFileType = SCH_IO_MGR::SCH_EAGLE;
         pcbFileType = IO_MGR::EAGLE;
     }
+    // Cadstar project.
+    else if( droppedFileName.GetExt() == CadstarSchematicFileExtension
+             || droppedFileName.GetExt() == CadstarPcbFileExtension )
+    {
+        schFileExtension = CadstarSchematicFileExtension;
+        pcbFileExtension = CadstarPcbFileExtension;
+        schFileType = SCH_IO_MGR::SCH_CADSTAR_ARCHIVE;
+        pcbFileType = IO_MGR::CADSTAR_PCB_ARCHIVE;
+    }
     else
     {
-        // Cadstar project.
-        if( droppedFileName.GetExt() == CadstarSchematicFileExtension
-            || droppedFileName.GetExt() == CadstarPcbFileExtension )
-        {
-            schFileExtension = CadstarSchematicFileExtension;
-            pcbFileExtension = CadstarPcbFileExtension;
-            schFileType = SCH_IO_MGR::SCH_CADSTAR_ARCHIVE;
-            pcbFileType = IO_MGR::CADSTAR_PCB_ARCHIVE;
-        }
-        else
-            return -1;
+        return -1;
     }
 
     IMPORT_PROJ_HELPER importProj( m_frame, droppedFileName.GetFullPath(), schFileExtension,