cvpcb: Implement delete/cut/copy/paste for individual associations
Fixes: lp:1794883 * https://bugs.launchpad.net/kicad/+bug/1794883
This commit is contained in:
parent
1d66aad4df
commit
d80759efb8
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -113,6 +113,8 @@ void COMPONENTS_LISTBOX::OnChar( wxKeyEvent& event )
|
||||||
{
|
{
|
||||||
int key = event.GetKeyCode();
|
int key = event.GetKeyCode();
|
||||||
|
|
||||||
|
wxCommandEvent dummy;
|
||||||
|
|
||||||
switch( key )
|
switch( key )
|
||||||
{
|
{
|
||||||
case WXK_TAB:
|
case WXK_TAB:
|
||||||
|
@ -135,6 +137,21 @@ void COMPONENTS_LISTBOX::OnChar( wxKeyEvent& event )
|
||||||
event.Skip();
|
event.Skip();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case WXK_DELETE:
|
||||||
|
GetParent()->DelAssociation( dummy );
|
||||||
|
return;
|
||||||
|
|
||||||
|
case WXK_CONTROL_X:
|
||||||
|
GetParent()->CutAssociation( dummy );
|
||||||
|
return;
|
||||||
|
|
||||||
|
case WXK_CONTROL_C:
|
||||||
|
GetParent()->CopyAssociation( dummy );
|
||||||
|
return;
|
||||||
|
|
||||||
|
case WXK_CONTROL_V:
|
||||||
|
GetParent()->PasteAssociation( dummy );
|
||||||
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2010 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
|
* Copyright (C) 2014-2019 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -42,7 +42,11 @@ enum id_cvpcb_frm
|
||||||
ID_CVPCB_CREATE_SCREENCMP = ID_END_LIST,
|
ID_CVPCB_CREATE_SCREENCMP = ID_END_LIST,
|
||||||
ID_CVPCB_GOTO_FIRSTNA,
|
ID_CVPCB_GOTO_FIRSTNA,
|
||||||
ID_CVPCB_GOTO_PREVIOUSNA,
|
ID_CVPCB_GOTO_PREVIOUSNA,
|
||||||
ID_CVPCB_DEL_ASSOCIATIONS,
|
ID_CVPCB_DEL_ALL_ASSOCIATIONS,
|
||||||
|
ID_CVPCB_DEL_ASSOCIATION,
|
||||||
|
ID_CVPCB_CUT_ASSOCIATION,
|
||||||
|
ID_CVPCB_COPY_ASSOCIATION,
|
||||||
|
ID_CVPCB_PASTE_ASSOCIATION,
|
||||||
ID_CVPCB_AUTO_ASSOCIE,
|
ID_CVPCB_AUTO_ASSOCIE,
|
||||||
ID_CVPCB_COMPONENT_LIST,
|
ID_CVPCB_COMPONENT_LIST,
|
||||||
ID_CVPCB_FOOTPRINT_LIST,
|
ID_CVPCB_FOOTPRINT_LIST,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -75,7 +75,11 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER )
|
||||||
EVT_TOOL( ID_CVPCB_CREATE_SCREENCMP, CVPCB_MAINFRAME::DisplayModule )
|
EVT_TOOL( ID_CVPCB_CREATE_SCREENCMP, CVPCB_MAINFRAME::DisplayModule )
|
||||||
EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA, CVPCB_MAINFRAME::ToFirstNA )
|
EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA, CVPCB_MAINFRAME::ToFirstNA )
|
||||||
EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA )
|
EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA )
|
||||||
EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAssociations )
|
EVT_TOOL( ID_CVPCB_DEL_ALL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAllAssociations )
|
||||||
|
EVT_TOOL( ID_CVPCB_DEL_ASSOCIATION, CVPCB_MAINFRAME::DelAssociation )
|
||||||
|
EVT_TOOL( ID_CVPCB_CUT_ASSOCIATION, CVPCB_MAINFRAME::CutAssociation )
|
||||||
|
EVT_TOOL( ID_CVPCB_COPY_ASSOCIATION, CVPCB_MAINFRAME::CopyAssociation )
|
||||||
|
EVT_TOOL( ID_CVPCB_PASTE_ASSOCIATION, CVPCB_MAINFRAME::PasteAssociation )
|
||||||
EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AutomaticFootprintMatching )
|
EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AutomaticFootprintMatching )
|
||||||
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
|
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
|
||||||
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
||||||
|
@ -432,9 +436,81 @@ void CVPCB_MAINFRAME::OnQuit( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
|
void CVPCB_MAINFRAME::CutAssociation( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( IsOK( this, _( "Delete selections" ) ) )
|
int itmIdx = m_compListBox->GetFirstSelected();
|
||||||
|
|
||||||
|
if( itmIdx == -1 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( m_netlist.IsEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
COMPONENT* component = m_netlist.GetComponent( itmIdx );
|
||||||
|
|
||||||
|
if( component && component->GetFPID().IsValid() )
|
||||||
|
{
|
||||||
|
m_clipboardBuffer = component->GetFPID().Format().wx_str();
|
||||||
|
|
||||||
|
SetNewPkg( wxEmptyString, itmIdx );
|
||||||
|
m_compListBox->RefreshItem( itmIdx );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CVPCB_MAINFRAME::CopyAssociation( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
int itmIdx = m_compListBox->GetFirstSelected();
|
||||||
|
|
||||||
|
if( itmIdx == -1 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( m_netlist.IsEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
COMPONENT* component = m_netlist.GetComponent( itmIdx );
|
||||||
|
|
||||||
|
if( component && component->GetFPID().IsValid() )
|
||||||
|
m_clipboardBuffer = component->GetFPID().Format().wx_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CVPCB_MAINFRAME::PasteAssociation( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
if( m_clipboardBuffer.IsEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
int itmIdx = m_compListBox->GetFirstSelected();
|
||||||
|
|
||||||
|
while( itmIdx != -1 )
|
||||||
|
{
|
||||||
|
SetNewPkg( m_clipboardBuffer, itmIdx );
|
||||||
|
m_compListBox->RefreshItem( itmIdx );
|
||||||
|
|
||||||
|
itmIdx = m_compListBox->GetNextSelected( itmIdx );
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CVPCB_MAINFRAME::DelAssociation( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
int itmIdx = m_compListBox->GetFirstSelected();
|
||||||
|
|
||||||
|
while( itmIdx != -1 )
|
||||||
|
{
|
||||||
|
SetNewPkg( wxEmptyString, itmIdx );
|
||||||
|
m_compListBox->RefreshItem( itmIdx );
|
||||||
|
|
||||||
|
itmIdx = m_compListBox->GetNextSelected( itmIdx );
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CVPCB_MAINFRAME::DelAllAssociations( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
if( IsOK( this, _( "Delete all footprint assocations?" ) ) )
|
||||||
{
|
{
|
||||||
m_skipComponentSelect = true;
|
m_skipComponentSelect = true;
|
||||||
|
|
||||||
|
@ -489,7 +565,17 @@ void CVPCB_MAINFRAME::OnComponentRightClick( wxMouseEvent& event )
|
||||||
wxMenu menu;
|
wxMenu menu;
|
||||||
|
|
||||||
menu.Append( ID_CVPCB_CREATE_SCREENCMP, _( "View Footprint" ),
|
menu.Append( ID_CVPCB_CREATE_SCREENCMP, _( "View Footprint" ),
|
||||||
_( "Show the assigned footprint in the footprint viewer" ) );
|
_( "Show the assigned footprint in the footprint viewer" ) );
|
||||||
|
|
||||||
|
menu.Append( ID_CVPCB_CUT_ASSOCIATION, _( "Cut Footprint Association" ),
|
||||||
|
_( "Cut the assigned footprint" ) );
|
||||||
|
menu.Append( ID_CVPCB_COPY_ASSOCIATION, _( "Copy Footprint Association" ),
|
||||||
|
_( "Copy the assigned footprint" ) );
|
||||||
|
menu.Append( ID_CVPCB_PASTE_ASSOCIATION, _( "Paste Footprint Association" ),
|
||||||
|
_( "Paste a footprint assignment" ) );
|
||||||
|
|
||||||
|
menu.Append( ID_CVPCB_DEL_ASSOCIATION, _( "Delete Footprint Association" ),
|
||||||
|
_( "Delete the assigned footprint" ) );
|
||||||
|
|
||||||
PopupMenu( &menu );
|
PopupMenu( &menu );
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -70,6 +70,7 @@ class CVPCB_MAINFRAME : public KIWAY_PLAYER
|
||||||
wxStaticText* m_statusLine2;
|
wxStaticText* m_statusLine2;
|
||||||
wxStaticText* m_statusLine3;
|
wxStaticText* m_statusLine3;
|
||||||
wxButton* m_saveAndContinue;
|
wxButton* m_saveAndContinue;
|
||||||
|
wxString m_clipboardBuffer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxArrayString m_ModuleLibNames;
|
wxArrayString m_ModuleLibNames;
|
||||||
|
@ -133,10 +134,34 @@ public:
|
||||||
void ToPreviousNA( wxCommandEvent& event );
|
void ToPreviousNA( wxCommandEvent& event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DelAssociations
|
* Function DelAllAssociations
|
||||||
* removes all component footprint associations already made
|
* Removes all component footprint associations already made
|
||||||
*/
|
*/
|
||||||
void DelAssociations( wxCommandEvent& event );
|
void DelAllAssociations( wxCommandEvent& event );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function DelAssociation
|
||||||
|
* Removes association from selected footprints
|
||||||
|
*/
|
||||||
|
void DelAssociation( wxCommandEvent& event );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function CutAssociation
|
||||||
|
* Cuts the footprint name for the 1st selected component to the clipboard
|
||||||
|
*/
|
||||||
|
void CutAssociation( wxCommandEvent& event );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function CopyAssociation
|
||||||
|
* Copies the footprint name for the 1st selected component to the clipboard
|
||||||
|
*/
|
||||||
|
void CopyAssociation( wxCommandEvent& event );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function PasteAssociation
|
||||||
|
* Paste the footprint from the clipboard onto the selected components
|
||||||
|
*/
|
||||||
|
void PasteAssociation( wxCommandEvent& event );
|
||||||
|
|
||||||
void OnConfigurePaths( wxCommandEvent& aEvent );
|
void OnConfigurePaths( wxCommandEvent& aEvent );
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
|
||||||
KiScaledBitmap( auto_associe_xpm, this ),
|
KiScaledBitmap( auto_associe_xpm, this ),
|
||||||
_( "Perform automatic footprint association" ) );
|
_( "Perform automatic footprint association" ) );
|
||||||
|
|
||||||
m_mainToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString,
|
m_mainToolBar->AddTool( ID_CVPCB_DEL_ALL_ASSOCIATIONS, wxEmptyString,
|
||||||
KiScaledBitmap( delete_association_xpm, this ),
|
KiScaledBitmap( delete_association_xpm, this ),
|
||||||
_( "Delete all footprint associations" ) );
|
_( "Delete all footprint associations" ) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue