]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/define-music-properties.scm (all-music-properties): document
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 25 May 2005 10:22:34 +0000 (10:22 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 25 May 2005 10:22:34 +0000 (10:22 +0000)
length-callback and start-callback as "read-only".

* scm/music-functions.scm (unfold-repeats): rewrite. Cannot set
length-callback after creation.

ChangeLog
lily/global-context.cc
scm/define-grobs.scm
scm/define-music-properties.scm
scm/lily-library.scm
scm/music-functions.scm

index dbd9be457ca948780bc5ac7db917784ae8476322..acf72389c1cf0c1d835675951e27d123432ed7e1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-05-25  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * scm/define-music-properties.scm (all-music-properties): document
+       length-callback and start-callback as "read-only".
+
+       * scm/music-functions.scm (unfold-repeats): rewrite. Cannot set
+       length-callback after creation. 
+
        * scripts/convert-ly.py (conv): unfoldrepeats -> unfoldRepeats,
        compressmusic -> compressMusic.
 
index 3a251eb891caeae523c9277ddb4ffbdb5aaed6c2..df9187d1e5df9363620bc804fd9a16678bc81e92 100644 (file)
@@ -155,7 +155,8 @@ Global_context::run_iterator_on_me (Music_iterator *iter)
       if (!get_score_context ())
        {
          SCM sym = ly_symbol2scm ("Score");
-         Context_def *t = unsmob_context_def (find_context_def (get_output_def (), sym));
+         Context_def *t = unsmob_context_def (find_context_def (get_output_def (),
+                                                                sym));
          if (!t)
            error (_f ("can't find `%s' context", "Score"));
 
@@ -177,6 +178,7 @@ Global_context::apply_finalizations ()
   SCM lst = get_property ("finalizations");
   set_property ("finalizations", SCM_EOL);
   for (SCM s = lst; scm_is_pair (s); s = scm_cdr (s))
+    
     /* TODO: make safe.  */
     scm_primitive_eval (scm_car (s));
 }
index 6c535a8c76a42420f43f06d93a402aae5a028a6e..4e0d9708c7164053d88727f89956522f395f8d15 100644 (file)
        (before-line-breaking-callback . ,Paper_column::before_line_breaking)
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
 
-;              (print-function . ,Paper_column::print) (font-name . "ecrm8") (Y-extent-callback . #f)
+               (print-function . ,Paper_column::print) (font-name . "ecrm8") (Y-extent-callback . #f)
        (meta . ((interfaces . (paper-column-interface axis-group-interface spaceable-grob-interface item-interface ))))
        ))
 
index 9d789dbbd109c9d0913152aafcc9176694400438..ef68b93f24bd159eb1334134255a042c64379baa 100644 (file)
@@ -58,7 +58,8 @@ e.g. @code{\\tag #'part ...} could tag a piece of music as only being active in
      (label ,markup? "label of a mark.")
      (last-pitch ,ly:pitch? "The last pitch after relativization.")
      (length ,ly:moment? "The duration of this music")
-     (length-callback ,procedure? "How to compute the duration of this music")
+     (length-callback ,procedure? "How to compute the duration of this music. This property
+can only be defined as initializer in @file{define-music-types.scm}.")
      (internal-class-name ,string? "C++ class to use for this Music object") 
      (name ,symbol? "Name of this music object")
      (numerator ,integer? "numerator of a time signature")
@@ -73,7 +74,8 @@ For chord inversions, this is negative.")
      (pitch-alist ,list? "list of pitches jointly forming the scale of a key signature")
      (pop-first ,boolean? "Do a revert before we try to do a override on some grob property.")
      (procedure ,procedure?
-               "The function to run with \\applycontext. It must take a single argument, being the context.")
+               "The function to run with \\applycontext.
+It must take a single argument, being the context.")
      (property-operations ,list?
                          "Do these operations for instantiating the context.")
      (predicate ,procedure? "the predicate of a \\outputproperty.")
@@ -86,9 +88,10 @@ For chord inversions, this is negative.")
      (repeat-count  ,integer? "do a @code{\repeat} how ofen?")
      (span-direction ,ly:dir? "Does this start or stop a spanner?")
      (split-list ,list? "splitting moments for part combiner.")
-     (start-callback ,procedure? "Function to compute the negative length of
-starting grace notes.")
-     (string-number ,integer? "The number of the string in a String_number_req")
+     (start-callback ,procedure? "Function to compute the negative
+length of starting grace notes.  This property can only be defined as
+initializer in @file{define-music-types.scm}.")
+     (string-number ,integer? "The number of the string in a StringNumberEvent")
      (symbol ,symbol? "Grob name to perform an override/revert on.")
      (text ,markup? "markup expression to be printed")
      (tremolo-type ,integer? "")
@@ -106,7 +109,7 @@ solo1, solo2 and unisono")
 a string) for figured bass")
      (alteration ,number? "alteration for figured bass")
      (bracket-start ,boolean? "start a bracket
-here. TODO: use span requests?")
+here. TODO: use SpanEvents?")
      (bracket-stop ,boolean? "stop a bracket here.")
      (untransposable ,boolean? "If set, this music is not transposed.")
      )))
index 3f77e9a174ae36a21b7189241f04840834a1b3e5..4683ccead2a249b4d2e95746be3488c6343d4bc3 100644 (file)
@@ -134,6 +134,13 @@ found."
       (let ((k (assoc (car keys) lst)))
        (if k k (first-assoc (cdr keys) lst)))))
 
