Exemplo n.º 1
0
 public override void DoChecks(Data.IProject project, IModelErrors errors, CancellationToken ct)
 {
     m_ModelErrors = errors;
     m_Ct          = ct;
     foreach (IMode mode in project.GetModes())
     {
         foreach (IModeElement element in mode.GetElements())
         {
             element.Visit(this);
             m_Ct.ThrowIfCancellationRequested();
         }
     }
 }
Exemplo n.º 2
0
        public SpeakersDialog(IList <Data.IFileElement> elements, Ares.Data.IProject project)
        {
            InitializeComponent();
            Element   = elements[0];
            m_Project = project;
            Action    = new Actions.SpeakerChangeAction(elements, true, Element.Effects.SpeakerAssignment.Random, Element.Effects.SpeakerAssignment.Assignment);
            if (Element.Effects.SpeakerAssignment.Random)
            {
                randomButton.Checked         = true;
                defaultButton.Checked        = false;
                oneSpeakerBox.Enabled        = false;
                oneSpeakerBox.SelectedIndex  = 0;
                oneSpeakerButton.Checked     = false;
                twoSpeakersBox.Enabled       = false;
                twoSpeakersBox.SelectedIndex = 0;
                twoSpeakersButton.Checked    = false;
                allSpeakersButton.Checked    = false;
            }
            else
            {
                randomButton.Checked = false;
                switch (Element.Effects.SpeakerAssignment.Assignment)
                {
                case Data.SpeakerAssignment.LeftFront:
                    oneSpeakerBox.SelectedIndex  = 0;
                    oneSpeakerButton.Checked     = true;
                    twoSpeakersBox.SelectedIndex = 0;
                    twoSpeakersBox.Enabled       = false;
                    twoSpeakersButton.Checked    = false;
                    defaultButton.Checked        = false;
                    allSpeakersButton.Checked    = false;
                    break;

                case Data.SpeakerAssignment.RightFront:
                    oneSpeakerBox.SelectedIndex  = 1;
                    oneSpeakerButton.Checked     = true;
                    twoSpeakersBox.SelectedIndex = 0;
                    twoSpeakersBox.Enabled       = false;
                    twoSpeakersButton.Checked    = false;
                    defaultButton.Checked        = false;
                    allSpeakersButton.Checked    = false;
                    break;

                case Data.SpeakerAssignment.Center:
                    oneSpeakerBox.SelectedIndex  = 2;
                    oneSpeakerButton.Checked     = true;
                    twoSpeakersBox.SelectedIndex = 0;
                    twoSpeakersBox.Enabled       = false;
                    twoSpeakersButton.Checked    = false;
                    defaultButton.Checked        = false;
                    allSpeakersButton.Checked    = false;
                    break;

                case Data.SpeakerAssignment.LeftBack:
                    oneSpeakerBox.SelectedIndex  = 3;
                    oneSpeakerButton.Checked     = true;
                    twoSpeakersBox.SelectedIndex = 0;
                    twoSpeakersBox.Enabled       = false;
                    twoSpeakersButton.Checked    = false;
                    defaultButton.Checked        = false;
                    allSpeakersButton.Checked    = false;
                    break;

                case Data.SpeakerAssignment.RightBack:
                    oneSpeakerBox.SelectedIndex  = 4;
                    oneSpeakerButton.Checked     = true;
                    twoSpeakersBox.SelectedIndex = 0;
                    twoSpeakersBox.Enabled       = false;
                    twoSpeakersButton.Checked    = false;
                    defaultButton.Checked        = false;
                    allSpeakersButton.Checked    = false;
                    break;

                case Data.SpeakerAssignment.LeftCenterBack:
                    oneSpeakerBox.SelectedIndex  = 5;
                    oneSpeakerButton.Checked     = true;
                    twoSpeakersBox.SelectedIndex = 0;
                    twoSpeakersBox.Enabled       = false;
                    twoSpeakersButton.Checked    = false;
                    defaultButton.Checked        = false;
                    allSpeakersButton.Checked    = false;
                    break;

                case Data.SpeakerAssignment.RightCenterBack:
                    oneSpeakerBox.SelectedIndex  = 6;
                    oneSpeakerButton.Checked     = true;
                    twoSpeakersBox.SelectedIndex = 0;
                    twoSpeakersBox.Enabled       = false;
                    twoSpeakersButton.Checked    = false;
                    defaultButton.Checked        = false;
                    allSpeakersButton.Checked    = false;
                    break;

                case Data.SpeakerAssignment.Subwoofer:
                    oneSpeakerBox.SelectedIndex  = 7;
                    oneSpeakerButton.Checked     = true;
                    twoSpeakersBox.SelectedIndex = 0;
                    twoSpeakersBox.Enabled       = false;
                    twoSpeakersButton.Checked    = false;
                    defaultButton.Checked        = false;
                    allSpeakersButton.Checked    = false;
                    break;

                case Data.SpeakerAssignment.BothFronts:
                    oneSpeakerBox.SelectedIndex  = 0;
                    oneSpeakerBox.Enabled        = false;
                    oneSpeakerButton.Checked     = false;
                    twoSpeakersBox.SelectedIndex = 0;
                    twoSpeakersButton.Checked    = true;
                    defaultButton.Checked        = false;
                    allSpeakersButton.Checked    = false;
                    break;

                case Data.SpeakerAssignment.BothRears:
                    oneSpeakerBox.SelectedIndex  = 0;
                    oneSpeakerBox.Enabled        = false;
                    oneSpeakerButton.Checked     = false;
                    twoSpeakersBox.SelectedIndex = 1;
                    twoSpeakersButton.Checked    = true;
                    defaultButton.Checked        = false;
                    allSpeakersButton.Checked    = false;
                    break;

                case Data.SpeakerAssignment.BothCenterRears:
                    oneSpeakerBox.SelectedIndex  = 0;
                    oneSpeakerBox.Enabled        = false;
                    oneSpeakerButton.Checked     = false;
                    twoSpeakersBox.SelectedIndex = 2;
                    twoSpeakersButton.Checked    = true;
                    defaultButton.Checked        = false;
                    allSpeakersButton.Checked    = false;
                    break;

                case Data.SpeakerAssignment.CenterAndSubwoofer:
                    oneSpeakerBox.SelectedIndex  = 0;
                    oneSpeakerBox.Enabled        = false;
                    oneSpeakerButton.Checked     = false;
                    twoSpeakersBox.SelectedIndex = 3;
                    twoSpeakersButton.Checked    = true;
                    defaultButton.Checked        = false;
                    allSpeakersButton.Checked    = false;
                    break;

                case Data.SpeakerAssignment.AllSpeakers:
                    oneSpeakerBox.SelectedIndex  = 0;
                    oneSpeakerBox.Enabled        = false;
                    oneSpeakerButton.Checked     = false;
                    twoSpeakersBox.SelectedIndex = 0;
                    twoSpeakersButton.Checked    = false;
                    twoSpeakersBox.Enabled       = false;
                    defaultButton.Checked        = false;
                    allSpeakersButton.Checked    = true;
                    break;

                case Data.SpeakerAssignment.Default:
                default:
                    oneSpeakerBox.SelectedIndex  = 0;
                    oneSpeakerBox.Enabled        = false;
                    oneSpeakerButton.Checked     = false;
                    twoSpeakersBox.SelectedIndex = 0;
                    twoSpeakersButton.Checked    = false;
                    twoSpeakersBox.Enabled       = false;
                    defaultButton.Checked        = true;
                    allSpeakersButton.Checked    = false;
                    break;
                }
            }
        }
