public static GuitarHandPosition CreateEvent(GuitarMessageList owner, TickPair ticks, int noteFret)
 {
     var ret = new GuitarHandPosition(owner, ticks, noteFret);
     ret.IsNew = true;
     ret.CreateEvents();
     return ret;
 }
예제 #2
0
        public static GuitarHandPosition CreateEvent(GuitarMessageList owner, TickPair ticks, int noteFret)
        {
            var ret = new GuitarHandPosition(owner, ticks, noteFret);

            ret.IsNew = true;
            ret.CreateEvents();
            return(ret);
        }
예제 #3
0
        public bool CreateHandPositionEvents()
        {
            try
            {
                Remove(Messages.HandPositions.ToList());

                var ownerTrack = Messages.Owner.MidiTrack;

                var x108 = Generate108();

                foreach (var item in x108)
                {
                    GuitarHandPosition.CreateEvent(Messages, item.Ticks, item.Fret);
                }

                return(true);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                return(false);
            }
        }
        private void Draw108Event(Graphics g, bool tabActive, bool drawSelected,
            GuitarHandPosition ev, int downTick, int upTick, string text, SolidBrush tb)
        {
            var st = GetScreenPointFromTick(downTick);
            var et = GetScreenPointFromTick(upTick);
            if (et > 0 && st < Width)
            {
                if (st < 0)
                    st = 0;
                if (et > Width)
                    et = Width;

                g.FillRectangle(tb,
                    st,
                    0, et - st,
                    Height - HScroll.Height - 1);
                using (var p = new Pen(tb))
                {

                    g.DrawRectangle(p, st, 0, et - st, Height - HScroll.Height - 1);
                }

                if (!ZoomedOutFar)
                {
                    var size = g.MeasureString(text, Utility.fretFont);

                    var textRect = new RectangleF((float)st, (size.Height * (0)) + (0 * size.Height * 0.1f),
                            size.Width, size.Height);
                    for (int idx = 0; idx < 8; idx++)
                    {
                        var ntr = new RectangleF((float)st, (size.Height * (idx)) + (idx * size.Height * 0.1f),
                            size.Width, size.Height);

                        if (VisibleTextEvents.CountOverlapping(ntr) == 0)
                        {
                            textRect = ntr;
                            VisibleTextEvents.Add(GuitarTextEvent.GetTextEvent(GuitarTrack, downTick, text),
                                ntr);
                            break;
                        }
                    }

                    using (var tbg = new SolidBrush(Color.FromArgb(tabActive ? (drawSelected ? 255 : 180) : 80, Utility.BackgroundBrush.Color)))
                    {
                        g.FillRectangle(tbg,
                            textRect.X, textRect.Y, textRect.Width, textRect.Height + 1);
                    }
                    using (var tbg = new Pen(Color.FromArgb(180, Utility.noteBoundPen.Color)))
                    {
                        g.DrawRectangle(tbg,
                            textRect.X, textRect.Y, textRect.Width, textRect.Height + 1);
                    }
                    using (var fb = new SolidBrush(Color.FromArgb(180, Utility.fretBrush.Color)))
                    {
                        var tl = textRect.Location;
                        tl.X -= 1;

                        textRect.Location = tl;
                        textRect.Width += 3;
                        g.DrawString(text,
                        Utility.fretFont,
                        fb,
                        textRect, StringFormat.GenericDefault);
                    }
                }
            }
        }