private bool UnloadProject() { if (!SaveCurrentProject()) { return(false); } if (m_CurrentProject != null) { List <WeifenLuo.WinFormsUI.Docking.IDockContent> documents = new List <WeifenLuo.WinFormsUI.Docking.IDockContent>(dockPanel.Documents); foreach (WeifenLuo.WinFormsUI.Docking.IDockContent document in documents) { if (!(document is ElementEditors.FileTagsEditor) && !(document is ElementEditors.TagsEditor)) { (document as Form).Close(); } } Ares.ModelInfo.ModelChecks.Instance.CancelChecks(); Ares.Data.DataModule.ProjectManager.UnloadProject(m_CurrentProject); m_CurrentProject = null; DoModelChecks(); Actions.Actions.Instance.Clear(); #if !MONO m_Instance.SetLoadedProject("-"); #endif } return(true); }
public TriggerEditor(Ares.Data.IProject project) { InitializeComponent(); m_Project = project; m_Tooltip = new ToolTip(); m_Tooltip.SetToolTip(allCrossFadeButton, StringResources.SetFadingForAll); m_Tooltip.SetToolTip(allSoundsFadeButton, StringResources.SetFadingForAll); }
public void SetContainer(Ares.Data.IMacro container, Ares.Data.IProject project) { ElementId = container.Id; m_Element = container; m_Project = project; macroControl.SetContainer(container, project); ElementSet(); }
private bool OpenProject(String filePath) { if (!UnloadProject()) { return(true); } bool result = true; try { m_CurrentProject = Ares.Data.DataModule.ProjectManager.LoadProject(filePath); Ares.Settings.Settings.Instance.RecentFiles.AddFile(new RecentFiles.ProjectEntry(m_CurrentProject.FileName, m_CurrentProject.Title)); } catch (Ares.Data.InvalidProjectException) { m_CurrentProject = null; result = false; } catch (Exception e) { MessageBox.Show(this, String.Format(StringResources.LoadError, e.Message), StringResources.Ares, MessageBoxButtons.OK, MessageBoxIcon.Error); m_CurrentProject = null; } Ares.Editor.Actions.FilesWatcher.Instance.Project = m_CurrentProject; if (m_ProjectExplorer != null) { m_ProjectExplorer.SetProject(m_CurrentProject); } if (m_TagsEditor != null) { m_TagsEditor.SetProject(m_CurrentProject); } if (m_FileTagsEditor != null) { m_FileTagsEditor.SetProject(m_CurrentProject); } for (int i = 0; i < m_FileExplorers.Length; ++i) { if (m_FileExplorers[i] != null) { m_FileExplorers[i].SetProject(m_CurrentProject); } } if (m_AudioSourceSearch != null) { m_AudioSourceSearch.SetProject(m_CurrentProject); } DoModelChecks(); Ares.ModelInfo.ModelChecks.Instance.AdaptHiddenTags(m_CurrentProject); #if !MONO m_Instance.SetLoadedProject(filePath); #endif UpdateGUI(); return(result); }
public void SetContainer(Ares.Data.ISequentialContainer container, Ares.Data.IProject project) { ElementId = container.Id; m_Element = container; sequentialContainerControl.SetContainer(container, project, false); volumeControl.SetElement(container, project); label1.Text = String.Format(label1.Text, String.Format(StringResources.FileExplorerTitle, StringResources.Music)); ElementSet(project); }
public void SetElement(Ares.Data.IElement element, Ares.Data.IProject project) { m_Element = element; m_Project = project; listen = false; UpdateData(); Actions.ElementChanges.Instance.AddListener(m_Element.Id, Update); listen = true; }
private void NewProject() { String title = StringResources.NewProject; if (!UnloadProject()) { return; } m_CurrentProject = Ares.Data.DataModule.ProjectManager.CreateProject(title); try { m_CurrentProject.TagLanguageId = Ares.Tags.TagsModule.GetTagsDB().TranslationsInterface.GetIdOfCurrentUILanguage(); } catch (Ares.Tags.TagsDbException ex) { MessageBox.Show(this, String.Format(StringResources.TagsDbError, ex.Message), StringResources.Ares, MessageBoxButtons.OK, MessageBoxIcon.Error); } DoModelChecks(); Ares.Editor.Actions.FilesWatcher.Instance.Project = m_CurrentProject; if (m_ProjectExplorer != null) { m_ProjectExplorer.SetProject(m_CurrentProject); } if (m_TagsEditor != null) { m_TagsEditor.SetProject(m_CurrentProject); } if (m_FileTagsEditor != null) { m_FileTagsEditor.SetProject(m_CurrentProject); } for (int i = 0; i < m_FileExplorers.Length; ++i) { if (m_FileExplorers[i] != null) { m_FileExplorers[i].SetProject(m_CurrentProject); } } if (m_AudioSourceSearch != null) { m_AudioSourceSearch.SetProject(m_CurrentProject); } if (m_ProjectExplorer.IsHidden) { ShowProjectExplorer(); } UpdateGUI(); m_ProjectExplorer.InitNewProject(); }
public void Undo(Ares.Data.IProject project) { if (CanUndo) { Ares.ModelInfo.ModelChecks.Instance.CancelChecks(); m_Actions[--m_Index].Undo(project); if (UpdateGUI != null) { UpdateGUI(); } } }
protected void ElementSet(Ares.Data.IProject project) { Project = project; Update(m_Element.Id, Actions.ElementChanges.ChangeType.Renamed); Actions.ElementChanges.Instance.AddListener(m_Element.Id, Update); if (Actions.Playing.Instance.IsElementPlaying(m_Element)) { DisableControls(true); } else if (Actions.Playing.Instance.IsElementOrSubElementPlaying(m_Element)) { DisableControls(false); } }
public void AddNew(Action action, Ares.Data.IProject project) { if (m_Actions.Count > m_Index) { m_Actions.RemoveRange(m_Index, m_Actions.Count - m_Index); } m_Actions.Add(action); m_Index++; Ares.ModelInfo.ModelChecks.Instance.CancelChecks(); action.Do(project); if (UpdateGUI != null) { UpdateGUI(); } }
public static void ShowTriggerEditor(Ares.Data.IModeElement element, Ares.Data.IProject project, WeifenLuo.WinFormsUI.Docking.DockPanel parent) { EditorBase existing = EditorRegistry.Instance.GetEditor(element.Id); if (existing != null) { existing.Activate(); } else { TriggerEditor editor = new TriggerEditor(project); editor.SetElement(element); ShowEditor(editor, parent); } }
public void SetContainer(Ares.Data.IGeneralElementContainer container, Ares.Data.IProject project) { m_Container = container; bool hasContainer = (m_Container != null); allFadeInButton.Enabled = hasContainer; allFadeOutButton.Enabled = hasContainer; allVolumeButton.Enabled = hasContainer; allCrossFadeButton.Enabled = hasContainer; allFadeInButton.Visible = hasContainer; allFadeOutButton.Visible = hasContainer; allVolumeButton.Visible = hasContainer; allCrossFadeButton.Visible = hasContainer; m_Project = project; }
public void SetProject(Ares.Data.IProject project) { m_Project = project; m_LanguageId = m_Project != null ? m_Project.TagLanguageId : -1; if (m_LanguageId == -1) { try { m_LanguageId = Ares.Tags.TagsModule.GetTagsDB().TranslationsInterface.GetIdOfCurrentUILanguage(); } catch (Ares.Tags.TagsDbException ex) { MessageBox.Show(this, String.Format(StringResources.TagsDbError, ex.Message), StringResources.Ares, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } UpdateControls(); }
public void SetElement(Ares.Data.IDelayableElement element, Ares.Data.IProject project) { if (m_Element != null) { Actions.ElementChanges.Instance.RemoveListener(m_Element.Id, Update); } m_Element = element; m_Project = project; if (m_Element != null) { Update(m_Element.Id, Actions.ElementChanges.ChangeType.Changed); Actions.ElementChanges.Instance.AddListener(m_Element.Id, Update); } else { fixedDelayUpDown.Value = 0; maxDelayUpDown.Value = 0; } }
public void SetEffects(Ares.Data.IEffectsElement element, Ares.Data.IProject project) { m_Project = project; if (m_Element != null) { Actions.ElementChanges.Instance.RemoveListener(m_Element.Id, Update); } m_Element = element; if (m_Element != null) { Enabled = true; Update(m_Element.Id, Actions.ElementChanges.ChangeType.Changed); Actions.ElementChanges.Instance.AddListener(m_Element.Id, Update); } else { Enabled = false; } }
public void SetProject(Ares.Data.IProject project) { m_Project = project; UpdateAll(); }
public override void Undo(Ares.Data.IProject project) { AddFileTags(m_RemovedTags); RemoveFileTags(m_AddedTags); Ares.Editor.Actions.TagChanges.Instance.FireTagsDBChanged(this); }
public void SetContainer(Ares.Data.IElementContainer <Ares.Data.IChoiceElement> container, Ares.Data.IProject project, bool hasMusicColumns) { ElementId = container.Id; m_Element = container; choiceContainerControl.SetContainer(container, project, hasMusicColumns); volumeControl.SetElement(container, project); label1.Text = String.Format(label1.Text, String.Format(StringResources.FileExplorerTitle, StringResources.Music)); ElementSet(project); }
public static void ShowEditor(Ares.Data.IElement element, Ares.Data.IGeneralElementContainer container, Ares.Data.IProject project, WeifenLuo.WinFormsUI.Docking.DockPanel parent) { ShowEditor(element, container, null, project, parent); }
public static void ShowEditor(Ares.Data.IElement element, Ares.Data.IModeElement modeElement, Ares.Data.IProject project, WeifenLuo.WinFormsUI.Docking.DockPanel parent) { ShowEditor(element, null, modeElement, project, parent); }
private static void ShowEditor(Ares.Data.IElement element, Ares.Data.IGeneralElementContainer container, Ares.Data.IModeElement modeElement, Ares.Data.IProject project, WeifenLuo.WinFormsUI.Docking.DockPanel parent) { if (element == null) { return; } EditorBase existing = EditorRegistry.Instance.GetEditor(element.Id); if (existing != null) { existing.Activate(); } else { if (element is Ares.Data.IRandomBackgroundMusicList) { RandomPlaylistOrBGSoundChoiceEditor editor = new RandomPlaylistOrBGSoundChoiceEditor(); editor.SetPlaylist(element as Ares.Data.IRandomBackgroundMusicList, project); ShowEditor(editor, parent); } else if (element is Ares.Data.IBackgroundSoundChoice) { RandomPlaylistOrBGSoundChoiceEditor editor = new RandomPlaylistOrBGSoundChoiceEditor(); editor.SetBGSoundChoice(element as Ares.Data.IBackgroundSoundChoice, project); ShowEditor(editor, parent); } else if (element is Ares.Data.ISequentialBackgroundMusicList) { SequentialPlaylistEditor editor = new SequentialPlaylistEditor(); editor.SetPlaylist(element as Ares.Data.ISequentialBackgroundMusicList, project); ShowEditor(editor, parent); } else if (element is Ares.Data.IMacro) { MacroEditor editor = new MacroEditor(); editor.SetContainer(element as Ares.Data.IMacro, project); ShowEditor(editor, parent); } else if (element is Ares.Data.IElementContainer <Ares.Data.IChoiceElement> ) { ChoiceContainerEditor editor = new ChoiceContainerEditor(); editor.SetContainer(element as Ares.Data.IElementContainer <Ares.Data.IChoiceElement>, project, false); ShowEditor(editor, parent); } else if (element is Ares.Data.ISequentialContainer) { SequentialContainerEditor editor = new SequentialContainerEditor(); editor.SetContainer(element as Ares.Data.ISequentialContainer, project); ShowEditor(editor, parent); } else if (element is Ares.Data.IElementContainer <Ares.Data.IParallelElement> ) { ParallelContainerEditor editor = new ParallelContainerEditor(); editor.SetContainer(element as Ares.Data.IElementContainer <Ares.Data.IParallelElement>, project); ShowEditor(editor, parent); } else if (element is Ares.Data.IMusicByTags) { MusicByTagsEditor editor = new MusicByTagsEditor(); editor.SetElement(element as Ares.Data.IMusicByTags, project); ShowEditor(editor, parent); } else if (element is Ares.Data.IReferenceElement) { Ares.Data.IElement referencedElement = Ares.Data.DataModule.ElementRepository.GetElement((element as Ares.Data.IReferenceElement).ReferencedId); if (referencedElement != null) { ShowEditor(referencedElement, container, project, parent); } } else if (element is Ares.Data.IWebRadioElement) { WebRadioEditor editor = new WebRadioEditor(); editor.SetElement(element as Ares.Data.IWebRadioElement, project, modeElement); ShowEditor(editor, parent); } else if (element is Ares.Data.IFileElement) { Ares.Data.IFileElement fileElement = (Ares.Data.IFileElement)element; if (fileElement.FilePath.EndsWith(".m3u", StringComparison.InvariantCultureIgnoreCase) || fileElement.FilePath.EndsWith(".m3u8", StringComparison.InvariantCultureIgnoreCase) || fileElement.FilePath.EndsWith(".pls", StringComparison.InvariantCultureIgnoreCase)) { String basePath = fileElement.SoundFileType == Data.SoundFileType.Music ? Ares.Settings.Settings.Instance.MusicDirectory : Ares.Settings.Settings.Instance.SoundDirectory; String filePath = System.IO.Path.Combine(basePath, fileElement.FilePath); System.Diagnostics.Process.Start(filePath); } else { FileElementEditor editor = new FileElementEditor(); editor.SetElement(element as Ares.Data.IFileElement, container, project); ShowEditor(editor, parent); } } } }
public void SetContainer(Ares.Data.IElementContainer <Ares.Data.IParallelElement> container, Ares.Data.IProject project) { ElementId = container.Id; m_Element = container; parallelContainerControl.SetContainer(container, project); volumeControl.SetElement(container, project); ElementSet(project); UpdateActiveElement(); Actions.ElementChanges.Instance.AddListener(-1, Update); }
public HideTagAction(int tagId, bool isHidden, Ares.Data.IProject project) { m_TagId = tagId; m_Hidden = isHidden; m_OldValue = project.GetHiddenTags().Contains(m_TagId); }
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; } } }
public abstract void Undo(Ares.Data.IProject project);
public HideCategoryAction(int categoryId, bool isHidden, Ares.Data.IProject project) { m_CategoryId = categoryId; m_Hidden = isHidden; m_OldValue = project.GetHiddenTagCategories().Contains(categoryId); }