Update ProductionView
authorMatthieu Totet
Fri, 11 Dec 2009 10:48:58 +0100
changeset 20 c2dd8119a6c1
parent 19 7d044e7562ea
child 21 253f142174ac
Update ProductionView
client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs
client/src/Iri.Modernisation.Controls/Iri.Modernisation.Controls.csproj
client/src/Iri.Modernisation.Controls/View/MenuableUserControl.cs
client/src/Iri.Modernisation.Controls/View/PolemicElement.xaml.cs
client/src/Iri.Modernisation.Controls/View/ProductionEditor/ProductionEditor.xaml
client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/CustomableIndexElement.xaml
client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/CustomableIndexElement.xaml.cs
client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/CustomableVideoElement.xaml
client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml
client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs
client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml
client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml.cs
client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/CustomableIndexElementVM.cs
client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/CustomableVideoElementVM.cs
client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs
client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs
client/src/Iri.Modernisation.Data/Models/VideoSequence.cs
--- a/client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs	Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs	Fri Dec 11 10:48:58 2009 +0100
@@ -494,6 +494,19 @@
             {
                 ClickAddSelectedRecord = new Command("ClickAddSelectedRecord");
                 VideoRecordUpdated = new Command("VideoRecordUpdated");
+                DelVideoSequence = new Command("DelVideoSequence");
+                ClickAddIndex = new Command("ClickAddIndex");
+
+            }
+            public static Command ClickAddIndex
+            {
+                get;
+                private set;
+            }
+            public static Command DelVideoSequence
+            {
+                get;
+                private set;
             }
             public static Command ClickAddSelectedRecord
             {
--- a/client/src/Iri.Modernisation.Controls/Iri.Modernisation.Controls.csproj	Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/Iri.Modernisation.Controls.csproj	Fri Dec 11 10:48:58 2009 +0100
@@ -85,6 +85,7 @@
     <Compile Include="ViewModel\NavigationBar\NavigationBarVM.cs" />
     <Compile Include="ViewModel\PolemicElementVM.cs" />
     <Compile Include="ViewModel\NavigationBar\ProductionMenuVM.cs" />
+    <Compile Include="ViewModel\ProductionTimeLine\CustomableIndexElementVM.cs" />
     <Compile Include="ViewModel\ProductionTimeLine\CustomableVideoElementVM.cs" />
     <Compile Include="ViewModel\ProductionTimeLine\ProductionTimeLineVM.cs" />
     <Compile Include="ViewModel\ProductionView\ProductionViewVM.cs" />
@@ -165,6 +166,9 @@
     <Compile Include="View\ProductionEditor\ProductionEditor.xaml.cs">
       <DependentUpon>ProductionEditor.xaml</DependentUpon>
     </Compile>
+    <Compile Include="View\ProductionTimeLine\CustomableIndexElement.xaml.cs">
+      <DependentUpon>CustomableIndexElement.xaml</DependentUpon>
+    </Compile>
     <Compile Include="View\ProductionTimeLine\CustomableVideoElement.xaml.cs">
       <DependentUpon>CustomableVideoElement.xaml</DependentUpon>
     </Compile>
@@ -279,6 +283,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:MarkupCompilePass1</Generator>
     </Page>
+    <Page Include="View\ProductionTimeLine\CustomableIndexElement.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:MarkupCompilePass1</Generator>
+    </Page>
     <Page Include="View\ProductionTimeLine\CustomableVideoElement.xaml">
       <Generator>MSBuild:MarkupCompilePass1</Generator>
       <SubType>Designer</SubType>
--- a/client/src/Iri.Modernisation.Controls/View/MenuableUserControl.cs	Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/MenuableUserControl.cs	Fri Dec 11 10:48:58 2009 +0100
@@ -41,6 +41,7 @@
 
         void MenuableUserControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
+            if(this.IsEnabled)
             ((MenuableViewModel)base.DataContext).MenuableUserControl_MouseLeftButtonDown(sender,e);
         }
       
