Make it easier to open legacy files.

This commit is contained in:
Jeff Young 2021-11-18 22:31:18 +00:00
parent 396b4c1b89
commit c01649fc6e
7 changed files with 22 additions and 18 deletions

View File

@ -290,11 +290,6 @@ bool PGM_BASE::InitPgm( bool aHeadless, bool aSkipPyInit )
if( !aSkipPyInit )
m_python_scripting = std::make_unique<SCRIPTING>();
#ifdef __WXMAC__
// Always show filters on Open dialog to be able to choose plugin
wxSystemOptions::SetOption( wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES, 1 );
#endif
// TODO(JE): Remove this if apps are refactored to not assume Prj() always works
// Need to create a project early for now (it can have an empty path for the moment)
GetSettingsManager().LoadProject( "" );

View File

@ -230,6 +230,13 @@ wxString AllProjectFilesWildcard()
}
wxString AllSchematicFilesWildcard()
{
return _( "All KiCad schematic files" )
+ AddFileExtListToFilter( { KiCadSchematicFileExtension, LegacySchematicFileExtension } );
}
wxString LegacySchematicFileWildcard()
{
return _( "KiCad legacy schematic files" )

View File

@ -971,9 +971,9 @@ void SCH_EDIT_FRAME::NewProject()
void SCH_EDIT_FRAME::LoadProject()
{
wxString pro_dir = m_mruPath;
wxString wildcards = KiCadSchematicFileWildcard();
wildcards += "|" + LegacySchematicFileWildcard();
wxString wildcards = AllSchematicFilesWildcard()
+ "|" + KiCadSchematicFileWildcard()
+ "|" + LegacySchematicFileWildcard();
wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir, wxEmptyString,
wildcards, wxFD_OPEN | wxFD_FILE_MUST_EXIST );

View File

@ -47,9 +47,9 @@ void SYMBOL_EDIT_FRAME::ImportSymbol()
return;
}
wxString wildcards = KiCadSymbolLibFileWildcard();
wildcards += "|" + LegacySymbolLibFileWildcard();
wxString wildcards = AllSymbolLibFilesWildcard()
+ "|" + KiCadSymbolLibFileWildcard()
+ "|" + LegacySymbolLibFileWildcard();
wxFileDialog dlg( this, _( "Import Symbol" ), m_mruPath, wxEmptyString,
wildcards, wxFD_OPEN | wxFD_FILE_MUST_EXIST );

View File

@ -188,6 +188,7 @@ extern wxString AllSymbolLibFilesWildcard();
extern wxString ProjectFileWildcard();
extern wxString LegacyProjectFileWildcard();
extern wxString AllProjectFilesWildcard();
extern wxString AllSchematicFilesWildcard();
extern wxString KiCadSchematicFileWildcard();
extern wxString LegacySchematicFileWildcard();
extern wxString BoardFileWildcard();

View File

@ -296,8 +296,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 = AllProjectFilesWildcard()
+ "|" + ProjectFileWildcard()
+ "|" + LegacyProjectFileWildcard();
wxFileDialog dlg( m_frame, _( "Open Existing Project" ), aDefaultDir, wxEmptyString, wildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );

View File

@ -141,8 +141,8 @@ bool AskLoadBoardFileName( PCB_EDIT_FRAME* aParent, int* aCtl, wxString* aFileNa
fileExtensions.push_back( plugin->GetFileExtension().ToStdString() );
}
fileFilters = _( "All KiCad Board Files" ) + AddFileExtListToFilter( fileExtensions ) + "|"
+ fileFilters;
fileFilters = _( "All KiCad Board Files" ) + AddFileExtListToFilter( fileExtensions )
+ "|" + fileFilters;
}
else
{
@ -160,7 +160,8 @@ bool AskLoadBoardFileName( PCB_EDIT_FRAME* aParent, int* aCtl, wxString* aFileNa
allWildcards += "*." + formatWildcardExt( plugin->GetFileExtension() ) + ";";
}
fileFilters = _( "All supported formats|" ) + allWildcards + "|" + fileFilters;
fileFilters = _( "All supported formats|" ) + allWildcards
+ "|" + fileFilters;
}
@ -183,8 +184,7 @@ bool AskLoadBoardFileName( PCB_EDIT_FRAME* aParent, int* aCtl, wxString* aFileNa
wxFileDialog dlg( aParent,
aKicadFilesOnly ? _( "Open Board File" ) : _( "Import Non KiCad Board File" ),
path, name, fileFilters,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
path, name, fileFilters, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_OK )
{