fix README
[melted_gui] / src / playlist.h
1 /*
2 * playlist.h -- GTK+ 2 melted gui
3 * Copyright (C) 2012 Maksym Veremeyenko <verem@m1stereo.tv>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU 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, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20 #ifndef PLAYLIST_H
21 #define PLAYLIST_H
22
23 #include "instance.h"
24
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #endif /* __cplusplus */
29
30
31 void playlist_init(instance_t* app);
32 void playlist_release(instance_t* app);
33
34
35 /**
36 * @anchor playlist_idx_cued
37 *
38 * function check if given index is in the any player usage
39 *
40 * @param[in] app application instance handle
41 * @param[in] idx index of playlist item
42 * @param[out] player_idx index of player where item used
43 *
44 * @return 1 for success and set player_idx to proper value and zero
45 * if item is not used in any player
46 *
47 * @{
48 */
49 int playlist_idx_cued(instance_t* app, int idx, int* player_idx);
50 /** @} */
51
52 /**
53 * @anchor playlist_range_cued
54 *
55 * function check if given range is in the any player usage
56 *
57 * @param[in] app application instance handle
58 * @param[in] start index of first playlist item
59 * @param[in] stop index of last playlist item
60 *
61 * @return 1 for success and zero if range is not used in any player
62 *
63 * @note idxs_in_players_range
64 * @{
65 */
66 int playlist_range_cued(instance_t* app, int start, int stop);
67 /** @} */
68
69
70 /**
71 * @anchor playlist_insert_check
72 *
73 * function check if possible to insert into the current playlist position
74 *
75 * @param[in] app application instance handle
76 * @param[in] idx index of playlist to insert
77 * @param[out] t playlist type will be associated with insert position
78 *
79 * @return 1 for success and zero otherwise
80 *
81 * @{
82 */
83 int playlist_insert_check(instance_t* app, int idx, playlist_item_type_t* t);
84 /** @} */
85
86
87 /**
88 * @anchor playlist_insert_items
89 *
90 * function check if possible to insert into the current playlist position
91 *
92 * @param[in] app application instance handle
93 * @param[in] idx index of playlist to insert
94 * @param[in] items list of playlist items
95 * @param[in] count number of items in the list of playlist
96 *
97 * @{
98 */
99 void playlist_insert_items(instance_t* app, int idx, playlist_item_t* items, int count);
100 /** @} */
101
102 /**
103 * @anchor playlist_get_selected_items_idx
104 *
105 * function tries to get list of indexes of selected items
106 *
107 * @param[in] app application instance handle
108 * @param[out] count number of items in list
109 *
110 * @return NULL if no items selected otherwise return pointer
111 * to the list of array of integers with items indexes selected
112 * and set count variable to the number of items in list
113 *
114 * @{
115 */
116 int* playlist_get_selected_items_idx(instance_t* app, int *count);
117 /** @} */
118
119 /**
120 * @anchor playlist_get_block
121 *
122 * function tries to find block range that include given playlist index
123 *
124 * @param[in] app application instance handle
125 * @param[in] idx playlist item index
126 * @param[out] pstart pointer where index of first item of block will be stored
127 * @param[out] pstart pointer where index of last item of block will be stored
128 *
129 * @return -1 if no range found, otherwise number of items in a block
130 *
131 * @{
132 */
133 int playlist_get_block(instance_t* app, int idx, int* pstart, int* pstop);
134 /** @} */
135
136
137 /**
138 * @anchor playlist_get_player_at_pos
139 *
140 * function find a player associated with playlist item
141 *
142 * @param[in] app application instance handle
143 * @param[in] idx playlist item index
144 *
145 * @return NULL if item not assiciated with player, otherwise player struct
146 *
147 * @{
148 */
149 player_t *playlist_get_player_at_pos(instance_t* app, int pos);
150 /** @} */
151
152 /**
153 * @anchor playlist_get_first_selected_item_idx
154 *
155 * function tries to get index of first selected item
156 *
157 * @param[in] app application instance handle
158 *
159 * @return -1 if no items selected otherwise return index of
160 * selected item
161 *
162 * @{
163 */
164 int playlist_get_first_selected_item_idx(instance_t* app);
165 /** @} */
166
167
168 /**
169 * @anchor playlist_delete_items
170 *
171 * function delete list of items
172 *
173 * @param[in] app application instance handle
174 * @param[in] idxs list of indexes to delete
175 * @param[in] count number of indexes in the list
176 * @param[in] sel flag used to change playlist selection
177 * on first item after delete operation
178 *
179 * @{
180 */
181 void playlist_delete_items(instance_t* app, int* idxs, int count, int sel);
182 /** @} */
183
184 /**
185 * @anchor playlist_delete_selected_items
186 *
187 * function delete selected items
188 *
189 * @param[in] app application instance handle
190 *
191 * @{
192 */
193 void playlist_delete_selected_items(instance_t* app);
194 /** @} */
195
196 /**
197 * @anchor playlist_item_index
198 *
199 * @{
200 */
201 int playlist_item_index(instance_t* app, int start, int idx);
202 /** @} */
203
204
205 /**
206 * @anchor playlist_block
207 *
208 * function change block type of events
209 *
210 * @param[in] app application instance handle
211 * @param[in] loop flag indicating that loop type will be used
212 *
213 * @{
214 */
215 void playlist_block(instance_t* app, int loop);
216 /** @} */
217
218
219 /**
220 * @anchor playlist_item_copy
221 *
222 * function copy selected items from playlist into the clipboard
223 *
224 * @param[in] app application instance handle
225 *
226 * @{
227 */
228 void playlist_item_copy(instance_t* app);
229 /** @} */
230
231
232 /**
233 * @anchor playlist_item_paste
234 *
235 * function insert items from clipboard to playlist
236 *
237 * @param[in] app application instance handle
238 * @param[in] after flag indicating that insertion is after selected
239 *
240 * @{
241 */
242 void playlist_item_paste(instance_t* app, int after);
243 /** @} */
244
245
246 /**
247 * @anchor playlist_item_swap
248 *
249 * swap first selected item with next or previous item
250 *
251 * @param[in] app application instance handle
252 * @param[in] dir swap direction
253 *
254 * @{
255 */
256 void playlist_item_swap(instance_t* app, int dir);
257 /** @} */
258
259 void playlist_save(instance_t* app);
260 void playlist_load(instance_t* app);
261 void playlist_item_edit(instance_t* app);
262 void playlist_item_add(instance_t* app, int after);
263 void playlist_relink(instance_t* app);
264 void playlist_item_add_from_library(instance_t* app, int after);
265
266 #ifdef __cplusplus
267 };
268 #endif /* __cplusplus */
269
270 #endif /* PLAYLIST_H */