settings: make progressbar_look support 'empty' part of progressbar

This commit is contained in:
Andrzej Rybczak
2010-08-22 16:36:47 +02:00
parent d879a60965
commit a66ab40c25
4 changed files with 18 additions and 11 deletions

View File

@@ -257,6 +257,10 @@
# #
#centered_cursor = "no" #centered_cursor = "no"
# #
##
## Note: You can specify third character which will
## be used to build 'empty' part of progressbar.
##
#progressbar_look = "=>" #progressbar_look = "=>"
# #
#default_place_to_search_in = "database" (database/playlist) #default_place_to_search_in = "database" (database/playlist)

View File

@@ -202,7 +202,7 @@ Default state for autocenter mode at start.
If enabled, currently highlighted position in the list will be always centered. If enabled, currently highlighted position in the list will be always centered.
.TP .TP
.B progressbar_look = TEXT .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 .TP
.B default_find_mode = wrapped/normal .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. 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.

View File

@@ -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_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}}"; new_header_second_line = "{{{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D}}";
browser_playlist_prefix << clRed << "(playlist)" << clEnd << ' '; browser_playlist_prefix << clRed << "(playlist)" << clEnd << ' ';
progressbar = U("=>"); progressbar = U("=>\0");
pattern = "%n - %t"; pattern = "%n - %t";
selected_item_prefix << clMagenta; selected_item_prefix << clMagenta;
selected_item_suffix << clEnd; selected_item_suffix << clEnd;
@@ -793,9 +793,16 @@ void NcmpcppConfig::Read()
} }
else if (cl.find("progressbar_look") != std::string::npos) else if (cl.find("progressbar_look") != std::string::npos)
{ {
progressbar = TO_WSTRING(v); std::basic_string<my_char_t> pb = TO_WSTRING(v);
if (progressbar.length() != 2) if (pb.length() < 2 || pb.length() > 3)
FatalError("the length of progressbar_look is not two characters long!"); {
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) else if (cl.find("default_tag_editor_pattern") != std::string::npos)
{ {

View File

@@ -357,11 +357,7 @@ void NcmpcppStatusChanged(MPD::Connection *, MPD::StatusChanges changed, void *)
{ {
WindowTitle("ncmpc++ ver. "VERSION); WindowTitle("ncmpc++ ver. "VERSION);
if (!block_progressbar_update) if (!block_progressbar_update)
{ DrawProgressbar(0, 0);
*wFooter << Config.progressbar_color;
mvwhline(wFooter->Raw(), 0, 0, 0, wFooter->GetWidth());
*wFooter << clEnd;
}
Playlist::ReloadRemaining = 1; Playlist::ReloadRemaining = 1;
myPlaylist->NowPlaying = -1; myPlaylist->NowPlaying = -1;
if (Config.new_design) if (Config.new_design)
@@ -659,7 +655,7 @@ void DrawProgressbar(unsigned elapsed, unsigned time)
{ {
unsigned howlong = time ? wFooter->GetWidth()*elapsed/time : 0; unsigned howlong = time ? wFooter->GetWidth()*elapsed/time : 0;
*wFooter << fmtBold << Config.progressbar_color; *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) if (time)
{ {
unsigned pb_width = std::min(size_t(howlong), wFooter->GetWidth()); unsigned pb_width = std::min(size_t(howlong), wFooter->GetWidth());