]> git.donarmstrong.com Git - lilypond.git/commitdiff
Move translation functions from output-lib.scm -> translation-functions.scm
authorNeil Puttock <n.puttock@gmail.com>
Wed, 19 Aug 2009 23:41:56 +0000 (00:41 +0100)
committerNeil Puttock <n.puttock@gmail.com>
Wed, 19 Aug 2009 23:41:56 +0000 (00:41 +0100)
* tablature formatters

* bar number visibility functions

* repeat count visibility functions

scm/output-lib.scm
scm/translation-functions.scm

index 142a2d0341df1807e223061333a7493af7d0d8df..444f77df06965be181cb0f660dbef72cb85914b7 100644 (file)
     (ly:text-interface::interpret-markup layout props text)))
 
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; tablature
-
-;; The TabNoteHead tablatureFormat callback.
-;; Compute the text grob-property
-(define-public (fret-number-tablature-format string context event)
-  (let* ((tuning (ly:context-property context 'stringTunings))
-        (pitch (ly:event-property event 'pitch))
-        (is-harmonic (apply
-                      functional-or
-                      (map
-                       (lambda (ev)
-                         (eq? 'harmonic-event (ly:event-property ev 'class)))
-                       (ly:event-property event 'articulations)))))
-
-    (make-whiteout-markup
-     (make-vcenter-markup
-      (format
-       "~a"
-       (- (ly:pitch-semitones pitch)
-         (list-ref tuning
-                   ;; remove 1 because list index starts at 0
-                   ;;and guitar string at 1.
-                   (1- string))))))))
-
-;; The 5-string banjo has got a extra string, the fifth (duh), which
-;; starts at the fifth fret on the neck.  Frets on the fifth string
-;; are referred to relative to the other frets:
-;;   the "first fret" on the fifth string is really the sixth fret
-;;   on the banjo neck.
-;; We solve this by defining a new fret-number-tablature function:
-(define-public (fret-number-tablature-format-banjo string context event)
-  (let* ((tuning (ly:context-property context 'stringTunings))
-        (pitch (ly:event-property event 'pitch)))
-
-    (make-whiteout-markup
-     (make-vcenter-markup
-      (let ((fret (- (ly:pitch-semitones pitch) (list-ref tuning (1- string)))))
-       (number->string (cond
-                        ((and (> fret 0) (= string 5))
-                         (+ fret 5))
-                        (else fret))))))))
-
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; note heads
 
                                          (- radius stem-thickness) 0 #t)))
          letter)))))
 
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; bar numbers
-
-(define-public ((every-nth-bar-number-visible n) barnum)
-  (= 0 (modulo barnum n)))
-
-(define-public ((modulo-bar-number-visible n m) barnum)
-  (and (> barnum 1) (= m (modulo barnum n))))
-
-(define-public ((set-bar-number-visibility n) tr)
-  (let ((bn (ly:context-property tr 'currentBarNumber)))
-    (ly:context-set-property! tr 'barNumberVisibility
-                             (modulo-bar-number-visible n (modulo bn n)))))
-
-(define-public (first-bar-number-invisible barnum) (> barnum 1))
-
-(define-public (all-bar-numbers-visible barnum) #t)
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; percent repeat counters
-
-(define-public ((every-nth-repeat-count-visible n) count context)
-  (= 0 (modulo count n)))
-
-(define-public (all-repeat-counts-visible count context) #t)
-
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; break visibility
 
index eefa9c0806a3b18088219b88cf413e7bccf45e5f..fb8ccac3c5b1dde2bfd8d812659144391005a9c2 100644 (file)
@@ -5,7 +5,10 @@
 ;;;; (c) 1998--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
 ;;;;                Jan Nieuwenhuizen <janneke@gnu.org>
 
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; metronome marks
+
 (define-public (format-metronome-markup text dur count context)
   (let* ((hide-note (eq? #t (ly:context-property context 'tempoHideNote))))
     (metronome-markup text dur count hide-note)))
@@ -80,7 +83,6 @@
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Bass figures.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (define-public (format-bass-figure figure event context)
   (let* ((fig (ly:event-property event 'figure))
 
     ))
 
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; fret diagrams
 
    (sort notes note-pitch>?))
 
   string-fret-fingering-tuples)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; tablature
+
+;; The TabNoteHead tablatureFormat callback.
+;; Compute the text grob-property
+(define-public (fret-number-tablature-format string context event)
+  (let* ((tuning (ly:context-property context 'stringTunings))
+        (pitch (ly:event-property event 'pitch))
+        (is-harmonic (apply
+                      functional-or
+                      (map
+                       (lambda (ev)
+                         (eq? 'harmonic-event (ly:event-property ev 'class)))
+                       (ly:event-property event 'articulations)))))
+
+    (make-whiteout-markup
+     (make-vcenter-markup
+      (format
+       "~a"
+       (- (ly:pitch-semitones pitch)
+         (list-ref tuning
+                   ;; remove 1 because list index starts at 0
+                   ;;and guitar string at 1.
+                   (1- string))))))))
+
+;; The 5-string banjo has got a extra string, the fifth (duh), which
+;; starts at the fifth fret on the neck.  Frets on the fifth string
+;; are referred to relative to the other frets:
+;;   the "first fret" on the fifth string is really the sixth fret
+;;   on the banjo neck.
+;; We solve this by defining a new fret-number-tablature function:
+(define-public (fret-number-tablature-format-banjo string context event)
+  (let* ((tuning (ly:context-property context 'stringTunings))
+        (pitch (ly:event-property event 'pitch)))
+
+    (make-whiteout-markup
+     (make-vcenter-markup
+      (let ((fret (- (ly:pitch-semitones pitch) (list-ref tuning (1- string)))))
+       (number->string (cond
+                        ((and (> fret 0) (= string 5))
+                         (+ fret 5))
+                        (else fret))))))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; bar numbers
+
+(define-public ((every-nth-bar-number-visible n) barnum)
+  (= 0 (modulo barnum n)))
+
+(define-public ((modulo-bar-number-visible n m) barnum)
+  (and (> barnum 1) (= m (modulo barnum n))))
+
+(define-public ((set-bar-number-visibility n) tr)
+  (let ((bn (ly:context-property tr 'currentBarNumber)))
+    (ly:context-set-property! tr 'barNumberVisibility
+                             (modulo-bar-number-visible n (modulo bn n)))))
+
+(define-public (first-bar-number-invisible barnum) (> barnum 1))
+
+(define-public (all-bar-numbers-visible barnum) #t)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; percent repeat counters
+
+(define-public ((every-nth-repeat-count-visible n) count context)
+  (= 0 (modulo count n)))
+
+(define-public (all-repeat-counts-visible count context) #t)