Example #1
0
 /// <summary>
 /// Appends a chord to the phrase
 /// </summary>
 /// <param name="c">Chord to append</param>
 public void Add(Chord c)
 {
     this._chords.Add(_chords.Count, c);
 }
Example #2
0
 public void Clear()
 {
     _currentChord = new Chord(_nStrings);
     _drawer.Invalidate();
 }
Example #3
0
        protected void InitializeDrawingComponents()
        {
            InitializeColors();
            _stringMatrix = new SortedDictionary<int, Rectangle>();
            _currentChord = new Chord(_nStrings);
            Point center = new Point(_drawer.Width / 2, _drawer.Height / 2);
            int rectHeight = (_nStrings + 1) * _stringWidth;
            int rectWidth = _drawer.Width - 10;
            this._stringRect = new Rectangle((center.X - rectWidth / 2), (center.Y - rectHeight / 2), rectWidth, rectHeight);

            //init _stringMatrix
            Rectangle r;
            int x = center.X - _cursorSize.Width / 2;
            int y = _stringRect.Location.Y;
            for (int i = 1; i <= _nStrings; i++)
            {
                r = new Rectangle(new Point(x, (y + i * _stringWidth - _cursorSize.Height / 2)), _cursorSize);
                _stringMatrix.Add(i, r);
            }

            this._drawer.Paint += new PaintEventHandler(_drawer_Paint);
        }
Example #4
0
        /// <summary>
        /// Converts a string representation of a chord into a chord object
        /// </summary>
        /// <param name="s">String representation of the chord</param>
        /// <returns>Chord object</returns>
        public static Chord Parse(String s)
        {
            Chord retVal = null;
            try
            {
                int last = s.IndexOf("]");
                String chordStr = s.Substring(0, last).Trim(new char[] { '[', ']' });
                String flagStr = s.Substring(last + 1).Trim(new char[] { '(', ')' });
                String[] chords = chordStr.Split(',');

                retVal = new Chord(chords.Length);
                for (int i = 0; i < chords.Length; i++)
                    retVal[i] = int.Parse(chords[i]);

                if (flagStr == "H")
                    retVal.ChordFlags = ChordFlags.Harmonic;
                else if (flagStr == "PM")
                    retVal.ChordFlags = ChordFlags.PalmMute;
            }
            catch (Exception) { throw; }

            return retVal;
        }