flac: Saner EOF handling
[cmus.git] / editable.h
blob05208276ea5dee5a5c2a80930489f44e94f142db
1 /*
2 * Copyright 2006 Timo Hirvonen
3 */
5 #ifndef EDITABLE_H
6 #define EDITABLE_H
8 #include "window.h"
9 #include "list.h"
10 #include "track.h"
11 #include "locking.h"
13 struct editable {
14 struct window *win;
15 struct list_head head;
16 unsigned int nr_tracks;
17 unsigned int nr_marked;
18 unsigned int total_time;
19 const char **sort_keys;
20 char sort_str[128];
21 struct searchable *searchable;
23 void (*free_track)(struct list_head *item);
26 extern pthread_mutex_t editable_mutex;
28 void editable_init(struct editable *e, void (*free_track)(struct list_head *item));
29 void editable_add(struct editable *e, struct simple_track *track);
30 void editable_remove_track(struct editable *e, struct simple_track *track);
31 void editable_remove_sel(struct editable *e);
32 void editable_sort(struct editable *e);
33 void editable_set_sort_keys(struct editable *e, const char **keys);
34 void editable_toggle_mark(struct editable *e);
35 void editable_move_after(struct editable *e);
36 void editable_move_before(struct editable *e);
37 void editable_clear(struct editable *e);
38 void editable_mark(struct editable *e, const char *filter);
39 void editable_unmark(struct editable *e);
40 void editable_invert_marks(struct editable *e);
41 int __editable_for_each_sel(struct editable *e, int (*cb)(void *data, struct track_info *ti),
42 void *data, int reverse);
43 int editable_for_each_sel(struct editable *e, int (*cb)(void *data, struct track_info *ti),
44 void *data, int reverse);
46 static inline void editable_track_to_iter(struct editable *e, struct simple_track *track, struct iter *iter)
48 iter->data0 = &e->head;
49 iter->data1 = track;
50 iter->data2 = NULL;
53 #define editable_lock() cmus_mutex_lock(&editable_mutex)
54 #define editable_unlock() cmus_mutex_unlock(&editable_mutex)
56 #endif