Re: [frogs] Stepping into the code for nested properties

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]


On 11 May 2010 17:59, Carl Sorensen <c_sorensen@xxxxxxx> wrote:

> IIUC, the default values are part of the *context* properties, rather than
> part of the *grob* properties.  If there is no grob property list, then the
> value of the properties is determined from the defaults in the context.

Each grob is a context property (I learned this from you during our
discussions on autobeaming. :)

The defaults for each grob are contained in all-grob-descriptions (in
scm/define-grobs.scm), which the parser uses via \grobdescriptions to
set each grob in the Global context.  You can see how this works by
using \applyContext:

#(use-modules (ice-9 pretty-print))

\new Voice \relative c' {
  cis d e f
  \applyContext #(lambda (ctx)
                   (pretty-print
                    (ly:context-property ctx 'Accidental)))
}

Once an override comes along, the defaults are updated recursively
(updated_grob_properties ()) to carry over any overrides from parent
contexts.  The overrides are prepended to a copy of the default alist,
which itself is prepended to the default settings:

#(use-modules (ice-9 pretty-print))

\new Voice \relative c' {
  \override Accidental #'color = #red
  cis d e f
  \applyContext #(lambda (ctx)
                   (pretty-print
                    (ly:context-property ctx 'Accidental)))
}

> Also, IIUC, when you call execute_override_property, you don't *replace* the
> override, you *prepend* it.  Or at least, that's what happens for non-nested
> properties.  It's possible that that *doesn't* happen for nested properties,
> and may be the cause of some of the nested-property bugs.

It looks the same for nested properties, as far as I can tell.

Cheers,
Neil

---
----
Join the Frogs!


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/