From a762c4d86e7654f38acc43cb96c2cfbe31a8c1c9 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 3 Dec 2018 15:21:04 +0100 Subject: [PATCH] Import GFX: temporary disable SVG import until V6.0. SVG import need some refinements to be efficient, so it is disable for v 5.x. Will be re-enabled later. Enabling SVG import is *only* for developers, not for users. --- pcbnew/import_gfx/dialog_import_gfx.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pcbnew/import_gfx/dialog_import_gfx.cpp b/pcbnew/import_gfx/dialog_import_gfx.cpp index 6860c6429d..819856cbcf 100644 --- a/pcbnew/import_gfx/dialog_import_gfx.cpp +++ b/pcbnew/import_gfx/dialog_import_gfx.cpp @@ -49,6 +49,14 @@ #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 @@ -234,10 +242,16 @@ void DIALOG_IMPORT_GFX::onBrowseFiles( wxCommandEvent& event ) // Generate the list of handled file formats wxString wildcardsDesc; + +#ifdef DISABLE_SVG_IMPORT + wildcardsDesc = DxfFileWildcard(); +#else wxString allWildcards; 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(); @@ -246,6 +260,7 @@ void DIALOG_IMPORT_GFX::onBrowseFiles( wxCommandEvent& event ) } wildcardsDesc = "All supported formats|" + allWildcards + wildcardsDesc; +#endif wxFileDialog dlg( m_parent, _( "Open File" ), path, filename, wildcardsDesc, wxFD_OPEN|wxFD_FILE_MUST_EXIST ); @@ -286,7 +301,11 @@ void DIALOG_IMPORT_GFX::onOKClick( wxCommandEvent& event ) m_default_lineWidth = getPCBdefaultLineWidthMM(); m_importer->SetLayer( PCB_LAYER_ID( m_layer ) ); +#ifdef DISABLE_SVG_IMPORT + auto plugin = GRAPHICS_IMPORT_MGR::GetPluginByExt( "dxf" ); +#else auto plugin = GRAPHICS_IMPORT_MGR::GetPluginByExt( wxFileName( m_filename ).GetExt() ); +#endif if( plugin ) {