--- a/client/src/Iri.Modernisation.Controls/View/PolemicElement.xaml.cs	Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/PolemicElement.xaml.cs	Fri Dec 11 10:48:58 2009 +0100
@@ -26,7 +26,6 @@
 
         void PolemicElementControl_MouseEnter(object sender, MouseEventArgs e)
         {
-          
             //throw new NotImplementedException();
         }
 
--- a/client/src/Iri.Modernisation.Controls/View/ProductionEditor/ProductionEditor.xaml	Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionEditor/ProductionEditor.xaml	Fri Dec 11 10:48:58 2009 +0100
@@ -8,12 +8,10 @@
             <Button x:Name="ProductionViewerDisplayWebcamButton"  Width="75" Content="Webcam"/>
         </StackPanel>
         <View:VideoViewer Margin="0,0,24,0"  Height="227"/> 
-        <StackPanel x:Name="DescriptionSegmentPanel" Height="114">
-            <TextBlock Style="{StaticResource CommonTextBlock}" x:Name="TitleSegmentLabel" Text="Title Segment" TextWrapping="Wrap" Height="16" Margin="0,0,8,0"/>
-            <ScrollViewer x:Name="DescriptionSegmentScroller" Height="73"  Margin="0,0,8,0">
-                <TextBlock Style="{StaticResource CommonTextBlock}" x:Name="DescriptionSegmentLabel"  Text="Desc Segment" TextWrapping="Wrap" Height="130"/>
-            </ScrollViewer>
-            <TextBlock Style="{StaticResource CommonTextBlock}" x:Name="KeyWordLabel" Text="KeyWord Segment" TextWrapping="Wrap" Height="21" Margin="0,0,8,0"/>
+        <StackPanel x:Name="DescriptionSegmentPanel" Height="128">
+            <TextBox x:Name="TitleSegmentLabel" Text="Title Segment" TextWrapping="Wrap" Height="24" Margin="0,0,8,0"/>
+            <TextBox  x:Name="DescriptionSegmentLabel"  Text="Desc Segment" TextWrapping="Wrap" Height="64" AcceptsReturn="True" VerticalScrollBarVisibility="Visible"/>
+            <TextBox  x:Name="KeyWordLabel" Text="KeyWord Segment" TextWrapping="Wrap" Height="24" Margin="0,0,8,0"/>
         </StackPanel>
     </StackPanel>
 </UserControl>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/CustomableIndexElement.xaml	Fri Dec 11 10:48:58 2009 +0100
