示例#1
0
        public ChannelTimeline()
        {
            InitializeComponent();

            this.SetStyle(
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.UserPaint |
                ControlStyles.DoubleBuffer, true);

            selectedChannel = Seq.Sequencer.Song.Channels[0];
        }
示例#2
0
 public void ReadChunk(string id, long length, DarkInStream s)
 {
     if (id.Equals("CHAN"))
     {
         int index;
         s.Read(out index);
         Channels[index] = new Channel(index);
         s.ReadAllChunks(Channels[index]);
     }
 }
示例#3
0
 public Song()
 {
     for (int i = 0; i < Channels.Length; i++)
     {
         Channels[i] = new Channel(i);
         Channels[i].AddPatch(new Patch());
     }
 }
示例#4
0
        private void ChannelTimeline_MouseUp(object sender, MouseEventArgs e)
        {
            if (moving || selecting)
            {
                selectedChannel = GetChannelClosestTo(e.Y);
            }

            mousePos = e.Location;

            if (moving)
            {
                Point m = GetSelectedClipsMovement();
                foreach(Clip clip in selectedClips)
                {
                    Clip c = clip;

                    if (copying)
                    {
                        c = c.Clone();
                        Sequencer.Song.Channels[c.Channel.Number].AddClip(c);
                    }

                    c.StartTime += m.X;

                    if (m.Y != 0)
                    {
                        int oldChannel = c.Channel.Number;
                        int newChannel = oldChannel + m.Y;

                        Sequencer.Song.Channels[oldChannel].RemoveClip(c);
                        Sequencer.Song.Channels[newChannel].AddClip(c);
                    }
                }
            }

            if (creating)
            {
                UpdateCreatedClip();
                createdClip.Channel.AddClip(createdClip);
                selectedClips.Clear();
                selectedClips.Add(createdClip);
                createdClip = null;
            }

            moving = false;
            selecting = false;
            creating = false;
            Refresh();
        }
示例#5
0
        private void ChannelTimeline_MouseMove(object sender, MouseEventArgs e)
        {
            if (moving || selecting)
            {
                selectedChannel = GetChannelClosestTo(e.Y);
                Refresh();
            }

            mousePos = e.Location;

            if (creating)
            {
                UpdateCreatedClip();
            }

            if (creating || moving || selecting)
            {
                Refresh();
            }
        }
示例#6
0
        private void ChannelTimeline_MouseDown(object sender, MouseEventArgs e)
        {
            Channel lastSelected = selectedChannel;
            selectedChannel = GetChannelClosestTo(e.Y);
            Clip clickedClip = GetClipAt(e.Location);

            if (e.Button == MouseButtons.Left)
            {
                if (!selectedClips.Contains(clickedClip))
                {
                    selectedClips.Clear();

                    if (clickedClip != null)
                    {
                        selectedClips.Add(clickedClip);
                    }
                }

                if (clickedClip != null)
                {
                    moving = true;
                }
                else if (selectedChannel == lastSelected)
                {
                    creating = true;
                    createdClip = new Clip();
                    createdClip.Channel = selectedChannel;
                    int t = ConvertXToTime(e.X);
                    createdClip.StartTime = t - t % (Sequencer.Song.TicksPerBar);
                    createdClip.Length = Sequencer.Song.TicksPerBar;
                }

                mouseDownPos = e.Location;
            }

            mousePos = e.Location;

            Refresh();
        }