From ec39bdda77ef04bbc9d85729bbf6ed992c06a16f Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 19 May 2019 14:25:01 -0400 Subject: [PATCH] GerbView: fix saving of canvas type and lingering legacy menu item Fixes: lp:1829647 * https://bugs.launchpad.net/kicad/+bug/1829647 (cherry picked from commit b00e20b23f41fc3393d4ef9c96407f61f9f83fac) --- common/legacy_wx/eda_draw_frame.cpp | 6 +++--- gerbview/events_called_functions.cpp | 8 ++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/common/legacy_wx/eda_draw_frame.cpp b/common/legacy_wx/eda_draw_frame.cpp index 88982aa73c..1bf083848d 100644 --- a/common/legacy_wx/eda_draw_frame.cpp +++ b/common/legacy_wx/eda_draw_frame.cpp @@ -1255,14 +1255,14 @@ bool EDA_DRAW_FRAME::saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas // a parent frame) FRAME_T allowed_frames[] = { - FRAME_SCH, FRAME_PCB, FRAME_PCB_MODULE_EDITOR + FRAME_SCH, FRAME_PCB, FRAME_PCB_MODULE_EDITOR, FRAME_GERBER }; bool allow_save = false; - for( int ii = 0; ii < 3; ii++ ) + for( FRAME_T frame : allowed_frames ) { - if( m_Ident == allowed_frames[ii] ) + if( m_Ident == frame ) { allow_save = true; break; diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp index 8dcc1598eb..b1790abf7e 100644 --- a/gerbview/events_called_functions.cpp +++ b/gerbview/events_called_functions.cpp @@ -435,19 +435,15 @@ void GERBVIEW_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent ) { wxMenuBar* menuBar = GetMenuBar(); EDA_DRAW_PANEL_GAL* gal_canvas = GetGalCanvas(); - EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE; - - if( IsGalCanvasActive() && gal_canvas ) - canvasType = gal_canvas->GetBackend(); + EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = gal_canvas->GetBackend(); struct { int menuId; int galType; } menuList[] = { - { ID_MENU_CANVAS_LEGACY, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE }, { ID_MENU_CANVAS_OPENGL, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL }, { ID_MENU_CANVAS_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO }, }; - for( auto ii: menuList ) + for( auto ii : menuList ) { wxMenuItem* item = menuBar->FindItem( ii.menuId );