/*
* page_clips.c -- Clips Page Handling
* Copyright (C) 2002-2003 Charles Yates <charles.yates@pandora.be>
+ * Copyright (C) 2010 Dan Dennedy <dan@dennedy.org>
*
* 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
#include "interface.h"
#include "support.h"
#include "dv1394app.h"
-#include "util.h"
#include "page.h"
typedef struct
struct page_t parent;
dv1394app app;
GtkWidget *widget;
- valerie dv;
+ mvcp dv;
char *path;
int unit;
int generation;
GtkWidget *label = lookup_widget( this_page_get_widget( this ), "label_directory" );
if ( path != NULL )
{
- valerie_dir dir = valerie_dir_init( this->dv, path );
+ mvcp_dir dir = mvcp_dir_init( this->dv, path );
GtkListStore *dir_store = NULL;
GtkListStore *clip_store = NULL;
GtkTreeIter iter;
int index;
- valerie_dir_entry_t entry;
+ mvcp_dir_entry_t entry;
free( this->path );
this->path = strdup( path );
gtk_list_store_set( dir_store, &iter, 0, "..", -1 );
}
- for ( index = 0; index < valerie_dir_count( dir ); index ++ )
+ for ( index = 0; index < mvcp_dir_count( dir ); index ++ )
{
- valerie_dir_get( dir, index, &entry );
+ mvcp_dir_get( dir, index, &entry );
if ( strchr( entry.name, '/' ) )
{
gtk_list_store_append( dir_store, &iter );
}
}
- valerie_dir_close( dir );
+ mvcp_dir_close( dir );
}
else
{
static void list_queue( page_clips this, int clip )
{
GtkWidget *treeview = lookup_widget( this_page_get_widget( this ), "treeview1" );
- valerie_list list = valerie_list_init( this->dv, dv1394app_get_selected_unit( this->app ) );
+ mvcp_list list = mvcp_list_init( this->dv, dv1394app_get_selected_unit( this->app ) );
GtkListStore *list_store = NULL;
GtkTreeIter iter;
GtkTreePath *path;
int index;
- valerie_list_entry_t entry;
+ mvcp_list_entry_t entry;
if ( gtk_tree_view_get_model( GTK_TREE_VIEW( treeview ) ) == NULL )
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
- list_store = gtk_list_store_new( 6, G_TYPE_BOOLEAN, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT );
+ list_store = gtk_list_store_new( 6,
+ G_TYPE_BOOLEAN,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_INT );
gtk_tree_view_set_model( GTK_TREE_VIEW( treeview ), GTK_TREE_MODEL( list_store ) );
renderer = gtk_cell_renderer_toggle_new( );
this->generation = list->generation;
- for ( index = 0; index < valerie_list_count( list ); index ++ )
+ for ( index = 0; index < mvcp_list_count( list ); index ++ )
{
- valerie_list_get( list, index, &entry );
+ char tc1[12], tc2[12], tc3[12];
+ mvcp_list_get( list, index, &entry );
gtk_list_store_append( list_store, &iter );
- gtk_list_store_set( list_store, &iter, 0, index == clip, 1, ( int )entry.in, 2, ( int )entry.out, 3, ( int )entry.size, 4, entry.full, 5, entry.clip, -1 );
+ gtk_list_store_set( list_store, &iter,
+ 0, index == clip,
+ 1, frames2tc( entry.in, entry.fps, tc1),
+ 2, frames2tc( entry.out, entry.fps, tc2),
+ 3, frames2tc( entry.size, entry.fps, tc3),
+ 4, entry.full,
+ 5, entry.clip,
+ -1 );
}
this->clip = clip;
- if ( clip < valerie_list_count( list ) )
+ if ( clip < mvcp_list_count( list ) )
{
path = gtk_tree_path_new_from_indices( this->clip, -1 );
gtk_tree_view_scroll_to_cell( GTK_TREE_VIEW( treeview ), path, NULL, TRUE, 0.5, 0 );
gtk_tree_path_free( path );
}
- valerie_list_close( list );
+ mvcp_list_close( list );
}
static void list_active( page_clips this, int clip )
switch( this->mode )
{
case 0:
- valerie_unit_load_back( this->dv, dv1394app_get_selected_unit( this->app ), temp );
- valerie_unit_play( this->dv, dv1394app_get_selected_unit( this->app ) );
+ mvcp_unit_load_back( this->dv, dv1394app_get_selected_unit( this->app ), temp );
+ mvcp_unit_play( this->dv, dv1394app_get_selected_unit( this->app ) );
break;
case 1:
- valerie_unit_load( this->dv, dv1394app_get_selected_unit( this->app ), temp );
+ mvcp_unit_load( this->dv, dv1394app_get_selected_unit( this->app ), temp );
break;
case 2:
- valerie_unit_append( this->dv, dv1394app_get_selected_unit( this->app ), temp, -1, -1 );
+ mvcp_unit_append( this->dv, dv1394app_get_selected_unit( this->app ), temp, -1, -1 );
break;
case 3:
- valerie_unit_clip_insert( this->dv, dv1394app_get_selected_unit( this->app ), valerie_relative, 1, temp, -1, -1 );
+ {
+ GtkWidget *widget = lookup_widget( this_page_get_widget( this ), "treeview1" );
+ GtkTreeSelection *select = gtk_tree_view_get_selection( GTK_TREE_VIEW( widget ) );
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ int clip;
+
+ if ( gtk_tree_selection_get_selected( select, &model, &iter ) )
+ {
+ gtk_tree_model_get( model, &iter, 5, &clip, -1 );
+ mvcp_unit_clip_insert( this->dv, dv1394app_get_selected_unit( this->app ), mvcp_absolute, clip, temp, -1, -1 );
+ }
break;
+ }
}
free( temp );
if ( gtk_tree_selection_get_selected( select, &model, &iter ) )
{
gtk_tree_model_get( model, &iter, 5, &clip, -1 );
- valerie_unit_clip_goto( this->dv, dv1394app_get_selected_unit( this->app ), valerie_absolute, clip, 0 );
- valerie_unit_play( this->dv, dv1394app_get_selected_unit( this->app ) );
+ mvcp_unit_clip_goto( this->dv, dv1394app_get_selected_unit( this->app ), mvcp_absolute, clip, 0 );
+ mvcp_unit_play( this->dv, dv1394app_get_selected_unit( this->app ) );
}
return TRUE;
static gboolean on_up( GtkWidget *dummy, gpointer data )
{
page_clips this = data;
- valerie_unit_clip_move( this->dv, dv1394app_get_selected_unit( this->app ), valerie_relative, 0, valerie_relative, -1 );
+ GtkWidget *widget = lookup_widget( this_page_get_widget( this ), "treeview1" );
+ GtkTreeSelection *select = gtk_tree_view_get_selection( GTK_TREE_VIEW( widget ) );
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ int clip;
+
+ if ( gtk_tree_selection_get_selected( select, &model, &iter ) )
+ {
+ gtk_tree_model_get( model, &iter, 5, &clip, -1 );
+ mvcp_unit_clip_move( this->dv, dv1394app_get_selected_unit( this->app ), mvcp_absolute, clip, mvcp_absolute, clip - 1 < 0 ? 0 : clip - 1 );
+ }
return TRUE;
}
static gboolean on_down( GtkWidget *dummy, gpointer data )
{
page_clips this = data;
- valerie_unit_clip_move( this->dv, dv1394app_get_selected_unit( this->app ), valerie_relative, 0, valerie_relative, 1 );
+ GtkWidget *widget = lookup_widget( this_page_get_widget( this ), "treeview1" );
+ GtkTreeSelection *select = gtk_tree_view_get_selection( GTK_TREE_VIEW( widget ) );
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ int clip;
+
+ if ( gtk_tree_selection_get_selected( select, &model, &iter ) )
+ {
+ gtk_tree_model_get( model, &iter, 5, &clip, -1 );
+ mvcp_unit_clip_move( this->dv, dv1394app_get_selected_unit( this->app ), mvcp_absolute, clip, mvcp_absolute, clip + 1 );
+ }
return TRUE;
}
static gboolean on_remove( GtkWidget *dummy, gpointer data )
{
page_clips this = data;
- valerie_unit_remove_current_clip( this->dv, dv1394app_get_selected_unit( this->app ) );
+ GtkWidget *widget = lookup_widget( this_page_get_widget( this ), "treeview1" );
+ GtkTreeSelection *select = gtk_tree_view_get_selection( GTK_TREE_VIEW( widget ) );
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ int clip;
+
+ if ( gtk_tree_selection_get_selected( select, &model, &iter ) )
+ {
+ gtk_tree_model_get( model, &iter, 5, &clip, -1 );
+ mvcp_unit_clip_remove( this->dv, dv1394app_get_selected_unit( this->app ), mvcp_absolute, clip );
+ }
return TRUE;
}
static gboolean on_clean( GtkWidget *dummy, gpointer data )
{
page_clips this = data;
- valerie_unit_clean( this->dv, dv1394app_get_selected_unit( this->app ) );
+ mvcp_unit_clean( this->dv, dv1394app_get_selected_unit( this->app ) );
return TRUE;
}
static void this_page_get_toolbar_info( page this, GtkIconSize size, GtkWidget **icon, char **label )
{
- *icon = gtk_image_new_from_stock( "gtk-find", size );
- *label = "_Clips";
+ *icon = gtk_image_new_from_stock( "gtk-justify-fill", size );
+ *label = _("_Playlist");
}
static void this_page_on_connect( page_clips this )
{
- this->dv = valerie_init( dv1394app_get_parser( this->app ) );
+ this->dv = mvcp_init( dv1394app_get_parser( this->app ) );
list_clips( this, "/" );
}
static void this_page_on_disconnect( page_clips this )
{
list_clips( this, NULL );
- valerie_close( this->dv );
+ mvcp_close( this->dv );
}
-static void this_page_show_status( page_clips this, valerie_status status )
+static void this_page_show_status( page_clips this, mvcp_status status )
{
if ( status->status != unit_disconnected )
{
this->parent.on_connect = ( void (*)( page ) )this_page_on_connect;
this->parent.on_unit_change = ( void (*)( page, int ) )this_page_on_unit_change;
this->parent.on_disconnect = ( void (*)( page ) )this_page_on_disconnect;
- this->parent.show_status = ( void (*)( page, valerie_status ) )this_page_show_status;
+ this->parent.show_status = ( void (*)( page, mvcp_status ) )this_page_show_status;
this->parent.close = ( void (*)( page ) )this_page_close;
this->app = app;
this->generation = -1;