author | ARIAS Santiago |
Sat, 14 Nov 2009 19:07:51 +0100 | |
changeset 201 | 16287a7d1f1a |
parent 167 | 206f07a8d887 |
permissions | -rw-r--r-- |
55 | 1 |
using System; |
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Windows; |
|
6 |
using System.Windows.Controls; |
|
7 |
using System.Windows.Data; |
|
8 |
using System.Windows.Documents; |
|
9 |
using System.Windows.Input; |
|
10 |
using System.Windows.Media; |
|
11 |
using System.Windows.Media.Imaging; |
|
12 |
using System.Windows.Navigation; |
|
13 |
using System.Windows.Shapes; |
|
143 | 14 |
using Microsoft.Surface.Presentation; |
55 | 15 |
|
16 |
namespace FingersDance.Views |
|
17 |
{ |
|
18 |
/// <summary> |
|
19 |
/// Interaction logic for TimelineAnnotationView.xaml |
|
20 |
/// </summary> |
|
21 |
public partial class TimelineAnnotationView : UserControl |
|
22 |
{ |
|
167
206f07a8d887
Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents:
160
diff
changeset
|
23 |
|
206f07a8d887
Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents:
160
diff
changeset
|
24 |
public static readonly DependencyProperty ScaleXProperty = DependencyProperty.Register("ScaleX", typeof(Double), typeof(TimelineAnnotationView)); |
206f07a8d887
Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents:
160
diff
changeset
|
25 |
|
55 | 26 |
public TimelineAnnotationView() |
27 |
{ |
|
28 |
InitializeComponent(); |
|
29 |
} |
|
167
206f07a8d887
Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents:
160
diff
changeset
|
30 |
|
206f07a8d887
Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents:
160
diff
changeset
|
31 |
public Double ScaleX |
206f07a8d887
Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents:
160
diff
changeset
|
32 |
{ |
206f07a8d887
Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents:
160
diff
changeset
|
33 |
get { return (Double)GetValue(ScaleXProperty); } |
206f07a8d887
Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents:
160
diff
changeset
|
34 |
set { SetValue(ScaleXProperty, value); } |
206f07a8d887
Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents:
160
diff
changeset
|
35 |
} |
55 | 36 |
} |
71 | 37 |
|
38 |
public class ThicknessSingleValueConverter : IValueConverter |
|
39 |
{ |
|
40 |
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
|
41 |
{ |
|
42 |
ThicknessConverter myThicknessConverter = new ThicknessConverter(); |
|
43 |
Thickness th1 = (Thickness)myThicknessConverter.ConvertFrom(value); |
|
74
7ce946833eae
First step of data binding where we can add an annotation by clicking on the timeline
cavaliet
parents:
71
diff
changeset
|
44 |
th1.Top = 0; |
7ce946833eae
First step of data binding where we can add an annotation by clicking on the timeline
cavaliet
parents:
71
diff
changeset
|
45 |
th1.Bottom = th1.Right = 0; |
71 | 46 |
return th1; |
47 |
} |
|
48 |
public object ConvertBack(object value, Type targetTypes, object parameter, System.Globalization.CultureInfo culture) |
|
49 |
{ |
|
50 |
Thickness thickness = (Thickness)value; |
|
51 |
return thickness.Left; |
|
52 |
} |
|
53 |
} |
|
143 | 54 |
|
55 |
public class VisibilityConverter : IValueConverter |
|
56 |
{ |
|
57 |
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
|
58 |
{ |
|
150
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
146
diff
changeset
|
59 |
Visibility v = ((float)value > 0) ? Visibility.Visible : Visibility.Hidden; |
143 | 60 |
return v; |
61 |
} |
|
62 |
public object ConvertBack(object value, Type targetTypes, object parameter, System.Globalization.CultureInfo culture) |
|
63 |
{ |
|
64 |
return 1.0; |
|
65 |
} |
|
66 |
} |
|
160
e940ca798fe3
Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents:
150
diff
changeset
|
67 |
|
150
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
146
diff
changeset
|
68 |
public class ColorConverter : IValueConverter |
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
146
diff
changeset
|
69 |
{ |
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
146
diff
changeset
|
70 |
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
146
diff
changeset
|
71 |
{ |
160
e940ca798fe3
Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents:
150
diff
changeset
|
72 |
//UInt32 argb = (UInt32)value; |
e940ca798fe3
Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents:
150
diff
changeset
|
73 |
//Color c = Color.FromArgb((Byte)((argb >> 24) & 0xFF), (Byte)((argb >> 16) & 0xFF), (Byte)((argb >> 8) & 0xFF), (Byte)(argb & 0xFF)); |
e940ca798fe3
Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents:
150
diff
changeset
|
74 |
SolidColorBrush scb = new SolidColorBrush((Color)value); |
150
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
146
diff
changeset
|
75 |
return scb; |
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
146
diff
changeset
|
76 |
} |
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
146
diff
changeset
|
77 |
public object ConvertBack(object value, Type targetTypes, object parameter, System.Globalization.CultureInfo culture) |
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
146
diff
changeset
|
78 |
{ |
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
146
diff
changeset
|
79 |
return 1.0; |
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
146
diff
changeset
|
80 |
} |
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
146
diff
changeset
|
81 |
} |
55 | 82 |
} |