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