2016-07-06 09:22:56 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2016 CERN
|
2021-07-16 20:13:26 +00:00
|
|
|
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2016-07-06 09:22:56 +00:00
|
|
|
*
|
|
|
|
* @author Wayne Stambaugh <stambaughw@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2022-11-06 16:51:52 +00:00
|
|
|
#include <string_utf8_map.h>
|
2016-07-06 09:22:56 +00:00
|
|
|
|
|
|
|
#include <sch_io_mgr.h>
|
2020-10-01 08:52:03 +00:00
|
|
|
#include <wx/translation.h>
|
2016-07-06 09:22:56 +00:00
|
|
|
|
2020-10-01 08:52:03 +00:00
|
|
|
#define FMT_UNIMPLEMENTED "Plugin \"%s\" does not implement the \"%s\" function."
|
2016-07-06 09:22:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function not_implemented
|
|
|
|
* throws an IO_ERROR and complains of an API function not being implemented.
|
|
|
|
*
|
|
|
|
* @param aPlugin is a SCH_PLUGIN instance
|
|
|
|
* @param aCaller is the name of the unimplemented API function.
|
|
|
|
*/
|
2017-01-27 15:56:36 +00:00
|
|
|
static void not_implemented( const SCH_PLUGIN* aPlugin, const char* aCaller )
|
|
|
|
{
|
|
|
|
THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED,
|
|
|
|
aPlugin->GetName().GetData(),
|
|
|
|
wxString::FromUTF8( aCaller ).GetData() ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-11-06 16:51:52 +00:00
|
|
|
void SCH_PLUGIN::SaveLibrary( const wxString& aFileName, const STRING_UTF8_MAP* aProperties )
|
2017-01-27 15:56:36 +00:00
|
|
|
{
|
|
|
|
not_implemented( this, __FUNCTION__ );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-21 03:00:23 +00:00
|
|
|
SCH_SHEET* SCH_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchematic,
|
2022-11-06 16:51:52 +00:00
|
|
|
SCH_SHEET* aAppendToMe, const STRING_UTF8_MAP* aProperties )
|
2016-07-06 09:22:56 +00:00
|
|
|
{
|
|
|
|
not_implemented( this, __FUNCTION__ );
|
2021-07-16 20:13:26 +00:00
|
|
|
return nullptr;
|
2016-07-06 09:22:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-21 03:00:23 +00:00
|
|
|
void SCH_PLUGIN::Save( const wxString& aFileName, SCH_SHEET* aSheet, SCHEMATIC* aSchematic,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties )
|
2016-07-06 09:22:56 +00:00
|
|
|
{
|
|
|
|
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
|
|
|
not_implemented( this, __FUNCTION__ );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-01-27 15:56:36 +00:00
|
|
|
void SCH_PLUGIN::EnumerateSymbolLib( wxArrayString& aAliasNameList,
|
|
|
|
const wxString& aLibraryPath,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties )
|
2016-07-06 09:22:56 +00:00
|
|
|
{
|
|
|
|
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
|
|
|
not_implemented( this, __FUNCTION__ );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-10 18:51:46 +00:00
|
|
|
void SCH_PLUGIN::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
|
2017-02-24 16:09:27 +00:00
|
|
|
const wxString& aLibraryPath,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties )
|
2017-02-24 16:09:27 +00:00
|
|
|
{
|
|
|
|
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
|
|
|
not_implemented( this, __FUNCTION__ );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-10 18:51:46 +00:00
|
|
|
LIB_SYMBOL* SCH_PLUGIN::LoadSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
2022-12-08 23:56:55 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties )
|
2016-07-06 09:22:56 +00:00
|
|
|
{
|
|
|
|
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
|
|
|
not_implemented( this, __FUNCTION__ );
|
2021-07-16 20:13:26 +00:00
|
|
|
return nullptr;
|
2016-07-06 09:22:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-06-10 18:51:46 +00:00
|
|
|
void SCH_PLUGIN::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties )
|
2016-07-06 09:22:56 +00:00
|
|
|
{
|
|
|
|
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
|
|
|
not_implemented( this, __FUNCTION__ );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-11-06 19:15:42 +00:00
|
|
|
void SCH_PLUGIN::DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties )
|
2016-07-06 09:22:56 +00:00
|
|
|
{
|
|
|
|
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
|
|
|
not_implemented( this, __FUNCTION__ );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-11-06 16:51:52 +00:00
|
|
|
void SCH_PLUGIN::CreateSymbolLib( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
2016-07-06 09:22:56 +00:00
|
|
|
{
|
|
|
|
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
|
|
|
not_implemented( this, __FUNCTION__ );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-11-06 16:51:52 +00:00
|
|
|
bool SCH_PLUGIN::DeleteSymbolLib( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
2016-07-06 09:22:56 +00:00
|
|
|
{
|
|
|
|
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
|
|
|
not_implemented( this, __FUNCTION__ );
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool SCH_PLUGIN::IsSymbolLibWritable( const wxString& aLibraryPath )
|
|
|
|
{
|
|
|
|
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
|
|
|
not_implemented( this, __FUNCTION__ );
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-11-06 16:51:52 +00:00
|
|
|
void SCH_PLUGIN::SymbolLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const
|
2016-07-06 09:22:56 +00:00
|
|
|
{
|
|
|
|
// disable all these in another couple of months, after everyone has seen them:
|
|
|
|
#if 1
|
|
|
|
(*aListToAppendTo)["debug_level"] = UTF8( _(
|
|
|
|
"Enable <b>debug</b> logging for Symbol*() functions in this SCH_PLUGIN."
|
2016-10-09 12:29:44 +00:00
|
|
|
) );
|
2016-07-06 09:22:56 +00:00
|
|
|
|
|
|
|
(*aListToAppendTo)["read_filter_regex"] = UTF8( _(
|
|
|
|
"Regular expression <b>symbol name</b> filter."
|
2016-10-09 12:29:44 +00:00
|
|
|
) );
|
2016-07-06 09:22:56 +00:00
|
|
|
|
|
|
|
(*aListToAppendTo)["enable_transaction_logging"] = UTF8( _(
|
|
|
|
"Enable transaction logging. The mere presence of this option turns on the "
|
|
|
|
"logging, no need to set a Value."
|
2016-10-09 12:29:44 +00:00
|
|
|
) );
|
2016-07-06 09:22:56 +00:00
|
|
|
|
|
|
|
(*aListToAppendTo)["username"] = UTF8( _(
|
|
|
|
"User name for <b>login</b> to some special library server."
|
2020-11-24 22:16:41 +00:00
|
|
|
) );
|
2016-07-06 09:22:56 +00:00
|
|
|
|
|
|
|
(*aListToAppendTo)["password"] = UTF8( _(
|
|
|
|
"Password for <b>login</b> to some special library server."
|
2016-10-09 12:29:44 +00:00
|
|
|
) );
|
2016-07-06 09:22:56 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
// Suitable for a C++ to python SCH_PLUGIN::Footprint*() adapter, move it to the adapter
|
|
|
|
// if and when implemented.
|
|
|
|
(*aListToAppendTo)["python_symbol_plugin"] = UTF8( _(
|
|
|
|
"Enter the python symbol which implements the SCH_PLUGIN::Symbol*() functions."
|
2016-10-09 12:29:44 +00:00
|
|
|
) );
|
2016-07-06 09:22:56 +00:00
|
|
|
#endif
|
|
|
|
}
|
2017-06-21 12:41:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
bool SCH_PLUGIN::CheckHeader( const wxString& aFileName )
|
|
|
|
{
|
|
|
|
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
|
|
|
not_implemented( this, __FUNCTION__ );
|
2017-11-09 23:33:26 +00:00
|
|
|
return false;
|
2017-06-21 12:41:00 +00:00
|
|
|
}
|
2017-12-07 00:10:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
const wxString& SCH_PLUGIN::GetError() const
|
|
|
|
{
|
|
|
|
// not pure virtual so that plugins only have to implement subset of the SCH_PLUGIN interface.
|
|
|
|
not_implemented( this, __FUNCTION__ );
|
|
|
|
static wxString error;
|
|
|
|
return error;
|
|
|
|
}
|