32#include <wx/filedlg.h>
47 const wxString& aFilesWildcard,
48 const std::vector<std::string>& aSchFileExtensions,
49 const std::vector<std::string>& aPcbFileExtensions,
50 int aSchFileType,
int aPcbFileType )
54 int style = wxFD_OPEN | wxFD_FILE_MUST_EXIST;
56 wxFileDialog inputdlg(
this, aWindowTitle, default_dir, wxEmptyString, aFilesWildcard, style );
58 if( inputdlg.ShowModal() == wxID_CANCEL )
67 std::vector<wxString> schFileExts( aSchFileExtensions.begin(), aSchFileExtensions.end() );
68 std::vector<wxString> pcbFileExts( aPcbFileExtensions.begin(), aPcbFileExtensions.end() );
75 wxDirDialog prodlg(
this,
_(
"KiCad Project Destination" ), importProj.
m_InputFile.GetPath(),
78 if( prodlg.ShowModal() == wxID_CANCEL )
81 wxString targetDir = prodlg.GetPath();
93 msg.Printf(
_(
"Folder '%s' could not be created.\n\n"
94 "Make sure you have write permissions and try again." ),
102 wxDir targetDirTest( targetDir );
103 if( targetDirTest.IsOpened() && targetDirTest.HasFiles() )
105 msg =
_(
"The selected directory is not empty. We recommend you "
106 "create projects in their own clean directory.\n\nDo you "
107 "want to create a new empty directory for the project?" );
109 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxYES_NO | wxICON_WARNING );
120 msg =
_(
"Error creating new directory. Please try a different path. The "
121 "project cannot be imported." );
123 wxMessageDialog dirErrorDlg(
this, msg,
_(
"Error" ),
124 wxOK_DEFAULT | wxICON_ERROR );
125 dirErrorDlg.ShowModal();
131 targetDirTest.Close();
137 importProj.
ImportFiles( aSchFileType, aPcbFileType );
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 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 OnImportEagleFiles(wxCommandEvent &event)
Open dialog to import Eagle schematic and board files.
void LoadProject(const wxFileName &aProjectFileName)
bool CloseProject(bool aSave)
Closes the project, and saves it if aSave is true;.
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)
Checks the 'do not show again' setting for the dialog.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
static const std::string ProjectFileExtension
static wxString EasyEdaArchiveWildcard()
static wxString CadstarArchiveFilesWildcard()
static wxString EasyEdaProFileWildcard()
static wxString EagleFilesWildcard()
This file is part of the common library.
Definition of file extensions used in Kicad.