unused defines cleaning / a few fixes for clock

master
Andrzej Rybczak 17 years ago
parent 7246b57d48
commit 164dec3eed
  1. 10
      src/clock.cpp
  2. 2
      src/clock.h
  3. 2
      src/ncmpcpp.h
  4. 2
      src/strbuffer.h
  5. 3
      src/window.cpp
  6. 6
      src/window.h

@ -24,6 +24,8 @@
#ifdef ENABLE_CLOCK
#include <cstring>
#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);

@ -53,7 +53,7 @@ class Clock : public Screen<Window>
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;
};

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

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

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

@ -30,19 +30,13 @@
#include <stack>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#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

Loading…
Cancel
Save