Apply custom hidden flags also to menu items created from macros.

This commit is contained in:
Matthias Koefferlein 2017-10-31 09:38:29 +01:00
parent 52e893ae17
commit 3c3c3a0b87
2 changed files with 11 additions and 0 deletions

View File

@ -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<std::pair<std::string, bool> >::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

View File

@ -247,6 +247,7 @@ private:
tl::DeferredMethod<MacroController> dm_sync_file_watcher;
tl::DeferredMethod<MacroController> dm_sync_files;
std::vector<std::pair<std::string, std::string> > m_key_bindings;
std::vector<std::pair<std::string, bool> > m_menu_items_hidden;
void sync_implicit_macros (bool ask_before_autorun);
void add_macro_items_to_menu (lym::MacroCollection &collection, std::set<std::string> &used_names, std::set<std::string> &groups, const lay::Technology *tech);