@@ -0,0 +1,33 @@
+<UserControl
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
+             xmlns:Converter="clr-namespace:Iri.Modernisation.Controls.Converter"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+    
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+    x:Class="Iri.Modernisation.Controls.View.CustomableIndexElement"
+    BorderBrush="Black"  Width="{Binding Duration}" mc:Ignorable="d">
+    <UserControl.Resources>
+        <Converter:PolemicTypeColorConverter x:Key="PolemicTypeColorConverter"/>
+    </UserControl.Resources>
+    <Grid x:Name="LayoutRoot">
+        <ToolTipService.ToolTip>
+            <StackPanel Orientation="Horizontal">
+                <TextBlock Text="{Binding TimerIn}"/>
+                <TextBlock Text="|- "/>
+                <TextBlock Text="{Binding Duration}"/>
+                <TextBlock Text="-| "/>
+                <TextBlock Text="{Binding TimerOut}"/>
+
+            </StackPanel>
+
+        </ToolTipService.ToolTip>
+        <Rectangle Fill="{Binding Chapter, Converter={StaticResource PolemicTypeColorConverter}, Mode=TwoWay}" Stroke="Black" StrokeThickness="0"/>
+        <Rectangle Fill="Black" Stroke="Black" StrokeThickness="0" HorizontalAlignment="Left" Width="2" Cursor="SizeWE" d:LayoutOverrides="HorizontalAlignment"/>
+        <Rectangle Fill="Black" Stroke="Black" StrokeThickness="0" HorizontalAlignment="Right" Width="2" Cursor="SizeWE" d:LayoutOverrides="HorizontalAlignment"/>
+        <Rectangle Fill="Black" Stroke="Black" StrokeThickness="0" Height="2" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="8"/>
+        <Rectangle Fill="Black" Stroke="Black" StrokeThickness="0" Height="2" HorizontalAlignment="Left" VerticalAlignment="Top" Width="8"/>
+        <Rectangle Fill="Black" Stroke="Black" StrokeThickness="0" Height="2" HorizontalAlignment="Right" VerticalAlignment="Top" Width="8"/>
+        <Rectangle Fill="Black" Stroke="Black" StrokeThickness="0" Height="2" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="8"/>
+    </Grid>
+</UserControl>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/CustomableIndexElement.xaml.cs	Fri Dec 11 10:48:58 2009 +0100
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using Iri.Modernisation.Controls.ViewModel;
+namespace Iri.Modernisation.Controls.View
+{
+    public partial class CustomableIndexElement : UserControl
+    {
+        
+
+
+
+        public double TrimRight
+        {
+            get { return (double)GetValue(TrimRightProperty); }
+            set
+            {
+                if (((CustomableIndexElementVM)DataContext).TimerOut>TimeSpan.Zero)
+                {
+                    SetValue(TrimRightProperty, value);
+                    ((CustomableIndexElementVM)DataContext).TimerOut = ((CustomableIndexElementVM)DataContext).TimerOut.Subtract(new TimeSpan(0, 0, 0, 0, (int)((value) / ProductionTimeLine.ScaleTime)));
+                    this.Width = ((CustomableIndexElementVM)DataContext).Duration;
+                }
+            }
+        }
+
+        // Using a DependencyProperty as the backing store for TrimRight.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty TrimRightProperty =
+            DependencyProperty.Register("TrimRight", typeof(double), typeof(CustomableIndexElement), null);
+
+        public CustomableIndexElement()
+        {
+            InitializeComponent();
+        }
+    }
+}
--- a/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/CustomableVideoElement.xaml	Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/CustomableVideoElement.xaml	Fri Dec 11 10:48:58 2009 +0100
@@ -2,7 +2,7 @@
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
              xmlns:Converter="clr-namespace:Iri.Modernisation.Controls.Converter"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Class="Iri.Modernisation.Controls.View.CustomableVideoElement"
-    BorderBrush="Black"  Width="{Binding Duration, Mode=OneTime}" mc:Ignorable="d">
+    BorderBrush="Black"  Width="{Binding Duration}" mc:Ignorable="d">
     <UserControl.Resources>
         <Converter:PolemicTypeColorConverter x:Key="PolemicTypeColorConverter"/>
     </UserControl.Resources>
--- a/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml	Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml	Fri Dec 11 10:48:58 2009 +0100
@@ -8,7 +8,7 @@
 	x:Class="Iri.Modernisation.Controls.View.ProductionTimeLine"
 	d:DesignWidth="640" Height="176">
 
-		<StackPanel x:Name="BookTimeLinePanel">
+		<StackPanel x:Name="BookTimeLinePanel" Background="#FF1C1C1C">
 		<StackPanel x:Name="HeaderBookTimeLinePanel" Orientation="Horizontal">
 			<Button x:Name="CutSequenceButton"  Content="Cut" Width="56"/>
 			<Button x:Name="InsertSequenceButton"  Width="58" Content="Ins"/>
--- a/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs	Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs	Fri Dec 11 10:48:58 2009 +0100
@@ -10,7 +10,7 @@
 using Iri.Modernisation.BaseMVVM.Commands;
 using Iri.Modernisation.Data.Models;
 using Iri.Modernisation.Controls.ViewModel;
