Inheritance: BaseSequence.Sequence
Beispiel #1
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (loadingTask != null && !loadingTask.IsCompleted && !loadingTask.IsFaulted && !loadingTask.IsCanceled)
            {
                cancellationTokenSource.Cancel();
            }

            //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;
            EffectsForm.Dispose();

            MarksForm.EditMarkCollection -= MarkCollection_Edit;
            MarksForm.MarkCollectionChecked -= MarkCollection_Checked;
            MarksForm.ChangedMarkCollection -= MarkCollection_Changed;
            MarksForm.Dispose();

            ToolsForm.StartColorDrag -= ToolPalette_ColorDrag;
            ToolsForm.StartCurveDrag -= ToolPalette_CurveDrag;
            ToolsForm.StartGradientDrag -= ToolPalette_GradientDrag;
            ToolsForm.Dispose();

            TimelineControl.SelectionChanged -= TimelineControlOnSelectionChanged;
            TimelineControl.grid.MouseDown -= TimelineControl_MouseDown;
            TimeLineSequenceClipboardContentsChanged -= TimelineSequenceTimeLineSequenceClipboardContentsChanged;
            TimelineControl.CursorMoved -= CursorMovedHandler;
            TimelineControl.ElementsSelected -= timelineControl_ElementsSelected;
            TimelineControl.ContextSelected -= timelineControl_ContextSelected;
            TimelineControl.TimePerPixelChanged -= TimelineControl_TimePerPixelChanged;
            TimelineControl.DataDropped -= timelineControl_DataDropped;

            Execution.ExecutionStateChanged -= OnExecutionStateChanged;
            _autoSaveTimer.Stop();
            _autoSaveTimer.Tick -= AutoSaveEventProcessor;

            if (_curveLibrary != null)
            {
                _curveLibrary.CurveChanged -= CurveLibrary_CurveChanged;
            }

            if (_colorGradientLibrary != null)
            {
                _colorGradientLibrary.GradientChanged -= ColorGradientLibrary_CurveChanged;
            }

            //GRRR - make the color collections a library at some point

            foreach (ToolStripItem toolStripItem in toolStripDropDownButton_SnapToStrength.DropDownItems)
            {
                var toolStripMenuItem = toolStripItem as ToolStripMenuItem;
                if (toolStripMenuItem != null)
                {
                    toolStripMenuItem.Click -= toolStripButtonSnapToStrength_MenuItem_Click;
                }
            }

            if (disposing && (components != null))
            {
                components.Dispose();
                TimelineControl.Dispose();
                GridForm.Dispose();
            }

            if (_effectNodeToElement != null)
            {
                _effectNodeToElement.Clear();
                _effectNodeToElement = null;
            }

            if (_elementNodeToRows != null)
            {
                _elementNodeToRows.Clear();
                _elementNodeToRows = null;
            }

            if (_sequence != null)
            {
                _sequence.Dispose();
                _sequence = null;
            }

            dockPanel.Dispose();

            base.Dispose(disposing);
            GC.Collect();
        }
        private void loadSequence(Vixen.Sys.ISequence sequence)
        {
            // check if it's the right type of sequence that we know how to deal with. If not, complain bitterly.
            if(sequence is TimedSequence)
                _sequence = (TimedSequence)sequence;
            else {
                throw new NotImplementedException("Cannot use sequence type with a Timed Sequence Editor");
            }

            // default the sequence to 1 minute if it's not set
            if(_sequence.Length == TimeSpan.Zero)
                _sequence.Length = _defaultSequenceTime;

            SequenceLength = _sequence.Length;

            // update our program context with this sequence
            OpenSequenceContext(sequence);

            // clear out all the old data
            loadSystemNodesToRows();

            // load the new data: get all the commands in the sequence, and make a new element for each of them.
            _effectNodeToElement = new Dictionary<EffectNode, Element>();
            foreach(EffectNode node in _sequence.SequenceData.EffectData) {
                addElementForEffectNode(node);
            }

            populateGridWithMarks();

            populateWaveformAudio();

            //Original code set modified to always be true upon loading a sequence.
            //sequenceModified();
            //This path is followed for new and existing sequences so we need to determine which we have and set modified accordingly.
            //Added logic to determine if the sequence has a filepath to set modified JU 8/1/2012.

            _SetTimingToolStripEnabledState();

            if(String.IsNullOrEmpty(_sequence.FilePath)) {
                sequenceModified();
            } else {
                sequenceNotModified();
            }
        }
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (_loadingTask != null && !_loadingTask.IsCompleted && !_loadingTask.IsFaulted && !_loadingTask.IsCanceled)
            {
                _cancellationTokenSource.Cancel();
            }

            //TimelineControl.grid.RenderProgressChanged -= OnRenderProgressChanged;

            TimelineControl.ElementChangedRows -= ElementChangedRowsHandler;
            TimelineControl.ElementsMovedNew -= timelineControl_ElementsMovedNew;
            TimelineControl.ElementDoubleClicked -= ElementDoubleClickedHandler;
            //TimelineControl.DataDropped -= timelineControl_DataDropped;
            TimelineControl.grid.DragOver -= TimelineControlGrid_DragOver;
            TimelineControl.grid.DragEnter -= TimelineControlGrid_DragEnter;
            TimelineControl.grid.DragDrop -= TimelineControlGrid_DragDrop;

            TimelineControl.PlaybackCurrentTimeChanged -= timelineControl_PlaybackCurrentTimeChanged;

            TimelineControl.RulerClicked -= timelineControl_RulerClicked;
            TimelineControl.RulerBeginDragTimeRange -= timelineControl_RulerBeginDragTimeRange;
            TimelineControl.RulerTimeRangeDragged -= timelineControl_TimeRangeDragged;
            TimelineControl.MarkMoved -= timelineControl_MarkMoved;
            TimelineControl.DeleteMark -= timelineControl_DeleteMark;

            if (_effectsForm != null && !_effectsForm.IsDisposed)
            {
                EffectsForm.Dispose();
            }

            if (_effectEditorForm != null && !_effectEditorForm.IsDisposed)
            {
                EffectEditorForm.Dispose();
            }

            if (_marksForm != null && !_marksForm.IsDisposed)
            {
                _marksForm.Dispose();
            }

            if (_toolPaletteForm != null && !_toolPaletteForm.IsDisposed)
            {
                ToolsForm.Dispose();
            }

            if (_layerEditor != null && !_layerEditor.IsDisposed)
            {
                _layerEditor.Dispose();
            }

            TimelineControl.SelectionChanged -= TimelineControlOnSelectionChanged;
            TimelineControl.grid.MouseDown -= TimelineControl_MouseDown;
            TimeLineSequenceClipboardContentsChanged -= TimelineSequenceTimeLineSequenceClipboardContentsChanged;
            TimelineControl.CursorMoved -= CursorMovedHandler;
            TimelineControl.ElementsSelected -= timelineControl_ElementsSelected;
            TimelineControl.ContextSelected -= timelineControl_ContextSelected;
            TimelineControl.TimePerPixelChanged -= TimelineControl_TimePerPixelChanged;
            TimelineControl.VisibleTimeStartChanged -= TimelineControl_VisibleTimeStartChanged;
            Row.RowHeightChanged -= TimeLineControl_Row_RowHeightChanged;
            //TimelineControl.DataDropped -= timelineControl_DataDropped;

            Execution.ExecutionStateChanged -= OnExecutionStateChanged;
            _autoSaveTimer.Stop();
            _autoSaveTimer.Tick -= AutoSaveEventProcessor;

            if (_curveLibrary != null)
            {
                _curveLibrary.CurveChanged -= CurveLibrary_CurveChanged;
            }

            if (_colorGradientLibrary != null)
            {
                _colorGradientLibrary.GradientChanged -= ColorGradientLibrary_CurveChanged;
            }

            //GRRR - make the color collections a library at some mouseLocation

            foreach (ToolStripItem toolStripItem in toolStripDropDownButton_SnapToStrength.DropDownItems)
            {
                var toolStripMenuItem = toolStripItem as ToolStripMenuItem;
                if (toolStripMenuItem != null)
                {
                    toolStripMenuItem.Click -= toolStripButtonSnapToStrength_MenuItem_Click;
                }
            }

            if (disposing && (components != null))
            {
                components.Dispose();
                TimelineControl.Dispose();
                GridForm.Dispose();
            }

            if (_effectNodeToElement != null)
            {
                _effectNodeToElement.Clear();
                _effectNodeToElement = null;
            }

            if (_elementNodeToRows != null)
            {
                _elementNodeToRows.Clear();
                _elementNodeToRows = null;
            }

            if (_sequence != null)
            {
                _sequence.Dispose();
                _sequence = null;
            }

            dockPanel.Dispose();

            base.Dispose(disposing);
        }
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (loadingTask != null && !loadingTask.IsCompleted && !loadingTask.IsFaulted && !loadingTask.IsCanceled)
            {
                cancellationTokenSource.Cancel();
            }

            //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.EditMarkCollection -= MarkCollection_Edit;
            MarksForm.MarkCollectionChecked -= MarkCollection_Checked;
            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;

            //;
            if (disposing && (components != null))
            {
                components.Dispose();

                TimelineControl.Dispose();

            }
            if (_effectNodeToElement != null)
            {
                _effectNodeToElement.Clear();
                _effectNodeToElement = null;
            }
            if (_elementNodeToRows != null)
            {
                _elementNodeToRows.Clear();
                _elementNodeToRows = null;
            }
            if (_sequence != null)
            {
                _sequence.Dispose();
                _sequence = null;
            }
            base.Dispose(disposing);
            GC.Collect();
        }