Loading common/wildcards_and_files_ext.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -55,6 +55,7 @@ const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" ) const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) ); const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) ); const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) ); const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) ); const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) ); const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) ); const wxString EaglePcbFileWildcard( _( "Eagle printed circuit board files (*.brd)|*.brd" ) ); const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) ); const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) ); const wxString FootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) ); const wxString FootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) ); const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) ); const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) ); Loading include/wildcards_and_files_ext.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,7 @@ extern const wxString NetlistFileWildcard; extern const wxString GerberFileWildcard; extern const wxString GerberFileWildcard; extern const wxString LegacyPcbFileWildcard; extern const wxString LegacyPcbFileWildcard; extern const wxString PcbFileWildcard; extern const wxString PcbFileWildcard; extern const wxString EaglePcbFileWildcard; extern const wxString PdfFileWildcard; extern const wxString PdfFileWildcard; extern const wxString MacrosFileWildcard; extern const wxString MacrosFileWildcard; extern const wxString AllFilesWildcard; extern const wxString AllFilesWildcard; Loading pcbnew/files.cpp +59 −37 Original line number Original line Diff line number Diff line Loading @@ -121,8 +121,8 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) fn.SetExt( PcbFileExtension ); fn.SetExt( PcbFileExtension ); GetScreen()->SetFileName( fn.GetFullPath() ); GetScreen()->SetFileName( fn.GetFullPath() ); UpdateTitle(); UpdateTitle(); break; } } break; case ID_APPEND_FILE: case ID_APPEND_FILE: LoadOnePcbFile( wxEmptyString, true ); LoadOnePcbFile( wxEmptyString, true ); Loading Loading @@ -154,8 +154,6 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) bool PCB_EDIT_FRAME::LoadOnePcbFile( const wxString& aFileName, bool aAppend, bool PCB_EDIT_FRAME::LoadOnePcbFile( const wxString& aFileName, bool aAppend, bool aForceFileDialog ) bool aForceFileDialog ) { { wxString msg; if( GetScreen()->IsModify() && !aAppend ) if( GetScreen()->IsModify() && !aAppend ) { { if( !IsOK( this, _( "The current board has been modified. Do you wish to discard \ if( !IsOK( this, _( "The current board has been modified. Do you wish to discard \ Loading @@ -172,10 +170,30 @@ the changes?" ) ) ) wxFileName fileName = aFileName; wxFileName fileName = aFileName; IO_MGR::PCB_FILE_T pluginType = IO_MGR::LEGACY; static const struct { const wxString& filter; IO_MGR::PCB_FILE_T pluginType; } loaders[] = { { LegacyPcbFileWildcard, IO_MGR::LEGACY }, { PcbFileWildcard, IO_MGR::KICAD }, { EaglePcbFileWildcard, IO_MGR::EAGLE }, }; if( !fileName.IsOk() || !fileName.FileExists() || aForceFileDialog ) if( !fileName.IsOk() || !fileName.FileExists() || aForceFileDialog ) { { wxString name; wxString name; wxString path = wxGetCwd(); wxString path = wxGetCwd(); wxString fileFilters; for( unsigned i = 0; i<DIM( loaders ); ++i ) { if( i > 0 ) fileFilters += wxChar( '|' ); fileFilters += loaders[i].filter; } if( aForceFileDialog && fileName.FileExists() ) if( aForceFileDialog && fileName.FileExists() ) { { Loading @@ -183,7 +201,7 @@ the changes?" ) ) ) name = fileName.GetFullName(); name = fileName.GetFullName(); } } wxFileDialog dlg( this, _( "Open Board File" ), path, name, LegacyPcbFileWildcard, wxFileDialog dlg( this, _( "Open Board File" ), path, name, fileFilters, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL ) Loading @@ -191,10 +209,15 @@ the changes?" ) ) ) fileName = dlg.GetPath(); fileName = dlg.GetPath(); if( !fileName.HasExt() ) int chosenFilter = dlg.GetFilterIndex(); fileName.SetExt( PcbFileExtension ); pluginType = loaders[chosenFilter].pluginType; } } PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) ); if( !fileName.HasExt() ) fileName.SetExt( pi->GetFileExtension() ); if( !aAppend ) if( !aAppend ) Clear_Pcb( false ); // pass false since we prompted above for a modified board Clear_Pcb( false ); // pass false since we prompted above for a modified board Loading Loading @@ -224,13 +247,12 @@ the changes?" ) ) ) try try { { // load or append either: // load or append either: loadedBoard = IO_MGR::Load( IO_MGR::LEGACY, GetScreen()->GetFileName(), loadedBoard = pi->Load( GetScreen()->GetFileName(), aAppend ? GetBoard() : NULL, NULL ); aAppend ? GetBoard() : NULL, NULL ); if( !aAppend ) if( !aAppend ) { { if( loadedBoard->GetFileFormatVersionAtLoad() < LEGACY_BOARD_FILE_VERSION ) if( pluginType == IO_MGR::LEGACY && loadedBoard->GetFileFormatVersionAtLoad() < LEGACY_BOARD_FILE_VERSION ) { { DisplayInfoMessage( this, _( "This file was created by an older \ DisplayInfoMessage( this, _( "This file was created by an older \ version of Pcbnew. It will be stored in the new file format when you save \ version of Pcbnew. It will be stored in the new file format when you save \ Loading Loading
common/wildcards_and_files_ext.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -55,6 +55,7 @@ const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" ) const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) ); const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) ); const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) ); const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) ); const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) ); const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) ); const wxString EaglePcbFileWildcard( _( "Eagle printed circuit board files (*.brd)|*.brd" ) ); const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) ); const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) ); const wxString FootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) ); const wxString FootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) ); const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) ); const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) ); Loading
include/wildcards_and_files_ext.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -63,6 +63,7 @@ extern const wxString NetlistFileWildcard; extern const wxString GerberFileWildcard; extern const wxString GerberFileWildcard; extern const wxString LegacyPcbFileWildcard; extern const wxString LegacyPcbFileWildcard; extern const wxString PcbFileWildcard; extern const wxString PcbFileWildcard; extern const wxString EaglePcbFileWildcard; extern const wxString PdfFileWildcard; extern const wxString PdfFileWildcard; extern const wxString MacrosFileWildcard; extern const wxString MacrosFileWildcard; extern const wxString AllFilesWildcard; extern const wxString AllFilesWildcard; Loading
pcbnew/files.cpp +59 −37 Original line number Original line Diff line number Diff line Loading @@ -121,8 +121,8 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) fn.SetExt( PcbFileExtension ); fn.SetExt( PcbFileExtension ); GetScreen()->SetFileName( fn.GetFullPath() ); GetScreen()->SetFileName( fn.GetFullPath() ); UpdateTitle(); UpdateTitle(); break; } } break; case ID_APPEND_FILE: case ID_APPEND_FILE: LoadOnePcbFile( wxEmptyString, true ); LoadOnePcbFile( wxEmptyString, true ); Loading Loading @@ -154,8 +154,6 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) bool PCB_EDIT_FRAME::LoadOnePcbFile( const wxString& aFileName, bool aAppend, bool PCB_EDIT_FRAME::LoadOnePcbFile( const wxString& aFileName, bool aAppend, bool aForceFileDialog ) bool aForceFileDialog ) { { wxString msg; if( GetScreen()->IsModify() && !aAppend ) if( GetScreen()->IsModify() && !aAppend ) { { if( !IsOK( this, _( "The current board has been modified. Do you wish to discard \ if( !IsOK( this, _( "The current board has been modified. Do you wish to discard \ Loading @@ -172,10 +170,30 @@ the changes?" ) ) ) wxFileName fileName = aFileName; wxFileName fileName = aFileName; IO_MGR::PCB_FILE_T pluginType = IO_MGR::LEGACY; static const struct { const wxString& filter; IO_MGR::PCB_FILE_T pluginType; } loaders[] = { { LegacyPcbFileWildcard, IO_MGR::LEGACY }, { PcbFileWildcard, IO_MGR::KICAD }, { EaglePcbFileWildcard, IO_MGR::EAGLE }, }; if( !fileName.IsOk() || !fileName.FileExists() || aForceFileDialog ) if( !fileName.IsOk() || !fileName.FileExists() || aForceFileDialog ) { { wxString name; wxString name; wxString path = wxGetCwd(); wxString path = wxGetCwd(); wxString fileFilters; for( unsigned i = 0; i<DIM( loaders ); ++i ) { if( i > 0 ) fileFilters += wxChar( '|' ); fileFilters += loaders[i].filter; } if( aForceFileDialog && fileName.FileExists() ) if( aForceFileDialog && fileName.FileExists() ) { { Loading @@ -183,7 +201,7 @@ the changes?" ) ) ) name = fileName.GetFullName(); name = fileName.GetFullName(); } } wxFileDialog dlg( this, _( "Open Board File" ), path, name, LegacyPcbFileWildcard, wxFileDialog dlg( this, _( "Open Board File" ), path, name, fileFilters, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL ) Loading @@ -191,10 +209,15 @@ the changes?" ) ) ) fileName = dlg.GetPath(); fileName = dlg.GetPath(); if( !fileName.HasExt() ) int chosenFilter = dlg.GetFilterIndex(); fileName.SetExt( PcbFileExtension ); pluginType = loaders[chosenFilter].pluginType; } } PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) ); if( !fileName.HasExt() ) fileName.SetExt( pi->GetFileExtension() ); if( !aAppend ) if( !aAppend ) Clear_Pcb( false ); // pass false since we prompted above for a modified board Clear_Pcb( false ); // pass false since we prompted above for a modified board Loading Loading @@ -224,13 +247,12 @@ the changes?" ) ) ) try try { { // load or append either: // load or append either: loadedBoard = IO_MGR::Load( IO_MGR::LEGACY, GetScreen()->GetFileName(), loadedBoard = pi->Load( GetScreen()->GetFileName(), aAppend ? GetBoard() : NULL, NULL ); aAppend ? GetBoard() : NULL, NULL ); if( !aAppend ) if( !aAppend ) { { if( loadedBoard->GetFileFormatVersionAtLoad() < LEGACY_BOARD_FILE_VERSION ) if( pluginType == IO_MGR::LEGACY && loadedBoard->GetFileFormatVersionAtLoad() < LEGACY_BOARD_FILE_VERSION ) { { DisplayInfoMessage( this, _( "This file was created by an older \ DisplayInfoMessage( this, _( "This file was created by an older \ version of Pcbnew. It will be stored in the new file format when you save \ version of Pcbnew. It will be stored in the new file format when you save \ Loading