Don't double-add pins to parent part when pasting.
Also adds undo to paste operations in LibEdit. Fixes: lp:1829355 * https://bugs.launchpad.net/kicad/+bug/1829355
This commit is contained in:
parent
0dd1584394
commit
68224e0fcd
|
@ -534,6 +534,9 @@ int LIB_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
LIB_PART* part = m_frame->GetCurPart();
|
LIB_PART* part = m_frame->GetCurPart();
|
||||||
|
|
||||||
|
if( !part )
|
||||||
|
return 0;
|
||||||
|
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
|
|
||||||
saveCopyInUndoList( part, UR_LIBEDIT );
|
saveCopyInUndoList( part, UR_LIBEDIT );
|
||||||
|
@ -634,13 +637,15 @@ int LIB_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_frame->SaveCopyInUndoList( part );
|
||||||
|
|
||||||
for( LIB_ITEM& item : newPart->GetDrawItems() )
|
for( LIB_ITEM& item : newPart->GetDrawItems() )
|
||||||
{
|
{
|
||||||
if( item.Type() == LIB_FIELD_T )
|
if( item.Type() == LIB_FIELD_T )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
|
LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
|
||||||
newItem->SetFlags( IS_NEW );
|
newItem->SetFlags( IS_NEW | IS_PASTED );
|
||||||
newItems.push_back( newItem );
|
newItems.push_back( newItem );
|
||||||
|
|
||||||
part->GetDrawItems().push_back( newItem );
|
part->GetDrawItems().push_back( newItem );
|
||||||
|
|
|
@ -171,7 +171,7 @@ bool LIB_PIN_TOOL::PlacePin( LIB_PIN* aPin )
|
||||||
test->GetUnit() );
|
test->GetUnit() );
|
||||||
|
|
||||||
KIDIALOG dlg( m_frame, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
KIDIALOG dlg( m_frame, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
||||||
dlg.SetOKLabel( _( "Create Pin Anyway" ) );
|
dlg.SetOKLabel( _( "Place Pin Anyway" ) );
|
||||||
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
|
||||||
|
|
||||||
bool status = dlg.ShowModal() == wxID_OK;
|
bool status = dlg.ShowModal() == wxID_OK;
|
||||||
|
@ -193,7 +193,7 @@ bool LIB_PIN_TOOL::PlacePin( LIB_PIN* aPin )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aPin->IsNew() )
|
if( aPin->IsNew() && !( aPin->GetFlags() & IS_PASTED ) )
|
||||||
{
|
{
|
||||||
g_LastPinOrient = aPin->GetOrientation();
|
g_LastPinOrient = aPin->GetOrientation();
|
||||||
g_LastPinType = aPin->GetType();
|
g_LastPinType = aPin->GetType();
|
||||||
|
|
|
@ -124,7 +124,7 @@ typedef const INSPECTOR_FUNC& INSPECTOR; /// std::function passed to nested u
|
||||||
#define CANDIDATE (1 << 14) ///< flag indicating that the structure is connected
|
#define CANDIDATE (1 << 14) ///< flag indicating that the structure is connected
|
||||||
#define SKIP_STRUCT (1 << 15) ///< flag indicating that the structure should be ignored
|
#define SKIP_STRUCT (1 << 15) ///< flag indicating that the structure should be ignored
|
||||||
#define DO_NOT_DRAW (1 << 16) ///< Used to disable draw function
|
#define DO_NOT_DRAW (1 << 16) ///< Used to disable draw function
|
||||||
// empty spot (1 << 17)
|
#define IS_PASTED (1 << 17) ///< Modifier on IS_NEW which indicates it came from clipboard
|
||||||
#define TRACK_LOCKED (1 << 18) ///< Pcbnew: track locked: protected from global deletion
|
#define TRACK_LOCKED (1 << 18) ///< Pcbnew: track locked: protected from global deletion
|
||||||
#define TRACK_AR (1 << 19) ///< Pcbnew: autorouted track
|
#define TRACK_AR (1 << 19) ///< Pcbnew: autorouted track
|
||||||
#define FLAG1 (1 << 20) ///< Pcbnew: flag used in local computations
|
#define FLAG1 (1 << 20) ///< Pcbnew: flag used in local computations
|
||||||
|
|
Loading…
Reference in New Issue