Code

Added support for a configuration file ~/.ncmpcrc and color support.
[ncmpc.git] / screen.h
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 #define IS_PLAYING(s) (s==MPD_STATUS_STATE_PLAY)
26 #define IS_PAUSED(s) (s==MPD_STATUS_STATE_PAUSE)
28 typedef enum
29 {
30   SCREEN_PLAY_WINDOW = 0,
31   SCREEN_FILE_WINDOW,
32   SCREEN_HELP_WINDOW,
33   SCREEN_SEARCH_WINDOW
35 } screen_mode_t;
39 typedef struct
40 {
41   WINDOW *w;
42   int rows, cols;
44 } window_t;
48 typedef struct
49 {
50   window_t top_window;
51   window_t main_window;
52   window_t progress_window;
53   window_t status_window;
54   time_t status_timestamp;
56   list_window_t *playlist;
57   list_window_t *filelist;
58   list_window_t *helplist;
60   int cols, rows;
62   screen_mode_t mode;
64   char *buf;
65   size_t buf_size;
67   char *findbuf;
69   int painted;
71 } screen_t;
75 int screen_init(void);
76 int screen_exit(void);
77 void screen_resized(int sig);
78 void screen_status_message(char *msg);
79 void screen_status_printf(char *format, ...);
80 char *screen_error(void);
81 void screen_paint(mpd_client_t *c);
82 void screen_update(mpd_client_t *c);
83 void screen_cmd(mpd_client_t *c, command_t cmd);
85 #endif