diff --git a/src/screen.c b/src/screen.c
index 5345f49ef8665bca530a20689d533742797d1a64..17641df997a2bfb5fc3efdebd16d431c30e8884c 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
#include "charset.h"
#include "mpdclient.h"
#include "utils.h"
-#include "command.h"
#include "options.h"
#include "colors.h"
#include "strfsong.h"
-#include "wreadln.h"
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <locale.h>
+#ifndef NCMPC_MINI
/** welcome message time [s] */
-static const unsigned SCREEN_WELCOME_TIME = 10;
+static const GTime SCREEN_WELCOME_TIME = 10;
+#endif
/** status message time [s] */
-static const unsigned SCREEN_STATUS_MESSAGE_TIME = 3;
+static const GTime SCREEN_STATUS_MESSAGE_TIME = 3;
/* minumum window size */
static const int SCREEN_MIN_COLS = 14;
/* screens */
+#ifndef NCMPC_MINI
static gboolean welcome = TRUE;
-static struct screen screen;
+#endif
+
+struct screen screen;
static const struct screen_functions *mode_fn = &screen_playlist;
static int seek_id = -1;
static int seek_target_time = 0;
/* open the new mode */
if (mode_fn->open != NULL)
- mode_fn->open(&screen, c);
+ mode_fn->open(c);
screen_paint(c);
}
if (header[0]) {
colors_use(w, COLOR_TITLE_BOLD);
mvwaddstr(w, 0, 0, header);
+#ifndef NCMPC_MINI
} else {
colors_use(w, COLOR_TITLE_BOLD);
waddstr(w, get_key_names(CMD_SCREEN_HELP, FALSE));
waddstr(w, get_key_names(CMD_SCREEN_LYRICS, FALSE));
colors_use(w, COLOR_TITLE);
waddstr(w, _(":Lyrics "));
+#endif
#endif
}
+
if (c->status == NULL || c->status->volume == MPD_STATUS_NO_VOLUME) {
g_snprintf(buf, 32, _("Volume n/a "));
} else {
mpd_Status *status = c->status;
mpd_Song *song = c->song;
int elapsedTime = 0;
+#ifdef NCMPC_MINI
+ static char bitrate[1];
+#else
char bitrate[16];
+#endif
const char *str = NULL;
int x = 0;
elapsedTime = seek_target_time;
/* display bitrate if visible-bitrate is true */
+#ifndef NCMPC_MINI
if (options.visible_bitrate) {
g_snprintf(bitrate, 16,
" [%d kbps]", status->bitRate);
} else {
bitrate[0] = '\0';
}
+#endif
/*write out the time, using hours if time over 60 minutes*/
if (c->status->totalTime > 3600) {
bitrate, elapsedTime/60, elapsedTime%60,
status->totalTime/60, status->totalTime%60 );
}
+#ifndef NCMPC_MINI
} else {
g_snprintf(screen.buf, screen.buf_size,
" [%d kbps]", status->bitRate );
+#endif
}
+#ifndef NCMPC_MINI
} else {
time_t timep;
time(&timep);
strftime(screen.buf, screen.buf_size, "%X ",localtime(&timep));
+#endif
}
/* display song */
if (status != NULL && (IS_PLAYING(status->state) ||
IS_PAUSED(status->state))) {
char songname[MAX_SONGNAME_LENGTH];
+#ifndef NCMPC_MINI
int width = COLS - x - utf8_width(screen.buf);
+#endif
if (song)
strfsong(songname, MAX_SONGNAME_LENGTH,
colors_use(w, COLOR_STATUS);
/* scroll if the song name is to long */
+#ifndef NCMPC_MINI
if (options.scroll && utf8_width(songname) > (unsigned)width) {
static scroll_state_t st = { 0, 0 };
char *tmp = strscroll(songname, options.scroll_sep, width, &st);
g_strlcpy(songname, tmp, MAX_SONGNAME_LENGTH);
g_free(tmp);
}
+#endif
//mvwaddnstr(w, 0, x, songname, width);
mvwaddstr(w, 0, x, songname);
}
screen.main_window.cols, screen.main_window.rows);
if (mode_fn->open != NULL)
- mode_fn->open(&screen, c);
-
- /* initialize wreadln */
- wrln_wgetch = my_wgetch;
- wrln_max_history_length = 16;
+ mode_fn->open(c);
}
void
void
screen_update(mpdclient_t *c)
{
+#ifndef NCMPC_MINI
static int repeat = -1;
static int random_enabled = -1;
static int crossfade = -1;
screen.last_cmd==CMD_NONE &&
time(NULL)-screen.start_timestamp <= SCREEN_WELCOME_TIME)
paint_top_window("", c, 0);
- else if (mode_fn->get_title != NULL) {
+ else
+#endif
+ if (mode_fn->get_title != NULL) {
paint_top_window(mode_fn->get_title(screen.buf,screen.buf_size), c, 0);
+#ifndef NCMPC_MINI
welcome = FALSE;
+#endif
} else
paint_top_window("", c, 0);
screen_cmd(mpdclient_t *c, command_t cmd)
{
screen.last_cmd = cmd;
+#ifndef NCMPC_MINI
welcome = FALSE;
+#endif
- if (mode_fn->cmd != NULL && mode_fn->cmd(&screen, c, cmd))
+ if (mode_fn->cmd != NULL && mode_fn->cmd(c, cmd))
return;
if (screen_client_cmd(c, cmd))
case CMD_SCREEN_FILE:
screen_switch(&screen_browse, c);
break;
+#ifdef ENABLE_HELP_SCREEN
case CMD_SCREEN_HELP:
screen_switch(&screen_help, c);
break;
+#endif
#ifdef ENABLE_SEARCH_SCREEN
case CMD_SCREEN_SEARCH:
screen_switch(&screen_search, c);