lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Add dots to tocItemMarkup (issue4172047)


From: percival . music . ca
Subject: Add dots to tocItemMarkup (issue4172047)
Date: Tue, 15 Feb 2011 00:53:38 +0000

Reviewers: ,

Message:
LGTM.

Description:
Add dots to tocItemMarkup

* New markup command fill-with-dots

* Add it to tocItemMarkup

Please review this at http://codereview.appspot.com/4172047/

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..1f07fb6db17d2b407cf490809c7267ab00ad25d2 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-dots \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..8e6514fe872c89d52bd9c5f9ae92623f12fcf618 100644
--- a/scm/define-markup-commands.scm
+++ b/scm/define-markup-commands.scm
@@ -1013,6 +1013,26 @@ determines the space between markups in @var{args}.
      word-space
      (remove ly:stencil-empty? stencils))))

+(define-markup-command (fill-with-dots layout props left right)
+  (markup? markup?)
+  #:category align
+  "
address@hidden filling line with dots
+Fill-line between markups @code{left} and @code{right} with a postscript dotted line
address@hidden, quote]
+\\markup {
+  \\fill-with-dots left right
+}
address@hidden lilypond"
+ (let* ((left-width (cdr (ly:stencil-extent (interpret-markup layout props left) X))) + (right-width (cdr (ly:stencil-extent (interpret-markup layout props right) X))) + (middle-width (- (ly:output-def-lookup layout 'line-width) (+ left-width right-width)))
+         (offset (- middle-width (* (truncate (/ middle-width 1.5)) 1.5))))
+    (interpret-markup layout props
+                      (markup left
+ #:with-dimensions (cons 0 middle-width) '(0 . 0) #:postscript (string-append "0.25 setlinewidth 1 setlinecap [0 1.5] 0 setdash " (number->string offset) " 0.12 moveto " (number->string middle-width) " 0 rlineto stroke")
+                              right))))
+
 (define-markup-command (concat layout props args)
   (markup-list?)
   #:category align





reply via email to

[Prev in Thread] Current Thread [Next in Thread]