| 66 | } |
| 67 | |
| 68 | static void add_binding_if_valid(color_ostream &out, const string &sym, const string &cmdline, df::viewscreen *screen, bool filtermenu) { |
| 69 | if (!can_invoke(cmdline, screen)) |
| 70 | return; |
| 71 | |
| 72 | if (filtermenu && (cmdline.starts_with(INVOKE_MENU_PREFIX) || |
| 73 | cmdline == INVOKE_HOTKEYS_COMMAND)) { |
| 74 | DEBUG(log).print("filtering out hotkey menu keybinding\n"); |
| 75 | return; |
| 76 | } |
| 77 | |
| 78 | if (should_hide_armok(out, cmdline)) { |
| 79 | DEBUG(log).print("filtering out armok keybinding\n"); |
| 80 | return; |
| 81 | } |
| 82 | |
| 83 | current_bindings[sym] = cmdline; |
| 84 | sorted_keys.push_back(sym); |
| 85 | string keyspec = sym + "@" + MENU_SCREEN_FOCUS_STRING; |
| 86 | string binding = "hotkeys invoke " + int_to_string(sorted_keys.size() - 1); |
| 87 | DEBUG(log).print("adding keybinding: {} -> {}\n", keyspec, binding); |
| 88 | Core::getInstance().getHotkeyManager()->addKeybind(keyspec, binding); |
| 89 | } |
| 90 | |
| 91 | static void find_active_keybindings(color_ostream &out, df::viewscreen *screen, bool filtermenu) { |
| 92 | if (valid) |
no test coverage detected