63 if( aImportAsFootprintGraphic )
81 m_gfxImportMgr = std::make_unique<GRAPHICS_IMPORT_MGR>( blacklist );
92 m_layer = cfg->m_ImportGraphics.layer;
98 m_origin.
x = cfg->m_ImportGraphics.origin_x;
99 m_origin.
y = cfg->m_ImportGraphics.origin_y;
135 GetSizer()->Fit(
this );
136 GetSizer()->SetSizeHints(
this );
151 cfg->m_ImportGraphics.origin_x =
m_origin.
x;
152 cfg->m_ImportGraphics.origin_y =
m_origin.
y;
157 void DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX::onUnitPositionSelection( wxCommandEvent& event )
160 updatePcbImportOffsets_mm();
162 m_originUnits = m_DxfPcbPositionUnits->GetSelection();;
163 showPcbImportOffsets();
175 case 1: value *= 25.4 / 1000;
break;
176 case 2: value *= 25.4;
break;
232 filename = fn.GetFullName();
236 wxString wildcardsDesc;
237 wxString allWildcards;
242 const auto extensions = plugin->GetFileExtensions();
245 allWildcards += plugin->GetWildcards() +
";";
248 wildcardsDesc =
_(
"All supported formats|" ) + allWildcards + wildcardsDesc;
250 wxFileDialog dlg(
m_parent,
_(
"Open File" ), path, filename, wildcardsDesc,
251 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
253 if( dlg.ShowModal() != wxID_OK )
256 wxString fileName = dlg.GetPath();
258 if( fileName.IsEmpty() )
268 if( !wxDialog::TransferDataFromWindow() )
275 wxMessageBox(
_(
"No file selected!" ) );
286 wxMessageBox(
_(
"Please select a valid layer." ) );
302 if( dxfPlugin !=
nullptr )
310 dxfPlugin->
SetUnit( it->first );
329 wxString warnings =
m_importer->GetMessages();
332 if( !warnings.empty() )
335 dlg.
MessageSet(
_(
"Items in the imported file could not be handled properly." ) );
336 warnings.Replace(
"\n",
"<br/>" );
343 wxMessageBox(
_(
"There is no plugin to handle this file type." ) );
std::unique_ptr< GRAPHICS_IMPORT_MGR > m_gfxImportMgr
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
const BITMAP_OPAQUE small_folder_xpm[1]
const std::map< DXF_IMPORT_UNITS, wxString > dxfUnitsMap
void originOptionOnUpdateUI(wxUpdateUIEvent &event) override
bool TransferDataFromWindow() override
wxTextCtrl * m_textCtrlLineWidth
Class DIALOG_IMPORT_GFX_BASE.
DIALOG_IMPORT_GFX(PCB_BASE_FRAME *aParent, bool aUseModuleItems=false)
void onBrowseFiles(wxCommandEvent &event) override
void onUnitWidthSelection(wxCommandEvent &event) override
wxRadioButton * m_rbInteractivePlacement
wxCheckBox * m_groupItems
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
wxTextCtrl * m_DxfPcbYCoord
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
LAYER_NUM GetLayerSelection() const
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
PCB_LAYER_ID
A quick note on layer IDs:
wxTextCtrl * m_textCtrlImportScale
FOOTPRINT * GetFirstFootprint() const
Gets the first footprint on the board or nullptr.
void SetUnit(DXF_IMPORT_UNITS aUnit)
Set the default units when importing DXFs DXFs can lack units by design which requires the importing ...
void showPCBdefaultLineWidth()
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
static int m_lineWidthUnits
PCB_BASE_FRAME * m_parent
Definition of file extensions used in Kicad.
int SetLayerSelection(LAYER_NUM layer)
bool SetLayersHotkeys(bool value)
wxChoice * m_choiceDxfUnits
wxChoice * m_choiceUnitLineWidth
std::vector< GFX_FILE_T > TYPE_LIST
void MessageSet(const wxString &message)
Add a message (in bold) to message list.
int LAYER_NUM
This can be replaced with int and removed.
wxBitmapButton * m_browseButton
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
static wxString m_filename
static double m_scaleImport
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
wxRadioButton * m_rbAbsolutePlacement
void AddHTML_Text(const wxString &message)
Add HTML text (without any change) to message list.
void showPcbImportOffsets()
wxTextCtrl * m_DxfPcbXCoord
wxTextCtrl * m_textCtrlFileName
void updatePcbImportOffsets_mm()
PCBNEW_SETTINGS * GetPcbNewSettings() const
wxChoice * m_DxfPcbPositionUnits
static bool m_placementInteractive
static bool m_shouldGroupItems
double getPCBdefaultLineWidthMM()
DIALOG_IMPORT_GRAPHICS m_ImportGraphics
double DoubleValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function DoubleValueFromString converts aTextValue to a double.
std::unique_ptr< GRAPHICS_IMPORTER_PCBNEW > m_importer
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.