32#include <wx/filedlg.h>
49 const wxString& aFilesWildcard,
50 const std::vector<std::string>& aSchFileExtensions,
51 const std::vector<std::string>& aPcbFileExtensions,
52 int aSchFileType,
int aPcbFileType )
56 int style = wxFD_OPEN | wxFD_FILE_MUST_EXIST;
58 wxFileDialog inputdlg(
this, aWindowTitle, default_dir, wxEmptyString, aFilesWildcard, style );
62 if( inputdlg.ShowModal() == wxID_CANCEL )
65 wxString inputPath = inputdlg.GetPath();
66 bool isPadsProject = ( aSchFileType == SCH_IO_MGR::SCH_PADS
73 _(
"The selected file does not appear to be a PADS ASCII schematic or PCB." ) );
83 std::vector<wxString> schFileExts( aSchFileExtensions.begin(), aSchFileExtensions.end() );
84 std::vector<wxString> pcbFileExts( aPcbFileExtensions.begin(), aPcbFileExtensions.end() );
91 wxDirDialog prodlg(
this,
_(
"KiCad Project Destination" ), importProj.
m_InputFile.GetPath(),
94 if( prodlg.ShowModal() == wxID_CANCEL )
97 wxString targetDir = prodlg.GetPath();
109 msg.Printf(
_(
"Folder '%s' could not be created.\n\n"
110 "Make sure you have write permissions and try again." ),
118 wxDir targetDirTest( targetDir );
119 if( targetDirTest.IsOpened() && targetDirTest.HasFiles() )
121 msg =
_(
"The selected directory is not empty. We recommend you "
122 "create projects in their own clean directory.\n\nDo you "
123 "want to create a new empty directory for the project?" );
125 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxYES_NO | wxICON_WARNING );
136 msg =
_(
"Error creating new directory. Please try a different path. The "
137 "project cannot be imported." );
140 wxOK_DEFAULT | wxICON_ERROR );
141 dirErrorDlg.ShowModal();
147 targetDirTest.Close();
156 importProj.
ImportFiles( aSchFileType, aPcbFileType );
203 {
"asc",
"txt" }, {
"asc",
"txt" }, SCH_IO_MGR::SCH_PADS,
wxString GetMruPath() const
A helper class to import non Kicad project.
void FindEmptyTargetDir()
Appends a new directory with the name of the project file Keep iterating until an empty directory is ...
void ImportFiles(int aImportedSchFileType, int aImportedPcbFileType)
Converts imported files to kicad type files.
void ImportPadsFiles()
Converts PADS ASCII schematic and PCB files to KiCad type files.
void CreateNewProject(const wxFileName &aProjectFileName, bool aCreateStubFiles=true)
Creates a new project by setting up and initial project, schematic, and board files.
void OnImportEasyEdaProFiles(wxCommandEvent &event)
Open dialog to import EasyEDA Pro schematic and board files.
void OnImportEasyEdaFiles(wxCommandEvent &event)
Open dialog to import EasyEDA Std schematic and board files.
void OnImportPadsProjectFiles(wxCommandEvent &event)
Open dialog to import PADS Logic schematic and PCB files.
void OnImportAltiumProjectFiles(wxCommandEvent &event)
Open dialog to import Altium project files.
void OnImportEagleFiles(wxCommandEvent &event)
Open dialog to import Eagle schematic and board files.
void OnImportGedaFiles(wxCommandEvent &event)
Open dialog to import gEDA/gaf schematic and PCB files.
bool CloseProject(bool aSave)
Closes the project, and saves it if aSave is true;.
bool LoadProject(const wxFileName &aProjectFileName)
Loads a new project.
void OnImportCadstarArchiveFiles(wxCommandEvent &event)
Open dialog to import CADSTAR Schematic and PCB Archive files.
void ImportNonKiCadProject(const wxString &aWindowTitle, const wxString &aFilesWildcard, const std::vector< std::string > &aSchFileExtensions, const std::vector< std::string > &aPcbFileExtensions, int aSchFileType, int aPcbFileType)
Creates a project and imports a non-KiCad Schematic and PCB.
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox.
@ GEDA_PCB
Geda PCB file formats.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
#define KICAD_MESSAGE_DIALOG
static const std::string ProjectFileExtension
static wxString EasyEdaArchiveWildcard()
static wxString GedaProjectFilesWildcard()
static wxString CadstarArchiveFilesWildcard()
static wxString EasyEdaProFileWildcard()
static wxString PADSProjectFilesWildcard()
static wxString AltiumProjectFilesWildcard()
static wxString EagleFilesWildcard()
PADS_FILE_TYPE DetectPadsFileType(const wxString &aFilePath)
Detect the type of a PADS file by examining its header.
Common utilities and types for parsing PADS file formats.
Definition of file extensions used in Kicad.