Code

Added a welcome message (help).
authorKalle Wallin <kaw@linux.se>
Tue, 6 Apr 2004 08:45:11 +0000 (08:45 +0000)
committerKalle Wallin <kaw@linux.se>
Tue, 6 Apr 2004 08:45:11 +0000 (08:45 +0000)
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@609 09075e82-0dd4-0310-85a5-a0d7c8717e4f

screen.c
screen.h

index efd93d1fec9e76f903b3229626bb3aa9a9c700f7..95fe85d4b399d73d3b560eec0955c32e7b3e6ec5 100644 (file)
--- 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:
index 452490996fcb351990ea3a7b18a6a729661fc32a..b23a1da0e5a4926998ef732cbb8909eebd391b79 100644 (file)
--- 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;