From d28fea5502844bd7bc0aaeca0bb1083428157eee Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 19 Apr 2020 13:41:54 +0200 Subject: [PATCH] Dxf import: fix a bug that disable import of data inside blocks Provide also a minimal debug info when enabled in code (and only in debug version) --- pcbnew/import_gfx/dialog_import_gfx_base.cpp | 134 +- pcbnew/import_gfx/dialog_import_gfx_base.fbp | 1924 +++++++++--------- pcbnew/import_gfx/dialog_import_gfx_base.h | 23 +- pcbnew/import_gfx/dxf_import_plugin.cpp | 7 +- pcbnew/import_gfx/dxf_import_plugin.h | 63 +- 5 files changed, 1091 insertions(+), 1060 deletions(-) diff --git a/pcbnew/import_gfx/dialog_import_gfx_base.cpp b/pcbnew/import_gfx/dialog_import_gfx_base.cpp index 30905aaec7..8c9bbef1da 100644 --- a/pcbnew/import_gfx/dialog_import_gfx_base.cpp +++ b/pcbnew/import_gfx/dialog_import_gfx_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) +// C++ code generated with wxFormBuilder (version Jul 10 2019) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -14,56 +14,56 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - + wxBoxSizer* bSizerMain; bSizerMain = new wxBoxSizer( wxVERTICAL ); - + wxBoxSizer* bSizerFile; bSizerFile = new wxBoxSizer( wxHORIZONTAL ); - + m_staticTextFile = new wxStaticText( this, wxID_ANY, _("File:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextFile->Wrap( -1 ); m_staticTextFile->SetToolTip( _("Only vectors will be imported. Bitmaps and fonts will be ignored.") ); - + bSizerFile->Add( m_staticTextFile, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - + m_textCtrlFileName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textCtrlFileName->SetToolTip( _("Only vectors will be imported. Bitmaps and fonts will be ignored.") ); m_textCtrlFileName->SetMinSize( wxSize( 300,-1 ) ); - + bSizerFile->Add( m_textCtrlFileName, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - + m_buttonBrowse = new wxButton( this, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonBrowse->SetToolTip( _("Only vectors will be imported. Bitmaps and fonts will be ignored.") ); - + bSizerFile->Add( m_buttonBrowse, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - + + bSizerMain->Add( bSizerFile, 0, wxALL|wxEXPAND, 5 ); - + wxStaticBoxSizer* sbSizer2; sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Placement:") ), wxVERTICAL ); - + wxBoxSizer* bSizerOptions; bSizerOptions = new wxBoxSizer( wxVERTICAL ); - + m_rbInteractivePlacement = new wxRadioButton( sbSizer2->GetStaticBox(), wxID_ANY, _("Interactive placement"), wxDefaultPosition, wxDefaultSize, 0 ); - m_rbInteractivePlacement->SetValue( true ); + m_rbInteractivePlacement->SetValue( true ); bSizerOptions->Add( m_rbInteractivePlacement, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 ); - + wxBoxSizer* bSizerUserPos; bSizerUserPos = new wxBoxSizer( wxHORIZONTAL ); - + m_rbAbsolutePlacement = new wxRadioButton( sbSizer2->GetStaticBox(), wxID_ANY, _("At"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerUserPos->Add( m_rbAbsolutePlacement, 0, wxALIGN_CENTER_VERTICAL, 5 ); - + wxBoxSizer* bSizerPosSettings; bSizerPosSettings = new wxBoxSizer( wxHORIZONTAL ); - + m_staticTextXpos = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextXpos->Wrap( -1 ); bSizerPosSettings->Add( m_staticTextXpos, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); - + m_DxfPcbXCoord = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); #ifdef __WXGTK__ if ( !m_DxfPcbXCoord->HasFlag( wxTE_MULTILINE ) ) @@ -74,13 +74,13 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, m_DxfPcbXCoord->SetMaxLength( 10 ); #endif m_DxfPcbXCoord->SetToolTip( _("DXF origin on PCB Grid, X Coordinate") ); - + bSizerPosSettings->Add( m_DxfPcbXCoord, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - + m_staticTextYpos = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextYpos->Wrap( -1 ); bSizerPosSettings->Add( m_staticTextYpos, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); - + m_DxfPcbYCoord = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); #ifdef __WXGTK__ if ( !m_DxfPcbYCoord->HasFlag( wxTE_MULTILINE ) ) @@ -91,109 +91,109 @@ DIALOG_IMPORT_GFX_BASE::DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id, m_DxfPcbYCoord->SetMaxLength( 10 ); #endif m_DxfPcbYCoord->SetToolTip( _("DXF origin on PCB Grid, Y Coordinate") ); - + bSizerPosSettings->Add( m_DxfPcbYCoord, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - + m_staticTextUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextUnits->Wrap( -1 ); bSizerPosSettings->Add( m_staticTextUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); - + wxString m_DxfPcbPositionUnitsChoices[] = { _("mm"), _("inch") }; int m_DxfPcbPositionUnitsNChoices = sizeof( m_DxfPcbPositionUnitsChoices ) / sizeof( wxString ); m_DxfPcbPositionUnits = new wxChoice( sbSizer2->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_DxfPcbPositionUnitsNChoices, m_DxfPcbPositionUnitsChoices, 0 ); m_DxfPcbPositionUnits->SetSelection( 0 ); m_DxfPcbPositionUnits->SetToolTip( _("Select PCB grid units") ); - + bSizerPosSettings->Add( m_DxfPcbPositionUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - + + bSizerUserPos->Add( bSizerPosSettings, 1, wxBOTTOM|wxEXPAND|wxTOP, 5 ); - - + + bSizerOptions->Add( bSizerUserPos, 0, wxEXPAND, 5 ); - - + + sbSizer2->Add( bSizerOptions, 1, wxEXPAND|wxLEFT, 20 ); - - + + bSizerMain->Add( sbSizer2, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); - + wxStaticBoxSizer* sbSizer1; sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Import parameters:") ), wxVERTICAL ); - + wxBoxSizer* bSizer7; bSizer7 = new wxBoxSizer( wxHORIZONTAL ); - - + + bSizer7->Add( 0, 0, 0, wxLEFT|wxRIGHT, 10 ); - + wxFlexGridSizer* fgSizerImportSettings; fgSizerImportSettings = new wxFlexGridSizer( 0, 3, 5, 5 ); fgSizerImportSettings->AddGrowableCol( 1 ); fgSizerImportSettings->SetFlexibleDirection( wxBOTH ); fgSizerImportSettings->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - + m_staticTextLineWidth = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Line width (DXF import):"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextLineWidth->Wrap( -1 ); fgSizerImportSettings->Add( m_staticTextLineWidth, 0, wxALIGN_CENTER_VERTICAL, 5 ); - + m_textCtrlLineWidth = new wxTextCtrl( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizerImportSettings->Add( m_textCtrlLineWidth, 0, wxEXPAND, 5 ); - + wxString m_choiceUnitLineWidthChoices[] = { _("mm"), _("mils"), _("inches") }; int m_choiceUnitLineWidthNChoices = sizeof( m_choiceUnitLineWidthChoices ) / sizeof( wxString ); m_choiceUnitLineWidth = new wxChoice( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceUnitLineWidthNChoices, m_choiceUnitLineWidthChoices, 0 ); m_choiceUnitLineWidth->SetSelection( 0 ); fgSizerImportSettings->Add( m_choiceUnitLineWidth, 0, wxALIGN_CENTER_VERTICAL, 5 ); - + m_staticTextBrdlayer = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Graphic layer:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextBrdlayer->Wrap( -1 ); fgSizerImportSettings->Add( m_staticTextBrdlayer, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - m_SelLayerBox = new PCB_LAYER_BOX_SELECTOR( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + + m_SelLayerBox = new PCB_LAYER_BOX_SELECTOR( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); fgSizerImportSettings->Add( m_SelLayerBox, 0, wxEXPAND, 5 ); - - + + fgSizerImportSettings->Add( 0, 0, 0, 0, 5 ); - + m_staticTextscale = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Import scale:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextscale->Wrap( -1 ); fgSizerImportSettings->Add( m_staticTextscale, 0, wxALIGN_CENTER_VERTICAL, 5 ); - + m_textCtrlImportScale = new wxTextCtrl( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizerImportSettings->Add( m_textCtrlImportScale, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - + + fgSizerImportSettings->Add( 0, 0, 0, 0, 5 ); - - + + bSizer7->Add( fgSizerImportSettings, 1, wxBOTTOM|wxEXPAND|wxRIGHT|wxTOP, 5 ); - - + + sbSizer1->Add( bSizer7, 1, wxEXPAND, 5 ); - - + + bSizerMain->Add( sbSizer1, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); - - + + bSizerMain->Add( 0, 0, 0, wxEXPAND, 5 ); - + m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizerOK = new wxButton( this, wxID_OK ); m_sdbSizer->AddButton( m_sdbSizerOK ); m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->Realize(); - + bSizerMain->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 ); - - + + this->SetSizer( bSizerMain ); this->Layout(); bSizerMain->Fit( this ); - + this->Centre( wxBOTH ); - + // Connect Events m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_GFX_BASE::onBrowseFiles ), NULL, this ); m_rbInteractivePlacement->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_IMPORT_GFX_BASE::onInteractivePlacement ), NULL, this ); @@ -214,5 +214,5 @@ DIALOG_IMPORT_GFX_BASE::~DIALOG_IMPORT_GFX_BASE() m_rbAbsolutePlacement->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_IMPORT_GFX_BASE::originOptionOnUpdateUI ), NULL, this ); m_DxfPcbPositionUnits->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_IMPORT_GFX_BASE::onUnitPositionSelection ), NULL, this ); m_choiceUnitLineWidth->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_IMPORT_GFX_BASE::onUnitWidthSelection ), NULL, this ); - + } diff --git a/pcbnew/import_gfx/dialog_import_gfx_base.fbp b/pcbnew/import_gfx/dialog_import_gfx_base.fbp index f9553ea497..15cf8b6e9c 100644 --- a/pcbnew/import_gfx/dialog_import_gfx_base.fbp +++ b/pcbnew/import_gfx/dialog_import_gfx_base.fbp @@ -1,8 +1,8 @@ - + - + C++ 1 source_name @@ -16,9 +16,9 @@ none 1 dialog_dxf_import - + . - + 1 1 1 @@ -29,67 +29,67 @@ 0 wxAUI_MGR_DEFAULT - + wxBOTH - + 1 1 impl_virtual - - - + + + 0 wxID_ANY - - + + DIALOG_IMPORT_GFX_BASE - + -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Import Vector Graphics File - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + bSizerMain wxVERTICAL none @@ -98,7 +98,7 @@ wxALL|wxEXPAND 0 - + bSizerFile wxHORIZONTAL none @@ -111,78 +111,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY File: - + 0 - - + + 0 - + 1 m_staticTextFile 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 Only vectors will be imported. Bitmaps and fonts will be ignored. - - - + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -194,86 +194,86 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - + 0 - - - + + + 0 300,-1 1 m_textCtrlFileName 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 Only vectors will be imported. Bitmaps and fonts will be ignored. - + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -285,17 +285,17 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 0 @@ -303,65 +303,65 @@ 0 Left 1 - + 1 - + 0 0 wxID_ANY Browse - + 0 - - + + 0 - + 1 m_buttonBrowse 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 Only vectors will be imported. Bitmaps and fonts will be ignored. - + wxFILTER_NONE wxDefaultValidator - - - - + + + + onBrowseFiles - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -373,18 +373,18 @@ wxID_ANY Placement: - + sbSizer2 wxVERTICAL 1 none - + 20 wxEXPAND|wxLEFT 1 - + bSizerOptions wxVERTICAL none @@ -397,82 +397,82 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Interactive placement - + 0 - - + + 0 - + 1 m_rbInteractivePlacement 1 - - + + protected 1 - + Resizable 1 - - + + ; forward_declare 0 - - + + wxFILTER_NONE wxDefaultValidator - + 1 - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + onInteractivePlacement - - - - - + + + + + originOptionOnUpdateUI @@ -481,7 +481,7 @@ wxEXPAND 0 - + bSizerUserPos wxHORIZONTAL none @@ -494,82 +494,82 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY At - + 0 - - + + 0 - + 1 m_rbAbsolutePlacement 1 - - + + protected 1 - + Resizable 1 - - + + ; forward_declare 0 - - + + wxFILTER_NONE wxDefaultValidator - + 0 - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + onAbsolutePlacement - - - - - + + + + + originOptionOnUpdateUI @@ -578,7 +578,7 @@ wxBOTTOM|wxEXPAND|wxTOP 1 - + bSizerPosSettings wxHORIZONTAL none @@ -591,78 +591,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY X: - + 0 - - + + 0 - + 1 m_staticTextXpos 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -674,86 +674,86 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - + 0 - + 10 - + 0 - + 1 m_DxfPcbXCoord 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 DXF origin on PCB Grid, X Coordinate - + wxFILTER_NUMERIC wxTextValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -765,78 +765,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Y: - + 0 - - + + 0 - + 1 m_staticTextYpos 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -848,86 +848,86 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - + 0 - + 10 - + 0 - + 1 m_DxfPcbYCoord 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 DXF origin on PCB Grid, Y Coordinate - + wxFILTER_NUMERIC wxTextValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -939,78 +939,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Units: - + 0 - - + + 0 - + 1 m_staticTextUnits 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1022,83 +1022,83 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 "mm" "inch" 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - + 0 - - + + 0 - + 1 m_DxfPcbPositionUnits 1 - - + + protected 1 - + Resizable 0 1 - - - + + + 0 Select PCB grid units - + wxFILTER_NONE wxDefaultValidator - - - - - + + + + + onUnitPositionSelection - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -1116,18 +1116,18 @@ wxID_ANY Import parameters: - + sbSizer1 wxVERTICAL 1 none - + 5 wxEXPAND 1 - + bSizer7 wxHORIZONTAL none @@ -1149,9 +1149,9 @@ 3 wxBOTH 1 - + 5 - + fgSizerImportSettings wxFLEX_GROWMODE_SPECIFIED none @@ -1166,78 +1166,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Line width (DXF import): - + 0 - - + + 0 - + 1 m_staticTextLineWidth 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1249,86 +1249,86 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - + 0 - - - + + + 0 - + 1 m_textCtrlLineWidth 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1340,83 +1340,83 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 "mm" "mils" "inches" 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - + 0 - - + + 0 - + 1 m_choiceUnitLineWidth 1 - - + + protected 1 - + Resizable 0 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - + + + + + onUnitWidthSelection - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -1428,78 +1428,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Graphic layer: - + 0 - - + + 0 - + 1 m_staticTextBrdlayer 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1511,91 +1511,91 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 - + 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - + 0 - - + + 0 - + 1 m_SelLayerBox 1 - - + + protected 1 - + Resizable -1 1 - - + + PCB_LAYER_BOX_SELECTOR; pcb_layer_box_selector.h 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 - + 0 0 @@ -1612,78 +1612,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Import scale: - + 0 - - + + 0 - + 1 m_staticTextscale 1 - - + + protected 1 - + Resizable 1 - - + + ; forward_declare 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1695,91 +1695,91 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - + 0 - - - + + + 0 - + 1 m_textCtrlImportScale 1 - - + + protected 1 - + Resizable 1 - - + + ; forward_declare 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 - + 0 0 @@ -1816,17 +1816,17 @@ 1 0 0 - + m_sdbSizer protected - - - - - - - - + + + + + + + + diff --git a/pcbnew/import_gfx/dialog_import_gfx_base.h b/pcbnew/import_gfx/dialog_import_gfx_base.h index a4fb6f7325..92ed242071 100644 --- a/pcbnew/import_gfx/dialog_import_gfx_base.h +++ b/pcbnew/import_gfx/dialog_import_gfx_base.h @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) +// C++ code generated with wxFormBuilder (version Jul 10 2019) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __DIALOG_IMPORT_GFX_BASE_H__ -#define __DIALOG_IMPORT_GFX_BASE_H__ +#pragma once #include #include @@ -21,6 +20,9 @@ class PCB_LAYER_BOX_SELECTOR; #include #include #include +#include +#include +#include #include #include #include @@ -39,7 +41,7 @@ class PCB_LAYER_BOX_SELECTOR; class DIALOG_IMPORT_GFX_BASE : public DIALOG_SHIM { private: - + protected: wxStaticText* m_staticTextFile; wxTextCtrl* m_textCtrlFileName; @@ -62,7 +64,7 @@ class DIALOG_IMPORT_GFX_BASE : public DIALOG_SHIM wxStdDialogButtonSizer* m_sdbSizer; wxButton* m_sdbSizerOK; wxButton* m_sdbSizerCancel; - + // Virtual event handlers, overide them in your derived class virtual void onBrowseFiles( wxCommandEvent& event ) { event.Skip(); } virtual void onInteractivePlacement( wxCommandEvent& event ) { event.Skip(); } @@ -70,13 +72,12 @@ class DIALOG_IMPORT_GFX_BASE : public DIALOG_SHIM virtual void onAbsolutePlacement( wxCommandEvent& event ) { event.Skip(); } virtual void onUnitPositionSelection( wxCommandEvent& event ) { event.Skip(); } virtual void onUnitWidthSelection( wxCommandEvent& event ) { event.Skip(); } - - + + public: - - DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Import Vector Graphics File"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + + DIALOG_IMPORT_GFX_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Import Vector Graphics File"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_IMPORT_GFX_BASE(); - + }; -#endif //__DIALOG_IMPORT_GFX_BASE_H__ diff --git a/pcbnew/import_gfx/dxf_import_plugin.cpp b/pcbnew/import_gfx/dxf_import_plugin.cpp index 7d73094849..264f511fd3 100644 --- a/pcbnew/import_gfx/dxf_import_plugin.cpp +++ b/pcbnew/import_gfx/dxf_import_plugin.cpp @@ -332,10 +332,9 @@ void DXF_IMPORT_PLUGIN::endEntity() void DXF_IMPORT_PLUGIN::addBlock( const DL_BlockData& aData ) { - // The DXF blocks are not useful in our import, so we skip them with the exception - // of the main block that is shown when editing the file - if( aData.name.compare( "*Model_Space") ) - m_inBlock = true; + // The DXF blocks are not useful in our import, so we skip the block id + // because Pcbnew has no support to group a set of graphic items inside an entity + m_inBlock = false; } diff --git a/pcbnew/import_gfx/dxf_import_plugin.h b/pcbnew/import_gfx/dxf_import_plugin.h index fce2d3bdef..d2def32711 100644 --- a/pcbnew/import_gfx/dxf_import_plugin.h +++ b/pcbnew/import_gfx/dxf_import_plugin.h @@ -115,6 +115,13 @@ public: * This class import DXF ASCII files and convert basic entities to board entities. * It depends on the dxflib library. */ +#if 0 //defined(DEBUG) +// For dxf import debug: +#define ON_UNSUPPORTED( error_msg ) wxLogMessage( error_msg ) +#else +#define ON_UNSUPPORTED( error_msg ) +#endif + class DXF_IMPORT_PLUGIN : public GRAPHICS_IMPORT_PLUGIN, public DL_CreationAdapter { private: @@ -299,37 +306,61 @@ private: virtual void addKnot( const DL_KnotData& aData ) override; // Not yet handled DXF entities: + virtual void addXLine( const DL_XLineData& ) override { ON_UNSUPPORTED( "addXLine" ); } + + virtual void addRay( const DL_RayData& ) override { ON_UNSUPPORTED( "addRay" ); } + + virtual void addArcAlignedText( const DL_ArcAlignedTextData& ) override + { ON_UNSUPPORTED( "addArcAlignedText" ); } + + virtual void addAttribute( const DL_AttributeData& ) override + { ON_UNSUPPORTED( "addAttribute" ); } + virtual void addDimAlign( const DL_DimensionData&, - const DL_DimAlignedData& ) override {} + const DL_DimAlignedData& ) override { ON_UNSUPPORTED( "addDimAlign" ); } virtual void addDimLinear( const DL_DimensionData&, - const DL_DimLinearData& ) override {} + const DL_DimLinearData& ) override { ON_UNSUPPORTED( "addDimLinear" ); } virtual void addDimRadial( const DL_DimensionData&, - const DL_DimRadialData& ) override {} + const DL_DimRadialData& ) override { ON_UNSUPPORTED( "addDimRadial" ); } virtual void addDimDiametric( const DL_DimensionData&, - const DL_DimDiametricData& ) override {} + const DL_DimDiametricData& ) override { ON_UNSUPPORTED( "addDimDiametric" ); } virtual void addDimAngular( const DL_DimensionData&, - const DL_DimAngularData& ) override {} + const DL_DimAngularData& ) override { ON_UNSUPPORTED( "addDimAngular" ); } virtual void addDimAngular3P( const DL_DimensionData&, - const DL_DimAngular3PData& ) override {} + const DL_DimAngular3PData& ) override { ON_UNSUPPORTED( "addDimAngular3P" ); } virtual void addDimOrdinate( const DL_DimensionData&, - const DL_DimOrdinateData& ) override {} - virtual void addLeader( const DL_LeaderData& ) override {} + const DL_DimOrdinateData& ) override { ON_UNSUPPORTED( "addDimOrdinate" ); } - virtual void addLeaderVertex( const DL_LeaderVertexData& ) override {} + virtual void addLeader( const DL_LeaderData& ) override + { ON_UNSUPPORTED( "addLeader" ); } - virtual void addHatch( const DL_HatchData& ) override {} + virtual void addLeaderVertex( const DL_LeaderVertexData& ) override + { ON_UNSUPPORTED( "addLeaderVertex" ); } - virtual void addTrace( const DL_TraceData& ) override {} - virtual void add3dFace( const DL_3dFaceData& ) override {} + virtual void addHatch( const DL_HatchData& ) override { ON_UNSUPPORTED( "addHatch" ); } - virtual void addSolid( const DL_SolidData& ) override {} + virtual void addTrace( const DL_TraceData& ) override { ON_UNSUPPORTED( "addTrace" ); } + virtual void add3dFace( const DL_3dFaceData& ) override { ON_UNSUPPORTED( "add3dFace" ); } - virtual void addImage( const DL_ImageData& ) override {} + virtual void addSolid( const DL_SolidData& ) override { ON_UNSUPPORTED( "addSolid" ); } + + virtual void addImage( const DL_ImageData& ) override { ON_UNSUPPORTED( "addImage" ); } virtual void linkImage( const DL_ImageDefData& ) override {} - virtual void addHatchLoop( const DL_HatchLoopData& ) override {} + virtual void addHatchLoop( const DL_HatchLoopData& ) override { ON_UNSUPPORTED( "addHatchLoop" ); } - virtual void addHatchEdge( const DL_HatchEdgeData& ) override {} + virtual void addHatchEdge( const DL_HatchEdgeData& ) override { ON_UNSUPPORTED( "addHatchEdge" ); } + + virtual void addXRecord( const std::string& ) override { ON_UNSUPPORTED( "addXRecord" ); } + virtual void addXRecordString( int, const std::string& ) override { ON_UNSUPPORTED( "addXRecordString" ); } + virtual void addXRecordReal( int, double ) override { ON_UNSUPPORTED( "addXRecordReal" ); } + virtual void addXRecordInt( int, int ) override { ON_UNSUPPORTED( "addXRecordInt" ); } + virtual void addXRecordBool( int, bool ) override { ON_UNSUPPORTED( "addXRecordBool" ); } + + virtual void addXDataApp( const std::string& ) override { ON_UNSUPPORTED( "addXDataApp" ); } + virtual void addXDataString( int, const std::string& ) override { ON_UNSUPPORTED( "addXDataString" ); } + virtual void addXDataReal( int, double ) override { ON_UNSUPPORTED( "addXDataReal" ); } + virtual void addXDataInt( int, int ) override { ON_UNSUPPORTED( "addXDataInt" ); } /** * Convert a native unicode string into a DXF encoded string.