playlist basic operations
[melted_gui] / src / playlist.h
index 9a9ac58..1ed329e 100644 (file)
@@ -1,6 +1,270 @@
-void omnplay_playlist_load(omnplay_instance_t* app);
-void omnplay_playlist_save(omnplay_instance_t* app);
-void omnplay_playlist_relink(omnplay_instance_t* app);
-void omnplay_playlist_draw(omnplay_instance_t* app);
-void omnplay_playlist_draw_item(omnplay_instance_t* app, int idx);
-void omnplay_playlist_draw_item_rem(omnplay_instance_t* app, int idx, char* rem);
+/*
+ * playlist.h -- GTK+ 2 melted gui
+ * Copyright (C) 2012 Maksym Veremeyenko <verem@m1stereo.tv>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef PLAYLIST_H
+#define PLAYLIST_H
+
+#include "instance.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+void playlist_init(instance_t* app);
+void playlist_release(instance_t* app);
+
+
+/**
+ * @anchor playlist_idx_cued
+ *
+ * function check if given index is in the any player usage
+ *
+ * @param[in] app application instance handle
+ * @param[in] idx index of playlist item
+ * @param[out] player_idx index of player where item used
+ *
+ * @return 1 for success and set player_idx to proper value and zero
+ * if item is not used in any player
+ *
+ * @{
+ */
+int playlist_idx_cued(instance_t* app, int idx, int* player_idx);
+/** @} */
+
+/**
+ * @anchor playlist_range_cued
+ *
+ * function check if given range is in the any player usage
+ *
+ * @param[in] app application instance handle
+ * @param[in] start index of first playlist item
+ * @param[in] stop index of last playlist item
+ *
+ * @return 1 for success and zero if range is not used in any player
+ *
+ * @note idxs_in_players_range
+ * @{
+ */
+int playlist_range_cued(instance_t* app, int start, int stop);
+/** @} */
+
+
+/**
+ * @anchor playlist_insert_check
+ *
+ * function check if possible to insert into the current playlist position
+ *
+ * @param[in] app application instance handle
+ * @param[in] idx index of playlist to insert
+ * @param[out] t playlist type will be associated with insert position
+ *
+ * @return 1 for success and zero otherwise
+ *
+ * @{
+ */
+int playlist_insert_check(instance_t* app, int idx, playlist_item_type_t* t);
+/** @} */
+
+
+/**
+ * @anchor playlist_insert_items
+ *
+ * function check if possible to insert into the current playlist position
+ *
+ * @param[in] app application instance handle
+ * @param[in] idx index of playlist to insert
+ * @param[in] items list of playlist items
+ * @param[in] count number of items in the list of playlist
+ *
+ * @{
+ */
+void playlist_insert_items(instance_t* app, int idx, playlist_item_t* items, int count);
+/** @} */
+
+/**
+ * @anchor playlist_get_selected_items_idx
+ *
+ * function tries to get list of indexes of selected items
+ *
+ * @param[in] app application instance handle
+ * @param[out] count number of items in list
+ *
+ * @return NULL if no items selected otherwise return pointer
+ * to the list of array of integers with items indexes selected
+ * and set count variable to the number of items in list
+ *
+ * @{
+ */
+int* playlist_get_selected_items_idx(instance_t* app, int *count);
+/** @} */
+
+/**
+ * @anchor playlist_get_block
+ *
+ * function tries to find block range that include given playlist index
+ *
+ * @param[in] app application instance handle
+ * @param[in] idx playlist item index
+ * @param[out] pstart pointer where index of first item of block will be stored
+ * @param[out] pstart pointer where index of last item of block will be stored
+ *
+ * @return -1 if no range found, otherwise number of items in a block
+ *
+ * @{
+ */
+int playlist_get_block(instance_t* app, int idx, int* pstart, int* pstop);
+/** @} */
+
+
+/**
+ * @anchor playlist_get_player_at_pos
+ *
+ * function find a player associated with playlist item
+ *
+ * @param[in] app application instance handle
+ * @param[in] idx playlist item index
+ *
+ * @return NULL if item not assiciated with player, otherwise player struct
+ *
+ * @{
+ */
+player_t *playlist_get_player_at_pos(instance_t* app, int pos);
+/** @} */
+
+/**
+ * @anchor playlist_get_first_selected_item_idx
+ *
+ * function tries to get index of first selected item
+ *
+ * @param[in] app application instance handle
+ *
+ * @return -1 if no items selected otherwise return index of
+ * selected item
+ *
+ * @{
+ */
+int playlist_get_first_selected_item_idx(instance_t* app);
+/** @} */
+
+
+/**
+ * @anchor playlist_delete_items
+ *
+ * function delete list of items
+ *
+ * @param[in] app application instance handle
+ * @param[in] idxs list of indexes to delete
+ * @param[in] count number of indexes in the list
+ * @param[in] sel flag used to change playlist selection
+ * on first item after delete operation
+ *
+ * @{
+ */
+void playlist_delete_items(instance_t* app, int* idxs, int count, int sel);
+/** @} */
+
+/**
+ * @anchor playlist_delete_selected_items
+ *
+ * function delete selected items
+ *
+ * @param[in] app application instance handle
+ *
+ * @{
+ */
+void playlist_delete_selected_items(instance_t* app);
+/** @} */
+
+/**
+ * @anchor playlist_item_index
+ *
+ * @{
+ */
+int playlist_item_index(instance_t* app, int start, int idx);
+/** @} */
+
+
+/**
+ * @anchor playlist_block
+ *
+ * function change block type of events
+ *
+ * @param[in] app application instance handle
+ * @param[in] loop flag indicating that loop type will be used
+ *
+ * @{
+ */
+void playlist_block(instance_t* app, int loop);
+/** @} */
+
+
+/**
+ * @anchor playlist_item_copy
+ *
+ * function copy selected items from playlist into the clipboard
+ *
+ * @param[in] app application instance handle
+ *
+ * @{
+ */
+void playlist_item_copy(instance_t* app);
+/** @} */
+
+
+/**
+ * @anchor playlist_item_paste
+ *
+ * function insert items from clipboard to playlist
+ *
+ * @param[in] app application instance handle
+ * @param[in] after flag indicating that insertion is after selected
+ *
+ * @{
+ */
+void playlist_item_paste(instance_t* app, int after);
+/** @} */
+
+
+/**
+ * @anchor playlist_item_swap
+ *
+ * swap first selected item with next or previous item
+ *
+ * @param[in] app application instance handle
+ * @param[in] dir swap direction
+ *
+ * @{
+ */
+void playlist_item_swap(instance_t* app, int dir);
+/** @} */
+
+void playlist_save(instance_t* app);
+void playlist_load(instance_t* app);
+void playlist_item_edit(instance_t* app);
+void playlist_item_add(instance_t* app, int after);
+void playlist_relink(instance_t* app);
+void playlist_item_add_from_library(instance_t* app, int after);
+
+#ifdef __cplusplus
+};
+#endif /* __cplusplus */
+
+#endif /* PLAYLIST_H */