From bb18c9201b37995d78455bcd84e284ebe735bac8 Mon Sep 17 00:00:00 2001 From: John Beard Date: Tue, 4 Dec 2018 13:48:47 +0000 Subject: [PATCH] Make SVG import a CMake option (experimental) This allows too turn it on for work without an additional patch. Also fix a bug in the disable code - when the SVG is enabled, allow to select SVG files. --- pcbnew/CMakeLists.txt | 20 ++++++++++++++++++++ pcbnew/import_gfx/dialog_import_gfx.cpp | 14 +------------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 6c1eb44fd5..8cac3a1109 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -852,3 +852,23 @@ if( APPLE ) ) endif() endif() + +# Experimental feature flags +# + +# Currently (Version 5.1) SVG import is disabled by default, to avoid issues +# SVG needs some enhancements. +# Especially, all SVG shapes are imported as curves and converted to a lot of segments. +# A better approach is to convert to polylines (not yet existing in Pcbnew) and keep +# arcs and circles as primitives (not yet possible with tinysvg library. +# So, until these issues are solved, disable SVG import option. +# Warning: enable svg import is currently only for developers. +option( KICAD_EXPERIMENTAL_ENABLE_SVG "Experimental: Enable SVG import" OFF) + +if( NOT KICAD_EXPERIMENTAL_ENABLE_SVG ) + set_property( + SOURCE import_gfx/dialog_import_gfx.cpp + PROPERTY COMPILE_DEFINITIONS DISABLE_SVG_IMPORT + APPEND + ) +endif() \ No newline at end of file diff --git a/pcbnew/import_gfx/dialog_import_gfx.cpp b/pcbnew/import_gfx/dialog_import_gfx.cpp index 819856cbcf..48f0988762 100644 --- a/pcbnew/import_gfx/dialog_import_gfx.cpp +++ b/pcbnew/import_gfx/dialog_import_gfx.cpp @@ -49,22 +49,12 @@ #define IMPORT_GFX_LINEWIDTH_UNITS_KEY "GfxImportLineWidthUnits" #define IMPORT_GFX_LINEWIDTH_KEY "GfxImportLineWidth" -// Currently (Version 5.1) SVG import is disabled by default, to avoid issues -// SVG needs some enhancements. -// Especially, all SVG shapes are imported as curves and converted to a lot of segments. -// A better approach is to convert to polylines (not yet existing in Pcbnew) and keep -// arcs and circles as primitives (not yet possible with tinysvg library. -// So, until these issues are solved, disable SVG import option. -// Warning: enable svg import is currently only for developers. -#define DISABLE_SVG_IMPORT - // Static members of DIALOG_IMPORT_GFX, to remember // the user's choices during the session wxString DIALOG_IMPORT_GFX::m_filename; bool DIALOG_IMPORT_GFX::m_placementInteractive = true; LAYER_NUM DIALOG_IMPORT_GFX::m_layer = Dwgs_User; -double DIALOG_IMPORT_GFX::m_scaleImport = 1.0; // Do not change the imported items siaz - +double DIALOG_IMPORT_GFX::m_scaleImport = 1.0; // Do not change the imported items size DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX( PCB_BASE_FRAME* aParent, bool aImportAsFootprintGraphic ) : DIALOG_IMPORT_GFX_BASE( aParent ) @@ -250,8 +240,6 @@ void DIALOG_IMPORT_GFX::onBrowseFiles( wxCommandEvent& event ) for( auto pluginType : GRAPHICS_IMPORT_MGR::GFX_FILE_TYPES ) { - if( !pluginType == GRAPHICS_IMPORT_MGR::GFX_FILE_T::DXF ) - continue; auto plugin = GRAPHICS_IMPORT_MGR::GetPlugin( pluginType ); const auto wildcards = plugin->GetWildcards();