37#include <wx/filedlg.h>
60 m_xOrigin( aParent, m_xLabel, m_xCtrl, m_xUnits ),
61 m_yOrigin( aParent, m_yLabel, m_yCtrl, m_yUnits ),
62 m_defaultLineWidth( aParent, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits )
64 if( aImportAsFootprintGraphic )
82 m_gfxImportMgr = std::make_unique<GRAPHICS_IMPORT_MGR>( blacklist );
108 for(
const std::pair<const DXF_IMPORT_UNITS, wxString>& unitEntry :
dxfUnitsMap )
115 wxCommandEvent
dummy;
121 GetSizer()->Fit(
this );
122 GetSizer()->SetSizeHints(
this );
153 bool enableDXFControls =
true;
156 if( std::unique_ptr<GRAPHICS_IMPORT_PLUGIN> plugin =
m_gfxImportMgr->GetPluginByExt( ext ) )
171 if( !filename.IsEmpty() )
173 wxFileName fn( filename );
175 filename = fn.GetFullName();
179 wxString wildcardsDesc;
180 wxString allWildcards;
184 std::unique_ptr<GRAPHICS_IMPORT_PLUGIN> plugin =
m_gfxImportMgr->GetPlugin( pluginType );
185 const std::vector<std::string> extensions = plugin->GetFileExtensions();
188 allWildcards += plugin->GetWildcards() + wxT(
";" );
191 wildcardsDesc =
_(
"All supported formats" ) + wxT(
"|" ) + allWildcards + wildcardsDesc;
193 wxFileDialog dlg(
m_parent,
_(
"Open File" ),
path, filename, wildcardsDesc,
194 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
196 if( dlg.ShowModal() == wxID_OK && !dlg.GetPath().IsEmpty() )
203 if( !wxDialog::TransferDataFromWindow() )
208 wxMessageBox(
_(
"No file selected!" ) );
214 wxMessageBox(
_(
"Please select a valid layer." ) );
221 double xscale =
scale;
222 double yscale =
scale;
236 if( std::unique_ptr<GRAPHICS_IMPORT_PLUGIN> plugin =
m_gfxImportMgr->GetPluginByExt( ext ) )
244 dxfPlugin->SetUnit( DXF_IMPORT_UNITS::DEFAULT );
246 dxfPlugin->SetUnit( it->first );
265 wxString warnings =
m_importer->GetMessages();
268 if( !warnings.empty() )
271 dlg.
MessageSet(
_(
"Items in the imported file could not be handled properly." ) );
272 warnings.Replace( wxT(
"\n" ), wxT(
"<br/>" ) );
281 wxMessageBox(
_(
"There is no plugin to handle this file type." ) );
constexpr EDA_IU_SCALE pcbIUScale
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Class DIALOG_IMPORT_GFX_BASE.
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
wxRadioButton * m_rbInteractivePlacement
wxTextCtrl * m_textCtrlFileName
wxCheckBox * m_groupItems
wxTextCtrl * m_importScaleCtrl
wxChoice * m_choiceDxfUnits
wxRadioButton * m_rbAbsolutePlacement
wxStaticText * m_staticTextLineWidth1
STD_BITMAP_BUTTON * m_browseButton
void onFilename(wxCommandEvent &event)
static double m_importScale
bool TransferDataFromWindow() override
void originOptionOnUpdateUI(wxUpdateUIEvent &event) override
PCB_BASE_FRAME * m_parent
DIALOG_IMPORT_GFX(PCB_BASE_FRAME *aParent, bool aUseModuleItems=false)
std::unique_ptr< GRAPHICS_IMPORT_MGR > m_gfxImportMgr
static bool m_placementInteractive
UNIT_BINDER m_defaultLineWidth
static bool m_shouldGroupItems
void onBrowseFiles(wxCommandEvent &event) override
std::unique_ptr< GRAPHICS_IMPORTER_PCBNEW > m_importer
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
GFX_FILE_T
< List of handled file types.
std::vector< GFX_FILE_T > TYPE_LIST
void MessageSet(const wxString &message)
Add a message (in bold) to message list.
void AddHTML_Text(const wxString &message)
Add HTML text (without any change) to message list.
int GetLayerSelection() const
int SetLayerSelection(int layer)
bool SetLayersHotkeys(bool value)
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
DISPLAY_OPTIONS m_Display
DIALOG_IMPORT_GRAPHICS m_ImportGraphics
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
PCBNEW_SETTINGS * GetPcbNewSettings() const
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
virtual long long int GetValue()
Return the current value in Internal Units.
void Enable(bool aEnable)
Enable/disable the label, widget and units label.
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
const std::map< DXF_IMPORT_UNITS, wxString > dxfUnitsMap
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.
PCB_LAYER_ID
A quick note on layer IDs:
double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function DoubleValueFromString converts aTextValue to a double.
std::vector< FAB_LAYER_COLOR > dummy
constexpr double IUTomm(int iu) const
bool interactive_placement
bool m_DisplayInvertYAxis
bool m_DisplayInvertXAxis
Definition of file extensions used in Kicad.