Reviewers: carl.d.sorensen_gmail.com,
Message:
A few questions.
http://codereview.appspot.com/4182056/diff/1/scm/define-markup-commands.scm
File scm/define-markup-commands.scm (right):
http://codereview.appspot.com/4182056/diff/1/scm/define-markup-commands.scm#newcode994
scm/define-markup-commands.scm:994: (define (nest-patterns pattern
pattern-width distance count patterns)
Ok. So, the input arguments will be "count", "pattern" and "distance"
(in this order) ? Or just "count" and "pattern" ?
With the property "word-space" instead of "distance"...
http://codereview.appspot.com/4182056/diff/1/scm/define-markup-commands.scm#newcode1021
scm/define-markup-commands.scm:1021: }
Maybe a smaller example ? Shall we see more possibilities ? With a
\override #'(line-width . 50) for example.
http://codereview.appspot.com/4182056/diff/1/scm/define-markup-commands.scm#newcode1032
scm/define-markup-commands.scm:1032: (x-offset (+ (* (- (- middle-width
(* patterns-number period)) pattern-width) (/ (1+ dir) 2)) (abs (car
pattern-x-extent)))))
It will be done (my Lord ;o) )
Description:
Add dots to tocItemMarkup
* scm/define-markup-commands.scm
New markup command : fill-with-pattern
* ly/toc-init.ly
Add dots to tocItemMarkup
Please review this at http://codereview.appspot.com/4182056/
Affected files:
M ly/toc-init.ly
M scm/define-markup-commands.scm
Index: ly/toc-init.ly
diff --git a/ly/toc-init.ly b/ly/toc-init.ly
index
dda4f31ab4d13250336decea7f2c3e57c87485e6..7f0a10622f7df7e230d8c2ef7e690443260286b3
100644
--- a/ly/toc-init.ly
+++ b/ly/toc-init.ly
@@ -26,9 +26,7 @@
\fill-line { \null "Table of Contents" \null }
\hspace #1
}
- tocItemMarkup = \markup \fill-line {
- \fromproperty #'toc:text \fromproperty #'toc:page
- }
+ tocItemMarkup = \markup \fill-with-pattern #1.5 #RIGHT "." \fromproperty
#'toc:text \fromproperty #'toc:page
}
#(define-markup-list-command (table-of-contents layout props) ()
Index: scm/define-markup-commands.scm
diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm
index
5dbc5d2f5254b61bd4e3bd4c42b4143807501812..69c9122d3708ecda32142efd7b40bbe88d83ba76
100644
--- a/scm/define-markup-commands.scm
+++ b/scm/define-markup-commands.scm
@@ -991,6 +991,50 @@ If there are no arguments, return an empty stencil.
X)))
line-contents))))
+(define (nest-patterns pattern pattern-width distance count patterns)
+ (if (zero? count)
+ patterns
+ (nest-patterns pattern pattern-width distance (1- count) (markup
patterns #:with-dimensions (cons 0 pattern-width) '(0 . 0) pattern (markup
#:hspace distance)))))
+
+(define-markup-command (fill-with-pattern layout props period dir pattern
left right)
+ (number? number? markup? markup? markup?)
+ #:category align
+ #:properties ((word-space)
+ (line-width))
+ "
+@cindex filling line with pattern
+Put @vars{left} and @vars{right} in a horizontal line of width
@vars{line-width} with a line of markups @vars{pattern} in between.
+Patterns are spaced apart by @vars{period}.
+Patterns are aligned to the @vars{dir} markup.
+@lilypond[verbatim, quote]
+\\markup \\column {
+ \"right-aligned :\"
+ \\fill-with-pattern #1.5 #RIGHT . first right
+ \\fill-with-pattern #1.5 #RIGHT . second right
+ \\null
+ \"center-aligned :\"
+ \\fill-with-pattern #2 #CENTER - left right
+ \\null
+ \"left-aligned :\"
+ \\fill-with-pattern #2.5 #LEFT : left first
+ \\fill-with-pattern #2.5 #LEFT : left second
+}
+@end lilypond"
+ (let* ((pattern-x-extent (ly:stencil-extent (interpret-markup layout
props pattern) X))
+ (pattern-width (interval-length pattern-x-extent))
+ (left-width (interval-length (ly:stencil-extent (interpret-markup
layout props left) X)))
+ (right-width (interval-length (ly:stencil-extent
(interpret-markup layout props right) X)))
+ (middle-width (- line-width (+ (+ left-width right-width) (*
word-space 2))))
+ (period (max period pattern-width))
+ (patterns-number (truncate (/ (- middle-width pattern-width)
period)))
+ (distance-between-patterns (- period pattern-width))
+ (patterns (markup))
+ (x-offset (+ (* (- (- middle-width (* patterns-number period))
pattern-width) (/ (1+ dir) 2)) (abs (car pattern-x-extent)))))
+ (interpret-markup layout props
+ (markup left
+ #:override '(word-space . 0)
#:with-dimensions (cons 0 middle-width) '(0 . 0) #:translate (cons x-offset
0) (markup (nest-patterns pattern pattern-width distance-between-patterns
patterns-number patterns) pattern)
+ right))))
+
(define-markup-command (line layout props args)
(markup-list?)
#:category align
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel