From 9d3aca56bbd6e0214b610e78177098144a9e928f Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Mon, 5 Oct 2020 20:22:57 +0100 Subject: [PATCH] Add unit submenu to page layout editor view menu --- pagelayout_editor/menubar.cpp | 10 ++++++++++ pagelayout_editor/pl_editor_frame.cpp | 3 +++ 2 files changed, 13 insertions(+) diff --git a/pagelayout_editor/menubar.cpp b/pagelayout_editor/menubar.cpp index 3fcb028c8b..a20fe3027c 100644 --- a/pagelayout_editor/menubar.cpp +++ b/pagelayout_editor/menubar.cpp @@ -110,6 +110,16 @@ void PL_EDITOR_FRAME::ReCreateMenuBar() viewMenu->AppendSeparator(); viewMenu->Add( ACTIONS::toggleGrid, ACTION_MENU::CHECK ); + + // Units submenu + ACTION_MENU* unitsSubMenu = new ACTION_MENU( false, selTool ); + unitsSubMenu->SetTitle( _( "&Units" ) ); + unitsSubMenu->SetIcon( unit_mm_xpm ); + unitsSubMenu->Add( ACTIONS::inchesUnits, ACTION_MENU::CHECK ); + unitsSubMenu->Add( ACTIONS::milsUnits, ACTION_MENU::CHECK ); + unitsSubMenu->Add( ACTIONS::millimetersUnits, ACTION_MENU::CHECK ); + viewMenu->Add( unitsSubMenu ); + viewMenu->Add( ACTIONS::toggleCursorStyle, ACTION_MENU::CHECK ); viewMenu->AppendSeparator(); diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index 7971fc11d1..85c3d1aafb 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -253,6 +253,9 @@ void PL_EDITOR_FRAME::setupUIConditions() mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) ); mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) ); + mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) ); + mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) ); + mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) ); mgr->SetConditions( ACTIONS::cut, ENABLE( SELECTION_CONDITIONS::NotEmpty ) ); mgr->SetConditions( ACTIONS::copy, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );