From 3da656b83260ef257675a4ae4c681b3b99f83353 Mon Sep 17 00:00:00 2001 From: Kalle Wallin Date: Mon, 22 Mar 2004 18:09:23 +0000 Subject: Added a find buffer and a function for formated status messages. git-svn-id: https://svn.musicpd.org/ncmpc/trunk@368 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- screen.c | 18 ++++++++++++++++++ screen.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/screen.c b/screen.c index 98c08eb66..2d61122fd 100644 --- a/screen.c +++ b/screen.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -20,6 +21,7 @@ #include "screen_search.h" #define STATUS_MESSAGE_TIMEOUT 3 +#define STATUS_LINE_MAX_SIZE 512 static screen_t *screen = NULL; @@ -203,6 +205,7 @@ screen_exit(void) screen->filelist = list_window_free(screen->filelist); screen->helplist = list_window_free(screen->helplist); free(screen->buf); + free(screen->findbuf); free(screen); screen = NULL; } @@ -235,6 +238,18 @@ screen_status_message(mpd_client_t *c, char *msg) screen->status_timestamp = time(NULL); } +void +screen_status_printf(mpd_client_t *c, char *format, ...) +{ + char buffer[STATUS_LINE_MAX_SIZE]; + va_list ap; + + va_start(ap,format); + vsnprintf(buffer,sizeof(buffer),format,ap); + va_end(ap); + screen_status_message(c, buffer); +} + int screen_init(void) { @@ -269,6 +284,7 @@ screen_init(void) screen->rows = LINES; screen->buf = malloc(screen->cols); screen->buf_size = screen->cols; + screen->findbuf = NULL; screen->painted = 0; /* create top window */ @@ -503,6 +519,8 @@ screen_cmd(mpd_client_t *c, command_t cmd) break; case CMD_QUIT: exit(EXIT_SUCCESS); + case CMD_LIST_FIND: + case CMD_LIST_FIND_NEXT: case CMD_NONE: case CMD_DELETE: case CMD_SELECT: diff --git a/screen.h b/screen.h index 35124240b..4681319c3 100644 --- a/screen.h +++ b/screen.h @@ -53,6 +53,8 @@ typedef struct char *buf; size_t buf_size; + char *findbuf; + int painted; } screen_t; @@ -63,6 +65,7 @@ int screen_init(void); int screen_exit(void); void screen_resized(int sig); void screen_status_message(mpd_client_t *c, char *msg); +void screen_status_printf(mpd_client_t *c, char *format, ...); char *screen_error(void); void screen_paint(mpd_client_t *c); void screen_update(mpd_client_t *c); -- cgit v1.2.3