Fix repaints getting done after the wrong dialog.

(cherry picked from commit b7c9a1ad55)
This commit is contained in:
Jeff Young 2022-02-13 13:06:35 +00:00
parent fd4ac7c5df
commit f37531ed39
2 changed files with 23 additions and 29 deletions

View File

@ -58,6 +58,7 @@
#include <tool/grid_menu.h>
#include "cleanup_item.h"
#include <zoom_defines.h>
#include <ratsnest/ratsnest_view_item.h>
wxDEFINE_EVENT( BOARD_CHANGED, wxCommandEvent );
@ -810,7 +811,25 @@ void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
GetCanvas()->GetView()->GetPainter()->GetSettings()->LoadColors( GetColorSettings() );
GetCanvas()->GetView()->UpdateAllItems( KIGFX::COLOR );
GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT,
[&]( KIGFX::VIEW_ITEM* aItem ) -> bool
{
if( dynamic_cast<RATSNEST_VIEW_ITEM*>( aItem ) )
{
return true; // ratsnest display
}
else if( dynamic_cast<PCB_TRACK*>( aItem ) )
{
return true; // track, arc & via clearance display
}
else if( dynamic_cast<PAD*>( aItem ) )
{
return true; // pad clearance display
}
return false;
} );
RecreateToolbars();

View File

@ -973,8 +973,6 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
// Make sure everything's up-to-date
GetBoard()->BuildListOfNets();
const PCB_DISPLAY_OPTIONS prevOpts = GetDisplayOptions();
DIALOG_BOARD_SETUP dlg( this );
if( !aInitialPage.IsEmpty() )
@ -989,36 +987,13 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
Kiway().CommonSettingsChanged( false, true );
bool trackClearanceModeChanged = GetDisplayOptions().m_ShowTrackClearanceMode
!= prevOpts.m_ShowTrackClearanceMode;
bool padClearanceModeChanged = GetDisplayOptions().m_DisplayPadClearance
!= prevOpts.m_DisplayPadClearance;
GetCanvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT,
[&]( KIGFX::VIEW_ITEM* aItem ) -> bool
{
BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( aItem );
if( dynamic_cast<EDA_TEXT*>( aItem ) )
return true; // text variables
if( !item )
return false;
switch( item->Type() )
{
case PCB_TRACE_T:
case PCB_ARC_T:
case PCB_VIA_T:
return trackClearanceModeChanged;
case PCB_PAD_T:
return padClearanceModeChanged;
case PCB_TEXT_T:
case PCB_FP_TEXT_T:
return true; // text variables
default:
return false;
}
return false;
} );
GetCanvas()->Refresh();