Copy lastResolved stuff when pasting.
This of course assumes the paste came from the same document. If not then pasted items will get default lastResolved stuff.
This commit is contained in:
parent
58b5ac4970
commit
75d750a3cb
|
@ -184,13 +184,6 @@ COLOR4D SCH_BUS_ENTRY_BASE::GetStrokeColor() const
|
|||
if( netclass )
|
||||
m_lastResolvedColor = netclass->GetSchematicColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxASSERT_MSG( !IsConnectable()
|
||||
|| !ADVANCED_CFG::GetCfg().m_RealTimeConnectivity
|
||||
|| !Schematic() || !Schematic()->ConnectionGraph()->m_allowRealTime,
|
||||
"Connectivity shouldn't be dirty if realtime connectivity is on!" );
|
||||
}
|
||||
|
||||
return m_lastResolvedColor;
|
||||
}
|
||||
|
@ -209,13 +202,6 @@ PLOT_DASH_TYPE SCH_BUS_ENTRY_BASE::GetStrokeStyle() const
|
|||
if( netclass )
|
||||
m_lastResolvedLineStyle = static_cast<PLOT_DASH_TYPE>( netclass->GetLineStyle() );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxASSERT_MSG( !IsConnectable()
|
||||
|| !ADVANCED_CFG::GetCfg().m_RealTimeConnectivity
|
||||
|| !Schematic() || !Schematic()->ConnectionGraph()->m_allowRealTime,
|
||||
"Connectivity shouldn't be dirty if realtime connectivity is on!" );
|
||||
}
|
||||
|
||||
return m_lastResolvedLineStyle;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,18 @@ public:
|
|||
|
||||
~SCH_BUS_ENTRY_BASE() { }
|
||||
|
||||
void SetLastResolvedState( const SCH_ITEM* aItem ) override
|
||||
{
|
||||
const SCH_BUS_ENTRY_BASE* aEntry = dynamic_cast<const SCH_BUS_ENTRY_BASE*>( aItem );
|
||||
|
||||
if( aEntry )
|
||||
{
|
||||
m_lastResolvedWidth = aEntry->m_lastResolvedWidth;
|
||||
m_lastResolvedLineStyle = aEntry->m_lastResolvedLineStyle;
|
||||
m_lastResolvedColor = aEntry->m_lastResolvedColor;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true for items which are moved with the anchor point at mouse cursor
|
||||
* and false for items moved with no reference to anchor
|
||||
|
|
|
@ -414,6 +414,8 @@ public:
|
|||
|
||||
void SetConnectivityDirty( bool aDirty = true ) { m_connectivity_dirty = aDirty; }
|
||||
|
||||
virtual void SetLastResolvedState( const SCH_ITEM* aItem ) { }
|
||||
|
||||
NETCLASSPTR NetClass( const SCH_SHEET_PATH* aSheet = nullptr ) const;
|
||||
|
||||
/**
|
||||
|
|
|
@ -187,13 +187,6 @@ COLOR4D SCH_JUNCTION::GetJunctionColor() const
|
|||
if( netclass )
|
||||
m_lastResolvedColor = netclass->GetSchematicColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxASSERT_MSG( !IsConnectable()
|
||||
|| !ADVANCED_CFG::GetCfg().m_RealTimeConnectivity
|
||||
|| !Schematic() || !Schematic()->ConnectionGraph()->m_allowRealTime,
|
||||
"Connectivity shouldn't be dirty if realtime connectivity is on!" );
|
||||
}
|
||||
|
||||
return m_lastResolvedColor;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,17 @@ public:
|
|||
|
||||
void SwapData( SCH_ITEM* aItem ) override;
|
||||
|
||||
void SetLastResolvedState( const SCH_ITEM* aItem ) override
|
||||
{
|
||||
const SCH_JUNCTION* aJunction = dynamic_cast<const SCH_JUNCTION*>( aItem );
|
||||
|
||||
if( aJunction )
|
||||
{
|
||||
m_lastResolvedDiameter = aJunction->m_lastResolvedDiameter;
|
||||
m_lastResolvedColor = aJunction->m_lastResolvedColor;
|
||||
}
|
||||
}
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
|
|
|
@ -245,13 +245,6 @@ COLOR4D SCH_LINE::GetLineColor() const
|
|||
if( netclass )
|
||||
m_lastResolvedColor = netclass->GetSchematicColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxASSERT_MSG( !IsConnectable()
|
||||
|| !ADVANCED_CFG::GetCfg().m_RealTimeConnectivity
|
||||
|| !Schematic() || !Schematic()->ConnectionGraph()->m_allowRealTime,
|
||||
"Connectivity shouldn't be dirty if realtime connectivity is on!" );
|
||||
}
|
||||
|
||||
return m_lastResolvedColor;
|
||||
}
|
||||
|
@ -303,13 +296,6 @@ PLOT_DASH_TYPE SCH_LINE::GetEffectiveLineStyle() const
|
|||
if( netclass )
|
||||
m_lastResolvedLineStyle = static_cast<PLOT_DASH_TYPE>( netclass->GetLineStyle() );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxASSERT_MSG( !IsConnectable()
|
||||
|| !ADVANCED_CFG::GetCfg().m_RealTimeConnectivity
|
||||
|| !Schematic() || !Schematic()->ConnectionGraph()->m_allowRealTime,
|
||||
"Connectivity shouldn't be dirty if realtime connectivity is on!" );
|
||||
}
|
||||
|
||||
return m_lastResolvedLineStyle;
|
||||
}
|
||||
|
|
|
@ -93,6 +93,18 @@ public:
|
|||
wxPoint GetEndPoint() const { return m_end; }
|
||||
void SetEndPoint( const wxPoint& aPosition ) { m_end = aPosition; }
|
||||
|
||||
void SetLastResolvedState( const SCH_ITEM* aItem ) override
|
||||
{
|
||||
const SCH_LINE* aLine = dynamic_cast<const SCH_LINE*>( aItem );
|
||||
|
||||
if( aLine )
|
||||
{
|
||||
m_lastResolvedLineStyle = aLine->m_lastResolvedLineStyle;
|
||||
m_lastResolvedWidth = aLine->m_lastResolvedWidth;
|
||||
m_lastResolvedColor = aLine->m_lastResolvedColor;
|
||||
}
|
||||
}
|
||||
|
||||
PLOT_DASH_TYPE GetDefaultStyle() const;
|
||||
|
||||
void SetLineStyle( const PLOT_DASH_TYPE aStyle );
|
||||
|
|
|
@ -1683,11 +1683,14 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
// Build symbol list for reannotation of duplicates
|
||||
SCH_SHEET_LIST sheets = m_frame->Schematic().GetSheets();
|
||||
SCH_REFERENCE_LIST existingRefs;
|
||||
sheets.GetSymbols( existingRefs );
|
||||
hierarchy.GetSymbols( existingRefs );
|
||||
existingRefs.SortByReferenceOnly();
|
||||
|
||||
// Build UUID map for fetching last-resolved-properties
|
||||
std::map<KIID, EDA_ITEM*> itemMap;
|
||||
hierarchy.FillItemMap( itemMap );
|
||||
|
||||
// Keep track of pasted sheets and symbols for the different
|
||||
// paths to the hierarchy
|
||||
std::map<SCH_SHEET_PATH, SCH_REFERENCE_LIST> pastedSymbols;
|
||||
|
@ -1864,8 +1867,17 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
SCH_ITEM* srcItem = dynamic_cast<SCH_ITEM*>( itemMap[ item->m_Uuid ] );
|
||||
SCH_ITEM* destItem = dynamic_cast<SCH_ITEM*>( item );
|
||||
|
||||
// Everything gets a new KIID
|
||||
const_cast<KIID&>( item->m_Uuid ) = KIID();
|
||||
|
||||
if( srcItem && destItem )
|
||||
{
|
||||
destItem->SetConnectivityDirty( true );
|
||||
destItem->SetLastResolvedState( srcItem );
|
||||
}
|
||||
}
|
||||
|
||||
item->SetFlags( IS_NEW | IS_PASTED | IS_MOVING );
|
||||
|
|
Loading…
Reference in New Issue