length-callback and start-callback as "read-only".
* scm/music-functions.scm (unfold-repeats): rewrite. Cannot set
length-callback after creation.
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.
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"));
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));
}
(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 ))))
))
(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")
(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.")
(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? "")
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.")
)))
(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)
(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))
(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)