2011-11-28 04:32:29 +00:00
|
|
|
#ifndef IO_MGR_H_
|
|
|
|
#define IO_MGR_H_
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
|
|
|
*
|
2012-04-17 14:54:48 +00:00
|
|
|
* Copyright (C) 2011-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2020-12-18 15:40:13 +00:00
|
|
|
* Copyright (C) 2016-2020 Kicad Developers, see AUTHORS.txt for contributors.
|
2011-11-28 04:32:29 +00:00
|
|
|
*
|
|
|
|
* 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, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <richio.h>
|
2013-10-24 13:58:05 +00:00
|
|
|
#include <map>
|
2017-10-30 23:21:16 +00:00
|
|
|
#include <functional>
|
2018-02-05 20:55:00 +00:00
|
|
|
#include <wx/time.h>
|
2011-11-28 04:32:29 +00:00
|
|
|
|
2019-01-15 22:17:56 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2011-11-28 04:32:29 +00:00
|
|
|
class BOARD;
|
|
|
|
class PLUGIN;
|
2020-11-13 15:15:52 +00:00
|
|
|
class FOOTPRINT;
|
2022-11-06 16:51:52 +00:00
|
|
|
class STRING_UTF8_MAP;
|
2020-12-18 15:40:13 +00:00
|
|
|
class PROJECT;
|
2021-06-23 22:53:08 +00:00
|
|
|
class PROGRESS_REPORTER;
|
2011-11-28 04:32:29 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* A factory which returns an instance of a #PLUGIN.
|
2011-11-28 04:32:29 +00:00
|
|
|
*/
|
|
|
|
class IO_MGR
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* The set of file types that the IO_MGR knows about, and for which there has been a
|
|
|
|
* plugin written.
|
2011-11-28 04:32:29 +00:00
|
|
|
*/
|
|
|
|
enum PCB_FILE_T
|
|
|
|
{
|
2020-04-03 23:22:24 +00:00
|
|
|
LEGACY, ///< Legacy Pcbnew file formats prior to s-expression.
|
|
|
|
KICAD_SEXP, ///< S-expression Pcbnew file format.
|
2012-05-20 13:14:46 +00:00
|
|
|
EAGLE,
|
2012-12-29 09:54:25 +00:00
|
|
|
PCAD,
|
2020-07-01 22:30:40 +00:00
|
|
|
FABMASTER,
|
2020-04-03 23:22:24 +00:00
|
|
|
ALTIUM_DESIGNER,
|
|
|
|
ALTIUM_CIRCUIT_STUDIO,
|
|
|
|
ALTIUM_CIRCUIT_MAKER,
|
2020-08-29 18:09:48 +00:00
|
|
|
CADSTAR_PCB_ARCHIVE,
|
2020-04-03 23:22:24 +00:00
|
|
|
GEDA_PCB, ///< Geda PCB file formats.
|
2011-12-02 16:28:00 +00:00
|
|
|
// add your type here.
|
|
|
|
|
2011-11-28 04:32:29 +00:00
|
|
|
// etc.
|
2016-05-10 19:07:35 +00:00
|
|
|
|
|
|
|
FILE_TYPE_NONE
|
2011-11-28 04:32:29 +00:00
|
|
|
};
|
|
|
|
|
2017-10-30 23:21:16 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Hold a list of available plugins, created using a singleton REGISTER_PLUGIN object.
|
2017-10-30 23:21:16 +00:00
|
|
|
* This way, plugins can be added link-time.
|
|
|
|
*/
|
|
|
|
class PLUGIN_REGISTRY
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct ENTRY
|
|
|
|
{
|
|
|
|
PCB_FILE_T m_type;
|
|
|
|
std::function<PLUGIN*(void)> m_createFunc;
|
|
|
|
wxString m_name;
|
|
|
|
};
|
|
|
|
|
|
|
|
static PLUGIN_REGISTRY *Instance()
|
|
|
|
{
|
|
|
|
static PLUGIN_REGISTRY *self = nullptr;
|
|
|
|
|
|
|
|
if( !self )
|
|
|
|
{
|
|
|
|
self = new PLUGIN_REGISTRY;
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2020-12-18 15:40:13 +00:00
|
|
|
void Register( PCB_FILE_T aType, const wxString& aName,
|
|
|
|
std::function<PLUGIN*(void)> aCreateFunc )
|
2017-10-30 23:21:16 +00:00
|
|
|
{
|
|
|
|
ENTRY ent;
|
|
|
|
ent.m_type = aType;
|
|
|
|
ent.m_createFunc = aCreateFunc;
|
|
|
|
ent.m_name = aName;
|
|
|
|
m_plugins.push_back( ent );
|
|
|
|
}
|
|
|
|
|
|
|
|
PLUGIN* Create( PCB_FILE_T aFileType ) const
|
|
|
|
{
|
|
|
|
for( auto& ent : m_plugins )
|
|
|
|
{
|
|
|
|
if ( ent.m_type == aFileType )
|
|
|
|
{
|
|
|
|
return ent.m_createFunc();
|
|
|
|
}
|
|
|
|
}
|
2020-12-18 15:40:13 +00:00
|
|
|
|
2017-10-30 23:21:16 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::vector<ENTRY>& AllPlugins() const
|
|
|
|
{
|
|
|
|
return m_plugins;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<ENTRY> m_plugins;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Register a plugin.
|
|
|
|
*
|
|
|
|
* Declare as a static variable in an anonymous namespace.
|
|
|
|
*
|
|
|
|
* @param aType type of the plugin
|
|
|
|
* @param aName name of the file format
|
|
|
|
* @param aCreateFunc function that creates a new object for the plugin.
|
2017-10-30 23:21:16 +00:00
|
|
|
*/
|
|
|
|
struct REGISTER_PLUGIN
|
|
|
|
{
|
2020-12-18 15:40:13 +00:00
|
|
|
REGISTER_PLUGIN( PCB_FILE_T aType, const wxString& aName,
|
|
|
|
std::function<PLUGIN*(void)> aCreateFunc )
|
2017-10-30 23:21:16 +00:00
|
|
|
{
|
|
|
|
PLUGIN_REGISTRY::Instance()->Register( aType, aName, aCreateFunc );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-11-28 04:32:29 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Return a #PLUGIN which the caller can use to import, export, save, or load
|
|
|
|
* design documents.
|
2011-11-28 04:32:29 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* The returned #PLUGIN, may be reference counted, so please call PluginRelease() when you
|
|
|
|
* are done using the returned #PLUGIN. It may or may not be code running from a DLL/DSO.
|
2011-11-28 04:32:29 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* @note The caller owns the returned object and must call PluginRelease when done using it.
|
|
|
|
*
|
|
|
|
* @param aFileType is from #PCB_FILE_T and tells which plugin to find.
|
|
|
|
* @return the plug in corresponding to \a aFileType or NULL if not found.
|
2011-11-28 04:32:29 +00:00
|
|
|
*/
|
|
|
|
static PLUGIN* PluginFind( PCB_FILE_T aFileType );
|
|
|
|
|
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Release a #PLUGIN back to the system and may cause it to be unloaded from memory.
|
2011-11-28 04:32:29 +00:00
|
|
|
*
|
2011-12-02 16:28:00 +00:00
|
|
|
* @param aPlugin is the one to be released, and which is no longer usable
|
2020-12-18 15:40:13 +00:00
|
|
|
* after calling this.
|
2011-11-28 04:32:29 +00:00
|
|
|
*/
|
|
|
|
static void PluginRelease( PLUGIN* aPlugin );
|
|
|
|
|
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Return a brief name for a plugin given \a aFileType enum.
|
2011-11-28 04:32:29 +00:00
|
|
|
*/
|
2011-12-02 21:56:47 +00:00
|
|
|
static const wxString ShowType( PCB_FILE_T aFileType );
|
2011-11-28 04:32:29 +00:00
|
|
|
|
2012-10-17 15:12:17 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Return the #PCB_FILE_T from the corresponding plugin type name: "kicad", "legacy", etc.
|
2012-10-17 15:12:17 +00:00
|
|
|
*/
|
|
|
|
static PCB_FILE_T EnumFromStr( const wxString& aFileType );
|
|
|
|
|
2012-04-07 18:05:56 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Return the file extension for \a aFileType.
|
2012-04-07 18:05:56 +00:00
|
|
|
*
|
|
|
|
* @param aFileType The #PCB_FILE_T type.
|
2020-12-18 15:40:13 +00:00
|
|
|
* @return the file extension for \a aFileType or an empty string if \a aFileType is invalid.
|
2012-04-07 18:05:56 +00:00
|
|
|
*/
|
|
|
|
static const wxString GetFileExtension( PCB_FILE_T aFileType );
|
|
|
|
|
2012-11-19 16:19:38 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Return a plugin type given a footprint library's libPath.
|
2012-11-19 16:19:38 +00:00
|
|
|
*/
|
|
|
|
static PCB_FILE_T GuessPluginTypeFromLibPath( const wxString& aLibPath );
|
|
|
|
|
2011-11-28 04:32:29 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Find the requested #PLUGIN and if found, calls the #PLUGIN::Load() function
|
|
|
|
* on it using the arguments passed to this function. After the #PLUGIN::Load()
|
|
|
|
* function returns, the #PLUGIN is Released() as part of this call.
|
2011-11-28 04:32:29 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* @param aFileType is the #PCB_FILE_T of file to load.
|
2011-11-28 04:32:29 +00:00
|
|
|
* @param aFileName is the name of the file to load.
|
|
|
|
* @param aAppendToMe is an existing BOARD to append to, use NULL if fresh
|
2020-12-18 15:40:13 +00:00
|
|
|
* board load is wanted.
|
2011-11-28 04:32:29 +00:00
|
|
|
* @param aProperties is an associative array that allows the caller to
|
2020-12-18 15:40:13 +00:00
|
|
|
* pass additional tuning parameters to the PLUGIN.
|
|
|
|
* @param aProject is the optional #PROJECT object primarily used by third party
|
|
|
|
* importers.
|
|
|
|
* @return the loaded #BOARD object. The caller owns it an it will never NULL because
|
|
|
|
* exception thrown if error.
|
|
|
|
*
|
|
|
|
* @throw IO_ERROR if the #PLUGIN cannot be found, file cannot be found, or file cannot
|
|
|
|
* be loaded.
|
2011-11-28 04:32:29 +00:00
|
|
|
*/
|
|
|
|
static BOARD* Load( PCB_FILE_T aFileType, const wxString& aFileName,
|
2022-11-06 16:51:52 +00:00
|
|
|
BOARD* aAppendToMe = nullptr, const STRING_UTF8_MAP* aProperties = nullptr,
|
2021-06-23 22:53:08 +00:00
|
|
|
PROJECT* aProject = nullptr,
|
|
|
|
PROGRESS_REPORTER* aProgressReporter = nullptr );
|
2011-11-28 04:32:29 +00:00
|
|
|
|
2011-12-02 16:28:00 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Write either a full \a aBoard to a storage file in a format that this implementation
|
|
|
|
* knows about, or it can be used to write a portion of\a aBoard to a special kind of
|
|
|
|
* export file.
|
2011-12-22 21:57:50 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* @param aFileType is the #PCB_FILE_T of file to save.
|
2011-12-02 16:28:00 +00:00
|
|
|
* @param aFileName is the name of a file to save to on disk.
|
2020-12-18 15:40:13 +00:00
|
|
|
* @param aBoard is the #BOARD document (data tree) to save or export to disk.
|
|
|
|
* @param aBoard is the in memory document tree from which to extract information when
|
|
|
|
* writing to \a aFileName. The caller continues to own the #BOARD, and
|
|
|
|
* the plugin should refrain from modifying the #BOARD if possible.
|
|
|
|
* @param aProperties is an associative array that can be used to tell the saver how to
|
|
|
|
* save the file, because it can take any number of additional named
|
|
|
|
* tuning arguments that the plugin is known to support. The caller
|
|
|
|
* continues to own this object (plugin may not delete it), and plugins
|
|
|
|
* should expect it to be optionally NULL.
|
2011-12-02 16:28:00 +00:00
|
|
|
*
|
|
|
|
* @throw IO_ERROR if there is a problem saving or exporting.
|
|
|
|
*/
|
2020-12-18 15:40:13 +00:00
|
|
|
static void Save( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* aBoard,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2011-11-28 04:32:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* A base class that #BOARD loading and saving plugins should derive from.
|
|
|
|
*
|
|
|
|
* Implementations can provide either Load() or Save() functions, or both. PLUGINs throw
|
|
|
|
* exceptions, so it is best that you wrap your calls to these functions in a try catch block.
|
|
|
|
* Plugins throw exceptions because it is illegal for them to have any user interface calls in
|
|
|
|
* them whatsoever, i.e. no windowing or screen printing at all.
|
|
|
|
*
|
|
|
|
*The compiler writes the "zero argument" constructor for a PLUGIN automatically if you do
|
|
|
|
* not provide one. If you decide you need to provide a zero argument constructor of your
|
|
|
|
* own design, that is allowed. It must be public, and it is what the #IO_MGR uses. Parameters
|
|
|
|
* may be passed into a PLUGIN via the #PROPERTIES variable for any of the public API functions
|
|
|
|
* which take one.
|
|
|
|
*
|
2011-11-28 04:32:29 +00:00
|
|
|
*
|
|
|
|
* <pre>
|
|
|
|
* try
|
|
|
|
* {
|
2011-12-02 16:28:00 +00:00
|
|
|
* IO_MGR::Load(...);
|
|
|
|
* or
|
|
|
|
* IO_MGR::Save(...);
|
2011-11-28 04:32:29 +00:00
|
|
|
* }
|
2014-04-09 13:33:04 +00:00
|
|
|
* catch( const IO_ERROR& ioe )
|
2011-11-28 04:32:29 +00:00
|
|
|
* {
|
|
|
|
* // grab text from ioe, show in error window.
|
|
|
|
* }
|
|
|
|
* </pre>
|
|
|
|
*/
|
|
|
|
class PLUGIN
|
|
|
|
{
|
|
|
|
public:
|
2011-11-30 07:43:46 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Return a brief hard coded name for this PLUGIN.
|
2011-11-30 07:43:46 +00:00
|
|
|
*/
|
2013-11-27 06:04:04 +00:00
|
|
|
virtual const wxString PluginName() const = 0;
|
2012-04-07 18:05:56 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Returns the file extension for the PLUGIN.
|
2012-04-07 18:05:56 +00:00
|
|
|
*/
|
2013-11-27 06:04:04 +00:00
|
|
|
virtual const wxString GetFileExtension() const = 0;
|
2011-11-28 04:32:29 +00:00
|
|
|
|
2022-02-11 21:38:31 +00:00
|
|
|
/**
|
|
|
|
* Registers a KIDIALOG callback for collecting info from the user.
|
|
|
|
*/
|
|
|
|
virtual void SetQueryUserCallback( std::function<bool( wxString aTitle, int aIcon,
|
|
|
|
wxString aMessage,
|
|
|
|
wxString aAction )> aCallback )
|
|
|
|
{ }
|
|
|
|
|
2011-11-28 04:32:29 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Load information from some input file format that this PLUGIN implementation
|
|
|
|
* knows about into either a new #BOARD or an existing one.
|
2011-11-28 04:32:29 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* This may be used to load an entire new #BOARD, or to augment an existing one if
|
|
|
|
* @a aAppendToMe is not NULL.
|
2011-11-28 04:32:29 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* @param aFileName is the name of the file to use as input and may be foreign in
|
|
|
|
* nature or native in nature.
|
|
|
|
* @param aAppendToMe is an existing BOARD to append to, but if NULL then this means
|
|
|
|
* "do not append, rather load anew".
|
|
|
|
* @param aProperties is an associative array that can be used to tell the loader how to
|
|
|
|
* load the file, because it can take any number of additional named
|
|
|
|
* arguments that the plugin is known to support. These are tuning
|
|
|
|
* parameters for the import or load. The caller continues to own
|
|
|
|
* this object (plugin may not delete it), and plugins should expect
|
|
|
|
* it to be optionally NULL.
|
|
|
|
* @param aProject is the optional #PROJECT object primarily used by third party
|
|
|
|
* importers.
|
2021-06-23 22:53:08 +00:00
|
|
|
* @param aProgressReporter an optional progress reporter
|
|
|
|
* @param aLineCount a line count (necessary if a progress reporter is supplied)
|
2020-12-18 15:40:13 +00:00
|
|
|
* @return the successfully loaded board, or the same one as \a aAppendToMe if aAppendToMe
|
|
|
|
* was not NULL, and caller owns it.
|
|
|
|
*
|
|
|
|
* @throw IO_ERROR if there is a problem loading, and its contents should say what went
|
|
|
|
* wrong, using line number and character offsets of the input file if
|
|
|
|
* possible.
|
2011-11-28 04:32:29 +00:00
|
|
|
*/
|
2011-11-30 07:43:46 +00:00
|
|
|
virtual BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr, PROJECT* aProject = nullptr,
|
2021-06-23 22:53:08 +00:00
|
|
|
PROGRESS_REPORTER* aProgressReporter = nullptr );
|
2011-11-28 04:32:29 +00:00
|
|
|
|
2021-01-31 21:55:51 +00:00
|
|
|
/**
|
|
|
|
* Return a container with the cached library footprints generated in the last call to
|
|
|
|
* #Load. This function is intended to be used ONLY by the non-KiCad board importers for the
|
|
|
|
* purpose of obtaining the footprint library of the design and creating a project-specific
|
|
|
|
* library.
|
|
|
|
*
|
|
|
|
* @return Footprints (caller owns the objects)
|
|
|
|
*/
|
|
|
|
virtual std::vector<FOOTPRINT*> GetImportedCachedLibraryFootprints();
|
|
|
|
|
2011-11-28 04:32:29 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Write @a aBoard to a storage file in a format that this PLUGIN implementation knows
|
|
|
|
* about or it can be used to write a portion of \a aBoard to a special kind of export
|
|
|
|
* file.
|
2011-11-28 04:32:29 +00:00
|
|
|
*
|
|
|
|
* @param aFileName is the name of a file to save to on disk.
|
2020-12-18 15:40:13 +00:00
|
|
|
* @param aBoard is the class #BOARD in memory document tree from which to extract
|
|
|
|
* information when writing to \a aFileName. The caller continues to
|
|
|
|
* own the BOARD, and the plugin should refrain from modifying the BOARD
|
|
|
|
* if possible.
|
|
|
|
* @param aProperties is an associative array that can be used to tell the saver how to
|
|
|
|
* save the file, because it can take any number of additional named
|
|
|
|
* tuning arguments that the plugin is known to support. The caller
|
|
|
|
* continues to own this object (plugin may not delete it) and plugins
|
|
|
|
* should expect it to be optionally NULL.
|
2011-11-28 04:32:29 +00:00
|
|
|
*
|
2011-12-02 16:28:00 +00:00
|
|
|
* @throw IO_ERROR if there is a problem saving or exporting.
|
2011-11-28 04:32:29 +00:00
|
|
|
*/
|
2011-12-02 16:57:44 +00:00
|
|
|
virtual void Save( const wxString& aFileName, BOARD* aBoard,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2012-11-19 16:19:38 +00:00
|
|
|
|
2012-04-16 03:18:41 +00:00
|
|
|
/**
|
2017-06-13 23:47:05 +00:00
|
|
|
* Return a list of footprint names contained within the library at @a aLibraryPath.
|
2012-04-16 03:18:41 +00:00
|
|
|
*
|
2013-11-28 15:41:10 +00:00
|
|
|
* @param aLibraryPath is a locator for the "library", usually a directory, file,
|
2020-12-18 15:40:13 +00:00
|
|
|
* or URL containing several footprints.
|
|
|
|
* @param aProperties is an associative array that can be used to tell the plugin
|
|
|
|
* anything needed about how to perform with respect to @a aLibraryPath.
|
|
|
|
* The caller continues to own this object (plugin may not delete it),
|
|
|
|
* and plugins should expect it to be optionally NULL.
|
2017-06-13 23:47:05 +00:00
|
|
|
* @param aFootprintNames is the array of available footprint names inside a library.
|
2019-08-31 14:18:27 +00:00
|
|
|
* @param aBestEfforts if true, don't throw on errors, just return an empty list.
|
|
|
|
*
|
2012-04-16 03:18:41 +00:00
|
|
|
* @throw IO_ERROR if the library cannot be found, or footprint cannot be loaded.
|
|
|
|
*/
|
2017-06-11 20:20:44 +00:00
|
|
|
virtual void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath,
|
2022-11-06 16:51:52 +00:00
|
|
|
bool aBestEfforts, const STRING_UTF8_MAP* aProperties = nullptr );
|
2012-04-16 03:18:41 +00:00
|
|
|
|
2018-02-05 20:55:00 +00:00
|
|
|
/**
|
2018-02-23 12:21:06 +00:00
|
|
|
* Generate a timestamp representing all the files in the library (including the library
|
|
|
|
* directory).
|
2020-12-18 15:40:13 +00:00
|
|
|
*
|
|
|
|
* Timestamps should not be considered ordered, they either match or they don't.
|
2018-02-05 20:55:00 +00:00
|
|
|
*/
|
2018-03-04 01:13:09 +00:00
|
|
|
virtual long long GetLibraryTimestamp( const wxString& aLibraryPath ) const = 0;
|
2018-02-05 20:55:00 +00:00
|
|
|
|
2017-03-23 00:59:25 +00:00
|
|
|
/**
|
|
|
|
* If possible, prefetches the specified library (e.g. performing downloads). Does not parse.
|
|
|
|
* Threadsafe.
|
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* This is a no-op for libraries that cannot be prefetched. Plugins that cannot prefetch
|
|
|
|
* need not override this; a default no-op is provided.
|
2017-03-23 00:59:25 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* @param aLibraryPath is a locator for the "library", usually a directory, file, or URL
|
|
|
|
* containing several footprints.
|
2017-03-23 00:59:25 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* @param aProperties is an associative array that can be used to tell the plugin anything
|
|
|
|
* needed about how to perform with respect to @a aLibraryPath. The
|
|
|
|
* caller continues to own this object (plugin may not delete it), and
|
|
|
|
* plugins should expect it to be optionally NULL.
|
2017-03-23 00:59:25 +00:00
|
|
|
*
|
|
|
|
* @throw IO_ERROR if there is an error prefetching the library.
|
|
|
|
*/
|
|
|
|
virtual void PrefetchLib( const wxString& aLibraryPath,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2017-03-23 00:59:25 +00:00
|
|
|
|
2012-04-16 03:18:41 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Load a footprint having @a aFootprintName from the @a aLibraryPath containing a library
|
|
|
|
* format that this PLUGIN knows about.
|
2012-04-16 03:18:41 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* @param aLibraryPath is a locator for the "library", usually a directory, file, or URL
|
|
|
|
* containing several footprints.
|
2012-04-16 03:18:41 +00:00
|
|
|
* @param aFootprintName is the name of the footprint to load.
|
2020-12-18 15:40:13 +00:00
|
|
|
* @param aProperties is an associative array that can be used to tell the loader
|
|
|
|
* implementation to do something special, because it can take
|
|
|
|
* any number of additional named tuning arguments that the plugin
|
|
|
|
* is known to support. The caller continues to own this object
|
|
|
|
* (plugin may not delete it), and plugins should expect it to be
|
|
|
|
* optionally NULL.
|
2021-03-30 09:38:03 +00:00
|
|
|
* @param aKeepUUID = true to keep initial items UUID, false to set new UUID
|
|
|
|
* normally true if loaded in the footprint editor, false
|
|
|
|
* if loaded in the board editor. Make sense only in kicad_plugin
|
2020-12-18 15:40:13 +00:00
|
|
|
* @return the #FOOTPRINT object if found caller owns it, else NULL if not found.
|
|
|
|
*
|
|
|
|
* @throw IO_ERROR if the library cannot be found or read. No exception is thrown in
|
|
|
|
* the case where \a aFootprintName cannot be found.
|
2012-04-16 03:18:41 +00:00
|
|
|
*/
|
2021-03-30 09:38:03 +00:00
|
|
|
virtual FOOTPRINT* FootprintLoad( const wxString& aLibraryPath,
|
|
|
|
const wxString& aFootprintName,
|
|
|
|
bool aKeepUUID = false,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2012-04-16 03:18:41 +00:00
|
|
|
|
2018-02-23 12:21:06 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* A version of FootprintLoad() for use after FootprintEnumerate() for more efficient
|
2018-07-30 13:18:37 +00:00
|
|
|
* cache management.
|
2018-02-23 12:21:06 +00:00
|
|
|
*/
|
2020-11-13 15:15:52 +00:00
|
|
|
virtual const FOOTPRINT* GetEnumeratedFootprint( const wxString& aLibraryPath,
|
|
|
|
const wxString& aFootprintName,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2018-02-23 12:21:06 +00:00
|
|
|
|
2019-07-11 21:59:14 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Check for the existence of a footprint.
|
2019-07-11 21:59:14 +00:00
|
|
|
*/
|
|
|
|
virtual bool FootprintExists( const wxString& aLibraryPath, const wxString& aFootprintName,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2019-07-11 21:59:14 +00:00
|
|
|
|
2012-04-16 03:18:41 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Write @a aFootprint to an existing library located at @a aLibraryPath.
|
2012-04-17 01:35:43 +00:00
|
|
|
* If a footprint by the same name already exists, it is replaced.
|
2012-04-16 03:18:41 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* @param aLibraryPath is a locator for the "library", usually a directory, file, or URL
|
|
|
|
* containing several footprints.
|
|
|
|
* @param aFootprint is what to store in the library. The caller continues to own the
|
|
|
|
* footprint after this call.
|
|
|
|
* @param aProperties is an associative array that can be used to tell the saver how to
|
|
|
|
* save the footprint, because it can take any number of additional
|
|
|
|
* named tuning arguments that the plugin is known to support. The
|
|
|
|
* caller continues to own this object (plugin may not delete it), and
|
|
|
|
* plugins should expect it to be optionally NULL.
|
2012-04-16 03:18:41 +00:00
|
|
|
*
|
|
|
|
* @throw IO_ERROR if there is a problem saving.
|
|
|
|
*/
|
2020-11-13 15:15:52 +00:00
|
|
|
virtual void FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFootprint,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2012-04-16 03:18:41 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Delete @a aFootprintName from the library at @a aLibraryPath.
|
2012-04-16 03:18:41 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* @param aLibraryPath is a locator for the "library", usually a directory, file, or URL
|
|
|
|
* containing several footprints.
|
2012-04-17 14:54:48 +00:00
|
|
|
* @param aFootprintName is the name of a footprint to delete from the specified library.
|
2020-12-18 15:40:13 +00:00
|
|
|
* @param aProperties is an associative array that can be used to tell the library delete
|
|
|
|
* function anything special, because it can take any number of additional
|
|
|
|
* named tuning arguments that the plugin is known to support. The caller
|
|
|
|
* continues to own this object (plugin may not delete it), and plugins
|
|
|
|
* should expect it to be optionally NULL.
|
2013-09-25 19:17:06 +00:00
|
|
|
*
|
2012-04-16 03:18:41 +00:00
|
|
|
* @throw IO_ERROR if there is a problem finding the footprint or the library, or deleting it.
|
|
|
|
*/
|
2020-12-18 15:40:13 +00:00
|
|
|
virtual void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2012-04-16 03:18:41 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Create a new empty footprint library at @a aLibraryPath empty.
|
2012-04-17 01:35:43 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* It is an error to attempt to create an existing library or to attempt to create
|
|
|
|
* on a "read only" location.
|
2012-04-17 01:35:43 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* @param aLibraryPath is a locator for the "library", usually a directory, file, or URL
|
|
|
|
* containing several footprints.
|
|
|
|
* @param aProperties is an associative array that can be used to tell the library create
|
|
|
|
* function anything special, because it can take any number of additional
|
|
|
|
* named tuning arguments that the plugin is known to support. The caller
|
|
|
|
* continues to own this object (plugin may not delete it), and plugins
|
|
|
|
* should expect it to be optionally NULL.
|
2012-04-17 01:35:43 +00:00
|
|
|
*
|
|
|
|
* @throw IO_ERROR if there is a problem finding the library, or creating it.
|
|
|
|
*/
|
2020-12-18 15:40:13 +00:00
|
|
|
virtual void FootprintLibCreate( const wxString& aLibraryPath,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2012-04-17 01:35:43 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Delete an existing footprint library and returns true, or if library does not
|
2012-11-19 16:19:38 +00:00
|
|
|
* exist returns false, or throws an exception if library exists but is read only or
|
|
|
|
* cannot be deleted for some other reason.
|
2012-04-17 01:35:43 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* @param aLibraryPath is a locator for the "library", usually a directory or file which
|
|
|
|
* will contain footprints.
|
|
|
|
* @param aProperties is an associative array that can be used to tell the library delete
|
|
|
|
* implementation function anything special, because it can take any
|
|
|
|
* number of additional named tuning arguments that the plugin is known
|
|
|
|
* to support. The caller continues to own this object (plugin may not
|
|
|
|
* delete it), and plugins should expect it to be optionally NULL.
|
|
|
|
* @return true if library deleted, false if library did not exist.
|
2012-11-19 16:19:38 +00:00
|
|
|
*
|
|
|
|
* @throw IO_ERROR if there is a problem deleting an existing library.
|
2012-04-17 01:35:43 +00:00
|
|
|
*/
|
2020-12-18 15:40:13 +00:00
|
|
|
virtual bool FootprintLibDelete( const wxString& aLibraryPath,
|
2022-11-06 16:51:52 +00:00
|
|
|
const STRING_UTF8_MAP* aProperties = nullptr );
|
2012-04-17 01:35:43 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Return true if the library at @a aLibraryPath is writable.
|
2012-11-19 16:19:38 +00:00
|
|
|
*
|
2020-12-18 15:40:13 +00:00
|
|
|
* The system libraries are typically read only because of where they are installed..
|
|
|
|
*
|
|
|
|
* @param aLibraryPath is a locator for the "library", usually a directory, file, or URL
|
|
|
|
* containing several footprints.
|
2013-11-28 15:41:10 +00:00
|
|
|
*
|
2012-11-19 16:19:38 +00:00
|
|
|
* @throw IO_ERROR if no library at aLibraryPath exists.
|
2012-04-16 03:18:41 +00:00
|
|
|
*/
|
2012-04-17 01:35:43 +00:00
|
|
|
virtual bool IsFootprintLibWritable( const wxString& aLibraryPath );
|
2012-04-16 03:18:41 +00:00
|
|
|
|
2013-11-12 00:17:27 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Append supported PLUGIN options to @a aListToAppenTo along with internationalized
|
|
|
|
* descriptions.
|
|
|
|
*
|
|
|
|
* Options are typically appended so that a derived #PLUGIN can call its base class
|
|
|
|
* function by the same name first, thus inheriting options declared there. Some base
|
|
|
|
* class options could pertain to all Footprint*() functions in all derived PLUGINs.
|
|
|
|
*
|
|
|
|
* @note Since aListToAppendTo is a #PROPERTIES object, all options will be unique and
|
|
|
|
* last guy wins.
|
2013-11-12 00:17:27 +00:00
|
|
|
*
|
|
|
|
* @param aListToAppendTo holds a tuple of
|
|
|
|
* <dl>
|
2020-12-18 15:40:13 +00:00
|
|
|
* <dt>option</dt>
|
|
|
|
* <dd>This eventually is what shows up into the fp-lib-table "options"
|
|
|
|
* field, possibly combined with others.</dd>
|
|
|
|
* <dt>internationalized description</dt>
|
|
|
|
* <dd>The internationalized description is displayed in DIALOG_FP_PLUGIN_OPTIONS.
|
2013-11-12 00:17:27 +00:00
|
|
|
* It may be multi-line and be quite explanatory of the option.</dd>
|
2020-12-18 15:40:13 +00:00
|
|
|
* </dl>
|
2013-11-12 00:17:27 +00:00
|
|
|
* <br>
|
|
|
|
* In the future perhaps @a aListToAppendTo evolves to something capable of also
|
|
|
|
* holding a wxValidator for the cells in said dialog:
|
|
|
|
* http://forums.wxwidgets.org/viewtopic.php?t=23277&p=104180.
|
2020-12-18 15:40:13 +00:00
|
|
|
* This would require a 3 column list, and introducing wx GUI knowledge to
|
|
|
|
* PLUGIN, which has been avoided to date.
|
2013-11-12 00:17:27 +00:00
|
|
|
*/
|
2022-11-06 16:51:52 +00:00
|
|
|
virtual void FootprintLibOptions( STRING_UTF8_MAP* aListToAppendTo ) const;
|
2013-11-12 00:17:27 +00:00
|
|
|
|
2013-10-05 10:34:55 +00:00
|
|
|
virtual ~PLUGIN()
|
2023-04-20 22:19:04 +00:00
|
|
|
{};
|
2013-10-05 10:34:55 +00:00
|
|
|
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
|
Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.
* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
and C++ so that the resultant type name is common in both languages, and
the types AGREE.
* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.
* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.
* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
Having the name consistent between like types is helpful, and between
languages. std::map<> ends up as SOMETHING_MAP.
* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
instead of hashtables, because swig does not yet support std::unordered_map.
* You can now get to any netclass or net info. NETNAMES_MAP and NETCODES_MAP
are traversable basically the same as a python dictionary using a python
string (not wsString) as the key! The wxString typemap converts python
string to wxString before the lookup happens. Iteration also works.
2016-07-18 17:23:09 +00:00
|
|
|
#ifndef SWIG
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
/**
|
2020-12-18 15:40:13 +00:00
|
|
|
* Releases a PLUGIN in the context of a potential thrown exception through its destructor.
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
*/
|
|
|
|
class RELEASER
|
|
|
|
{
|
|
|
|
PLUGIN* plugin;
|
|
|
|
|
2013-10-05 04:53:15 +00:00
|
|
|
// private assignment operator so it's illegal
|
|
|
|
RELEASER& operator=( RELEASER& aOther ) { return *this; }
|
|
|
|
|
2013-10-05 10:34:55 +00:00
|
|
|
// private copy constructor so it's illegal
|
2020-10-05 10:41:14 +00:00
|
|
|
RELEASER( const RELEASER& aOther ) : plugin( nullptr ) {}
|
2013-10-05 10:34:55 +00:00
|
|
|
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
public:
|
2020-10-05 10:41:14 +00:00
|
|
|
RELEASER( PLUGIN* aPlugin = nullptr ) :
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
plugin( aPlugin )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~RELEASER()
|
|
|
|
{
|
|
|
|
if( plugin )
|
2013-10-05 04:53:15 +00:00
|
|
|
release();
|
|
|
|
}
|
|
|
|
|
|
|
|
void release()
|
|
|
|
{
|
|
|
|
IO_MGR::PluginRelease( plugin );
|
2020-10-05 10:41:14 +00:00
|
|
|
plugin = nullptr;
|
2013-10-05 04:53:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void set( PLUGIN* aPlugin )
|
|
|
|
{
|
|
|
|
if( plugin )
|
|
|
|
release();
|
|
|
|
plugin = aPlugin;
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
}
|
|
|
|
|
2013-10-05 04:53:15 +00:00
|
|
|
operator PLUGIN* () const
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
{
|
|
|
|
return plugin;
|
|
|
|
}
|
|
|
|
|
2013-10-05 04:53:15 +00:00
|
|
|
PLUGIN* operator -> () const
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
{
|
|
|
|
return plugin;
|
|
|
|
}
|
|
|
|
};
|
Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.
* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
and C++ so that the resultant type name is common in both languages, and
the types AGREE.
* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.
* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.
* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
Having the name consistent between like types is helpful, and between
languages. std::map<> ends up as SOMETHING_MAP.
* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
instead of hashtables, because swig does not yet support std::unordered_map.
* You can now get to any netclass or net info. NETNAMES_MAP and NETCODES_MAP
are traversable basically the same as a python dictionary using a python
string (not wsString) as the key! The wxString typemap converts python
string to wxString before the lookup happens. Iteration also works.
2016-07-18 17:23:09 +00:00
|
|
|
#endif
|
2011-12-02 16:28:00 +00:00
|
|
|
};
|
|
|
|
|
2011-11-28 04:32:29 +00:00
|
|
|
#endif // IO_MGR_H_
|