bool EDA_DRAW_PANEL_GAL::SaveGalSettings()
{
    if( !m_edaFrame || !m_gal )
        return false;

    wxConfigBase* cfg = Kiface().KifaceSettings();
    wxString baseCfgName = m_edaFrame->GetName();

    if( !cfg )
        return false;

    if( !cfg->Write( baseCfgName + GRID_STYLE_CFG, (long) GetGAL()->GetGridStyle() ) )
        return false;

    return true;
}
bool EDA_DRAW_PANEL_GAL::LoadGalSettings()
{
    if( !m_edaFrame || !m_gal )
        return false;

    wxConfigBase* cfg = Kiface().KifaceSettings();
    wxString baseCfgName = m_edaFrame->GetName();

    if( !cfg )
        return false;

    long gridStyle;
    cfg->Read( baseCfgName + GRID_STYLE_CFG, &gridStyle, (long) KIGFX::GRID_STYLE::GRID_STYLE_DOTS );
    GetGAL()->SetGridStyle( (KIGFX::GRID_STYLE) gridStyle );

    return true;
}
void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{
    myframe->SetElementVisibility( (GERBVIEW_LAYER_ID) aId, isEnabled );

    auto galCanvas = myframe->GetGalCanvas();

    if( galCanvas )
    {
        if( aId == LAYER_GERBVIEW_GRID )
        {
            galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() );
            galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
        }
        else
            galCanvas->GetView()->SetLayerVisible( aId, isEnabled );
    }

    if( galCanvas && myframe->IsGalCanvasActive() )
        galCanvas->Refresh();
    else
        myframe->GetCanvas()->Refresh();
}