[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
define-*.scm
From: |
Nicolas Sceaux |
Subject: |
define-*.scm |
Date: |
Sat, 14 May 2005 12:46:56 +0200 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
Hello,
I was wondering if some syntax could be added in the scm/define-**.scm
files. For instance, a user may want to define a new music property,
to be used in a music function. I once had to do:
%% We add a `not-tuplefiable' music property
#(let ((my-prop 'not-tuplefiable))
(set-object-property! my-prop 'music-type? boolean?)
(set-object-property! my-prop 'music-doc "Set to #t if the sequence should
not be tuplefied by \\tuplefy")
(set! all-music-properties (cons my-prop all-music-properties)))
It would have been easier to do, eg:
#(define-music-property not-tuplefiable boolean?
"Set to #t if the sequence should not be tuplefied by \\tuplefy")
I suspect that define-music-properties.scm might also benefit from
that, by not using backquotes, unquotes, etc.
(define-all-music-properties
(iterator-ctor procedure? "Function to construct music-event-iterator
object for this Music")
(duration ly:duration? "Duration of this note/lyric.")
(metronome-count number? "How many beats in a minute?"))
This may be more obvious with scm/define-grobs.scm. There would be:
(define-grob-description Arpeggio (arpeggio-interface
staff-symbol-referencer-interface side-position-interface item-interface
font-interface)
(X-extent-callback Arpeggio::width_callback)
(Y-extent-callback #f)
(print-function Arpeggio::print)
(Y-offset-callbacks (list Staff_symbol_referencer::callback))
(X-offset-callbacks (list Side_position_interface::aligned_side))
(direction -1)
(padding 0.5)
(staff-position 0.0))
(define-grob-description TextSpanner (text-spanner-interface
side-position-interface font-interface spanner-interface)
(print-function Text_spanner::print)
(font-shape 'talic)
(style 'dashed-line)
(staff-padding 0.1)
(dash-fraction 0.2)
(dash-period 3.0)
(direction 1))
...
And a(n advanced) user could do, to override a bunch of grob
properties in eg an init file:
(custom-grob-descriptions
(Arpeggio padding 1.0)
(TextSpanner staff-padding 0.8)
;; ...
)
scm/define-music-types.scm could become:
(define-music-type MultiMeasureRestMusicGroup "Music" (general-music
sequential-music)
"Like sequential-music, but specifically intended
to group start-mmrest, skip, stop-mmrest sequence.
Syntax @code{R2.*5} for 5 measures in 3/4 time."
(length-callback Music_sequence::cumulative_length_callback)
(start-callback Music_sequence::first_start_callback)
(iterator-ctor Sequential_music_iterator::constructor))
(define-music-type AutoChangeMusic "Music_wrapper" (general-music
music-wrapper-music auto-change-instruction)
"Used for making voices that switch between piano staves automatically."
(iterator-ctor Auto_change_iterator::constructor))
(define-music-type SoloOneEvent "Event" (general-music event part-combine-event)
"Print Solo.1"
(part-combine-status 'solo1))
...
In scm/define-grobs.scm, we read:
;;;; WARNING: the meta field should be the last one.
;;;; WARNING: don't use anonymous functions for initialization.
;; TODO: junk the meta field in favor of something more compact?
Using define-grob-description, we could take care of that.
nicolas
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- define-*.scm,
Nicolas Sceaux <=