From a66ab40c2545c7d0e6ff1fcfce49a5d6403d8f18 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 22 Aug 2010 16:36:47 +0200 Subject: [PATCH] settings: make progressbar_look support 'empty' part of progressbar --- doc/config | 4 ++++ doc/ncmpcpp.1 | 2 +- src/settings.cpp | 15 +++++++++++---- src/status.cpp | 8 ++------ 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/doc/config b/doc/config index 7922f1f6..4925957b 100644 --- a/doc/config +++ b/doc/config @@ -257,6 +257,10 @@ # #centered_cursor = "no" # +## +## Note: You can specify third character which will +## be used to build 'empty' part of progressbar. +## #progressbar_look = "=>" # #default_place_to_search_in = "database" (database/playlist) diff --git a/doc/ncmpcpp.1 b/doc/ncmpcpp.1 index 7fe42739..852c0354 100644 --- a/doc/ncmpcpp.1 +++ b/doc/ncmpcpp.1 @@ -202,7 +202,7 @@ Default state for autocenter mode at start. If enabled, currently highlighted position in the list will be always centered. .TP .B progressbar_look = TEXT -This variable defines the look of progressbar. Note that it has to be exactly two characters long. +This variable defines the look of progressbar. Note that it has to be exactly two or three characters long. .TP .B default_find_mode = wrapped/normal If set to "wrapped", going from last found position to next will take you to the first one (same goes for the first position and going to previous one), otherwise no actions will be performed. diff --git a/src/settings.cpp b/src/settings.cpp index 33c142ba..439e06e4 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -343,7 +343,7 @@ void NcmpcppConfig::SetDefaults() new_header_first_line = "{$b$1$aqqu$/a$9 {%t}|{%f} $1$atqq$/a$9$/b}"; new_header_second_line = "{{{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D}}"; browser_playlist_prefix << clRed << "(playlist)" << clEnd << ' '; - progressbar = U("=>"); + progressbar = U("=>\0"); pattern = "%n - %t"; selected_item_prefix << clMagenta; selected_item_suffix << clEnd; @@ -793,9 +793,16 @@ void NcmpcppConfig::Read() } else if (cl.find("progressbar_look") != std::string::npos) { - progressbar = TO_WSTRING(v); - if (progressbar.length() != 2) - FatalError("the length of progressbar_look is not two characters long!"); + std::basic_string pb = TO_WSTRING(v); + if (pb.length() < 2 || pb.length() > 3) + { + std::cerr << "Warning: length of progressbar_look should be either "; + std::cerr << "2 or 3, but it's " << pb.length() << ", discarding.\n"; + } + else + progressbar = pb; + // if two characters were specified, add third one as null + progressbar.resize(3); } else if (cl.find("default_tag_editor_pattern") != std::string::npos) { diff --git a/src/status.cpp b/src/status.cpp index 79541904..6edd73fb 100644 --- a/src/status.cpp +++ b/src/status.cpp @@ -357,11 +357,7 @@ void NcmpcppStatusChanged(MPD::Connection *, MPD::StatusChanges changed, void *) { WindowTitle("ncmpc++ ver. "VERSION); if (!block_progressbar_update) - { - *wFooter << Config.progressbar_color; - mvwhline(wFooter->Raw(), 0, 0, 0, wFooter->GetWidth()); - *wFooter << clEnd; - } + DrawProgressbar(0, 0); Playlist::ReloadRemaining = 1; myPlaylist->NowPlaying = -1; if (Config.new_design) @@ -659,7 +655,7 @@ void DrawProgressbar(unsigned elapsed, unsigned time) { unsigned howlong = time ? wFooter->GetWidth()*elapsed/time : 0; *wFooter << fmtBold << Config.progressbar_color; - mvwhline(wFooter->Raw(), 0, 0, 0, wFooter->GetWidth()); + mvwhline(wFooter->Raw(), 0, 0, Config.progressbar[2], wFooter->GetWidth()); if (time) { unsigned pb_width = std::min(size_t(howlong), wFooter->GetWidth());