Replace highlight colors with prefixes and suffixes

This commit is contained in:
Andrzej Rybczak
2017-03-28 11:31:09 +02:00
parent 8134e6e23b
commit 19d32648ed
32 changed files with 364 additions and 155 deletions

View File

@@ -143,6 +143,13 @@ void showSongs(NC::Menu<T> &menu, const MPD::Song &s, const SongList &list, cons
if (!right_aligned.str().empty())
{
size_t x_off = menu.getWidth() - wideLength(ToWString(right_aligned.str()));
if (menu.isHighlighted() && list.currentS()->song() == &s)
{
if (menu.highlightSuffix() == Config.current_item_suffix)
x_off -= Config.current_item_suffix_length;
else
x_off -= Config.current_item_inactive_column_suffix_length;
}
if (is_now_playing)
x_off -= Config.now_playing_suffix_length;
if (is_selected)
@@ -164,6 +171,18 @@ void showSongsInColumns(NC::Menu<T> &menu, const MPD::Song &s, const SongList &l
is_in_playlist, discard_colors);
int menu_width = menu.getWidth();
if (menu.isHighlighted() && list.currentS()->song() == &s)
{
if (menu.highlightPrefix() == Config.current_item_prefix)
menu_width -= Config.current_item_prefix_length;
else
menu_width -= Config.current_item_inactive_column_prefix_length;
if (menu.highlightSuffix() == Config.current_item_suffix)
menu_width -= Config.current_item_suffix_length;
else
menu_width -= Config.current_item_inactive_column_suffix_length;
}
if (is_now_playing)
{
menu_width -= Config.now_playing_prefix_length;
@@ -343,7 +362,7 @@ void Display::Tags(NC::Menu<MPD::MutableSong> &menu)
menu << Charset::utf8ToLocale(s.getName())
<< Config.color2
<< " -> "
<< NC::FormattedColor::End(Config.color2)
<< NC::FormattedColor::End<>(Config.color2)
<< Charset::utf8ToLocale(s.getNewName());
}
}