Footprint viewers: force cairo canvas instead of legacy canvas when the legacy canvas is selected in the board editor.

Legacy canvas does not work in footprint preview panel and does not work fine in footprint viewer frame.

Fixes: lp:1842483
https://bugs.launchpad.net/kicad/+bug/1842483
This commit is contained in:
jean-pierre charras 2019-09-04 16:00:54 +02:00
parent d05d8b6100
commit a79526cad8
2 changed files with 15 additions and 4 deletions

View File

@ -247,7 +247,11 @@ public:
FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL( KIWAY* aKiway, wxWindow* aParent,
std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> aOpts,
GAL_TYPE aGalType )
: PCB_DRAW_PANEL_GAL ( aParent, -1, wxPoint( 0, 0 ), wxSize(200, 200), *aOpts, aGalType ),
: PCB_DRAW_PANEL_GAL ( aParent, -1, wxPoint( 0, 0 ), wxSize(200, 200), *aOpts,
// Note: legacy canvas does not work in FOOTPRINT_PREVIEW_PANEL:
// force opengl or cairo canvas
aGalType == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ? aGalType
: EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ),
KIWAY_HOLDER( aKiway ),
m_DisplayOptions( std::move( aOpts ) ),
m_footprintDisplayed( true )

View File

@ -192,9 +192,15 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
UpdateTitle();
// Create GAL canvas
m_canvasType = LoadCanvasTypeSetting();
// Legacy canvas is deprecated and does not work fine in footprint viewer.
// So force cairo canvas in this case
if( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
GetGalDisplayOptions(),
LoadCanvasTypeSetting() );
GetGalDisplayOptions(), m_canvasType );
SetGalCanvas( drawPanel );
// Create the manager and dispatcher & route draw panel events to the dispatcher
@ -244,13 +250,14 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
m_auimgr.Update();
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
UseGalCanvas( true );
// Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
GetGalCanvas()->GetView()->SetScale( m_lastZoom );
updateView();
UseGalCanvas( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
{
Raise(); // On some window managers, this is needed