Revert modifications to SCH_EDIT_FRAME::OpenProjectFiles()

This commit is contained in:
Maciej Suminski 2017-09-12 20:59:28 +02:00
parent e75d76d1a8
commit 6b44d12bd8
2 changed files with 2 additions and 16 deletions

View File

@ -71,7 +71,7 @@ const wxString GedaPcbFootprintLibFileExtension( wxT( "fp" ) );
const wxString SchematicSymbolFileWildcard( _( "KiCad drawing symbol file (*.sym)|*.sym" ) ); const wxString SchematicSymbolFileWildcard( _( "KiCad drawing symbol file (*.sym)|*.sym" ) );
const wxString SchematicLibraryFileWildcard( _( "KiCad component library file (*.lib)|*.lib" ) ); const wxString SchematicLibraryFileWildcard( _( "KiCad component library file (*.lib)|*.lib" ) );
const wxString ProjectFileWildcard( _( "KiCad project files (*.pro)|*.pro" ) ); const wxString ProjectFileWildcard( _( "KiCad project files (*.pro)|*.pro" ) );
const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch|Eagle 6.x XML schematic file (*.sch)|*.sch" ) ); const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" ) );
const wxString EagleSchematicFileWildcard( _( "Eagle XML schematic file (*.sch)|*.sch" ) ); const wxString EagleSchematicFileWildcard( _( "Eagle XML schematic file (*.sch)|*.sch" ) );
const wxString EagleFilesWildcard( _( "Eagle XML files (*.sch *.brd)|*.sch;*.brd" ) ); const wxString EagleFilesWildcard( _( "Eagle XML files (*.sch *.brd)|*.sch;*.brd" ) );
const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) ); const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) );

View File

@ -315,24 +315,10 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
{ {
delete g_RootSheet; // Delete the current project. delete g_RootSheet; // Delete the current project.
g_RootSheet = NULL; // Force CreateScreens() to build new empty project on load failure. g_RootSheet = NULL; // Force CreateScreens() to build new empty project on load failure.
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi; SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
// Iterate through the available plugins to determine the file type
for( auto pluginType : SCH_IO_MGR::SCH_FILE_T_vector )
{
pi.set( SCH_IO_MGR::FindPlugin( pluginType ) );
if( pi && pi->CheckHeader( fullFileName ) )
break; // got the right plugin
else
pi.set( nullptr ); // do not give a false impression that we have a valid plugin
}
try try
{ {
if( !pi )
THROW_IO_ERROR( _( "File format not recognized" ) );
g_RootSheet = pi->Load( fullFileName, &Kiway() ); g_RootSheet = pi->Load( fullFileName, &Kiway() );
m_CurrentSheet->clear(); m_CurrentSheet->clear();
m_CurrentSheet->push_back( g_RootSheet ); m_CurrentSheet->push_back( g_RootSheet );