36 #include <wx/filedlg.h> 37 #include <wx/msgdlg.h> 65 if( aImportAsFootprintGraphic )
83 m_gfxImportMgr = std::make_unique<GRAPHICS_IMPORT_MGR>( blacklist );
94 m_layer = cfg->m_ImportGraphics.layer;
100 m_origin.
x = cfg->m_ImportGraphics.origin_x;
101 m_origin.
y = cfg->m_ImportGraphics.origin_y;
137 GetSizer()->Fit(
this );
138 GetSizer()->SetSizeHints(
this );
153 cfg->m_ImportGraphics.origin_x =
m_origin.
x;
154 cfg->m_ImportGraphics.origin_y =
m_origin.
y;
159 void DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX::onUnitPositionSelection( wxCommandEvent& event )
162 updatePcbImportOffsets_mm();
164 m_originUnits = m_DxfPcbPositionUnits->GetSelection();;
165 showPcbImportOffsets();
177 case 1: value *= 25.4 / 1000;
break;
178 case 2: value *= 25.4;
break;
234 filename = fn.GetFullName();
238 wxString wildcardsDesc;
239 wxString allWildcards;
244 const auto extensions = plugin->GetFileExtensions();
247 allWildcards += plugin->GetWildcards() + wxT(
";" );
250 wildcardsDesc =
_(
"All supported formats|" ) + allWildcards + wildcardsDesc;
252 wxFileDialog dlg(
m_parent,
_(
"Open File" ),
path, filename, wildcardsDesc,
253 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
255 if( dlg.ShowModal() != wxID_OK )
258 wxString fileName = dlg.GetPath();
260 if( fileName.IsEmpty() )
270 if( !wxDialog::TransferDataFromWindow() )
277 wxMessageBox(
_(
"No file selected!" ) );
288 wxMessageBox(
_(
"Please select a valid layer." ) );
304 if( dxfPlugin !=
nullptr )
312 dxfPlugin->
SetUnit( it->first );
331 wxString warnings =
m_importer->GetMessages();
334 if( !warnings.empty() )
337 dlg.
MessageSet(
_(
"Items in the imported file could not be handled properly." ) );
338 warnings.Replace( wxT(
"\n" ), wxT(
"<br/>" ) );
345 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 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
int LAYER_NUM
This can be replaced with int and removed.
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.
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
LAYER_NUM GetLayerSelection() const
wxTextCtrl * m_textCtrlImportScale
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
void SetUnit(DXF_IMPORT_UNITS aUnit)
Set the default units when importing DXFs.
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)
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
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.
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
PCB_LAYER_ID
A quick note on layer IDs:
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.