Esempio n. 1
0
        public static List <BarredBeat> genBeats(MeasureTreeNode measure_node)
        {
            List <IChordBounds> chords = (from node in measure_node.Children
                                          orderby(node as ChordTreeNode).getChord().Position.Index
                                          select(node as ChordTreeNode).getBounds()).ToList();
            int beat_length = (int)measure_node.getMeasure().TimeSignature.BeatType;
            var beats       = new List <BarredBeat>();

            while (chords.Any())
            {
                beats.Add(new BarredBeat(beat_length, chords));
            }

            return(beats);
        }
 public MeasureProperties(MeasureTreeNode m, GuiCommandExecutor exec, NodeClick c)
     : base(c, exec)
 {
     measure = m.getMeasure();
     resetToDefault();
 }
        public void runUpdate(NodeClick click, UpdateType update)
        {
            switch (update)
            {
            case UpdateType.UpdatePart:
                Updater.updatePartBounds(click.PartNode);
                break;

            case UpdateType.UpdateMeasuresAtAndAfter:
                MeasureTreeNode first_node = click.getFirstMeasureNodeByPosition();
                if (first_node == null)
                {
                    return;
                }

                MeasureTreeNode        prev_node = click.PartNode.getMeasureNodeAtPosition(first_node.getMeasure().Position.Index - 1);
                List <MeasureTreeNode> to_update = click.PartNode.getMeasureNodesAtAndAfterPosition(first_node.getMeasure().Position.Index);
                Updater.updateMeasureBoundsAtAndAfter(prev_node, to_update);
                break;

            case UpdateType.UpdateMeasure:
                Updater.updateMeasureBounds(click.MeasureNodes.FirstOrDefault());
                break;

            case UpdateType.UpdateChord:
                Updater.updateChordBounds(click.ChordNodes.FirstOrDefault());
                Updater.updateDrawing(click.ChordNodes.FirstOrDefault());
                break;

            case UpdateType.RedrawPart:
                Updater.updateRootDrawing();
                break;
            }
        }