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.
This commit is contained in:
jean-pierre charras 2018-12-03 15:21:04 +01:00
parent fb5b5ff7c3
commit a762c4d86e
1 changed files with 19 additions and 0 deletions

View File

@ -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 )
{