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;
62 extern struct editable lib_editable
;
63 extern struct tree_track
*lib_cur_track
;
64 extern enum aaa_mode aaa_mode
;
65 extern unsigned int play_sorted
;
67 extern struct searchable
*tree_searchable
;
68 extern struct window
*lib_tree_win
;
69 extern struct window
*lib_track_win
;
70 extern struct window
*lib_cur_win
;
71 extern struct list_head lib_artist_head
;
73 #define CUR_ALBUM (lib_cur_track->album)
74 #define CUR_ARTIST (lib_cur_track->album->artist)
78 struct track_info
*lib_set_next(void);
79 struct track_info
*lib_set_prev(void);
80 void lib_add_track(struct track_info
*track_info
);
81 void lib_set_filter(struct expr
*expr
);
82 void lib_remove(struct track_info
*ti
);
83 void lib_clear_store(void);
84 void lib_reshuffle(void);
85 void lib_set_view(int view
);
86 int lib_for_each(int (*cb
)(void *data
, struct track_info
*ti
), void *data
);
88 struct track_info
*tree_set_selected(void);
89 void tree_add_track(struct tree_track
*track
);
90 void tree_remove(struct tree_track
*track
);
91 void tree_remove_sel(void);
92 void tree_toggle_active_window(void);
93 void tree_toggle_expand_artist(void);
94 void tree_sel_current(void);
95 int tree_for_each_sel(int (*cb
)(void *data
, struct track_info
*ti
), void *data
, int reverse
);
96 int __tree_for_each_sel(int (*cb
)(void *data
, struct track_info
*ti
), void *data
, int reverse
);
98 struct track_info
*sorted_set_selected(void);
99 void sorted_sel_current(void);
101 static inline struct tree_track
*iter_to_sorted_track(const struct iter
*iter
)
106 static inline struct artist
*iter_to_artist(const struct iter
*iter
)
111 static inline struct album
*iter_to_album(const struct iter
*iter
)
116 static inline struct tree_track
*iter_to_tree_track(const struct iter
*iter
)
121 static inline struct artist
*to_artist(const struct list_head
*item
)
123 return container_of(item
, struct artist
, node
);
126 static inline struct album
*to_album(const struct list_head
*item
)
128 return container_of(item
, struct album
, node
);