Viewlib: fix minor issues.

This commit is contained in:
jean-pierre charras 2019-05-24 12:54:11 +02:00
parent e3815381ab
commit 4ae5a006d0
2 changed files with 10 additions and 5 deletions

View File

@ -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" ) );

View File

@ -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;