Clearer naming and commenting.

Also some const& hygiene and some formatting.
This commit is contained in:
Jeff Young 2024-06-25 09:10:18 +01:00
parent 0a5784fc9e
commit 14a55facf2
22 changed files with 88 additions and 99 deletions

View File

@ -23,8 +23,8 @@
#include <wx/listctrl.h>
DIALOG_IMPORT_CHOOSE_PROJECT::DIALOG_IMPORT_CHOOSE_PROJECT(
wxWindow* aParent, const std::vector<IMPORT_PROJECT_DESC>& aProjectDesc ) :
DIALOG_IMPORT_CHOOSE_PROJECT::DIALOG_IMPORT_CHOOSE_PROJECT( wxWindow* aParent,
const std::vector<IMPORT_PROJECT_DESC>& aProjectDesc ) :
DIALOG_IMPORT_CHOOSE_PROJECT_BASE( aParent )
{
m_project_desc = aProjectDesc;
@ -49,8 +49,7 @@ DIALOG_IMPORT_CHOOSE_PROJECT::DIALOG_IMPORT_CHOOSE_PROJECT(
{
m_listCtrl->InsertItem( row, convertName( desc.ComboName, desc.ComboId ) );
m_listCtrl->SetItem( row, pcbNameColId, convertName( desc.PCBName, desc.PCBId ) );
m_listCtrl->SetItem( row, schNameColId,
convertName( desc.SchematicName, desc.SchematicId ) );
m_listCtrl->SetItem( row, schNameColId, convertName( desc.SchematicName, desc.SchematicId ) );
++row;
}
@ -81,7 +80,7 @@ void DIALOG_IMPORT_CHOOSE_PROJECT::onClose( wxCloseEvent& event )
}
std::vector<IMPORT_PROJECT_DESC> DIALOG_IMPORT_CHOOSE_PROJECT::GetProjectSelections()
std::vector<IMPORT_PROJECT_DESC> DIALOG_IMPORT_CHOOSE_PROJECT::GetProjects()
{
std::vector<IMPORT_PROJECT_DESC> result;
@ -100,13 +99,14 @@ std::vector<IMPORT_PROJECT_DESC> DIALOG_IMPORT_CHOOSE_PROJECT::GetProjectSelecti
}
std::vector<IMPORT_PROJECT_DESC> DIALOG_IMPORT_CHOOSE_PROJECT::GetSelectionsModal(
wxWindow* aParent, const std::vector<IMPORT_PROJECT_DESC>& aProjectDesc )
std::vector<IMPORT_PROJECT_DESC>
DIALOG_IMPORT_CHOOSE_PROJECT::RunModal( wxWindow* aParent,
const std::vector<IMPORT_PROJECT_DESC>& aProjectDesc )
{
DIALOG_IMPORT_CHOOSE_PROJECT dlg( aParent, aProjectDesc );
if( dlg.ShowModal() != wxID_OK )
return {};
return dlg.GetProjectSelections();
return dlg.GetProjects();
}

View File

@ -38,13 +38,13 @@ public:
* @param aProjectDesc are project descriptors.
*/
static std::vector<IMPORT_PROJECT_DESC>
GetSelectionsModal( wxWindow* aParent, const std::vector<IMPORT_PROJECT_DESC>& aProjectDesc );
RunModal( wxWindow* aParent, const std::vector<IMPORT_PROJECT_DESC>& aProjectDesc );
void onItemActivated( wxListEvent& event ) override;
void onClose( wxCloseEvent& event ) override;
std::vector<IMPORT_PROJECT_DESC> GetProjectSelections();
std::vector<IMPORT_PROJECT_DESC> GetProjects();
private:
std::vector<IMPORT_PROJECT_DESC> m_project_desc;

View File

@ -60,7 +60,7 @@ public:
* The function is marked as virtual, so the plugins can implement extra
* logic (e.g., enable warnings or checks)
*/
virtual void RegisterChooseProjectCallback( CHOOSE_PROJECT_HANDLER aChooseProjectHandler )
virtual void RegisterCallback( CHOOSE_PROJECT_HANDLER aChooseProjectHandler )
{
m_choose_project_handler = aChooseProjectHandler;
}

View File

@ -1390,14 +1390,10 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType,
DIALOG_HTML_REPORTER errorReporter( this );
WX_PROGRESS_REPORTER progressReporter( this, _( "Importing Schematic" ), 1 );
PROJECT_CHOOSER_PLUGIN* projectChooserPlugin =
dynamic_cast<PROJECT_CHOOSER_PLUGIN*>( pi.get() );
if( projectChooserPlugin )
if( PROJECT_CHOOSER_PLUGIN* c_pi = dynamic_cast<PROJECT_CHOOSER_PLUGIN*>( pi.get() ) )
{
projectChooserPlugin->RegisterChooseProjectCallback(
std::bind( DIALOG_IMPORT_CHOOSE_PROJECT::GetSelectionsModal, this,
std::placeholders::_1 ) );
c_pi->RegisterCallback( std::bind( DIALOG_IMPORT_CHOOSE_PROJECT::RunModal,
this, std::placeholders::_1 ) );
}
if( eeconfig()->m_System.show_import_issues )

View File

@ -184,9 +184,7 @@ void IMPORT_PROJ_HELPER::EasyEDAProProjectHandler()
EASYEDAPRO::ProjectToSelectorDialog( project, false, false );
if( toImport.size() > 1 )
{
toImport = DIALOG_IMPORT_CHOOSE_PROJECT::GetSelectionsModal( m_frame, toImport );
}
toImport = DIALOG_IMPORT_CHOOSE_PROJECT::RunModal( m_frame, toImport );
if( toImport.size() == 1 )
{

View File

@ -107,7 +107,7 @@ set( PCBNEW_DIALOGS
dialogs/dialog_import_settings.cpp
dialogs/dialog_import_settings_base.cpp
dialogs/dialog_imported_layers_base.cpp
dialogs/dialog_imported_layers.cpp
dialogs/dialog_map_layers.cpp
dialogs/dialog_rule_area_properties.cpp
dialogs/dialog_rule_area_properties_base.cpp
dialogs/dialog_layer_selection_base.cpp

View File

@ -20,18 +20,18 @@
#include <layer_ids.h>
#include <dialog_imported_layers.h>
#include <dialog_map_layers.h>
#include <wx/msgdlg.h>
wxString DIALOG_IMPORTED_LAYERS::WrapRequired( const wxString& aLayerName )
wxString DIALOG_MAP_LAYERS::WrapRequired( const wxString& aLayerName )
{
return aLayerName + wxT( " *" );
}
wxString DIALOG_IMPORTED_LAYERS::UnwrapRequired( const wxString& aLayerName )
wxString DIALOG_MAP_LAYERS::UnwrapRequired( const wxString& aLayerName )
{
if( !aLayerName.EndsWith( wxT( " *" ) ) )
return aLayerName;
@ -40,8 +40,7 @@ wxString DIALOG_IMPORTED_LAYERS::UnwrapRequired( const wxString& aLayerName )
}
const INPUT_LAYER_DESC* DIALOG_IMPORTED_LAYERS::GetLayerDescription(
const wxString& aLayerName ) const
const INPUT_LAYER_DESC* DIALOG_MAP_LAYERS::GetLayerDescription( const wxString& aLayerName ) const
{
wxString layerName = UnwrapRequired( aLayerName );
@ -55,7 +54,7 @@ const INPUT_LAYER_DESC* DIALOG_IMPORTED_LAYERS::GetLayerDescription(
}
PCB_LAYER_ID DIALOG_IMPORTED_LAYERS::GetSelectedLayerID()
PCB_LAYER_ID DIALOG_MAP_LAYERS::GetSelectedLayerID()
{
// First check if there is a KiCad element selected
wxString selectedKiCadLayerName;
@ -86,10 +85,11 @@ PCB_LAYER_ID DIALOG_IMPORTED_LAYERS::GetSelectedLayerID()
}
PCB_LAYER_ID DIALOG_IMPORTED_LAYERS::GetAutoMatchLayerID( const wxString& aInputLayerName )
PCB_LAYER_ID DIALOG_MAP_LAYERS::GetAutoMatchLayerID( const wxString& aInputLayerName )
{
wxString pureInputLayerName = UnwrapRequired( aInputLayerName );
for( INPUT_LAYER_DESC inputLayerDesc : m_input_layers )
for( const INPUT_LAYER_DESC& inputLayerDesc : m_input_layers )
{
if( inputLayerDesc.Name == pureInputLayerName
&& inputLayerDesc.AutoMapLayer != PCB_LAYER_ID::UNSELECTED_LAYER )
@ -102,7 +102,7 @@ PCB_LAYER_ID DIALOG_IMPORTED_LAYERS::GetAutoMatchLayerID( const wxString& aInput
}
void DIALOG_IMPORTED_LAYERS::AddMappings()
void DIALOG_MAP_LAYERS::AddMappings()
{
PCB_LAYER_ID selectedKiCadLayerID = GetSelectedLayerID();
@ -148,7 +148,7 @@ void DIALOG_IMPORTED_LAYERS::AddMappings()
}
void DIALOG_IMPORTED_LAYERS::RemoveMappings( int aStatus )
void DIALOG_MAP_LAYERS::RemoveMappings( int aStatus )
{
wxArrayInt rowsToDelete;
int itemIndex = -1;
@ -173,17 +173,14 @@ void DIALOG_IMPORTED_LAYERS::RemoveMappings( int aStatus )
}
void DIALOG_IMPORTED_LAYERS::DeleteListItems( const wxArrayInt& aRowsToDelete,
wxListCtrl* aListCtrl )
void DIALOG_MAP_LAYERS::DeleteListItems( const wxArrayInt& aRowsToDelete, wxListCtrl* aListCtrl )
{
for( long n = ( aRowsToDelete.GetCount() - 1 ); 0 <= n; n-- )
{
for( long n = (long) aRowsToDelete.GetCount() - 1; 0 <= n; n-- )
aListCtrl->DeleteItem( aRowsToDelete[n] );
}
}
void DIALOG_IMPORTED_LAYERS::OnAutoMatchLayersClicked( wxCommandEvent& event )
void DIALOG_MAP_LAYERS::OnAutoMatchLayersClicked( wxCommandEvent& event )
{
// Iterate through each selected layer in the unmatched layers list
int itemIndex = -1;
@ -225,14 +222,14 @@ void DIALOG_IMPORTED_LAYERS::OnAutoMatchLayersClicked( wxCommandEvent& event )
}
DIALOG_IMPORTED_LAYERS::DIALOG_IMPORTED_LAYERS( wxWindow* aParent,
const std::vector<INPUT_LAYER_DESC>& aLayerDesc ) :
DIALOG_MAP_LAYERS::DIALOG_MAP_LAYERS( wxWindow* aParent,
const std::vector<INPUT_LAYER_DESC>& aLayerDesc ) :
DIALOG_IMPORTED_LAYERS_BASE( aParent )
{
LSET kiCadLayers;
// Read in the input layers
for( INPUT_LAYER_DESC inLayer : aLayerDesc )
for( const INPUT_LAYER_DESC& inLayer : aLayerDesc )
{
m_input_layers.push_back( inLayer );
wxString layerName = inLayer.Required ? WrapRequired( inLayer.Name ) : inLayer.Name;
@ -269,7 +266,7 @@ DIALOG_IMPORTED_LAYERS::DIALOG_IMPORTED_LAYERS( wxWindow* aParent,
// Load the input layer list to unmatched layers
int row = 0;
for( wxString importedLayerName : m_unmatched_layer_names )
for( const wxString& importedLayerName : m_unmatched_layer_names )
{
wxListItem item;
item.SetId( row );
@ -306,7 +303,7 @@ DIALOG_IMPORTED_LAYERS::DIALOG_IMPORTED_LAYERS( wxWindow* aParent,
}
std::vector<wxString> DIALOG_IMPORTED_LAYERS::GetUnmappedRequiredLayers() const
std::vector<wxString> DIALOG_MAP_LAYERS::GetUnmappedRequiredLayers() const
{
std::vector<wxString> unmappedLayers;
@ -324,11 +321,10 @@ std::vector<wxString> DIALOG_IMPORTED_LAYERS::GetUnmappedRequiredLayers() const
std::map<wxString, PCB_LAYER_ID>
DIALOG_IMPORTED_LAYERS::GetMapModal( wxWindow* aParent,
const std::vector<INPUT_LAYER_DESC>& aLayerDesc )
DIALOG_MAP_LAYERS::RunModal( wxWindow* aParent, const std::vector<INPUT_LAYER_DESC>& aLayerDesc )
{
DIALOG_IMPORTED_LAYERS dlg( aParent, aLayerDesc );
bool dataOk = false;
DIALOG_MAP_LAYERS dlg( aParent, aLayerDesc );
bool dataOk = false;
while( !dataOk )
{

View File

@ -25,10 +25,10 @@
#include <pcb_io/common/plugin_common_layer_mapping.h>
class DIALOG_IMPORTED_LAYERS : public DIALOG_IMPORTED_LAYERS_BASE
class DIALOG_MAP_LAYERS : public DIALOG_IMPORTED_LAYERS_BASE
{
public:
DIALOG_IMPORTED_LAYERS( wxWindow* aParent, const std::vector<INPUT_LAYER_DESC>& aLayerDesc );
DIALOG_MAP_LAYERS( wxWindow* aParent, const std::vector<INPUT_LAYER_DESC>& aLayerDesc );
/**
* Return a list of layers names that are required, but they are not mapped.
@ -43,8 +43,8 @@ public:
* @param aLayerDesc
* @return Mapped layers
*/
static std::map<wxString, PCB_LAYER_ID> GetMapModal( wxWindow* aParent,
const std::vector<INPUT_LAYER_DESC>& aLayerDesc );
static std::map<wxString, PCB_LAYER_ID> RunModal( wxWindow* aParent,
const std::vector<INPUT_LAYER_DESC>& aLayerDesc );
private:
//Helper functions

View File

@ -63,7 +63,7 @@
#include <pcb_io/cadstar/pcb_io_cadstar_archive.h>
#include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <dialogs/dialog_export_2581.h>
#include <dialogs/dialog_imported_layers.h>
#include <dialogs/dialog_map_layers.h>
#include <dialogs/dialog_import_choose_project.h>
#include <tools/pcb_actions.h>
#include "footprint_info_impl.h"
@ -525,10 +525,9 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
if( !lock->Valid() && lock->IsLockedByMe() )
{
// If we cannot acquire the lock but we appear to be the one who
// locked it, check to see if there is another KiCad instance running.
// If there is not, then we can override the lock. This could happen if
// KiCad crashed or was interrupted
// If we cannot acquire the lock but we appear to be the one who locked it, check to
// see if there is another KiCad instance running. If not, then we can override the
// lock. This could happen if KiCad crashed or was interrupted.
if( !Pgm().SingleInstance()->IsAnotherRunning() )
lock->OverrideLock();
@ -536,8 +535,10 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
if( !lock->Valid() )
{
msg.Printf( _( "PCB '%s' is already open by '%s' at '%s'." ), wx_filename.GetFullName(),
lock->GetUsername(), lock->GetHostname() );
msg.Printf( _( "PCB '%s' is already open by '%s' at '%s'." ),
wx_filename.GetFullName(),
lock->GetUsername(),
lock->GetHostname() );
if( !AskOverrideLock( this, msg ) )
return false;
@ -562,7 +563,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
bool is_new = !wxFileName::IsFileReadable( fullFileName );
// If its a non-existent schematic and caller thinks it exists
// If its a non-existent PCB and caller thinks it exists
if( is_new && !( aCtl & KICTL_CREATE ) )
{
// notify user that fullFileName does not exist, ask if user wants to create it.
@ -609,9 +610,9 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
mgr->LoadProject( pro.GetFullPath() );
// Do not allow saving a project if one doesn't exist. This normally happens if we are
// standalone and opening a board that has been moved from its project folder.
// For converted projects, we don't want to set the read-only flag because we want a project
// to be saved for the new file in case things like netclasses got migrated.
// opening a board that has been moved from its project folder.
// For converted projects, we don't want to set the read-only flag because we want a
// project to be saved for the new file in case things like netclasses got migrated.
Prj().SetReadOnly( !pro.Exists() && !converted );
}
@ -632,21 +633,17 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
BOARD* loadedBoard = nullptr; // it will be set to non-NULL if loaded OK
IO_RELEASER<PCB_IO> pi( PCB_IO_MGR::PluginFind( pluginType ) );
LAYER_REMAPPABLE_PLUGIN* layerRemappableIO = dynamic_cast<LAYER_REMAPPABLE_PLUGIN*>( pi.get() );
if( layerRemappableIO )
if( LAYER_MAPPABLE_PLUGIN* mappable_pi = dynamic_cast<LAYER_MAPPABLE_PLUGIN*>( pi.get() ) )
{
layerRemappableIO->RegisterLayerMappingCallback(
std::bind( DIALOG_IMPORTED_LAYERS::GetMapModal, this, std::placeholders::_1 ) );
mappable_pi->RegisterCallback( std::bind( DIALOG_MAP_LAYERS::RunModal,
this, std::placeholders::_1 ) );
}
PROJECT_CHOOSER_PLUGIN* projectChooserIO = dynamic_cast<PROJECT_CHOOSER_PLUGIN*>( pi.get() );
if( projectChooserIO )
if( PROJECT_CHOOSER_PLUGIN* chooser_pi = dynamic_cast<PROJECT_CHOOSER_PLUGIN*>( pi.get() ) )
{
projectChooserIO->RegisterChooseProjectCallback(
std::bind( DIALOG_IMPORT_CHOOSE_PROJECT::GetSelectionsModal, this,
std::placeholders::_1 ) );
chooser_pi->RegisterCallback( std::bind( DIALOG_IMPORT_CHOOSE_PROJECT::RunModal,
this,
std::placeholders::_1 ) );
}
if( ( aCtl & KICTL_REVERT ) )

View File

@ -41,9 +41,10 @@
#include <compoundfilereader.h>
#include <utf.h>
PCB_IO_ALTIUM_CIRCUIT_MAKER::PCB_IO_ALTIUM_CIRCUIT_MAKER() : PCB_IO( wxS( "Altium Circuit Maker" ) )
PCB_IO_ALTIUM_CIRCUIT_MAKER::PCB_IO_ALTIUM_CIRCUIT_MAKER() :
PCB_IO( wxS( "Altium Circuit Maker" ) )
{
RegisterLayerMappingCallback( PCB_IO_ALTIUM_DESIGNER::DefaultLayerMappingCallback );
RegisterCallback( PCB_IO_ALTIUM_DESIGNER::DefaultLayerMappingCallback );
}

View File

@ -30,7 +30,7 @@
#include <pcb_io/pcb_io_mgr.h>
#include <pcb_io/common/plugin_common_layer_mapping.h>
class PCB_IO_ALTIUM_CIRCUIT_MAKER : public PCB_IO, public LAYER_REMAPPABLE_PLUGIN
class PCB_IO_ALTIUM_CIRCUIT_MAKER : public PCB_IO, public LAYER_MAPPABLE_PLUGIN
{
public:
const IO_BASE::IO_FILE_DESC GetBoardFileDesc() const override

View File

@ -42,9 +42,10 @@
#include <compoundfilereader.h>
#include <utf.h>
PCB_IO_ALTIUM_CIRCUIT_STUDIO::PCB_IO_ALTIUM_CIRCUIT_STUDIO() : PCB_IO( wxS( "Altium Circuit Studio" ) )
PCB_IO_ALTIUM_CIRCUIT_STUDIO::PCB_IO_ALTIUM_CIRCUIT_STUDIO() :
PCB_IO( wxS( "Altium Circuit Studio" ) )
{
RegisterLayerMappingCallback( PCB_IO_ALTIUM_DESIGNER::DefaultLayerMappingCallback );
RegisterCallback( PCB_IO_ALTIUM_DESIGNER::DefaultLayerMappingCallback );
}

View File

@ -29,7 +29,7 @@
#include <pcb_io/pcb_io_mgr.h>
#include <pcb_io/common/plugin_common_layer_mapping.h>
class PCB_IO_ALTIUM_CIRCUIT_STUDIO : public PCB_IO, public LAYER_REMAPPABLE_PLUGIN
class PCB_IO_ALTIUM_CIRCUIT_STUDIO : public PCB_IO, public LAYER_MAPPABLE_PLUGIN
{
public:
const IO_BASE::IO_FILE_DESC GetBoardFileDesc() const override

View File

@ -41,11 +41,12 @@
#include <compoundfilereader.h>
#include <utf.h>
PCB_IO_ALTIUM_DESIGNER::PCB_IO_ALTIUM_DESIGNER() : PCB_IO( wxS( "Altium Designer" ) )
PCB_IO_ALTIUM_DESIGNER::PCB_IO_ALTIUM_DESIGNER() :
PCB_IO( wxS( "Altium Designer" ) )
{
m_reporter = &WXLOG_REPORTER::GetInstance();
RegisterLayerMappingCallback( PCB_IO_ALTIUM_DESIGNER::DefaultLayerMappingCallback );
RegisterCallback( PCB_IO_ALTIUM_DESIGNER::DefaultLayerMappingCallback );
}

View File

@ -34,7 +34,7 @@
class ALTIUM_COMPOUND_FILE;
class PCB_IO_ALTIUM_DESIGNER : public PCB_IO, public LAYER_REMAPPABLE_PLUGIN
class PCB_IO_ALTIUM_DESIGNER : public PCB_IO, public LAYER_MAPPABLE_PLUGIN
{
public:
// -----<PUBLIC PCB_IO API>--------------------------------------------------

View File

@ -32,10 +32,11 @@
#include <compoundfilereader.h>
#include <utf.h>
PCB_IO_SOLIDWORKS::PCB_IO_SOLIDWORKS() : PCB_IO( wxS( "Solidworks PCB" ) )
PCB_IO_SOLIDWORKS::PCB_IO_SOLIDWORKS() :
PCB_IO( wxS( "Solidworks PCB" ) )
{
m_reporter = &WXLOG_REPORTER::GetInstance();
RegisterLayerMappingCallback( PCB_IO_ALTIUM_DESIGNER::DefaultLayerMappingCallback );
RegisterCallback( PCB_IO_ALTIUM_DESIGNER::DefaultLayerMappingCallback );
}

View File

@ -24,7 +24,7 @@
#include <pcb_io/pcb_io_mgr.h>
#include <pcb_io/common/plugin_common_layer_mapping.h>
class PCB_IO_SOLIDWORKS : public PCB_IO, public LAYER_REMAPPABLE_PLUGIN
class PCB_IO_SOLIDWORKS : public PCB_IO, public LAYER_MAPPABLE_PLUGIN
{
public:
const IO_BASE::IO_FILE_DESC GetBoardFileDesc() const override

View File

@ -49,10 +49,9 @@ std::map<wxString, PCB_LAYER_ID> PCB_IO_CADSTAR_ARCHIVE::DefaultLayerMappingCall
}
void PCB_IO_CADSTAR_ARCHIVE::RegisterLayerMappingCallback(
LAYER_MAPPING_HANDLER aLayerMappingHandler )
void PCB_IO_CADSTAR_ARCHIVE::RegisterCallback( LAYER_MAPPING_HANDLER aLayerMappingHandler )
{
LAYER_REMAPPABLE_PLUGIN::RegisterLayerMappingCallback( aLayerMappingHandler );
LAYER_MAPPABLE_PLUGIN::RegisterCallback( aLayerMappingHandler );
m_show_layer_mapping_warnings = false; // only show warnings with default callback
}
@ -60,8 +59,7 @@ void PCB_IO_CADSTAR_ARCHIVE::RegisterLayerMappingCallback(
PCB_IO_CADSTAR_ARCHIVE::PCB_IO_CADSTAR_ARCHIVE() : PCB_IO( wxS( "CADSTAR PCB Archive" ) )
{
m_show_layer_mapping_warnings = true;
LAYER_REMAPPABLE_PLUGIN::RegisterLayerMappingCallback(
PCB_IO_CADSTAR_ARCHIVE::DefaultLayerMappingCallback );
LAYER_MAPPABLE_PLUGIN::RegisterCallback( PCB_IO_CADSTAR_ARCHIVE::DefaultLayerMappingCallback );
}

View File

@ -29,7 +29,7 @@
#include <memory>
class PCB_IO_CADSTAR_ARCHIVE : public PCB_IO, public LAYER_REMAPPABLE_PLUGIN
class PCB_IO_CADSTAR_ARCHIVE : public PCB_IO, public LAYER_MAPPABLE_PLUGIN
{
public:
const IO_BASE::IO_FILE_DESC GetBoardFileDesc() const override
@ -62,7 +62,7 @@ public:
*
* @param aLayerMappingHandler
*/
void RegisterLayerMappingCallback( LAYER_MAPPING_HANDLER aLayerMappingHandler ) override;
void RegisterCallback( LAYER_MAPPING_HANDLER aLayerMappingHandler ) override;
void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aLibraryPath,
bool aBestEfforts, const STRING_UTF8_MAP* aProperties = nullptr ) override;

View File

@ -58,7 +58,7 @@ using LAYER_MAPPING_HANDLER = std::function<std::map<wxString, PCB_LAYER_ID>( co
/**
* @brief Plugin class for import plugins that support remappable layers
*/
class LAYER_REMAPPABLE_PLUGIN
class LAYER_MAPPABLE_PLUGIN
{
public:
/**
@ -70,12 +70,12 @@ public:
*
* @param aLayerMappingHandler
*/
virtual void RegisterLayerMappingCallback( LAYER_MAPPING_HANDLER aLayerMappingHandler )
virtual void RegisterCallback( LAYER_MAPPING_HANDLER aLayerMappingHandler )
{
m_layer_mapping_handler = aLayerMappingHandler;
}
virtual ~LAYER_REMAPPABLE_PLUGIN() = default;
virtual ~LAYER_MAPPABLE_PLUGIN() = default;
protected:
LAYER_MAPPING_HANDLER m_layer_mapping_handler; ///< Callback to get layer mapping
};

View File

@ -222,7 +222,8 @@ void ERULES::parse( wxXmlNode* aRules, std::function<void()> aCheckpoint )
}
PCB_IO_EAGLE::PCB_IO_EAGLE() : PCB_IO( wxS( "Eagle" ) ),
PCB_IO_EAGLE::PCB_IO_EAGLE() :
PCB_IO( wxS( "Eagle" ) ),
m_rules( new ERULES() ),
m_xpath( new XPATH() ),
m_progressReporter( nullptr ),
@ -235,8 +236,7 @@ PCB_IO_EAGLE::PCB_IO_EAGLE() : PCB_IO( wxS( "Eagle" ) ),
init( nullptr );
clear_cu_map();
RegisterLayerMappingCallback( std::bind( &PCB_IO_EAGLE::DefaultLayerMappingCallback,
this, _1 ) );
RegisterCallback( std::bind( &PCB_IO_EAGLE::DefaultLayerMappingCallback, this, _1 ) );
}

View File

@ -128,7 +128,7 @@ struct ERULES
* Works with Eagle 6.x XML board files and footprints to implement the Pcbnew #PLUGIN API
* or a portion of it.
*/
class PCB_IO_EAGLE : public PCB_IO, public LAYER_REMAPPABLE_PLUGIN
class PCB_IO_EAGLE : public PCB_IO, public LAYER_MAPPABLE_PLUGIN
{
public:
const IO_BASE::IO_FILE_DESC GetBoardFileDesc() const override