Wayne, Here are the rebased patches for 5.1.
-Ian On Thu, Jun 20, 2019 at 10:04 PM Ian McInerney <[email protected]> wrote: > Wayne, > > Thanks for merging the first patch. I am working on rebasing the other two > to the 5.1 branch, and hope to have them done for you today (the > compilations can take a while on my machine though). > > My plan for the master version is to first transition the existing cvpcb > functions to the tool manager that Jeff put in, then to add these functions > on to the tool manager as appropriate. That way there is no duplication of > the work (since the copy/paste/delete need to be in the tool manager > eventually, this saves having to rewrite them into it later). I hope to do > that over the next week or so. > > -Ian > > On Thu, Jun 20, 2019 at 9:04 PM Wayne Stambaugh <[email protected]> > wrote: > >> Ian, >> >> Would you please rebase patches 2 and 3. They no longer apply cleanly. >> I'm going to merge all three patches since they all have bug reports >> filed against them. I will accept patch 1 as is since the bug report >> that it fixes specifically requests the current library path be >> displayed rather than the library path of the assigned footprint of a >> symbol. When you get a chance, please update the master branch versions >> so we can keep the behavior the same for v6. >> >> Thanks, >> >> Wayne >> >> On 5/31/19 6:13 PM, Ian McInerney wrote: >> > Attached is a patchset that includes some upgrades to the usability of >> > cvpcb, namely the following: >> > >> > * Include a line below the footprint description giving the URI of the >> > source library. This allows people to see where the library is from. It >> > is located in a 3rd line below the footprint description, since I >> > figured this placement is the least obtrusive. It is also only displayed >> > for the selection from the footprint list (not the component footprint) >> > since the description field is not displayed for the component. >> > (requested in https://bugs.launchpad.net/kicad/+bug/1782805) >> > >> > * Implement the ability for the escape key to close the window, since it >> > has a cancel button on it this seems like a useful feature. This will >> > prompt the user to save the changes if there are any, and will only >> > operate when the assignment window has focus, so if escape is pressed in >> > the footprint viewer window it will not close the main window. >> > (requested in https://bugs.launchpad.net/kicad/+bug/1830483) >> > >> > * Implement the ability to delete individual footprint associations >> > using the delete key or a right-click menu option. (requested >> > in https://bugs.launchpad.net/kicad/+bug/1818883) >> > >> > * Implement a cut/copy/paste system for the footprint associations that >> > operates on a 1->1 or 1->many arrangement. When more than 1 component is >> > selected for the copy/cut command, only the 1st selected one is used. It >> > can paste this to any number of selected components. This is also >> > available through the right-click menu. (requested >> > in https://bugs.launchpad.net/kicad/+bug/1794883). >> > >> > These changes work for both master and 5.1, and I think would be useful >> > to include in 5.1.3 (one of those reports requesting the features is >> > actually already targeted to 5.1.3). >> > >> > -Ian >> > >> > _______________________________________________ >> > Mailing list: https://launchpad.net/~kicad-developers >> > Post to : [email protected] >> > Unsubscribe : https://launchpad.net/~kicad-developers >> > More help : https://help.launchpad.net/ListHelp >> > >> >> _______________________________________________ >> Mailing list: https://launchpad.net/~kicad-developers >> Post to : [email protected] >> Unsubscribe : https://launchpad.net/~kicad-developers >> More help : https://help.launchpad.net/ListHelp >> >
From a1a5d160b60596593f05924052e118dfb17e70bc Mon Sep 17 00:00:00 2001 From: Ian McInerney <[email protected]> Date: Thu, 20 Jun 2019 23:27:58 +0100 Subject: [PATCH 2/2] cvpcb: Implement delete/cut/copy/paste for individual associations Fixes: lp:1794883 * https://bugs.launchpad.net/kicad/+bug/1794883 --- cvpcb/components_listbox.cpp | 19 ++++++- cvpcb/cvpcb_id.h | 8 ++- cvpcb/cvpcb_mainframe.cpp | 96 ++++++++++++++++++++++++++++++++++-- cvpcb/cvpcb_mainframe.h | 33 +++++++++++-- cvpcb/toolbars_cvpcb.cpp | 2 +- 5 files changed, 145 insertions(+), 13 deletions(-) diff --git a/cvpcb/components_listbox.cpp b/cvpcb/components_listbox.cpp index f8a97191d..729efeb84 100644 --- a/cvpcb/components_listbox.cpp +++ b/cvpcb/components_listbox.cpp @@ -1,7 +1,7 @@ /* * 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 * 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(); + wxCommandEvent dummy; + switch( key ) { case WXK_TAB: @@ -135,6 +137,21 @@ void COMPONENTS_LISTBOX::OnChar( wxKeyEvent& event ) event.Skip(); 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: break; diff --git a/cvpcb/cvpcb_id.h b/cvpcb/cvpcb_id.h index c46e9b15d..12a6820c9 100644 --- a/cvpcb/cvpcb_id.h +++ b/cvpcb/cvpcb_id.h @@ -2,7 +2,7 @@ * 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) 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 * 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_GOTO_FIRSTNA, 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_COMPONENT_LIST, ID_CVPCB_FOOTPRINT_LIST, diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp index 4f1456300..af735059b 100644 --- a/cvpcb/cvpcb_mainframe.cpp +++ b/cvpcb/cvpcb_mainframe.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2011 Wayne Stambaugh <[email protected]> - * 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 * 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_GOTO_FIRSTNA, CVPCB_MAINFRAME::ToFirstNA ) 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_FOOTPRINT_DISPLAY_FILTERED_LIST, 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; @@ -489,7 +565,17 @@ void CVPCB_MAINFRAME::OnComponentRightClick( wxMouseEvent& event ) wxMenu menu; 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 ); } diff --git a/cvpcb/cvpcb_mainframe.h b/cvpcb/cvpcb_mainframe.h index cbdd4e5c9..1cb86b28c 100644 --- a/cvpcb/cvpcb_mainframe.h +++ b/cvpcb/cvpcb_mainframe.h @@ -2,7 +2,7 @@ * 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) 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 * 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_statusLine3; wxButton* m_saveAndContinue; + wxString m_clipboardBuffer; public: wxArrayString m_ModuleLibNames; @@ -133,10 +134,34 @@ public: void ToPreviousNA( wxCommandEvent& event ); /** - * Function DelAssociations - * removes all component footprint associations already made + * Function DelAllAssociations + * 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 ); diff --git a/cvpcb/toolbars_cvpcb.cpp b/cvpcb/toolbars_cvpcb.cpp index 6334c53ad..482f9e16f 100644 --- a/cvpcb/toolbars_cvpcb.cpp +++ b/cvpcb/toolbars_cvpcb.cpp @@ -63,7 +63,7 @@ void CVPCB_MAINFRAME::ReCreateHToolbar() KiScaledBitmap( auto_associe_xpm, this ), _( "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 ), _( "Delete all footprint associations" ) ); -- 2.17.2
From f2882e5b3b9fc7d455f60a28aa13e9da78b51628 Mon Sep 17 00:00:00 2001 From: Ian McInerney <[email protected]> Date: Thu, 20 Jun 2019 23:13:36 +0100 Subject: [PATCH 1/2] cvpcb: Allow the escape key to close the window Fixes: lp:1830483 * https://bugs.launchpad.net/kicad/+bug/1830483 --- cvpcb/cvpcb_id.h | 1 + cvpcb/cvpcb_mainframe.cpp | 15 +++++++++++++++ cvpcb/cvpcb_mainframe.h | 1 + 3 files changed, 17 insertions(+) diff --git a/cvpcb/cvpcb_id.h b/cvpcb/cvpcb_id.h index b1c8bb6bb..c46e9b15d 100644 --- a/cvpcb/cvpcb_id.h +++ b/cvpcb/cvpcb_id.h @@ -56,5 +56,6 @@ enum id_cvpcb_frm ID_CVPCB_EQUFILES_LIST_EDIT, ID_CVPCB_LIB_TABLE_EDIT, ID_CVPCB_FILTER_TEXT_EDIT, + ID_CVPCB_ESCAPE_KEY, ID_TB_MEASUREMENT_TOOL }; diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp index ea93376a8..4f1456300 100644 --- a/cvpcb/cvpcb_mainframe.cpp +++ b/cvpcb/cvpcb_mainframe.cpp @@ -95,6 +95,9 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER ) EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow ) EVT_SIZE( CVPCB_MAINFRAME::OnSize ) + // Handle the escape key + EVT_TOOL( ID_CVPCB_ESCAPE_KEY, CVPCB_MAINFRAME::OnEscapeKey ) + // UI event handlers EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, CVPCB_MAINFRAME::OnFilterFPbyKeywords ) EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, @@ -228,6 +231,12 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) : m_compListBox->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( CVPCB_MAINFRAME::OnComponentRightClick ), NULL, this ); + + // Add an accelerator to make escape close the window + wxAcceleratorEntry entries[1]; + entries[0].Set( wxACCEL_NORMAL, WXK_ESCAPE, ID_CVPCB_ESCAPE_KEY ); + wxAcceleratorTable accel( 1, entries ); + SetAcceleratorTable( accel ); } @@ -384,6 +393,12 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event ) } +void CVPCB_MAINFRAME::OnEscapeKey( wxCommandEvent& aEvent ) +{ + Close( false ); +} + + void CVPCB_MAINFRAME::OnOK( wxCommandEvent& aEvent ) { SaveFootprintAssociation( false ); diff --git a/cvpcb/cvpcb_mainframe.h b/cvpcb/cvpcb_mainframe.h index da17d9e39..cbdd4e5c9 100644 --- a/cvpcb/cvpcb_mainframe.h +++ b/cvpcb/cvpcb_mainframe.h @@ -122,6 +122,7 @@ public: void OnCloseWindow( wxCloseEvent& Event ); void OnSize( wxSizeEvent& SizeEvent ); void OnKeyDown( wxKeyEvent& aEvent ); + void OnEscapeKey( wxCommandEvent& aEvent ); void ReCreateHToolbar(); virtual void ReCreateMenuBar() override; void ShowChangedLanguage() override; -- 2.17.2
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

