2 * Copyright 2004-2006 Timo Hirvonen
10 #include "track_info.h"
16 struct shuffle_track shuffle_track
;
17 struct list_head node
;
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
);
33 struct list_head node
;
36 struct list_head track_head
;
38 struct artist
*artist
;
40 /* date of the first track added to this album */
45 /* next/prev artist */
46 struct list_head node
;
49 struct list_head album_head
;
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;
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)
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
)
109 static inline struct artist
*iter_to_artist(const struct iter
*iter
)
114 static inline struct album
*iter_to_album(const struct iter
*iter
)
119 static inline struct tree_track
*iter_to_tree_track(const struct iter
*iter
)
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
);