OmPlrClipInfo clip_info;
char clip_name[omPlrMaxClipDirLen];
+ app->library.id_display_idx = 0;
+
pthread_mutex_lock(&app->players.lock);
r = OmPlrClipGetFirst((OmPlrHandle)app->players.item[0].handle, clip_name, sizeof(clip_name));
gdk_threads_enter();
pthread_mutex_lock(&player->app->playlist.lock);
pthread_mutex_lock(&player->app->players.lock);
- if(curr->state == omPlrStatePlay || curr->state == omPlrStateCuePlay)
+
+ /* check if playlist exist */
+ if(player->playlist_length)
{
- idx = find_index_of_playlist_item(player->app, player->playlist_start, curr->currClipNum);
- if(idx >= 0)
- {
- frames2tc(curr->currClipStartPos + curr->currClipLen - curr->pos, 25.0, tc_rem);
- omnplay_playlist_draw_item_rem(player->app, idx, tc_rem);
- }
+ /* clear remain on "previous" item */
if(curr->currClipNum != prev->currClipNum && 1 != prev->numClips)
{
tc_rem[0] = 0;
if(idx >= 0)
omnplay_playlist_draw_item_rem(player->app, idx, tc_rem);
};
- }
- else
- {
- tc_rem[0] = 0;
+
+ /* update current item */
idx = find_index_of_playlist_item(player->app, player->playlist_start, curr->currClipNum);
if(idx >= 0)
+ {
+ /* reset value */
+ tc_rem[0] = 0;
+
+ /* for play and cue calc new value */
+ if(curr->state == omPlrStatePlay || curr->state == omPlrStateCuePlay)
+ frames2tc(curr->currClipStartPos + curr->currClipLen - curr->pos, 25.0, tc_rem);
+
+ /* setup that value */
omnplay_playlist_draw_item_rem(player->app, idx, tc_rem);
- idx = find_index_of_playlist_item(player->app, player->playlist_start, prev->currClipNum);
- if(idx >= 0)
- omnplay_playlist_draw_item_rem(player->app, idx, tc_rem);
+ };
};
pthread_mutex_unlock(&player->app->players.lock);
pthread_mutex_unlock(&player->app->playlist.lock);
list[0] = list[0] + 1;
};
-static int* get_selected_items_playlist(omnplay_instance_t* app)
+int* omnplay_selected_idxs_playlist(omnplay_instance_t* app)
{
int* list = NULL;
GtkTreeSelection *selection;
static void omnplay_playlist_block(omnplay_instance_t* app, control_buttons_t button)
{
int start, stop, r, i;
- int* list = get_selected_items_playlist(app);
+ int* list = omnplay_selected_idxs_playlist(app);
if(!list)
return;
static int get_first_selected_item_playlist(omnplay_instance_t* app)
{
int idx;
- int* list = get_selected_items_playlist(app);
+ int* list = omnplay_selected_idxs_playlist(app);
if(!list) return -1;
idx = list[1];
free(list);
int i, idx, c;
int *list, *list2;
- list = get_selected_items_playlist(app);
+ list = omnplay_selected_idxs_playlist(app);
if(!list) return;
list2 = (int*)malloc(sizeof(int) * list[0]);
omnplay_playlist_draw(app);
/* select */
- path = gtk_tree_path_new_from_indices(idx + count, -1);
+ path = gtk_tree_path_new_from_indices(idx, -1);
gtk_tree_selection_select_path(gtk_tree_view_get_selection(GTK_TREE_VIEW(app->playlist_grid)), path);
gtk_tree_view_set_cursor(GTK_TREE_VIEW(app->playlist_grid), path, NULL, FALSE);
gtk_tree_path_free(path);
{
int *list, i;
- list = get_selected_items_playlist(app);
+ list = omnplay_selected_idxs_playlist(app);
if(!list) return;
for(i = 0; i < list[0]; i++)
static gboolean on_playlist_grid_button(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
+ omnplay_instance_t* app = (omnplay_instance_t*)data;
+
// g_warning("on_playlist_grid_button");
if(event->button==1 && event->type==GDK_2BUTTON_PRESS)
{
- omnplay_ctl((omnplay_instance_t* )data, BUTTON_PLAYER_CUE);
+ omnplay_playlist_item_edit(app);
return TRUE;
};
playlist_item_t* items;
omnplay_instance_t* app = (omnplay_instance_t*)userdata;
- list = get_selected_items_playlist(app);
+ list = omnplay_selected_idxs_playlist(app);
if(!list) return;
/* clear delete flag */
free(list);
};
+/*
+ * http://www.mail-archive.com/mahogany-users@lists.sourceforge.net/msg00286.html
+ */
+static gboolean playlist_grid_drag_motion(GtkWidget *widget, GdkDragContext *context,
+ gint x, gint y, guint time, gpointer data)
+{
+ gboolean same;
+ GtkWidget *source_widget;
+
+ g_warning("playlist_grid_drag_motion");
+
+ /* Get source widget and check if it is the same as the
+ * destination widget.
+ */
+ source_widget = gtk_drag_get_source_widget(context);
+ same = ((source_widget == widget) ? TRUE : FALSE);
+
+ /* Put additional checks here, perhaps if same is FALSE then
+ * set the default drag to GDK_ACTION_COPY.
+ */
+
+ /* Say we just want to allow GDK_ACTION_MOVE, first we check
+ * if that is in the list of allowed actions on the dc. If
+ * so then we set it to that. Note if the user holds down the
+ * ctrl key then the only flag in dc->actions will be
+ * GDK_ACTION_COPY. The constraint for dc->actions is that
+ * specified from the given actions in gtk_drag_dest_set() and
+ * gtk_drag_source_set().
+ */
+ if(same)
+ {
+ if(context->actions == GDK_ACTION_MOVE)
+ gdk_drag_status(context, GDK_ACTION_COPY, time);
+ else
+ gdk_drag_status(context, GDK_ACTION_MOVE, time);
+ }
+ else
+ gdk_drag_status(context, context->actions, time);
+
+ return(TRUE);
+}
+
void omnplay_init(omnplay_instance_t* app)
{
int i;
gtk_drag_source_set(app->playlist_grid, GDK_BUTTON1_MASK,
drag_targets, 1, (GdkDragAction)(GDK_ACTION_COPY | GDK_ACTION_MOVE));
- gtk_drag_dest_set(app->playlist_grid, GTK_DEST_DEFAULT_ALL,
+ gtk_drag_dest_set(app->playlist_grid, (GtkDestDefaults)(GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP),
drag_targets, 1, (GdkDragAction)(GDK_ACTION_COPY | GDK_ACTION_MOVE));
g_signal_connect (app->library_grid, "drag_data_get", G_CALLBACK(library_grid_drag_data_get_cb), app);
g_signal_connect (app->playlist_grid, "drag_begin", G_CALLBACK(playlist_grid_drag_begin_cb), app);
g_signal_connect (app->playlist_grid, "drag_data_received", G_CALLBACK (playlist_grid_drag_data_received), app);
g_signal_connect (app->playlist_grid, "drag_data_delete", G_CALLBACK (playlist_grid_drag_data_delete), app);
+ g_signal_connect (app->playlist_grid, "drag_motion", G_CALLBACK (playlist_grid_drag_motion), app);
};
void omnplay_release(omnplay_instance_t* app)