Pcbnew: Route all display options updates through the frame
The frame contains the main option set that is used for setting the UI state, so it must be updated. The frame also updates the view when set, so calling the view separately to update the options isn't needed. Fixes https://gitlab.com/kicad/code/kicad/issues/5069
This commit is contained in:
parent
0a0ed9e064
commit
e03f6a3b49
|
@ -696,7 +696,10 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
|
|||
{
|
||||
PCB_DISPLAY_OPTIONS opt = myframe->GetDisplayOptions();
|
||||
opt.m_ShowGlobalRatsnest = isEnabled;
|
||||
myframe->GetCanvas()->GetView()->UpdateDisplayOptions( opt );
|
||||
myframe->SetDisplayOptions( opt );
|
||||
|
||||
// TODO(ISM): Remove once EVT_UPDATE_UI works
|
||||
myframe->SyncToolbars();
|
||||
}
|
||||
}
|
||||
else if( aId != LAYER_GRID )
|
||||
|
|
|
@ -97,7 +97,6 @@ int PCB_VIEWER_TOOLS::ShowPadNumbers( const TOOL_EVENT& aEvent )
|
|||
|
||||
Flip( opts.m_DisplayPadNum );
|
||||
frame()->SetDisplayOptions( opts );
|
||||
view()->UpdateDisplayOptions( opts );
|
||||
|
||||
for( auto module : board()->Modules() )
|
||||
{
|
||||
|
@ -117,7 +116,6 @@ int PCB_VIEWER_TOOLS::PadDisplayMode( const TOOL_EVENT& aEvent )
|
|||
|
||||
Flip( opts.m_DisplayPadFill );
|
||||
frame()->SetDisplayOptions( opts );
|
||||
view()->UpdateDisplayOptions( opts );
|
||||
|
||||
for( auto module : board()->Modules() )
|
||||
{
|
||||
|
@ -137,7 +135,6 @@ int PCB_VIEWER_TOOLS::GraphicOutlines( const TOOL_EVENT& aEvent )
|
|||
|
||||
Flip( opts.m_DisplayGraphicsFill );
|
||||
frame()->SetDisplayOptions( opts );
|
||||
view()->UpdateDisplayOptions( opts );
|
||||
|
||||
for( MODULE* module : board()->Modules() )
|
||||
{
|
||||
|
@ -168,7 +165,6 @@ int PCB_VIEWER_TOOLS::TextOutlines( const TOOL_EVENT& aEvent )
|
|||
|
||||
Flip( opts.m_DisplayTextFill );
|
||||
frame()->SetDisplayOptions( opts );
|
||||
view()->UpdateDisplayOptions( opts );
|
||||
|
||||
for( MODULE* module : board()->Modules() )
|
||||
{
|
||||
|
|
|
@ -120,7 +120,6 @@ int PCBNEW_CONTROL::TrackDisplayMode( const TOOL_EVENT& aEvent )
|
|||
|
||||
Flip( opts.m_DisplayPcbTrackFill );
|
||||
m_frame->SetDisplayOptions( opts );
|
||||
view()->UpdateDisplayOptions( opts );
|
||||
|
||||
for( auto track : board()->Tracks() )
|
||||
{
|
||||
|
@ -143,7 +142,6 @@ int PCBNEW_CONTROL::ToggleRatsnest( const TOOL_EVENT& aEvent )
|
|||
// N.B. Do not disable the Ratsnest layer here. We use it for local ratsnest
|
||||
Flip( opts.m_ShowGlobalRatsnest );
|
||||
m_frame->SetDisplayOptions( opts );
|
||||
view()->UpdateDisplayOptions( opts );
|
||||
getEditFrame<PCB_EDIT_FRAME>()->SetElementVisibility( LAYER_RATSNEST,
|
||||
opts.m_ShowGlobalRatsnest );
|
||||
|
||||
|
@ -152,7 +150,6 @@ int PCBNEW_CONTROL::ToggleRatsnest( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
Flip( opts.m_DisplayRatsnestLinesCurved );
|
||||
m_frame->SetDisplayOptions( opts );
|
||||
view()->UpdateDisplayOptions( opts );
|
||||
}
|
||||
|
||||
canvas()->RedrawRatsnest();
|
||||
|
@ -167,7 +164,6 @@ int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent )
|
|||
auto opts = displayOptions();
|
||||
|
||||
Flip( opts.m_DisplayViaFill );
|
||||
view()->UpdateDisplayOptions( opts );
|
||||
m_frame->SetDisplayOptions( opts );
|
||||
|
||||
for( auto track : board()->Tracks() )
|
||||
|
@ -199,7 +195,6 @@ int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
|
|||
wxFAIL;
|
||||
|
||||
m_frame->SetDisplayOptions( opts );
|
||||
view()->UpdateDisplayOptions( opts );
|
||||
|
||||
for( int i = 0; i < board()->GetAreaCount(); ++i )
|
||||
view()->Update( board()->GetArea( i ), KIGFX::GEOMETRY );
|
||||
|
@ -246,7 +241,7 @@ int PCBNEW_CONTROL::HighContrastModeCycle( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_frame->SetDisplayOptions( opts );
|
||||
|
||||
// TODO: remove once EVT_UPDATE_UI works
|
||||
// TODO(ISM): remove once EVT_UPDATE_UI works
|
||||
m_frame->SyncToolbars();
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue