Beispiel #1
0
 public void ShowWarning_ControlsMustBeInTopVoice(DurationSymbol durationSymbol)
 {
     ShowVoiceWarning(durationSymbol, "control symbol");
 }
Beispiel #2
0
 public void ShowWarning_DynamicsMustBeInTopVoice(DurationSymbol durationSymbol)
 {
     ShowVoiceWarning(durationSymbol, "dynamic");
 }
Beispiel #3
0
 public void ShowVoiceWarning(DurationSymbol durationSymbol, string type)
 {
     int staffIndex = 0;
     int voiceIndex = 0;
     Staff staff = durationSymbol.Voice.Staff;
     foreach(Staff testStaff in staff.SVGSystem.Staves)
     {
         if(staff == testStaff)
             break;
         staffIndex++;
     }
     foreach(Voice voice in staff.Voices)
     {
         if(voice == durationSymbol.Voice)
             break;
         voiceIndex++;
     }
     string msg = "Found a " + type + " at\n" +
                 "    millisecond position " + durationSymbol.AbsMsPosition + "\n" +
                 "    staff index " + staffIndex.ToString() + "\n" +
                 "    voice index " + voiceIndex.ToString() + "\n\n" +
                 "Controls which are not attached to the top voice\n" +
                 "in a staff will be ignored.";
     MessageBox.Show(msg, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
 }
Beispiel #4
0
 private void InsertBeforeDS(List<NoteObject> noteObjects, DurationSymbol insertBeforeDS, ClefChangeSymbol invisibleClefChangeSymbol)
 {
     for(int i = 0; i < noteObjects.Count; ++i)
     {
         DurationSymbol durationSymbol = noteObjects[i] as DurationSymbol;
         if(durationSymbol != null && durationSymbol == insertBeforeDS)
         {
             noteObjects.Insert(i, invisibleClefChangeSymbol);
             break;
         }
     }
 }
Beispiel #5
0
 public NoteObjectMoment(DurationSymbol durationSymbol)
 {
     _msPosition = durationSymbol.MsPosition;
     AddNoteObject(durationSymbol);
 }
Beispiel #6
0
        /// <summary>
        /// Replaces the DurationSymbol symbolToBeReplaced (which is in this Voice's NoteObjects)
        /// by the all the noteObjects. Sets each of the noteObjects' Voice to this. 
        /// </summary>
        public void Replace(DurationSymbol symbolToBeReplaced, List<NoteObject> noteObjects)
        {
            #region conditions
            Debug.Assert(symbolToBeReplaced != null && symbolToBeReplaced.Voice == this);
            #endregion conditions

            List<NoteObject> tempList = new List<NoteObject>(this.NoteObjects);
            this.NoteObjects.Clear();
            int i = 0;
            while(tempList.Count > i && tempList[i] != symbolToBeReplaced)
            {
                this.NoteObjects.Add(tempList[i]);
                i++;
            }
            foreach(NoteObject noteObject in noteObjects)
            {
                noteObject.Voice = this;
                this.NoteObjects.Add(noteObject);
            }
            // tempList[i] is the symbolToBeReplaced
            i++;
            while(tempList.Count > i)
            {
                this.NoteObjects.Add(tempList[i]);
                i++;
            }
            tempList = null;
        }
Beispiel #7
0
 /// <summary>
 /// If there is a collision between them, move the barnumber above the first duration symbol in the voice.
 /// </summary>
 /// <param name="barnumberMetrics"></param>
 /// <param name="durationSymbolMetrics"></param>
 /// <param name="gap"></param>
 private void RemoveCollision(BarnumberMetrics barnumberMetrics, DurationSymbol durationSymbol, float gap)
 {
     ChordMetrics chordMetrics = durationSymbol.Metrics as ChordMetrics;
     float verticalOverlap = 0F;
     if(chordMetrics != null)
     {
         verticalOverlap = chordMetrics.OverlapHeight(barnumberMetrics, gap);
     }
     RestMetrics restMetrics = durationSymbol.Metrics as RestMetrics;
     if(restMetrics != null)
     {
         verticalOverlap = restMetrics.OverlapHeight(barnumberMetrics, gap);
         if(verticalOverlap > 0)
         {
             // fine tuning
             // compare with the extra padding given to these symbols in the RestMetrics constructor.
             switch(durationSymbol.DurationClass)
             {
                 case DurationClass.breve:
                 case DurationClass.semibreve:
                 case DurationClass.minim:
                 case DurationClass.crotchet:
                 case DurationClass.quaver:
                 case DurationClass.semiquaver:
                     break;
                 case DurationClass.threeFlags:
                     verticalOverlap -= gap;
                     break;
                 case DurationClass.fourFlags:
                     verticalOverlap -= gap * 2F;
                     break;
                 case DurationClass.fiveFlags:
                     verticalOverlap -= gap * 2.5F;
                     break;
             }
         }
     }
     if(verticalOverlap > 0)
         barnumberMetrics.Move(0F, -(verticalOverlap + gap));
 }