Eeschema: fix broken instance data when adding new symbol.
Pass the current SCHEMATIC object pointer in SCH_SYMBOL ctor so that newly created symbols will update the current instance data on creation when the current sheet instance is being displayed. This is a better fix for the master branch and cherry-picking from 6.0 was a mess. Fixes https://gitlab.com/kicad/code/kicad/-/issues/12190
This commit is contained in:
parent
d22fc24d9e
commit
7c6d9f67f9
|
@ -105,8 +105,8 @@ SCH_SYMBOL::SCH_SYMBOL() :
|
|||
|
||||
SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId,
|
||||
const SCH_SHEET_PATH* aSheet, int aUnit, int aConvert,
|
||||
const VECTOR2I& aPosition ) :
|
||||
SCH_ITEM( nullptr, SCH_SYMBOL_T )
|
||||
const VECTOR2I& aPosition, EDA_ITEM* aParent ) :
|
||||
SCH_ITEM( aParent, SCH_SYMBOL_T )
|
||||
{
|
||||
Init( aPosition );
|
||||
|
||||
|
@ -151,8 +151,9 @@ SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId,
|
|||
|
||||
|
||||
SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet,
|
||||
const PICKED_SYMBOL& aSel, const VECTOR2I& aPosition ) :
|
||||
SCH_SYMBOL( aSymbol, aSel.LibId, aSheet, aSel.Unit, aSel.Convert, aPosition )
|
||||
const PICKED_SYMBOL& aSel, const VECTOR2I& aPosition,
|
||||
EDA_ITEM* aParent ) :
|
||||
SCH_SYMBOL( aSymbol, aSel.LibId, aSheet, aSel.Unit, aSel.Convert, aPosition, aParent )
|
||||
{
|
||||
// Set any fields that were modified as part of the symbol selection
|
||||
for( const std::pair<int, wxString>& i : aSel.Fields )
|
||||
|
|
|
@ -86,16 +86,16 @@ public:
|
|||
* @param aSymbol is the library symbol to create schematic symbol from.
|
||||
* @param aLibId is the #LIB_ID of alias to create.
|
||||
* @param aSheet is the schematic sheet the symbol is place into.
|
||||
* @param unit is unit for symbols that have multiple parts per package.
|
||||
* @param convert is the alternate body style for the schematic symbols.
|
||||
* @param pos is the position of the symbol.
|
||||
* @param setNewItemFlag is used to set the symbol #IS_NEW and #IS_MOVING flags.
|
||||
* @param aUnit is unit for symbols that have multiple parts per package.
|
||||
* @param aConvert is the alternate body style for the schematic symbols.
|
||||
* @param aPosition is the position of the symbol.
|
||||
*/
|
||||
SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
|
||||
int unit, int convert = 0, const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
|
||||
int aUnit, int aConvert = 0, const VECTOR2I& aPosition = VECTOR2I( 0, 0 ),
|
||||
EDA_ITEM* aParent = nullptr );
|
||||
|
||||
SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
|
||||
const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
|
||||
const VECTOR2I& aPosition = VECTOR2I( 0, 0 ), EDA_ITEM* aParent = nullptr );
|
||||
|
||||
/**
|
||||
* Clone \a aSymbol into a new schematic symbol object.
|
||||
|
|
|
@ -216,8 +216,10 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
|||
};
|
||||
|
||||
Activate();
|
||||
|
||||
// Must be done after Activate() so that it gets set into the correct context
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
// Set initial cursor
|
||||
setCursor();
|
||||
|
||||
|
@ -226,7 +228,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
addSymbol( symbol );
|
||||
annotate();
|
||||
getViewControls()->WarpMouseCursor( getViewControls()->GetMousePosition( false ));
|
||||
getViewControls()->WarpMouseCursor( getViewControls()->GetMousePosition( false ) );
|
||||
}
|
||||
else if( aEvent.HasPosition() )
|
||||
{
|
||||
|
@ -324,7 +326,8 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
|||
cursorPos = getViewControls()->GetMousePosition();
|
||||
}
|
||||
|
||||
symbol = new SCH_SYMBOL( *libSymbol, &m_frame->GetCurrentSheet(), sel, cursorPos );
|
||||
symbol = new SCH_SYMBOL( *libSymbol, &m_frame->GetCurrentSheet(), sel, cursorPos,
|
||||
&m_frame->Schematic() );
|
||||
addSymbol( symbol );
|
||||
annotate();
|
||||
|
||||
|
@ -482,8 +485,10 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
};
|
||||
|
||||
Activate();
|
||||
|
||||
// Must be done after Activate() so that it gets set into the correct context
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
// Set initial cursor
|
||||
setCursor();
|
||||
|
||||
|
@ -756,8 +761,10 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
};
|
||||
|
||||
Activate();
|
||||
|
||||
// Must be done after Activate() so that it gets set into the correct context
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
// Set initial cursor
|
||||
setCursor();
|
||||
|
||||
|
@ -1173,8 +1180,10 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
};
|
||||
|
||||
Activate();
|
||||
|
||||
// Must be done after Activate() so that it gets set into the correct context
|
||||
controls->ShowCursor( true );
|
||||
|
||||
// Set initial cursor
|
||||
setCursor();
|
||||
|
||||
|
@ -1501,8 +1510,10 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
};
|
||||
|
||||
Activate();
|
||||
|
||||
// Must be done after Activate() so that it gets set into the correct context
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
// Set initial cursor
|
||||
setCursor();
|
||||
|
||||
|
@ -1708,8 +1719,10 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
};
|
||||
|
||||
Activate();
|
||||
|
||||
// Must be done after Activate() so that it gets set into the correct context
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
// Set initial cursor
|
||||
setCursor();
|
||||
|
||||
|
|
Loading…
Reference in New Issue