From e85cdadfabb9be13a1cf7686af23d6fa1deb3cde Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 17 Oct 2005 00:38:04 +0000 Subject: [PATCH] (Difficult tweaks): use callbacks. --- ChangeLog | 3 ++ Documentation/user/advanced-notation.itely | 2 +- Documentation/user/basic-notation.itely | 2 +- Documentation/user/changing-defaults.itely | 46 +++++++++++----------- scm/document-translation.scm | 13 +++--- 5 files changed, 35 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1bf3a05b47..1776338107 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-10-17 Han-Wen Nienhuys + * Documentation/user/changing-defaults.itely (Difficult tweaks): + use callbacks. + * lily/context-property.cc (execute_general_pushpop_property): robustness checks. diff --git a/Documentation/user/advanced-notation.itely b/Documentation/user/advanced-notation.itely index 2a8c8c79ec..a201da7a21 100644 --- a/Documentation/user/advanced-notation.itely +++ b/Documentation/user/advanced-notation.itely @@ -1525,7 +1525,7 @@ tsMarkup =\markup { } { - \override Staff.TimeSignature #'print-function = #Text_interface::print + \override Staff.TimeSignature #'callbacks #'stencil = #Text_interface::print \override Staff.TimeSignature #'text = #tsMarkup \time 3/2 c'2 \bar ":" c'4 c'4. diff --git a/Documentation/user/basic-notation.itely b/Documentation/user/basic-notation.itely index bde43e6dcd..7db71430b6 100644 --- a/Documentation/user/basic-notation.itely +++ b/Documentation/user/basic-notation.itely @@ -2987,7 +2987,7 @@ Isolated percents can also be printed. This is done by putting a multi measure rest with a different print function, @lilypond[fragment,verbatim] -\override MultiMeasureRest #'print-function +\override MultiMeasureRest #'callbacks #'stencil = #Multi_measure_rest::percent R1 @end lilypond diff --git a/Documentation/user/changing-defaults.itely b/Documentation/user/changing-defaults.itely index 97adb3e0c3..a4a03db479 100644 --- a/Documentation/user/changing-defaults.itely +++ b/Documentation/user/changing-defaults.itely @@ -1140,18 +1140,25 @@ does not amount to much. The initialization file @example (Fingering - . ((print-function . ,Text_interface::print) - (padding . 0.6) - (staff-padding . 0.6) + . ((padding . 0.5) + (avoid-slur . around) + (slur-padding . 0.2) + (staff-padding . 0.5) (self-alignment-X . 0) (self-alignment-Y . 0) (script-priority . 100) - (font-size . -5) - (meta . ((interfaces . (finger-interface font-interface - text-script-interface text-interface - side-position-interface - self-alignment-interface - item-interface)))))) + (callbacks . ((stencil . ,Text_interface::print) + (direction . ,Script_interface::calc_direction))) + (font-encoding . fetaNumber) + (font-size . -5) ; don't overlap when next to heads. + (meta . ((class . Item) + (interfaces . (finger-interface + font-interface + text-script-interface + text-interface + side-position-interface + self-alignment-interface + item-interface)))))) @end example @noindent @@ -1278,13 +1285,11 @@ in. These are clones of the original object and inherit all properties, including @code{\override}s. -[THIS SECTION IS OUT OF DATE. REWRITE ME.] - In other words, an @code{\override} always affects all pieces of a broken spanner. To change only one part of a spanner at a line break, it is necessary to hook into the formatting process. The -@code{after-line-breaking-callback} property contains the Scheme procedure -that is called after the line breaks have been determined, and layout +@code{after-line-breaking} callback contains the Scheme procedure that +is called after the line breaks have been determined, and layout objects have been split over different systems. In the following example, we define a procedure @@ -1304,8 +1309,7 @@ if yes, it sets @code{extra-offset}. This procedure is installed into @internalsref{Tie}, so the last part of the broken tie is translated up. -@ignore -@li lypond[quote,verbatim,raggedright] +@lilypond[quote,verbatim,raggedright] #(define (my-callback grob) (let* ( ; have we been split? @@ -1320,7 +1324,7 @@ of the broken tie is translated up. (ly:grob-set-property! grob 'extra-offset '(-2 . 5))))) \relative c'' { - \override Tie #'after-line-breaking-callback = + \override Tie #'callbacks #'after-line-breaking = #my-callback c1 ~ \break c2 ~ c } @@ -1328,12 +1332,10 @@ of the broken tie is translated up. @end ignore @noindent -When applying this trick, the new @code{after-line-breaking-callback} -should also call the old @code{after-line-breaking-callback}, if there -is one. For example, if using this with @code{Slur}, -@code{Slur::after_line_breaking} should also be called. - -[END OUT OF DATE] +When applying this trick, the new @code{after-line-breaking} callback +should also call the old one @code{after-line-breaking}, if there is +one. For example, if using this with @code{Hairpin}, +@code{Hairpin::after_line_breaking} should also be called. @item Some objects cannot be changed with @code{\override} for diff --git a/scm/document-translation.scm b/scm/document-translation.scm index 096de09c49..fdf04014c0 100644 --- a/scm/document-translation.scm +++ b/scm/document-translation.scm @@ -128,7 +128,7 @@ (string-append "@item Set " (format "grob-property @code{~a} " (string-join path " ")) - (format " in @ref{~a} " sym) + (format " in @ref{~a} " context-sym) (if (not (null? (cddr body))) (format " to @code{~a}" (scm->texi value)) "") @@ -136,12 +136,11 @@ "\n"))) ((equal? (object-property sym 'is-grob?) #t) "") ((equal? tag 'assign) - (string-append - "@item Set translator property @code{" - (symbol->string (car body)) - "} to @code{" - (scm->texi (cadr body)) - "}\n"))))) + (format "@item Set translator property @code{~a} to @code{~a}" + context-sym + (scm->texi (car args)))) + ))) + (define (context-doc context-desc) (let* ((name-sym (cdr (assoc 'context-name context-desc))) -- 2.39.2