Properly update view when GerbView display settings changed

This commit is contained in:
Jon Evans 2018-02-27 20:53:27 -05:00 committed by jean-pierre charras
parent cd14525839
commit 490a2105c3
1 changed files with 23 additions and 16 deletions

View File

@ -147,28 +147,32 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
TransferDataFromWindow(); TransferDataFromWindow();
auto displayOptions = (GBR_DISPLAY_OPTIONS*) m_Parent->GetDisplayOptions(); auto displayOptions = (GBR_DISPLAY_OPTIONS*) m_Parent->GetDisplayOptions();
bool needs_repaint = false, option;
m_Parent->m_DisplayOptions.m_DisplayPolarCood = m_Parent->m_DisplayOptions.m_DisplayPolarCood =
(m_PolarDisplay->GetSelection() == 0) ? false : true; (m_PolarDisplay->GetSelection() == 0) ? false : true;
g_UserUnit = (m_BoxUnits->GetSelection() == 0) ? INCHES : MILLIMETRES; g_UserUnit = (m_BoxUnits->GetSelection() == 0) ? INCHES : MILLIMETRES;
if( m_OptDisplayLines->GetSelection() == 1 ) option = ( m_OptDisplayLines->GetSelection() == 1 );
m_Parent->m_DisplayOptions.m_DisplayLinesFill = true;
else
m_Parent->m_DisplayOptions.m_DisplayLinesFill = false;
if( m_OptDisplayFlashedItems->GetSelection() == 1 ) if( option != m_Parent->m_DisplayOptions.m_DisplayLinesFill )
{ needs_repaint = true;
m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill = true;
}
else
{
m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill = false;
}
if( m_OptDisplayPolygons->GetSelection() == 0 ) m_Parent->m_DisplayOptions.m_DisplayLinesFill = option;
m_Parent->m_DisplayOptions.m_DisplayPolygonsFill = false;
else option = ( m_OptDisplayFlashedItems->GetSelection() == 1 );
m_Parent->m_DisplayOptions.m_DisplayPolygonsFill = true;
if( option != m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill )
needs_repaint = true;
m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill = option;
option = ( m_OptDisplayPolygons->GetSelection() == 1 );
if( option != m_Parent->m_DisplayOptions.m_DisplayPolygonsFill )
needs_repaint = true;
m_Parent->m_DisplayOptions.m_DisplayPolygonsFill = option;
m_Parent->SetElementVisibility( LAYER_DCODES, m_OptDisplayDCodes->GetValue() ); m_Parent->SetElementVisibility( LAYER_DCODES, m_OptDisplayDCodes->GetValue() );
@ -192,6 +196,9 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
settings->LoadDisplayOptions( displayOptions ); settings->LoadDisplayOptions( displayOptions );
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
if( needs_repaint )
view->UpdateAllItems( KIGFX::REPAINT );
m_Parent->GetCanvas()->Refresh(); m_Parent->GetCanvas()->Refresh();
EndModal( 1 ); EndModal( 1 );