public BarColumnRenderingInfo(BarColumn column, double position, double width) { this.Column = column; this.Position = position; this.Width = width; this.NoteBoundingBoxes = new Rect?[Defaults.Strings]; }
public bool ValidateColumn(TablatureContext context, ILogger logger, BarColumn column) { if (column.VoiceBeats.Count == 2 && column.VoiceBeats.All(b => b.StrumTechnique != StrumTechnique.None)) { if (column.VoiceBeats[0].StrumTechnique != column.VoiceBeats[1].StrumTechnique) { logger.Report(LogLevel.Warning, column.VoiceBeats[1].Range, Messages.Warning_ConflictedStrumTechniques); column.VoiceBeats[1].StrumTechnique = StrumTechnique.None; } } return(true); }
private async Task <double> GetColumnMinWidthInBar(PrimitiveRenderer primitiveRenderer, BarColumn column, PreciseDuration minDurationInBar) { var columnRegularWidth = Math.Min(this.Style.MaximumBeatSizeWithoutLyrics, this.Style.MinimumBeatSize * column.GetDuration() / minDurationInBar); double columnMinWidth; if (column.Lyrics == null) { columnMinWidth = this.Style.MinimumBeatSize; } else { var lyricsBounds = await primitiveRenderer.MeasureLyrics(column.Lyrics.Text); columnMinWidth = Math.Max(this.Style.MinimumBeatSize, lyricsBounds.Width); } return(Math.Max(columnRegularWidth, columnMinWidth)); }
public static double GetPositionInRow(this BarColumn column, BarRenderingContext rc) { return(rc.Owner.GetRelativeX(rc.ColumnRenderingInfos[column.ColumnIndex].Position + rc.Location.X)); }
public static double GetPosition(this BarColumn column, BarRenderingContext rc) { return(rc.ColumnRenderingInfos[column.ColumnIndex].Position); }
private void ArrangeColumns() { var lyricsSegmentIndex = 0; foreach (var segment in _bar.Rhythm.Segments) { if (segment.IsOmittedByTemplate) { continue; } var beats = new List <Beat>(); this.CreateArrangedBarBeats(beats, segment.TrebleVoice); this.CreateArrangedBarBeats(beats, segment.BassVoice); // group all beats by sorted positions var groups = beats.GroupBy(b => b.Position).OrderBy(g => g.Key); var isFirstBeat = true; foreach (var group in groups) { var columnIndex = _bar.Columns.Count; var column = new BarColumn(_bar, columnIndex); foreach (var beat in group) { beat.OwnerColumn = column; column.VoiceBeats.Add(beat); } column.Chord = segment.Chord; if (isFirstBeat) { column.IsFirstColumnOfSegment = true; } isFirstBeat = false; _bar.Columns.Add(column); } // fill in lyrics if (segment.TrebleVoice != null && _bar.Lyrics != null && lyricsSegmentIndex < _bar.Lyrics.Segments.Count) { foreach (var beat in segment.TrebleVoice.Beats) { if (lyricsSegmentIndex >= _bar.Lyrics.Segments.Count) { break; } beat.OwnerColumn.Lyrics = _bar.Lyrics.Segments[lyricsSegmentIndex]; ++lyricsSegmentIndex; } } } }