From 3c3c3a0b872c3e0f6a6f0cfce65d4796a88009ca Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 31 Oct 2017 09:38:29 +0100 Subject: [PATCH] Apply custom hidden flags also to menu items created from macros. --- src/lay/lay/layMacroController.cc | 10 ++++++++++ src/lay/lay/layMacroController.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/lay/lay/layMacroController.cc b/src/lay/lay/layMacroController.cc index b708fc15c..f4b083a06 100644 --- a/src/lay/lay/layMacroController.cc +++ b/src/lay/lay/layMacroController.cc @@ -204,6 +204,8 @@ MacroController::configure (const std::string &key, const std::string &value) { if (key == cfg_key_bindings) { m_key_bindings = unpack_key_binding (value); + } else if (key == cfg_menu_items_hidden) { + m_menu_items_hidden = unpack_menu_items_hidden (value); } return false; } @@ -774,6 +776,14 @@ MacroController::do_update_menu_with_macros () a.set_shortcut (kb->second); } } + + // apply the custom hidden flags + for (std::vector >::const_iterator hf = m_menu_items_hidden.begin (); hf != m_menu_items_hidden.end (); ++hf) { + if (mp_mw->menu ()->is_valid (hf->first)) { + lay::Action a = mp_mw->menu ()->action (hf->first); + a.set_hidden (hf->second); + } + } } void diff --git a/src/lay/lay/layMacroController.h b/src/lay/lay/layMacroController.h index 29f8f70f0..cd6716f38 100644 --- a/src/lay/lay/layMacroController.h +++ b/src/lay/lay/layMacroController.h @@ -247,6 +247,7 @@ private: tl::DeferredMethod dm_sync_file_watcher; tl::DeferredMethod dm_sync_files; std::vector > m_key_bindings; + std::vector > m_menu_items_hidden; void sync_implicit_macros (bool ask_before_autorun); void add_macro_items_to_menu (lym::MacroCollection &collection, std::set &used_names, std::set &groups, const lay::Technology *tech);