Exemplo n.º 3
0
 public override void Undo(Data.IProject project)
 {
     project.SetTagHidden(m_TagId, m_OldValue);
     TagChanges.Instance.FireTagsDBChanged(null);
 }
Exemplo n.º 4
0
 public override void DoChecks(Data.IProject project, Ares.ModelInfo.IModelErrors errors, CancellationToken ct)
 {
     System.Windows.Forms.KeysConverter converter = new System.Windows.Forms.KeysConverter();
     for (int i = 0; i < project.GetModes().Count; ++i)
     {
         IMode mode = project.GetModes()[i];
         // check: no empty key
         if (mode.KeyCode == 0)
         {
             /*
              * AddError(errors, ModelError.ErrorSeverity.Warning,
              *  String.Format(StringResources.ModeNoKey, mode.Title), mode);
              */
         }
         else
         {
             // check: no globally reserved key
             if (s_GlobalReservedKeys.ContainsKey(mode.KeyCode))
             {
                 AddError(errors, Ares.ModelInfo.ModelError.ErrorSeverity.Error,
                          String.Format(StringResources.ModeKeyGloballyReserved,
                                        converter.ConvertToString((System.Windows.Forms.Keys)mode.KeyCode)), mode);
             }
             // check: key not used by another mode
             for (int j = i + 1; j < project.GetModes().Count; ++j)
             {
                 if (project.GetModes()[j].KeyCode == mode.KeyCode)
                 {
                     AddError(errors, Ares.ModelInfo.ModelError.ErrorSeverity.Error,
                              String.Format(StringResources.DuplicateModeKey,
                                            converter.ConvertToString((System.Windows.Forms.Keys)mode.KeyCode),
                                            mode.Title, project.GetModes()[j].Title), mode);
                 }
             }
         }
         // check mode elements
         for (int j = 0; j < mode.GetElements().Count; ++j)
         {
             IModeElement modeElement = mode.GetElements()[j];
             // get key code, if there is one
             int keyCode = 0;
             if (modeElement.Trigger != null)
             {
                 if (modeElement.Trigger.TriggerType == TriggerType.Key)
                 {
                     keyCode = ((IKeyTrigger)modeElement.Trigger).KeyCode;
                 }
                 else
                 {
                     // no key trigger, no checks
                     continue;
                 }
             }
             // check: no empty key
             if (keyCode == 0)
             {
                 /*
                  * AddError(errors, ModelError.ErrorSeverity.Warning,
                  *  String.Format(StringResources.ModeElementNoKey, modeElement.Title), modeElement);
                  */
             }
             else
             {
                 // check: no globally reserved key
                 if (s_GlobalReservedKeys.ContainsKey(keyCode))
                 {
                     AddError(errors, Ares.ModelInfo.ModelError.ErrorSeverity.Error,
                              String.Format(StringResources.ModeElementKeyGloballyReserved,
                                            converter.ConvertToString((System.Windows.Forms.Keys)keyCode)), modeElement);
                 }
                 // check: key not used by a mode
                 for (int k = 0; k < project.GetModes().Count; ++k)
                 {
                     if (project.GetModes()[k].KeyCode == keyCode)
                     {
                         AddError(errors, Ares.ModelInfo.ModelError.ErrorSeverity.Error,
                                  String.Format(StringResources.ModeElementKeyUsedByMode,
                                                converter.ConvertToString((System.Windows.Forms.Keys)keyCode),
                                                modeElement.Title, project.GetModes()[k].Title), modeElement);
                     }
                 }
                 // check: key not used by another element in the same mode
                 for (int k = j + 1; k < mode.GetElements().Count; ++k)
                 {
                     IModeElement other = mode.GetElements()[k];
                     if (other.Trigger != null && other.Trigger.TriggerType == TriggerType.Key)
                     {
                         if (((IKeyTrigger)other.Trigger).KeyCode == keyCode)
                         {
                             AddError(errors, Ares.ModelInfo.ModelError.ErrorSeverity.Error,
                                      String.Format(StringResources.DuplicateModeElementKey,
                                                    converter.ConvertToString((System.Windows.Forms.Keys)keyCode),
                                                    modeElement.Title, other.Title), modeElement);
                         }
                     }
                 }
             }
             ct.ThrowIfCancellationRequested();
         }
     }
 }
Exemplo n.º 5
0
 public override void Do(Data.IProject project)
 {
     project.SetTagCategoryHidden(m_CategoryId, m_Hidden);
     TagChanges.Instance.FireTagsDBChanged(null);
 }