Add playing-prefix

REBASE-ME!

Add parser entry for "not_playing_prefix"

squash
wilder
Jacopo De Simoi 7 years ago committed by Jacopo De Simoi
parent e8f1c4bd48
commit cb3e1f6791
  1. 17
      src/display.cpp
  2. 10
      src/settings.cpp
  3. 4
      src/settings.h
  4. 6
      src/title.cpp

@ -112,6 +112,8 @@ void setProperties(NC::Menu<T> &menu, const MPD::Song &s, const SongList &list,
&& song_pos == Status::State::currentSongPosition();
if (is_now_playing)
menu << Config.now_playing_prefix;
else
menu << Config.not_playing_prefix;
is_in_playlist = !myPlaylist->isActiveWindow(menu)
&& myPlaylist->checkForSong(s);
@ -131,6 +133,8 @@ void unsetProperties(NC::Menu<T> &menu, bool separate_albums, bool is_now_playin
if (is_now_playing)
menu << Config.now_playing_suffix;
else
menu << Config.not_playing_suffix;
if (separate_albums)
menu << NC::Format::NoUnderline;
@ -160,6 +164,8 @@ void showSongs(NC::Menu<T> &menu, const MPD::Song &s, const SongList &list, cons
}
if (is_now_playing)
x_off -= Config.now_playing_suffix_length;
else
x_off -= Config.not_playing_suffix_length;
if (is_selected)
x_off -= Config.selected_item_suffix_length;
menu << NC::TermManip::ClearToEOL << NC::XY(x_off, y) << right_aligned;
@ -193,9 +199,14 @@ void showSongsInColumns(NC::Menu<T> &menu, const MPD::Song &s, const SongList &l
}
if (is_now_playing)
{
menu_width -= Config.now_playing_prefix_length;
menu_width -= Config.now_playing_suffix_length;
// menu_width -= Config.now_playing_prefix_length;
//menu_width -= Config.now_playing_suffix_length;
} else
{
//menu_width -= Config.not_playing_prefix_length;
//menu_width -= Config.not_playing_suffix_length;
}
if (is_selected)
{
menu_width -= Config.selected_item_prefix_length;
@ -277,6 +288,8 @@ std::string Display::Columns(size_t list_width)
if (Config.columns.empty())
return result;
result += Config.not_playing_prefix.str();
int width;
int remained_width = list_width;
std::vector<Column>::const_iterator it, last = Config.columns.end() - 1;

@ -356,6 +356,16 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
nullptr,
std::ref(now_playing_suffix_length),
ph::_1));
p.add("not_playing_prefix", &not_playing_prefix, "",
std::bind(buffer_wlength,
nullptr,
std::ref(not_playing_prefix_length),
ph::_1));
p.add("not_playing_suffix", &not_playing_suffix, "",
std::bind(buffer_wlength,
nullptr,
std::ref(not_playing_suffix_length),
ph::_1));
p.add("browser_playlist_prefix", &browser_playlist_prefix, "$2playlist$9 ", buffer);
p.add("selected_item_prefix", &selected_item_prefix, "$6",
std::bind(buffer_wlength,

@ -112,6 +112,8 @@ struct Configuration
NC::Buffer selected_item_suffix;
NC::Buffer now_playing_prefix;
NC::Buffer now_playing_suffix;
NC::Buffer not_playing_prefix;
NC::Buffer not_playing_suffix;
NC::Buffer modified_item_prefix;
NC::Buffer current_item_prefix;
NC::Buffer current_item_suffix;
@ -212,6 +214,8 @@ struct Configuration
size_t selected_item_suffix_length;
size_t now_playing_prefix_length;
size_t now_playing_suffix_length;
size_t not_playing_prefix_length;
size_t not_playing_suffix_length;
size_t current_item_prefix_length;
size_t current_item_suffix_length;
size_t current_item_inactive_column_prefix_length;

@ -62,9 +62,9 @@ void drawHeader()
mvwhline(wHeader->raw(), 4, 0, 0, COLS);
*wHeader << NC::FormattedColor::End<>(Config.alternative_ui_separator_color)
<< NC::XY((COLS-wideLength(title))/2, 3)
<< NC::Format::Bold
<< title
<< NC::Format::NoBold;
// << NC::Format::Bold
<< title;
// << NC::Format::NoBold;
break;
}
wHeader->refresh();

Loading…
Cancel
Save