-using SLExtensions.Collections.ObjectModel;
+using System.Collections.ObjectModel;
 namespace Iri.Modernisation.Controls.View
 {
   
@@ -27,11 +27,17 @@
 		{
 			// Required to initialize variables
 			InitializeComponent();
+            Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartSelected_Executed);
             Commands.ProductionView.VideoRecordUpdated.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(VideoRecordUpdated_Executed);
-             Commands.Action.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(Action_Executed);
+            Commands.Action.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(Action_Executed);
           
 		}
 
+        void EditorPartSelected_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+        {
+            UpdateElements();
+        }
+
         void VideoRecordUpdated_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
         {
           UpdateElements();
@@ -42,35 +48,108 @@
         {
             AddSequenceButton.Content = ((MouseEventArgs)e.Parameter).GetPosition(this).X;
         }
+        private double _sumOfLengh=0;
         public void UpdateElements()
         {
             if (DataContext != null)
             {
-                VideoTimeStrip.Children.Clear();
-                int intChapter = 0;
-                foreach(ObservableCollection<VideoSequence> Ocvs in  ((ProductionTimeLineVM)this.DataContext).ListVideoSequences)
+                if (((ProductionTimeLineVM)this.DataContext).SelectedChapter != -1)
                 {
-                    foreach (VideoSequence Vs in Ocvs)
+                    if (!((ProductionTimeLineVM)DataContext).IsIndexing)
                     {
-                        CustomableVideoElement _temp = new CustomableVideoElement()
+                        VideoTimeStrip.Children.Clear();
+                        int intChapter = 0;
+                        _sumOfLengh = 0;
+                        foreach (ObservableCollection<VideoSequence> Ocvs in ((ProductionTimeLineVM)this.DataContext).ListVideoSequences)
                         {
-                            DataContext = new CustomableVideoElementVM(Vs)
+                            
+                            foreach (VideoSequence Vs in Ocvs)
                             {
-                                Chapter = (VideoChapterType)intChapter
-                            },
-                        };
-                        _temp.MouseMove += new MouseEventHandler(CustomableVideoElement_MouseMove);
-                        _temp.MouseLeftButtonDown += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonDown);
-                        _temp.MouseLeftButtonUp += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonUp);
+                                CustomableVideoElement _temp = new CustomableVideoElement()
+                                {
+                                    DataContext = new CustomableVideoElementVM(Vs)
+                                    {
+                                        Chapter = (VideoChapterType)intChapter
+                                    },
+                                };
+                                _temp.MouseLeftButtonDown += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonDown);
+                                if ((VideoChapterType)intChapter == ((ProductionTimeLineVM)this.DataContext).SelectedBookChapter.Type)
+                                {
+                                    _temp.MouseMove += new MouseEventHandler(CustomableVideoElement_MouseMove);
 
-                        VideoTimeStrip.Children.Add(_temp);// TODO: Add event handler implementation here.
+                                    _temp.MouseLeftButtonUp += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonUp);
+                                }
+                                VideoTimeStrip.Children.Add(_temp);// TODO: Add event handler implementation here.
+                                _sumOfLengh += _temp.Width;
+                            }
+                            intChapter++;
+                        }
+                    }
+                    else
+                    {
+                        AnnotationTimeStrip.Children.Clear();
+                      
+                        foreach (ObservableCollection<SegmentIndex> Ocsi in ((ProductionTimeLineVM)this.DataContext).ListIndex)
+                        {
+                            foreach (SegmentIndex Si in Ocsi)
+                            {
+                                
+                                    // PolemicElementControl an = new PolemicElementControl() { IsEnabled = false };
+                                    CustomableIndexElement an = new CustomableIndexElement()
+                                    {
+                                        DataContext = new CustomableIndexElementVM(Si)
+                                    };
 
+                                    //an.DataContext = new PolemicElementVM(Si);
+
+                                    an.MouseLeftButtonDown += new MouseButtonEventHandler(an_MouseLeftButtonDown);
+                                    an.MouseMove += new MouseEventHandler(an_MouseMove);
+                                    an.MouseLeftButtonUp += new MouseButtonEventHandler(an_MouseLeftButtonUp);
+                                    //((ProductionTimeLineVM)DataContext).SelectedBookChapter);
+                                    AnnotationTimeStrip.Children.Add(an);
+                               
+                            }
+                            
+                        }
+                       
                     }
