1 #ifndef SCREEN_H
2 #define SCREEN_H
3 #include <ncurses.h>
4 #include "list_window.h"
6 /* top window headers */
7 #define TOP_HEADER_PREFIX "Music Player Client - "
8 #define TOP_HEADER_PLAY TOP_HEADER_PREFIX "Playlist"
9 #define TOP_HEADER_FILE TOP_HEADER_PREFIX "Browse"
10 #define TOP_HEADER_HELP TOP_HEADER_PREFIX "Help "
11 #define TOP_HEADER_SEARCH TOP_HEADER_PREFIX "Search "
13 /* colors */
14 #define TITLE_COLORS COLOR_PAIR(1)
15 #define LINE_COLORS COLOR_PAIR(2)
16 #define LIST_COLORS COLOR_PAIR(3)
17 #define PROGRESS_COLORS COLOR_PAIR(4)
18 #define STATUS_COLORS COLOR_PAIR(5)
19 #define ALERT_COLORS COLOR_PAIR(6)
21 /* minumum window size */
22 #define SCREEN_MIN_COLS 14
23 #define SCREEN_MIN_ROWS 5
25 /* timeout for non blocking read [ms] */
26 #define SCREEN_TIMEOUT 250
28 #define IS_PLAYING(s) (s==MPD_STATUS_STATE_PLAY)
29 #define IS_PAUSED(s) (s==MPD_STATUS_STATE_PAUSE)
31 typedef enum
32 {
33 SCREEN_PLAY_WINDOW = 0,
34 SCREEN_FILE_WINDOW,
35 SCREEN_HELP_WINDOW,
36 SCREEN_SEARCH_WINDOW
38 } screen_mode_t;
42 typedef struct
43 {
44 WINDOW *w;
45 int rows, cols;
47 } window_t;
51 typedef struct
52 {
53 window_t top_window;
54 window_t main_window;
55 window_t progress_window;
56 window_t status_window;
57 time_t status_timestamp;
59 list_window_t *playlist;
60 list_window_t *filelist;
61 list_window_t *helplist;
63 int cols, rows;
65 screen_mode_t mode;
67 char *buf;
68 size_t buf_size;
70 char *findbuf;
72 int painted;
74 } screen_t;
78 int screen_init(void);
79 int screen_exit(void);
80 void screen_resized(int sig);
81 void screen_status_message(char *msg);
82 void screen_status_printf(char *format, ...);
83 char *screen_error(void);
84 void screen_paint(mpd_client_t *c);
85 void screen_update(mpd_client_t *c);
86 void screen_cmd(mpd_client_t *c, command_t cmd);
88 #endif