void input_context::display_help() { // Shamelessly stolen from help.cpp WINDOW *w_help = newwin(FULL_SCREEN_HEIGHT - 2, FULL_SCREEN_WIDTH - 2, 1 + (int)((TERMY > FULL_SCREEN_HEIGHT) ? (TERMY - FULL_SCREEN_HEIGHT) / 2 : 0), 1 + (int)((TERMX > FULL_SCREEN_WIDTH) ? (TERMX - FULL_SCREEN_WIDTH) / 2 : 0)); werase(w_help); // Draw win header and borders draw_border(w_help, c_white); mvwprintz(w_help, 0, (FULL_SCREEN_WIDTH - utf8_width(_("Keybindings"))) / 2 - 1, c_ltred, " %s ", _("Keybindings")); mvwprintz(w_help, 1, 51, c_ltred, _("Unbound keys")); mvwprintz(w_help, 2, 51, c_ltgreen, _("Keybinding active only")); mvwprintz(w_help, 3, 51, c_ltgreen, _("on this screen")); mvwprintz(w_help, 4, 51, c_ltgray, _("Keybinding active globally")); // Clear the lines. Don't touch borders for (int i = 1; i < FULL_SCREEN_HEIGHT - 3; i++) { mvwprintz(w_help, i, 1, c_black, " "); } for (int i = 0; i < registered_actions.size(); i++) { const std::string &action_id = registered_actions[i]; if(action_id == "ANY_INPUT") { continue; } bool overwrite_default; const std::vector<input_event> &input_events = inp_mngr.get_input_for_action(action_id, category, &overwrite_default); nc_color col = input_events.size() ? c_white : c_ltred; mvwprintz(w_help, i, 3, col, "%s: ", inp_mngr.get_action_name(action_id).c_str()); if (!input_events.size()) { mvwprintz(w_help, i, 30, c_ltred, _("Unbound!")); } else { // The color depends on whether this input draws from context-local or from // default settings. Default will be ltgray, overwrite will be ltgreen. col = overwrite_default ? c_ltgreen : c_ltgray; mvwprintz(w_help, i, 30, col, "%s", get_desc(action_id).c_str()); } } wrefresh(w_help); refresh(); long ch = getch(); while (ch != 'q' && ch != 'Q' && ch != KEY_ESCAPE) { ch = getch(); }; werase(w_help); wrefresh(w_help); delwin(w_help); }