-                    intChapter++;
+                   
+
                 }
                 
+                
             }
         }
+
+        void an_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+        {
+            _isTrimRightCapturated = false;
+            _isTrimLeftCapturated = false;
+        }
+
+        void an_MouseMove(object sender, MouseEventArgs e)
+        {
+            if (((ProductionTimeLineVM)DataContext).IsIndexing)
+            {
+                if (e.GetPosition(AnnotationTimeStrip).X <= _sumOfLengh && _isTrimRightCapturated && ((CustomableIndexElement)sender).CaptureMouse())
+                {
+                    ((CustomableIndexElement)sender).TrimRight = _comePoint.X - e.GetPosition(((CustomableIndexElement)sender)).X;
+                    _comePoint = e.GetPosition(((CustomableIndexElement)sender));
+                }
+               
+            }
+        }
+        private CustomableIndexElement _selectedIndex;
+        void an_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            _selectedIndex = ((CustomableIndexElement)sender);
+            if (e.GetPosition(((CustomableIndexElement)sender)).X >= ((CustomableIndexElement)sender).Width - 5)
+            {
+                _comePoint = e.GetPosition(((CustomableIndexElement)sender));
+                _isTrimRightCapturated = true;
+            }
+           
+        }
         private void AddSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e)
         {
             Random rndNumbers = new Random();
@@ -101,15 +180,16 @@
                 else
                 {
                     VideoChapter vc = ((ProductionTimeLineVM)DataContext).SelectedBookChapter;
-                    PolemicElementControl an = new PolemicElementControl();
+                    PolemicElementControl an = new PolemicElementControl() { IsEnabled = false };
                     an.DataContext = new PolemicElementVM(new SegmentIndex(vc)
                         {
                             TimerIn = TimeSpan.Zero,
                             Duration = new TimeSpan(0, rndNumbers.Next(10, 60), 0),
                             Chapter = vc,
+                            
 
                         });
-                    
+                  
                         //((ProductionTimeLineVM)DataContext).SelectedBookChapter);
                     AnnotationTimeStrip.Children.Add(an);
                 }
@@ -134,16 +214,18 @@
         void CustomableVideoElement_MouseMove(object sender, MouseEventArgs e)
         {
 
-            
-            if (_isTrimRightCapturated && ((CustomableVideoElement)sender).CaptureMouse())
+            if (!((ProductionTimeLineVM)DataContext).IsIndexing)
             {
-                ((CustomableVideoElement)sender).TrimRight = _comePoint.X  - e.GetPosition(((CustomableVideoElement)sender)).X;
-                _comePoint = e.GetPosition(((CustomableVideoElement)sender));
-            }
-            else if (_isTrimLeftCapturated && ((CustomableVideoElement)sender).CaptureMouse())
-            {
-                ((CustomableVideoElement)sender).TrimLeft = e.GetPosition(((CustomableVideoElement)sender)).X - _comePoint.X;
-                _comePoint = e.GetPosition(((CustomableVideoElement)sender));
+                if (_isTrimRightCapturated && ((CustomableVideoElement)sender).CaptureMouse())
+                {
+                    ((CustomableVideoElement)sender).TrimRight = _comePoint.X - e.GetPosition(((CustomableVideoElement)sender)).X;
+                    _comePoint = e.GetPosition(((CustomableVideoElement)sender));
+                }
+                else if (_isTrimLeftCapturated && ((CustomableVideoElement)sender).CaptureMouse())
+                {
+                    ((CustomableVideoElement)sender).TrimLeft = e.GetPosition(((CustomableVideoElement)sender)).X - _comePoint.X;
+                    _comePoint = e.GetPosition(((CustomableVideoElement)sender));
+                }
             }
            
         }
@@ -170,7 +252,8 @@
 
         private void DeleteSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e)
         {
-            VideoTimeStrip.Children.Remove(_selected);
+            //VideoTimeStrip.Children.Remove(_selected);
+            Commands.ProductionView.DelVideoSequence.Execute(((CustomableVideoElement)_selected).DataContext);
         }
 	}
 }
