diff --git a/src/clock.cpp b/src/clock.cpp index 38f4477a..590ae34f 100644 --- a/src/clock.cpp +++ b/src/clock.cpp @@ -24,6 +24,8 @@ #ifdef ENABLE_CLOCK +#include + #include "global.h" #include "playlist.h" #include "settings.h" @@ -42,12 +44,14 @@ short Clock::disp[11] = long Clock::older[6], Clock::next[6], Clock::newer[6], Clock::mask; -const size_t Clock::Width = Config.clock_display_seconds ? 60 : 40; +size_t Clock::Width; const size_t Clock::Height = 8; void Clock::Init() { - w = new Scrollpad((COLS-Width)/2, (LINES-Height)/2, Width, Height-1, "", Config.main_color, Border(Config.main_color)); + Width = Config.clock_display_seconds ? 60 : 40; + + w = new Window((COLS-Width)/2, (LINES-Height)/2, Width, Height-1, "", Config.main_color, Border(Config.main_color)); w->SetTimeout(ncmpcpp_window_timeout); } @@ -111,7 +115,7 @@ void Clock::Update() Set(10, 7); Set(10, 17); - char buf[54]; + char buf[64]; strftime(buf, 64, "%x", time); attron(COLOR_PAIR(Config.main_color)); mvprintw(w->GetStartY()+w->GetHeight(), w->GetStartX()+(w->GetWidth()-strlen(buf))/2, "%s", buf); diff --git a/src/clock.h b/src/clock.h index b2fec4af..95ecb9c1 100644 --- a/src/clock.h +++ b/src/clock.h @@ -53,7 +53,7 @@ class Clock : public Screen static short disp[11]; static long older[6], next[6], newer[6], mask; - static const size_t Width; + static size_t Width; static const size_t Height; }; diff --git a/src/ncmpcpp.h b/src/ncmpcpp.h index 21dcfb15..a00a4e49 100644 --- a/src/ncmpcpp.h +++ b/src/ncmpcpp.h @@ -21,6 +21,8 @@ #ifndef _NCMPCPP_H #define _NCMPCPP_H +#include + #include "window.h" #include "menu.h" #include "scrollpad.h" diff --git a/src/strbuffer.h b/src/strbuffer.h index efe22341..7f11ab0f 100644 --- a/src/strbuffer.h +++ b/src/strbuffer.h @@ -155,7 +155,7 @@ template Window &operator<<(Window &w, const basic_buffer &buf) w << tmp; tmp.clear(); } - if (b->Value < 100) + if (b->Value < fmtNone) w << Color(b->Value); else w << Format(b->Value); diff --git a/src/window.cpp b/src/window.cpp index 37739ae5..19297e8c 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -18,6 +18,9 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include +#include + #include "window.h" using std::string; diff --git a/src/window.h b/src/window.h index 7559d041..67c85f70 100644 --- a/src/window.h +++ b/src/window.h @@ -30,19 +30,13 @@ #include #include #include -#include -#include #ifdef _UTF8 # define my_char_t wchar_t -# define my_string_t wstring -# define UTF_S_FMT "%ls" # define TO_STRING(x) ToString(x) # define TO_WSTRING(x) ToWString(x) #else # define my_char_t char -# define my_string_t string -# define UTF_S_FMT "%s" # define TO_STRING(x) x # define TO_WSTRING(x) x #endif