From: Kalle Wallin Date: Tue, 6 Apr 2004 08:45:11 +0000 (+0000) Subject: Added a welcome message (help). X-Git-Tag: v0.12_alpha1~605 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c6b7d4d7119f9d8c12514f8309a25ed618e22512;p=ncmpc.git Added a welcome message (help). git-svn-id: https://svn.musicpd.org/ncmpc/trunk@609 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- diff --git a/screen.c b/screen.c index efd93d1..95fe85d 100644 --- a/screen.c +++ b/screen.c @@ -87,9 +87,27 @@ paint_top_window(char *header, int volume, int clear) { char buf[12]; - wattron(w, A_BOLD); - mvwaddstr(w, 0, 0, header); - wattroff(w, A_BOLD); + if( header[0] ) + { + wattron(w, A_BOLD); + mvwaddstr(w, 0, 0, header); + wattroff(w, A_BOLD); + } + else + { + wattron(w, A_BOLD); + waddstr(w, "F1"); + wattroff(w, A_BOLD); + waddstr(w, ":Help "); + wattron(w, A_BOLD); + waddstr(w, "F2"); + wattroff(w, A_BOLD); + waddstr(w, ":Playlist "); + wattron(w, A_BOLD); + waddstr(w, "F3"); + wattroff(w, A_BOLD); + waddstr(w, ":Browse"); + } if( volume==MPD_STATUS_NO_VOLUME ) { snprintf(buf, 12, "Volume n/a "); @@ -335,6 +353,7 @@ screen_init(void) screen->findbuf = NULL; screen->painted = 0; screen->input_timestamp = time(NULL); + screen->last_cmd = CMD_NONE; /* create top window */ screen->top_window.rows = 2; @@ -455,7 +474,11 @@ screen_update(mpd_client_t *c) switch(screen->mode) { case SCREEN_PLAY_WINDOW: - paint_top_window(TOP_HEADER_PLAY, c->status->volume, 0); + if( screen->last_cmd==CMD_NONE && + time(NULL)-screen->input_timestamp <= SCREEN_WELCOME_TIME) + paint_top_window("", c->status->volume, 0); + else + paint_top_window(TOP_HEADER_PLAY, c->status->volume, 0); play_update(screen, c); lw = screen->playlist; break; @@ -488,6 +511,7 @@ screen_cmd(mpd_client_t *c, command_t cmd) screen_mode_t new_mode = screen->mode; screen->input_timestamp = time(NULL); + screen->last_cmd = cmd; switch(screen->mode) { case SCREEN_PLAY_WINDOW: diff --git a/screen.h b/screen.h index 4524909..b23a1da 100644 --- a/screen.h +++ b/screen.h @@ -25,6 +25,9 @@ /* timeout for non blocking read [ms] */ #define SCREEN_TIMEOUT 250 +/* welcome message time [s] */ +#define SCREEN_WELCOME_TIME 10 + #define IS_PLAYING(s) (s==MPD_STATUS_STATE_PLAY) #define IS_PAUSED(s) (s==MPD_STATUS_STATE_PAUSE) #define IS_STOPPED(s) (!(IS_PLAYING(s) | IS_PAUSED(s))) @@ -58,6 +61,7 @@ typedef struct time_t status_timestamp; time_t input_timestamp; + command_t last_cmd; list_window_t *playlist; list_window_t *filelist;