Beispiel #1
0
        private void timelineControl_CurveDropped(object sender, ToolDropEventArgs e)
        {
            List<Element> elementList = new List<Element>();

            if (e.Element.Selected)
                elementList = TimelineControl.SelectedElements.ToList();
            else
                elementList.Add(e.Element);

            Curve droppedCurve = _curveLibrary.GetCurve(e.Data.GetData(DataFormats.StringFormat).ToString());
            foreach (Element elem in elementList)
            {
                Curve curve = new Curve(droppedCurve);

                if (ToolsForm.LinkCurves)
                {
                    curve.LibraryReferenceName = e.Data.GetData(DataFormats.StringFormat).ToString();
                }
                else
                {
                    curve.LibraryReferenceName = string.Empty;
                    curve.UnlinkFromLibraryCurve();
                }

                curve.IsCurrentLibraryCurve = false;

                object[] parms = elem.EffectNode.Effect.ParameterValues;
                switch (elem.EffectNode.Effect.EffectName)
                {
                    case "Alternating":
                        if (e.MouseButton == MouseButtons.Right || Control.ModifierKeys.HasFlag(Keys.Control))
                        {
                            parms[13] = curve;
                        }
                        else
                        {
                            parms[12] = curve;
                        }
                        break;
                    case "Pulse":
                        parms[0] = curve;
                        break;
                    case "Chase":
                        parms[5] = curve;
                        break;
                    case "Spin":
                        parms[11] = curve;
                        break;
                    case "Wipe":
                        parms[2] = curve;
                        break;
                }
                elem.EffectNode.Effect.ParameterValues = parms;
                TimelineControl.grid.RenderElement(elem);
            }
            sequenceModified();
        }
Beispiel #2
0
        private void timelineControl_GradientDropped(object sender, ToolDropEventArgs e)
        {
            List<Element> elementList = new List<Element>();

            if (e.Element.Selected)
                elementList = TimelineControl.SelectedElements.ToList();
            else
                elementList.Add(e.Element);

            ColorGradient droppedGradient = _colorGradientLibrary.GetColorGradient(e.Data.GetData(DataFormats.StringFormat).ToString());
            foreach (Element elem in elementList)
            {
                ColorGradient gradient = new ColorGradient(droppedGradient);

                if (ToolsForm.LinkGradients)
                {
                    gradient.LibraryReferenceName = e.Data.GetData(DataFormats.StringFormat).ToString();
                }
                else
                {
                    gradient.LibraryReferenceName = string.Empty;
                    gradient.UnlinkFromLibrary();
                }

                gradient.IsCurrentLibraryGradient = false;

                object[] parms = elem.EffectNode.Effect.ParameterValues;
                switch (elem.EffectNode.Effect.EffectName)
                {
                    case "Alternating":
                        if (e.MouseButton == MouseButtons.Right || Control.ModifierKeys.HasFlag(Keys.Control))
                        {
                            parms[9] = false;
                            parms[11] = gradient;
                        }
                        else
                        {
                            parms[8] = false;
                            parms[10] = gradient;
                        }
                        break;
                    case "Pulse":
                        parms[1] = gradient;
                        break;
                    case "Chase":
                        parms[0] = ToolsForm.GradientHandling;
                        parms[4] = gradient;
                        break;
                    case "Spin":
                        parms[2] = ToolsForm.GradientHandling;
                        parms[10] = gradient;
                        break;
                    case "Twinkle":
                        parms[7] = ToolsForm.GradientHandling;
                        parms[9] = gradient;
                        break;
                    case "Wipe":
                        parms[0] = gradient;
                        break;
                }
                elem.EffectNode.Effect.ParameterValues = parms;
                TimelineControl.grid.RenderElement(elem);
            }
            sequenceModified();
        }
Beispiel #3
0
        private void timelineControl_ColorDropped(object sender, ToolDropEventArgs e)
        {
            List<Element> elementList = new List<Element>();

            if (e.Element.Selected)
                elementList = TimelineControl.SelectedElements.ToList();
            else
                elementList.Add(e.Element);

            Color color = (Color)e.Data.GetData(typeof(Color));
            foreach (Element elem in elementList)
            {
                object[] parms = elem.EffectNode.Effect.ParameterValues;
                switch (elem.EffectNode.Effect.EffectName)
                {
                    case "Alternating":
                        if (e.MouseButton == MouseButtons.Right || Control.ModifierKeys.HasFlag(Keys.Control))
                        {
                            parms[3] = color;
                            parms[9] = true;
                        }
                        else
                        {
                            parms[1] = color;
                            parms[8] = true;
                        }
                        break;
                    case "Set Level":
                        parms[1] = color;
                        break;
                    case "Pulse":
                        parms[1] = new ColorGradient(color);
                        break;
                    case "Chase":
                        parms[0] = 0; // StaticColor
                        parms[3] = color;
                        break;
                    case "Spin":
                        parms[2] = 0; // StaticColor
                        parms[9] = color;
                        break;
                    case "Twinkle":
                        parms[7] = 0; // StaticColor
                        parms[8] = color;
                        break;
                    case "Wipe":
                        parms[0] = new ColorGradient(color);
                        break;
                }
                //TODO:
                //this would be a good place to build a list of target elements, and the new parameters
                //list could be passed to a ModifyElements method to do the work in "one step"
                elem.EffectNode.Effect.ParameterValues = parms;
                TimelineControl.grid.RenderElement(elem);
            }
            sequenceModified();
        }