1 /* ncmpc (Ncurses MPD Client)
2 * (c) 2004-2009 The Music Player Daemon Project
3 * Project homepage: http://musicpd.org
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "mpdclient.h"
29 #ifdef HAVE_NCURSESW_NCURSES_H
30 #include <ncursesw/ncurses.h>
35 #define IS_PLAYING(s) (s==MPD_STATUS_STATE_PLAY)
36 #define IS_PAUSED(s) (s==MPD_STATUS_STATE_PAUSE)
37 #define IS_STOPPED(s) (!(IS_PLAYING(s) | IS_PAUSED(s)))
39 #define MAX_SONGNAME_LENGTH 512
47 struct window top_window
;
48 struct window main_window
;
49 struct window progress_window
;
50 struct window status_window
;
52 /* GTime is equivalent to time_t */
53 GTime start_timestamp
;
54 GTime status_timestamp
;
67 extern struct screen screen
;
69 extern const struct screen_functions screen_playlist
;
70 extern const struct screen_functions screen_browse
;
71 #ifdef ENABLE_ARTIST_SCREEN
72 extern const struct screen_functions screen_artist
;
74 extern const struct screen_functions screen_help
;
75 #ifdef ENABLE_SEARCH_SCREEN
76 extern const struct screen_functions screen_search
;
78 #ifdef ENABLE_SONG_SCREEN
79 extern const struct screen_functions screen_song
;
81 #ifdef ENABLE_KEYDEF_SCREEN
82 extern const struct screen_functions screen_keydef
;
84 #ifdef ENABLE_LYRICS_SCREEN
85 extern const struct screen_functions screen_lyrics
;
87 #ifdef ENABLE_OUTPUTS_SCREEN
88 extern const struct screen_functions screen_outputs
;
92 typedef struct screen_functions
{
93 void (*init
)(WINDOW
*w
, int cols
, int rows
);
95 void (*open
)(mpdclient_t
*c
);
97 void (*resize
)(int cols
, int rows
);
99 void (*update
)(mpdclient_t
*c
);
100 bool (*cmd
)(mpdclient_t
*c
, command_t cmd
);
101 const char *(*get_title
)(char *s
, size_t size
);
102 } screen_functions_t
;
104 void screen_init(mpdclient_t
*c
);
105 void screen_exit(void);
106 void screen_resize(struct mpdclient
*c
);
107 void screen_status_message(const char *msg
);
108 void screen_status_printf(const char *format
, ...);
109 char *screen_error(void);
110 void screen_paint(mpdclient_t
*c
);
111 void screen_update(mpdclient_t
*c
);
112 void screen_idle(mpdclient_t
*c
);
113 void screen_cmd(mpdclient_t
*c
, command_t cmd
);
114 gint
screen_get_id(const char *name
);
117 screen_switch(const struct screen_functions
*sf
, struct mpdclient
*c
);
119 screen_swap(struct mpdclient
*c
, const struct mpd_song
*song
);
122 screen_is_visible(const struct screen_functions
*sf
);
124 int screen_get_mouse_event(mpdclient_t
*c
, unsigned long *bstate
, int *row
);
127 screen_file_goto_song(struct mpdclient
*c
, const struct mpd_song
*song
);
129 #ifdef ENABLE_SONG_SCREEN
131 screen_song_switch(struct mpdclient
*c
, const struct mpd_song
*song
);
134 #ifdef ENABLE_LYRICS_SCREEN
136 screen_lyrics_switch(struct mpdclient
*c
, const struct mpd_song
*song
, bool follow
);