author | cavaliet |
Tue, 24 Nov 2009 22:08:57 +0100 | |
changeset 229 | 05aba5def1fc |
parent 192 | 11083c390ce4 |
permissions | -rw-r--r-- |
55 | 1 |
using System; |
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
229
05aba5def1fc
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents:
192
diff
changeset
|
5 |
using System.Windows.Media; |
55 | 6 |
|
69 | 7 |
using FingersDance.Data; |
8 |
||
9 |
namespace FingersDance.ViewModels |
|
55 | 10 |
{ |
69 | 11 |
public class CuttingViewModel : ViewModelBase |
55 | 12 |
{ |
182
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
13 |
private Cutting cut; |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
14 |
|
55 | 15 |
private List<AnnotationViewModel> _annotList = new List<AnnotationViewModel>(); |
69 | 16 |
|
190
619ca3ae13c7
MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents:
182
diff
changeset
|
17 |
public CuttingViewModel(Cutting c, float annotWidth, Double scaleX) |
619ca3ae13c7
MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents:
182
diff
changeset
|
18 |
{ |
619ca3ae13c7
MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents:
182
diff
changeset
|
19 |
|
619ca3ae13c7
MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents:
182
diff
changeset
|
20 |
cut = c; |
619ca3ae13c7
MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents:
182
diff
changeset
|
21 |
this._annotList = new List<AnnotationViewModel>(); |
619ca3ae13c7
MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents:
182
diff
changeset
|
22 |
int i = 0; |
619ca3ae13c7
MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents:
182
diff
changeset
|
23 |
foreach (Annotation annot in c.AnnotList) |
619ca3ae13c7
MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents:
182
diff
changeset
|
24 |
{ |
619ca3ae13c7
MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents:
182
diff
changeset
|
25 |
this._annotList.Add(new AnnotationViewModel(annot, annot.TcBegin - (i * annotWidth), 1 / scaleX)); |
619ca3ae13c7
MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents:
182
diff
changeset
|
26 |
i++; |
619ca3ae13c7
MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents:
182
diff
changeset
|
27 |
} |
619ca3ae13c7
MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents:
182
diff
changeset
|
28 |
|
619ca3ae13c7
MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents:
182
diff
changeset
|
29 |
} |
619ca3ae13c7
MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents:
182
diff
changeset
|
30 |
|
143 | 31 |
public CuttingViewModel(Cutting c, float annotWidth) { |
69 | 32 |
|
182
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
33 |
cut = c; |
69 | 34 |
this._annotList = new List<AnnotationViewModel>(); |
143 | 35 |
int i = 0; |
69 | 36 |
foreach (Annotation annot in c.AnnotList) |
143 | 37 |
{ |
38 |
this._annotList.Add(new AnnotationViewModel(annot, annot.TcBegin - (i * annotWidth))); |
|
39 |
i++; |
|
40 |
} |
|
69 | 41 |
|
42 |
} |
|
43 |
||
182
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
44 |
public Cutting Cutting |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
45 |
{ |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
46 |
get { return cut; } |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
47 |
set |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
48 |
{ |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
49 |
cut = value; |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
50 |
base.OnPropertyChanged("Cutting"); |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
51 |
} |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
52 |
} |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
53 |
|
192
11083c390ce4
Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents:
190
diff
changeset
|
54 |
public String Id |
11083c390ce4
Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents:
190
diff
changeset
|
55 |
{ |
11083c390ce4
Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents:
190
diff
changeset
|
56 |
get { return cut.Id; } |
11083c390ce4
Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents:
190
diff
changeset
|
57 |
set |
11083c390ce4
Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents:
190
diff
changeset
|
58 |
{ |
11083c390ce4
Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents:
190
diff
changeset
|
59 |
if (value == cut.Id || String.IsNullOrEmpty(value)) |
11083c390ce4
Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents:
190
diff
changeset
|
60 |
return; |
11083c390ce4
Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents:
190
diff
changeset
|
61 |
cut.Id = value; |
11083c390ce4
Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents:
190
diff
changeset
|
62 |
base.OnPropertyChanged("Id"); |
11083c390ce4
Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents:
190
diff
changeset
|
63 |
} |
11083c390ce4
Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents:
190
diff
changeset
|
64 |
} |
143 | 65 |
public String Title |
55 | 66 |
{ |
182
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
67 |
get { return cut.Title; } |
55 | 68 |
set |
69 |
{ |
|
182
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
70 |
if (value == cut.Title || String.IsNullOrEmpty(value)) |
55 | 71 |
return; |
182
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
167
diff
changeset
|
72 |
cut.Title = value; |
55 | 73 |
base.OnPropertyChanged("Title"); |
74 |
} |
|
75 |
} |
|
76 |
public List<AnnotationViewModel> AnnotList |
|
77 |
{ |
|
78 |
get { return _annotList; } |
|
79 |
set |
|
80 |
{ |
|
81 |
_annotList = value; |
|
82 |
base.OnPropertyChanged("AnnotList"); |
|
83 |
} |
|
84 |
} |
|
229
05aba5def1fc
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents:
192
diff
changeset
|
85 |
public Color Color |
05aba5def1fc
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents:
192
diff
changeset
|
86 |
{ |
05aba5def1fc
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents:
192
diff
changeset
|
87 |
get { return cut.Color; } |
05aba5def1fc
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents:
192
diff
changeset
|
88 |
set |
05aba5def1fc
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents:
192
diff
changeset
|
89 |
{ |
05aba5def1fc
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents:
192
diff
changeset
|
90 |
if (value == cut.Color) |
05aba5def1fc
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents:
192
diff
changeset
|
91 |
return; |
05aba5def1fc
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents:
192
diff
changeset
|
92 |
cut.Color = value; |
05aba5def1fc
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents:
192
diff
changeset
|
93 |
base.OnPropertyChanged("Title"); |
05aba5def1fc
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents:
192
diff
changeset
|
94 |
} |
05aba5def1fc
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents:
192
diff
changeset
|
95 |
} |
143 | 96 |
|
167
206f07a8d887
Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents:
146
diff
changeset
|
97 |
public void setListFromAnnotations(List<Annotation> annotList, float annotWidth, Double scaleX) |
143 | 98 |
{ |
99 |
||
100 |
this._annotList = new List<AnnotationViewModel>(); |
|
101 |
int i = 0; |
|
102 |
foreach (Annotation annot in annotList) |
|
103 |
{ |
|
167
206f07a8d887
Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents:
146
diff
changeset
|
104 |
this._annotList.Add(new AnnotationViewModel(annot, annot.TcBegin - (i * annotWidth), 1/scaleX)); |
143 | 105 |
i++; |
106 |
} |
|
107 |
||
108 |
} |
|
55 | 109 |
} |
110 |
} |