// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // A class to track the behaviours of audio track selection // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.Model.Subtitles { using System.ComponentModel; using System.Linq; using HandBrakeWPF.Utilities; /// /// A class to track the behaviours of audio track selection /// public class SubtitleBehaviours : PropertyChangedBase { private SubtitleBehaviourModes selectedBehaviour; private BindingList selectedLangauges; private bool addForeignAudioScanTrack; private bool addClosedCaptions; private SubtitleBurnInBehaviourModes selectedBurnInBehaviour; /// /// Initializes a new instance of the class. /// public SubtitleBehaviours() { this.SelectedBehaviour = SubtitleBehaviourModes.None; this.SelectedBurnInBehaviour = SubtitleBurnInBehaviourModes.None; this.SelectedLangauges = new BindingList(); } /// /// Initializes a new instance of the class. /// /// /// The behaviours. /// public SubtitleBehaviours(SubtitleBehaviours behaviours) { this.SelectedBehaviour = behaviours.selectedBehaviour; this.SelectedBurnInBehaviour = behaviours.selectedBurnInBehaviour; this.SelectedLangauges = new BindingList(behaviours.SelectedLangauges.ToList()); this.AddClosedCaptions = behaviours.AddClosedCaptions; this.AddForeignAudioScanTrack = behaviours.AddForeignAudioScanTrack; } /// /// Gets or sets the selected behaviour. /// public SubtitleBehaviourModes SelectedBehaviour { get { return this.selectedBehaviour; } set { if (value == this.selectedBehaviour) { return; } this.selectedBehaviour = value; this.NotifyOfPropertyChange(() => this.SelectedBehaviour); } } /// /// Gets or sets the selected burn in behaviour. /// public SubtitleBurnInBehaviourModes SelectedBurnInBehaviour { get { return this.selectedBurnInBehaviour; } set { if (value == this.selectedBurnInBehaviour) { return; } this.selectedBurnInBehaviour = value; this.NotifyOfPropertyChange(() => this.SelectedBurnInBehaviour); } } /// /// Gets or sets the selected langages. /// public BindingList SelectedLangauges { get { return this.selectedLangauges; } set { if (Equals(value, this.selectedLangauges)) { return; } this.selectedLangauges = value; this.NotifyOfPropertyChange(() => this.SelectedLangauges); } } /// /// Gets or sets a value indicating whether add foreign audio scan track. /// public bool AddForeignAudioScanTrack { get { return this.addForeignAudioScanTrack; } set { if (value.Equals(this.addForeignAudioScanTrack)) { return; } this.addForeignAudioScanTrack = value; this.NotifyOfPropertyChange(() => this.AddForeignAudioScanTrack); } } /// /// Gets or sets a value indicating whether add closed captions. /// public bool AddClosedCaptions { get { return this.addClosedCaptions; } set { if (value.Equals(this.addClosedCaptions)) { return; } this.addClosedCaptions = value; this.NotifyOfPropertyChange(() => this.AddClosedCaptions); } } /// /// Clone this object /// /// /// The . /// public SubtitleBehaviours Clone() { SubtitleBehaviours cloned = new SubtitleBehaviours { SelectedBehaviour = this.selectedBehaviour, SelectedBurnInBehaviour = this.selectedBurnInBehaviour, SelectedLangauges = new BindingList(), AddClosedCaptions = this.addClosedCaptions, AddForeignAudioScanTrack = this.addForeignAudioScanTrack, }; foreach (var item in this.SelectedLangauges) { cloned.SelectedLangauges.Add(item); } return cloned; } } }