\ No newline at end of file
--- a/client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml	Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml	Fri Dec 11 10:48:58 2009 +0100
@@ -14,9 +14,9 @@
 
     	<View:HeaderProduction DataContext="{Binding ViewModelHeaderProduction}" x:Name="HeaderProductionElement" HorizontalAlignment="Left" VerticalAlignment="Top" d:LayoutOverrides="VerticalAlignment"/>
     	<View:ProductionTimeLine x:Name="ProductionTimeLineElement" Height="176" VerticalAlignment="Bottom" DataContext="{Binding ViewModelProductionTimeLine}"/>
-    	<View:ProductionEditor Margin="272,115,0,0" HorizontalAlignment="Left" Height="369" VerticalAlignment="Top"/>
+    	<View:ProductionEditor Margin="272,115,0,0" HorizontalAlignment="Left" Height="381" VerticalAlignment="Top"/>
     	<View:VideoViewer HorizontalAlignment="Right" Margin="0,115,8,204" Width="404"/>
-    	<StackPanel x:Name="RecordsPanel" HorizontalAlignment="Left" Margin="8,264,0,216" Width="248">
+    	<StackPanel x:Name="RecordsPanel" HorizontalAlignment="Left" Margin="8,240,0,216" Width="248">
     		<TextBlock Style="{StaticResource CommonTextBlock}" Text="{Binding RecordsLabel, Source={StaticResource LangLabels}}" x:Name="RecordLabel" TextWrapping="Wrap"/>
     		<ListBox SelectedItem="{Binding SelectedVideoSequence,Mode=TwoWay}" x:Name="RecordsList" ItemsSource="{Binding RecordedVideoSequences}" Height="168">
 				<ListBox.ItemTemplate>
@@ -27,8 +27,9 @@
 					</DataTemplate>
 				</ListBox.ItemTemplate>
 			</ListBox>
-			<Button Content="+" x:Name="AddSelectedRecord" Input:CommandService.Command="ClickAddSelectedRecord"></Button>
-    	</StackPanel>
+			<Button Content="+ (Enregistrement)" x:Name="AddSelectedRecord" Input:CommandService.Command="ClickAddSelectedRecord"></Button>
+    		<Button Content="+ (Index)" x:Name="AddIndex" Input:CommandService.Command="ClickAddIndex"></Button>
+		</StackPanel>
 
     </Grid>
 </UserControl>
--- a/client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml.cs	Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml.cs	Fri Dec 11 10:48:58 2009 +0100
@@ -24,9 +24,6 @@
             //HeaderProductionElement.SelectedPart += new EventHandler<HeaderProductionEventArgs>(HeaderProductionElement_SelectedPart);
         }
 
