RE: Is it possible to have a single \override for same context/Grob for different property values?
Hello, -Original Message- From: Carl Sorensen [mailto:c_soren...@byu.edu] Sent: 25 January 2011 00:17 To: Neil Puttock Cc: James Lowe; lilypond-devel Subject: Re: Is it possible to have a single \override for same context/Grob for different property values? On 1/24/11 5:15 PM, Neil Puttock n.putt...@gmail.com wrote: On 25 January 2011 00:10, Carl Sorensen c_soren...@byu.edu wrote: If you use pairs, instead of lists, for the property overrides then the override list is a standard alist: \overrideGrobProps #'Accidental #`((color . ,red) (font-size . 4) (extra-offset . (1.5 . 3))) Yup, but then you have to type those annoying full stops (or periods, if you prefer. :) This is true, but it's also consistent with the standard idiom of LilyPond (another GLISS discussion, I suppose) So is that a yes or no? :) What I am trying to avoid a scheme-code implementation in my .ly file simply because as a 'normal' user all that stuff is hard for me. I expect I am not the only one who struggles with knowing when to use a Grob and/or context (or which one even) the properties are not such a big deal once you figure the context out - some \overrides seem to not need a grob and some do but anyway - to give you some context of where this came from http://lsr.dsi.unimi.it/LSR/Item?id=375 The construct uses notes = { \repeat unfold 5 { f,16 e' d' c' } \repeat unfold 5 { a16 c, e, c } \repeat unfold 5 { b16 f' c' g' } \repeat unfold 5 { d,16 g c f } \repeat unfold 5 { e,16 g b d } \repeat unfold 5 { g,16 a b c } \repeat unfold 5 { \stemDown d,16 a' e' b' } } damping = \repeat unfold 7 { %% default beam damping is 1: \override Beam #'damping = #1 s4^1 (def.) \override Beam #'damping = #2 s^2 \override Beam #'damping = #4 s^4 \override Beam #'damping = #-3 s^-3 \override Beam #'damping = #+inf.0 s^+inf.0 } And then have the construct \notes \damping This works but if I want two or more overrides for the same group of notes it breaks down. So I was looking how to apply a 'single' instance of an override with the same context but for multiple properties. I realise that this might not be the best way for 'day to day' scores but I can see some user for this for theoretical pieces or simplifying the creation of musical exercises for instance. James ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Is it possible to have a single \override for same context/Grob for different property values?
On 24 January 2011 17:30, James Lowe james.l...@datacore.com wrote: So I wondered if it is possible to save some lines of code/simplify overrides for the same context/Grob such that I can write 'something like' \override context.GrobName ( ( #'property1 = #value1) (#'property2 = #value2) (#'property3 = #value3) ) Here's an idea: overrideGrobProps = #(define-music-function (parser location grob-name prop-list) (symbol? cheap-list?) (make-sequential-music (map (lambda (entry) (make-grob-property-override grob-name (car entry) (cadr entry))) prop-list))) \relative c' { c4 cis d des % apply \override to list of properties + values (not \once) \overrideGrobProps #'Accidental #`((color ,red) (font-size 4) (extra-offset (1.5 . 3))) \overrideGrobProps #'NoteHead #'((style mensural) (duration-log 0)) c4 cis d des } Cheers, Neil ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Is it possible to have a single \override for same context/Grob for different property values?
On 1/24/11 4:55 PM, Neil Puttock n.putt...@gmail.com wrote: On 24 January 2011 17:30, James Lowe james.l...@datacore.com wrote: So I wondered if it is possible to save some lines of code/simplify overrides for the same context/Grob such that I can write 'something like' \override context.GrobName ( ( #'property1 = #value1) (#'property2 = #value2) (#'property3 = #value3) ) Here's an idea: overrideGrobProps = #(define-music-function (parser location grob-name prop-list) (symbol? cheap-list?) (make-sequential-music (map (lambda (entry) (make-grob-property-override grob-name (car entry) (cadr entry))) prop-list))) \relative c' { c4 cis d des % apply \override to list of properties + values (not \once) \overrideGrobProps #'Accidental #`((color ,red) (font-size 4) (extra-offset (1.5 . 3))) If you use pairs, instead of lists, for the property overrides then the override list is a standard alist: \overrideGrobProps #'Accidental #`((color . ,red) (font-size . 4) (extra-offset . (1.5 . 3))) Seems like this might be able to be implemented in core LilyPond, but it's a GLISS topic, I think. Great idea! Carl ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Is it possible to have a single \override for same context/Grob for different property values?
On 25 January 2011 00:10, Carl Sorensen c_soren...@byu.edu wrote: If you use pairs, instead of lists, for the property overrides then the override list is a standard alist: \overrideGrobProps #'Accidental #`((color . ,red) (font-size . 4) (extra-offset . (1.5 . 3))) Yup, but then you have to type those annoying full stops (or periods, if you prefer. :) Cheers, Neil ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Is it possible to have a single \override for same context/Grob for different property values?
On 1/24/11 5:15 PM, Neil Puttock n.putt...@gmail.com wrote: On 25 January 2011 00:10, Carl Sorensen c_soren...@byu.edu wrote: If you use pairs, instead of lists, for the property overrides then the override list is a standard alist: \overrideGrobProps #'Accidental #`((color . ,red) (font-size . 4) (extra-offset . (1.5 . 3))) Yup, but then you have to type those annoying full stops (or periods, if you prefer. :) This is true, but it's also consistent with the standard idiom of LilyPond (another GLISS discussion, I suppose) Thanks, Carl ___ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel