public void AddChannel(Channel channel) { int number = 0; foreach (Channel presentChannel in channels) if (number < presentChannel.ChannelNumber) number = presentChannel.ChannelNumber; channel.ChannelNumber = number + 1; channel.Y = channels.Count; channels.Add(channel); OnChannelAdded(channel); channel.StateChanged += channelStateChangedHandler; }
private void AddChannel(Channel channel) { TimelineChannelPropertiesView p = new TimelineChannelPropertiesView(); p.MouseDown += new MouseEventHandler(this.timelineChannelPropertiesView_MouseDown); p.Top = channel.Y * (channelPadding * 2 + channelHeight) + channelPadding; p.Width = Width; p.Left = 0; p.Value = channel.ChannelNumber; p.BackColor = Color.FromArgb(130, 130, 130); Channel c = channel; p.ValueChanged += delegate(object o, EventArgs e2) { c.ChannelNumber = p.Value; }; Controls.Add(p); UpdateSize(); }
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); } } } }
public EventArgs(Channel channel, ICollection<Clip> clips) { Channel = channel; Clips = clips; }
private void channel_StateChanged(Channel channel) { OnChannelStateChanged(channel); }
private XmlElement FromChannelToXmlElement(Channel channel, XmlDocument doc) { XmlElement channelElement = doc.CreateElement("channel"); XmlElement number = doc.CreateElement("number"); number.InnerText = channel.ChannelNumber.ToString(); channelElement.AppendChild(number); foreach (Clip clip in channel.Clips) channelElement.AppendChild(clip.ToXmlElement(doc)); return channelElement; }
protected void OnChannelStateChanged(Channel channel) { if (ChannelStateChanged != null) ChannelStateChanged(new Timeline.EventArgs(channel, new List<Clip>())); }
protected void OnChannelRemoved(Channel channel) { if (ChannelRemoved != null) ChannelRemoved(new Timeline.EventArgs(channel, null)); }
public void RemoveChannel(Channel channel) { channel.StateChanged -= channelStateChangedHandler; foreach (Clip clip in channel.Clips) clip.StateChanged -= clipStateChangedHandler; channels.Remove(channel); foreach (Channel presentChannel in channels) if (presentChannel.Y > channel.Y) presentChannel.Y--; OnChannelRemoved(channel); channel.Dispose(); UpdateCoreClips(); }
private void PaintChannel(PaintEventArgs e, Channel channel) { if (channel.IsSelected) { Brush b = new SolidBrush(Color.FromArgb(40, 40, 40)); e.Graphics.FillRectangle(b, ChannelDimensionToPixelDimension(channel)); b.Dispose(); } }
private Rectangle ChannelDimensionToPixelDimension(Channel channel) { Rectangle result = new Rectangle(0, channel.Y, 0, 1); result = BeatDimensionToPixelDimension(result); result.Width = Width; return result; }