-        void HeaderProductionElement_SelectedPart(object sender, HeaderProductionEventArgs e)
-        {
-            MessageBox.Show(e.ChapterType.ToString());
-        }
+     
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/CustomableIndexElementVM.cs	Fri Dec 11 10:48:58 2009 +0100
@@ -0,0 +1,96 @@
+using System;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Ink;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using Iri.Modernisation.Data.Models;
+using Iri.Modernisation.Controls.View;
+namespace Iri.Modernisation.Controls.ViewModel
+{
+    public class CustomableIndexElementVM : BaseMVVM.ViewModel.ViewModel
+    {
+        public CustomableIndexElementVM(SegmentIndex paramSeg)
+        {
+
+            _segmentIndex = paramSeg;
+
+            _timerIn = paramSeg.TimerIn;
+            _timerOut = paramSeg.TimerOut;
+  
+
+            OnPropertyChanged("Duration");
+        }
+
+        private SegmentIndex _segmentIndex;
+        public SegmentIndex SegmentIndex
+        {
+            get
+            {
+                return _segmentIndex;
+            }
+        }
+
+        private TimeSpan _timerIn;
+        public TimeSpan TimerIn
+        {
+            get
+            {
+                return _timerIn;
+            }
+            set
+            {
+                _timerIn = value;
+                _segmentIndex.TimerIn = value;
+                OnPropertyChanged(String.Empty);
+            }
+        }
+
+        private TimeSpan _timerOut;
+        public TimeSpan TimerOut
+        {
+            get
+            {
+                return _timerOut;
+            }
+            set
+            {
+                _timerOut = value;
+                _segmentIndex.TimerOut = value;
+                OnPropertyChanged(String.Empty);
+            }
+        }
+
+        
+        public double Duration
+        {
+            get
+            {
+                //MessageBox.Show(((TimeSpan)(TimerOut - TimerIn)).TotalMilliseconds.ToString());
+                return ((TimeSpan)(TimerOut - TimerIn)).TotalMilliseconds * ProductionTimeLine.ScaleTime;
+
+            }
+            
+        }
+
+        private VideoChapterType _chapter;
+        public VideoChapterType Chapter
+        {
+            get
+            {
+                return _segmentIndex.Chapter.Type;
+            }
+            set
+            {
+                _chapter = value;
+                OnPropertyChanged("Chapter");
+            }
+        }
+
+      
+    }
+}
--- a/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/CustomableVideoElementVM.cs	Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/CustomableVideoElementVM.cs	Fri Dec 11 10:48:58 2009 +0100
@@ -28,6 +28,13 @@
         }
 
         private VideoSequence _videoSequence;
+        public VideoSequence VideoSequence
+        {
+            get
+            {
+                return _videoSequence;
+            }
+        }
 
         private TimeSpan _runTime;
         public TimeSpan RunTime 
--- a/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs	Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs	Fri Dec 11 10:48:58 2009 +0100
@@ -13,7 +13,8 @@
 using Iri.Modernisation.BaseMVVM.ViewModel;
 using Iri.Modernisation.Controls.View;
 using System.Collections.Generic;
-using SLExtensions.Collections.ObjectModel;
+using System.Collections.ObjectModel;
+
 namespace Iri.Modernisation.Controls.ViewModel
 {
     public class ProductionTimeLineVM : BaseMVVM.ViewModel.ViewModel
@@ -95,10 +96,17 @@
             }
         }
 
-       
-    
-        private List<SegmentIndex>[] _listSegmentIndex = new List<SegmentIndex>[4];
-        public List<SegmentIndex> SelectedIndex
+
+
+        private ObservableCollection<SegmentIndex>[] _listSegmentIndex;
+        public ObservableCollection<SegmentIndex>[] ListIndex
+        {
+            get
+            {
+                return _listSegmentIndex;
+            }
+        }
+        public ObservableCollection<SegmentIndex> SelectedIndex
         {
             get
             {
@@ -107,7 +115,7 @@
             set
             {
                 _listSegmentIndex[SelectedChapter] = value;
-                _newBook.Chapters[SelectedChapter].Index = value;
+                //_newBook.Chapters[SelectedChapter].Index = value;
                 OnPropertyChanged("SelectedIndex");
             }
         }
@@ -139,13 +147,55 @@
             };
            // PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ProductionTimeLineVM_PropertyChanged);
            // SelectedVideoSequences = new ObservableCollection<VideoSequence>();
