コード例 #1
0
 public BarColumnRenderingInfo(BarColumn column, double position, double width)
 {
     this.Column            = column;
     this.Position          = position;
     this.Width             = width;
     this.NoteBoundingBoxes = new Rect?[Defaults.Strings];
 }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: BarRenderer.cs プロジェクト: hillinworks/tabml
        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));
        }
コード例 #4
0
 public static double GetPositionInRow(this BarColumn column, BarRenderingContext rc)
 {
     return(rc.Owner.GetRelativeX(rc.ColumnRenderingInfos[column.ColumnIndex].Position + rc.Location.X));
 }
コード例 #5
0
 public static double GetPosition(this BarColumn column, BarRenderingContext rc)
 {
     return(rc.ColumnRenderingInfos[column.ColumnIndex].Position);
 }
コード例 #6
0
ファイル: BarArranger.cs プロジェクト: hillinworks/tabml
        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;
                    }
                }
            }
        }