Pcbnew: keep layer manager synchronized with board items visibility after switching to a new canvas.

This commit is contained in:
jean-pierre charras 2017-08-09 09:48:56 +02:00
parent 068f96f2ce
commit 9bb43a89ba
4 changed files with 25 additions and 7 deletions

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -687,7 +687,7 @@ public:
/**
* switches currently used canvas (default / Cairo / OpenGL).
*/
void SwitchCanvas( wxCommandEvent& aEvent );
virtual void SwitchCanvas( wxCommandEvent& aEvent );
/**
* Update UI called when switches currently used canvas (default / Cairo / OpenGL).

View File

@ -118,6 +118,11 @@ protected:
*/
void enableGALSpecificMenus();
/**
* switches currently used canvas (default / Cairo / OpenGL).
*/
virtual void SwitchCanvas( wxCommandEvent& aEvent ) override;
/**
* Helper function to coerce all colors to legacy-compatible when
* switching from GAL to legacy canvas

View File

@ -979,7 +979,7 @@ void PCB_BASE_FRAME::UseGalCanvas( bool aEnable )
if( m_toolManager )
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
// Transfer latets current display options from legacy to GAL canvas:
// Transfer latest current display options from legacy to GAL canvas:
auto painter = static_cast<KIGFX::PCB_PAINTER*>( galCanvas->GetView()->GetPainter() );
auto settings = painter->GetSettings();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();

View File

@ -190,9 +190,9 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, PCB_EDIT_FRAME::Show3D_Frame )
// Switching canvases
EVT_MENU( ID_MENU_CANVAS_LEGACY, PCB_BASE_FRAME::SwitchCanvas )
EVT_MENU( ID_MENU_CANVAS_CAIRO, PCB_BASE_FRAME::SwitchCanvas )
EVT_MENU( ID_MENU_CANVAS_OPENGL, PCB_BASE_FRAME::SwitchCanvas )
EVT_MENU( ID_MENU_CANVAS_LEGACY, PCB_EDIT_FRAME::SwitchCanvas )
EVT_MENU( ID_MENU_CANVAS_CAIRO, PCB_EDIT_FRAME::SwitchCanvas )
EVT_MENU( ID_MENU_CANVAS_OPENGL, PCB_EDIT_FRAME::SwitchCanvas )
// Menu Get Design Rules Editor
EVT_MENU( ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, PCB_EDIT_FRAME::ShowDesignRulesEditor )
@ -1106,6 +1106,19 @@ void PCB_EDIT_FRAME::OnLayerColorChange( wxCommandEvent& aEvent )
}
void PCB_EDIT_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
{
// switches currently used canvas (default / Cairo / OpenGL).
PCB_BASE_FRAME::SwitchCanvas( aEvent );
// The base class method reinit the layers manager.
// We must upate the layer widget to match board visibility states,
// both layers and render columns.
syncLayerVisibilities();
syncLayerWidgetLayer();
syncRenderStates();
}
void PCB_EDIT_FRAME::ToPlotter( wxCommandEvent& event )
{
DIALOG_PLOT dlg( this );