Highlight selection candidates instead of using BRIGHT_BOX
This commit is contained in:
parent
b90d86aa2d
commit
d87c9f7ed7
|
@ -765,9 +765,17 @@ void GERBER_DRAW_ITEM::Show( int nestLevel, std::ostream& os ) const
|
|||
|
||||
void GERBER_DRAW_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
{
|
||||
aCount = 2;
|
||||
aLayers[0] = GERBER_DRAW_LAYER( GetLayer() );
|
||||
aLayers[1] = GERBER_DCODE_LAYER( aLayers[0] );
|
||||
aCount = IsBrightened() ? 1 : 2;
|
||||
|
||||
if( IsBrightened() )
|
||||
{
|
||||
aLayers[0] = LAYER_GP_OVERLAY;
|
||||
}
|
||||
else
|
||||
{
|
||||
aLayers[0] = GERBER_DRAW_LAYER( GetLayer() );
|
||||
aLayers[1] = GERBER_DCODE_LAYER( aLayers[0] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -232,6 +232,10 @@ void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer )
|
|||
|
||||
color = m_gerbviewSettings.GetColor( aItem, aLayer );
|
||||
|
||||
// TODO: Should brightened color be a preference?
|
||||
if( aItem->IsBrightened() )
|
||||
color = COLOR4D( 0.0, 1.0, 0.0, 0.75 );
|
||||
|
||||
if( isNegative )
|
||||
{
|
||||
if( m_gerbviewSettings.m_showNegativeItems )
|
||||
|
|
|
@ -636,8 +636,6 @@ EDA_ITEM* GERBVIEW_SELECTION_TOOL::disambiguationMenu( GERBER_COLLECTOR* aCollec
|
|||
BRIGHT_BOX brightBox;
|
||||
CONTEXT_MENU menu;
|
||||
|
||||
getView()->Add( &brightBox );
|
||||
|
||||
int limit = std::min( 10, aCollector->GetCount() );
|
||||
|
||||
for( int i = 0; i < limit; ++i )
|
||||
|
@ -657,7 +655,11 @@ EDA_ITEM* GERBVIEW_SELECTION_TOOL::disambiguationMenu( GERBER_COLLECTOR* aCollec
|
|||
if( evt->Action() == TA_CONTEXT_MENU_UPDATE )
|
||||
{
|
||||
if( current )
|
||||
{
|
||||
current->ClearBrightened();
|
||||
getView()->Update( current, KIGFX::LAYERS );
|
||||
getView()->MarkTargetDirty( KIGFX::TARGET_OVERLAY );
|
||||
}
|
||||
|
||||
int id = *evt->GetCommandId();
|
||||
|
||||
|
@ -666,6 +668,8 @@ EDA_ITEM* GERBVIEW_SELECTION_TOOL::disambiguationMenu( GERBER_COLLECTOR* aCollec
|
|||
{
|
||||
current = ( *aCollector )[id - 1];
|
||||
current->SetBrightened();
|
||||
getView()->Update( current, KIGFX::LAYERS );
|
||||
getView()->MarkTargetDirty( KIGFX::TARGET_OVERLAY );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -684,19 +688,14 @@ EDA_ITEM* GERBVIEW_SELECTION_TOOL::disambiguationMenu( GERBER_COLLECTOR* aCollec
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
// Draw a mark to show which item is available to be selected
|
||||
if( current && current->IsBrightened() )
|
||||
{
|
||||
brightBox.SetItem( current );
|
||||
getView()->SetVisible( &brightBox, true );
|
||||
// getView()->Hide( &brightBox, false );
|
||||
getView()->Update( &brightBox, KIGFX::GEOMETRY );
|
||||
getView()->MarkTargetDirty( KIGFX::TARGET_OVERLAY );
|
||||
}
|
||||
}
|
||||
|
||||
getView()->Remove( &brightBox );
|
||||
if( current && current->IsBrightened() )
|
||||
{
|
||||
current->ClearBrightened();
|
||||
getView()->Update( current, KIGFX::LAYERS );
|
||||
getView()->MarkTargetDirty( KIGFX::TARGET_OVERLAY );
|
||||
}
|
||||
|
||||
return current;
|
||||
}
|
||||
|
@ -762,7 +761,7 @@ void GERBVIEW_SELECTION_TOOL::selectVisually( EDA_ITEM* aItem ) const
|
|||
{
|
||||
// Move the item's layer to the front
|
||||
int layer = static_cast<GERBER_DRAW_ITEM*>( aItem )->GetLayer();
|
||||
m_frame->GetGalCanvas()->SetTopLayer( GERBER_DRAW_LAYER( layer ) );
|
||||
m_frame->SetActiveLayer( layer, true );
|
||||
|
||||
// Hide the original item, so it is shown only on overlay
|
||||
aItem->SetSelected();
|
||||
|
|
Loading…
Reference in New Issue