author | cavaliet |
Thu, 12 Nov 2009 16:15:19 +0100 | |
changeset 192 | 11083c390ce4 |
parent 190 | 619ca3ae13c7 |
child 229 | 05aba5def1fc |
permissions | -rw-r--r-- |
55 | 1 |
using System; |
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
||
69 | 6 |
using FingersDance.Data; |
7 |
||
8 |
namespace FingersDance.ViewModels |
|
55 | 9 |
{ |
69 | 10 |
public class CuttingViewModel : ViewModelBase |
55 | 11 |
{ |
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
|
12 |
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
|
13 |
|
55 | 14 |
private List<AnnotationViewModel> _annotList = new List<AnnotationViewModel>(); |
69 | 15 |
|
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
|
16 |
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
|
17 |
{ |
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 |
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
|
20 |
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
|
21 |
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
|
22 |
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
|
23 |
{ |
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 |
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
|
25 |
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
|
26 |
} |
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 |
|
143 | 30 |
public CuttingViewModel(Cutting c, float annotWidth) { |
69 | 31 |
|
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
|
32 |
cut = c; |
69 | 33 |
this._annotList = new List<AnnotationViewModel>(); |
143 | 34 |
int i = 0; |
69 | 35 |
foreach (Annotation annot in c.AnnotList) |
143 | 36 |
{ |
37 |
this._annotList.Add(new AnnotationViewModel(annot, annot.TcBegin - (i * annotWidth))); |
|
38 |
i++; |
|
39 |
} |
|
69 | 40 |
|
41 |
} |
|
42 |
||
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
|
43 |
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
|
44 |
{ |
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 |
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
|
46 |
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
|
47 |
{ |
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 |
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
|
49 |
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
|
50 |
} |
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 |
|
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
|
53 |
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
|
54 |
{ |
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 |
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
|
56 |
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
|
57 |
{ |
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 |
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
|
59 |
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
|
60 |
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
|
61 |
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
|
62 |
} |
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 |
} |
143 | 64 |
public String Title |
55 | 65 |
{ |
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
|
66 |
get { return cut.Title; } |
55 | 67 |
set |
68 |
{ |
|
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
|
69 |
if (value == cut.Title || String.IsNullOrEmpty(value)) |
55 | 70 |
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
|
71 |
cut.Title = value; |
55 | 72 |
base.OnPropertyChanged("Title"); |
73 |
} |
|
74 |
} |
|
75 |
public List<AnnotationViewModel> AnnotList |
|
76 |
{ |
|
77 |
get { return _annotList; } |
|
78 |
set |
|
79 |
{ |
|
80 |
_annotList = value; |
|
81 |
base.OnPropertyChanged("AnnotList"); |
|
82 |
} |
|
83 |
} |
|
143 | 84 |
|
167
206f07a8d887
Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents:
146
diff
changeset
|
85 |
public void setListFromAnnotations(List<Annotation> annotList, float annotWidth, Double scaleX) |
143 | 86 |
{ |
87 |
||
88 |
this._annotList = new List<AnnotationViewModel>(); |
|
89 |
int i = 0; |
|
90 |
foreach (Annotation annot in annotList) |
|
91 |
{ |
|
167
206f07a8d887
Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents:
146
diff
changeset
|
92 |
this._annotList.Add(new AnnotationViewModel(annot, annot.TcBegin - (i * annotWidth), 1/scaleX)); |
143 | 93 |
i++; |
94 |
} |
|
95 |
||
96 |
} |
|
55 | 97 |
} |
98 |
} |