From 4ae5a006d099efc26e95e25e6b38570cb330eaef Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 24 May 2019 12:54:11 +0200 Subject: [PATCH] Viewlib: fix minor issues. --- eeschema/toolbars_viewlib.cpp | 6 +++++- eeschema/viewlib_frame.cpp | 9 +++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/eeschema/toolbars_viewlib.cpp b/eeschema/toolbars_viewlib.cpp index 5e3afde95d..5a9a30243b 100644 --- a/eeschema/toolbars_viewlib.cpp +++ b/eeschema/toolbars_viewlib.cpp @@ -134,6 +134,10 @@ void LIB_VIEW_FRAME::ReCreateMenuBar() return IsGridVisible(); }; + auto electricalTypesShownCondition = [ this ] ( const SELECTION& aSel ) { + return GetShowElectricalType(); + }; + viewMenu->AddItem( ACTIONS::zoomInCenter, EE_CONDITIONS::ShowAlways ); viewMenu->AddItem( ACTIONS::zoomOutCenter, EE_CONDITIONS::ShowAlways ); viewMenu->AddItem( ACTIONS::zoomFitScreen, EE_CONDITIONS::ShowAlways ); @@ -144,7 +148,7 @@ void LIB_VIEW_FRAME::ReCreateMenuBar() viewMenu->AddItem( ACTIONS::gridProperties, EE_CONDITIONS::ShowAlways ); viewMenu->AddSeparator(); - viewMenu->AddItem( EE_ACTIONS::showElectricalTypes, EE_CONDITIONS::ShowAlways ); + viewMenu->AddCheckItem( EE_ACTIONS::showElectricalTypes, electricalTypesShownCondition ); // Append menus to the menubar menuBar->Append( fileMenu, _( "&File" ) ); diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 47d252fe23..7f7e8fc9bb 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -104,9 +104,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame wxDefaultPosition, wxDefaultSize, aFrameType == FRAME_SCH_VIEWER_MODAL ? LIB_VIEW_STYLE_MODAL : LIB_VIEW_STYLE, aFrameType == FRAME_SCH_VIEWER_MODAL ? LIB_VIEW_NAME_MODAL : LIB_VIEW_NAME ), - m_libList( nullptr ), - m_cmpList( nullptr ), - m_previewItem( nullptr ) + m_libList( nullptr ), m_cmpList( nullptr ), m_previewItem( nullptr ) { wxASSERT( aFrameType == FRAME_SCH_VIEWER || aFrameType == FRAME_SCH_VIEWER_MODAL ); @@ -127,7 +125,6 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame m_libListWidth = 200; m_cmpListWidth = 300; m_listPowerCmpOnly = false; - SetShowElectricalType( true ); // Initialize grid id to the default value (50 mils): m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; @@ -136,6 +133,10 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame GetScreen()->m_Center = true; // Axis origin centered on screen. LoadSettings( config() ); + // Synchronize some draw options + SetShowElectricalType( true ); + GetRenderSettings()->m_ShowPinsElectricalType = GetShowElectricalType(); + // Ensure axis are always drawn (initial default display was not drawn) KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions(); gal_opts.m_axesEnabled = true;