+            Commands.ProductionView.DelVideoSequence.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(DelVideoSequence_Executed);
             Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartSelected_Executed);
             Commands.ProductionTimeLine.EditorPartFinished.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartFinished_Executed);
+            Commands.ProductionView.ClickAddIndex.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(ClickAddIndex_Executed);
             _listVideoSequences[0].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
             _listVideoSequences[1].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
             _listVideoSequences[2].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
             _listVideoSequences[3].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
-      
+
+            _listSegmentIndex = new ObservableCollection<SegmentIndex>[4]
+            {
+                new ObservableCollection<SegmentIndex>(),
+                new ObservableCollection<SegmentIndex>(),
+                new ObservableCollection<SegmentIndex>(),
+                new ObservableCollection<SegmentIndex>()
+            };
+            _listSegmentIndex[0].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
+            _listSegmentIndex[1].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
+            _listSegmentIndex[2].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
+            _listSegmentIndex[3].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
+        }
+
+        void ClickAddIndex_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+        {
+            if(IsIndexing)
+            {
+                TimeSpan dur = TimeSpan.Zero;
+                // Permet de créer un Index avec une durée calé sur les videos.
+                foreach (VideoSequence Vs in SelectedVideoSequences)
+                {
+                    dur += Vs.Duration;
+                }
+                foreach (SegmentIndex Si in SelectedIndex)
+                {
+                    dur -= Si.Duration;
+                }
+                SelectedIndex.Add(new SegmentIndex(SelectedBookChapter) 
+                { 
+                    TimerIn = TimeSpan.Zero, 
+                    TimerOut = dur,
+                    Chapter = SelectedBookChapter
+                });
+            }
+ 
+        }
+
+        void DelVideoSequence_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+        {
+            SelectedVideoSequences.Remove(((CustomableVideoElementVM)e.Parameter).VideoSequence);
         }
 
         void SelectedVideoSequences_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
@@ -155,7 +205,7 @@
 
         void ProductionTimeLineVM_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
         {
-            Commands.ProductionView.VideoRecordUpdated.Execute();
+            //Commands.ProductionView.VideoRecordUpdated.Execute();
         }
 
         void EditorPartFinished_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
--- a/client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs	Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs	Fri Dec 11 10:48:58 2009 +0100
@@ -92,7 +92,6 @@
                     RunTime = new TimeSpan(0, rndNumbers.Next(10, 60), 0),
                     BeginTrim = new TimeSpan(0, 0, 0),
                     EndTrim = new TimeSpan(0, 0, 0),
-
                 });
             }
            
@@ -100,7 +99,15 @@
 
         void ClickAddSelectedRecord_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
         {
-            ViewModelProductionTimeLine.SelectedVideoSequences.Add(SelectedVideoSequence);
+            if (ViewModelProductionTimeLine.SelectedChapter != -1)
+            {
+                if (!ViewModelProductionTimeLine.IsIndexing)
+                {
+                    if(SelectedVideoSequence!=null)
+                    ViewModelProductionTimeLine.SelectedVideoSequences.Add(new VideoSequence(SelectedVideoSequence));
+                }
+               
+            }
            
         }
        
--- a/client/src/Iri.Modernisation.Data/Models/VideoSequence.cs	Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.Data/Models/VideoSequence.cs	Fri Dec 11 10:48:58 2009 +0100
@@ -17,6 +17,22 @@
     /// </summary>
     public class VideoSequence : SegmentElement
     {
+
+        public VideoSequence():
+            base()
+        {
+        }
+
+        public VideoSequence(VideoSequence oldVs)
+            : base(oldVs)
+        {
+            Path = oldVs.Path;
+            RunTime = oldVs.RunTime;
+            BeginTrim = oldVs.BeginTrim;
+            EndTrim = oldVs.EndTrim;
+            
+        }
+
         /// <summary>
         /// Chemin d'accès à la vidéo
         /// </summary>