1 /* ncmpc (Ncurses MPD Client)
2 * (c) 2004-2017 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.
20 #include "screen_list.h"
21 #include "screen_interface.h"
23 #include "screen_help.h"
24 #include "screen_queue.h"
25 #include "screen_file.h"
26 #include "screen_artist.h"
27 #include "screen_search.h"
28 #include "screen_song.h"
29 #include "screen_keydef.h"
30 #include "screen_lyrics.h"
31 #include "screen_outputs.h"
32 #include "screen_chat.h"
39 const struct screen_functions
*functions
;
41 { "playlist", &screen_queue
},
42 { "browse", &screen_browse
},
43 #ifdef ENABLE_ARTIST_SCREEN
44 { "artist", &screen_artist
},
46 #ifdef ENABLE_HELP_SCREEN
47 { "help", &screen_help
},
49 #ifdef ENABLE_SEARCH_SCREEN
50 { "search", &screen_search
},
52 #ifdef ENABLE_SONG_SCREEN
53 { "song", &screen_song
},
55 #ifdef ENABLE_KEYDEF_SCREEN
56 { "keydef", &screen_keydef
},
58 #ifdef ENABLE_LYRICS_SCREEN
59 { "lyrics", &screen_lyrics
},
61 #ifdef ENABLE_OUTPUTS_SCREEN
62 { "outputs", &screen_outputs
},
64 #ifdef ENABLE_CHAT_SCREEN
65 { "chat", &screen_chat
},
70 screen_list_init(WINDOW
*w
, unsigned cols
, unsigned rows
)
72 for (unsigned i
= 0; i
< G_N_ELEMENTS(screens
); ++i
) {
73 const struct screen_functions
*sf
= screens
[i
].functions
;
76 sf
->init(w
, cols
, rows
);
81 screen_list_exit(void)
83 for (unsigned i
= 0; i
< G_N_ELEMENTS(screens
); ++i
) {
84 const struct screen_functions
*sf
= screens
[i
].functions
;
92 screen_list_resize(unsigned cols
, unsigned rows
)
94 for (unsigned i
= 0; i
< G_N_ELEMENTS(screens
); ++i
) {
95 const struct screen_functions
*sf
= screens
[i
].functions
;
98 sf
->resize(cols
, rows
);
103 screen_get_name(const struct screen_functions
*sf
)
105 for (unsigned i
= 0; i
< G_N_ELEMENTS(screens
); ++i
)
106 if (screens
[i
].functions
== sf
)
107 return screens
[i
].name
;
112 const struct screen_functions
*
113 screen_lookup_name(const char *name
)
115 for (unsigned i
= 0; i
< G_N_ELEMENTS(screens
); ++i
)
116 if (strcmp(name
, screens
[i
].name
) == 0)
117 return screens
[i
].functions
;