]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/output-lib.scm
Issue 4294: Functions to display rhythmic information of a grob
[lilypond.git] / scm / output-lib.scm
index 7f956a54d574549efbf360575efc782ad817fb67..96456b1b77fb436ae4a90b6b7ae851c30fa01678 100644 (file)
   "Return the name of the grob @var{grob} as a symbol."
   (assq-ref (ly:grob-property grob 'meta) 'name))
 
+(define-public (grob::rhythmic-location grob)
+  "Return a pair consisting of the measure number and moment within
+   the measure of grob @var{grob}."
+  (let* (; all grobs support either spanner- or item-interface
+         (item (if (grob::has-interface grob 'spanner-interface)
+                   (ly:spanner-bound grob LEFT)
+                   grob))
+         (col (ly:item-get-column item)))
+    (if (ly:grob? col)
+        (ly:grob-property col 'rhythmic-location)
+        '())))
+
+(define-public (grob::when grob)
+  "Return the global timestep (a moment) of grob @var{grob}."
+  (let* (; all grobs support either spanner- or item-interface
+         (item (if (grob::has-interface grob 'spanner-interface)
+                   (ly:spanner-bound grob LEFT)
+                   grob))
+         (col (ly:item-get-column item)))
+    (if (ly:grob? col)
+        (ly:grob-property col 'when)
+        '())))
+
 (define-public (make-stencil-boxer thickness padding callback)
   "Return function that adds a box around the grob passed as argument."
   (lambda (grob)