1 /*
2  * Copyright 2008-2013 Various Authors
3  * Copyright 2006 Timo Hirvonen
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef CMUS_PL_H
20 #define CMUS_PL_H
21 
22 #include "track_info.h"
23 #include "window.h"
24 #include "editable.h"
25 #include "cmus.h"
26 
27 struct pl_list_info {
28 	const char *name;
29 	unsigned marked : 1;
30 	unsigned active : 1;
31 	unsigned selected : 1;
32 	unsigned current : 1;
33 };
34 
35 extern struct window *pl_list_win;
36 extern struct editable_shared pl_editable_shared;
37 
38 void pl_init(void);
39 void pl_exit(void);
40 void pl_save(void);
41 void pl_import(const char *path);
42 void pl_export_selected_pl(const char *path);
43 struct searchable *pl_get_searchable(void);
44 int pl_add_file_to_marked_pl(const char *file);
45 void pl_add_track_to_marked_pl(struct track_info *ti);
46 void pl_rename_selected_pl(const char *name);
47 void pl_create(const char *name);
48 void pl_get_sort_str(char *buf, size_t size);
49 void pl_set_sort_str(const char *buf);
50 void pl_clear(void);
51 struct track_info *pl_goto_next(void);
52 struct track_info *pl_goto_prev(void);
53 struct track_info *pl_play_selected_row(void);
54 void pl_select_playing_track(void);
55 void pl_reshuffle(void);
56 int _pl_for_each_sel(track_info_cb cb, void *data, int reverse);
57 int pl_for_each_sel(track_info_cb cb, void *data, int reverse, int advance);
58 void pl_reload_visible(void);
59 struct window *pl_cursor_win(void);
60 void pl_set_nr_rows(int h);
61 unsigned int pl_visible_total_time(void);
62 unsigned int pl_playing_total_time(void);
63 struct simple_track *pl_get_playing_track(void);
64 void pl_update_track(struct track_info *old, struct track_info *new);
65 int pl_get_cursor_in_track_window(void);
66 int pl_visible_is_marked(void);
67 const char *pl_marked_pl_name(void);
68 void pl_set_marked_pl_by_name(const char *name);
69 
70 void pl_mark_for_redraw(void);
71 int pl_needs_redraw(void);
72 void pl_draw(void (*list)(struct window *win),
73 		void (*tracks)(struct window *win), int full);
74 void pl_list_iter_to_info(struct iter *iter, struct pl_list_info *info);
75 
pl_add_track_to_marked_pl2(struct track_info * ti,void * opaque)76 static inline void pl_add_track_to_marked_pl2(struct track_info *ti,
77 		void *opaque)
78 {
79 	pl_add_track_to_marked_pl(ti);
80 }
81 
82 /* cmd wrappers */
83 
84 void pl_invert_marks(void);
85 void pl_mark(char *arg);
86 void pl_unmark(void);
87 void pl_rand(void);
88 void pl_win_mv_after(void);
89 void pl_win_mv_before(void);
90 void pl_win_remove(void);
91 void pl_win_toggle(void);
92 void pl_win_update(void);
93 void pl_win_next(void);
94 
95 #endif
96