+(define-public (flatten-alist alist)
+  (if (null? alist)
+      '()
+      (cons (caar alist)
+           (cons (cdar alist)
+                 (flatten-alist (cdr alist))))))
+
 ;;;;;;;;;;;;;;;;
 ;; vector
 (define-public (vector-for-each proc vec)
index bab748a7c0ac9b7d269afb5dce541b2d81e35c2e..45f3fada95af1eaf68c1af31251ad03ff9cab38e 100644 (file)
@@ -213,14 +213,21 @@ Returns `obj'.
 (define-public (unfold-repeats music)
   "
 This function replaces all repeats  with unfold repeats. "
-  
+
   (let ((es (ly:music-property music 'elements))
        (e  (ly:music-property music 'element))
        )
     (if (memq 'repeated-music (ly:music-property music 'types))
-       (begin
-         (if (equal? (ly:music-property music 'iterator-ctor)
-                     Chord_tremolo_iterator::constructor)
+       (let*
+           ((props (ly:music-mutable-properties music))
+            (old-name (ly:music-property music 'name))
+            (flattened  (flatten-alist props)))
+
+         (set! music (apply make-music (cons 'UnfoldedRepeatedMusic
+                                             flattened)))
+
+         (display old-name)
+         (if (equal? old-name 'TremoloRepeatedMusic)
              (let* ((seq-arg? (memq 'sequential-music
                                     (ly:music-property e 'types)))
                     (count  (ly:music-property music 'repeat-count))
@@ -234,14 +241,9 @@ This function replaces all repeats  with unfold repeats. "
                                             (ly:intlog2 count)) dot-shift)
                
                (if seq-arg?
-                   (ly:music-compress e (ly:make-moment (length (ly:music-property e 'elements)) 1)))))
+                   (ly:music-compress e (ly:make-moment (length (ly:music-property
+                                                                 e 'elements)) 1)))))))
          
-         (set! (ly:music-property music 'length-callback)
-               Repeated_music::unfolded_music_length)
-         (set! (ly:music-property music 'start-callback)
-               Repeated_music::first_start)
-         (set! (ly:music-property music 'iterator-ctor)
-               Unfolded_repeat_iterator::constructor)))
     
     (if (pair? es)
        (set! (ly:music-property music 'elements)