From f72394cc6b3abe8994724c256beb15713023988a Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Wed, 25 Sep 2013 14:17:06 -0500 Subject: [PATCH] Make PLUGIN::Footprint*() API functions take 'const' PROPERTIES*. Add const PROPERTIES* to FootprintDelete(). Add {Get,Set}Properties() to FP_LIB_TABLE::ROW. Touch up fp table dialog. --- Documentation/guidelines/UIpolicies.txt | 7 ++ TODO.txt | 35 +++++---- common/CMakeLists.txt | 1 + common/fp_lib_table.cpp | 5 +- include/fp_lib_table.h | 19 +++++ pcbnew/dialogs/dialog_fp_lib_table.cpp | 15 ++-- pcbnew/eagle_plugin.cpp | 16 ++--- pcbnew/eagle_plugin.h | 21 +++--- pcbnew/gpcb_plugin.cpp | 12 ++-- pcbnew/gpcb_plugin.h | 12 ++-- pcbnew/io_mgr.cpp | 71 +------------------ pcbnew/io_mgr.h | 27 ++++--- pcbnew/kicad_plugin.cpp | 18 ++--- pcbnew/kicad_plugin.h | 20 +++--- pcbnew/legacy_plugin.cpp | 34 ++++----- pcbnew/legacy_plugin.h | 20 +++--- pcbnew/librairi.cpp | 2 +- pcbnew/loadcmp.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/pcad_plugin.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/pcad_plugin.h | 6 +- pcbnew/plugin.cpp | 41 ++++++++--- pcbnew/scripting/pcbnew_scripting_helpers.cpp | 5 +- 22 files changed, 183 insertions(+), 208 deletions(-) diff --git a/Documentation/guidelines/UIpolicies.txt b/Documentation/guidelines/UIpolicies.txt index a8d3a45d7e..7d80c6197e 100644 --- a/Documentation/guidelines/UIpolicies.txt +++ b/Documentation/guidelines/UIpolicies.txt @@ -73,4 +73,11 @@ Dialogs: within the dialog, but for testing purposes please do not exceed this dialog size should the user have selected a font size of 13 points. +Quoting: + Filenames and paths should be emphasized with <> angle brackets. Anything + else should be emphasized with single quotes ''. e.g.: + + + 'FOOTPRINTNAME' + 'anything else' diff --git a/TODO.txt b/TODO.txt index 7a7a30ec34..621a2e828c 100644 --- a/TODO.txt +++ b/TODO.txt @@ -140,25 +140,22 @@ PCBNew various zoom factors. I believe that a fixed distance in pixels might make for a friendlier UI. -*) Check that the new load visibility BOARD settings is properly setting the toolbar - buttons like show grid or ratsnest. Add PCB_EDIT_FRAME::SetVisibleElements() so - toolbar crap is not known to a BOARD. - -*) Finish removing global access requirements from PLUGINs, so that: - *) a BOARD is a fully self contained document description. - *) plugin developers do not have to access globals, since a plugin could - very well be a dynamically loaded DLL/DSO in the future. - One final problem remains is the BASE_SCREEN's grid origin. An easy - solution is to move just that one field into the BOARD. - -*) Add ::Footprint*() functions to EAGLE_PLUGIN, so that Eagle footprint libraries - can be used in situ. - -*) Add a library table for Pcbnew like that in the sweet library and get rid of the - damn search path strategy. This will enable concurrent usage of various types - of PLUGIN::Footprint*() functions. At least LEGACY and KICAD are both needed - concurrently. - *) Add a hot key to toggle the 45 degree constraint on and off so that it can be changed when drawing a trace. + +Dick's Final TODO List: +====================== +*) write options dialog for fp table dialog. +*) Apply Fabrizio and Alexander's linux desktop patches after unifying them. +*) Get licensing cleaned up. +*) Re-arrange the repo architecture. +*) Merge KiCad GAL/TOM/ORSON if nobody else does. +*) lib_convert.py (i.e. convert) all footprint libraries to pretty format and move copy them to + github if nobody else does. +*) DLL-ization of pcbnew eeschema +*) Pass options, i.e. PROPERTIES to all PLUGIN::Footprint*() calls. Current code needs + to be based on NickNames, not Libpaths, so we have access to the FP_LIB_TABLE::ROWs. + User should not be prompted for a libpath for reading from it, he/she must pick from the + known list of nicknames. Possibly duplicate some of the PLUGIN:::Footprint*() api in ROW or + FP_LIB_TABLE. Again, limited to PLUGIN::Footprint*() calls, not Load() and Save(). diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index bb7d281901..e2fa10f651 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -133,6 +133,7 @@ set(PCB_COMMON_SRCS ../pcbnew/sel_layer.cpp ../pcbnew/pcb_plot_params.cpp ../pcbnew/io_mgr.cpp + ../pcbnew/plugin.cpp ../pcbnew/eagle_plugin.cpp ../pcbnew/legacy_plugin.cpp ../pcbnew/kicad_plugin.cpp diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index 95e20b8a62..5c85243a3d 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -235,7 +235,6 @@ PROPERTIES* FP_LIB_TABLE::ParseOptions( const std::string& aOptionsList ) ++cp; // skip the escape pair += *cp++; // add the separator } - else if( *cp==OPT_SEP ) { ++cp; // skip the separator @@ -248,7 +247,7 @@ PROPERTIES* FP_LIB_TABLE::ParseOptions( const std::string& aOptionsList ) // stash the pair if( pair.size() ) { - // the first equals size established the end of the name + // first equals sign separates 'name' and 'value'. size_t eqNdx = pair.find( '=' ); if( eqNdx != pair.npos ) { @@ -257,7 +256,7 @@ PROPERTIES* FP_LIB_TABLE::ParseOptions( const std::string& aOptionsList ) props[name] = value; } else - props[pair] = ""; + props[pair] = ""; // property is present, but with no value. } } diff --git a/include/fp_lib_table.h b/include/fp_lib_table.h index c23fd4609e..a0c79171b5 100644 --- a/include/fp_lib_table.h +++ b/include/fp_lib_table.h @@ -216,6 +216,24 @@ public: */ void SetDescr( const wxString& aDescr ) { description = aDescr; } + /** + * Function GetProperties + * returns the constant PROPERTIES for this library (ROW). These are + * the "options" in a table. + */ + const PROPERTIES* GetProperties() const { return properties; } + + /** + * Function SetProperties + * sets this ROW's PROPERTIES by taking ownership of @a aProperties. + * @param aProperties ownership is given over to this ROW. + */ + void SetProperties( const PROPERTIES* aProperties ) + { + delete properties; + properties = aProperties; + } + //---------------------------------------------------------- /** @@ -236,6 +254,7 @@ public: LIB_T type; wxString options; wxString description; + const PROPERTIES* properties; }; diff --git a/pcbnew/dialogs/dialog_fp_lib_table.cpp b/pcbnew/dialogs/dialog_fp_lib_table.cpp index dd68317e34..7cccb00684 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table.cpp +++ b/pcbnew/dialogs/dialog_fp_lib_table.cpp @@ -412,11 +412,10 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE { wxString nick = model.GetValue( r, COL_NICKNAME ).Trim( false ).Trim(); wxString uri = model.GetValue( r, COL_URI ).Trim( false ).Trim(); - wxString type = model.GetValue( r, COL_TYPE ).Trim( false ).Trim(); - if( !nick || !uri || !type ) + if( !nick || !uri ) { - // Delete the "empty" row, where empty means missing nick, uri, or type. + // Delete the "empty" row, where empty means missing nick or uri. // This also updates the UI which could be slow, but there should only be a few // rows to delete, unless the user fell asleep on the Add Row // button. @@ -434,7 +433,7 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE m_auinotebook->SetSelection( &model == &m_global_model ? 0 : 1 ); } - // go to the bottom of the two rows, it is technically the duplicate: + // go to the problematic row m_cur_grid->SelectBlock( r, 0, r, 0 ); m_cur_grid->MakeCellVisible( r, 0 ); @@ -447,7 +446,6 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE // set the trimmed values back into the table so they get saved to disk. model.SetValue( r, COL_NICKNAME, nick ); model.SetValue( r, COL_URI, uri ); - model.SetValue( r, COL_TYPE, type ); ++r; // this row was OK. } } @@ -460,9 +458,10 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE for( int r1 = 0; r1 < model.GetNumberRows() - 1; ++r1 ) { + wxString nick1 = model.GetValue( r1, COL_NICKNAME ); + for( int r2=r1+1; r2 < model.GetNumberRows(); ++r2 ) { - wxString nick1 = model.GetValue( r1, COL_NICKNAME ); wxString nick2 = model.GetValue( r2, COL_NICKNAME ); if( nick1 == nick2 ) @@ -478,7 +477,7 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE m_auinotebook->SetSelection( &model == &m_global_model ? 0 : 1 ); } - // go to the bottom of the two rows, it is technically the duplicate: + // go to the lower of the two rows, it is technically the duplicate: m_cur_grid->SelectBlock( r2, 0, r2, 0 ); m_cur_grid->MakeCellVisible( r2, 0 ); @@ -582,7 +581,7 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE void optionsEditor( wxMouseEvent& event ) { // @todo: write the options editor, and pass the options to the Footprint*() calls. - D(printf("%s:%d\n", __func__, (int) m_cur_grid->GetNumberRows() );) + //D(printf("%s:%d\n", __func__, (int) m_cur_grid->GetNumberRows() );) } void onCancelButtonClick( wxCommandEvent& event ) diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 842c94aed8..a9011f363b 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -1105,7 +1105,7 @@ wxSize inline EAGLE_PLUGIN::kicad_fontz( double d ) const } -BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties ) +BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. PTREE doc; @@ -1188,7 +1188,7 @@ BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPE } -void EAGLE_PLUGIN::init( PROPERTIES* aProperties ) +void EAGLE_PLUGIN::init( const PROPERTIES* aProperties ) { m_hole_count = 0; @@ -2800,7 +2800,7 @@ void EAGLE_PLUGIN::cacheLib( const wxString& aLibPath ) } -wxArrayString EAGLE_PLUGIN::FootprintEnumerate( const wxString& aLibraryPath, PROPERTIES* aProperties ) +wxArrayString EAGLE_PLUGIN::FootprintEnumerate( const wxString& aLibraryPath, const PROPERTIES* aProperties ) { init( aProperties ); @@ -2815,7 +2815,7 @@ wxArrayString EAGLE_PLUGIN::FootprintEnumerate( const wxString& aLibraryPath, PR } -MODULE* EAGLE_PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, PROPERTIES* aProperties ) +MODULE* EAGLE_PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties ) { init( aProperties ); @@ -2836,13 +2836,13 @@ MODULE* EAGLE_PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxStrin /* -void EAGLE_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties ) +void EAGLE_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties ) { // Eagle lovers apply here. } -void EAGLE_PLUGIN::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, PROPERTIES* aProperties ) +void EAGLE_PLUGIN::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, const PROPERTIES* aProperties ) { } @@ -2852,12 +2852,12 @@ void EAGLE_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString } -void EAGLE_PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES* aProperties ) +void EAGLE_PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties ) { } -bool EAGLE_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProperties ) +bool EAGLE_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties ) { } diff --git a/pcbnew/eagle_plugin.h b/pcbnew/eagle_plugin.h index 077bb942aa..abe92427e7 100644 --- a/pcbnew/eagle_plugin.h +++ b/pcbnew/eagle_plugin.h @@ -82,13 +82,13 @@ public: //------------------------------------------------------- const wxString& PluginName() const; - BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties = NULL ); + BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties = NULL ); const wxString& GetFileExtension() const; - wxArrayString FootprintEnumerate( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL); + wxArrayString FootprintEnumerate( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL); - MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, PROPERTIES* aProperties = NULL ); + MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties = NULL ); bool IsFootprintLibWritable( const wxString& aLibraryPath ) { @@ -96,16 +96,15 @@ public: } /* - void Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties = NULL ); + void Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties = NULL ); - void FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, PROPERTIES* aProperties = NULL ); + void FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, const PROPERTIES* aProperties = NULL ); - void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName ); + void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties = NULL ); - void FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL ); - - bool FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL ); + void FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL ); + bool FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL ); */ //------------------------------------------------------ @@ -132,7 +131,7 @@ private: ///< lookup key is either libname.packagename or simply ///< packagename if FootprintLoad() or FootprintEnumberate() - PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. + const PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. BOARD* m_board; ///< which BOARD is being worked on, no ownership here int m_min_trace; ///< smallest trace we find on Load(), in BIU. @@ -146,7 +145,7 @@ private: wxDateTime m_mod_time; /// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed. - void init( PROPERTIES* aProperties ); + void init( const PROPERTIES* aProperties ); void clear_cu_map(); diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp index 3fe218fd78..3c294c9135 100644 --- a/pcbnew/gpcb_plugin.cpp +++ b/pcbnew/gpcb_plugin.cpp @@ -805,7 +805,7 @@ GPCB_PLUGIN::~GPCB_PLUGIN() } -void GPCB_PLUGIN::init( PROPERTIES* aProperties ) +void GPCB_PLUGIN::init( const PROPERTIES* aProperties ) { m_props = aProperties; } @@ -824,7 +824,7 @@ void GPCB_PLUGIN::cacheLib( const wxString& aLibraryPath ) wxArrayString GPCB_PLUGIN::FootprintEnumerate( const wxString& aLibraryPath, - PROPERTIES* aProperties ) + const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -846,7 +846,7 @@ wxArrayString GPCB_PLUGIN::FootprintEnumerate( const wxString& aLibraryPath, MODULE* GPCB_PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - PROPERTIES* aProperties ) + const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -868,11 +868,11 @@ MODULE* GPCB_PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString } -void GPCB_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName ) +void GPCB_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. - init( NULL ); + init( aProperties ); cacheLib( aLibraryPath ); @@ -886,7 +886,7 @@ void GPCB_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString& } -bool GPCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProperties ) +bool GPCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties ) { wxFileName fn; fn.SetPath( aLibraryPath ); diff --git a/pcbnew/gpcb_plugin.h b/pcbnew/gpcb_plugin.h index 7d33bf28cd..3e38d67e36 100644 --- a/pcbnew/gpcb_plugin.h +++ b/pcbnew/gpcb_plugin.h @@ -64,14 +64,14 @@ public: return extension; } - wxArrayString FootprintEnumerate( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL); + wxArrayString FootprintEnumerate( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL); MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - PROPERTIES* aProperties = NULL ); + const PROPERTIES* aProperties = NULL ); - void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName ); + void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties = NULL ); - bool FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL ); + bool FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL ); bool IsFootprintLibWritable( const wxString& aLibraryPath ); @@ -86,7 +86,7 @@ public: protected: wxString m_error; ///< for throwing exceptions - PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. + const PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. GPCB_FPL_CACHE* m_cache; ///< Footprint library cache. int m_ctl; @@ -97,7 +97,7 @@ private: /// we only cache one footprint library for now, this determines which one. void cacheLib( const wxString& aLibraryPath ); - void init( PROPERTIES* aProperties ); + void init( const PROPERTIES* aProperties ); }; #endif // _GPCB_PLUGIN_H_ diff --git a/pcbnew/io_mgr.cpp b/pcbnew/io_mgr.cpp index 0a3d222748..0cc72fa4bb 100644 --- a/pcbnew/io_mgr.cpp +++ b/pcbnew/io_mgr.cpp @@ -54,9 +54,6 @@ // plugins coexisting. -// static LEGACY_PLUGIN kicad_plugin; -// static EAGLE_PLUGIN eagle_plugin; - PLUGIN* IO_MGR::PluginFind( PCB_FILE_T aFileType ) { // This implementation is subject to change, any magic is allowed here. @@ -221,7 +218,7 @@ IO_MGR::PCB_FILE_T IO_MGR::GuessPluginTypeFromLibPath( const wxString& aLibPath BOARD* IO_MGR::Load( PCB_FILE_T aFileType, const wxString& aFileName, - BOARD* aAppendToMe, PROPERTIES* aProperties ) + BOARD* aAppendToMe, const PROPERTIES* aProperties ) { // release the PLUGIN even if an exception is thrown. PLUGIN::RELEASER pi = PluginFind( aFileType ); @@ -235,7 +232,7 @@ BOARD* IO_MGR::Load( PCB_FILE_T aFileType, const wxString& aFileName, } -void IO_MGR::Save( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties ) +void IO_MGR::Save( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties ) { // release the PLUGIN even if an exception is thrown. PLUGIN::RELEASER pi = PluginFind( aFileType ); @@ -249,67 +246,3 @@ void IO_MGR::Save( PCB_FILE_T aFileType, const wxString& aFileName, BOARD* aBoar THROW_IO_ERROR( wxString::Format( FMT_NOTFOUND, ShowType( aFileType ).GetData() ) ); } - -BOARD* PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties ) -{ - // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. - THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData(), __FUNCTION__ ) ); -} - - -void PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties ) -{ - // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. - THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData(), __FUNCTION__ ) ); -} - - -wxArrayString PLUGIN::FootprintEnumerate( const wxString& aLibraryPath, PROPERTIES* aProperties ) -{ - // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. - THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) ); -} - - -MODULE* PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - PROPERTIES* aProperties ) -{ - // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. - THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) ); -} - - -void PLUGIN::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, PROPERTIES* aProperties ) -{ - // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. - THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) ); -} - - -void PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName ) -{ - // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. - THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) ); -} - - -void PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES* aProperties ) -{ - // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. - THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) ); -} - - -bool PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProperties ) -{ - // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. - THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) ); -} - - -bool PLUGIN::IsFootprintLibWritable( const wxString& aLibraryPath ) -{ - // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. - THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) ); -} - diff --git a/pcbnew/io_mgr.h b/pcbnew/io_mgr.h index a83f7e8914..6e70e668da 100644 --- a/pcbnew/io_mgr.h +++ b/pcbnew/io_mgr.h @@ -134,7 +134,7 @@ public: * or file cannot be loaded. */ static BOARD* Load( PCB_FILE_T aFileType, const wxString& aFileName, - BOARD* aAppendToMe = NULL, PROPERTIES* aProperties = NULL ); + BOARD* aAppendToMe = NULL, const PROPERTIES* aProperties = NULL ); /** * Function Save @@ -160,7 +160,7 @@ public: * @throw IO_ERROR if there is a problem saving or exporting. */ static void Save( PCB_FILE_T aFileType, const wxString& aFileName, - BOARD* aBoard, PROPERTIES* aProperties = NULL ); + BOARD* aBoard, const PROPERTIES* aProperties = NULL ); }; @@ -231,7 +231,7 @@ public: * input file if possible. */ virtual BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, - PROPERTIES* aProperties = NULL ); + const PROPERTIES* aProperties = NULL ); /** * Function Save @@ -254,7 +254,7 @@ public: * @throw IO_ERROR if there is a problem saving or exporting. */ virtual void Save( const wxString& aFileName, BOARD* aBoard, - PROPERTIES* aProperties = NULL ); + const PROPERTIES* aProperties = NULL ); //---------------------------------- @@ -276,7 +276,7 @@ public: * @throw IO_ERROR if the library cannot be found, or footprint cannot be loaded. */ virtual wxArrayString FootprintEnumerate( const wxString& aLibraryPath, - PROPERTIES* aProperties = NULL); + const PROPERTIES* aProperties = NULL ); /** * Function FootprintLoad @@ -300,7 +300,7 @@ public: * is thrown in the case where aFootprintName cannot be found. */ virtual MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - PROPERTIES* aProperties = NULL ); + const PROPERTIES* aProperties = NULL ); /** * Function FootprintSave @@ -323,7 +323,7 @@ public: * @throw IO_ERROR if there is a problem saving. */ virtual void FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, - PROPERTIES* aProperties = NULL ); + const PROPERTIES* aProperties = NULL ); /** * Function FootprintDelete @@ -334,9 +334,16 @@ public: * * @param aFootprintName is the name of a footprint to delete from the specified library. * + * @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. + * * @throw IO_ERROR if there is a problem finding the footprint or the library, or deleting it. */ - virtual void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName ); + virtual void FootprintDelete( const wxString& aLibraryPath, + const wxString& aFootprintName, const PROPERTIES* aProperties = NULL ); /** * Function FootprintLibCreate @@ -355,7 +362,7 @@ public: * * @throw IO_ERROR if there is a problem finding the library, or creating it. */ - virtual void FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL ); + virtual void FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL ); /** * Function FootprintLibDelete @@ -376,7 +383,7 @@ public: * * @throw IO_ERROR if there is a problem deleting an existing library. */ - virtual bool FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL ); + virtual bool FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL ); /** * Function IsFootprintLibWritable diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 91ebe6e1e8..6e973a618c 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -361,7 +361,7 @@ bool FP_CACHE::IsModified( const wxString& aLibPath, const wxString& aFootprintN } -void PCB_IO::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties ) +void PCB_IO::Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -1632,7 +1632,7 @@ PCB_IO::~PCB_IO() } -BOARD* PCB_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties ) +BOARD* PCB_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties ) { FILE_LINE_READER reader( aFileName ); @@ -1652,7 +1652,7 @@ BOARD* PCB_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* } -void PCB_IO::init( PROPERTIES* aProperties ) +void PCB_IO::init( const PROPERTIES* aProperties ) { m_board = NULL; m_props = aProperties; @@ -1671,7 +1671,7 @@ void PCB_IO::cacheLib( const wxString& aLibraryPath, const wxString& aFootprintN } -wxArrayString PCB_IO::FootprintEnumerate( const wxString& aLibraryPath, PROPERTIES* aProperties ) +wxArrayString PCB_IO::FootprintEnumerate( const wxString& aLibraryPath, const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -1693,7 +1693,7 @@ wxArrayString PCB_IO::FootprintEnumerate( const wxString& aLibraryPath, PROPERTI MODULE* PCB_IO::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - PROPERTIES* aProperties ) + const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -1716,7 +1716,7 @@ MODULE* PCB_IO::FootprintLoad( const wxString& aLibraryPath, const wxString& aFo void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, - PROPERTIES* aProperties ) + const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -1783,7 +1783,7 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri } -void PCB_IO::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName ) +void PCB_IO::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -1801,7 +1801,7 @@ void PCB_IO::FootprintDelete( const wxString& aLibraryPath, const wxString& aFoo } -void PCB_IO::FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES* aProperties ) +void PCB_IO::FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties ) { if( wxDir::Exists( aLibraryPath ) ) { @@ -1819,7 +1819,7 @@ void PCB_IO::FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES* aProp } -bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProperties ) +bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties ) { wxFileName fn; fn.SetPath( aLibraryPath ); diff --git a/pcbnew/kicad_plugin.h b/pcbnew/kicad_plugin.h index 008ab6e12c..5b18ae3e3f 100644 --- a/pcbnew/kicad_plugin.h +++ b/pcbnew/kicad_plugin.h @@ -99,23 +99,23 @@ public: } void Save( const wxString& aFileName, BOARD* aBoard, - PROPERTIES* aProperties = NULL ); // overload + const PROPERTIES* aProperties = NULL ); // overload - BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties = NULL ); + BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties = NULL ); - wxArrayString FootprintEnumerate( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL); + wxArrayString FootprintEnumerate( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL); MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - PROPERTIES* aProperties = NULL ); + const PROPERTIES* aProperties = NULL ); void FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, - PROPERTIES* aProperties = NULL ); + const PROPERTIES* aProperties = NULL ); - void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName ); + void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties = NULL ); - void FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL); + void FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL); - bool FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL ); + bool FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL ); bool IsFootprintLibWritable( const wxString& aLibraryPath ); @@ -156,7 +156,7 @@ protected: wxString m_error; ///< for throwing exceptions BOARD* m_board; ///< which BOARD, no ownership here - PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. + const PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. FP_CACHE* m_cache; ///< Footprint library cache. LINE_READER* m_reader; ///< no ownership here. @@ -212,7 +212,7 @@ private: /// we only cache one footprint library for now, this determines which one. void cacheLib( const wxString& aLibraryPath, const wxString& aFootprintName = wxEmptyString ); - void init( PROPERTIES* aProperties ); + void init( const PROPERTIES* aProperties ); }; #endif // KICAD_PLUGIN_H_ diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 80c8d42ce4..9f912da92e 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -231,7 +231,7 @@ static inline long hexParse( const char* next, const char** out = NULL ) } -BOARD* LEGACY_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties ) +BOARD* LEGACY_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -2817,7 +2817,7 @@ double LEGACY_PLUGIN::degParse( const char* aValue, const char** nptrptr ) } -void LEGACY_PLUGIN::init( PROPERTIES* aProperties ) +void LEGACY_PLUGIN::init( const PROPERTIES* aProperties ) { m_board = NULL; m_props = aProperties; @@ -2838,7 +2838,7 @@ void LEGACY_PLUGIN::init( PROPERTIES* aProperties ) //-------------------------------------------------------- -void LEGACY_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties ) +void LEGACY_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -2858,17 +2858,6 @@ void LEGACY_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* m_fp = fp; // member function accessibility -#if 0 // old school, property "header" was not used by any other plugin. - if( m_props ) - { - wxString header = (*m_props)["header"]; - - // save a file header, if caller provided one (with trailing \n hopefully). - fprintf( m_fp, "%s", TO_UTF8( header ) ); - } - -#else - wxString header = wxString::Format( wxT( "PCBNEW-BOARD Version %d date %s\n\n# Created by Pcbnew%s\n\n" ), LEGACY_BOARD_FILE_VERSION, DateAndTime().GetData(), @@ -2876,7 +2865,6 @@ void LEGACY_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* // save a file header, if caller provided one (with trailing \n hopefully). fprintf( m_fp, "%s", TO_UTF8( header ) ); -#endif SaveBOARD( aBoard ); } @@ -4225,7 +4213,7 @@ void LEGACY_PLUGIN::cacheLib( const wxString& aLibraryPath ) } -wxArrayString LEGACY_PLUGIN::FootprintEnumerate( const wxString& aLibraryPath, PROPERTIES* aProperties ) +wxArrayString LEGACY_PLUGIN::FootprintEnumerate( const wxString& aLibraryPath, const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -4246,8 +4234,8 @@ wxArrayString LEGACY_PLUGIN::FootprintEnumerate( const wxString& aLibraryPath, P } -MODULE* LEGACY_PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - PROPERTIES* aProperties ) +MODULE* LEGACY_PLUGIN::FootprintLoad( const wxString& aLibraryPath, + const wxString& aFootprintName, const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -4274,7 +4262,8 @@ MODULE* LEGACY_PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxStri } -void LEGACY_PLUGIN::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, PROPERTIES* aProperties ) +void LEGACY_PLUGIN::FootprintSave( const wxString& aLibraryPath, + const MODULE* aFootprint, const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -4318,7 +4307,8 @@ void LEGACY_PLUGIN::FootprintSave( const wxString& aLibraryPath, const MODULE* a } -void LEGACY_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName ) +void LEGACY_PLUGIN::FootprintDelete( const wxString& aLibraryPath, + const wxString& aFootprintName, const PROPERTIES* aProperties ) { LOCALE_IO toggle; // toggles on, then off, the C locale. @@ -4346,7 +4336,7 @@ void LEGACY_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxStrin } -void LEGACY_PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES* aProperties ) +void LEGACY_PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties ) { if( wxFileExists( aLibraryPath ) ) { @@ -4366,7 +4356,7 @@ void LEGACY_PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES } -bool LEGACY_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProperties ) +bool LEGACY_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties ) { wxFileName fn = aLibraryPath; diff --git a/pcbnew/legacy_plugin.h b/pcbnew/legacy_plugin.h index e2c99e7e30..b17aecb79d 100644 --- a/pcbnew/legacy_plugin.h +++ b/pcbnew/legacy_plugin.h @@ -76,23 +76,23 @@ public: return extension; } - BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties = NULL ); // overload + BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties = NULL ); - void Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties = NULL ); // overload + void Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties = NULL ); - wxArrayString FootprintEnumerate( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL); + wxArrayString FootprintEnumerate( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL); MODULE* FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - PROPERTIES* aProperties = NULL ); + const PROPERTIES* aProperties = NULL ); void FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, - PROPERTIES* aProperties = NULL ); + const PROPERTIES* aProperties = NULL ); - void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName ); + void FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties = NULL ); - void FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL ); + void FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL ); - bool FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProperties = NULL ); + bool FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties = NULL ); bool IsFootprintLibWritable( const wxString& aLibraryPath ); @@ -116,7 +116,7 @@ protected: wxString m_error; ///< for throwing exceptions BOARD* m_board; ///< which BOARD, no ownership here - PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. + const PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. LINE_READER* m_reader; ///< no ownership here. FILE* m_fp; ///< no ownership here. @@ -127,7 +127,7 @@ protected: LP_CACHE* m_cache; /// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed. - void init( PROPERTIES* aProperties ); + void init( const PROPERTIES* aProperties ); double biuToDisk; ///< convert from BIUs to disk engineering units ///< with this scale factor diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 708fca9e1e..c1f82899ff 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -619,7 +619,7 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibPath, if( ! MODULE::IsLibNameValid( footprintName ) ) { wxString msg; - msg.Printf( _("Error:\none of invalid chars <%s> found\nin <%s>" ), + msg.Printf( _("Error:\none of invalid chars '%s' found\nin '%s'" ), MODULE::ReturnStringLibNameInvalidChars( true ), GetChars( footprintName ) ); diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 53dde24230..376fd83600 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -451,7 +451,7 @@ MODULE* PCB_BASE_FRAME::loadFootprint( const FPID& aFootprintId ) PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::EnumFromStr( row->GetType() ) ) ); - return pi->FootprintLoad( libPath, footprintName ); + return pi->FootprintLoad( libPath, footprintName, row->GetProperties() ); } diff --git a/pcbnew/pcad2kicadpcb_plugin/pcad_plugin.cpp b/pcbnew/pcad2kicadpcb_plugin/pcad_plugin.cpp index 86cfcb3a06..c605f42a26 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcad_plugin.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcad_plugin.cpp @@ -71,7 +71,7 @@ const wxString& PCAD_PLUGIN::GetFileExtension() const } -BOARD* PCAD_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties ) +BOARD* PCAD_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties ) { wxXmlDocument xmlDoc; diff --git a/pcbnew/pcad2kicadpcb_plugin/pcad_plugin.h b/pcbnew/pcad2kicadpcb_plugin/pcad_plugin.h index aaefce22e0..55949829ff 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcad_plugin.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcad_plugin.h @@ -43,7 +43,7 @@ public: BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, - PROPERTIES* aProperties = NULL ); + const PROPERTIES* aProperties = NULL ); const wxString& GetFileExtension() const; @@ -52,8 +52,8 @@ public: PCAD_PLUGIN(); ~PCAD_PLUGIN(); private: - PROPERTIES* m_props; - BOARD* m_board; + const PROPERTIES* m_props; + BOARD* m_board; }; #endif // PCAD_PLUGIN_H_ diff --git a/pcbnew/plugin.cpp b/pcbnew/plugin.cpp index 7153247b39..77d6e7f3ec 100644 --- a/pcbnew/plugin.cpp +++ b/pcbnew/plugin.cpp @@ -1,27 +1,48 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2011-2012 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2011 KiCad Developers, see change_log.txt for contributors. + * + * 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 -//#include - #define FMT_UNIMPLEMENTED _( "Plugin '%s' does not implement the '%s' function." ) #define FMT_NOTFOUND _( "Plugin type '%s' is not found." ) -BOARD* PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties ) +BOARD* PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties ) { // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData(), __FUNCTION__ ) ); } -void PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties ) +void PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties ) { // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData(), __FUNCTION__ ) ); } -wxArrayString PLUGIN::FootprintEnumerate( const wxString& aLibraryPath, PROPERTIES* aProperties ) +wxArrayString PLUGIN::FootprintEnumerate( const wxString& aLibraryPath, const PROPERTIES* aProperties ) { // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) ); @@ -29,35 +50,35 @@ wxArrayString PLUGIN::FootprintEnumerate( const wxString& aLibraryPath, PROPERTI MODULE* PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, - PROPERTIES* aProperties ) + const PROPERTIES* aProperties ) { // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) ); } -void PLUGIN::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, PROPERTIES* aProperties ) +void PLUGIN::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, const PROPERTIES* aProperties ) { // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) ); } -void PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName ) +void PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties ) { // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) ); } -void PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES* aProperties ) +void PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties ) { // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) ); } -bool PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProperties ) +bool PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties ) { // not pure virtual so that plugins only have to implement subset of the PLUGIN interface. THROW_IO_ERROR( wxString::Format( FMT_UNIMPLEMENTED, PluginName().GetData() , __FUNCTION__ ) ); diff --git a/pcbnew/scripting/pcbnew_scripting_helpers.cpp b/pcbnew/scripting/pcbnew_scripting_helpers.cpp index d26f76d374..42a0a14391 100644 --- a/pcbnew/scripting/pcbnew_scripting_helpers.cpp +++ b/pcbnew/scripting/pcbnew_scripting_helpers.cpp @@ -88,6 +88,7 @@ bool SaveBoard( wxString& aFileName, BOARD* aBoard, aBoard->SynchronizeNetsAndNetClasses(); aBoard->SetCurrentNetClass( aBoard->m_NetClasses.GetDefault()->GetName() ); +#if 0 wxString header; PROPERTIES props; @@ -100,7 +101,9 @@ bool SaveBoard( wxString& aFileName, BOARD* aBoard, props["header"] = header; } - IO_MGR::Save( aFormat, aFileName, aBoard, &props ); +#else + IO_MGR::Save( aFormat, aFileName, aBoard, NULL ); +#endif return true; }