X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Documentation%2Fextending%2Fprogramming-interface.itely;h=9fd578b2bd6262f0a42963f64f32c70392f5271c;hb=d409c67cbbdebe840220c17f796544a8a9dd193e;hp=46d7fd512fa08490edcbfe5b993aa960a07c49ad;hpb=34fc5bf1293e0bbdea8519118112b50dd1256ac7;p=lilypond.git diff --git a/Documentation/extending/programming-interface.itely b/Documentation/extending/programming-interface.itely index 46d7fd512f..9fd578b2bd 100644 --- a/Documentation/extending/programming-interface.itely +++ b/Documentation/extending/programming-interface.itely @@ -8,7 +8,7 @@ Guide, node Updating translation committishes.. @end ignore -@c \version "2.15.18" +@c \version "2.17.6" @node Interfaces for programmers @chapter Interfaces for programmers @@ -359,7 +359,7 @@ manualBeam = (parser location beg-end) (pair?) #@{ - \once \override Beam #'positions = #beg-end + \once \override Beam.positions = #beg-end #@}) \relative c' @{ @@ -378,7 +378,7 @@ manualBeam = (parser location beg end) (number? number?) #{ - \once \override Beam #'positions = #(cons beg end) + \once \override Beam.positions = #(cons beg end) #}) \relative c' { @@ -399,14 +399,14 @@ AltOn = (parser location mag) (number?) #{ - \override Stem #'length = #(* 7.0 mag) - \override NoteHead #'font-size = + \override Stem.length = #(* 7.0 mag) + \override NoteHead.font-size = #(inexact->exact (* (/ 6.0 (log 2.0)) (log mag))) #}) AltOff = { - \revert Stem #'length - \revert NoteHead #'font-size + \revert Stem.length + \revert NoteHead.font-size } \relative c' { @@ -424,12 +424,12 @@ withAlt = (parser location mag music) (number? ly:music?) #{ - \override Stem #'length = #(* 7.0 mag) - \override NoteHead #'font-size = + \override Stem.length = #(* 7.0 mag) + \override NoteHead.font-size = #(inexact->exact (* (/ 6.0 (log 2.0)) (log mag))) - $music - \revert Stem #'length - \revert NoteHead #'font-size + #music + \revert Stem.length + \revert NoteHead.font-size #}) \relative c' { @@ -458,7 +458,7 @@ displayBarNum = (parser location) () (if (eq? #t (ly:get-option 'display-bar-numbers)) - #@{ \once \override Score.BarNumber #'break-visibility = ##f #@} + #@{ \once \override Score.BarNumber.break-visibility = ##f #@} #@{#@})) @end example @@ -756,7 +756,7 @@ padding. "Draw a double box around text." (interpret-markup layout props #@{\markup \override #'(box-padding . 0.4) \box - \override #'(box-padding . 0.6) \box @{ $text @}#@})) + \override #'(box-padding . 0.6) \box @{ #text @}#@})) @end lisp or, equivalently @@ -800,7 +800,7 @@ now as follows: (interpret-markup layout props #@{\markup \override #`(box-padding . ,inter-box-padding) \box \override #`(box-padding . ,box-padding) \box - @{ $text @} #@})) + @{ #text @} #@})) @end lisp Again, the equivalent version using the markup macro would be: @@ -836,7 +836,7 @@ customized: (interpret-markup layout props #{\markup \override #`(box-padding . ,inter-box-padding) \box \override #`(box-padding . ,box-padding) \box - { $text } #})) + { #text } #})) \markup \double-box A \markup \override #'(inter-box-padding . 0.8) \double-box A @@ -942,7 +942,7 @@ indented. The indent width is taken from the @code{props} argument. #(define-markup-list-command (paragraph layout props args) (markup-list?) #:properties ((par-indent 2)) (interpret-markup-list layout props - #@{\markuplist \justified-lines @{ \hspace #par-indent $args @} #@})) + #@{\markuplist \justified-lines @{ \hspace #par-indent #args @} #@})) @end example @@ -1028,19 +1028,18 @@ current bar number on the standard output during the compile: @cindex calling code on layout objects @funindex \applyOutput - The most versatile way of tuning an object is @code{\applyOutput} which works by inserting an event into the specified context (@rinternals{ApplyOutputEvent}). Its syntax is @example -\applyOutput @var{context} @var{proc} +\applyOutput @var{Context} @var{proc} @end example @noindent where @code{@var{proc}} is a Scheme function, taking three arguments. When interpreted, the function @code{@var{proc}} is called for -every layout object found in the context @code{@var{context}} at +every layout object found in the context @code{@var{Context}} at the current time step, with the following arguments: @itemize @item the layout object itself, @@ -1069,6 +1068,14 @@ note-heads on the center-line and next to it: } @end lilypond +To have @var{function} interpreted at the @code{Score} or @code{Staff} +level use these forms + +@example +\applyOutput #'Score #@var{function} +\applyOutput #'Staff #@var{function} +@end example + @node Callback functions @section Callback functions @@ -1077,13 +1084,13 @@ Properties (like @code{thickness}, @code{direction}, etc.) can be set at fixed values with @code{\override}, e.g. @example -\override Stem #'thickness = #2.0 +\override Stem.thickness = #2.0 @end example Properties can also be set to a Scheme procedure, @lilypond[fragment,verbatim,quote,relative=2] -\override Stem #'thickness = #(lambda (grob) +\override Stem.thickness = #(lambda (grob) (if (= UP (ly:grob-property grob 'direction)) 2.0 7.0)) @@ -1153,7 +1160,7 @@ my-callback = #(lambda (grob) TODO: the example for this section is ill-chosen since @example -F = -\tweak #'font-size #-3 -\flageolet +F = -\tweak font-size #-3 -\flageolet @end example (note the @samp{-} marking it as a post event) will actually work fine for the stated purpose. Until this section gets a rewrite, let's @@ -1163,7 +1170,7 @@ The main disadvantage of @code{\tweak} is its syntactical inflexibility. For example, the following produces a syntax error. @example -F = \tweak #'font-size #-3 -\flageolet +F = \tweak font-size #-3 -\flageolet \relative c'' @{ c4^\F c4_\F @@ -1258,7 +1265,7 @@ of the broken tie is repositioned. (ly:grob-set-property! grob 'extra-offset '(-2 . 5))))) \relative c'' { - \override Tie #'after-line-breaking = + \override Tie.after-line-breaking = #my-callback c1 ~ \break c2 ~ c @@ -1281,9 +1288,10 @@ and @code{PaperColumn}. They can be changed with the @example \overrideProperty -#"Score.NonMusicalPaperColumn" % Grob name -#'line-break-system-details % Property name -#'((next-padding . 20)) % Value +Score.NonMusicalPaperColumn % Grob name + . line-break-system-details % Property name + . next-padding % Optional subproperty name + #20 % Value @end example Note, however, that @code{\override}, applied to