Better synchronization of various ratsnest visibility controls.

This commit is contained in:
Alex 2023-01-27 10:01:08 +03:00
parent a872ed11bf
commit 52edbf91dc
2 changed files with 17 additions and 1 deletions

View File

@ -174,6 +174,8 @@ int PCB_CONTROL::ToggleRatsnest( const TOOL_EVENT& aEvent )
Flip( displayOptions().m_DisplayRatsnestLinesCurved ); Flip( displayOptions().m_DisplayRatsnestLinesCurved );
} }
frame()->OnDisplayOptionsChanged();
canvas()->RedrawRatsnest(); canvas()->RedrawRatsnest();
canvas()->Refresh(); canvas()->Refresh();
@ -354,6 +356,13 @@ int PCB_CONTROL::RatsnestModeCycle( const TOOL_EVENT& aEvent )
displayOptions().m_ShowGlobalRatsnest = false; displayOptions().m_ShowGlobalRatsnest = false;
} }
getEditFrame<PCB_EDIT_FRAME>()->SetElementVisibility( LAYER_RATSNEST,
displayOptions().m_ShowGlobalRatsnest );
frame()->OnDisplayOptionsChanged();
canvas()->RedrawRatsnest();
canvas()->Refresh();
return 0; return 0;
} }

View File

@ -2018,6 +2018,7 @@ void APPEARANCE_CONTROLS::onObjectVisibilityChanged( GAL_LAYER_ID aLayer, bool i
{ {
m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest = isVisible; m_frame->GetPcbNewSettings()->m_Display.m_ShowGlobalRatsnest = isVisible;
m_frame->GetBoard()->SetElementVisibility( aLayer, isVisible ); m_frame->GetBoard()->SetElementVisibility( aLayer, isVisible );
m_frame->OnDisplayOptionsChanged();
m_frame->GetCanvas()->RedrawRatsnest(); m_frame->GetCanvas()->RedrawRatsnest();
} }
@ -3077,7 +3078,13 @@ void APPEARANCE_CONTROLS::onRatsnestMode( wxCommandEvent& aEvent )
cfg->m_Display.m_ShowGlobalRatsnest = false; cfg->m_Display.m_ShowGlobalRatsnest = false;
} }
m_frame->GetCanvas()->RedrawRatsnest(); if( PCB_EDIT_FRAME* editframe = dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) )
{
editframe->SetElementVisibility( LAYER_RATSNEST, cfg->m_Display.m_ShowGlobalRatsnest );
editframe->OnDisplayOptionsChanged();
editframe->GetCanvas()->RedrawRatsnest();
editframe->GetCanvas()->Refresh();
}
passOnFocus(); passOnFocus();
} }