Kick the wildcards and file exts into a static class, export it from kicommon
This commit is contained in:
parent
5e7a68fcd9
commit
9a890cdba9
|
@ -714,8 +714,8 @@ void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event )
|
|||
if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
|
||||
{
|
||||
// Remember path between saves during this session only.
|
||||
const wxString wildcard = fmt_is_jpeg ? JpegFileWildcard() : PngFileWildcard();
|
||||
const wxString ext = fmt_is_jpeg ? JpegFileExtension : PngFileExtension;
|
||||
const wxString wildcard = fmt_is_jpeg ? FILEEXT::JpegFileWildcard() : FILEEXT::PngFileWildcard();
|
||||
const wxString ext = fmt_is_jpeg ? FILEEXT::JpegFileExtension : FILEEXT::PngFileExtension;
|
||||
|
||||
// First time path is set to the project path.
|
||||
if( !m_defaultSaveScreenshotFileName.IsOk() )
|
||||
|
|
|
@ -438,14 +438,14 @@ void BITMAP2CMP_FRAME::ExportDrawingSheetFormat()
|
|||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Drawing Sheet File" ), path, wxEmptyString,
|
||||
DrawingSheetFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
FILEEXT::DrawingSheetFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
int diag = fileDlg.ShowModal();
|
||||
|
||||
if( diag != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = fileDlg.GetPath();
|
||||
fn.SetExt( DrawingSheetFileExtension );
|
||||
fn.SetExt( FILEEXT::DrawingSheetFileExtension );
|
||||
m_convertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile;
|
||||
|
@ -475,7 +475,7 @@ void BITMAP2CMP_FRAME::ExportPostScriptFormat()
|
|||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create PostScript File" ), path, wxEmptyString,
|
||||
PSFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
FILEEXT::PSFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
@ -511,12 +511,13 @@ void BITMAP2CMP_FRAME::ExportEeschemaFormat()
|
|||
path = ::wxGetCwd();
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Symbol Library" ), path, wxEmptyString,
|
||||
KiCadSymbolLibFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
FILEEXT::KiCadSymbolLibFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = EnsureFileExtension( fileDlg.GetPath(), KiCadSymbolLibFileExtension );
|
||||
fn = EnsureFileExtension( fileDlg.GetPath(), FILEEXT::KiCadSymbolLibFileExtension );
|
||||
m_convertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile = wxFopen( m_convertedFileName, wxT( "w" ) );
|
||||
|
@ -545,12 +546,13 @@ void BITMAP2CMP_FRAME::ExportPcbnewFormat()
|
|||
path = m_mruPath;
|
||||
|
||||
wxFileDialog fileDlg( this, _( "Create Footprint Library" ), path, wxEmptyString,
|
||||
KiCadFootprintLibFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
FILEEXT::KiCadFootprintLibFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
fn = EnsureFileExtension( fileDlg.GetPath(), KiCadFootprintFileExtension );
|
||||
fn = EnsureFileExtension( fileDlg.GetPath(), FILEEXT::KiCadFootprintFileExtension );
|
||||
m_convertedFileName = fn.GetFullPath();
|
||||
|
||||
FILE* outfile = wxFopen( m_convertedFileName, wxT( "w" ) );
|
||||
|
|
|
@ -119,6 +119,7 @@ set( KICOMMON_SRCS
|
|||
richio.cpp
|
||||
string_utils.cpp
|
||||
trace_helpers.cpp
|
||||
wildcards_and_files_ext.cpp
|
||||
wx_filename.cpp
|
||||
|
||||
io/kicad/kicad_io_utils.cpp # needed by richio
|
||||
|
@ -509,7 +510,6 @@ set( COMMON_SRCS
|
|||
title_block.cpp
|
||||
undo_redo_container.cpp
|
||||
validators.cpp
|
||||
wildcards_and_files_ext.cpp
|
||||
drawing_sheet/ds_painter.cpp
|
||||
xnode.cpp
|
||||
view/wx_view_controls.cpp
|
||||
|
|
|
@ -168,5 +168,5 @@ DATABASE_LIB_SETTINGS::DATABASE_LIB_SETTINGS( const std::string& aFilename ) :
|
|||
|
||||
wxString DATABASE_LIB_SETTINGS::getFileExt() const
|
||||
{
|
||||
return DatabaseLibraryFileExtension;
|
||||
return FILEEXT::DatabaseLibraryFileExtension;
|
||||
}
|
||||
|
|
|
@ -793,7 +793,8 @@ void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
|
|||
|
||||
// Display a file picker dialog
|
||||
wxFileDialog fileDialog( this, _( "Drawing Sheet File" ), path, name,
|
||||
DrawingSheetFileWildcard(), wxFD_DEFAULT_STYLE|wxFD_FILE_MUST_EXIST );
|
||||
FILEEXT::DrawingSheetFileWildcard(),
|
||||
wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( fileDialog.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
|
|
@ -199,8 +199,8 @@ void PANEL_HOTKEYS_EDITOR::OnFilterSearch( wxCommandEvent& aEvent )
|
|||
void PANEL_HOTKEYS_EDITOR::ImportHotKeys()
|
||||
{
|
||||
wxString filename = wxFileSelector( _( "Import Hotkeys File:" ), m_frame->GetMruPath(),
|
||||
wxEmptyString, HotkeyFileExtension,
|
||||
HotkeyFileWildcard(), wxFD_OPEN, this );
|
||||
wxEmptyString, FILEEXT::HotkeyFileExtension,
|
||||
FILEEXT::HotkeyFileWildcard(), wxFD_OPEN, this );
|
||||
|
||||
if( filename.IsEmpty() )
|
||||
return;
|
||||
|
@ -229,7 +229,7 @@ void PANEL_HOTKEYS_EDITOR::ImportHotKeys()
|
|||
void PANEL_HOTKEYS_EDITOR::dumpHotkeys()
|
||||
{
|
||||
wxString filename = wxFileSelector( wxT( "Hotkeys File" ), m_frame->GetMruPath(),
|
||||
wxEmptyString, TextFileExtension, TextFileWildcard(),
|
||||
wxEmptyString, FILEEXT::TextFileExtension, FILEEXT::TextFileWildcard(),
|
||||
wxFD_SAVE, this );
|
||||
|
||||
if( filename.IsEmpty() )
|
||||
|
|
|
@ -1248,8 +1248,8 @@ void EDA_BASE_FRAME::OnDropFiles( wxDropFilesEvent& aEvent )
|
|||
wxString ext = fn.GetExt();
|
||||
|
||||
// Alias all gerber files as GerberFileExtension
|
||||
if( IsGerberFileExtension( ext ) )
|
||||
ext = GerberFileExtension;
|
||||
if( FILEEXT::IsGerberFileExtension( ext ) )
|
||||
ext = FILEEXT::GerberFileExtension;
|
||||
|
||||
if( m_acceptedExts.find( ext.ToStdString() ) != m_acceptedExts.end() )
|
||||
m_AcceptedFiles.emplace_back( fn );
|
||||
|
|
|
@ -356,7 +356,7 @@ void ReadHotKeyConfig( const wxString& aFileName,
|
|||
if( fileName.IsEmpty() )
|
||||
{
|
||||
wxFileName fn( wxS( "user" ) );
|
||||
fn.SetExt( HotkeyFileExtension );
|
||||
fn.SetExt( FILEEXT::HotkeyFileExtension );
|
||||
fn.SetPath( PATHS::GetUserSettingsPath() );
|
||||
fileName = fn.GetFullPath();
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ int WriteHotKeyConfig( const std::vector<TOOL_ACTION*>& aActions )
|
|||
std::map<std::string, std::pair<int, int>> hotkeys;
|
||||
wxFileName fn( "user" );
|
||||
|
||||
fn.SetExt( HotkeyFileExtension );
|
||||
fn.SetExt( FILEEXT::HotkeyFileExtension );
|
||||
fn.SetPath( PATHS::GetUserSettingsPath() );
|
||||
|
||||
// Read the existing config (all hotkeys)
|
||||
|
@ -458,7 +458,7 @@ int ReadLegacyHotkeyConfigFile( const wxString& aFilename, std::map<std::string,
|
|||
{
|
||||
wxFileName fn( aFilename );
|
||||
|
||||
fn.SetExt( HotkeyFileExtension );
|
||||
fn.SetExt( FILEEXT::HotkeyFileExtension );
|
||||
fn.SetPath( PATHS::GetUserSettingsPath() );
|
||||
|
||||
if( !wxFile::Exists( fn.GetFullPath() ) )
|
||||
|
|
|
@ -47,5 +47,5 @@ HTTP_LIB_SETTINGS::HTTP_LIB_SETTINGS( const std::string& aFilename ) :
|
|||
|
||||
wxString HTTP_LIB_SETTINGS::getFileExt() const
|
||||
{
|
||||
return HTTPLibraryFileExtension;
|
||||
return FILEEXT::HTTPLibraryFileExtension;
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ void PROJECT::setProjectFullName( const wxString& aFullPathAndName )
|
|||
|
||||
wxASSERT( m_project_name.IsAbsolute() );
|
||||
|
||||
wxASSERT( m_project_name.GetExt() == ProjectFileExtension );
|
||||
wxASSERT( m_project_name.GetExt() == FILEEXT::ProjectFileExtension );
|
||||
|
||||
// until multiple projects are in play, set an environment variable for the
|
||||
// the project pointer.
|
||||
|
|
|
@ -585,7 +585,7 @@ bool PROJECT_FILE::SaveToFile( const wxString& aDirectory, bool aForce )
|
|||
{
|
||||
wxASSERT( m_project );
|
||||
|
||||
Set( "meta.filename", m_project->GetProjectName() + "." + ProjectFileExtension );
|
||||
Set( "meta.filename", m_project->GetProjectName() + "." + FILEEXT::ProjectFileExtension );
|
||||
|
||||
return JSON_SETTINGS::SaveToFile( aDirectory, aForce );
|
||||
}
|
||||
|
@ -597,7 +597,7 @@ bool PROJECT_FILE::SaveAs( const wxString& aDirectory, const wxString& aFile )
|
|||
wxString oldProjectName = oldFilename.GetName();
|
||||
wxString oldProjectPath = oldFilename.GetPath();
|
||||
|
||||
Set( "meta.filename", aFile + "." + ProjectFileExtension );
|
||||
Set( "meta.filename", aFile + "." + FILEEXT::ProjectFileExtension );
|
||||
SetFilename( aFile );
|
||||
|
||||
auto updatePath =
|
||||
|
@ -638,13 +638,13 @@ bool PROJECT_FILE::SaveAs( const wxString& aDirectory, const wxString& aFile )
|
|||
|
||||
wxString PROJECT_FILE::getFileExt() const
|
||||
{
|
||||
return ProjectFileExtension;
|
||||
return FILEEXT::ProjectFileExtension;
|
||||
}
|
||||
|
||||
|
||||
wxString PROJECT_FILE::getLegacyFileExt() const
|
||||
{
|
||||
return LegacyProjectFileExtension;
|
||||
return FILEEXT::LegacyProjectFileExtension;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -352,7 +352,7 @@ bool PROJECT_LOCAL_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce
|
|||
{
|
||||
wxASSERT( m_project );
|
||||
|
||||
Set( "meta.filename", m_project->GetProjectName() + "." + ProjectLocalSettingsFileExtension );
|
||||
Set( "meta.filename", m_project->GetProjectName() + "." + FILEEXT::ProjectLocalSettingsFileExtension );
|
||||
|
||||
return JSON_SETTINGS::SaveToFile( aDirectory, aForce );
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ bool PROJECT_LOCAL_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce
|
|||
|
||||
bool PROJECT_LOCAL_SETTINGS::SaveAs( const wxString& aDirectory, const wxString& aFile )
|
||||
{
|
||||
Set( "meta.filename", aFile + "." + ProjectLocalSettingsFileExtension );
|
||||
Set( "meta.filename", aFile + "." + FILEEXT::ProjectLocalSettingsFileExtension );
|
||||
SetFilename( aFile );
|
||||
|
||||
return JSON_SETTINGS::SaveToFile( aDirectory, true );
|
||||
|
|
|
@ -853,8 +853,8 @@ bool SETTINGS_MANAGER::LoadProject( const wxString& aFullPath, bool aSetActive )
|
|||
// Normalize path to new format even if migrating from a legacy file
|
||||
wxFileName path( aFullPath );
|
||||
|
||||
if( path.GetExt() == LegacyProjectFileExtension )
|
||||
path.SetExt( ProjectFileExtension );
|
||||
if( path.GetExt() == FILEEXT::LegacyProjectFileExtension )
|
||||
path.SetExt( FILEEXT::ProjectFileExtension );
|
||||
|
||||
wxString fullPath = path.GetFullPath();
|
||||
|
||||
|
@ -1166,7 +1166,7 @@ bool SETTINGS_MANAGER::BackupProject( REPORTER& aReporter ) const
|
|||
wxFileName target;
|
||||
target.SetPath( GetProjectBackupsPath() );
|
||||
target.SetName( fileName );
|
||||
target.SetExt( ArchiveFileExtension );
|
||||
target.SetExt( FILEEXT::ArchiveFileExtension );
|
||||
|
||||
if( !target.DirExists() && !wxMkdir( target.GetPath() ) )
|
||||
{
|
||||
|
|
|
@ -366,7 +366,7 @@ void WX_HTML_REPORT_PANEL::onBtnSaveToFile( wxCommandEvent& event )
|
|||
fn = m_reportFileName;
|
||||
|
||||
wxFileDialog dlg( this, _( "Save Report File" ), fn.GetPath(), fn.GetFullName(),
|
||||
TextFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
FILEEXT::TextFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
|
|
@ -122,84 +122,84 @@ wxString AddFileExtListToFilter( const std::vector<std::string>& aExts )
|
|||
return files_filter;
|
||||
}
|
||||
|
||||
const std::string BackupFileSuffix( "-bak" );
|
||||
const std::string LockFilePrefix( "~" );
|
||||
const std::string LockFileExtension( "lck" );
|
||||
const std::string FILEEXT::BackupFileSuffix( "-bak" );
|
||||
const std::string FILEEXT::LockFilePrefix( "~" );
|
||||
const std::string FILEEXT::LockFileExtension( "lck" );
|
||||
|
||||
const std::string KiCadSymbolLibFileExtension( "kicad_sym" );
|
||||
const std::string SchematicSymbolFileExtension( "sym" );
|
||||
const std::string LegacySymbolLibFileExtension( "lib" );
|
||||
const std::string LegacySymbolDocumentFileExtension( "dcm" );
|
||||
const std::string FILEEXT::KiCadSymbolLibFileExtension( "kicad_sym" );
|
||||
const std::string FILEEXT::SchematicSymbolFileExtension( "sym" );
|
||||
const std::string FILEEXT::LegacySymbolLibFileExtension( "lib" );
|
||||
const std::string FILEEXT::LegacySymbolDocumentFileExtension( "dcm" );
|
||||
|
||||
const std::string VrmlFileExtension( "wrl" );
|
||||
const std::string FILEEXT::VrmlFileExtension( "wrl" );
|
||||
|
||||
const std::string ProjectFileExtension( "kicad_pro" );
|
||||
const std::string LegacyProjectFileExtension( "pro" );
|
||||
const std::string ProjectLocalSettingsFileExtension( "kicad_prl" );
|
||||
const std::string LegacySchematicFileExtension( "sch" );
|
||||
const std::string CadstarSchematicFileExtension( "csa" );
|
||||
const std::string CadstarPartsLibraryFileExtension( "lib" );
|
||||
const std::string KiCadSchematicFileExtension( "kicad_sch" );
|
||||
const std::string SpiceFileExtension( "cir" );
|
||||
const std::string CadstarNetlistFileExtension( "frp" );
|
||||
const std::string OrCadPcb2NetlistFileExtension( "net" );
|
||||
const std::string NetlistFileExtension( "net" );
|
||||
const std::string AllegroNetlistFileExtension( "txt" );
|
||||
const std::string FootprintAssignmentFileExtension( "cmp" );
|
||||
const std::string GerberFileExtension( "gbr" );
|
||||
const std::string GerberJobFileExtension( "gbrjob" );
|
||||
const std::string HtmlFileExtension( "html" );
|
||||
const std::string EquFileExtension( "equ" );
|
||||
const std::string HotkeyFileExtension( "hotkeys" );
|
||||
const std::string DatabaseLibraryFileExtension( "kicad_dbl" );
|
||||
const std::string HTTPLibraryFileExtension( "kicad_httplib" );
|
||||
const std::string FILEEXT::ProjectFileExtension( "kicad_pro" );
|
||||
const std::string FILEEXT::LegacyProjectFileExtension( "pro" );
|
||||
const std::string FILEEXT::ProjectLocalSettingsFileExtension( "kicad_prl" );
|
||||
const std::string FILEEXT::LegacySchematicFileExtension( "sch" );
|
||||
const std::string FILEEXT::CadstarSchematicFileExtension( "csa" );
|
||||
const std::string FILEEXT::CadstarPartsLibraryFileExtension( "lib" );
|
||||
const std::string FILEEXT::KiCadSchematicFileExtension( "kicad_sch" );
|
||||
const std::string FILEEXT::SpiceFileExtension( "cir" );
|
||||
const std::string FILEEXT::CadstarNetlistFileExtension( "frp" );
|
||||
const std::string FILEEXT::OrCadPcb2NetlistFileExtension( "net" );
|
||||
const std::string FILEEXT::NetlistFileExtension( "net" );
|
||||
const std::string FILEEXT::AllegroNetlistFileExtension( "txt" );
|
||||
const std::string FILEEXT::FootprintAssignmentFileExtension( "cmp" );
|
||||
const std::string FILEEXT::GerberFileExtension( "gbr" );
|
||||
const std::string FILEEXT::GerberJobFileExtension( "gbrjob" );
|
||||
const std::string FILEEXT::HtmlFileExtension( "html" );
|
||||
const std::string FILEEXT::EquFileExtension( "equ" );
|
||||
const std::string FILEEXT::HotkeyFileExtension( "hotkeys" );
|
||||
const std::string FILEEXT::DatabaseLibraryFileExtension( "kicad_dbl" );
|
||||
const std::string FILEEXT::HTTPLibraryFileExtension( "kicad_httplib" );
|
||||
|
||||
const std::string ArchiveFileExtension( "zip" );
|
||||
const std::string FILEEXT::ArchiveFileExtension( "zip" );
|
||||
|
||||
const std::string LegacyPcbFileExtension( "brd" );
|
||||
const std::string EaglePcbFileExtension( "brd" );
|
||||
const std::string CadstarPcbFileExtension( "cpa" );
|
||||
const std::string KiCadPcbFileExtension( "kicad_pcb" );
|
||||
const std::string DrawingSheetFileExtension( "kicad_wks" );
|
||||
const std::string DesignRulesFileExtension( "kicad_dru" );
|
||||
const std::string FILEEXT::LegacyPcbFileExtension( "brd" );
|
||||
const std::string FILEEXT::EaglePcbFileExtension( "brd" );
|
||||
const std::string FILEEXT::CadstarPcbFileExtension( "cpa" );
|
||||
const std::string FILEEXT::KiCadPcbFileExtension( "kicad_pcb" );
|
||||
const std::string FILEEXT::DrawingSheetFileExtension( "kicad_wks" );
|
||||
const std::string FILEEXT::DesignRulesFileExtension( "kicad_dru" );
|
||||
|
||||
const std::string PdfFileExtension( "pdf" );
|
||||
const std::string MacrosFileExtension( "mcr" );
|
||||
const std::string DrillFileExtension( "drl" );
|
||||
const std::string SVGFileExtension( "svg" );
|
||||
const std::string ReportFileExtension( "rpt" );
|
||||
const std::string FootprintPlaceFileExtension( "pos" );
|
||||
const std::string FILEEXT::PdfFileExtension( "pdf" );
|
||||
const std::string FILEEXT::MacrosFileExtension( "mcr" );
|
||||
const std::string FILEEXT::DrillFileExtension( "drl" );
|
||||
const std::string FILEEXT::SVGFileExtension( "svg" );
|
||||
const std::string FILEEXT::ReportFileExtension( "rpt" );
|
||||
const std::string FILEEXT::FootprintPlaceFileExtension( "pos" );
|
||||
|
||||
const std::string KiCadFootprintLibPathExtension( "pretty" ); // this is a directory
|
||||
const std::string LegacyFootprintLibPathExtension( "mod" ); // this is a file
|
||||
const std::string AltiumFootprintLibPathExtension( "PcbLib" ); // this is a file
|
||||
const std::string CadstarFootprintLibPathExtension( "cpa" ); // this is a file
|
||||
const std::string EagleFootprintLibPathExtension( "lbr" ); // this is a file
|
||||
const std::string GedaPcbFootprintLibFileExtension( "fp" ); // this is a file
|
||||
const std::string FILEEXT::KiCadFootprintLibPathExtension( "pretty" ); // this is a directory
|
||||
const std::string FILEEXT::LegacyFootprintLibPathExtension( "mod" ); // this is a file
|
||||
const std::string FILEEXT::AltiumFootprintLibPathExtension( "PcbLib" ); // this is a file
|
||||
const std::string FILEEXT::CadstarFootprintLibPathExtension( "cpa" ); // this is a file
|
||||
const std::string FILEEXT::EagleFootprintLibPathExtension( "lbr" ); // this is a file
|
||||
const std::string FILEEXT::GedaPcbFootprintLibFileExtension( "fp" ); // this is a file
|
||||
|
||||
const std::string KiCadFootprintFileExtension( "kicad_mod" );
|
||||
const std::string SpecctraDsnFileExtension( "dsn" );
|
||||
const std::string SpecctraSessionFileExtension( "ses" );
|
||||
const std::string IpcD356FileExtension( "d356" );
|
||||
const std::string Ipc2581FileExtension( "xml" );
|
||||
const std::string WorkbookFileExtension( "wbk" );
|
||||
const std::string FILEEXT::KiCadFootprintFileExtension( "kicad_mod" );
|
||||
const std::string FILEEXT::SpecctraDsnFileExtension( "dsn" );
|
||||
const std::string FILEEXT::SpecctraSessionFileExtension( "ses" );
|
||||
const std::string FILEEXT::IpcD356FileExtension( "d356" );
|
||||
const std::string FILEEXT::Ipc2581FileExtension( "xml" );
|
||||
const std::string FILEEXT::WorkbookFileExtension( "wbk" );
|
||||
|
||||
const std::string PngFileExtension( "png" );
|
||||
const std::string JpegFileExtension( "jpg" );
|
||||
const std::string TextFileExtension( "txt" );
|
||||
const std::string MarkdownFileExtension( "md" );
|
||||
const std::string CsvFileExtension( "csv" );
|
||||
const std::string XmlFileExtension( "xml" );
|
||||
const std::string JsonFileExtension( "json" );
|
||||
const std::string FILEEXT::PngFileExtension( "png" );
|
||||
const std::string FILEEXT::JpegFileExtension( "jpg" );
|
||||
const std::string FILEEXT::TextFileExtension( "txt" );
|
||||
const std::string FILEEXT::MarkdownFileExtension( "md" );
|
||||
const std::string FILEEXT::CsvFileExtension( "csv" );
|
||||
const std::string FILEEXT::XmlFileExtension( "xml" );
|
||||
const std::string FILEEXT::JsonFileExtension( "json" );
|
||||
|
||||
const std::string StepFileExtension( "step" );
|
||||
const std::string StepFileAbrvExtension( "stp" );
|
||||
const std::string GltfBinaryFileExtension( "glb" );
|
||||
const std::string FILEEXT::StepFileExtension( "step" );
|
||||
const std::string FILEEXT::StepFileAbrvExtension( "stp" );
|
||||
const std::string FILEEXT::GltfBinaryFileExtension( "glb" );
|
||||
|
||||
const wxString GerberFileExtensionsRegex( "(gbr|gko|pho|(g[tb][alops])|(gm?\\d\\d*)|(gp[tb]))" );
|
||||
const wxString FILEEXT::GerberFileExtensionsRegex( "(gbr|gko|pho|(g[tb][alops])|(gm?\\d\\d*)|(gp[tb]))" );
|
||||
|
||||
|
||||
bool IsGerberFileExtension( const wxString& ext )
|
||||
bool FILEEXT::IsGerberFileExtension( const wxString& ext )
|
||||
{
|
||||
static wxRegEx gerberRE( GerberFileExtensionsRegex, wxRE_ICASE );
|
||||
|
||||
|
@ -207,125 +207,125 @@ bool IsGerberFileExtension( const wxString& ext )
|
|||
}
|
||||
|
||||
|
||||
wxString AllFilesWildcard()
|
||||
wxString FILEEXT::AllFilesWildcard()
|
||||
{
|
||||
return _( "All files" ) + AddFileExtListToFilter( {} );
|
||||
}
|
||||
|
||||
|
||||
wxString KiCadSymbolLibFileWildcard()
|
||||
wxString FILEEXT::KiCadSymbolLibFileWildcard()
|
||||
{
|
||||
return _( "KiCad symbol library files" )
|
||||
+ AddFileExtListToFilter( { KiCadSymbolLibFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString ProjectFileWildcard()
|
||||
wxString FILEEXT::ProjectFileWildcard()
|
||||
{
|
||||
return _( "KiCad project files" ) + AddFileExtListToFilter( { ProjectFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString LegacyProjectFileWildcard()
|
||||
wxString FILEEXT::LegacyProjectFileWildcard()
|
||||
{
|
||||
return _( "KiCad legacy project files" )
|
||||
+ AddFileExtListToFilter( { LegacyProjectFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString AllProjectFilesWildcard()
|
||||
wxString FILEEXT::AllProjectFilesWildcard()
|
||||
{
|
||||
return _( "All KiCad project files" )
|
||||
+ AddFileExtListToFilter( { ProjectFileExtension, LegacyProjectFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString AllSchematicFilesWildcard()
|
||||
wxString FILEEXT::AllSchematicFilesWildcard()
|
||||
{
|
||||
return _( "All KiCad schematic files" )
|
||||
+ AddFileExtListToFilter( { KiCadSchematicFileExtension, LegacySchematicFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString LegacySchematicFileWildcard()
|
||||
wxString FILEEXT::LegacySchematicFileWildcard()
|
||||
{
|
||||
return _( "KiCad legacy schematic files" )
|
||||
+ AddFileExtListToFilter( { LegacySchematicFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString KiCadSchematicFileWildcard()
|
||||
wxString FILEEXT::KiCadSchematicFileWildcard()
|
||||
{
|
||||
return _( "KiCad s-expression schematic files" )
|
||||
+ AddFileExtListToFilter( { KiCadSchematicFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString CadstarArchiveFilesWildcard()
|
||||
wxString FILEEXT::CadstarArchiveFilesWildcard()
|
||||
{
|
||||
return _( "CADSTAR Archive files" ) + AddFileExtListToFilter( { "csa", "cpa" } );
|
||||
}
|
||||
|
||||
|
||||
wxString EagleFilesWildcard()
|
||||
wxString FILEEXT::EagleFilesWildcard()
|
||||
{
|
||||
return _( "Eagle XML files" ) + AddFileExtListToFilter( { "sch", "brd" } );
|
||||
}
|
||||
|
||||
|
||||
wxString OrCadPcb2NetlistFileWildcard()
|
||||
wxString FILEEXT::OrCadPcb2NetlistFileWildcard()
|
||||
{
|
||||
return _( "OrcadPCB2 netlist files" )
|
||||
+ AddFileExtListToFilter( { OrCadPcb2NetlistFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString NetlistFileWildcard()
|
||||
wxString FILEEXT::NetlistFileWildcard()
|
||||
{
|
||||
return _( "KiCad netlist files" ) + AddFileExtListToFilter( { "net" } );
|
||||
}
|
||||
|
||||
|
||||
wxString AllegroNetlistFileWildcard()
|
||||
wxString FILEEXT::AllegroNetlistFileWildcard()
|
||||
{
|
||||
return _( "Allegro netlist files" )
|
||||
+ AddFileExtListToFilter( { AllegroNetlistFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString EasyEdaArchiveWildcard()
|
||||
wxString FILEEXT::EasyEdaArchiveWildcard()
|
||||
{
|
||||
return _( "EasyEDA (JLCEDA) Std backup archive" ) + AddFileExtListToFilter( { "zip" } );
|
||||
}
|
||||
|
||||
|
||||
wxString EasyEdaProFileWildcard()
|
||||
wxString FILEEXT::EasyEdaProFileWildcard()
|
||||
{
|
||||
return _( "EasyEDA (JLCEDA) Pro files" ) + AddFileExtListToFilter( { "epro", "zip" } );
|
||||
}
|
||||
|
||||
|
||||
wxString PcbFileWildcard()
|
||||
wxString FILEEXT::PcbFileWildcard()
|
||||
{
|
||||
return _( "KiCad printed circuit board files" )
|
||||
+ AddFileExtListToFilter( { KiCadPcbFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString KiCadFootprintLibFileWildcard()
|
||||
wxString FILEEXT::KiCadFootprintLibFileWildcard()
|
||||
{
|
||||
return _( "KiCad footprint files" ) + AddFileExtListToFilter( { KiCadFootprintFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString KiCadFootprintLibPathWildcard()
|
||||
wxString FILEEXT::KiCadFootprintLibPathWildcard()
|
||||
{
|
||||
return _( "KiCad footprint library paths" )
|
||||
+ AddFileExtListToFilter( { KiCadFootprintLibPathExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString DrawingSheetFileWildcard()
|
||||
wxString FILEEXT::DrawingSheetFileWildcard()
|
||||
{
|
||||
return _( "Drawing sheet files" )
|
||||
+ AddFileExtListToFilter( { DrawingSheetFileExtension } );
|
||||
|
@ -333,7 +333,7 @@ wxString DrawingSheetFileWildcard()
|
|||
|
||||
|
||||
// Wildcard for cvpcb symbol to footprint link file
|
||||
wxString FootprintAssignmentFileWildcard()
|
||||
wxString FILEEXT::FootprintAssignmentFileWildcard()
|
||||
{
|
||||
return _( "KiCad symbol footprint link files" )
|
||||
+ AddFileExtListToFilter( { FootprintAssignmentFileExtension } );
|
||||
|
@ -341,180 +341,180 @@ wxString FootprintAssignmentFileWildcard()
|
|||
|
||||
|
||||
// Wildcard for reports and fabrication documents
|
||||
wxString DrillFileWildcard()
|
||||
wxString FILEEXT::DrillFileWildcard()
|
||||
{
|
||||
return _( "Drill files" )
|
||||
+ AddFileExtListToFilter( { DrillFileExtension, "nc", "xnc", "txt" } );
|
||||
}
|
||||
|
||||
|
||||
wxString SVGFileWildcard()
|
||||
wxString FILEEXT::SVGFileWildcard()
|
||||
{
|
||||
return _( "SVG files" ) + AddFileExtListToFilter( { SVGFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString HtmlFileWildcard()
|
||||
wxString FILEEXT::HtmlFileWildcard()
|
||||
{
|
||||
return _( "HTML files" ) + AddFileExtListToFilter( { "htm", "html" } );
|
||||
}
|
||||
|
||||
|
||||
wxString CsvFileWildcard()
|
||||
wxString FILEEXT::CsvFileWildcard()
|
||||
{
|
||||
return _( "CSV Files" ) + AddFileExtListToFilter( { CsvFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString PdfFileWildcard()
|
||||
wxString FILEEXT::PdfFileWildcard()
|
||||
{
|
||||
return _( "Portable document format files" ) + AddFileExtListToFilter( { "pdf" } );
|
||||
}
|
||||
|
||||
|
||||
wxString PSFileWildcard()
|
||||
wxString FILEEXT::PSFileWildcard()
|
||||
{
|
||||
return _( "PostScript files" ) + AddFileExtListToFilter( { "ps" } );
|
||||
}
|
||||
|
||||
|
||||
wxString JsonFileWildcard()
|
||||
wxString FILEEXT::JsonFileWildcard()
|
||||
{
|
||||
return _( "Json files" ) + AddFileExtListToFilter( { JsonFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString ReportFileWildcard()
|
||||
wxString FILEEXT::ReportFileWildcard()
|
||||
{
|
||||
return _( "Report files" ) + AddFileExtListToFilter( { ReportFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString FootprintPlaceFileWildcard()
|
||||
wxString FILEEXT::FootprintPlaceFileWildcard()
|
||||
{
|
||||
return _( "Component placement files" ) + AddFileExtListToFilter( { "pos" } );
|
||||
}
|
||||
|
||||
|
||||
wxString Shapes3DFileWildcard()
|
||||
wxString FILEEXT::Shapes3DFileWildcard()
|
||||
{
|
||||
return _( "VRML and X3D files" ) + AddFileExtListToFilter( { "wrl", "x3d" } );
|
||||
}
|
||||
|
||||
|
||||
wxString IDF3DFileWildcard()
|
||||
wxString FILEEXT::IDF3DFileWildcard()
|
||||
{
|
||||
return _( "IDFv3 footprint files" ) + AddFileExtListToFilter( { "idf" } );
|
||||
}
|
||||
|
||||
|
||||
wxString TextFileWildcard()
|
||||
wxString FILEEXT::TextFileWildcard()
|
||||
{
|
||||
return _( "Text files" ) + AddFileExtListToFilter( { "txt" } );
|
||||
}
|
||||
|
||||
|
||||
wxString ModLegacyExportFileWildcard()
|
||||
wxString FILEEXT::ModLegacyExportFileWildcard()
|
||||
{
|
||||
return _( "Legacy footprint export files" ) + AddFileExtListToFilter( { "emp" } );
|
||||
}
|
||||
|
||||
|
||||
wxString ErcFileWildcard()
|
||||
wxString FILEEXT::ErcFileWildcard()
|
||||
{
|
||||
return _( "Electrical rule check file" ) + AddFileExtListToFilter( { "erc" } );
|
||||
}
|
||||
|
||||
|
||||
wxString SpiceLibraryFileWildcard()
|
||||
wxString FILEEXT::SpiceLibraryFileWildcard()
|
||||
{
|
||||
return _( "Spice library file" ) + AddFileExtListToFilter( { "lib", "mod" } );
|
||||
}
|
||||
|
||||
|
||||
wxString SpiceNetlistFileWildcard()
|
||||
wxString FILEEXT::SpiceNetlistFileWildcard()
|
||||
{
|
||||
return _( "SPICE netlist file" ) + AddFileExtListToFilter( { "cir" } );
|
||||
}
|
||||
|
||||
|
||||
wxString CadstarNetlistFileWildcard()
|
||||
wxString FILEEXT::CadstarNetlistFileWildcard()
|
||||
{
|
||||
return _( "CadStar netlist file" ) + AddFileExtListToFilter( { "frp" } );
|
||||
}
|
||||
|
||||
|
||||
wxString EquFileWildcard()
|
||||
wxString FILEEXT::EquFileWildcard()
|
||||
{
|
||||
return _( "Symbol footprint association files" ) + AddFileExtListToFilter( { "equ" } );
|
||||
}
|
||||
|
||||
|
||||
wxString ZipFileWildcard()
|
||||
wxString FILEEXT::ZipFileWildcard()
|
||||
{
|
||||
return _( "Zip file" ) + AddFileExtListToFilter( { "zip" } );
|
||||
}
|
||||
|
||||
|
||||
wxString GencadFileWildcard()
|
||||
wxString FILEEXT::GencadFileWildcard()
|
||||
{
|
||||
return _( "GenCAD 1.4 board files" ) + AddFileExtListToFilter( { "cad" } );
|
||||
}
|
||||
|
||||
|
||||
wxString DxfFileWildcard()
|
||||
wxString FILEEXT::DxfFileWildcard()
|
||||
{
|
||||
return _( "DXF Files" ) + AddFileExtListToFilter( { "dxf" } );
|
||||
}
|
||||
|
||||
|
||||
wxString GerberJobFileWildcard()
|
||||
wxString FILEEXT::GerberJobFileWildcard()
|
||||
{
|
||||
return _( "Gerber job file" ) + AddFileExtListToFilter( { GerberJobFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString SpecctraDsnFileWildcard()
|
||||
wxString FILEEXT::SpecctraDsnFileWildcard()
|
||||
{
|
||||
return _( "Specctra DSN file" )
|
||||
+ AddFileExtListToFilter( { SpecctraDsnFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString SpecctraSessionFileWildcard()
|
||||
wxString FILEEXT::SpecctraSessionFileWildcard()
|
||||
{
|
||||
return _( "Specctra Session file" )
|
||||
+ AddFileExtListToFilter( { SpecctraSessionFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString IpcD356FileWildcard()
|
||||
wxString FILEEXT::IpcD356FileWildcard()
|
||||
{
|
||||
return _( "IPC-D-356 Test Files" )
|
||||
+ AddFileExtListToFilter( { IpcD356FileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString WorkbookFileWildcard()
|
||||
wxString FILEEXT::WorkbookFileWildcard()
|
||||
{
|
||||
return _( "Workbook file" )
|
||||
+ AddFileExtListToFilter( { WorkbookFileExtension } );
|
||||
}
|
||||
|
||||
|
||||
wxString PngFileWildcard()
|
||||
wxString FILEEXT::PngFileWildcard()
|
||||
{
|
||||
return _( "PNG file" ) + AddFileExtListToFilter( { "png" } );
|
||||
}
|
||||
|
||||
|
||||
wxString JpegFileWildcard()
|
||||
wxString FILEEXT::JpegFileWildcard()
|
||||
{
|
||||
return _( "Jpeg file" ) + AddFileExtListToFilter( { "jpg", "jpeg" } );
|
||||
}
|
||||
|
||||
|
||||
wxString HotkeyFileWildcard()
|
||||
wxString FILEEXT::HotkeyFileWildcard()
|
||||
{
|
||||
return _( "Hotkey file" ) + AddFileExtListToFilter( { HotkeyFileExtension } );
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ void DIALOG_CONFIG_EQUFILES::OnAddFiles( wxCommandEvent& event )
|
|||
wxString libpath = m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 1 ) );
|
||||
|
||||
wxFileDialog dlg( this, _( "Footprint Association File" ), libpath, wxEmptyString,
|
||||
EquFileWildcard(), wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
|
||||
FILEEXT::EquFileWildcard(), wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
|
|
@ -880,10 +880,10 @@ void DIALOG_ERC::deleteAllMarkers( bool aIncludeExclusions )
|
|||
|
||||
void DIALOG_ERC::OnSaveReport( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxFileName fn( wxS( "ERC." ) + ReportFileExtension );
|
||||
wxFileName fn( wxS( "ERC." ) + FILEEXT::ReportFileExtension );
|
||||
|
||||
wxFileDialog dlg( this, _( "Save Report File" ), Prj().GetProjectPath(), fn.GetFullName(),
|
||||
ReportFileWildcard() + wxS( "|" ) + JsonFileWildcard(),
|
||||
FILEEXT::ReportFileWildcard() + wxS( "|" ) + FILEEXT::JsonFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
|
@ -892,7 +892,7 @@ void DIALOG_ERC::OnSaveReport( wxCommandEvent& aEvent )
|
|||
fn = dlg.GetPath();
|
||||
|
||||
if( fn.GetExt().IsEmpty() )
|
||||
fn.SetExt( ReportFileExtension );
|
||||
fn.SetExt( FILEEXT::ReportFileExtension );
|
||||
|
||||
if( !fn.IsAbsolute() )
|
||||
{
|
||||
|
@ -903,7 +903,7 @@ void DIALOG_ERC::OnSaveReport( wxCommandEvent& aEvent )
|
|||
ERC_REPORT reportWriter( &m_parent->Schematic(), m_parent->GetUserUnits() );
|
||||
|
||||
bool success = false;
|
||||
if( fn.GetExt() == JsonFileExtension )
|
||||
if( fn.GetExt() == FILEEXT::JsonFileExtension )
|
||||
success = reportWriter.WriteJsonReport( fn.GetFullPath() );
|
||||
else
|
||||
success = reportWriter.WriteTextReport( fn.GetFullPath() );
|
||||
|
|
|
@ -523,7 +523,7 @@ bool DIALOG_EXPORT_NETLIST::TransferDataFromWindow()
|
|||
|
||||
if( runExternalSpiceCommand )
|
||||
{
|
||||
fn.SetExt( SpiceFileExtension );
|
||||
fn.SetExt( FILEEXT::SpiceFileExtension );
|
||||
fullpath = fn.GetFullPath();
|
||||
}
|
||||
else
|
||||
|
@ -647,32 +647,32 @@ bool DIALOG_EXPORT_NETLIST::FilenamePrms( NETLIST_TYPE_ID aType, wxString * aExt
|
|||
switch( aType )
|
||||
{
|
||||
case NET_TYPE_SPICE:
|
||||
fileExt = SpiceFileExtension;
|
||||
fileWildcard = SpiceNetlistFileWildcard();
|
||||
fileExt = FILEEXT::SpiceFileExtension;
|
||||
fileWildcard = FILEEXT::SpiceNetlistFileWildcard();
|
||||
break;
|
||||
|
||||
case NET_TYPE_CADSTAR:
|
||||
fileExt = CadstarNetlistFileExtension;
|
||||
fileWildcard = CadstarNetlistFileWildcard();
|
||||
fileExt = FILEEXT::CadstarNetlistFileExtension;
|
||||
fileWildcard = FILEEXT::CadstarNetlistFileWildcard();
|
||||
break;
|
||||
|
||||
case NET_TYPE_ORCADPCB2:
|
||||
fileExt = OrCadPcb2NetlistFileExtension;
|
||||
fileWildcard = OrCadPcb2NetlistFileWildcard();
|
||||
fileExt = FILEEXT::OrCadPcb2NetlistFileExtension;
|
||||
fileWildcard = FILEEXT::OrCadPcb2NetlistFileWildcard();
|
||||
break;
|
||||
|
||||
case NET_TYPE_PCBNEW:
|
||||
fileExt = NetlistFileExtension;
|
||||
fileWildcard = NetlistFileWildcard();
|
||||
fileExt = FILEEXT::NetlistFileExtension;
|
||||
fileWildcard = FILEEXT::NetlistFileWildcard();
|
||||
break;
|
||||
|
||||
case NET_TYPE_ALLEGRO:
|
||||
fileExt = AllegroNetlistFileExtension;
|
||||
fileWildcard = AllegroNetlistFileWildcard();
|
||||
fileExt = FILEEXT::AllegroNetlistFileExtension;
|
||||
fileWildcard = FILEEXT::AllegroNetlistFileWildcard();
|
||||
break;
|
||||
|
||||
default: // custom, NET_TYPE_CUSTOM1 and greater
|
||||
fileWildcard = AllFilesWildcard();
|
||||
fileWildcard = FILEEXT::AllFilesWildcard();
|
||||
ret = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -364,7 +364,7 @@ bool DIALOG_FIELD_PROPERTIES::TransferDataFromWindow()
|
|||
}
|
||||
else if( m_fieldId == SHEETFILENAME_V )
|
||||
{
|
||||
m_text = EnsureFileExtension( m_text, KiCadSchematicFileExtension );
|
||||
m_text = EnsureFileExtension( m_text, FILEEXT::KiCadSchematicFileExtension );
|
||||
}
|
||||
|
||||
m_position = VECTOR2I( m_posX.GetValue(), m_posY.GetValue() );
|
||||
|
|
|
@ -55,10 +55,11 @@ bool DIALOG_SCH_IMPORT_SETTINGS::TransferDataToWindow()
|
|||
void DIALOG_SCH_IMPORT_SETTINGS::OnBrowseClicked( wxCommandEvent& event )
|
||||
{
|
||||
wxFileName fn = m_frame->Schematic().Root().GetFileName();
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
fn.SetExt( FILEEXT::ProjectFileExtension );
|
||||
|
||||
wxFileDialog dlg( this, _( "Import Settings From" ), fn.GetPath(), fn.GetFullName(),
|
||||
ProjectFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
|
||||
FILEEXT::ProjectFileWildcard(),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
|
||||
|
||||
if( dlg.ShowModal() == wxID_OK )
|
||||
m_filePathCtrl->SetValue( dlg.GetPath() );
|
||||
|
|
|
@ -273,7 +273,7 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
// Ensure the filename extension is OK. (In normal use will be caught by grid validators,
|
||||
// but unedited data from existing files can be bad.)
|
||||
sheetFileName = EnsureFileExtension( sheetFileName, KiCadSchematicFileExtension );
|
||||
sheetFileName = EnsureFileExtension( sheetFileName, FILEEXT::KiCadSchematicFileExtension );
|
||||
|
||||
wxFileName fn( sheetFileName );
|
||||
wxString newRelativeFilename = fn.GetFullPath();
|
||||
|
@ -416,7 +416,8 @@ bool DIALOG_SHEET_PROPERTIES::TransferDataFromWindow()
|
|||
bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilename )
|
||||
{
|
||||
wxString msg;
|
||||
wxFileName sheetFileName( EnsureFileExtension( aNewFilename, KiCadSchematicFileExtension ) );
|
||||
wxFileName sheetFileName(
|
||||
EnsureFileExtension( aNewFilename, FILEEXT::KiCadSchematicFileExtension ) );
|
||||
|
||||
// Sheet file names are relative to the path of the current sheet. This allows for
|
||||
// nesting of schematic files in subfolders. Screen file names are always absolute.
|
||||
|
|
|
@ -1192,10 +1192,10 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnOutputFileBrowseClicked( wxCommandEvent& even
|
|||
|
||||
// Calculate the export filename
|
||||
wxFileName fn( Prj().AbsolutePath( m_parent->Schematic().GetFileName() ) );
|
||||
fn.SetExt( CsvFileExtension );
|
||||
fn.SetExt( FILEEXT::CsvFileExtension );
|
||||
|
||||
wxFileDialog saveDlg( this, _( "Bill of Materials Output File" ), path, fn.GetFullName(),
|
||||
CsvFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
FILEEXT::CsvFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( saveDlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
|
|
@ -453,7 +453,7 @@ bool DIALOG_SYMBOL_REMAP::backupProject( REPORTER& aReporter )
|
|||
// Back up the cache library.
|
||||
srcFileName.SetPath( Prj().GetProjectPath() );
|
||||
srcFileName.SetName( Prj().GetProjectName() + wxS( "-cache" ) );
|
||||
srcFileName.SetExt( LegacySymbolLibFileExtension );
|
||||
srcFileName.SetExt( FILEEXT::LegacySymbolLibFileExtension );
|
||||
|
||||
destFileName = srcFileName;
|
||||
destFileName.SetName( destFileName.GetName() + timeStamp );
|
||||
|
@ -488,7 +488,7 @@ bool DIALOG_SYMBOL_REMAP::backupProject( REPORTER& aReporter )
|
|||
}
|
||||
|
||||
// Back up the rescue symbol library document file if it exists.
|
||||
srcFileName.SetExt( LegacySymbolDocumentFileExtension );
|
||||
srcFileName.SetExt( FILEEXT::LegacySymbolDocumentFileExtension );
|
||||
destFileName.SetExt( srcFileName.GetExt() );
|
||||
|
||||
tmp.Printf( _( "Backing up file '%s' to '%s'." ),
|
||||
|
|
|
@ -410,7 +410,7 @@ bool PANEL_SYM_LIB_TABLE::allowAutomaticPluginTypeSelection( wxString& aLibraryP
|
|||
|
||||
// Currently, only the extension .lib is common to legacy libraries and Cadstar libraries
|
||||
// so return false in this case
|
||||
if( ext == LegacySymbolLibFileExtension )
|
||||
if( ext == FILEEXT::LegacySymbolLibFileExtension )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -489,10 +489,10 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
|
|||
|
||||
destFile.SetPath( destPath );
|
||||
|
||||
if( ext == LegacySchematicFileExtension ||
|
||||
ext == LegacySchematicFileExtension + BackupFileSuffix ||
|
||||
ext == KiCadSchematicFileExtension ||
|
||||
ext == KiCadSchematicFileExtension + BackupFileSuffix )
|
||||
if( ext == FILEEXT::LegacySchematicFileExtension
|
||||
|| ext == FILEEXT::LegacySchematicFileExtension + FILEEXT::BackupFileSuffix
|
||||
|| ext == FILEEXT::KiCadSchematicFileExtension
|
||||
|| ext == FILEEXT::KiCadSchematicFileExtension + FILEEXT::BackupFileSuffix )
|
||||
{
|
||||
if( destFile.GetName() == aProjectName )
|
||||
{
|
||||
|
@ -522,13 +522,14 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
|
|||
|
||||
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
||||
}
|
||||
else if( ext == SchematicSymbolFileExtension )
|
||||
else if( ext == FILEEXT::SchematicSymbolFileExtension )
|
||||
{
|
||||
// Symbols are not project-specific. Keep their source names.
|
||||
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
||||
}
|
||||
else if( ext == LegacySymbolLibFileExtension || ext == LegacySymbolDocumentFileExtension ||
|
||||
ext == KiCadSymbolLibFileExtension )
|
||||
else if( ext == FILEEXT::LegacySymbolLibFileExtension
|
||||
|| ext == FILEEXT::LegacySymbolDocumentFileExtension
|
||||
|| ext == FILEEXT::KiCadSymbolLibFileExtension )
|
||||
{
|
||||
if( destFile.GetName() == aProjectName + wxS( "-cache" ) )
|
||||
destFile.SetName( aNewProjectName + wxS( "-cache" ) );
|
||||
|
@ -538,7 +539,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
|
|||
|
||||
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
||||
}
|
||||
else if( ext == NetlistFileExtension )
|
||||
else if( ext == FILEEXT::NetlistFileExtension )
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ void SCH_EDIT_FRAME::saveProjectSettings()
|
|||
{
|
||||
wxFileName fn = Schematic().RootScreen()->GetFileName(); //ConfigFileName
|
||||
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
fn.SetExt( FILEEXT::ProjectFileExtension );
|
||||
|
||||
if( !fn.HasName() || !IsWritable( fn, false ) )
|
||||
return;
|
||||
|
|
|
@ -80,9 +80,9 @@ PROJECT* EESCHEMA_HELPERS::GetDefaultProject()
|
|||
|
||||
SCHEMATIC* EESCHEMA_HELPERS::LoadSchematic( wxString& aFileName )
|
||||
{
|
||||
if( aFileName.EndsWith( KiCadSchematicFileExtension ) )
|
||||
if( aFileName.EndsWith( FILEEXT::KiCadSchematicFileExtension ) )
|
||||
return LoadSchematic( aFileName, SCH_IO_MGR::SCH_KICAD );
|
||||
else if( aFileName.EndsWith( LegacySchematicFileExtension ) )
|
||||
else if( aFileName.EndsWith( FILEEXT::LegacySchematicFileExtension ) )
|
||||
return LoadSchematic( aFileName, SCH_IO_MGR::SCH_LEGACY );
|
||||
|
||||
// as fall back for any other kind use the legacy format
|
||||
|
@ -93,7 +93,7 @@ SCHEMATIC* EESCHEMA_HELPERS::LoadSchematic( wxString& aFileName )
|
|||
SCHEMATIC* EESCHEMA_HELPERS::LoadSchematic( wxString& aFileName, SCH_IO_MGR::SCH_FILE_T aFormat )
|
||||
{
|
||||
wxFileName pro = aFileName;
|
||||
pro.SetExt( ProjectFileExtension );
|
||||
pro.SetExt( FILEEXT::ProjectFileExtension );
|
||||
pro.MakeAbsolute();
|
||||
wxString projectPath = pro.GetFullPath();
|
||||
|
||||
|
|
|
@ -278,28 +278,28 @@ int EESCHEMA_JOBS_HANDLER::JobExportNetlist( JOB* aJob )
|
|||
switch( aNetJob->format )
|
||||
{
|
||||
case JOB_EXPORT_SCH_NETLIST::FORMAT::KICADSEXPR:
|
||||
fileExt = NetlistFileExtension;
|
||||
fileExt = FILEEXT::NetlistFileExtension;
|
||||
helper = std::make_unique<NETLIST_EXPORTER_KICAD>( sch );
|
||||
break;
|
||||
|
||||
case JOB_EXPORT_SCH_NETLIST::FORMAT::ORCADPCB2:
|
||||
fileExt = OrCadPcb2NetlistFileExtension;
|
||||
fileExt = FILEEXT::OrCadPcb2NetlistFileExtension;
|
||||
helper = std::make_unique<NETLIST_EXPORTER_ORCADPCB2>( sch );
|
||||
break;
|
||||
|
||||
case JOB_EXPORT_SCH_NETLIST::FORMAT::CADSTAR:
|
||||
fileExt = CadstarNetlistFileExtension;
|
||||
fileExt = FILEEXT::CadstarNetlistFileExtension;
|
||||
helper = std::make_unique<NETLIST_EXPORTER_CADSTAR>( sch );
|
||||
break;
|
||||
|
||||
case JOB_EXPORT_SCH_NETLIST::FORMAT::SPICE:
|
||||
fileExt = SpiceFileExtension;
|
||||
fileExt = FILEEXT::SpiceFileExtension;
|
||||
netlistOption = NETLIST_EXPORTER_SPICE::OPTION_SIM_COMMAND;
|
||||
helper = std::make_unique<NETLIST_EXPORTER_SPICE>( sch );
|
||||
break;
|
||||
|
||||
case JOB_EXPORT_SCH_NETLIST::FORMAT::SPICEMODEL:
|
||||
fileExt = SpiceFileExtension;
|
||||
fileExt = FILEEXT::SpiceFileExtension;
|
||||
helper = std::make_unique<NETLIST_EXPORTER_SPICE_MODEL>( sch );
|
||||
break;
|
||||
|
||||
|
@ -520,7 +520,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportBom( JOB* aJob )
|
|||
{
|
||||
wxFileName fn = sch->GetFileName();
|
||||
fn.SetName( fn.GetName() );
|
||||
fn.SetExt( CsvFileExtension );
|
||||
fn.SetExt( FILEEXT::CsvFileExtension );
|
||||
|
||||
aBomJob->m_outputFile = fn.GetFullName();
|
||||
}
|
||||
|
@ -638,7 +638,7 @@ int EESCHEMA_JOBS_HANDLER::JobExportPythonBom( JOB* aJob )
|
|||
{
|
||||
wxFileName fn = sch->GetFileName();
|
||||
fn.SetName( fn.GetName() + "-bom" );
|
||||
fn.SetExt( XmlFileExtension );
|
||||
fn.SetExt( FILEEXT::XmlFileExtension );
|
||||
|
||||
aNetJob->m_outputFile = fn.GetFullName();
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
|
|||
size_t forbidden_char;
|
||||
|
||||
fn.SetPath( aSvgJob->m_outputDirectory );
|
||||
fn.SetExt( SVGFileExtension );
|
||||
fn.SetExt( FILEEXT::SVGFileExtension );
|
||||
|
||||
filename = symbol->GetName().Lower();
|
||||
|
||||
|
@ -951,9 +951,9 @@ int EESCHEMA_JOBS_HANDLER::JobSchErc( JOB* aJob )
|
|||
fn.SetName( fn.GetName() );
|
||||
|
||||
if( ercJob->m_format == JOB_SCH_ERC::OUTPUT_FORMAT::JSON )
|
||||
fn.SetExt( JsonFileExtension );
|
||||
fn.SetExt( FILEEXT::JsonFileExtension );
|
||||
else
|
||||
fn.SetExt( ReportFileExtension );
|
||||
fn.SetExt( FILEEXT::ReportFileExtension );
|
||||
|
||||
ercJob->m_outputFile = fn.GetFullName();
|
||||
}
|
||||
|
|
|
@ -225,7 +225,7 @@ void FIELDS_GRID_TABLE<T>::initGrid( WX_GRID* aGrid )
|
|||
// Create a wild card using wxFileDialog syntax.
|
||||
wxString wildCard( _( "Schematic Files" ) );
|
||||
std::vector<std::string> exts;
|
||||
exts.push_back( KiCadSchematicFileExtension );
|
||||
exts.push_back( FILEEXT::KiCadSchematicFileExtension );
|
||||
wildCard += AddFileExtListToFilter( exts );
|
||||
|
||||
auto filepathEditor = new GRID_CELL_PATH_EDITOR( m_dialog, aGrid, &m_curdir, wildCard );
|
||||
|
@ -691,7 +691,7 @@ void FIELDS_GRID_TABLE<T>::SetValue( int aRow, int aCol, const wxString &aValue
|
|||
{
|
||||
if( m_parentType == SCH_SHEET_T && aRow == SHEETFILENAME )
|
||||
{
|
||||
value = EnsureFileExtension( value, KiCadSchematicFileExtension );
|
||||
value = EnsureFileExtension( value, FILEEXT::KiCadSchematicFileExtension );
|
||||
}
|
||||
else if( m_parentType == LIB_SYMBOL_T && aRow == VALUE_FIELD )
|
||||
{
|
||||
|
|
|
@ -122,7 +122,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
#endif
|
||||
|
||||
wxFileName pro = fullFileName;
|
||||
pro.SetExt( ProjectFileExtension );
|
||||
pro.SetExt( FILEEXT::ProjectFileExtension );
|
||||
|
||||
bool is_new = !wxFileName::IsFileReadable( fullFileName );
|
||||
|
||||
|
@ -164,7 +164,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
GetSettingsManager()->LoadProject( pro.GetFullPath() );
|
||||
|
||||
wxFileName legacyPro( pro );
|
||||
legacyPro.SetExt( LegacyProjectFileExtension );
|
||||
legacyPro.SetExt( FILEEXT::LegacyProjectFileExtension );
|
||||
|
||||
// Do not allow saving a project if one doesn't exist. This normally happens if we are
|
||||
// standalone and opening a schematic that has been moved from its project folder.
|
||||
|
@ -421,7 +421,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
wxFileName cacheFn = pro;
|
||||
|
||||
cacheFn.SetName( cacheFn.GetName() + "-cache" );
|
||||
cacheFn.SetExt( LegacySymbolLibFileExtension );
|
||||
cacheFn.SetExt( FILEEXT::LegacySymbolLibFileExtension );
|
||||
|
||||
msg.Printf( _( "The project symbol library cache file '%s' was not found." ),
|
||||
cacheFn.GetFullName() );
|
||||
|
@ -603,7 +603,7 @@ bool SCH_EDIT_FRAME::AppendSchematic()
|
|||
wxString path = wxPathOnly( Prj().GetProjectFullName() );
|
||||
|
||||
wxFileDialog dlg( this, _( "Insert Schematic" ), path, wxEmptyString,
|
||||
KiCadSchematicFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
FILEEXT::KiCadSchematicFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return false;
|
||||
|
@ -712,7 +712,7 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
|
|||
Schematic().Reset();
|
||||
|
||||
wxFileName projectFn( dlg.GetPath() );
|
||||
projectFn.SetExt( ProjectFileExtension );
|
||||
projectFn.SetExt( FILEEXT::ProjectFileExtension );
|
||||
GetSettingsManager()->LoadProject( projectFn.GetFullPath() );
|
||||
|
||||
Schematic().SetProject( &Prj() );
|
||||
|
@ -774,7 +774,7 @@ bool SCH_EDIT_FRAME::saveSchematicFile( SCH_SHEET* aSheet, const wxString& aSave
|
|||
|
||||
wxFileName projectFile( schematicFileName );
|
||||
|
||||
projectFile.SetExt( ProjectFileExtension );
|
||||
projectFile.SetExt( FILEEXT::ProjectFileExtension );
|
||||
|
||||
if( projectFile.FileExists() )
|
||||
{
|
||||
|
@ -908,12 +908,12 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
|
|||
}
|
||||
|
||||
if( savePath.HasExt() )
|
||||
savePath.SetExt( KiCadSchematicFileExtension );
|
||||
savePath.SetExt( FILEEXT::KiCadSchematicFileExtension );
|
||||
else
|
||||
savePath.SetName( wxEmptyString );
|
||||
|
||||
wxFileDialog dlg( this, _( "Schematic Files" ), savePath.GetPath(),
|
||||
savePath.GetFullName(), KiCadSchematicFileWildcard(),
|
||||
wxFileDialog dlg( this, _( "Schematic Files" ), savePath.GetPath(), savePath.GetFullName(),
|
||||
FILEEXT::KiCadSchematicFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
FILEDLG_HOOK_SAVE_PROJECT newProjectHook;
|
||||
|
@ -927,7 +927,7 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
|
|||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return false;
|
||||
|
||||
newFileName = EnsureFileExtension( dlg.GetPath(), KiCadSchematicFileExtension );
|
||||
newFileName = EnsureFileExtension( dlg.GetPath(), FILEEXT::KiCadSchematicFileExtension );
|
||||
|
||||
if( ( !newFileName.DirExists() && !newFileName.Mkdir() ) ||
|
||||
!newFileName.IsDirWritable() )
|
||||
|
@ -1063,10 +1063,10 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
|
|||
if( tmpFn.FileExists() && !tmpFn.IsFileWritable() )
|
||||
lockedFiles.Add( tmpFn.GetFullPath() );
|
||||
|
||||
if( tmpFn.GetExt() == KiCadSchematicFileExtension )
|
||||
if( tmpFn.GetExt() == FILEEXT::KiCadSchematicFileExtension )
|
||||
continue;
|
||||
|
||||
tmpFn.SetExt( KiCadSchematicFileExtension );
|
||||
tmpFn.SetExt( FILEEXT::KiCadSchematicFileExtension );
|
||||
|
||||
if( tmpFn.FileExists() )
|
||||
overwrittenFiles.Add( tmpFn.GetFullPath() );
|
||||
|
@ -1125,20 +1125,21 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
|
|||
// Convert legacy schematics file name extensions for the new format.
|
||||
wxFileName tmpFn = filenameMap[screen];
|
||||
|
||||
if( tmpFn.IsOk() && tmpFn.GetExt() != KiCadSchematicFileExtension )
|
||||
if( tmpFn.IsOk() && tmpFn.GetExt() != FILEEXT::KiCadSchematicFileExtension )
|
||||
{
|
||||
updateFileHistory = true;
|
||||
tmpFn.SetExt( KiCadSchematicFileExtension );
|
||||
tmpFn.SetExt( FILEEXT::KiCadSchematicFileExtension );
|
||||
|
||||
for( EDA_ITEM* item : screen->Items().OfType( SCH_SHEET_T ) )
|
||||
{
|
||||
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
|
||||
wxFileName sheetFileName = sheet->GetFileName();
|
||||
|
||||
if( !sheetFileName.IsOk() || sheetFileName.GetExt() == KiCadSchematicFileExtension )
|
||||
if( !sheetFileName.IsOk()
|
||||
|| sheetFileName.GetExt() == FILEEXT::KiCadSchematicFileExtension )
|
||||
continue;
|
||||
|
||||
sheetFileName.SetExt( KiCadSchematicFileExtension );
|
||||
sheetFileName.SetExt( FILEEXT::KiCadSchematicFileExtension );
|
||||
sheet->SetFileName( sheetFileName.GetFullPath() );
|
||||
UpdateItem( sheet );
|
||||
}
|
||||
|
@ -1207,7 +1208,7 @@ bool SCH_EDIT_FRAME::SaveProject( bool aSaveAs )
|
|||
|
||||
wxASSERT( filenameMap.count( Schematic().RootScreen() ) );
|
||||
wxFileName projectPath( filenameMap.at( Schematic().RootScreen() ) );
|
||||
projectPath.SetExt( ProjectFileExtension );
|
||||
projectPath.SetExt( FILEEXT::ProjectFileExtension );
|
||||
|
||||
if( Prj().IsNullProject() || ( aSaveAs && !saveCopy ) )
|
||||
{
|
||||
|
@ -1367,7 +1368,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType,
|
|||
|
||||
newfilename.SetPath( Prj().GetProjectPath() );
|
||||
newfilename.SetName( Prj().GetProjectName() );
|
||||
newfilename.SetExt( KiCadSchematicFileExtension );
|
||||
newfilename.SetExt( FILEEXT::KiCadSchematicFileExtension );
|
||||
|
||||
SetScreen( GetCurrentSheet().LastScreen() );
|
||||
|
||||
|
@ -1596,7 +1597,7 @@ void SCH_EDIT_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName )
|
|||
|
||||
wxFileName backupFn = recoveredFn;
|
||||
|
||||
backupFn.SetExt( backupFn.GetExt() + BackupFileSuffix );
|
||||
backupFn.SetExt( backupFn.GetExt() + FILEEXT::BackupFileSuffix );
|
||||
|
||||
wxLogTrace( traceAutoSave, wxS( "Recovering auto save file:\n"
|
||||
" Original file: '%s'\n"
|
||||
|
|
|
@ -115,7 +115,7 @@ static wxFileName GetRescueLibraryFileName( SCHEMATIC* aSchematic )
|
|||
{
|
||||
wxFileName fn = aSchematic->GetFileName();
|
||||
fn.SetName( fn.GetName() + wxT( "-rescue" ) );
|
||||
fn.SetExt( LegacySymbolLibFileExtension );
|
||||
fn.SetExt( FILEEXT::LegacySymbolLibFileExtension );
|
||||
return fn;
|
||||
}
|
||||
|
||||
|
@ -833,7 +833,7 @@ void SYMBOL_LIB_TABLE_RESCUER::OpenRescueLibrary()
|
|||
if( row )
|
||||
{
|
||||
if( SCH_IO_MGR::EnumFromStr( row->GetType() ) == SCH_IO_MGR::SCH_KICAD )
|
||||
fn.SetExt( KiCadSymbolLibFileExtension );
|
||||
fn.SetExt( FILEEXT::KiCadSymbolLibFileExtension );
|
||||
|
||||
std::vector<LIB_SYMBOL*> symbols;
|
||||
|
||||
|
@ -858,7 +858,7 @@ bool SYMBOL_LIB_TABLE_RESCUER::WriteRescueLibrary( wxWindow *aParent )
|
|||
wxFileName fn = GetRescueLibraryFileName( m_schematic );
|
||||
SYMBOL_LIB_TABLE_ROW* row = PROJECT_SCH::SchSymbolLibTable( m_prj )->FindRow( fn.GetName() );
|
||||
|
||||
fn.SetExt( KiCadSymbolLibFileExtension );
|
||||
fn.SetExt( FILEEXT::KiCadSymbolLibFileExtension );
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -367,7 +367,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
KIPLATFORM::APP::SetShutdownBlockReason( this, _( "New schematic file is unsaved" ) );
|
||||
|
||||
// Init for dropping files
|
||||
m_acceptedExts.emplace( KiCadSchematicFileExtension, &EE_ACTIONS::ddAppendFile );
|
||||
m_acceptedExts.emplace( FILEEXT::KiCadSchematicFileExtension, &EE_ACTIONS::ddAppendFile );
|
||||
DragAcceptFiles( true );
|
||||
|
||||
// Ensure the window is on top
|
||||
|
@ -1105,7 +1105,7 @@ void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
|
|||
if( !frame )
|
||||
{
|
||||
wxFileName fn = Prj().GetProjectFullName();
|
||||
fn.SetExt( PcbFileExtension );
|
||||
fn.SetExt( FILEEXT::PcbFileExtension );
|
||||
|
||||
frame = Kiway().Player( FRAME_PCB_EDITOR, true );
|
||||
|
||||
|
@ -1249,12 +1249,13 @@ void SCH_EDIT_FRAME::NewProject()
|
|||
wxString pro_dir = m_mruPath;
|
||||
|
||||
wxFileDialog dlg( this, _( "New Schematic" ), pro_dir, wxEmptyString,
|
||||
KiCadSchematicFileWildcard(), wxFD_SAVE );
|
||||
FILEEXT::KiCadSchematicFileWildcard(), wxFD_SAVE );
|
||||
|
||||
if( dlg.ShowModal() != wxID_CANCEL )
|
||||
{
|
||||
// Enforce the extension, wxFileDialog is inept.
|
||||
wxFileName create_me = EnsureFileExtension( dlg.GetPath(), KiCadSchematicFileExtension );
|
||||
wxFileName create_me =
|
||||
EnsureFileExtension( dlg.GetPath(), FILEEXT::KiCadSchematicFileExtension );
|
||||
|
||||
if( create_me.FileExists() )
|
||||
{
|
||||
|
@ -1276,9 +1277,9 @@ void SCH_EDIT_FRAME::NewProject()
|
|||
void SCH_EDIT_FRAME::LoadProject()
|
||||
{
|
||||
wxString pro_dir = m_mruPath;
|
||||
wxString wildcards = AllSchematicFilesWildcard()
|
||||
+ wxS( "|" ) + KiCadSchematicFileWildcard()
|
||||
+ wxS( "|" ) + LegacySchematicFileWildcard();
|
||||
wxString wildcards = FILEEXT::AllSchematicFilesWildcard()
|
||||
+ wxS( "|" ) + FILEEXT::KiCadSchematicFileWildcard()
|
||||
+ wxS( "|" ) + FILEEXT::LegacySchematicFileWildcard();
|
||||
|
||||
wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir, wxEmptyString,
|
||||
wildcards, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
@ -1297,9 +1298,9 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
|
|||
|
||||
if( kicad_board.IsOk() && !Schematic().GetFileName().IsEmpty() )
|
||||
{
|
||||
kicad_board.SetExt( PcbFileExtension );
|
||||
kicad_board.SetExt( FILEEXT::PcbFileExtension );
|
||||
wxFileName legacy_board( kicad_board );
|
||||
legacy_board.SetExt( LegacyPcbFileExtension );
|
||||
legacy_board.SetExt( FILEEXT::LegacyPcbFileExtension );
|
||||
wxFileName& boardfn = legacy_board;
|
||||
|
||||
if( !legacy_board.FileExists() || kicad_board.FileExists() )
|
||||
|
@ -1347,7 +1348,7 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
|
|||
void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
|
||||
{
|
||||
wxFileName fn = Prj().AbsolutePath( Schematic().GetFileName() );
|
||||
fn.SetExt( NetlistFileExtension );
|
||||
fn.SetExt( FILEEXT::NetlistFileExtension );
|
||||
|
||||
if( !ReadyToNetlist( _( "Assigning footprints requires a fully annotated schematic." ) ) )
|
||||
return;
|
||||
|
|
|
@ -304,7 +304,8 @@ wxString SCH_IO_ALTIUM::getLibName()
|
|||
|
||||
wxFileName SCH_IO_ALTIUM::getLibFileName()
|
||||
{
|
||||
wxFileName fn( m_schematic->Prj().GetProjectPath(), getLibName(), KiCadSymbolLibFileExtension );
|
||||
wxFileName fn( m_schematic->Prj().GetProjectPath(), getLibName(),
|
||||
FILEEXT::KiCadSymbolLibFileExtension );
|
||||
|
||||
return fn;
|
||||
}
|
||||
|
@ -317,7 +318,7 @@ SCH_SHEET* SCH_IO_ALTIUM::LoadSchematicFile( const wxString& aFileName, SCHEMATI
|
|||
wxCHECK( !aFileName.IsEmpty() && aSchematic, nullptr );
|
||||
|
||||
wxFileName fileName( aFileName );
|
||||
fileName.SetExt( KiCadSchematicFileExtension );
|
||||
fileName.SetExt( FILEEXT::KiCadSchematicFileExtension );
|
||||
m_schematic = aSchematic;
|
||||
|
||||
// Delete on exception, if I own m_rootSheet, according to aAppendToMe
|
||||
|
@ -491,7 +492,7 @@ void SCH_IO_ALTIUM::ParseAltiumSch( const wxString& aFileName )
|
|||
// Map the loaded Altium file to the project file.
|
||||
wxFileName projectFileName = loadAltiumFileName;
|
||||
projectFileName.SetPath( m_schematic->Prj().GetProjectPath() );
|
||||
projectFileName.SetExt( KiCadSchematicFileExtension );
|
||||
projectFileName.SetExt( FILEEXT::KiCadSchematicFileExtension );
|
||||
sheet->SetFileName( projectFileName.GetFullName() );
|
||||
screen->SetFileName( projectFileName.GetFullPath() );
|
||||
|
||||
|
@ -2505,9 +2506,10 @@ void SCH_IO_ALTIUM::ParseHarnessType( const std::map<wxString, wxString>& aPrope
|
|||
sheetNameField.SetTextColor( GetColorFromInt( elem.Color ) );
|
||||
|
||||
SCH_FIELD& sheetFileName = sheetIt->second->GetFields()[SHEETFILENAME];
|
||||
sheetFileName.SetText( elem.Text + wxT( "." ) + KiCadSchematicFileExtension );
|
||||
sheetFileName.SetText( elem.Text + wxT( "." ) + FILEEXT::KiCadSchematicFileExtension );
|
||||
|
||||
wxFileName fn( m_schematic->Prj().GetProjectPath(), elem.Text, KiCadSchematicFileExtension );
|
||||
wxFileName fn( m_schematic->Prj().GetProjectPath(), elem.Text,
|
||||
FILEEXT::KiCadSchematicFileExtension );
|
||||
wxString fullPath = fn.GetFullPath();
|
||||
|
||||
fullPath.Replace( wxT( "\\" ), wxT( "/" ) );
|
||||
|
|
|
@ -569,7 +569,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheets()
|
|||
getSheetNumber( rootSheetID ) )
|
||||
.ToStdString();
|
||||
ReplaceIllegalFileNameChars( &filename );
|
||||
filename += wxT( "." ) + KiCadSchematicFileExtension;
|
||||
filename += wxT( "." ) + FILEEXT::KiCadSchematicFileExtension;
|
||||
|
||||
wxFileName fn( m_schematic->Prj().GetProjectPath() + filename );
|
||||
m_rootSheet->GetScreen()->SetFileName( fn.GetFullPath() );
|
||||
|
@ -2493,7 +2493,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets( LAYER_ID
|
|||
std::string filename = wxString::Format( "%s_%02d", loadedFilename, sheetNum ).ToStdString();
|
||||
|
||||
ReplaceIllegalFileNameChars( &filename );
|
||||
filename += wxT( "." ) + KiCadSchematicFileExtension;
|
||||
filename += wxT( "." ) + FILEEXT::KiCadSchematicFileExtension;
|
||||
|
||||
filenameField.SetText( filename );
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ SCH_SHEET* SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile( const wxString& aFi
|
|||
libName = LIB_ID::FixIllegalChars( libName, true ).wx_str();
|
||||
|
||||
wxFileName libFileName( aSchematic->Prj().GetProjectPath(), libName,
|
||||
KiCadSymbolLibFileExtension );
|
||||
FILEEXT::KiCadSymbolLibFileExtension );
|
||||
|
||||
SCH_IO::SCH_IO_RELEASER sch_plugin;
|
||||
sch_plugin.set( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD ) );
|
||||
|
|
|
@ -53,13 +53,13 @@ public:
|
|||
const IO_BASE::IO_FILE_DESC GetSchematicFileDesc() const override
|
||||
{
|
||||
return IO_BASE::IO_FILE_DESC( _HKI( "CADSTAR Schematic Archive files" ),
|
||||
{ CadstarSchematicFileExtension } );
|
||||
{ FILEEXT::CadstarSchematicFileExtension } );
|
||||
}
|
||||
|
||||
const IO_BASE::IO_FILE_DESC GetLibraryDesc() const override
|
||||
{
|
||||
return IO_BASE::IO_FILE_DESC( _HKI( "CADSTAR Parts Library files" ),
|
||||
{ CadstarPartsLibraryFileExtension } );
|
||||
{ FILEEXT::CadstarPartsLibraryFileExtension } );
|
||||
}
|
||||
|
||||
bool CanReadLibrary( const wxString& aFileName ) const override;
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
const IO_BASE::IO_FILE_DESC GetLibraryDesc() const override
|
||||
{
|
||||
return IO_BASE::IO_FILE_DESC( _HKI( "KiCad database library files" ),
|
||||
{ DatabaseLibraryFileExtension } );
|
||||
{ FILEEXT::DatabaseLibraryFileExtension } );
|
||||
}
|
||||
|
||||
int GetModifyHash() const override { return 0; }
|
||||
|
|
|
@ -176,7 +176,8 @@ wxFileName SCH_IO_EAGLE::getLibFileName()
|
|||
|
||||
wxCHECK( m_schematic, fn );
|
||||
|
||||
fn.Assign( m_schematic->Prj().GetProjectPath(), getLibName(), KiCadSymbolLibFileExtension );
|
||||
fn.Assign( m_schematic->Prj().GetProjectPath(), getLibName(),
|
||||
FILEEXT::KiCadSymbolLibFileExtension );
|
||||
|
||||
return fn;
|
||||
}
|
||||
|
@ -424,7 +425,7 @@ SCH_SHEET* SCH_IO_EAGLE::LoadSchematicFile( const wxString& aFileName, SCHEMATIC
|
|||
unique_ptr<SCH_SHEET> deleter( aAppendToMe ? nullptr : m_rootSheet );
|
||||
|
||||
wxFileName newFilename( m_filename );
|
||||
newFilename.SetExt( KiCadSchematicFileExtension );
|
||||
newFilename.SetExt( FILEEXT::KiCadSchematicFileExtension );
|
||||
|
||||
if( aAppendToMe )
|
||||
{
|
||||
|
@ -967,7 +968,7 @@ void SCH_IO_EAGLE::loadSheet( wxXmlNode* aSheetNode, int aSheetIndex )
|
|||
|
||||
wxFileName fn( m_filename );
|
||||
fn.SetName( filename );
|
||||
fn.SetExt( KiCadSchematicFileExtension );
|
||||
fn.SetExt( FILEEXT::KiCadSchematicFileExtension );
|
||||
|
||||
filenameField.SetText( fn.GetFullName() );
|
||||
|
||||
|
|
|
@ -417,7 +417,7 @@ SCH_SHEET* SCH_IO_EASYEDAPRO::LoadSchematicFile( const wxString& aFileName,
|
|||
wxFileName fname( aFileName );
|
||||
wxString libName = EASYEDAPRO::ShortenLibName( fname.GetName() );
|
||||
|
||||
wxFileName libFileName( fname.GetPath(), libName, KiCadSymbolLibFileExtension );
|
||||
wxFileName libFileName( fname.GetPath(), libName, FILEEXT::KiCadSymbolLibFileExtension );
|
||||
|
||||
if( fname.GetExt() != wxS( "epro" ) && fname.GetExt() != wxS( "zip" ) )
|
||||
return rootSheet;
|
||||
|
@ -455,7 +455,7 @@ SCH_SHEET* SCH_IO_EASYEDAPRO::LoadSchematicFile( const wxString& aFileName,
|
|||
|
||||
wxFileName rootFname( aFileName );
|
||||
rootFname.SetFullName( rootBaseName + wxS( "." )
|
||||
+ wxString::FromUTF8( KiCadSchematicFileExtension ) );
|
||||
+ wxString::FromUTF8( FILEEXT::KiCadSchematicFileExtension ) );
|
||||
|
||||
rootSheet->SetName( prjSchematics[schematicToLoad].name );
|
||||
rootSheet->SetFileName( rootFname.GetFullPath() );
|
||||
|
@ -505,7 +505,7 @@ SCH_SHEET* SCH_IO_EASYEDAPRO::LoadSchematicFile( const wxString& aFileName,
|
|||
|
||||
wxFileName sheetFname( aFileName );
|
||||
sheetFname.SetFullName( sheetBaseName + wxS( "." )
|
||||
+ wxString::FromUTF8( KiCadSchematicFileExtension ) );
|
||||
+ wxString::FromUTF8( FILEEXT::KiCadSchematicFileExtension ) );
|
||||
|
||||
std::unique_ptr<SCH_SHEET> subSheet = std::make_unique<SCH_SHEET>( aSchematic );
|
||||
subSheet->SetFileName( sheetFname.GetFullPath() );
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
const IO_BASE::IO_FILE_DESC GetLibraryDesc() const override
|
||||
{
|
||||
return IO_BASE::IO_FILE_DESC( _HKI( "KiCad HTTP library files" ),
|
||||
{ HTTPLibraryFileExtension } );
|
||||
{ FILEEXT::HTTPLibraryFileExtension } );
|
||||
}
|
||||
|
||||
int GetModifyHash() const override { return 0; }
|
||||
|
|
|
@ -73,13 +73,13 @@ public:
|
|||
const IO_BASE::IO_FILE_DESC GetSchematicFileDesc() const override
|
||||
{
|
||||
return IO_BASE::IO_FILE_DESC( _HKI( "KiCad legacy schematic files" ),
|
||||
{ LegacySchematicFileExtension } );
|
||||
{ FILEEXT::LegacySchematicFileExtension } );
|
||||
}
|
||||
|
||||
const IO_BASE::IO_FILE_DESC GetLibraryDesc() const override
|
||||
{
|
||||
return IO_BASE::IO_FILE_DESC( _HKI( "KiCad legacy symbol library files" ),
|
||||
{ LegacySymbolLibFileExtension } );
|
||||
{ FILEEXT::LegacySymbolLibFileExtension } );
|
||||
}
|
||||
|
||||
bool CanReadSchematicFile( const wxString& aFileName ) const override;
|
||||
|
|
|
@ -171,7 +171,7 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::loadDocs()
|
|||
wxFileName fn = m_libFileName;
|
||||
LIB_SYMBOL* symbol = nullptr;;
|
||||
|
||||
fn.SetExt( LegacySymbolDocumentFileExtension );
|
||||
fn.SetExt( FILEEXT::LegacySymbolDocumentFileExtension );
|
||||
|
||||
// Not all libraries will have a document file.
|
||||
if( !fn.FileExists() )
|
||||
|
@ -1856,7 +1856,7 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::saveDocFile()
|
|||
|
||||
wxFileName fileName = m_libFileName;
|
||||
|
||||
fileName.SetExt( LegacySymbolDocumentFileExtension );
|
||||
fileName.SetExt( FILEEXT::LegacySymbolDocumentFileExtension );
|
||||
FILE_OUTPUTFORMATTER formatter( fileName.GetFullPath() );
|
||||
|
||||
formatter.Print( 0, "%s\n", DOCFILE_IDENT );
|
||||
|
|
|
@ -72,13 +72,13 @@ public:
|
|||
const IO_BASE::IO_FILE_DESC GetSchematicFileDesc() const override
|
||||
{
|
||||
return IO_BASE::IO_FILE_DESC( _HKI( "KiCad s-expression schematic files" ),
|
||||
{ KiCadSchematicFileExtension } );
|
||||
{ FILEEXT::KiCadSchematicFileExtension } );
|
||||
}
|
||||
|
||||
const IO_BASE::IO_FILE_DESC GetLibraryDesc() const override
|
||||
{
|
||||
return IO_BASE::IO_FILE_DESC( _HKI( "KiCad symbol library files" ),
|
||||
{ KiCadSymbolLibFileExtension } );
|
||||
{ FILEEXT::KiCadSymbolLibFileExtension } );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2097,7 +2097,7 @@ bool SIMULATOR_FRAME_UI::SaveWorkbook( const wxString& aPath )
|
|||
updateMeasurementsFromGrid();
|
||||
|
||||
wxFileName filename = aPath;
|
||||
filename.SetExt( WorkbookFileExtension );
|
||||
filename.SetExt( FILEEXT::WorkbookFileExtension );
|
||||
|
||||
wxFile file;
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
|
||||
m_toolManager->RunAction( ACTIONS::zoomFitScreen );
|
||||
|
||||
m_acceptedExts.emplace( KiCadSymbolLibFileExtension, &ACTIONS::ddAddLibrary );
|
||||
m_acceptedExts.emplace( FILEEXT::KiCadSymbolLibFileExtension, &ACTIONS::ddAddLibrary );
|
||||
DragAcceptFiles( true );
|
||||
|
||||
KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Library changes are unsaved" ) );
|
||||
|
@ -904,8 +904,8 @@ wxString SYMBOL_EDIT_FRAME::AddLibraryFile( bool aCreateNew )
|
|||
|
||||
wxFileName fn = m_libMgr->GetUniqueLibraryName();
|
||||
|
||||
if( !LibraryFileBrowser( !aCreateNew, fn, KiCadSymbolLibFileWildcard(),
|
||||
KiCadSymbolLibFileExtension, false,
|
||||
if( !LibraryFileBrowser( !aCreateNew, fn, FILEEXT::KiCadSymbolLibFileWildcard(),
|
||||
FILEEXT::KiCadSymbolLibFileExtension, false,
|
||||
( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() ),
|
||||
PATHS::GetDefaultUserSymbolsPath() ) )
|
||||
{
|
||||
|
|
|
@ -1077,9 +1077,9 @@ bool SYMBOL_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile )
|
|||
default_path = search->LastVisitedPath();
|
||||
|
||||
fn.SetName( aLibrary );
|
||||
fn.SetExt( KiCadSymbolLibFileExtension );
|
||||
fn.SetExt( FILEEXT::KiCadSymbolLibFileExtension );
|
||||
|
||||
wxString wildcards = KiCadSymbolLibFileWildcard();
|
||||
wxString wildcards = FILEEXT::KiCadSymbolLibFileWildcard();
|
||||
|
||||
wxFileDialog dlg( this, wxString::Format( _( "Save Library '%s' As..." ), aLibrary ),
|
||||
default_path, fn.GetFullName(), wildcards,
|
||||
|
@ -1096,7 +1096,7 @@ bool SYMBOL_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile )
|
|||
prj.SetRString( PROJECT::SCH_LIB_PATH, fn.GetPath() );
|
||||
|
||||
if( fn.GetExt().IsEmpty() )
|
||||
fn.SetExt( KiCadSymbolLibFileExtension );
|
||||
fn.SetExt( FILEEXT::KiCadSymbolLibFileExtension );
|
||||
|
||||
type = saveAsHook.GetOption();
|
||||
}
|
||||
|
|
|
@ -156,10 +156,10 @@ void SYMBOL_EDIT_FRAME::ExportSymbol()
|
|||
wxFileName fn;
|
||||
|
||||
fn.SetName( symbol->GetName().Lower() );
|
||||
fn.SetExt( KiCadSymbolLibFileExtension );
|
||||
fn.SetExt( FILEEXT::KiCadSymbolLibFileExtension );
|
||||
|
||||
wxFileDialog dlg( this, _( "Export Symbol" ), m_mruPath, fn.GetFullName(),
|
||||
KiCadSymbolLibFileWildcard(), wxFD_SAVE );
|
||||
FILEEXT::KiCadSymbolLibFileWildcard(), wxFD_SAVE );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
|
|
@ -488,7 +488,7 @@ const wxString SYMBOL_LIBS::CacheName( const wxString& aFullProjectFilename )
|
|||
wxFileName name = aFullProjectFilename;
|
||||
|
||||
name.SetName( name.GetName() + "-cache" );
|
||||
name.SetExt( LegacySymbolLibFileExtension );
|
||||
name.SetExt( FILEEXT::LegacySymbolLibFileExtension );
|
||||
|
||||
if( name.FileExists() )
|
||||
return name.GetFullPath();
|
||||
|
@ -536,7 +536,7 @@ void SYMBOL_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
|
|||
// lib_names[] does not store the file extension. Set it.
|
||||
// Remember lib_names[i] can contain a '.' in name, so using a wxFileName
|
||||
// before adding the extension can create incorrect full filename
|
||||
wxString fullname = lib_names[i] + "." + LegacySymbolLibFileExtension;
|
||||
wxString fullname = lib_names[i] + "." + FILEEXT::LegacySymbolLibFileExtension;
|
||||
// Now the full name is set, we can use a wxFileName.
|
||||
wxFileName fn( fullname );
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ int SCH_EDITOR_CONTROL::ImportFPAssignments( const TOOL_EVENT& aEvent )
|
|||
|
||||
wxFileDialog dlg( m_frame, _( "Load Symbol Footprint Link File" ),
|
||||
path, wxEmptyString,
|
||||
FootprintAssignmentFileWildcard(),
|
||||
FILEEXT::FootprintAssignmentFileWildcard(),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
|
|
|
@ -109,7 +109,7 @@ bool BACK_ANNOTATE::FetchNetlistFromPCB( std::string& aNetlist )
|
|||
if( !frame )
|
||||
{
|
||||
wxFileName fn( m_frame->Prj().GetProjectFullName() );
|
||||
fn.SetExt( PcbFileExtension );
|
||||
fn.SetExt( FILEEXT::PcbFileExtension );
|
||||
|
||||
frame = m_frame->Kiway().Player( FRAME_PCB_EDITOR, true );
|
||||
frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
|
||||
|
|
|
@ -2088,7 +2088,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
sheet->SetBorderColor( cfg->m_Drawing.default_sheet_border_color );
|
||||
sheet->SetBackgroundColor( cfg->m_Drawing.default_sheet_background_color );
|
||||
sheet->GetFields()[ SHEETNAME ].SetText( "Untitled Sheet" );
|
||||
sheet->GetFields()[ SHEETFILENAME ].SetText( "untitled." + KiCadSchematicFileExtension );
|
||||
sheet->GetFields()[ SHEETFILENAME ].SetText( "untitled." + FILEEXT::KiCadSchematicFileExtension );
|
||||
sizeSheet( sheet, cursorPos );
|
||||
|
||||
m_view->ClearPreview();
|
||||
|
|
|
@ -112,14 +112,15 @@ int SCH_EDITOR_CONTROL::SaveCurrSheetCopyAs( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
SCH_SHEET* curr_sheet = m_frame->GetCurrentSheet().Last();
|
||||
wxFileName curr_fn = curr_sheet->GetFileName();
|
||||
wxFileDialog dlg( m_frame, _( "Schematic Files" ), curr_fn.GetPath(),
|
||||
curr_fn.GetFullName(), KiCadSchematicFileWildcard(),
|
||||
wxFileDialog dlg( m_frame, _( "Schematic Files" ), curr_fn.GetPath(), curr_fn.GetFullName(),
|
||||
FILEEXT::KiCadSchematicFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return false;
|
||||
|
||||
wxString newFilename = EnsureFileExtension( dlg.GetPath(), KiCadSchematicFileExtension );
|
||||
wxString newFilename =
|
||||
EnsureFileExtension( dlg.GetPath(), FILEEXT::KiCadSchematicFileExtension );
|
||||
|
||||
m_frame->saveSchematicFile( curr_sheet, newFilename );
|
||||
return 0;
|
||||
|
@ -379,8 +380,8 @@ int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
|
|||
if( !libTable ) // Cancelled by user
|
||||
return 0;
|
||||
|
||||
if( !m_frame->LibraryFileBrowser( false, fn, KiCadSymbolLibFileWildcard(),
|
||||
KiCadSymbolLibFileExtension, false,
|
||||
if( !m_frame->LibraryFileBrowser( false, fn, FILEEXT::KiCadSymbolLibFileWildcard(),
|
||||
FILEEXT::KiCadSymbolLibFileExtension, false,
|
||||
( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() ),
|
||||
PATHS::GetDefaultUserSymbolsPath() ) )
|
||||
{
|
||||
|
|
|
@ -92,7 +92,7 @@ int SIMULATOR_CONTROL::NewAnalysisTab( const TOOL_EVENT& aEvent )
|
|||
int SIMULATOR_CONTROL::OpenWorkbook( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
wxFileDialog openDlg( m_simulatorFrame, _( "Open Simulation Workbook" ), getDefaultPath(), "",
|
||||
WorkbookFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
FILEEXT::WorkbookFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( openDlg.ShowModal() == wxID_CANCEL )
|
||||
return -1;
|
||||
|
@ -111,12 +111,12 @@ wxString SIMULATOR_CONTROL::getDefaultFilename()
|
|||
if( m_simulatorFrame->Prj().GetProjectName().IsEmpty() )
|
||||
{
|
||||
filename.SetName( _( "noname" ) );
|
||||
filename.SetExt( WorkbookFileExtension );
|
||||
filename.SetExt( FILEEXT::WorkbookFileExtension );
|
||||
}
|
||||
else
|
||||
{
|
||||
filename.SetName( m_simulatorFrame->Prj().GetProjectName() );
|
||||
filename.SetExt( WorkbookFileExtension );
|
||||
filename.SetExt( FILEEXT::WorkbookFileExtension );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,8 @@ int SIMULATOR_CONTROL::SaveWorkbook( const TOOL_EVENT& aEvent )
|
|||
if( filename.IsEmpty() )
|
||||
{
|
||||
wxFileDialog saveAsDlg( m_simulatorFrame, _( "Save Simulation Workbook As" ),
|
||||
getDefaultPath(), getDefaultFilename(), WorkbookFileWildcard(),
|
||||
getDefaultPath(), getDefaultFilename(),
|
||||
FILEEXT::WorkbookFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( saveAsDlg.ShowModal() == wxID_CANCEL )
|
||||
|
@ -163,7 +164,7 @@ int SIMULATOR_CONTROL::ExportPlotAsPNG( const TOOL_EVENT& aEvent )
|
|||
if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( getCurrentSimTab() ) )
|
||||
{
|
||||
wxFileDialog saveDlg( m_simulatorFrame, _( "Save Plot as Image" ), "", "",
|
||||
PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
FILEEXT::PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( saveDlg.ShowModal() == wxID_CANCEL )
|
||||
return -1;
|
||||
|
@ -187,7 +188,8 @@ int SIMULATOR_CONTROL::ExportPlotAsCSV( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
const wxChar SEPARATOR = ';';
|
||||
|
||||
wxFileDialog saveDlg( m_simulatorFrame, _( "Save Plot Data" ), "", "", CsvFileWildcard(),
|
||||
wxFileDialog saveDlg( m_simulatorFrame, _( "Save Plot Data" ), "", "",
|
||||
FILEEXT::CsvFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( saveDlg.ShowModal() == wxID_CANCEL )
|
||||
|
|
|
@ -576,7 +576,7 @@ int SYMBOL_EDITOR_CONTROL::ExportView( const TOOL_EVENT& aEvent )
|
|||
wxString projectPath = wxPathOnly( m_frame->Prj().GetProjectFullName() );
|
||||
|
||||
wxFileDialog dlg( editFrame, _( "Export View as PNG" ), projectPath, fn.GetFullName(),
|
||||
PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
FILEEXT::PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() == wxID_OK && !dlg.GetPath().IsEmpty() )
|
||||
{
|
||||
|
@ -609,12 +609,13 @@ int SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
wxFileName fn( symbol->GetName() );
|
||||
fn.SetExt( SVGFileExtension );
|
||||
fn.SetExt( FILEEXT::SVGFileExtension );
|
||||
|
||||
wxString pro_dir = wxPathOnly( m_frame->Prj().GetProjectFullName() );
|
||||
|
||||
wxString fullFileName = wxFileSelector( _( "SVG File Name" ), pro_dir, fn.GetFullName(),
|
||||
SVGFileExtension, SVGFileWildcard(), wxFD_SAVE,
|
||||
FILEEXT::SVGFileExtension, FILEEXT::SVGFileWildcard(),
|
||||
wxFD_SAVE,
|
||||
m_frame );
|
||||
|
||||
if( !fullFileName.IsEmpty() )
|
||||
|
|
|
@ -179,7 +179,7 @@ bool GERBVIEW_FRAME::LoadFileOrShowDialog( const wxString& aFileName,
|
|||
bool GERBVIEW_FRAME::LoadAutodetectedFiles( const wxString& aFileName )
|
||||
{
|
||||
// 2 = autodetect files
|
||||
return LoadFileOrShowDialog( aFileName, AllFilesWildcard(), _( "Open Autodetected File(s)" ),
|
||||
return LoadFileOrShowDialog( aFileName, FILEEXT::AllFilesWildcard(), _( "Open Autodetected File(s)" ),
|
||||
2 );
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFileName )
|
|||
filetypes += _( "Bottom Pad Master" ) + AddFileExtListToFilter( { "gpb" } ) + wxT( "|" );
|
||||
|
||||
// All filetypes
|
||||
filetypes += AllFilesWildcard();
|
||||
filetypes += FILEEXT::AllFilesWildcard();
|
||||
|
||||
// 0 = gerber files
|
||||
return LoadFileOrShowDialog( aFileName, filetypes, _( "Open Gerber File(s)" ), 0 );
|
||||
|
@ -228,9 +228,9 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFileName )
|
|||
|
||||
bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFileName )
|
||||
{
|
||||
wxString filetypes = DrillFileWildcard();
|
||||
wxString filetypes = FILEEXT::DrillFileWildcard();
|
||||
filetypes << wxT( "|" );
|
||||
filetypes += AllFilesWildcard();
|
||||
filetypes += FILEEXT::AllFilesWildcard();
|
||||
|
||||
// 1 = drill files
|
||||
return LoadFileOrShowDialog( aFileName, filetypes, _( "Open NC (Excellon) Drill File(s)" ), 1 );
|
||||
|
@ -278,7 +278,7 @@ bool GERBVIEW_FRAME::LoadListOfGerberAndDrillFiles( const wxString& aPath,
|
|||
continue;
|
||||
}
|
||||
|
||||
if( filename.GetExt() == GerberJobFileExtension.c_str() )
|
||||
if( filename.GetExt() == FILEEXT::GerberJobFileExtension.c_str() )
|
||||
{
|
||||
//We cannot read a gerber job file as a gerber plot file: skip it
|
||||
wxString txt;
|
||||
|
@ -473,7 +473,7 @@ bool GERBVIEW_FRAME::unarchiveFiles( const wxString& aFullFileName, REPORTER* aR
|
|||
// The archive contains Gerber and/or Excellon drill files. Use the right loader.
|
||||
// However it can contain a few other files (reports, pdf files...),
|
||||
// which will be skipped.
|
||||
if( curr_ext == GerberJobFileExtension.c_str() )
|
||||
if( curr_ext == FILEEXT::GerberJobFileExtension.c_str() )
|
||||
{
|
||||
//We cannot read a gerber job file as a gerber plot file: skip it
|
||||
if( aReporter )
|
||||
|
@ -636,7 +636,8 @@ bool GERBVIEW_FRAME::LoadZipArchiveFile( const wxString& aFullFileName )
|
|||
currentPath = m_mruPath;
|
||||
|
||||
wxFileDialog dlg( this, _( "Open Zip File" ), currentPath, filename.GetFullName(),
|
||||
ZipFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
|
||||
FILEEXT::ZipFileWildcard(),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return false;
|
||||
|
@ -683,11 +684,11 @@ void GERBVIEW_FRAME::DoWithAcceptedFiles()
|
|||
|
||||
for( const wxFileName& file : m_AcceptedFiles )
|
||||
{
|
||||
if( file.GetExt() == ArchiveFileExtension )
|
||||
if( file.GetExt() == FILEEXT::ArchiveFileExtension )
|
||||
{
|
||||
wxString fn = file.GetFullPath();
|
||||
// Open zip archive in editor
|
||||
m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( ArchiveFileExtension ), &fn );
|
||||
m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( FILEEXT::ArchiveFileExtension ), &fn );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -698,5 +699,5 @@ void GERBVIEW_FRAME::DoWithAcceptedFiles()
|
|||
|
||||
// Open files in editor
|
||||
if( !gerbFn.IsEmpty() )
|
||||
m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( GerberFileExtension ), &gerbFn );
|
||||
m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( FILEEXT::GerberFileExtension ), &gerbFn );
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
|
|||
destFile.SetPath( destPath );
|
||||
}
|
||||
|
||||
if( IsGerberFileExtension( ext ) )
|
||||
if( FILEEXT::IsGerberFileExtension( ext ) )
|
||||
{
|
||||
wxString destFileName = destFile.GetName();
|
||||
|
||||
|
@ -187,7 +187,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
|
|||
|
||||
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
||||
}
|
||||
else if( ext == GerberJobFileExtension )
|
||||
else if( ext == FILEEXT::GerberJobFileExtension )
|
||||
{
|
||||
if( destFile.GetName() == aProjectName + wxT( "-job" ) )
|
||||
destFile.SetName( aNewProjectName + wxT( "-job" ) );
|
||||
|
@ -248,7 +248,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
|
|||
aErrors += msg;
|
||||
}
|
||||
}
|
||||
else if( ext == DrillFileExtension )
|
||||
else if( ext == FILEEXT::DrillFileExtension )
|
||||
{
|
||||
wxString destFileName = destFile.GetName();
|
||||
|
||||
|
|
|
@ -182,9 +182,9 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent )
|
|||
|
||||
// Drag and drop
|
||||
// Note that all gerber files are aliased as GerberFileExtension
|
||||
m_acceptedExts.emplace( GerberFileExtension, &GERBVIEW_ACTIONS::loadGerbFiles );
|
||||
m_acceptedExts.emplace( ArchiveFileExtension, &GERBVIEW_ACTIONS::loadZipFile );
|
||||
m_acceptedExts.emplace( DrillFileExtension, &GERBVIEW_ACTIONS::loadGerbFiles );
|
||||
m_acceptedExts.emplace( FILEEXT::GerberFileExtension, &GERBVIEW_ACTIONS::loadGerbFiles );
|
||||
m_acceptedExts.emplace( FILEEXT::ArchiveFileExtension, &GERBVIEW_ACTIONS::loadZipFile );
|
||||
m_acceptedExts.emplace( FILEEXT::DrillFileExtension, &GERBVIEW_ACTIONS::loadGerbFiles );
|
||||
DragAcceptFiles( true );
|
||||
|
||||
GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
|
||||
|
@ -269,9 +269,9 @@ bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
{
|
||||
wxString ext = wxFileName( aFileSet[i] ).GetExt().Lower();
|
||||
|
||||
if( ext == ArchiveFileExtension )
|
||||
if( ext == FILEEXT::ArchiveFileExtension )
|
||||
LoadZipArchiveFile( aFileSet[i] );
|
||||
else if( ext == GerberJobFileExtension )
|
||||
else if( ext == FILEEXT::GerberJobFileExtension )
|
||||
LoadGerberJobFile( aFileSet[i] );
|
||||
else
|
||||
{
|
||||
|
|
|
@ -192,7 +192,7 @@ bool GERBVIEW_FRAME::LoadGerberJobFile( const wxString& aFullFileName )
|
|||
wxFileDialog dlg( this, _( "Open Gerber Job File" ),
|
||||
currentPath,
|
||||
filename.GetFullName(),
|
||||
GerberJobFileWildcard(),
|
||||
FILEEXT::GerberJobFileWildcard(),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
|
|
|
@ -120,16 +120,16 @@ int GERBVIEW_CONTROL::ExportToPcbnew( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
}
|
||||
|
||||
wxString fileDialogName( NAMELESS_PROJECT + wxT( "." ) + KiCadPcbFileExtension );
|
||||
wxString fileDialogName( NAMELESS_PROJECT + wxT( "." ) + FILEEXT::KiCadPcbFileExtension );
|
||||
wxString path = m_frame->GetMruPath();
|
||||
|
||||
wxFileDialog filedlg( m_frame, _( "Export as KiCad Board File" ), path, fileDialogName,
|
||||
PcbFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
FILEEXT::PcbFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( filedlg.ShowModal() == wxID_CANCEL )
|
||||
return 0;
|
||||
|
||||
wxFileName fileName = EnsureFileExtension( filedlg.GetPath(), KiCadPcbFileExtension );
|
||||
wxFileName fileName = EnsureFileExtension( filedlg.GetPath(), FILEEXT::KiCadPcbFileExtension );
|
||||
|
||||
/* Install a dialog frame to choose the mapping
|
||||
* between gerber layers and Pcbnew layers
|
||||
|
|
|
@ -51,8 +51,8 @@ public:
|
|||
|
||||
wxLogTrace( LCK, "Trying to lock %s", filename );
|
||||
wxFileName fn( filename );
|
||||
fn.SetName( LockFilePrefix + fn.GetName() );
|
||||
fn.SetExt( fn.GetExt() + '.' + LockFileExtension );
|
||||
fn.SetName( FILEEXT::LockFilePrefix + fn.GetName() );
|
||||
fn.SetExt( fn.GetExt() + '.' + FILEEXT::LockFileExtension );
|
||||
|
||||
if( !fn.IsDirWritable() )
|
||||
{
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
protected:
|
||||
wxString getFileExt() const override
|
||||
{
|
||||
return ProjectLocalSettingsFileExtension;
|
||||
return FILEEXT::ProjectLocalSettingsFileExtension;
|
||||
}
|
||||
|
||||
wxString getLegacyFileExt() const override
|
||||
|
|
|
@ -32,23 +32,11 @@
|
|||
#ifndef INCLUDE_WILDCARDS_AND_FILES_EXT_H_
|
||||
#define INCLUDE_WILDCARDS_AND_FILES_EXT_H_
|
||||
|
||||
#include <kicommon.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <wx/string.h>
|
||||
|
||||
/**
|
||||
* \defgroup file_extensions File Extension Definitions
|
||||
*
|
||||
* @note Please do not changes these. If a different file extension is needed, create a new
|
||||
* definition in here. If you create a extension definition in another file, make sure
|
||||
* to add it to the Doxygen group "file_extensions" using the "addtogroup" tag. Also
|
||||
* note, just because they are defined as const doesn't guarantee that they cannot be
|
||||
* changed.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Compare the given extension against the reference extensions to see if it matches any
|
||||
* of the reference extensions.
|
||||
|
@ -65,8 +53,8 @@
|
|||
*
|
||||
* @return if the extension matches any reference extensions
|
||||
*/
|
||||
bool compareFileExtensions( const std::string& aExtension,
|
||||
const std::vector<std::string>& aReference, bool aCaseSensitive = false );
|
||||
KICOMMON_API bool compareFileExtensions( const std::string& aExtension,
|
||||
const std::vector<std::string>& aReference, bool aCaseSensitive = false );
|
||||
|
||||
/**
|
||||
* Build the wildcard extension file dialog wildcard filter to add to the base message dialog.
|
||||
|
@ -86,7 +74,7 @@ bool compareFileExtensions( const std::string& aExtension,
|
|||
* @return the appropriate file dialog wildcard filter list.
|
||||
*/
|
||||
|
||||
wxString AddFileExtListToFilter( const std::vector<std::string>& aExts );
|
||||
KICOMMON_API wxString AddFileExtListToFilter( const std::vector<std::string>& aExts );
|
||||
|
||||
/**
|
||||
* Format wildcard extension to support case sensitive file dialogs.
|
||||
|
@ -106,156 +94,175 @@ wxString AddFileExtListToFilter( const std::vector<std::string>& aExts );
|
|||
*
|
||||
* @return the build appropriate file dialog wildcard filter.
|
||||
*/
|
||||
wxString formatWildcardExt( const wxString& aWildcard );
|
||||
|
||||
extern const std::string BackupFileSuffix;
|
||||
extern const std::string LockFilePrefix;
|
||||
extern const std::string LockFileExtension;
|
||||
|
||||
extern const std::string SchematicSymbolFileExtension;
|
||||
extern const std::string LegacySymbolLibFileExtension;
|
||||
extern const std::string LegacySymbolDocumentFileExtension;
|
||||
extern const std::string SchematicBackupFileExtension;
|
||||
|
||||
extern const std::string VrmlFileExtension;
|
||||
extern const std::string ProjectFileExtension;
|
||||
extern const std::string LegacyProjectFileExtension;
|
||||
extern const std::string ProjectLocalSettingsFileExtension;
|
||||
extern const std::string LegacySchematicFileExtension;
|
||||
extern const std::string CadstarSchematicFileExtension;
|
||||
extern const std::string CadstarPartsLibraryFileExtension;
|
||||
extern const std::string KiCadSchematicFileExtension;
|
||||
extern const std::string SpiceFileExtension;
|
||||
extern const std::string CadstarNetlistFileExtension;
|
||||
extern const std::string OrCadPcb2NetlistFileExtension;
|
||||
extern const std::string NetlistFileExtension;
|
||||
extern const std::string AllegroNetlistFileExtension;
|
||||
extern const std::string GerberFileExtension;
|
||||
extern const std::string GerberJobFileExtension;
|
||||
extern const std::string HtmlFileExtension;
|
||||
extern const std::string EquFileExtension;
|
||||
extern const std::string HotkeyFileExtension;
|
||||
extern const std::string DatabaseLibraryFileExtension;
|
||||
extern const std::string HTTPLibraryFileExtension;
|
||||
|
||||
extern const std::string ArchiveFileExtension;
|
||||
|
||||
extern const std::string LegacyPcbFileExtension;
|
||||
extern const std::string EaglePcbFileExtension;
|
||||
extern const std::string CadstarPcbFileExtension;
|
||||
extern const std::string KiCadPcbFileExtension;
|
||||
#define PcbFileExtension KiCadPcbFileExtension // symlink choice
|
||||
extern const std::string KiCadSymbolLibFileExtension;
|
||||
extern const std::string DrawingSheetFileExtension;
|
||||
extern const std::string DesignRulesFileExtension;
|
||||
|
||||
extern const std::string LegacyFootprintLibPathExtension;
|
||||
extern const std::string PdfFileExtension;
|
||||
extern const std::string MacrosFileExtension;
|
||||
extern const std::string FootprintAssignmentFileExtension;
|
||||
extern const std::string DrillFileExtension;
|
||||
extern const std::string SVGFileExtension;
|
||||
extern const std::string ReportFileExtension;
|
||||
extern const std::string FootprintPlaceFileExtension;
|
||||
extern const std::string KiCadFootprintFileExtension;
|
||||
extern const std::string KiCadFootprintLibPathExtension;
|
||||
extern const std::string AltiumFootprintLibPathExtension;
|
||||
extern const std::string GedaPcbFootprintLibFileExtension;
|
||||
extern const std::string EagleFootprintLibPathExtension;
|
||||
extern const std::string DrawingSheetFileExtension;
|
||||
extern const std::string SpecctraDsnFileExtension;
|
||||
extern const std::string SpecctraSessionFileExtension;
|
||||
extern const std::string IpcD356FileExtension;
|
||||
extern const std::string Ipc2581FileExtension;
|
||||
extern const std::string WorkbookFileExtension;
|
||||
|
||||
extern const std::string PngFileExtension;
|
||||
extern const std::string JpegFileExtension;
|
||||
extern const std::string TextFileExtension;
|
||||
extern const std::string MarkdownFileExtension;
|
||||
extern const std::string CsvFileExtension;
|
||||
extern const std::string XmlFileExtension;
|
||||
extern const std::string JsonFileExtension;
|
||||
|
||||
extern const std::string StepFileExtension;
|
||||
extern const std::string StepFileAbrvExtension;
|
||||
extern const std::string GltfBinaryFileExtension;
|
||||
|
||||
extern const wxString GerberFileExtensionsRegex;
|
||||
|
||||
bool IsGerberFileExtension( const wxString& ext );
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
KICOMMON_API wxString formatWildcardExt( const wxString& aWildcard );
|
||||
|
||||
|
||||
/**
|
||||
* \defgroup file_wildcards File Wildcard Definitions
|
||||
*
|
||||
* @note Please do not changes these. If a different file wildcard is needed, create a new
|
||||
* definition in here. If you create a wildcard definition in another file, make sure
|
||||
* to add it to the Doxygen group "file_extensions" using the "addtogroup" tag and
|
||||
* correct handle the GTK+ file dialog case sensitivity issue.
|
||||
* @{
|
||||
*/
|
||||
class KICOMMON_API FILEEXT
|
||||
{
|
||||
public:
|
||||
FILEEXT() = delete;
|
||||
|
||||
extern wxString AllFilesWildcard();
|
||||
/**
|
||||
* \defgroup file_extensions File Extension Definitions
|
||||
*
|
||||
* @note Please do not changes these. If a different file extension is needed, create a new
|
||||
* definition in here. If you create a extension definition in another file, make sure
|
||||
* to add it to the Doxygen group "file_extensions" using the "addtogroup" tag. Also
|
||||
* note, just because they are defined as const doesn't guarantee that they cannot be
|
||||
* changed.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
static const std::string BackupFileSuffix;
|
||||
static const std::string LockFilePrefix;
|
||||
static const std::string LockFileExtension;
|
||||
|
||||
extern wxString FootprintAssignmentFileWildcard();
|
||||
extern wxString DrawingSheetFileWildcard();
|
||||
extern wxString KiCadSymbolLibFileWildcard();
|
||||
extern wxString ProjectFileWildcard();
|
||||
extern wxString LegacyProjectFileWildcard();
|
||||
extern wxString AllProjectFilesWildcard();
|
||||
extern wxString AllSchematicFilesWildcard();
|
||||
extern wxString KiCadSchematicFileWildcard();
|
||||
extern wxString LegacySchematicFileWildcard();
|
||||
extern wxString BoardFileWildcard();
|
||||
extern wxString OrCadPcb2NetlistFileWildcard();
|
||||
extern wxString NetlistFileWildcard();
|
||||
extern wxString AllegroNetlistFileWildcard();
|
||||
extern wxString HtmlFileWildcard();
|
||||
extern wxString CsvFileWildcard();
|
||||
extern wxString PcbFileWildcard();
|
||||
extern wxString CadstarArchiveFilesWildcard();
|
||||
extern wxString EagleFilesWildcard();
|
||||
extern wxString EasyEdaArchiveWildcard();
|
||||
extern wxString EasyEdaProFileWildcard();
|
||||
extern wxString PdfFileWildcard();
|
||||
extern wxString PSFileWildcard();
|
||||
extern wxString MacrosFileWildcard();
|
||||
extern wxString DrillFileWildcard();
|
||||
extern wxString SVGFileWildcard();
|
||||
extern wxString JsonFileWildcard();
|
||||
extern wxString ReportFileWildcard();
|
||||
extern wxString FootprintPlaceFileWildcard();
|
||||
extern wxString Shapes3DFileWildcard();
|
||||
extern wxString IDF3DFileWildcard();
|
||||
extern wxString DocModulesFileName();
|
||||
extern wxString KiCadFootprintLibFileWildcard();
|
||||
extern wxString KiCadFootprintLibPathWildcard();
|
||||
extern wxString TextFileWildcard();
|
||||
extern wxString ModLegacyExportFileWildcard();
|
||||
extern wxString ErcFileWildcard();
|
||||
extern wxString SpiceLibraryFileWildcard();
|
||||
extern wxString SpiceNetlistFileWildcard();
|
||||
extern wxString CadstarNetlistFileWildcard();
|
||||
extern wxString EquFileWildcard();
|
||||
extern wxString ZipFileWildcard();
|
||||
extern wxString GencadFileWildcard();
|
||||
extern wxString DxfFileWildcard();
|
||||
extern wxString GerberJobFileWildcard();
|
||||
extern wxString SpecctraDsnFileWildcard();
|
||||
extern wxString SpecctraSessionFileWildcard();
|
||||
extern wxString IpcD356FileWildcard();
|
||||
extern wxString WorkbookFileWildcard();
|
||||
extern wxString PngFileWildcard();
|
||||
extern wxString JpegFileWildcard();
|
||||
extern wxString HotkeyFileWildcard();
|
||||
static const std::string SchematicSymbolFileExtension;
|
||||
static const std::string LegacySymbolLibFileExtension;
|
||||
static const std::string LegacySymbolDocumentFileExtension;
|
||||
static const std::string SchematicBackupFileExtension;
|
||||
|
||||
static const std::string VrmlFileExtension;
|
||||
static const std::string ProjectFileExtension;
|
||||
static const std::string LegacyProjectFileExtension;
|
||||
static const std::string ProjectLocalSettingsFileExtension;
|
||||
static const std::string LegacySchematicFileExtension;
|
||||
static const std::string CadstarSchematicFileExtension;
|
||||
static const std::string CadstarPartsLibraryFileExtension;
|
||||
static const std::string KiCadSchematicFileExtension;
|
||||
static const std::string SpiceFileExtension;
|
||||
static const std::string CadstarNetlistFileExtension;
|
||||
static const std::string OrCadPcb2NetlistFileExtension;
|
||||
static const std::string NetlistFileExtension;
|
||||
static const std::string AllegroNetlistFileExtension;
|
||||
static const std::string GerberFileExtension;
|
||||
static const std::string GerberJobFileExtension;
|
||||
static const std::string HtmlFileExtension;
|
||||
static const std::string EquFileExtension;
|
||||
static const std::string HotkeyFileExtension;
|
||||
static const std::string DatabaseLibraryFileExtension;
|
||||
static const std::string HTTPLibraryFileExtension;
|
||||
|
||||
static const std::string ArchiveFileExtension;
|
||||
|
||||
static const std::string LegacyPcbFileExtension;
|
||||
static const std::string EaglePcbFileExtension;
|
||||
static const std::string CadstarPcbFileExtension;
|
||||
static const std::string KiCadPcbFileExtension;
|
||||
#define PcbFileExtension KiCadPcbFileExtension // symlink choice
|
||||
static const std::string KiCadSymbolLibFileExtension;
|
||||
static const std::string DrawingSheetFileExtension;
|
||||
static const std::string DesignRulesFileExtension;
|
||||
|
||||
static const std::string LegacyFootprintLibPathExtension;
|
||||
static const std::string PdfFileExtension;
|
||||
static const std::string MacrosFileExtension;
|
||||
static const std::string FootprintAssignmentFileExtension;
|
||||
static const std::string DrillFileExtension;
|
||||
static const std::string SVGFileExtension;
|
||||
static const std::string ReportFileExtension;
|
||||
static const std::string FootprintPlaceFileExtension;
|
||||
static const std::string KiCadFootprintFileExtension;
|
||||
static const std::string KiCadFootprintLibPathExtension;
|
||||
static const std::string AltiumFootprintLibPathExtension;
|
||||
static const std::string CadstarFootprintLibPathExtension;
|
||||
static const std::string GedaPcbFootprintLibFileExtension;
|
||||
static const std::string EagleFootprintLibPathExtension;
|
||||
static const std::string DrawingSheetFileExtension;
|
||||
static const std::string SpecctraDsnFileExtension;
|
||||
static const std::string SpecctraSessionFileExtension;
|
||||
static const std::string IpcD356FileExtension;
|
||||
static const std::string Ipc2581FileExtension;
|
||||
static const std::string WorkbookFileExtension;
|
||||
|
||||
static const std::string PngFileExtension;
|
||||
static const std::string JpegFileExtension;
|
||||
static const std::string TextFileExtension;
|
||||
static const std::string MarkdownFileExtension;
|
||||
static const std::string CsvFileExtension;
|
||||
static const std::string XmlFileExtension;
|
||||
static const std::string JsonFileExtension;
|
||||
|
||||
static const std::string StepFileExtension;
|
||||
static const std::string StepFileAbrvExtension;
|
||||
static const std::string GltfBinaryFileExtension;
|
||||
|
||||
static const wxString GerberFileExtensionsRegex;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup file_wildcards File Wildcard Definitions
|
||||
*
|
||||
* @note Please do not changes these. If a different file wildcard is needed, create a new
|
||||
* definition in here. If you create a wildcard definition in another file, make sure
|
||||
* to add it to the Doxygen group "file_extensions" using the "addtogroup" tag and
|
||||
* correct handle the GTK+ file dialog case sensitivity issue.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
static bool IsGerberFileExtension( const wxString& ext );
|
||||
static wxString AllFilesWildcard();
|
||||
|
||||
static wxString FootprintAssignmentFileWildcard();
|
||||
static wxString DrawingSheetFileWildcard();
|
||||
static wxString KiCadSymbolLibFileWildcard();
|
||||
static wxString ProjectFileWildcard();
|
||||
static wxString LegacyProjectFileWildcard();
|
||||
static wxString AllProjectFilesWildcard();
|
||||
static wxString AllSchematicFilesWildcard();
|
||||
static wxString KiCadSchematicFileWildcard();
|
||||
static wxString LegacySchematicFileWildcard();
|
||||
static wxString BoardFileWildcard();
|
||||
static wxString OrCadPcb2NetlistFileWildcard();
|
||||
static wxString NetlistFileWildcard();
|
||||
static wxString AllegroNetlistFileWildcard();
|
||||
static wxString HtmlFileWildcard();
|
||||
static wxString CsvFileWildcard();
|
||||
static wxString PcbFileWildcard();
|
||||
static wxString CadstarArchiveFilesWildcard();
|
||||
static wxString EagleFilesWildcard();
|
||||
static wxString EasyEdaArchiveWildcard();
|
||||
static wxString EasyEdaProFileWildcard();
|
||||
static wxString PdfFileWildcard();
|
||||
static wxString PSFileWildcard();
|
||||
static wxString MacrosFileWildcard();
|
||||
static wxString DrillFileWildcard();
|
||||
static wxString SVGFileWildcard();
|
||||
static wxString JsonFileWildcard();
|
||||
static wxString ReportFileWildcard();
|
||||
static wxString FootprintPlaceFileWildcard();
|
||||
static wxString Shapes3DFileWildcard();
|
||||
static wxString IDF3DFileWildcard();
|
||||
static wxString DocModulesFileName();
|
||||
static wxString KiCadFootprintLibFileWildcard();
|
||||
static wxString KiCadFootprintLibPathWildcard();
|
||||
static wxString TextFileWildcard();
|
||||
static wxString ModLegacyExportFileWildcard();
|
||||
static wxString ErcFileWildcard();
|
||||
static wxString SpiceLibraryFileWildcard();
|
||||
static wxString SpiceNetlistFileWildcard();
|
||||
static wxString CadstarNetlistFileWildcard();
|
||||
static wxString EquFileWildcard();
|
||||
static wxString ZipFileWildcard();
|
||||
static wxString GencadFileWildcard();
|
||||
static wxString DxfFileWildcard();
|
||||
static wxString GerberJobFileWildcard();
|
||||
static wxString SpecctraDsnFileWildcard();
|
||||
static wxString SpecctraSessionFileWildcard();
|
||||
static wxString IpcD356FileWildcard();
|
||||
static wxString WorkbookFileWildcard();
|
||||
static wxString PngFileWildcard();
|
||||
static wxString JpegFileWildcard();
|
||||
static wxString HotkeyFileWildcard();
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif // INCLUDE_WILDCARDS_AND_FILES_EXT_H_
|
||||
|
|
|
@ -61,10 +61,10 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event )
|
|||
{
|
||||
wxFileName fn = Prj().GetProjectFullName();
|
||||
|
||||
fn.SetExt( ArchiveFileExtension );
|
||||
fn.SetExt( FILEEXT::ArchiveFileExtension );
|
||||
|
||||
wxFileDialog zipfiledlg( this, _( "Unzip Project" ), fn.GetPath(),
|
||||
fn.GetFullName(), ZipFileWildcard(),
|
||||
fn.GetFullName(), FILEEXT::ZipFileWildcard(),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( zipfiledlg.ShowModal() == wxID_CANCEL )
|
||||
|
@ -112,11 +112,11 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
|
|||
{
|
||||
wxFileName fileName = GetProjectFileName();
|
||||
|
||||
fileName.SetExt( ArchiveFileExtension );
|
||||
fileName.SetExt( FILEEXT::ArchiveFileExtension );
|
||||
|
||||
wxFileDialog dlg( this, _( "Archive Project Files" ),
|
||||
fileName.GetPath(), fileName.GetFullName(),
|
||||
ZipFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
FILEEXT::ZipFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
|
|
@ -81,7 +81,7 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( const wxString& aWindowTitle,
|
|||
|
||||
importProj.m_TargetProj.SetPath( targetDir );
|
||||
importProj.m_TargetProj.SetName( importProj.m_InputFile.GetName() );
|
||||
importProj.m_TargetProj.SetExt( ProjectFileExtension );
|
||||
importProj.m_TargetProj.SetExt( FILEEXT::ProjectFileExtension );
|
||||
importProj.m_TargetProj.MakeAbsolute();
|
||||
|
||||
// Check if the project directory is empty
|
||||
|
@ -125,27 +125,27 @@ void KICAD_MANAGER_FRAME::ImportNonKiCadProject( const wxString& aWindowTitle,
|
|||
void KICAD_MANAGER_FRAME::OnImportCadstarArchiveFiles( wxCommandEvent& event )
|
||||
{
|
||||
ImportNonKiCadProject( _( "Import CADSTAR Archive Project Files" ),
|
||||
CadstarArchiveFilesWildcard(), { "csa" }, { "cpa" },
|
||||
FILEEXT::CadstarArchiveFilesWildcard(), { "csa" }, { "cpa" },
|
||||
SCH_IO_MGR::SCH_CADSTAR_ARCHIVE, PCB_IO_MGR::CADSTAR_PCB_ARCHIVE );
|
||||
}
|
||||
|
||||
|
||||
void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event )
|
||||
{
|
||||
ImportNonKiCadProject( _( "Import Eagle Project Files" ), EagleFilesWildcard(), { "sch" },
|
||||
ImportNonKiCadProject( _( "Import Eagle Project Files" ), FILEEXT::EagleFilesWildcard(), { "sch" },
|
||||
{ "brd" }, SCH_IO_MGR::SCH_EAGLE, PCB_IO_MGR::EAGLE );
|
||||
}
|
||||
|
||||
|
||||
void KICAD_MANAGER_FRAME::OnImportEasyEdaFiles( wxCommandEvent& event )
|
||||
{
|
||||
ImportNonKiCadProject( _( "Import EasyEDA Std Backup" ), EasyEdaArchiveWildcard(), { "INPUT" },
|
||||
ImportNonKiCadProject( _( "Import EasyEDA Std Backup" ), FILEEXT::EasyEdaArchiveWildcard(), { "INPUT" },
|
||||
{ "INPUT" }, SCH_IO_MGR::SCH_EASYEDA, PCB_IO_MGR::EASYEDA );
|
||||
}
|
||||
|
||||
|
||||
void KICAD_MANAGER_FRAME::OnImportEasyEdaProFiles( wxCommandEvent& event )
|
||||
{
|
||||
ImportNonKiCadProject( _( "Import EasyEDA Pro Project" ), EasyEdaProFileWildcard(), { "INPUT" },
|
||||
ImportNonKiCadProject( _( "Import EasyEDA Pro Project" ), FILEEXT::EasyEdaProFileWildcard(), { "INPUT" },
|
||||
{ "INPUT" }, SCH_IO_MGR::SCH_EASYEDAPRO, PCB_IO_MGR::EASYEDAPRO );
|
||||
}
|
|
@ -309,7 +309,8 @@ bool PGM_KICAD::OnPgmInit()
|
|||
{
|
||||
wxFileName tmp = App().argv[1];
|
||||
|
||||
if( tmp.GetExt() != ProjectFileExtension && tmp.GetExt() != LegacyProjectFileExtension )
|
||||
if( tmp.GetExt() != FILEEXT::ProjectFileExtension
|
||||
&& tmp.GetExt() != FILEEXT::LegacyProjectFileExtension )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
|
|
|
@ -228,14 +228,14 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
|
|||
m_leftWin->SetFocus();
|
||||
|
||||
// Init for dropping files
|
||||
m_acceptedExts.emplace( ProjectFileExtension, &KICAD_MANAGER_ACTIONS::loadProject );
|
||||
m_acceptedExts.emplace( LegacyProjectFileExtension, &KICAD_MANAGER_ACTIONS::loadProject );
|
||||
m_acceptedExts.emplace( FILEEXT::ProjectFileExtension, &KICAD_MANAGER_ACTIONS::loadProject );
|
||||
m_acceptedExts.emplace( FILEEXT::LegacyProjectFileExtension, &KICAD_MANAGER_ACTIONS::loadProject );
|
||||
|
||||
// Gerber files
|
||||
// Note that all gerber files are aliased as GerberFileExtension
|
||||
m_acceptedExts.emplace( GerberFileExtension, &KICAD_MANAGER_ACTIONS::viewDroppedGerbers );
|
||||
m_acceptedExts.emplace( GerberJobFileExtension, &KICAD_MANAGER_ACTIONS::viewDroppedGerbers );
|
||||
m_acceptedExts.emplace( DrillFileExtension, &KICAD_MANAGER_ACTIONS::viewDroppedGerbers );
|
||||
m_acceptedExts.emplace( FILEEXT::GerberFileExtension, &KICAD_MANAGER_ACTIONS::viewDroppedGerbers );
|
||||
m_acceptedExts.emplace( FILEEXT::GerberJobFileExtension, &KICAD_MANAGER_ACTIONS::viewDroppedGerbers );
|
||||
m_acceptedExts.emplace( FILEEXT::DrillFileExtension, &KICAD_MANAGER_ACTIONS::viewDroppedGerbers );
|
||||
|
||||
DragAcceptFiles( true );
|
||||
|
||||
|
@ -394,7 +394,7 @@ const wxString KICAD_MANAGER_FRAME::SchFileName()
|
|||
{
|
||||
wxFileName fn( GetProjectFileName() );
|
||||
|
||||
fn.SetExt( KiCadSchematicFileExtension );
|
||||
fn.SetExt( FILEEXT::KiCadSchematicFileExtension );
|
||||
return fn.GetFullPath();
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ const wxString KICAD_MANAGER_FRAME::SchLegacyFileName()
|
|||
{
|
||||
wxFileName fn( GetProjectFileName() );
|
||||
|
||||
fn.SetExt( LegacySchematicFileExtension );
|
||||
fn.SetExt( FILEEXT::LegacySchematicFileExtension );
|
||||
return fn.GetFullPath();
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,7 @@ const wxString KICAD_MANAGER_FRAME::PcbFileName()
|
|||
{
|
||||
wxFileName fn( GetProjectFileName() );
|
||||
|
||||
fn.SetExt( PcbFileExtension );
|
||||
fn.SetExt( FILEEXT::PcbFileExtension );
|
||||
return fn.GetFullPath();
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,7 @@ const wxString KICAD_MANAGER_FRAME::PcbLegacyFileName()
|
|||
{
|
||||
wxFileName fn( GetProjectFileName() );
|
||||
|
||||
fn.SetExt( LegacyPcbFileExtension );
|
||||
fn.SetExt( FILEEXT::LegacyPcbFileExtension );
|
||||
return fn.GetFullPath();
|
||||
}
|
||||
|
||||
|
@ -464,7 +464,7 @@ void KICAD_MANAGER_FRAME::DoWithAcceptedFiles()
|
|||
{
|
||||
wxString ext = fileName.GetExt();
|
||||
|
||||
if( ext == ProjectFileExtension || ext == LegacyProjectFileExtension )
|
||||
if( ext == FILEEXT::ProjectFileExtension || ext == FILEEXT::LegacyProjectFileExtension )
|
||||
{
|
||||
wxString fn = fileName.GetFullPath();
|
||||
m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( fileName.GetExt() ), &fn );
|
||||
|
@ -481,8 +481,8 @@ void KICAD_MANAGER_FRAME::DoWithAcceptedFiles()
|
|||
{
|
||||
wxString ext = fileName.GetExt();
|
||||
|
||||
if( ext == GerberJobFileExtension || ext == DrillFileExtension
|
||||
|| IsGerberFileExtension( ext ) )
|
||||
if( ext == FILEEXT::GerberJobFileExtension || ext == FILEEXT::DrillFileExtension
|
||||
|| FILEEXT::IsGerberFileExtension( ext ) )
|
||||
{
|
||||
gerberFiles += wxT( '\"' );
|
||||
gerberFiles += fileName.GetFullPath() + wxT( '\"' );
|
||||
|
@ -503,7 +503,7 @@ void KICAD_MANAGER_FRAME::DoWithAcceptedFiles()
|
|||
if( wxFileExists( fullEditorName ) )
|
||||
{
|
||||
wxString command = fullEditorName + " " + gerberFiles;
|
||||
m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( GerberFileExtension ),
|
||||
m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( FILEEXT::GerberFileExtension ),
|
||||
&command );
|
||||
}
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName,
|
|||
if( !aProjectFileName.FileExists() )
|
||||
{
|
||||
wxFileName legacyPro( aProjectFileName );
|
||||
legacyPro.SetExt( LegacyProjectFileExtension );
|
||||
legacyPro.SetExt( FILEEXT::LegacyProjectFileExtension );
|
||||
|
||||
if( legacyPro.FileExists() )
|
||||
{
|
||||
|
@ -663,7 +663,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName,
|
|||
wxString srcFileName = sys_search().FindValidPath( "kicad.kicad_pro" );
|
||||
|
||||
wxFileName destFileName( aProjectFileName );
|
||||
destFileName.SetExt( ProjectFileExtension );
|
||||
destFileName.SetExt( FILEEXT::ProjectFileExtension );
|
||||
|
||||
// Create a minimal project file if the template project file could not be copied
|
||||
if( !wxFileName::FileExists( srcFileName )
|
||||
|
@ -685,7 +685,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName,
|
|||
if( aCreateStubFiles )
|
||||
{
|
||||
wxFileName fn( aProjectFileName.GetFullPath() );
|
||||
fn.SetExt( KiCadSchematicFileExtension );
|
||||
fn.SetExt( FILEEXT::KiCadSchematicFileExtension );
|
||||
|
||||
// If a <project>.kicad_sch file does not exist, create a "stub" file ( minimal schematic
|
||||
// file ).
|
||||
|
@ -704,9 +704,9 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName,
|
|||
|
||||
// If a <project>.kicad_pcb or <project>.brd file does not exist,
|
||||
// create a .kicad_pcb "stub" file
|
||||
fn.SetExt( KiCadPcbFileExtension );
|
||||
fn.SetExt( FILEEXT::KiCadPcbFileExtension );
|
||||
wxFileName leg_fn( fn );
|
||||
leg_fn.SetExt( LegacyPcbFileExtension );
|
||||
leg_fn.SetExt( FILEEXT::LegacyPcbFileExtension );
|
||||
|
||||
if( !fn.FileExists() && !leg_fn.FileExists() )
|
||||
{
|
||||
|
@ -733,7 +733,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName,
|
|||
void KICAD_MANAGER_FRAME::OnOpenFileInTextEditor( wxCommandEvent& event )
|
||||
{
|
||||
// show all files in file dialog (in Kicad all files are editable texts):
|
||||
wxString wildcard = AllFilesWildcard();
|
||||
wxString wildcard = FILEEXT::AllFilesWildcard();
|
||||
|
||||
wxString default_dir = Prj().GetProjectPath();
|
||||
|
||||
|
@ -901,7 +901,7 @@ void KICAD_MANAGER_FRAME::OnIdle( wxIdleEvent& aEvent )
|
|||
Prj().GetLocalSettings().m_files.end(),
|
||||
[&]( const PROJECT_FILE_STATE& f )
|
||||
{
|
||||
return !f.fileName.EndsWith( ProjectFileExtension ) && f.open;
|
||||
return !f.fileName.EndsWith( FILEEXT::ProjectFileExtension ) && f.open;
|
||||
} );
|
||||
|
||||
if( previousOpenCount > 0 )
|
||||
|
@ -924,13 +924,13 @@ void KICAD_MANAGER_FRAME::OnIdle( wxIdleEvent& aEvent )
|
|||
openedFiles.insert( file.fileName );
|
||||
wxFileName fn( file.fileName );
|
||||
|
||||
if( fn.GetExt() == LegacySchematicFileExtension
|
||||
|| fn.GetExt() == KiCadSchematicFileExtension )
|
||||
if( fn.GetExt() == FILEEXT::LegacySchematicFileExtension
|
||||
|| fn.GetExt() == FILEEXT::KiCadSchematicFileExtension )
|
||||
{
|
||||
GetToolManager()->RunAction( KICAD_MANAGER_ACTIONS::editSchematic );
|
||||
}
|
||||
else if( fn.GetExt() == LegacyPcbFileExtension
|
||||
|| fn.GetExt() == KiCadPcbFileExtension )
|
||||
else if( fn.GetExt() == FILEEXT::LegacyPcbFileExtension
|
||||
|| fn.GetExt() == FILEEXT::KiCadPcbFileExtension )
|
||||
{
|
||||
GetToolManager()->RunAction( KICAD_MANAGER_ACTIONS::editPCB );
|
||||
}
|
||||
|
|
|
@ -156,7 +156,8 @@ size_t PROJECT_TEMPLATE::GetDestinationFiles( const wxFileName& aNewProjectPath,
|
|||
|
||||
for( wxFileName& file : srcFiles )
|
||||
{
|
||||
if( file.GetExt() == ProjectFileExtension || file.GetExt() == LegacyProjectFileExtension )
|
||||
if( file.GetExt() == FILEEXT::ProjectFileExtension
|
||||
|| file.GetExt() == FILEEXT::LegacyProjectFileExtension )
|
||||
{
|
||||
if( !basename.IsEmpty() && basename != file.GetName() )
|
||||
multipleProjectFilesFound = true;
|
||||
|
@ -205,7 +206,8 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aEr
|
|||
|
||||
for( wxFileName& file : srcFiles )
|
||||
{
|
||||
if( file.GetExt() == ProjectFileExtension || file.GetExt() == LegacyProjectFileExtension )
|
||||
if( file.GetExt() == FILEEXT::ProjectFileExtension
|
||||
|| file.GetExt() == FILEEXT::LegacyProjectFileExtension )
|
||||
{
|
||||
if( !basename.IsEmpty() && basename != file.GetName() )
|
||||
multipleProjectFilesFound = true;
|
||||
|
@ -225,7 +227,7 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath, wxString* aEr
|
|||
// Replace the template filename with the project filename for the new project creation
|
||||
wxString currname = destFile.GetName();
|
||||
|
||||
if( destFile.GetExt() == DrawingSheetFileExtension )
|
||||
if( destFile.GetExt() == FILEEXT::DrawingSheetFileExtension )
|
||||
{
|
||||
// Don't rename drawing sheet definitions; they're often shared
|
||||
}
|
||||
|
|
|
@ -298,33 +298,33 @@ wxString PROJECT_TREE_PANE::GetFileExt( TREE_FILE_TYPE type )
|
|||
{
|
||||
switch( type )
|
||||
{
|
||||
case TREE_FILE_TYPE::LEGACY_PROJECT: return LegacyProjectFileExtension;
|
||||
case TREE_FILE_TYPE::JSON_PROJECT: return ProjectFileExtension;
|
||||
case TREE_FILE_TYPE::LEGACY_SCHEMATIC: return LegacySchematicFileExtension;
|
||||
case TREE_FILE_TYPE::SEXPR_SCHEMATIC: return KiCadSchematicFileExtension;
|
||||
case TREE_FILE_TYPE::LEGACY_PCB: return LegacyPcbFileExtension;
|
||||
case TREE_FILE_TYPE::SEXPR_PCB: return KiCadPcbFileExtension;
|
||||
case TREE_FILE_TYPE::GERBER: return GerberFileExtensionsRegex;
|
||||
case TREE_FILE_TYPE::GERBER_JOB_FILE: return GerberJobFileExtension;
|
||||
case TREE_FILE_TYPE::HTML: return HtmlFileExtension;
|
||||
case TREE_FILE_TYPE::PDF: return PdfFileExtension;
|
||||
case TREE_FILE_TYPE::TXT: return TextFileExtension;
|
||||
case TREE_FILE_TYPE::MD: return MarkdownFileExtension;
|
||||
case TREE_FILE_TYPE::NET: return NetlistFileExtension;
|
||||
case TREE_FILE_TYPE::NET_SPICE: return SpiceFileExtension;
|
||||
case TREE_FILE_TYPE::CMP_LINK: return FootprintAssignmentFileExtension;
|
||||
case TREE_FILE_TYPE::REPORT: return ReportFileExtension;
|
||||
case TREE_FILE_TYPE::FP_PLACE: return FootprintPlaceFileExtension;
|
||||
case TREE_FILE_TYPE::DRILL: return DrillFileExtension;
|
||||
case TREE_FILE_TYPE::LEGACY_PROJECT: return FILEEXT::LegacyProjectFileExtension;
|
||||
case TREE_FILE_TYPE::JSON_PROJECT: return FILEEXT::ProjectFileExtension;
|
||||
case TREE_FILE_TYPE::LEGACY_SCHEMATIC: return FILEEXT::LegacySchematicFileExtension;
|
||||
case TREE_FILE_TYPE::SEXPR_SCHEMATIC: return FILEEXT::KiCadSchematicFileExtension;
|
||||
case TREE_FILE_TYPE::LEGACY_PCB: return FILEEXT::LegacyPcbFileExtension;
|
||||
case TREE_FILE_TYPE::SEXPR_PCB: return FILEEXT::KiCadPcbFileExtension;
|
||||
case TREE_FILE_TYPE::GERBER: return FILEEXT::GerberFileExtensionsRegex;
|
||||
case TREE_FILE_TYPE::GERBER_JOB_FILE: return FILEEXT::GerberJobFileExtension;
|
||||
case TREE_FILE_TYPE::HTML: return FILEEXT::HtmlFileExtension;
|
||||
case TREE_FILE_TYPE::PDF: return FILEEXT::PdfFileExtension;
|
||||
case TREE_FILE_TYPE::TXT: return FILEEXT::TextFileExtension;
|
||||
case TREE_FILE_TYPE::MD: return FILEEXT::MarkdownFileExtension;
|
||||
case TREE_FILE_TYPE::NET: return FILEEXT::NetlistFileExtension;
|
||||
case TREE_FILE_TYPE::NET_SPICE: return FILEEXT::SpiceFileExtension;
|
||||
case TREE_FILE_TYPE::CMP_LINK: return FILEEXT::FootprintAssignmentFileExtension;
|
||||
case TREE_FILE_TYPE::REPORT: return FILEEXT::ReportFileExtension;
|
||||
case TREE_FILE_TYPE::FP_PLACE: return FILEEXT::FootprintPlaceFileExtension;
|
||||
case TREE_FILE_TYPE::DRILL: return FILEEXT::DrillFileExtension;
|
||||
case TREE_FILE_TYPE::DRILL_NC: return "nc";
|
||||
case TREE_FILE_TYPE::DRILL_XNC: return "xnc";
|
||||
case TREE_FILE_TYPE::SVG: return SVGFileExtension;
|
||||
case TREE_FILE_TYPE::DRAWING_SHEET: return DrawingSheetFileExtension;
|
||||
case TREE_FILE_TYPE::FOOTPRINT_FILE: return KiCadFootprintFileExtension;
|
||||
case TREE_FILE_TYPE::SCHEMATIC_LIBFILE: return LegacySymbolLibFileExtension;
|
||||
case TREE_FILE_TYPE::SEXPR_SYMBOL_LIB_FILE: return KiCadSymbolLibFileExtension;
|
||||
case TREE_FILE_TYPE::DESIGN_RULES: return DesignRulesFileExtension;
|
||||
case TREE_FILE_TYPE::ZIP_ARCHIVE: return ArchiveFileExtension;
|
||||
case TREE_FILE_TYPE::SVG: return FILEEXT::SVGFileExtension;
|
||||
case TREE_FILE_TYPE::DRAWING_SHEET: return FILEEXT::DrawingSheetFileExtension;
|
||||
case TREE_FILE_TYPE::FOOTPRINT_FILE: return FILEEXT::KiCadFootprintFileExtension;
|
||||
case TREE_FILE_TYPE::SCHEMATIC_LIBFILE: return FILEEXT::LegacySymbolLibFileExtension;
|
||||
case TREE_FILE_TYPE::SEXPR_SYMBOL_LIB_FILE: return FILEEXT::KiCadSymbolLibFileExtension;
|
||||
case TREE_FILE_TYPE::DESIGN_RULES: return FILEEXT::DesignRulesFileExtension;
|
||||
case TREE_FILE_TYPE::ZIP_ARCHIVE: return FILEEXT::ArchiveFileExtension;
|
||||
|
||||
case TREE_FILE_TYPE::ROOT:
|
||||
case TREE_FILE_TYPE::UNKNOWN:
|
||||
|
@ -346,7 +346,8 @@ std::vector<wxString> getProjects( const wxDir& dir )
|
|||
{
|
||||
wxFileName file( dir_filename );
|
||||
|
||||
if( file.GetExt() == LegacyProjectFileExtension || file.GetExt() == ProjectFileExtension )
|
||||
if( file.GetExt() == FILEEXT::LegacyProjectFileExtension
|
||||
|| file.GetExt() == FILEEXT::ProjectFileExtension )
|
||||
projects.push_back( file.GetName() );
|
||||
|
||||
haveFile = dir.GetNext( &dir_filename );
|
||||
|
@ -622,7 +623,7 @@ void PROJECT_TREE_PANE::ReCreateTreePrj()
|
|||
fn.Clear();
|
||||
fn.SetPath( PATHS::GetDefaultUserProjectsPath() );
|
||||
fn.SetName( NAMELESS_PROJECT );
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
fn.SetExt( FILEEXT::ProjectFileExtension );
|
||||
prjReset = true;
|
||||
}
|
||||
|
||||
|
@ -647,11 +648,11 @@ void PROJECT_TREE_PANE::ReCreateTreePrj()
|
|||
// name of the migrated (new format) file, which may not have been saved to disk yet.
|
||||
if( !prjOpened && !prjReset )
|
||||
{
|
||||
fn.SetExt( LegacyProjectFileExtension );
|
||||
fn.SetExt( FILEEXT::LegacyProjectFileExtension );
|
||||
prjOpened = fn.FileExists();
|
||||
|
||||
// Set the ext back so that in the tree view we see the (not-yet-saved) new file
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
fn.SetExt( FILEEXT::ProjectFileExtension );
|
||||
}
|
||||
|
||||
// root tree:
|
||||
|
|
|
@ -70,7 +70,7 @@ wxFileName KICAD_MANAGER_CONTROL::newProjectDirectory( wxString* aFileName )
|
|||
|
||||
wxString default_dir = m_frame->GetMruPath();
|
||||
wxFileDialog dlg( m_frame, _( "Create New Project" ), default_dir, default_filename,
|
||||
ProjectFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
FILEEXT::ProjectFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
// Add a "Create a new directory" checkbox
|
||||
FILEDLG_NEW_PROJECT newProjectHook;
|
||||
|
@ -83,10 +83,10 @@ wxFileName KICAD_MANAGER_CONTROL::newProjectDirectory( wxString* aFileName )
|
|||
|
||||
// wxFileName automatically extracts an extension. But if it isn't
|
||||
// a .pro extension, we should keep it as part of the filename
|
||||
if( !pro.GetExt().IsEmpty() && pro.GetExt().ToStdString() != ProjectFileExtension )
|
||||
if( !pro.GetExt().IsEmpty() && pro.GetExt().ToStdString() != FILEEXT::ProjectFileExtension )
|
||||
pro.SetName( pro.GetName() + wxT( "." ) + pro.GetExt() );
|
||||
|
||||
pro.SetExt( ProjectFileExtension ); // enforce extension
|
||||
pro.SetExt( FILEEXT::ProjectFileExtension ); // enforce extension
|
||||
|
||||
if( !pro.IsAbsolute() )
|
||||
pro.MakeAbsolute();
|
||||
|
@ -244,7 +244,7 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
|
|||
// Get project destination folder and project file name.
|
||||
wxString default_dir = wxFileName( Prj().GetProjectFullName() ).GetPathWithSep();
|
||||
wxString title = _( "New Project Folder" );
|
||||
wxFileDialog dlg( m_frame, title, default_dir, wxEmptyString, ProjectFileWildcard(),
|
||||
wxFileDialog dlg( m_frame, title, default_dir, wxEmptyString, FILEEXT::ProjectFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
// Add a "Create a new directory" checkbox
|
||||
|
@ -258,10 +258,10 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
|
|||
|
||||
// wxFileName automatically extracts an extension. But if it isn't a .kicad_pro extension,
|
||||
// we should keep it as part of the filename
|
||||
if( !fn.GetExt().IsEmpty() && fn.GetExt().ToStdString() != ProjectFileExtension )
|
||||
if( !fn.GetExt().IsEmpty() && fn.GetExt().ToStdString() != FILEEXT::ProjectFileExtension )
|
||||
fn.SetName( fn.GetName() + wxT( "." ) + fn.GetExt() );
|
||||
|
||||
fn.SetExt( ProjectFileExtension );
|
||||
fn.SetExt( FILEEXT::ProjectFileExtension );
|
||||
|
||||
if( !fn.IsAbsolute() )
|
||||
fn.MakeAbsolute();
|
||||
|
@ -357,9 +357,9 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
|
|||
|
||||
int KICAD_MANAGER_CONTROL::openProject( const wxString& aDefaultDir )
|
||||
{
|
||||
wxString wildcard = AllProjectFilesWildcard()
|
||||
+ "|" + ProjectFileWildcard()
|
||||
+ "|" + LegacyProjectFileWildcard();
|
||||
wxString wildcard = FILEEXT::AllProjectFilesWildcard()
|
||||
+ "|" + FILEEXT::ProjectFileWildcard()
|
||||
+ "|" + FILEEXT::LegacyProjectFileWildcard();
|
||||
|
||||
wxFileDialog dlg( m_frame, _( "Open Existing Project" ), aDefaultDir, wxEmptyString, wildcard,
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
@ -440,9 +440,9 @@ public:
|
|||
wxString ext = destFile.GetExt();
|
||||
bool atRoot = destFile.GetPath() == m_projectDirPath;
|
||||
|
||||
if( ext == LegacyProjectFileExtension
|
||||
|| ext == ProjectFileExtension
|
||||
|| ext == ProjectLocalSettingsFileExtension )
|
||||
if( ext == FILEEXT::LegacyProjectFileExtension
|
||||
|| ext == FILEEXT::ProjectFileExtension
|
||||
|| ext == FILEEXT::ProjectLocalSettingsFileExtension )
|
||||
{
|
||||
wxString destPath = destFile.GetPath();
|
||||
|
||||
|
@ -456,70 +456,71 @@ public:
|
|||
{
|
||||
destFile.SetName( m_newProjectName );
|
||||
|
||||
if( atRoot && ext != ProjectLocalSettingsFileExtension )
|
||||
if( atRoot && ext != FILEEXT::ProjectLocalSettingsFileExtension )
|
||||
m_newProjectFile = destFile;
|
||||
}
|
||||
|
||||
if( ext == LegacyProjectFileExtension )
|
||||
if( ext == FILEEXT::LegacyProjectFileExtension )
|
||||
{
|
||||
// All paths in the settings file are relative so we can just do a straight copy
|
||||
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), m_errors );
|
||||
}
|
||||
else if( ext == ProjectFileExtension )
|
||||
else if( ext == FILEEXT::ProjectFileExtension )
|
||||
{
|
||||
PROJECT_FILE projectFile( aSrcFilePath );
|
||||
projectFile.LoadFromFile();
|
||||
projectFile.SaveAs( destFile.GetPath(), destFile.GetName() );
|
||||
}
|
||||
else if( ext == ProjectLocalSettingsFileExtension )
|
||||
else if( ext == FILEEXT::ProjectLocalSettingsFileExtension )
|
||||
{
|
||||
PROJECT_LOCAL_SETTINGS projectLocalSettings( nullptr, aSrcFilePath );
|
||||
projectLocalSettings.LoadFromFile();
|
||||
projectLocalSettings.SaveAs( destFile.GetPath(), destFile.GetName() );
|
||||
}
|
||||
}
|
||||
else if( ext == KiCadSchematicFileExtension
|
||||
|| ext == KiCadSchematicFileExtension + BackupFileSuffix
|
||||
|| ext == LegacySchematicFileExtension
|
||||
|| ext == LegacySchematicFileExtension + BackupFileSuffix
|
||||
|| ext == SchematicSymbolFileExtension
|
||||
|| ext == LegacySymbolLibFileExtension
|
||||
|| ext == LegacySymbolDocumentFileExtension
|
||||
|| ext == KiCadSymbolLibFileExtension
|
||||
|| ext == NetlistFileExtension
|
||||
else if( ext == FILEEXT::KiCadSchematicFileExtension
|
||||
|| ext == FILEEXT::KiCadSchematicFileExtension + FILEEXT::BackupFileSuffix
|
||||
|| ext == FILEEXT::LegacySchematicFileExtension
|
||||
|| ext == FILEEXT::LegacySchematicFileExtension + FILEEXT::BackupFileSuffix
|
||||
|| ext == FILEEXT::SchematicSymbolFileExtension
|
||||
|| ext == FILEEXT::LegacySymbolLibFileExtension
|
||||
|| ext == FILEEXT::LegacySymbolDocumentFileExtension
|
||||
|| ext == FILEEXT::KiCadSymbolLibFileExtension
|
||||
|| ext == FILEEXT::NetlistFileExtension
|
||||
|| destFile.GetName() == "sym-lib-table" )
|
||||
{
|
||||
KIFACE* eeschema = m_frame->Kiway().KiFACE( KIWAY::FACE_SCH );
|
||||
eeschema->SaveFileAs( m_projectDirPath, m_projectName, m_newProjectDirPath,
|
||||
m_newProjectName, aSrcFilePath, m_errors );
|
||||
}
|
||||
else if( ext == KiCadPcbFileExtension
|
||||
|| ext == KiCadPcbFileExtension + BackupFileSuffix
|
||||
|| ext == LegacyPcbFileExtension
|
||||
|| ext == KiCadFootprintFileExtension
|
||||
|| ext == LegacyFootprintLibPathExtension
|
||||
|| ext == FootprintAssignmentFileExtension
|
||||
else if( ext == FILEEXT::KiCadPcbFileExtension
|
||||
|| ext == FILEEXT::KiCadPcbFileExtension + FILEEXT::BackupFileSuffix
|
||||
|| ext == FILEEXT::LegacyPcbFileExtension
|
||||
|| ext == FILEEXT::KiCadFootprintFileExtension
|
||||
|| ext == FILEEXT::LegacyFootprintLibPathExtension
|
||||
|| ext == FILEEXT::FootprintAssignmentFileExtension
|
||||
|| destFile.GetName() == "fp-lib-table" )
|
||||
{
|
||||
KIFACE* pcbnew = m_frame->Kiway().KiFACE( KIWAY::FACE_PCB );
|
||||
pcbnew->SaveFileAs( m_projectDirPath, m_projectName, m_newProjectDirPath,
|
||||
m_newProjectName, aSrcFilePath, m_errors );
|
||||
}
|
||||
else if( ext == DrawingSheetFileExtension )
|
||||
else if( ext == FILEEXT::DrawingSheetFileExtension )
|
||||
{
|
||||
KIFACE* pleditor = m_frame->Kiway().KiFACE( KIWAY::FACE_PL_EDITOR );
|
||||
pleditor->SaveFileAs( m_projectDirPath, m_projectName, m_newProjectDirPath,
|
||||
m_newProjectName, aSrcFilePath, m_errors );
|
||||
}
|
||||
else if( ext == GerberJobFileExtension
|
||||
|| ext == DrillFileExtension
|
||||
|| IsGerberFileExtension(ext) )
|
||||
else if( ext == FILEEXT::GerberJobFileExtension
|
||||
|| ext == FILEEXT::DrillFileExtension
|
||||
|| FILEEXT::IsGerberFileExtension( ext ) )
|
||||
{
|
||||
KIFACE* gerbview = m_frame->Kiway().KiFACE( KIWAY::FACE_GERBVIEW );
|
||||
gerbview->SaveFileAs( m_projectDirPath, m_projectName, m_newProjectDirPath,
|
||||
m_newProjectName, aSrcFilePath, m_errors );
|
||||
}
|
||||
else if(destFile.GetName().StartsWith( LockFilePrefix ) && ext == LockFileExtension )
|
||||
else if( destFile.GetName().StartsWith( FILEEXT::LockFilePrefix )
|
||||
&& ext == FILEEXT::LockFileExtension )
|
||||
{
|
||||
// Ignore lock files
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
|
|||
{
|
||||
wxFileDialog openFileDialog( this, _( "Append Existing Drawing Sheet" ),
|
||||
wxEmptyString, wxEmptyString,
|
||||
DrawingSheetFileWildcard(), wxFD_OPEN );
|
||||
FILEEXT::DrawingSheetFileWildcard(), wxFD_OPEN );
|
||||
|
||||
if( openFileDialog.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
@ -155,7 +155,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
|
|||
case wxID_OPEN:
|
||||
{
|
||||
wxFileDialog openFileDialog( this, _( "Open Drawing Sheet" ), wxEmptyString, wxEmptyString,
|
||||
DrawingSheetFileWildcard(), wxFD_OPEN );
|
||||
FILEEXT::DrawingSheetFileWildcard(), wxFD_OPEN );
|
||||
|
||||
if( openFileDialog.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
@ -193,7 +193,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
|
|||
{
|
||||
wxString dir = PATHS::GetUserTemplatesPath();
|
||||
wxFileDialog openFileDialog( this, _( "Save Drawing Sheet As" ), dir, wxEmptyString,
|
||||
DrawingSheetFileWildcard(),
|
||||
FILEEXT::DrawingSheetFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( openFileDialog.ShowModal() == wxID_CANCEL )
|
||||
|
@ -206,8 +206,8 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
|
|||
// extension
|
||||
wxFileName fn(filename);
|
||||
|
||||
if( fn.GetExt() != DrawingSheetFileExtension )
|
||||
filename << wxT(".") << DrawingSheetFileExtension;
|
||||
if( fn.GetExt() != FILEEXT::DrawingSheetFileExtension )
|
||||
filename << wxT( "." ) << FILEEXT::DrawingSheetFileExtension;
|
||||
|
||||
if( !SaveDrawingSheetFile( filename ) )
|
||||
{
|
||||
|
|
|
@ -119,7 +119,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
|
||||
LoadSettings( config() );
|
||||
|
||||
m_acceptedExts.emplace( DrawingSheetFileExtension, nullptr );
|
||||
m_acceptedExts.emplace( FILEEXT::DrawingSheetFileExtension, nullptr );
|
||||
DragAcceptFiles( true );
|
||||
|
||||
VECTOR2I pageSizeIU = GetPageLayout().GetPageSettings().GetSizeIU( drawSheetIUScale.IU_PER_MILS );
|
||||
|
|
|
@ -82,12 +82,12 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
|
|||
|
||||
/* Set the file extension: */
|
||||
fn = GetBoard()->GetFileName();
|
||||
fn.SetExt( CsvFileExtension );
|
||||
fn.SetExt( FILEEXT::CsvFileExtension );
|
||||
|
||||
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
||||
|
||||
wxFileDialog dlg( this, _( "Save Bill of Materials" ), pro_dir, fn.GetFullName(),
|
||||
CsvFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
FILEEXT::CsvFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
|
|
@ -263,7 +263,7 @@ void DIALOG_BOARD_SETUP::onAuxiliaryAction( wxCommandEvent& aEvent )
|
|||
wxFileName boardFn( importDlg.GetFilePath() );
|
||||
wxFileName projectFn( boardFn );
|
||||
|
||||
projectFn.SetExt( ProjectFileExtension );
|
||||
projectFn.SetExt( FILEEXT::ProjectFileExtension );
|
||||
|
||||
if( !m_frame->GetSettingsManager()->LoadProject( projectFn.GetFullPath(), false ) )
|
||||
{
|
||||
|
|
|
@ -642,7 +642,7 @@ void DIALOG_BOARD_STATISTICS::saveReportClicked( wxCommandEvent& aEvent )
|
|||
wxFileName fn = m_parentFrame->GetBoard()->GetFileName();
|
||||
boardName = fn.GetName();
|
||||
wxFileDialog dlg( this, _( "Save Report File" ), s_savedDialogState.saveReportFolder,
|
||||
s_savedDialogState.saveReportName, TextFileWildcard(),
|
||||
s_savedDialogState.saveReportName, FILEEXT::TextFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
|
|
|
@ -872,10 +872,10 @@ void DIALOG_DRC::OnSeverity( wxCommandEvent& aEvent )
|
|||
|
||||
void DIALOG_DRC::OnSaveReport( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxFileName fn( "DRC." + ReportFileExtension );
|
||||
wxFileName fn( "DRC." + FILEEXT::ReportFileExtension );
|
||||
|
||||
wxFileDialog dlg( this, _( "Save Report File" ), Prj().GetProjectPath(), fn.GetFullName(),
|
||||
ReportFileWildcard() + wxS( "|" ) + JsonFileWildcard(),
|
||||
FILEEXT::ReportFileWildcard() + wxS( "|" ) + FILEEXT::JsonFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
|
@ -884,7 +884,7 @@ void DIALOG_DRC::OnSaveReport( wxCommandEvent& aEvent )
|
|||
fn = dlg.GetPath();
|
||||
|
||||
if( fn.GetExt().IsEmpty() )
|
||||
fn.SetExt( ReportFileExtension );
|
||||
fn.SetExt( FILEEXT::ReportFileExtension );
|
||||
|
||||
if( !fn.IsAbsolute() )
|
||||
{
|
||||
|
@ -896,7 +896,7 @@ void DIALOG_DRC::OnSaveReport( wxCommandEvent& aEvent )
|
|||
m_ratsnestProvider, m_fpWarningsProvider );
|
||||
|
||||
bool success = false;
|
||||
if( fn.GetExt() == JsonFileExtension )
|
||||
if( fn.GetExt() == FILEEXT::JsonFileExtension )
|
||||
success = reportWriter.WriteJsonReport( fn.GetFullPath() );
|
||||
else
|
||||
success = reportWriter.WriteTextReport( fn.GetFullPath() );
|
||||
|
|
|
@ -338,9 +338,9 @@ void DIALOG_EXPORT_STEP::onUpdateYPos( wxUpdateUIEvent& aEvent )
|
|||
void DIALOG_EXPORT_STEP::onBrowseClicked( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxString filter = _( "STEP files" )
|
||||
+ AddFileExtListToFilter( { StepFileExtension, StepFileAbrvExtension } ) + "|"
|
||||
+ AddFileExtListToFilter( { FILEEXT::StepFileExtension, FILEEXT::StepFileAbrvExtension } ) + "|"
|
||||
+ _( "Binary GTLF files" )
|
||||
+ AddFileExtListToFilter( { GltfBinaryFileExtension } );
|
||||
+ AddFileExtListToFilter( { FILEEXT::GltfBinaryFileExtension } );
|
||||
|
||||
// Build the absolute path of current output directory to preselect it in the file browser.
|
||||
wxString path = ExpandEnvVarSubstitutions( m_outputFileName->GetValue(), &Prj() );
|
||||
|
@ -442,7 +442,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
|
|||
cmdK2S.Append( wxT( " pcb" ) );
|
||||
cmdK2S.Append( wxT( " export" ) );
|
||||
|
||||
if( fn.GetExt() == GltfBinaryFileExtension )
|
||||
if( fn.GetExt() == FILEEXT::GltfBinaryFileExtension )
|
||||
cmdK2S.Append( wxT( " glb" ) );
|
||||
else
|
||||
cmdK2S.Append( wxT( " step" ) );
|
||||
|
|
|
@ -339,7 +339,7 @@ void DIALOG_EXPORT_SVG::ExportSVGFile( bool aOnlyOneFile )
|
|||
wxFileName fn( boardFilename );
|
||||
wxString suffix = aOnlyOneFile ? wxString( wxT( "brd" ) ) : m_board->GetStandardLayerName( layer );
|
||||
|
||||
BuildPlotFileName( &fn, outputDir.GetPath(), suffix, SVGFileExtension );
|
||||
BuildPlotFileName( &fn, outputDir.GetPath(), suffix, FILEEXT::SVGFileExtension );
|
||||
wxString svgPath = fn.GetFullPath();
|
||||
|
||||
m_printMaskLayer = aOnlyOneFile ? all_selected.SeqStackupForPlotting() : LSEQ( { layer } );
|
||||
|
|
|
@ -418,12 +418,12 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
|
|||
|
||||
if( useCSVfmt )
|
||||
{
|
||||
fn.SetName( fn.GetName() + wxT( "-" ) + FootprintPlaceFileExtension );
|
||||
fn.SetName( fn.GetName() + wxT( "-" ) + FILEEXT::FootprintPlaceFileExtension );
|
||||
fn.SetExt( wxT( "csv" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
fn.SetExt( FootprintPlaceFileExtension );
|
||||
fn.SetExt( FILEEXT::FootprintPlaceFileExtension );
|
||||
}
|
||||
|
||||
int fpcount = m_parent->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(), OnlySMD(),
|
||||
|
@ -464,12 +464,12 @@ bool DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles()
|
|||
|
||||
if( useCSVfmt )
|
||||
{
|
||||
fn.SetName( fn.GetName() + wxT( "-" ) + FootprintPlaceFileExtension );
|
||||
fn.SetName( fn.GetName() + wxT( "-" ) + FILEEXT::FootprintPlaceFileExtension );
|
||||
fn.SetExt( wxT( "csv" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
fn.SetExt( FootprintPlaceFileExtension );
|
||||
fn.SetExt( FILEEXT::FootprintPlaceFileExtension );
|
||||
}
|
||||
|
||||
fpcount = m_parent->DoGenFootprintsPositionFile( fn.GetFullPath(), UnitsMM(), OnlySMD(),
|
||||
|
|
|
@ -47,7 +47,7 @@ DIALOG_GENCAD_EXPORT_OPTIONS::DIALOG_GENCAD_EXPORT_OPTIONS( PCB_EDIT_FRAME* aPar
|
|||
// is set to.
|
||||
m_filePicker = new wxFilePickerCtrl( this, wxID_ANY, "",
|
||||
_("Select a GenCAD export filename"),
|
||||
GencadFileWildcard(),
|
||||
FILEEXT::GencadFileWildcard(),
|
||||
wxDefaultPosition, wxSize( -1,-1 ),
|
||||
wxFLP_SAVE|wxFLP_USE_TEXTCTRL );
|
||||
m_mainSizer->Add( m_filePicker, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 5 );
|
||||
|
|
|
@ -445,7 +445,7 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event )
|
|||
wxFileName fn = m_board->GetFileName();
|
||||
|
||||
fn.SetName( fn.GetName() + wxT( "-drl" ) );
|
||||
fn.SetExt( ReportFileExtension );
|
||||
fn.SetExt( FILEEXT::ReportFileExtension );
|
||||
|
||||
wxString defaultPath = ExpandEnvVarSubstitutions( m_plotOpts.GetOutputDirectory(), &Prj() );
|
||||
defaultPath = Prj().AbsolutePath( defaultPath );
|
||||
|
@ -454,7 +454,7 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event )
|
|||
defaultPath = PATHS::GetDefaultUserProjectsPath();
|
||||
|
||||
wxFileDialog dlg( this, _( "Save Drill Report File" ), defaultPath, fn.GetFullName(),
|
||||
ReportFileWildcard(), wxFD_SAVE );
|
||||
FILEEXT::ReportFileWildcard(), wxFD_SAVE );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
|
|
@ -133,7 +133,8 @@ void DIALOG_IMPORT_NETLIST::onBrowseNetlistFiles( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
wxFileDialog FilesDialog( this, _( "Import Netlist" ), dirPath, filename,
|
||||
NetlistFileWildcard(), wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );
|
||||
FILEEXT::NetlistFileWildcard(),
|
||||
wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( FilesDialog.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
|
|
@ -113,7 +113,8 @@ void DIALOG_IMPORT_SETTINGS::OnBrowseClicked( wxCommandEvent& event )
|
|||
wxFileName fn = m_frame->GetBoard()->GetFileName();
|
||||
|
||||
wxFileDialog dlg( this, _( "Import Settings From" ), fn.GetPath(), fn.GetFullName(),
|
||||
PcbFileWildcard(), wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
|
||||
FILEEXT::PcbFileWildcard(),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
|
||||
|
||||
if( dlg.ShowModal() == wxID_OK )
|
||||
m_filePathCtrl->SetValue( dlg.GetPath() );
|
||||
|
|
|
@ -1259,7 +1259,8 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
|
|||
wxFileName fn( boardFilename );
|
||||
|
||||
// Build gerber job file from basename
|
||||
BuildPlotFileName( &fn, outputDir.GetPath(), wxT( "job" ), GerberJobFileExtension );
|
||||
BuildPlotFileName( &fn, outputDir.GetPath(), wxT( "job" ),
|
||||
FILEEXT::GerberJobFileExtension );
|
||||
jobfile_writer.CreateJobFile( fn.GetFullPath() );
|
||||
}
|
||||
|
||||
|
|
|
@ -846,7 +846,7 @@ void PANEL_FP_LIB_TABLE::onMigrateLibraries( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
wxFileName newLib( resolvedPath );
|
||||
newLib.AppendDir( newLib.GetName() + "." + KiCadFootprintLibPathExtension );
|
||||
newLib.AppendDir( newLib.GetName() + "." + FILEEXT::KiCadFootprintLibPathExtension );
|
||||
newLib.SetName( "" );
|
||||
newLib.ClearExt();
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
// Drop the last directory if the path is a .pretty folder
|
||||
if( cfg->m_lastFootprintLibDir.EndsWith( KiCadFootprintLibPathExtension ) )
|
||||
if( cfg->m_lastFootprintLibDir.EndsWith( FILEEXT::KiCadFootprintLibPathExtension ) )
|
||||
cfg->m_lastFootprintLibDir = cfg->m_lastFootprintLibDir.BeforeLast( wxFileName::GetPathSeparator() );
|
||||
|
||||
const ENV_VAR_MAP& envVars = Pgm().GetLocalEnvVariables();
|
||||
|
@ -1023,7 +1023,8 @@ void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
|
|||
wxString nickname = LIB_ID::FixIllegalChars( fn.GetName(), true );
|
||||
bool doAdd = true;
|
||||
|
||||
if( fileType == PCB_IO_MGR::KICAD_SEXP && fn.GetExt() != KiCadFootprintLibPathExtension )
|
||||
if( fileType == PCB_IO_MGR::KICAD_SEXP
|
||||
&& fn.GetExt() != FILEEXT::KiCadFootprintLibPathExtension )
|
||||
nickname = LIB_ID::FixIllegalChars( fn.GetFullName(), true ).wx_str();
|
||||
|
||||
if( cur_model()->ContainsNickname( nickname ) )
|
||||
|
|
|
@ -728,7 +728,7 @@ void PANEL_SETUP_RULES::ImportSettingsFrom( BOARD* aBoard )
|
|||
if( !m_frame->Prj().IsNullProject() )
|
||||
{
|
||||
wxFileName relFile = aBoard->GetFileName();
|
||||
relFile.SetExt( DesignRulesFileExtension );
|
||||
relFile.SetExt( FILEEXT::DesignRulesFileExtension );
|
||||
|
||||
wxFileName absFile( aBoard->GetProject()->AbsolutePath( relFile.GetFullName() ) );
|
||||
|
||||
|
|
|
@ -371,8 +371,8 @@ void PCB_EDIT_FRAME::GenD356File( wxCommandEvent& aEvent )
|
|||
wxFileName fn = GetBoard()->GetFileName();
|
||||
wxString ext, wildcard;
|
||||
|
||||
ext = IpcD356FileExtension;
|
||||
wildcard = IpcD356FileWildcard();
|
||||
ext = FILEEXT::IpcD356FileExtension;
|
||||
wildcard = FILEEXT::IpcD356FileWildcard();
|
||||
fn.SetExt( ext );
|
||||
|
||||
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
||||
|
|
|
@ -68,10 +68,10 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
|
|||
wxString projectDir = wxPathOnly( Prj().GetProjectFullName() );
|
||||
wxFileName fn = GetBoard()->GetFileName();
|
||||
|
||||
fn.SetExt( FootprintAssignmentFileExtension );
|
||||
fn.SetExt( FILEEXT::FootprintAssignmentFileExtension );
|
||||
|
||||
wxFileDialog dlg( this, _( "Save Footprint Association File" ),
|
||||
projectDir, fn.GetFullName(), FootprintAssignmentFileWildcard(),
|
||||
wxFileDialog dlg( this, _( "Save Footprint Association File" ), projectDir, fn.GetFullName(),
|
||||
FILEEXT::FootprintAssignmentFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
|
|
|
@ -68,7 +68,7 @@ EXCELLON_WRITER::EXCELLON_WRITER( BOARD* aPcb )
|
|||
m_mirror = false;
|
||||
m_merge_PTH_NPTH = false;
|
||||
m_minimalHeader = false;
|
||||
m_drillFileExtension = DrillFileExtension;
|
||||
m_drillFileExtension = FILEEXT::DrillFileExtension;
|
||||
m_useRouteModeForOval = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ const wxString PLACEFILE_GERBER_WRITER::GetPlaceFileName( const wxString& aFullB
|
|||
wxString post_id = wxT( "-pnp_" );
|
||||
post_id += aLayer == B_Cu ? wxT( "bottom" ) : wxT( "top" );
|
||||
fn.SetName( fn.GetName() + post_id );
|
||||
fn.SetExt( GerberFileExtension );
|
||||
fn.SetExt( FILEEXT::GerberFileExtension );
|
||||
|
||||
return fn.GetFullPath();
|
||||
}
|
||||
|
|
|
@ -199,10 +199,10 @@ bool AskLoadBoardFileName( PCB_EDIT_FRAME* aParent, wxString* aFileName, int aCt
|
|||
*/
|
||||
bool AskSaveBoardFileName( PCB_EDIT_FRAME* aParent, wxString* aFileName, bool* aCreateProject )
|
||||
{
|
||||
wxString wildcard = PcbFileWildcard();
|
||||
wxString wildcard = FILEEXT::PcbFileWildcard();
|
||||
wxFileName fn = *aFileName;
|
||||
|
||||
fn.SetExt( KiCadPcbFileExtension );
|
||||
fn.SetExt( FILEEXT::KiCadPcbFileExtension );
|
||||
|
||||
wxFileDialog dlg( aParent, _( "Save Board File As" ), fn.GetPath(), fn.GetFullName(), wildcard,
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
@ -217,7 +217,7 @@ bool AskSaveBoardFileName( PCB_EDIT_FRAME* aParent, wxString* aFileName, bool* a
|
|||
return false;
|
||||
|
||||
*aFileName = dlg.GetPath();
|
||||
*aFileName = EnsureFileExtension( *aFileName, KiCadPcbFileExtension );
|
||||
*aFileName = EnsureFileExtension( *aFileName, FILEEXT::KiCadPcbFileExtension );
|
||||
|
||||
if( newProjectHook.IsAttachedToDialog() )
|
||||
*aCreateProject = newProjectHook.GetCreateNewProject();
|
||||
|
@ -407,7 +407,7 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
|
|||
savePath = PATHS::GetDefaultUserProjectsPath();
|
||||
}
|
||||
|
||||
wxFileName fn( savePath.GetPath(), orig_name, KiCadPcbFileExtension );
|
||||
wxFileName fn( savePath.GetPath(), orig_name, FILEEXT::KiCadPcbFileExtension );
|
||||
wxString filename = fn.GetFullPath();
|
||||
bool createProject = false;
|
||||
bool success = false;
|
||||
|
@ -535,7 +535,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
}
|
||||
|
||||
wxFileName pro = fullFileName;
|
||||
pro.SetExt( ProjectFileExtension );
|
||||
pro.SetExt( FILEEXT::ProjectFileExtension );
|
||||
|
||||
bool is_new = !wxFileName::IsFileReadable( fullFileName );
|
||||
|
||||
|
@ -872,7 +872,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
wxFileName fn = fullFileName;
|
||||
|
||||
if( converted )
|
||||
fn.SetExt( PcbFileExtension );
|
||||
fn.SetExt( FILEEXT::PcbFileExtension );
|
||||
|
||||
wxString fname = fn.GetFullPath();
|
||||
|
||||
|
@ -932,8 +932,8 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory,
|
|||
// please, keep it simple. prompting goes elsewhere.
|
||||
wxFileName pcbFileName = aFileName;
|
||||
|
||||
if( pcbFileName.GetExt() == LegacyPcbFileExtension )
|
||||
pcbFileName.SetExt( KiCadPcbFileExtension );
|
||||
if( pcbFileName.GetExt() == FILEEXT::LegacyPcbFileExtension )
|
||||
pcbFileName.SetExt( FILEEXT::KiCadPcbFileExtension );
|
||||
|
||||
// Write through symlinks, don't replace them
|
||||
WX_FILENAME::ResolvePossibleSymlinks( pcbFileName );
|
||||
|
@ -952,8 +952,8 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory,
|
|||
wxFileName rulesFile( pcbFileName );
|
||||
wxString msg;
|
||||
|
||||
projectFile.SetExt( ProjectFileExtension );
|
||||
rulesFile.SetExt( DesignRulesFileExtension );
|
||||
projectFile.SetExt( FILEEXT::ProjectFileExtension );
|
||||
rulesFile.SetExt( FILEEXT::DesignRulesFileExtension );
|
||||
|
||||
if( projectFile.FileExists() )
|
||||
{
|
||||
|
@ -1075,7 +1075,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory,
|
|||
|
||||
bool PCB_EDIT_FRAME::SavePcbCopy( const wxString& aFileName, bool aCreateProject )
|
||||
{
|
||||
wxFileName pcbFileName( EnsureFileExtension( aFileName, KiCadPcbFileExtension ) );
|
||||
wxFileName pcbFileName( EnsureFileExtension( aFileName, FILEEXT::KiCadPcbFileExtension ) );
|
||||
|
||||
if( !IsWritable( pcbFileName ) )
|
||||
{
|
||||
|
@ -1111,8 +1111,8 @@ bool PCB_EDIT_FRAME::SavePcbCopy( const wxString& aFileName, bool aCreateProject
|
|||
wxFileName rulesFile( pcbFileName );
|
||||
wxString msg;
|
||||
|
||||
projectFile.SetExt( ProjectFileExtension );
|
||||
rulesFile.SetExt( DesignRulesFileExtension );
|
||||
projectFile.SetExt( FILEEXT::ProjectFileExtension );
|
||||
rulesFile.SetExt( FILEEXT::DesignRulesFileExtension );
|
||||
|
||||
if( aCreateProject && !projectFile.FileExists() )
|
||||
GetSettingsManager()->SaveProjectCopy( projectFile.GetFullPath() );
|
||||
|
@ -1148,7 +1148,7 @@ bool PCB_EDIT_FRAME::doAutoSave()
|
|||
if( GetBoard()->GetFileName().IsEmpty() )
|
||||
{
|
||||
tmpFileName = wxFileName( PATHS::GetDefaultUserProjectsPath(), NAMELESS_PROJECT,
|
||||
KiCadPcbFileExtension );
|
||||
FILEEXT::KiCadPcbFileExtension );
|
||||
GetBoard()->SetFileName( tmpFileName.GetFullPath() );
|
||||
}
|
||||
else
|
||||
|
@ -1324,7 +1324,7 @@ void PCB_EDIT_FRAME::GenIPC2581File( wxCommandEvent& event )
|
|||
if( dlg.GetCompress() )
|
||||
{
|
||||
wxFileName tempfn = pcbFileName;
|
||||
tempfn.SetExt( Ipc2581FileExtension );
|
||||
tempfn.SetExt( FILEEXT::Ipc2581FileExtension );
|
||||
wxFileName zipfn = tempFile;
|
||||
zipfn.SetExt( "zip" );
|
||||
|
||||
|
|
|
@ -252,8 +252,8 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
// The selection filter doesn't need to grow in the vertical direction when docked
|
||||
m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
|
||||
|
||||
m_acceptedExts.emplace( KiCadFootprintLibPathExtension, &ACTIONS::ddAddLibrary );
|
||||
m_acceptedExts.emplace( KiCadFootprintFileExtension, &PCB_ACTIONS::ddImportFootprint );
|
||||
m_acceptedExts.emplace( FILEEXT::KiCadFootprintLibPathExtension, &ACTIONS::ddAddLibrary );
|
||||
m_acceptedExts.emplace( FILEEXT::KiCadFootprintFileExtension, &PCB_ACTIONS::ddImportFootprint );
|
||||
DragAcceptFiles( true );
|
||||
|
||||
ActivateGalCanvas();
|
||||
|
@ -942,7 +942,7 @@ void FOOTPRINT_EDIT_FRAME::UpdateTitle()
|
|||
title += footprint->GetReference();
|
||||
title += wxS( " " ) + wxString::Format( _( "[from %s]" ), Prj().GetProjectName()
|
||||
+ wxT( "." )
|
||||
+ PcbFileExtension );
|
||||
+ FILEEXT::PcbFileExtension );
|
||||
}
|
||||
else if( fpid.IsValid() )
|
||||
{
|
||||
|
@ -1363,8 +1363,8 @@ void FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng( wxCommandEvent& event )
|
|||
|
||||
wxString projectPath = wxPathOnly( Prj().GetProjectFullName() );
|
||||
|
||||
wxFileDialog dlg( this, _( "Export View as PNG" ), projectPath,
|
||||
fn.GetFullName(), PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
wxFileDialog dlg( this, _( "Export View as PNG" ), projectPath, fn.GetFullName(),
|
||||
FILEEXT::PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL || dlg.GetPath().IsEmpty() )
|
||||
return;
|
||||
|
|
|
@ -227,9 +227,9 @@ void FOOTPRINT_EDIT_FRAME::ExportFootprint( FOOTPRINT* aFootprint )
|
|||
|
||||
fn.SetName( aFootprint->GetFPID().GetLibItemName() );
|
||||
|
||||
wxString wildcard = KiCadFootprintLibFileWildcard();
|
||||
wxString wildcard = FILEEXT::KiCadFootprintLibFileWildcard();
|
||||
|
||||
fn.SetExt( KiCadFootprintFileExtension );
|
||||
fn.SetExt( FILEEXT::KiCadFootprintFileExtension );
|
||||
|
||||
if( !cfg->m_LastExportPath.empty() )
|
||||
fn.SetPath( cfg->m_LastExportPath );
|
||||
|
@ -242,7 +242,7 @@ void FOOTPRINT_EDIT_FRAME::ExportFootprint( FOOTPRINT* aFootprint )
|
|||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
||||
fn = EnsureFileExtension( dlg.GetPath(), KiCadFootprintFileExtension );
|
||||
fn = EnsureFileExtension( dlg.GetPath(), FILEEXT::KiCadFootprintFileExtension );
|
||||
cfg->m_LastExportPath = fn.GetPath();
|
||||
|
||||
try
|
||||
|
@ -320,8 +320,8 @@ wxString PCB_BASE_EDIT_FRAME::createNewLibrary( const wxString& aLibName,
|
|||
{
|
||||
fn = initialPath;
|
||||
|
||||
if( !LibraryFileBrowser( false, fn, KiCadFootprintLibPathWildcard(),
|
||||
KiCadFootprintLibPathExtension, false, isGlobal,
|
||||
if( !LibraryFileBrowser( false, fn, FILEEXT::KiCadFootprintLibPathWildcard(),
|
||||
FILEEXT::KiCadFootprintLibPathExtension, false, isGlobal,
|
||||
PATHS::GetDefaultUserFootprintsPath() ) )
|
||||
{
|
||||
return wxEmptyString;
|
||||
|
@ -331,7 +331,7 @@ wxString PCB_BASE_EDIT_FRAME::createNewLibrary( const wxString& aLibName,
|
|||
}
|
||||
else
|
||||
{
|
||||
fn = EnsureFileExtension( aLibName, KiCadFootprintLibPathExtension );
|
||||
fn = EnsureFileExtension( aLibName, FILEEXT::KiCadFootprintLibPathExtension );
|
||||
|
||||
if( !fn.IsAbsolute() )
|
||||
{
|
||||
|
@ -456,8 +456,8 @@ bool PCB_BASE_EDIT_FRAME::AddLibrary( const wxString& aFilename, FP_LIB_TABLE* a
|
|||
|
||||
if( aFilename.IsEmpty() )
|
||||
{
|
||||
if( !LibraryFileBrowser( true, fn, KiCadFootprintLibPathWildcard(),
|
||||
KiCadFootprintLibPathExtension, true, isGlobal,
|
||||
if( !LibraryFileBrowser( true, fn, FILEEXT::KiCadFootprintLibPathWildcard(),
|
||||
FILEEXT::KiCadFootprintLibPathExtension, true, isGlobal,
|
||||
PATHS::GetDefaultUserFootprintsPath() ) )
|
||||
{
|
||||
return false;
|
||||
|
@ -479,7 +479,8 @@ bool PCB_BASE_EDIT_FRAME::AddLibrary( const wxString& aFilename, FP_LIB_TABLE* a
|
|||
|
||||
// KiCad lib is our default guess. So it might not have the .pretty extension
|
||||
// In this case, the extension is part of the library name
|
||||
if( lib_type == PCB_IO_MGR::KICAD_SEXP && fn.GetExt() != KiCadFootprintLibPathExtension )
|
||||
if( lib_type == PCB_IO_MGR::KICAD_SEXP
|
||||
&& fn.GetExt() != FILEEXT::KiCadFootprintLibPathExtension )
|
||||
libName = fn.GetFullName();
|
||||
|
||||
// try to use path normalized to an environmental variable or project path
|
||||
|
|
|
@ -269,7 +269,7 @@ wxString PCB_BASE_EDIT_FRAME::GetDesignRulesPath()
|
|||
return wxEmptyString;
|
||||
|
||||
wxFileName fn = GetBoard()->GetFileName();
|
||||
fn.SetExt( DesignRulesFileExtension );
|
||||
fn.SetExt( FILEEXT::DesignRulesFileExtension );
|
||||
return Prj().AbsolutePath( fn.GetFullName() );
|
||||
}
|
||||
|
||||
|
|
|
@ -1158,7 +1158,7 @@ void PCB_BASE_FRAME::setFPWatcher( FOOTPRINT* aFootprint )
|
|||
}
|
||||
|
||||
m_watcherFileName.Assign( libfullname, aFootprint->GetFPID().GetLibItemName(),
|
||||
KiCadFootprintFileExtension );
|
||||
FILEEXT::KiCadFootprintFileExtension );
|
||||
|
||||
if( !m_watcherFileName.FileExists() )
|
||||
return;
|
||||
|
|
|
@ -487,8 +487,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
this );
|
||||
Bind( EDA_EVT_CLOSE_NET_INSPECTOR_DIALOG, &PCB_EDIT_FRAME::onCloseNetInspectorDialog, this );
|
||||
Bind( EDA_EVT_UNITS_CHANGED, &PCB_EDIT_FRAME::onUnitsChanged, this );
|
||||
m_acceptedExts.emplace( KiCadPcbFileExtension, &PCB_ACTIONS::ddAppendBoard );
|
||||
m_acceptedExts.emplace( LegacyPcbFileExtension, &PCB_ACTIONS::ddAppendBoard );
|
||||
m_acceptedExts.emplace( FILEEXT::KiCadPcbFileExtension, &PCB_ACTIONS::ddAppendBoard );
|
||||
m_acceptedExts.emplace( FILEEXT::LegacyPcbFileExtension, &PCB_ACTIONS::ddAppendBoard );
|
||||
DragAcceptFiles( true );
|
||||
}
|
||||
|
||||
|
@ -1836,13 +1836,13 @@ int PCB_EDIT_FRAME::TestStandalone()
|
|||
if( !frame->IsShownOnScreen() )
|
||||
{
|
||||
wxFileName fn( Prj().GetProjectPath(), Prj().GetProjectName(),
|
||||
KiCadSchematicFileExtension );
|
||||
FILEEXT::KiCadSchematicFileExtension );
|
||||
|
||||
// Maybe the file hasn't been converted to the new s-expression file format so
|
||||
// see if the legacy schematic file is still in play.
|
||||
if( !fn.FileExists() )
|
||||
{
|
||||
fn.SetExt( LegacySchematicFileExtension );
|
||||
fn.SetExt( FILEEXT::LegacySchematicFileExtension );
|
||||
|
||||
if( !fn.FileExists() )
|
||||
{
|
||||
|
@ -1922,12 +1922,12 @@ void PCB_EDIT_FRAME::RunEeschema()
|
|||
{
|
||||
wxString msg;
|
||||
wxFileName schematic( Prj().GetProjectPath(), Prj().GetProjectName(),
|
||||
KiCadSchematicFileExtension );
|
||||
FILEEXT::KiCadSchematicFileExtension );
|
||||
|
||||
if( !schematic.FileExists() )
|
||||
{
|
||||
wxFileName legacySchematic( Prj().GetProjectPath(), Prj().GetProjectName(),
|
||||
LegacySchematicFileExtension );
|
||||
FILEEXT::LegacySchematicFileExtension );
|
||||
|
||||
if( legacySchematic.FileExists() )
|
||||
{
|
||||
|
|
|
@ -230,7 +230,7 @@ void GPCB_FPL_CACHE::Load()
|
|||
}
|
||||
|
||||
wxString fullName;
|
||||
wxString fileSpec = wxT( "*." ) + GedaPcbFootprintLibFileExtension;
|
||||
wxString fileSpec = wxT( "*." ) + FILEEXT::GedaPcbFootprintLibFileExtension;
|
||||
|
||||
// wxFileName construction is egregiously slow. Construct it once and just swap out
|
||||
// the filename thereafter.
|
||||
|
@ -301,7 +301,7 @@ bool GPCB_FPL_CACHE::IsModified()
|
|||
|
||||
long long GPCB_FPL_CACHE::GetTimestamp( const wxString& aLibPath )
|
||||
{
|
||||
wxString fileSpec = wxT( "*." ) + GedaPcbFootprintLibFileExtension;
|
||||
wxString fileSpec = wxT( "*." ) + FILEEXT::GedaPcbFootprintLibFileExtension;
|
||||
|
||||
return TimestampDir( aLibPath, fileSpec );
|
||||
}
|
||||
|
@ -1001,7 +1001,7 @@ bool PCB_IO_GEDA::DeleteLibrary( const wxString& aLibraryPath, const STRING_UTF8
|
|||
{
|
||||
tmp = files[i];
|
||||
|
||||
if( tmp.GetExt() != KiCadFootprintFileExtension )
|
||||
if( tmp.GetExt() != FILEEXT::KiCadFootprintFileExtension )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format( _( "Unexpected file '%s' found in library '%s'." ),
|
||||
files[i].GetData(),
|
||||
|
|
|
@ -170,7 +170,7 @@ void FP_CACHE::Load()
|
|||
}
|
||||
|
||||
wxString fullName;
|
||||
wxString fileSpec = wxT( "*." ) + KiCadFootprintFileExtension;
|
||||
wxString fileSpec = wxT( "*." ) + FILEEXT::KiCadFootprintFileExtension;
|
||||
|
||||
// wxFileName construction is egregiously slow. Construct it once and just swap out
|
||||
// the filename thereafter.
|
||||
|
@ -267,7 +267,7 @@ bool FP_CACHE::IsModified()
|
|||
|
||||
long long FP_CACHE::GetTimestamp( const wxString& aLibPath )
|
||||
{
|
||||
wxString fileSpec = wxT( "*." ) + KiCadFootprintFileExtension;
|
||||
wxString fileSpec = wxT( "*." ) + FILEEXT::KiCadFootprintFileExtension;
|
||||
|
||||
return TimestampDir( aLibPath, fileSpec );
|
||||
}
|
||||
|
@ -2574,7 +2574,7 @@ bool PCB_IO_KICAD_SEXPR::FootprintExists( const wxString& aLibraryPath, const wx
|
|||
// case-insensitive filesystem) handled "for free".
|
||||
// Warning: footprint names frequently contain a point. So be careful when initializing
|
||||
// wxFileName, and use a CTOR with extension specified
|
||||
wxFileName footprintFile( aLibraryPath, aFootprintName, KiCadFootprintFileExtension );
|
||||
wxFileName footprintFile( aLibraryPath, aFootprintName, FILEEXT::KiCadFootprintFileExtension );
|
||||
|
||||
return footprintFile.Exists();
|
||||
}
|
||||
|
@ -2663,7 +2663,7 @@ void PCB_IO_KICAD_SEXPR::FootprintSave( const wxString& aLibraryPath, const FOOT
|
|||
|
||||
// Quietly overwrite footprint and delete footprint file from path for any by same name.
|
||||
wxFileName fn( aLibraryPath, aFootprint->GetFPID().GetLibItemName(),
|
||||
KiCadFootprintFileExtension );
|
||||
FILEEXT::KiCadFootprintFileExtension );
|
||||
|
||||
// Write through symlinks, don't replace them
|
||||
WX_FILENAME::ResolvePossibleSymlinks( fn );
|
||||
|
@ -2798,7 +2798,7 @@ bool PCB_IO_KICAD_SEXPR::DeleteLibrary( const wxString& aLibraryPath, const STRI
|
|||
{
|
||||
tmp = files[i];
|
||||
|
||||
if( tmp.GetExt() != KiCadFootprintFileExtension )
|
||||
if( tmp.GetExt() != FILEEXT::KiCadFootprintFileExtension )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format( _( "Unexpected file '%s' found in library "
|
||||
"path '%s'." ),
|
||||
|
|
|
@ -504,26 +504,28 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aSrcPr
|
|||
|
||||
destFile.SetPath( destPath );
|
||||
|
||||
if( ext == KiCadPcbFileExtension || ext == KiCadPcbFileExtension + BackupFileSuffix )
|
||||
if( ext == FILEEXT::KiCadPcbFileExtension
|
||||
|| ext == FILEEXT::KiCadPcbFileExtension + FILEEXT::BackupFileSuffix )
|
||||
{
|
||||
if( destFile.GetName() == aSrcProjectName )
|
||||
destFile.SetName( aNewProjectName );
|
||||
|
||||
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
||||
}
|
||||
else if( ext == LegacyPcbFileExtension )
|
||||
else if( ext == FILEEXT::LegacyPcbFileExtension )
|
||||
{
|
||||
if( destFile.GetName() == aSrcProjectName )
|
||||
destFile.SetName( aNewProjectName );
|
||||
|
||||
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
||||
}
|
||||
else if( ext == LegacyFootprintLibPathExtension || ext == KiCadFootprintFileExtension )
|
||||
else if( ext == FILEEXT::LegacyFootprintLibPathExtension
|
||||
|| ext == FILEEXT::KiCadFootprintFileExtension )
|
||||
{
|
||||
// Footprints are not project-specific. Keep their source names.
|
||||
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
||||
}
|
||||
else if( ext == FootprintAssignmentFileExtension )
|
||||
else if( ext == FILEEXT::FootprintAssignmentFileExtension )
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
|
|
@ -415,7 +415,7 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob )
|
|||
if( plotOpts.GetUseGerberProtelExtensions() )
|
||||
fileExt = GetGerberProtelExtension( layer );
|
||||
else
|
||||
fileExt = GerberFileExtension;
|
||||
fileExt = FILEEXT::GerberFileExtension;
|
||||
|
||||
BuildPlotFileName( &fn, aGerberJob->m_outputFile, brd->GetLayerName( layer ), fileExt );
|
||||
wxString fullname = fn.GetFullName();
|
||||
|
@ -447,7 +447,8 @@ int PCBNEW_JOBS_HANDLER::JobExportGerbers( JOB* aJob )
|
|||
wxFileName fn( aGerberJob->m_filename );
|
||||
|
||||
// Build gerber job file from basename
|
||||
BuildPlotFileName( &fn, aGerberJob->m_outputFile, wxT( "job" ), GerberJobFileExtension );
|
||||
BuildPlotFileName( &fn, aGerberJob->m_outputFile, wxT( "job" ),
|
||||
FILEEXT::GerberJobFileExtension );
|
||||
jobfile_writer.CreateJobFile( fn.GetFullPath() );
|
||||
|
||||
return exitCode;
|
||||
|
@ -671,11 +672,11 @@ int PCBNEW_JOBS_HANDLER::JobExportPos( JOB* aJob )
|
|||
fn.SetName( fn.GetName() );
|
||||
|
||||
if( aPosJob->m_format == JOB_EXPORT_PCB_POS::FORMAT::ASCII )
|
||||
fn.SetExt( FootprintPlaceFileExtension );
|
||||
fn.SetExt( FILEEXT::FootprintPlaceFileExtension );
|
||||
else if( aPosJob->m_format == JOB_EXPORT_PCB_POS::FORMAT::CSV )
|
||||
fn.SetExt( CsvFileExtension );
|
||||
fn.SetExt( FILEEXT::CsvFileExtension );
|
||||
else if( aPosJob->m_format == JOB_EXPORT_PCB_POS::FORMAT::GERBER )
|
||||
fn.SetExt( GerberFileExtension );
|
||||
fn.SetExt( FILEEXT::GerberFileExtension );
|
||||
|
||||
aPosJob->m_outputFile = fn.GetFullName();
|
||||
}
|
||||
|
@ -898,7 +899,7 @@ int PCBNEW_JOBS_HANDLER::doFpExportSvg( JOB_FP_EXPORT_SVG* aSvgJob, const FOOTPR
|
|||
wxFileName outputFile;
|
||||
outputFile.SetPath( aSvgJob->m_outputDirectory );
|
||||
outputFile.SetName( aFootprint->GetFPID().GetLibItemName().wx_str() );
|
||||
outputFile.SetExt( SVGFileExtension );
|
||||
outputFile.SetExt( FILEEXT::SVGFileExtension );
|
||||
|
||||
m_reporter->Report( wxString::Format( _( "Plotting footprint '%s' to '%s'\n" ),
|
||||
aFootprint->GetFPID().GetLibItemName().wx_str(),
|
||||
|
@ -942,9 +943,9 @@ int PCBNEW_JOBS_HANDLER::JobExportDrc( JOB* aJob )
|
|||
fn.SetName( fn.GetName() );
|
||||
|
||||
if( drcJob->m_format == JOB_PCB_DRC::OUTPUT_FORMAT::JSON )
|
||||
fn.SetExt( JsonFileExtension );
|
||||
fn.SetExt( FILEEXT::JsonFileExtension );
|
||||
else
|
||||
fn.SetExt( ReportFileExtension );
|
||||
fn.SetExt( FILEEXT::ReportFileExtension );
|
||||
|
||||
drcJob->m_outputFile = fn.GetFullName();
|
||||
}
|
||||
|
|
|
@ -86,9 +86,9 @@ void ScriptingOnDestructPcbEditFrame( PCB_EDIT_FRAME* aPcbEditFrame )
|
|||
|
||||
BOARD* LoadBoard( wxString& aFileName )
|
||||
{
|
||||
if( aFileName.EndsWith( KiCadPcbFileExtension ) )
|
||||
if( aFileName.EndsWith( FILEEXT::KiCadPcbFileExtension ) )
|
||||
return LoadBoard( aFileName, PCB_IO_MGR::KICAD_SEXP );
|
||||
else if( aFileName.EndsWith( LegacyPcbFileExtension ) )
|
||||
else if( aFileName.EndsWith( FILEEXT::LegacyPcbFileExtension ) )
|
||||
return LoadBoard( aFileName, PCB_IO_MGR::LEGACY );
|
||||
|
||||
// as fall back for any other kind use the legacy format
|
||||
|
@ -137,7 +137,7 @@ PROJECT* GetDefaultProject()
|
|||
BOARD* LoadBoard( wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat )
|
||||
{
|
||||
wxFileName pro = aFileName;
|
||||
pro.SetExt( ProjectFileExtension );
|
||||
pro.SetExt( FILEEXT::ProjectFileExtension );
|
||||
pro.MakeAbsolute();
|
||||
wxString projectPath = pro.GetFullPath();
|
||||
|
||||
|
@ -194,7 +194,7 @@ BOARD* LoadBoard( wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat )
|
|||
try
|
||||
{
|
||||
wxFileName rules = pro;
|
||||
rules.SetExt( DesignRulesFileExtension );
|
||||
rules.SetExt( FILEEXT::DesignRulesFileExtension );
|
||||
bds.m_DRCEngine->InitEngine( rules );
|
||||
}
|
||||
catch( ... )
|
||||
|
@ -219,7 +219,7 @@ BOARD* NewBoard( wxString& aFileName )
|
|||
{
|
||||
wxFileName boardFn = aFileName;
|
||||
wxFileName proFn = aFileName;
|
||||
proFn.SetExt( ProjectFileExtension );
|
||||
proFn.SetExt( FILEEXT::ProjectFileExtension );
|
||||
proFn.MakeAbsolute();
|
||||
|
||||
wxString projectPath = proFn.GetFullPath();
|
||||
|
@ -278,7 +278,7 @@ bool SaveBoard( wxString& aFileName, BOARD* aBoard, PCB_IO_MGR::PCB_FILE_T aForm
|
|||
if( !aSkipSettings )
|
||||
{
|
||||
wxFileName pro = aFileName;
|
||||
pro.SetExt( ProjectFileExtension );
|
||||
pro.SetExt( FILEEXT::ProjectFileExtension );
|
||||
pro.MakeAbsolute();
|
||||
|
||||
GetSettingsManager()->SaveProjectAs( pro.GetFullPath(), aBoard->GetProject() );
|
||||
|
@ -503,7 +503,7 @@ bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits,
|
|||
wxCHECK( engine, false );
|
||||
|
||||
wxFileName fn = aBoard->GetFileName();
|
||||
fn.SetExt( DesignRulesFileExtension );
|
||||
fn.SetExt( FILEEXT::DesignRulesFileExtension );
|
||||
PROJECT* prj = nullptr;
|
||||
|
||||
if( aBoard->GetProject() )
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue