Make sure aliases get their refs and values drawn correctly.

Fixes: lp:1799460
* https://bugs.launchpad.net/kicad/+bug/1799460
This commit is contained in:
Jeff Young 2018-10-23 16:02:55 +01:00
parent a96dbde738
commit 0c06bdb1e0
3 changed files with 11 additions and 14 deletions

View File

@ -182,9 +182,15 @@ bool operator<( const LIB_ALIAS& aItem1, const LIB_ALIAS& aItem2 )
void LIB_ALIAS::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 2;
// An alias's fields don't know how to fetch their parent's values so we don't let
// them draw themselves. This means the alias always has to draw them, which means
// it has to "own" their layers as well.
aCount = 5;
aLayers[0] = LAYER_DEVICE;
aLayers[1] = LAYER_DEVICE_BACKGROUND;
aLayers[2] = LAYER_REFERENCEPART;
aLayers[3] = LAYER_VALUEPART;
aLayers[4] = LAYER_FIELDS;
}

View File

@ -108,8 +108,9 @@ void SCH_PREVIEW_PANEL::setDefaultLayerOrder()
void SCH_PREVIEW_PANEL::setDefaultLayerDeps()
{
// caching makes no sense for Cairo and other software renderers
auto target = m_backend == GAL_TYPE_OPENGL ? KIGFX::TARGET_CACHED : KIGFX::TARGET_NONCACHED;
// An alias's fields don't know how to substitute in their parent's values, so we
// don't let them draw themselves. This means no caching.
auto target = KIGFX::TARGET_NONCACHED;
for( int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; i++ )
m_view->SetLayerTarget( i, target );

View File

@ -82,18 +82,8 @@ void SCH_VIEW::DisplayComponent( LIB_PART *aPart )
if( !aPart )
return;
int fgPriority = INT_MAX / 2;
int bgPriority = 0;
for ( auto &item : aPart->GetDrawItems() )
{
// Apply a z-order heuristic (because we don't yet let the user edit it):
// push body-filled objects to the back.
if( item.GetFillMode() == FILLED_WITH_BG_BODYCOLOR )
Add( &item, bgPriority++ );
else
Add( &item, fgPriority++ );
}
Add( &item );
m_selectionArea.reset( new KIGFX::PREVIEW::SELECTION_AREA( ) );
m_preview.reset( new KIGFX::VIEW_GROUP () );