Ejemplo n.º 1
0
        public ChordProperties(ChordTreeNode c, GuiCommandExecutor ex, NodeClick cl)
            : base(cl, ex)
        {
            chord = c.getChord();

            CurrentLength = chord.Length.NoteType.getStringFromNoteLength();
            Lengths       = NoteLengthExtensions.getAllLengthStrings();
        }
Ejemplo n.º 2
0
        public void readNoteLengthsFromFile(Dictionary <string, string> parsed_file)
        {
            var dict = new Dictionary <NoteLength, int>();

            foreach (var entry in parsed_file)
            {
                dict.Add(NoteLengthExtensions.getNoteLengthFromString(entry.Key), int.Parse(parsed_file[entry.Key]));
            }
            note_lengths = dict;
        }
Ejemplo n.º 3
0
 public static TupleLength createInstance(int note_length, int type)
 {
     if (NoteLengthExtensions.intIsValidNoteLength(note_length) &&
         TupletTypeExtensions.intIsValidTupletType(type))
     {
         return(new TupleLength((NoteLength)note_length, (TupletType)type));
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 4
0
        public Dictionary <NoteLength, string> getRestImagePaths(Dictionary <string, string> file_names)
        {
            var image_dict = new Dictionary <NoteLength, string>();

            foreach (string length_name in file_names.Keys)
            {
                NoteLength length = NoteLengthExtensions.getNoteLengthFromString(length_name);
                image_dict.Add(length, file_names[length_name]);
            }

            return(image_dict);
        }
Ejemplo n.º 5
0
        public Dictionary <NoteLength, ImageBrush> getLengthImages(Dictionary <string, string> uri_dict)
        {
            var image_dict = new Dictionary <NoteLength, ImageBrush>();

            foreach (var entry in uri_dict)
            {
                NoteLength length = NoteLengthExtensions.getNoteLengthFromString(entry.Key);
                var        brush  = new ImageBrush();
                brush.ImageSource = SettingsReader.getImageFromLocation(entry.Value);

                image_dict[length] = brush;
            }

            return(image_dict);
        }
Ejemplo n.º 6
0
        public override void submitChanges()
        {
            int        beat_type_i = (Int32.TryParse(BeatType, out int beat)) ? beat : 0;
            NoteLength beat_type_n = NoteLengthExtensions.getNoteLengthFromVisualLength(beat_type_i);

            if (NumBeatsError == String.Empty || BeatTypeError == String.Empty || BpmError == String.Empty || !Int32.TryParse(NumBeats, out int num_beats_i) ||
                beat_type_n == NoteLength.None || !Int32.TryParse(BPM, out int bpm_i))
            {
                return;
            }

            if (num_beats_i != measure.TimeSignature.NumberOfBeats || beat_type_n != measure.TimeSignature.BeatType)
            {
                executor.executeChangeMeasureTimeSigFromMenu(getClickCopy(), num_beats_i, beat_type_n);
            }
            if (bpm_i != measure.Bpm)
            {
                executor.executeChangeMeasureBpmFromMenu(getClickCopy(), bpm_i);
            }
        }
Ejemplo n.º 7
0
        public Dictionary <NoteLength, ImageBrush> getLengthImages(Dictionary <string, string> uri_dict)
        {
            var needed_lengths = new List <NoteLength>()
            {
                NoteLength.Half, NoteLength.Quarter, NoteLength.Eighth, NoteLength.Sixeteenth, NoteLength.ThirtySecond
            };
            var image_dict = new Dictionary <NoteLength, ImageBrush>();

            foreach (var entry in uri_dict)
            {
                NoteLength length = NoteLengthExtensions.getNoteLengthFromString(entry.Key);
                if (needed_lengths.Contains(length))
                {
                    var brush = new ImageBrush();
                    brush.ImageSource = SettingsReader.getImageFromLocation(entry.Value);

                    image_dict[length] = brush;
                }
            }

            return(image_dict);
        }
Ejemplo n.º 8
0
 public void setTimeSigNoteLengthProperty(ref string prop, string value, ref string error)
 {
     if (value == String.Empty)
     {
         error = "required field";
     }
     else if (Int32.TryParse(value, out int converted))
     {
         NoteLength length = NoteLengthExtensions.getNoteLengthFromVisualLength(converted);
         if (length == NoteLength.None)
         {
             error = "must be 2, 4, 8, 16, or 32";
         }
         else
         {
             error = "";
         }
     }
     else
     {
         error = "must be a number";
     }
     prop = value;
 }