checkbox with image arrow for playing item display
[rugen] / src / page_clips.c
index aeefc74..ac536ab 100644 (file)
@@ -43,10 +43,6 @@ typedef struct
        int unit;
        int generation;
        int clip;
-       
-       // TODO: This comes out later
-       int mode;
-       GtkWidget *modes[ 4 ];
 
        struct page_t *parent_page;
 }
@@ -158,53 +154,54 @@ static void list_queue( page_clips this, int clip )
                GtkTreeViewColumn *column;
 
                list_store = gtk_list_store_new( 6,
-                       G_TYPE_BOOLEAN,
+                       GDK_TYPE_PIXBUF,
                        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( );
-               column = gtk_tree_view_column_new_with_attributes ( "", renderer, "active", 0, NULL);
-               gtk_tree_view_append_column( GTK_TREE_VIEW( treeview ), column );       
-               
+
+               renderer = gtk_cell_renderer_pixbuf_new( );
+               column = gtk_tree_view_column_new_with_attributes ( "", renderer, "pixbuf", 0, NULL);
+               gtk_tree_view_append_column( GTK_TREE_VIEW( treeview ), column );
+
                renderer = gtk_cell_renderer_text_new( );
-               column = gtk_tree_view_column_new_with_attributes ( "In", renderer, "text", 1, NULL);
+               column = gtk_tree_view_column_new_with_attributes ( "Clip", renderer, "text", 1, NULL);
                gtk_tree_view_append_column( GTK_TREE_VIEW( treeview ), column );
-               
+
                renderer = gtk_cell_renderer_text_new( );
-               column = gtk_tree_view_column_new_with_attributes ( "Out", renderer, "text", 2, NULL);
+               column = gtk_tree_view_column_new_with_attributes ( "In", renderer, "text", 2, NULL);
                gtk_tree_view_append_column( GTK_TREE_VIEW( treeview ), column );
-               
+
                renderer = gtk_cell_renderer_text_new( );
-               column = gtk_tree_view_column_new_with_attributes ( "Length", renderer, "text", 3, NULL);
+               column = gtk_tree_view_column_new_with_attributes ( "Out", renderer, "text", 3, NULL);
                gtk_tree_view_append_column( GTK_TREE_VIEW( treeview ), column );
-               
+
                renderer = gtk_cell_renderer_text_new( );
-               column = gtk_tree_view_column_new_with_attributes ( "Clip", renderer, "text", 4, NULL);
+               column = gtk_tree_view_column_new_with_attributes ( "Length", renderer, "text", 4, NULL);
                gtk_tree_view_append_column( GTK_TREE_VIEW( treeview ), column );
+
        }
        else
        {
                list_store = GTK_LIST_STORE( gtk_tree_view_get_model( GTK_TREE_VIEW( treeview ) ) );
                gtk_list_store_clear( list_store );
        }
-       
+
        this->generation = list->generation;
-       
+
        for ( index = 0; index < mvcp_list_count( list ); index ++ )
        {
                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, frames2tc( entry.in, entry.fps, tc1),
-                       2, frames2tc( entry.out, entry.fps, tc2),
-                       3, frames2tc( entry.size, entry.fps, tc3),
-                       4, entry.full,
+                       0, this->app->playing[(index == clip)?1:0],
+                       1, entry.full,
+                       2, frames2tc( entry.in, entry.fps, tc1),
+                       3, frames2tc( entry.out, entry.fps, tc2),
+                       4, frames2tc( entry.size, entry.fps, tc3),
                        5, entry.clip,
                        -1 );
        }
@@ -216,7 +213,7 @@ static void list_queue( page_clips this, int clip )
                gtk_tree_view_scroll_to_cell( GTK_TREE_VIEW( treeview ), path, NULL, TRUE, 0.5, 0 );
                gtk_tree_path_free( path );
        }
-       
+
        mvcp_list_close( list );
 }
 
@@ -229,14 +226,14 @@ static void list_active( page_clips this, int clip )
 
        gtk_tree_model_get_iter( GTK_TREE_MODEL (list_store), &iter, path );
        gtk_tree_path_free( path );
-       gtk_list_store_set( list_store, &iter, 0, FALSE, -1 );
+       gtk_list_store_set( list_store, &iter, 0, this->app->playing[0], -1 );
        
        this->clip = clip;
        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_model_get_iter( GTK_TREE_MODEL (list_store), &iter, path );
        gtk_tree_path_free( path );
-       gtk_list_store_set( list_store, &iter, 0, TRUE, -1 );
+       gtk_list_store_set( list_store, &iter, 0, this->app->playing[1], -1 );
 }
 
 static gboolean on_ok( GtkWidget *dummy, gpointer data )
@@ -265,35 +262,7 @@ static gboolean on_ok( GtkWidget *dummy, gpointer data )
                        char *temp = malloc( strlen( this->path ) + strlen( text ) + 1 );
                        strcpy( temp, this->path );
                        strcat( temp, text );
-                       switch( this->mode )
-                       {
-                               case 0:
-                                       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: 
-                                       mvcp_unit_load( this->dv, dv1394app_get_selected_unit( this->app ), temp );
-                                       break;
-                               case 2: 
-                                       mvcp_unit_append( this->dv, dv1394app_get_selected_unit( this->app ), temp, -1, -1 );
-                                       break;
-                               case 3:
-                               {
-                                       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;
-                               }
-                       }
-                       
+                       mvcp_unit_append( this->dv, dv1394app_get_selected_unit( this->app ), temp, -1, -1 );
                        free( temp );
                }
                        
@@ -351,8 +320,8 @@ static gboolean on_queue_item( GtkWidget *dummy, gpointer data )
        if ( gtk_tree_selection_get_selected( select, &model, &iter ) )
        {
                gtk_tree_model_get( model, &iter, 5, &clip,     -1 );
+               mvcp_unit_pause( 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;
@@ -475,18 +444,6 @@ static gboolean on_clean( GtkWidget *dummy, gpointer data )
        return TRUE;
 }
 
-void on_mode_change( GtkMenuItem *menuitem, gpointer data )
-{
-       page_clips this = data;
-       int index = 0;
-       
-       for ( index = 0; index < 4; index ++ )
-               if ( GTK_WIDGET( menuitem ) == this->modes[ index ] )
-                       break;
-       
-       this->mode = index;
-}
-
 static GtkWidget *this_page_get_widget( page_clips this )
 {
        if ( this->widget == NULL )
@@ -539,7 +496,6 @@ page page_clips_init( dv1394app app, struct page_t *parent_page)
 {
        page_clips this = calloc( 1, sizeof( page_clips_t ) );
        GtkWidget *widget;
-       int index = 0;
 
        this->parent_page = parent_page;
        this->parent.get_widget = ( GtkWidget *(*)( page ) )this_page_get_widget;
@@ -578,14 +534,5 @@ page page_clips_init( dv1394app app, struct page_t *parent_page)
        g_signal_connect( G_OBJECT( widget ), "button-press-event", G_CALLBACK( on_queue_selected ), this );
        g_signal_connect( G_OBJECT( widget ), "key-press-event", G_CALLBACK( on_queue_key_press ), this );
 
-       for ( index = 0; index < 4; index ++ )
-       {
-               char item[ 256 ];
-               sprintf( item, "mode_%d", index );
-               widget = lookup_widget( this_page_get_widget( this ), item );
-               gtk_signal_connect( GTK_OBJECT( widget ), "activate", GTK_SIGNAL_FUNC( on_mode_change ), this );
-               this->modes[ index ] = widget;
-       }
-       
        return ( page )this;
 }