Remove extraneous "`"
[cmus.git] / lib.h
blobd47db8885b83bebdf07706aab9da2fb8f1c009da
1 /*
2 * Copyright 2004-2006 Timo Hirvonen
3 */
5 #ifndef LIB_H
6 #define LIB_H
8 #include "editable.h"
9 #include "search.h"
10 #include "track_info.h"
11 #include "expr.h"
13 #include <sys/time.h>
15 struct tree_track {
16 struct shuffle_track shuffle_track;
17 struct list_head node;
18 struct album *album;
21 static inline struct track_info *tree_track_info(const struct tree_track *track)
23 return ((struct simple_track *)track)->info;
26 static inline struct tree_track *to_tree_track(const struct list_head *item)
28 return container_of(item, struct tree_track, node);
31 struct album {
32 /* next/prev album */
33 struct list_head node;
35 /* list of tracks */
36 struct list_head track_head;
38 struct artist *artist;
39 char *name;
40 /* date of the first track added to this album */
41 int date;
44 struct artist {
45 /* next/prev artist */
46 struct list_head node;
48 /* list of albums */
49 struct list_head album_head;
50 char *name;
52 /* albums visible for this artist in the tree_win? */
53 unsigned int expanded : 1;
55 /* if streams == 1 && name == NULL then display <Stream> */
56 //unsigned int streams : 1;
59 enum aaa_mode {
60 AAA_MODE_ALL,
61 AAA_MODE_ARTIST,
62 AAA_MODE_ALBUM
65 extern struct editable lib_editable;
66 extern struct tree_track *lib_cur_track;
67 extern enum aaa_mode aaa_mode;
68 extern unsigned int play_sorted;
70 extern struct searchable *tree_searchable;
71 extern struct window *lib_tree_win;
72 extern struct window *lib_track_win;
73 extern struct window *lib_cur_win;
74 extern struct list_head lib_artist_head;
76 #define CUR_ALBUM (lib_cur_track->album)
77 #define CUR_ARTIST (lib_cur_track->album->artist)
79 void lib_init(void);
80 void tree_init(void);
81 struct track_info *lib_set_next(void);
82 struct track_info *lib_set_prev(void);
83 void lib_add_track(struct track_info *track_info);
84 void lib_set_filter(struct expr *expr);
85 void lib_remove(struct track_info *ti);
86 void lib_clear_store(void);
87 void lib_reshuffle(void);
88 void lib_set_view(int view);
89 int lib_for_each(int (*cb)(void *data, struct track_info *ti), void *data);
91 struct track_info *tree_set_selected(void);
92 void tree_add_track(struct tree_track *track);
93 void tree_remove(struct tree_track *track);
94 void tree_remove_sel(void);
95 void tree_toggle_active_window(void);
96 void tree_toggle_expand_artist(void);
97 void tree_sel_current(void);
98 int tree_for_each_sel(int (*cb)(void *data, struct track_info *ti), void *data, int reverse);
99 int __tree_for_each_sel(int (*cb)(void *data, struct track_info *ti), void *data, int reverse);
101 struct track_info *sorted_set_selected(void);
102 void sorted_sel_current(void);
104 static inline struct tree_track *iter_to_sorted_track(const struct iter *iter)
106 return iter->data1;
109 static inline struct artist *iter_to_artist(const struct iter *iter)
111 return iter->data1;
114 static inline struct album *iter_to_album(const struct iter *iter)
116 return iter->data2;
119 static inline struct tree_track *iter_to_tree_track(const struct iter *iter)
121 return iter->data1;
124 static inline struct artist *to_artist(const struct list_head *item)
126 return container_of(item, struct artist, node);
129 static inline struct album *to_album(const struct list_head *item)
131 return container_of(item, struct album, node);
134 #endif