Ratsnest: Improve show heuristics
When the local ratsnest tool is used, it should toggle the state based
on the global ratsnest visibility. After changing state, the layer
cache is marked as well.
Possibly related to lp:1800301
(cherry picked from commit 22fbf30f22
)
This commit is contained in:
parent
c539d6e0be
commit
eb689a5221
|
@ -112,7 +112,18 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool enable = !sourceNode->GetNoLine() && !targetNode->GetNoLine();
|
bool enable = !sourceNode->GetNoLine() && !targetNode->GetNoLine();
|
||||||
bool show = sourceNode->Parent()->GetLocalRatsnestVisible() || targetNode->Parent()->GetLocalRatsnestVisible();
|
bool show;
|
||||||
|
|
||||||
|
// If the ratsnest layer is currently enabled, the local ratsnest
|
||||||
|
// should be easy to turn off, so either element can disable it
|
||||||
|
// If the layer is off, the local ratsnest should be easy to turn on
|
||||||
|
// so either element can enable it.
|
||||||
|
if( sourceNode->Parent()->GetBoard()->IsElementVisible( LAYER_RATSNEST ) )
|
||||||
|
show = sourceNode->Parent()->GetLocalRatsnestVisible() &&
|
||||||
|
targetNode->Parent()->GetLocalRatsnestVisible();
|
||||||
|
else
|
||||||
|
show = sourceNode->Parent()->GetLocalRatsnestVisible() ||
|
||||||
|
targetNode->Parent()->GetLocalRatsnestVisible();
|
||||||
|
|
||||||
if ( enable && show )
|
if ( enable && show )
|
||||||
{
|
{
|
||||||
|
|
|
@ -760,7 +760,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_TB_OPTIONS_SHOW_RATSNEST:
|
case ID_TB_OPTIONS_SHOW_RATSNEST:
|
||||||
SetElementVisibility( LAYER_RATSNEST, state );
|
SetElementVisibility( LAYER_RATSNEST, state );
|
||||||
OnModify();
|
PCB_BASE_FRAME::OnModify();
|
||||||
Compile_Ratsnest( NULL, true );
|
Compile_Ratsnest( NULL, true );
|
||||||
|
|
||||||
if( IsGalCanvasActive() )
|
if( IsGalCanvasActive() )
|
||||||
|
|
|
@ -1089,25 +1089,22 @@ static bool showLocalRatsnest( TOOL_MANAGER* aToolMgr, BOARD* aBoard, const VECT
|
||||||
for( auto mod : modules )
|
for( auto mod : modules )
|
||||||
{
|
{
|
||||||
for( auto pad : mod->Pads() )
|
for( auto pad : mod->Pads() )
|
||||||
{
|
pad->SetLocalRatsnestVisible( aBoard->IsElementVisible( LAYER_RATSNEST ) );
|
||||||
pad->SetLocalRatsnestVisible( false );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
for( auto item : selection )
|
|
||||||
{
|
{
|
||||||
if( item->Type() == PCB_MODULE_T )
|
for( auto item : selection )
|
||||||
{
|
{
|
||||||
for( auto pad : static_cast<MODULE *> (item)->Pads() )
|
if( auto mod = dyn_cast<MODULE*>(item) )
|
||||||
{
|
{
|
||||||
pad->SetLocalRatsnestVisible( !pad->GetLocalRatsnestVisible() );
|
for( auto pad : mod->Pads() )
|
||||||
|
pad->SetLocalRatsnestVisible( !pad->GetLocalRatsnestVisible() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aToolMgr->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue