Make usage of BRIGHTENED consistent (m_Flags, not m_Status).

This commit is contained in:
Jeff Young 2019-04-19 17:15:14 +01:00
parent 5113c3cc58
commit f2d9887409
2 changed files with 23 additions and 18 deletions

View File

@ -225,7 +225,7 @@ bool SCH_PAINTER::isUnitAndConversionShown( const LIB_ITEM* aItem )
COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aOnBackgroundLayer ) COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aOnBackgroundLayer )
{ {
if( aItem->GetState( BRIGHTENED ) ) if( aItem->IsBrightened() )
return m_schSettings.GetLayerColor( LAYER_BRIGHTENED ); return m_schSettings.GetLayerColor( LAYER_BRIGHTENED );
const SCH_LINE* line = dynamic_cast<const SCH_LINE*>( aItem ); const SCH_LINE* line = dynamic_cast<const SCH_LINE*>( aItem );
@ -1121,8 +1121,7 @@ void SCH_PAINTER::draw( SCH_COMPONENT *aComp, int aLayer )
const SCH_PIN& schPin = pinMap.at( originalPin ); const SCH_PIN& schPin = pinMap.at( originalPin );
tempPin->ClearFlags(); tempPin->ClearFlags();
tempPin->SetFlags( schPin.GetFlags() ); // IS_MOVED, SELECTED, HIGHLIGHTED tempPin->SetFlags( schPin.GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
tempPin->SetStatus( schPin.GetStatus() ); // BRIGHTENED
if( schPin.IsDangling() ) if( schPin.IsDangling() )
tempPin->SetFlags( IS_DANGLING ); tempPin->SetFlags( IS_DANGLING );

View File

@ -173,18 +173,21 @@ int SCH_EDITOR_CONTROL::HighlightNetSelection( const TOOL_EVENT& aEvent )
if( !screen ) if( !screen )
return 0; return 0;
for( SCH_ITEM* ptr = screen->GetDrawItems(); ptr; ptr = ptr->Next() ) for( SCH_ITEM* item = screen->GetDrawItems(); item; item = item->Next() )
{ {
auto conn = ptr->Connection( *g_CurrentSheet ); SCH_CONNECTION* conn = item->Connection( *g_CurrentSheet );
bool redraw = ptr->GetState( BRIGHTENED ); bool redraw = item->IsBrightened();
ptr->SetState( BRIGHTENED, ( conn && conn->Name() == selectedNetName ) ); if( conn && conn->Name() == selectedNetName )
item->SetBrightened();
else
item->ClearBrightened();
redraw |= ptr->GetState( BRIGHTENED ); redraw |= item->IsBrightened();
if( ptr->Type() == SCH_COMPONENT_T ) if( item->Type() == SCH_COMPONENT_T )
{ {
SCH_COMPONENT* comp = static_cast<SCH_COMPONENT*>( ptr ); SCH_COMPONENT* comp = static_cast<SCH_COMPONENT*>( item );
redraw |= comp->HasBrightenedPins(); redraw |= comp->HasBrightenedPins();
@ -203,16 +206,19 @@ int SCH_EDITOR_CONTROL::HighlightNetSelection( const TOOL_EVENT& aEvent )
} }
} }
} }
else if( ptr->Type() == SCH_SHEET_T ) else if( item->Type() == SCH_SHEET_T )
{ {
for( SCH_SHEET_PIN& pin : static_cast<SCH_SHEET*>( ptr )->GetPins() ) for( SCH_SHEET_PIN& pin : static_cast<SCH_SHEET*>( item )->GetPins() )
{ {
auto pin_conn = pin.Connection( *g_CurrentSheet ); auto pin_conn = pin.Connection( *g_CurrentSheet );
bool redrawPin = pin.GetState( BRIGHTENED ); bool redrawPin = pin.IsBrightened();
pin.SetState( BRIGHTENED, ( pin_conn && pin_conn->Name() == selectedNetName ) ); if( pin_conn && pin_conn->Name() == selectedNetName )
pin.SetBrightened();
else
pin.ClearBrightened();
redrawPin |= pin.GetState( BRIGHTENED ); redrawPin |= pin.IsBrightened();
if( redrawPin ) if( redrawPin )
itemsToRedraw.push_back( &pin ); itemsToRedraw.push_back( &pin );
@ -220,14 +226,14 @@ int SCH_EDITOR_CONTROL::HighlightNetSelection( const TOOL_EVENT& aEvent )
} }
if( redraw ) if( redraw )
itemsToRedraw.push_back( ptr ); itemsToRedraw.push_back( item );
} }
// Be sure hightlight change will be redrawn // Be sure hightlight change will be redrawn
KIGFX::VIEW* view = getView(); KIGFX::VIEW* view = getView();
for( auto item : itemsToRedraw ) for( auto redrawItem : itemsToRedraw )
view->Update( (KIGFX::VIEW_ITEM*)item, KIGFX::VIEW_UPDATE_FLAGS::REPAINT ); view->Update( (KIGFX::VIEW_ITEM*)redrawItem, KIGFX::VIEW_UPDATE_FLAGS::REPAINT );
m_frame->GetGalCanvas()->Refresh(); m_frame->GetGalCanvas()->Refresh();