unused defines cleaning / a few fixes for clock

This commit is contained in:
Andrzej Rybczak
2009-02-19 00:59:02 +01:00
parent 7246b57d48
commit 164dec3eed
6 changed files with 14 additions and 11 deletions

View File

@@ -24,6 +24,8 @@
#ifdef ENABLE_CLOCK #ifdef ENABLE_CLOCK
#include <cstring>
#include "global.h" #include "global.h"
#include "playlist.h" #include "playlist.h"
#include "settings.h" #include "settings.h"
@@ -42,12 +44,14 @@ short Clock::disp[11] =
long Clock::older[6], Clock::next[6], Clock::newer[6], Clock::mask; 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; const size_t Clock::Height = 8;
void Clock::Init() 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); w->SetTimeout(ncmpcpp_window_timeout);
} }
@@ -111,7 +115,7 @@ void Clock::Update()
Set(10, 7); Set(10, 7);
Set(10, 17); Set(10, 17);
char buf[54]; char buf[64];
strftime(buf, 64, "%x", time); strftime(buf, 64, "%x", time);
attron(COLOR_PAIR(Config.main_color)); attron(COLOR_PAIR(Config.main_color));
mvprintw(w->GetStartY()+w->GetHeight(), w->GetStartX()+(w->GetWidth()-strlen(buf))/2, "%s", buf); mvprintw(w->GetStartY()+w->GetHeight(), w->GetStartX()+(w->GetWidth()-strlen(buf))/2, "%s", buf);

View File

@@ -53,7 +53,7 @@ class Clock : public Screen<Window>
static short disp[11]; static short disp[11];
static long older[6], next[6], newer[6], mask; static long older[6], next[6], newer[6], mask;
static const size_t Width; static size_t Width;
static const size_t Height; static const size_t Height;
}; };

View File

@@ -21,6 +21,8 @@
#ifndef _NCMPCPP_H #ifndef _NCMPCPP_H
#define _NCMPCPP_H #define _NCMPCPP_H
#include <cstdlib>
#include "window.h" #include "window.h"
#include "menu.h" #include "menu.h"
#include "scrollpad.h" #include "scrollpad.h"

View File

@@ -155,7 +155,7 @@ template <class C> Window &operator<<(Window &w, const basic_buffer<C> &buf)
w << tmp; w << tmp;
tmp.clear(); tmp.clear();
} }
if (b->Value < 100) if (b->Value < fmtNone)
w << Color(b->Value); w << Color(b->Value);
else else
w << Format(b->Value); w << Format(b->Value);

View File

@@ -18,6 +18,9 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/ ***************************************************************************/
#include <cstring>
#include <cstdlib>
#include "window.h" #include "window.h"
using std::string; using std::string;

View File

@@ -30,19 +30,13 @@
#include <stack> #include <stack>
#include <vector> #include <vector>
#include <string> #include <string>
#include <cstdlib>
#include <cstring>
#ifdef _UTF8 #ifdef _UTF8
# define my_char_t wchar_t # define my_char_t wchar_t
# define my_string_t wstring
# define UTF_S_FMT "%ls"
# define TO_STRING(x) ToString(x) # define TO_STRING(x) ToString(x)
# define TO_WSTRING(x) ToWString(x) # define TO_WSTRING(x) ToWString(x)
#else #else
# define my_char_t char # define my_char_t char
# define my_string_t string
# define UTF_S_FMT "%s"
# define TO_STRING(x) x # define TO_STRING(x) x
# define TO_WSTRING(x) x # define TO_WSTRING(x) x
#endif #endif