Enable canvas switching in pl_editor

This commit is contained in:
Marek Roszko 2020-10-31 17:16:48 -04:00
parent 98e07a77ef
commit 6e9ddd9c93
4 changed files with 15 additions and 10 deletions

View File

@ -698,7 +698,8 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas
{ {
FRAME_SCH, FRAME_SCH,
FRAME_PCB_EDITOR, FRAME_FOOTPRINT_EDITOR, FRAME_PCB_EDITOR, FRAME_FOOTPRINT_EDITOR,
FRAME_GERBER FRAME_GERBER,
FRAME_PL_EDITOR
}; };
bool allow_save = false; bool allow_save = false;

View File

@ -161,6 +161,12 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
// Language submenu // Language submenu
AddMenuLanguageList( preferencesMenu, selTool ); AddMenuLanguageList( preferencesMenu, selTool );
#ifndef __WXMAC__
preferencesMenu->AppendSeparator();
preferencesMenu->Add( ACTIONS::acceleratedGraphics, ACTION_MENU::CHECK );
preferencesMenu->Add( ACTIONS::standardGraphics, ACTION_MENU::CHECK );
#endif
//-- Menubar ----------------------------------------------------------- //-- Menubar -----------------------------------------------------------
// //
menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( fileMenu, _( "&File" ) );

View File

@ -139,11 +139,6 @@ bool PL_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
{ {
bool rv = EDA_DRAW_PANEL_GAL::SwitchBackend( aGalType ); bool rv = EDA_DRAW_PANEL_GAL::SwitchBackend( aGalType );
// The next onPaint event will call m_view->UpdateItems() that is very time consumming
// after switching to opengl. Clearing m_view and rebuild it is much faster
if( aGalType == GAL_TYPE_OPENGL )
m_view->Clear();
setDefaultLayerDeps(); setDefaultLayerDeps();
GetGAL()->SetWorldUnitLength( 1.0/IU_PER_MM /* 10 nm */ / 25.4 /* 1 inch in mm */ ); GetGAL()->SetWorldUnitLength( 1.0/IU_PER_MM /* 10 nm */ / 25.4 /* 1 inch in mm */ );

View File

@ -101,10 +101,8 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SetIcon( icon ); SetIcon( icon );
// Create GAL canvas // Create GAL canvas
m_canvasType = EDA_DRAW_PANEL_GAL::GAL_FALLBACK;
auto* drawPanel = new PL_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize, auto* drawPanel = new PL_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
GetGalDisplayOptions(), m_canvasType ); GetGalDisplayOptions(), EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
SetCanvas( drawPanel ); SetCanvas( drawPanel );
LoadSettings( config() ); LoadSettings( config() );
@ -173,7 +171,6 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
ActivateGalCanvas();
// Call Update() to fix all pane default sizes, especially the "InfoBar" pane before // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
// hidding it. // hidding it.
@ -183,6 +180,9 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.GetPane( "InfoBar" ).Hide(); m_auimgr.GetPane( "InfoBar" ).Hide();
m_auimgr.Update(); m_auimgr.Update();
ResolveCanvasType();
SwitchCanvas( m_canvasType );
// Add the exit key handler // Add the exit key handler
InitExitKey(); InitExitKey();
setupUnits( config() ); setupUnits( config() );
@ -263,6 +263,9 @@ void PL_EDITOR_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) ); mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) ); mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
mgr->SetConditions( ACTIONS::acceleratedGraphics, CHECK( cond.CanvasType( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) ) );
mgr->SetConditions( ACTIONS::standardGraphics, CHECK( cond.CanvasType( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ) ) );
mgr->SetConditions( ACTIONS::cut, ENABLE( SELECTION_CONDITIONS::NotEmpty ) ); mgr->SetConditions( ACTIONS::cut, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
mgr->SetConditions( ACTIONS::copy, ENABLE( SELECTION_CONDITIONS::NotEmpty ) ); mgr->SetConditions( ACTIONS::copy, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
mgr->SetConditions( ACTIONS::paste, ENABLE( SELECTION_CONDITIONS::Idle ) ); mgr->SetConditions( ACTIONS::paste, ENABLE( SELECTION_CONDITIONS::Idle ) );