Exemple #1
0
 private void FromXmlElementToChannel(XmlElement channelElement)
 {
     Channel channel = new Channel();
     AddChannel(channel);
     foreach (XmlNode node in channelElement.ChildNodes)
     {
         if (node.Name == "number")
         {
             channel.ChannelNumber = int.Parse(node.InnerText);
         }
         else if (node.Name == "clip")
         {
             XmlElement element = (XmlElement)node;
             if (element.GetAttribute("type") == "spline")
             {
                 SplineClip clip = new SplineClip();
                 clip.FromXmlElement(element);
                 AddClip(clip, clip.Location, clip.Dimension.Width);
             }
             else if (element.GetAttribute("type") == "generator")
             {
                 GeneratorClip clip = new GeneratorClip();
                 clip.FromXmlElement(element);
                 AddClip(clip, clip.Location, clip.Dimension.Width);
             }
         }
     }
 }
        private void TimelineChannelsView_MouseUp(object sender, MouseEventArgs e)
        {
            if (timeline == null)
                return;

            if (Mode == Modes.Move)
            {
                if (inSelect)
                {
                    Invalidate(selectionRectangle);
                }

                if (inMove)
                {
                    moveRectangle = CalculateMoveRectangle();
                    Invalidate(moveRectangle);
                    timeline.MoveSelectedClips(CalculateMovePoint());
                }

                if (inResize)
                {
                    resizeRectangle = CalculateResizeRectangle();
                    Invalidate(resizeRectangle);
                    timeline.ResizeSelectedClips(CalculateResizeX());
                }
            }

            if (mode == Modes.DrawGenerator || mode == Modes.DrawSpline)
            {
                if (inDraw)
                {
                    drawRectangle = CalculateDrawRectangle();
                    Invalidate(drawRectangle);

                    Clip clip = null;
                    if (mode == Modes.DrawGenerator)
                        clip = new GeneratorClip();
                    else if (mode == Modes.DrawSpline)
                        clip = new SplineClip();

                    timeline.AddClip(clip, CalculateDrawPoint(), CalculateDrawBeats());
                }
            }
            inSelect = false;
            inResize = false;
            inMove = false;
            inDraw = false;
        }