Skip to content

Commit

Permalink
Merge pull request #37981 from Kilvoctu/ui-hotkeys-fix
Browse files Browse the repository at this point in the history
Fix ui hotkey help not updating
  • Loading branch information
ZhilkinSerg committed Feb 13, 2020
2 parents b7831d2 + b1fb4d4 commit 3201703
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
12 changes: 8 additions & 4 deletions src/advanced_inv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,8 @@ void advanced_inventory::recalc_pane( side p )

void advanced_inventory::redraw_pane( side p )
{
input_context ctxt( "ADVANCED_INVENTORY" );

// don't update ui if processing demands
if( is_processing() ) {
return;
Expand Down Expand Up @@ -721,7 +723,8 @@ void advanced_inventory::redraw_pane( side p )
}
// draw a darker border around the inactive pane
draw_border( w, active ? BORDER_COLOR : c_dark_gray );
mvwprintw( w, point( 3, 0 ), _( "< [s]ort: %s >" ), get_sortname( pane.sortby ) );
mvwprintw( w, point( 3, 0 ), _( "< [%s] Sort: %s >" ), ctxt.get_desc( "SORT" ),
get_sortname( pane.sortby ) );
int max = square.max_size;
if( max > 0 ) {
int itemcount = square.get_item_count();
Expand All @@ -730,8 +733,8 @@ void advanced_inventory::redraw_pane( side p )
mvwprintw( w, point( w_width / 2 - fmtw, 0 ), "< %d/%d >", itemcount, max );
}

const char *fprefix = _( "[F]ilter" );
const char *fsuffix = _( "[R]eset" );
std::string fprefix = string_format( _( "[%s] Filter" ), ctxt.get_desc( "FILTER" ) );
std::string fsuffix = string_format( _( "[%s] Reset" ), ctxt.get_desc( "RESET_FILTER" ) );
if( !filter_edit ) {
if( !pane.filter.empty() ) {
mvwprintw( w, point( 2, getmaxy( w ) - 1 ), "< %s: %s >", fprefix, pane.filter );
Expand Down Expand Up @@ -1099,7 +1102,8 @@ void advanced_inventory::display()
draw_border( head );
Messages::display_messages( head, 2, 1, w_width - 1, head_height - 2 );
draw_minimap();
const std::string msg = _( "< [?] show help >" );
const std::string msg = string_format( _( "< [%s] Show help >" ),
ctxt.get_desc( "HELP_KEYBINDINGS" ) );
mvwprintz( head, point( w_width - ( minimap_width + 2 ) - utf8_width( msg ) - 1, 0 ),
c_white, msg );
if( g->u.has_watch() ) {
Expand Down
18 changes: 13 additions & 5 deletions src/bionics_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ char get_free_invlet( player &p )
static void draw_bionics_titlebar( const catacurses::window &window, player *p,
bionic_menu_mode mode )
{
input_context ctxt( "BIONICS" );

werase( window );
std::string fuel_string;
bool found_fuel = false;
Expand Down Expand Up @@ -130,18 +132,24 @@ static void draw_bionics_titlebar( const catacurses::window &window, player *p,
mvwputch( window, point( pwr_str_pos - 1, 0 ), BORDER_COLOR, LINE_OXXX ); // ^|^
center_print( window, 0, c_light_red, _( " BIONICS " ) );

std::string desc_append = string_format(
_( "[%s] Reassign, [%s] Switch tabs, [%s] Toggle fuel saving mode, [%s] Toggle auto start mode" ),
ctxt.get_desc( "REASSIGN" ), ctxt.get_desc( "NEXT_TAB" ), ctxt.get_desc( "TOGGLE_SAFE_FUEL" ),
ctxt.get_desc( "TOGGLE_AUTO_START" ) );
std::string desc;
if( mode == REASSIGNING ) {
desc = _( "Reassigning.\nSelect a bionic to reassign or press SPACE to cancel." );
fuel_string.clear();
} else if( mode == ACTIVATING ) {
desc = _( "<color_green>Activating</color> <color_yellow>!</color> to examine, <color_yellow>=</color> to reassign, <color_yellow>TAB</color> to switch tabs, <color_yellow>s</color> to toggle fuel saving mode, <color_yellow>A</color> to toggle auto start mode." );
desc = string_format( _( "<color_green>Activating</color> [%s] Examine, %s" ),
ctxt.get_desc( "TOGGLE_EXAMINE" ), desc_append );
} else if( mode == EXAMINING ) {
desc = _( "<color_light_blue>Examining</color> <color_yellow>!</color> to activate, <color_yellow>=</color> to reassign, <color_yellow>TAB</color> to switch tabs, <color_yellow>s</color> to toggle fuel saving mode, <color_yellow>A</color> to toggle auto start mode." );
desc = string_format( _( "<color_light_blue>Examining</color> [%s] Activate, %s" ),
ctxt.get_desc( "TOGGLE_EXAMINE" ), desc_append );
}

// NOLINTNEXTLINE(cata-use-named-point-constants)
int lines_count = fold_and_print( window, point( 1, 1 ), pwr_str_pos - 2, c_white, desc );
int lines_count = fold_and_print( window, point( 1, 1 ), pwr_str_pos - 2, c_light_gray, desc );
fold_and_print( window, point( 1, ++lines_count ), pwr_str_pos - 2, c_white, fuel_string );
wrefresh( window );
}
Expand Down Expand Up @@ -777,8 +785,8 @@ void player::power_bionics()
continue;
} else {
popup( _( "You can not activate %s!\n"
"To read a description of %s, press '!', then '%c'." ), bio_data.name,
bio_data.name, tmp->invlet );
"To read a description of %s, press '%s', then '%c'." ), bio_data.name,
bio_data.name, ctxt.get_desc( "TOGGLE_EXAMINE" ), tmp->invlet );
redraw = true;
}
} else if( menu_mode == EXAMINING ) {
Expand Down
4 changes: 2 additions & 2 deletions src/inventory_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1603,8 +1603,8 @@ void inventory_selector::draw_footer( const catacurses::window &w ) const
{
int filter_offset = 0;
if( has_available_choices() || !filter.empty() ) {
std::string text = string_format( filter.empty() ? _( "[%s]Filter" ) : _( "[%s]Filter: " ),
ctxt.press_x( "INVENTORY_FILTER", "", "", "" ) );
std::string text = string_format( filter.empty() ? _( "[%s] Filter" ) : _( "[%s] Filter: " ),
ctxt.get_desc( "INVENTORY_FILTER" ) );
filter_offset = utf8_width( text + filter ) + 6;

mvwprintz( w, point( 2, getmaxy( w ) - border ), c_light_gray, "< " );
Expand Down
6 changes: 3 additions & 3 deletions src/panels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2342,13 +2342,13 @@ void panel_manager::draw_adm( const catacurses::window &w, size_t column, size_t

col_offset = column_widths[0] + 2;
int col_width = column_widths[1] - 4;
mvwprintz( w, point( col_offset, 1 ), c_light_green, trunc_ellipse( ctxt.press_x( "TOGGLE_PANEL" ),
mvwprintz( w, point( col_offset, 1 ), c_light_green, trunc_ellipse( ctxt.get_desc( "TOGGLE_PANEL" ),
col_width ) + ":" );
mvwprintz( w, point( col_offset, 2 ), c_white, _( "Toggle panels on/off" ) );
mvwprintz( w, point( col_offset, 3 ), c_light_green, trunc_ellipse( ctxt.press_x( "MOVE_PANEL" ),
mvwprintz( w, point( col_offset, 3 ), c_light_green, trunc_ellipse( ctxt.get_desc( "MOVE_PANEL" ),
col_width ) + ":" );
mvwprintz( w, point( col_offset, 4 ), c_white, _( "Change display order" ) );
mvwprintz( w, point( col_offset, 5 ), c_light_green, trunc_ellipse( ctxt.press_x( "QUIT" ),
mvwprintz( w, point( col_offset, 5 ), c_light_green, trunc_ellipse( ctxt.get_desc( "QUIT" ),
col_width ) + ":" );
mvwprintz( w, point( col_offset, 6 ), c_white, _( "Exit" ) );
}
Expand Down

0 comments on commit 3201703

Please sign in to comment.