Switch canvas to Cairo if OpenGL is not supported on the first run

This commit is contained in:
Maciej Suminski 2018-06-04 11:49:53 +02:00
parent 6bd708621b
commit e4a6f2e523
2 changed files with 18 additions and 8 deletions

View File

@ -228,15 +228,20 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
// Switch to OpenGL, which will save the new setting if successful
wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_OPENGL );
auto handler = GetEventHandler();
handler->ProcessEvent( evt );
GetEventHandler()->ProcessEvent( evt );
// Switch back to Cairo if OpenGL is not supported
if( GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
{
wxCommandEvent cairoEvt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
GetEventHandler()->ProcessEvent( cairoEvt );
}
}
else if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
{
// If they were on legacy, switch them to Cairo
wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
auto handler = GetEventHandler();
handler->ProcessEvent( evt );
GetEventHandler()->ProcessEvent( evt );
}
}

View File

@ -484,15 +484,20 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// Switch to OpenGL, which will save the new setting if successful
wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_OPENGL );
auto handler = GetEventHandler();
handler->ProcessEvent( evt );
GetEventHandler()->ProcessEvent( evt );
// Switch back to Cairo if OpenGL is not supported
if( GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
{
wxCommandEvent cairoEvt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
GetEventHandler()->ProcessEvent( cairoEvt );
}
}
else if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
{
// If they were on legacy, switch them to Cairo
wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
auto handler = GetEventHandler();
handler->ProcessEvent( evt );
GetEventHandler()->ProcessEvent( evt );
}
}