cvpcb: Add individual association deleting

This commit is contained in:
Ian McInerney 2019-08-09 01:22:57 +02:00 committed by Wayne Stambaugh
parent 2d27c10c63
commit 796d888f8f
5 changed files with 34 additions and 0 deletions

View File

@ -227,6 +227,8 @@ void CVPCB_MAINFRAME::setupTools()
m_componentContextMenu = new ACTION_MENU( true ); m_componentContextMenu = new ACTION_MENU( true );
m_componentContextMenu->SetTool( tool ); m_componentContextMenu->SetTool( tool );
m_componentContextMenu->Add( CVPCB_ACTIONS::showFootprintViewer ); m_componentContextMenu->Add( CVPCB_ACTIONS::showFootprintViewer );
m_componentContextMenu->AppendSeparator();
m_componentContextMenu->Add( CVPCB_ACTIONS::deleteAssoc );
// Create the context menu for the footprint list box // Create the context menu for the footprint list box
m_footprintContextMenu = new ACTION_MENU( true ); m_footprintContextMenu = new ACTION_MENU( true );

View File

@ -114,6 +114,12 @@ TOOL_ACTION CVPCB_ACTIONS::autoAssociate( "cvpcb.Control.AutoAssociate", AS_GLOB
_( "Perform automatic footprint association" ), _( "Perform automatic footprint association" ),
auto_associe_xpm ); auto_associe_xpm );
TOOL_ACTION CVPCB_ACTIONS::deleteAssoc( "cvpcb.Control.Delete", AS_GLOBAL,
WXK_DELETE, "",
_( "Delete association" ),
_( "Delete selected footprint associations" ),
delete_association_xpm );
TOOL_ACTION CVPCB_ACTIONS::deleteAll( "cvpcb.Control.DeleteAll", AS_GLOBAL, TOOL_ACTION CVPCB_ACTIONS::deleteAll( "cvpcb.Control.DeleteAll", AS_GLOBAL,
0, "", 0, "",
_( "Delete all footprint associations" ), _( "Delete all footprint associations" ),

View File

@ -65,6 +65,7 @@ public:
static TOOL_ACTION autoAssociate; static TOOL_ACTION autoAssociate;
static TOOL_ACTION associate; static TOOL_ACTION associate;
static TOOL_ACTION deleteAll; static TOOL_ACTION deleteAll;
static TOOL_ACTION deleteAssoc;
/// Footprint Filtering actions /// Footprint Filtering actions
static TOOL_ACTION filterFPbyKeywords; static TOOL_ACTION filterFPbyKeywords;

View File

@ -262,6 +262,23 @@ int CVPCB_CONTROL::AutoAssociate( const TOOL_EVENT& aEvent )
} }
int CVPCB_CONTROL::DeleteAssoc( const TOOL_EVENT& aEvent )
{
// Get all the components that are selected
std::vector<unsigned int> sel = m_frame->GetComponentIndices( CVPCB_MAINFRAME::SEL_COMPONENTS );
// Delete the association
bool firstAssoc = true;
for( auto i : sel )
{
m_frame->AssociateFootprint( CVPCB_ASSOCIATION( i, LIB_ID() ), firstAssoc );
firstAssoc = false;
}
return 0;
}
int CVPCB_CONTROL::DeleteAll( const TOOL_EVENT& aEvent ) int CVPCB_CONTROL::DeleteAll( const TOOL_EVENT& aEvent )
{ {
if( IsOK( m_frame, _( "Delete all associations?" ) ) ) if( IsOK( m_frame, _( "Delete all associations?" ) ) )
@ -401,6 +418,7 @@ void CVPCB_CONTROL::setTransitions()
Go( &CVPCB_CONTROL::ShowEquFileTable, CVPCB_ACTIONS::showEquFileTable.MakeEvent() ); Go( &CVPCB_CONTROL::ShowEquFileTable, CVPCB_ACTIONS::showEquFileTable.MakeEvent() );
Go( &CVPCB_CONTROL::SaveAssociations, CVPCB_ACTIONS::saveAssociations.MakeEvent() ); Go( &CVPCB_CONTROL::SaveAssociations, CVPCB_ACTIONS::saveAssociations.MakeEvent() );
Go( &CVPCB_CONTROL::DeleteAll, CVPCB_ACTIONS::deleteAll.MakeEvent() ); Go( &CVPCB_CONTROL::DeleteAll, CVPCB_ACTIONS::deleteAll.MakeEvent() );
Go( &CVPCB_CONTROL::DeleteAssoc, CVPCB_ACTIONS::deleteAssoc.MakeEvent() );
// Navigation actions // Navigation actions
Go( &CVPCB_CONTROL::ToNA, CVPCB_ACTIONS::gotoNextNA.MakeEvent() ); Go( &CVPCB_CONTROL::ToNA, CVPCB_ACTIONS::gotoNextNA.MakeEvent() );

View File

@ -91,6 +91,13 @@ public:
*/ */
int DeleteAll( const TOOL_EVENT& aEvent ); int DeleteAll( const TOOL_EVENT& aEvent );
/**
* Delete the selected associations.
*
* @param aEvent is the event generated by the tool framework
*/
int DeleteAssoc( const TOOL_EVENT& aEvent );
/** /**
* Move the selected component to the not associated one in the specified direction. * Move the selected component to the not associated one in the specified direction.
* *