Skip to content

Commit

Permalink
Support for submenues which are associated with a hotkey action.
Browse files Browse the repository at this point in the history
  • Loading branch information
fendrin committed Jun 9, 2014
1 parent efec080 commit 11a7b22
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/hotkey/command_executor.cpp
Expand Up @@ -419,21 +419,26 @@ std::vector<std::string> command_executor::get_menu_images(display& disp, const
str << IMAGE_PREFIX << img << COLUMN_SEPARATOR;
}

const theme::menu* menu = disp.get_theme().get_menu_item(item);
if (hk == hotkey::HOTKEY_NULL) {
const theme::menu* menu = disp.get_theme().get_menu_item(item);
if (menu)
str << menu->title();
else
str << item.substr(0, item.find_last_not_of(' ') + 1) << COLUMN_SEPARATOR;
} else {
std::string desc = hotkey::get_description(item);
if (hk == HOTKEY_ENDTURN) {
const theme::action *b = disp.get_theme().get_action_item("button-endturn");
if (b) {
desc = b->title();

if (menu)
str << menu->title();
else {
std::string desc = hotkey::get_description(item);
if (hk == HOTKEY_ENDTURN) {
const theme::action *b = disp.get_theme().get_action_item("button-endturn");
if (b) {
desc = b->title();
}
}
str << desc << COLUMN_SEPARATOR << hotkey::get_names(item);
}
str << desc << COLUMN_SEPARATOR << hotkey::get_names(item);
}

result.push_back(str.str());
Expand Down

0 comments on commit 11a7b22

Please sign in to comment.