Make import/export flags explicit
IO plugins can import/export or both. This sets an explicit boolean for controlling which options are available.
This commit is contained in:
parent
eeee63186d
commit
ef62b01dd1
|
@ -715,7 +715,7 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
|
|||
|
||||
const IO_BASE::IO_FILE_DESC& desc = pi->GetSchematicFileDesc();
|
||||
|
||||
if( desc.m_FileExtensions.empty() )
|
||||
if( desc.m_FileExtensions.empty() || !desc.m_CanRead )
|
||||
continue;
|
||||
|
||||
if( !fileFiltersStr.IsEmpty() )
|
||||
|
|
|
@ -41,12 +41,15 @@ public:
|
|||
std::vector<std::string> m_FileExtensions; ///< Filter used for file pickers if m_IsFile is true
|
||||
std::vector<std::string> m_ExtensionsInDir; ///< In case of folders: extensions of files inside
|
||||
bool m_IsFile; ///< Whether the library is a folder or a file
|
||||
bool m_CanRead; ///< Whether the IO can read this file type
|
||||
bool m_CanWrite; ///< Whether the IO can write this file type
|
||||
|
||||
IO_FILE_DESC( const wxString& aDescription, const std::vector<std::string>& aFileExtensions,
|
||||
const std::vector<std::string>& aExtsInFolder = {}, bool aIsFile = true ) :
|
||||
const std::vector<std::string>& aExtsInFolder = {}, bool aIsFile = true,
|
||||
bool aCanRead = true, bool aCanWrite = true ) :
|
||||
m_Description( aDescription ),
|
||||
m_FileExtensions( aFileExtensions ), m_ExtensionsInDir( aExtsInFolder ),
|
||||
m_IsFile( aIsFile )
|
||||
m_IsFile( aIsFile ), m_CanRead( aCanRead ), m_CanWrite( aCanWrite )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ bool AskLoadBoardFileName( PCB_EDIT_FRAME* aParent, wxString* aFileName, int aCt
|
|||
|
||||
const IO_BASE::IO_FILE_DESC& desc = pi->GetBoardFileDesc();
|
||||
|
||||
if( desc.m_FileExtensions.empty() )
|
||||
if( desc.m_FileExtensions.empty() || !desc.m_CanRead )
|
||||
continue;
|
||||
|
||||
descriptions.emplace_back( desc );
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
|
||||
const IO_BASE::IO_FILE_DESC GetBoardFileDesc() const override
|
||||
{
|
||||
return IO_BASE::IO_FILE_DESC( wxEmptyString, {} );
|
||||
return IO_BASE::IO_FILE_DESC( wxEmptyString, {}, {}, false, false, true );
|
||||
}
|
||||
|
||||
const IO_BASE::IO_FILE_DESC GetLibraryDesc() const override
|
||||
|
|
Loading…
Reference in New Issue