kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #27475
Re: [PATCH] libedit: part deletion
On second thought, I'm reverting it, I found a weird bug. Apologies for
the accidental push, I'll be more careful next time.
I *was* investigating what I thought was a minor bug (i.e. didn't keep
me from pushing the patch), but I found this. To reproduce:
1) Select a single-unit part
2) Delete one unit of a different, multi-unit part
The current part gets messed up, like: https://misc.c4757p.com/messed-up-part.png
Not sure if that's a rendering issue or if the pins are actually gone.
What I *was* looking at is that I thought deleting a unit would just
delete the entire part, and I was going to suggest one of two possible
fixes:
1) Modify the component selector to have a mode where it doesn't delete
units
2) Actually delete the unit, adding code to filter the part and remove
anything on the unit to be deleted and reorder subsequent units.
I was going to offer to write #2 myself, because that'd be really useful
to me. But you should probably fix the bug described above first and
resubmit.
ALSO, I was going to contribute a small patch to this to preselect the
current component just like I added to Load Component recently - I
attached a diff for that in case you want it, I had it all done before
noticing this.
On Thu, Feb 02, 2017 at 06:15:57AM -0500, Chris Pavlina wrote:
> Oops, I didn't mean to push this one at the same time, clumsy push
> command - but it looks good too. I always hated that delete dialog.
> Thank you!
>
> On Thu, Feb 02, 2017 at 09:42:01PM +1100, Oliver Walters wrote:
> > The attached patch removes the clunky "Delete Single Part" dialog in
> > libedit, and re-uses the existing part-selector to find a component to
> > delete.
> >
> > Now, the user can use the filter tool to select a component for deletion.
>
diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp
index 8e37b8ebc..41e77353a 100644
--- a/eeschema/libedit.cpp
+++ b/eeschema/libedit.cpp
@@ -522,6 +522,7 @@ void LIB_EDIT_FRAME::DeleteOnePart( wxCommandEvent& event )
m_lastDrawItem = NULL;
m_drawItem = NULL;
+ LIB_PART* part = GetCurPart();
PART_LIB* lib = GetCurLib();
if( !lib )
@@ -538,7 +539,9 @@ void LIB_EDIT_FRAME::DeleteOnePart( wxCommandEvent& event )
COMPONENT_TREE_SEARCH_CONTAINER search_container( Prj().SchLibs() );
+ wxString name = part ? part->GetName() : wxString( wxEmptyString );
search_container.AddLibrary( *lib );
+ search_container.SetPreselectNode( name, /* aUnit */ 0 );
wxString dialogTitle;
dialogTitle.Printf( _( "Delete Component (%u items loaded)" ), search_container.GetComponentsCount() );
@@ -575,7 +578,7 @@ void LIB_EDIT_FRAME::DeleteOnePart( wxCommandEvent& event )
if( !IsOK( this, msg ) )
return;
- LIB_PART* part = GetCurPart();
+ part = GetCurPart();
if( !part || !part->HasAlias( libEntry->GetName() ) )
{
Follow ups
References