public VirtualEffectRemoveDialog(VirtualEffectLibrary library)
 {
     InitializeComponent();
     foreach (KeyValuePair<Guid, VirtualEffect> pair in library) {
         ListViewItem lvItem = new ListViewItem(pair.Value.Name);
         lvItem.SubItems.Add(pair.Key.ToString());
         listViewVirtualEffects.Items.Add(lvItem);
     }
 }
Beispiel #2
0
        private void TimedSequenceEditorForm_Load(object sender, EventArgs e)
        {
            settingsPath =
                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vixen",
                               "TimedSequenceEditorForm.xml");
            ColorCollectionsPath =
                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vixen",
                               "ColorCollections.xml");

            if (File.Exists(settingsPath))
            {
                dockPanel.LoadFromXml(settingsPath, new DeserializeDockContent(DockingPanels_GetContentFromPersistString));
            }
            else
            {
                GridForm.Show(dockPanel);
                ToolsForm.Show(dockPanel, DockState.DockLeft);
                MarksForm.Show(dockPanel, DockState.DockLeft);
                EffectsForm.Show(dockPanel, DockState.DockLeft);
            }

            XMLProfileSettings xml = new XMLProfileSettings();

            //Get preferences
            _autoSaveTimer.Interval = xml.GetSetting(XMLProfileSettings.SettingType.Preferences, string.Format("{0}/AutoSaveInterval", Name), 300000);

            //Restore App Settings
            dockPanel.DockLeftPortion = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DockLeftPortion", Name), 150);
            dockPanel.DockRightPortion = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DockRightPortion", Name), 150);
            autoSaveToolStripMenuItem.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/AutoSaveEnabled", Name), true);
            toolStripButton_SnapTo.Checked = toolStripMenuItem_SnapTo.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SnapToSelected", Name), true);
            PopulateSnapStrength(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings,	string.Format("{0}/SnapStrength", Name), 2));
            toolStripMenuItem_ResizeIndicator.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ResizeIndicatorEnabled", Name),false);
            toolStripButton_DrawMode.Checked = TimelineControl.grid.EnableDrawMode = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DrawModeSelected", Name), false);
            toolStripButton_SelectionMode.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SelectionModeSelected", Name), true);
            ToolsForm.LinkCurves = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ToolPaletteLinkCurves", Name), false);
            ToolsForm.LinkGradients = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ToolPaletteLinkGradients", Name), false);
            cADStyleSelectionBoxToolStripMenuItem.Checked = TimelineControl.grid.aCadStyleSelectionBox = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/CadStyleSelectionBox", Name), false);
            CheckRiColorMenuItem(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ResizeIndicatorColor", Name), "Red"));

            foreach (ToolStripItem toolStripItem in toolStripDropDownButton_SnapToStrength.DropDownItems)
            {
                var toolStripMenuItem = toolStripItem as ToolStripMenuItem;
                if (toolStripMenuItem != null)
                {
                    if(TimelineControl.grid.SnapStrength.Equals(Convert.ToInt32(toolStripMenuItem.Tag)))
                    {
                        toolStripMenuItem.PerformClick();
                        break;
                    }
                }
            }

            WindowState = FormWindowState.Normal;

            if (xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowState", Name),
                "Normal").Equals("Maximized"))
            {
                WindowState = FormWindowState.Maximized;
            }
            else
            {
                var desktopBounds = new Rectangle(new Point(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationX", Name), Location.X),
                                xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationY", Name), Location.Y)),new Size(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowWidth", Name), Size.Width),
                            xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowHeight", Name), Size.Height)));
                if (IsVisibleOnAnyScreen(desktopBounds))
                {
                    DesktopBounds = desktopBounds;
                }
            }

            _effectNodeToElement = new Dictionary<EffectNode, Element>();
            _elementNodeToRows = new Dictionary<ElementNode, List<Row>>();

            TimelineControl.grid.RenderProgressChanged += OnRenderProgressChanged;

            TimelineControl.ElementChangedRows += ElementChangedRowsHandler;
            TimelineControl.ElementsMovedNew += timelineControl_ElementsMovedNew;
            TimelineControl.ElementDoubleClicked += ElementDoubleClickedHandler;
            TimelineControl.DataDropped += timelineControl_DataDropped;
            TimelineControl.ColorDropped += timelineControl_ColorDropped;
            TimelineControl.CurveDropped += timelineControl_CurveDropped;
            TimelineControl.GradientDropped += timelineControl_GradientDropped;

            TimelineControl.PlaybackCurrentTimeChanged += timelineControl_PlaybackCurrentTimeChanged;

            TimelineControl.RulerClicked += timelineControl_RulerClicked;
            TimelineControl.RulerBeginDragTimeRange += timelineControl_RulerBeginDragTimeRange;
            TimelineControl.RulerTimeRangeDragged += timelineControl_TimeRangeDragged;

            TimelineControl.MarkMoved += timelineControl_MarkMoved;
            TimelineControl.DeleteMark += timelineControl_DeleteMark;

            EffectsForm.EscapeDrawMode += EscapeDrawMode;

            MarksForm.MarkCollectionChecked += MarkCollection_Checked;
            MarksForm.EditMarkCollection += MarkCollection_Edit;
            MarksForm.ChangedMarkCollection += MarkCollection_Changed;

            ToolsForm.StartColorDrag += ToolPalette_ColorDrag;
            ToolsForm.StartCurveDrag += ToolPalette_CurveDrag;
            ToolsForm.StartGradientDrag += ToolPalette_GradientDrag;

            TimelineControl.SelectionChanged += TimelineControlOnSelectionChanged;
            TimelineControl.grid.MouseDown += TimelineControl_MouseDown;
            TimeLineSequenceClipboardContentsChanged += TimelineSequenceTimeLineSequenceClipboardContentsChanged;
            TimelineControl.CursorMoved += CursorMovedHandler;
            TimelineControl.ElementsSelected += timelineControl_ElementsSelected;
            TimelineControl.ContextSelected += timelineControl_ContextSelected;
            TimelineControl.SequenceLoading = false;
            TimelineControl.TimePerPixelChanged += TimelineControl_TimePerPixelChanged;
            TimelineControl.grid.SelectedElementsCloneDelegate = CloneElements;
            TimelineControl.grid.StartDrawMode += DrawElement;

            _virtualEffectLibrary =
                ApplicationServices.Get<IAppModuleInstance>(VirtualEffectLibraryDescriptor.Guid) as
                VirtualEffectLibrary;

            _curveLibrary = ApplicationServices.Get<IAppModuleInstance>(CurveLibraryDescriptor.ModuleID) as CurveLibrary;
            if (_curveLibrary != null)
            {
                _curveLibrary.CurveChanged += CurveLibrary_CurveChanged;
            }

            _colorGradientLibrary = ApplicationServices.Get<IAppModuleInstance>(ColorGradientLibraryDescriptor.ModuleID) as ColorGradientLibrary;
            if (_colorGradientLibrary != null)
            {
                _colorGradientLibrary.GradientChanged += ColorGradientLibrary_CurveChanged;
            }

            LoadAvailableEffects();
            PopulateDragBoxFilterDropDown();
            InitUndo();
            updateButtonStates();
            UpdatePasteMenuStates();
            LoadVirtualEffects();
            LoadColorCollections();

            _library = ApplicationServices.Get<IAppModuleInstance>(LipSyncMapDescriptor.ModuleID) as LipSyncMapLibrary;

            #if DEBUG
            ToolStripButton b = new ToolStripButton("[Debug Break]");
            b.Click += b_Click;
            toolStripOperations.Items.Add(b);
            #endif
        }
        public TimedSequenceEditorForm()
        {
            InitializeComponent();

            _effectNodeToElement = new Dictionary<EffectNode, Element>();
            _elementNodeToRows = new Dictionary<ElementNode, List<Row>>();

            timelineControl.ElementChangedRows += ElementChangedRowsHandler;
            timelineControl.ElementsMovedNew += timelineControl_ElementsMovedNew;
            timelineControl.ElementDoubleClicked += ElementDoubleClickedHandler;
            timelineControl.DataDropped += timelineControl_DataDropped;

            timelineControl.PlaybackCurrentTimeChanged += timelineControl_PlaybackCurrentTimeChanged;

            timelineControl.RulerClicked += timelineControl_RulerClicked;
            timelineControl.RulerBeginDragTimeRange += timelineControl_RulerBeginDragTimeRange;
            timelineControl.RulerTimeRangeDragged += timelineControl_TimeRangeDragged;

            timelineControl.SelectionChanged += TimelineControlOnSelectionChanged;
            TimeLineSequenceClipboardContentsChanged += TimelineSequenceTimeLineSequenceClipboardContentsChanged;
            timelineControl.CursorMoved += CursorMovedHandler;
            timelineControl.ElementsSelected += timelineControl_ElementsSelected;

            _virtualEffectLibrary = ApplicationServices.Get<IAppModuleInstance>(VixenModules.App.VirtualEffect.VirtualEffectLibraryDescriptor.Guid) as VirtualEffectLibrary;

            LoadAvailableEffects();
            InitUndo();
            updateButtonStates();
            LoadVirtualEffects();

            #if DEBUG
            ToolStripButton b = new ToolStripButton("[Debug Break]");
            b.Click += b_Click;
            toolStripOperations.Items.Add(b);
            #endif
        }
        private void TimedSequenceEditorForm_Load(object sender, EventArgs e)
        {
            settingsPath =
                System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), "Vixen",
                               "TimedSequenceEditorForm.xml");
            if (System.IO.File.Exists(settingsPath))
            {
                dockPanel.LoadFromXml(settingsPath, new DeserializeDockContent(DockingPanels_GetContentFromPersistString));
            } else {
                GridForm.Show(dockPanel);
                MarksForm.Show(dockPanel, WeifenLuo.WinFormsUI.Docking.DockState.DockLeft);
                EffectsForm.Show(dockPanel, WeifenLuo.WinFormsUI.Docking.DockState.DockLeft);
            }

            XMLProfileSettings xml = new XMLProfileSettings();
            dockPanel.DockLeftPortion = xml.GetSetting(string.Format("{0}/DockLeftPortion", this.Name), 150);
            dockPanel.DockRightPortion = xml.GetSetting(string.Format("{0}/DockLeftPortion", this.Name), 150);
            xml = null;

            _effectNodeToElement = new Dictionary<EffectNode, Element>();
            _elementNodeToRows = new Dictionary<ElementNode, List<Row>>();

            TimelineControl.grid.RenderProgressChanged += OnRenderProgressChanged;

            TimelineControl.ElementChangedRows += ElementChangedRowsHandler;
            TimelineControl.ElementsMovedNew += timelineControl_ElementsMovedNew;
            TimelineControl.ElementDoubleClicked += ElementDoubleClickedHandler;
            TimelineControl.DataDropped += timelineControl_DataDropped;

            TimelineControl.PlaybackCurrentTimeChanged += timelineControl_PlaybackCurrentTimeChanged;

            TimelineControl.RulerClicked += timelineControl_RulerClicked;
            TimelineControl.RulerBeginDragTimeRange += timelineControl_RulerBeginDragTimeRange;
            TimelineControl.RulerTimeRangeDragged += timelineControl_TimeRangeDragged;

            TimelineControl.MarkMoved += timelineControl_MarkMoved;
            TimelineControl.DeleteMark += timelineControl_DeleteMark;

            MarksForm.MarkCollectionChecked += MarkCollection_Checked;
            MarksForm.EditMarkCollection += MarkCollection_Edit;
            MarksForm.ChangedMarkCollection += MarkCollection_Changed;

            TimelineControl.SelectionChanged += TimelineControlOnSelectionChanged;
            TimelineControl.grid.MouseDown += TimelineControl_MouseDown;
            TimeLineSequenceClipboardContentsChanged += TimelineSequenceTimeLineSequenceClipboardContentsChanged;
            TimelineControl.CursorMoved += CursorMovedHandler;
            TimelineControl.ElementsSelected += timelineControl_ElementsSelected;
            TimelineControl.ContextSelected += timelineControl_ContextSelected;
            TimelineControl.SequenceLoading = false;

            _virtualEffectLibrary =
                ApplicationServices.Get<IAppModuleInstance>(VixenModules.App.VirtualEffect.VirtualEffectLibraryDescriptor.Guid) as
                VirtualEffectLibrary;

            LoadAvailableEffects();
            InitUndo();
            updateButtonStates();
            UpdatePasteMenuStates();
            LoadVirtualEffects();

            #if DEBUG
            ToolStripButton b = new ToolStripButton("[Debug Break]");
            b.Click += b_Click;
            toolStripOperations.Items.Add(b);
            #endif
        }