blob: e31ad2042f9417c32e777f2fcd094060275355b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SubtitleBehaviours.cs" company="HandBrake Project (http://handbrake.fr)">
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
// </copyright>
// <summary>
// A class to track the behaviours of audio track selection
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.Model.Subtitles
{
using System.ComponentModel;
using System.Linq;
using HandBrake.ApplicationServices.Utilities;
/// <summary>
/// A class to track the behaviours of audio track selection
/// </summary>
public class SubtitleBehaviours : PropertyChangedBase
{
private SubtitleBehaviourModes selectedBehaviour;
private BindingList<string> selectedLangauges;
private bool addForeignAudioScanTrack;
private bool addClosedCaptions;
private SubtitleBurnInBehaviourModes selectedBurnInBehaviour;
/// <summary>
/// Initializes a new instance of the <see cref="SubtitleBehaviours"/> class.
/// </summary>
public SubtitleBehaviours()
{
this.SelectedBehaviour = SubtitleBehaviourModes.None;
this.SelectedBurnInBehaviour = SubtitleBurnInBehaviourModes.None;
this.SelectedLangauges = new BindingList<string>();
}
/// <summary>
/// Initializes a new instance of the <see cref="SubtitleBehaviours"/> class.
/// </summary>
/// <param name="behaviours">
/// The behaviours.
/// </param>
public SubtitleBehaviours(SubtitleBehaviours behaviours)
{
this.SelectedBehaviour = behaviours.selectedBehaviour;
this.SelectedBurnInBehaviour = behaviours.selectedBurnInBehaviour;
this.SelectedLangauges = new BindingList<string>(behaviours.SelectedLangauges.ToList());
}
/// <summary>
/// Gets or sets the selected behaviour.
/// </summary>
public SubtitleBehaviourModes SelectedBehaviour
{
get
{
return this.selectedBehaviour;
}
set
{
if (value == this.selectedBehaviour)
{
return;
}
this.selectedBehaviour = value;
this.NotifyOfPropertyChange(() => this.SelectedBehaviour);
}
}
/// <summary>
/// Gets or sets the selected burn in behaviour.
/// </summary>
public SubtitleBurnInBehaviourModes SelectedBurnInBehaviour
{
get
{
return this.selectedBurnInBehaviour;
}
set
{
if (value == this.selectedBurnInBehaviour)
{
return;
}
this.selectedBurnInBehaviour = value;
this.NotifyOfPropertyChange(() => this.SelectedBurnInBehaviour);
}
}
/// <summary>
/// Gets or sets the selected langages.
/// </summary>
public BindingList<string> SelectedLangauges
{
get
{
return this.selectedLangauges;
}
set
{
if (Equals(value, this.selectedLangauges))
{
return;
}
this.selectedLangauges = value;
this.NotifyOfPropertyChange(() => this.SelectedLangauges);
}
}
/// <summary>
/// Gets or sets a value indicating whether add foreign audio scan track.
/// </summary>
public bool AddForeignAudioScanTrack
{
get
{
return this.addForeignAudioScanTrack;
}
set
{
if (value.Equals(this.addForeignAudioScanTrack))
{
return;
}
this.addForeignAudioScanTrack = value;
this.NotifyOfPropertyChange(() => this.AddForeignAudioScanTrack);
}
}
/// <summary>
/// Gets or sets a value indicating whether add closed captions.
/// </summary>
public bool AddClosedCaptions
{
get
{
return this.addClosedCaptions;
}
set
{
if (value.Equals(this.addClosedCaptions))
{
return;
}
this.addClosedCaptions = value;
this.NotifyOfPropertyChange(() => this.AddClosedCaptions);
}
}
/// <summary>
/// Clone this object
/// </summary>
/// <returns>
/// The <see cref="object"/>.
/// </returns>
public SubtitleBehaviours Clone()
{
SubtitleBehaviours cloned = new SubtitleBehaviours
{
SelectedBehaviour = this.selectedBehaviour,
SelectedBurnInBehaviour = this.selectedBurnInBehaviour,
SelectedLangauges = new BindingList<string>(),
AddClosedCaptions = this.addClosedCaptions,
AddForeignAudioScanTrack = this.addForeignAudioScanTrack,
};
foreach (var item in this.SelectedLangauges)
{
cloned.SelectedLangauges.Add(item);
}
return cloned;
}
}
}
|