From 0923e4b23adf151bb673bb6727fd9e6a2458d029 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 16 Oct 2005 14:20:45 +0000 Subject: [PATCH] * lily/beam.cc: use length-fraction too. * scm/define-grob-properties.scm (all-user-grob-properties): remove property flag-width-function (all-user-grob-properties): remove space-function. * scm/layout-beam.scm: remove flag-width-function. * lily/beam.cc: remove flag-width-function * scm/layout-beam.scm: remove beam dir functions. * ly/engraver-init.ly (AncientRemoveEmptyStaffContext): use length-fraction. * lily/beam.cc: remove dir-function. * scm/define-grobs.scm: change print-function to stencil callback everywhere. * lily/beam.cc (calc_direction): use pseudo-property for beam direction callback. (calc_positions): use callback * scm/define-grob-properties.scm (all-user-grob-properties): doc callbacks property. --- ChangeLog | 10 +++++++ lily/beam.cc | 48 ++++++++++++---------------------- lily/include/beam.hh | 1 - ly/engraver-init.ly | 6 ++--- scm/define-grob-properties.scm | 4 --- scm/define-grobs.scm | 4 --- scm/layout-beam.scm | 9 ------- 7 files changed, 28 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2270144618..59b7b78255 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2005-10-16 Han-Wen Nienhuys + * lily/beam.cc: use length-fraction too. + + * scm/define-grob-properties.scm (all-user-grob-properties): + remove property flag-width-function + (all-user-grob-properties): remove space-function. + + * scm/layout-beam.scm: remove flag-width-function. + + * lily/beam.cc: remove flag-width-function + * scm/layout-beam.scm: remove beam dir functions. * ly/engraver-init.ly (AncientRemoveEmptyStaffContext): use length-fraction. diff --git a/lily/beam.cc b/lily/beam.cc index c4fc1147c4..839930d899 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -69,15 +69,17 @@ Beam::get_thickness (Grob *me) Real Beam::get_beam_translation (Grob *me) { - SCM func = me->get_property ("space-function"); + int beam_count = get_beam_count (me); + Real staff_space = Staff_symbol_referencer::staff_space (me); + Real line = Staff_symbol_referencer::line_thickness (me); + Real thickness = get_thickness (me); + Real fract = robust_scm2double (me->get_property ("length-fraction"), 1.0); + + Real beam_translation = beam_count < 4 + ? (2 * staff_space + line - thickness) / 2.0 + : (3 * staff_space + line - thickness) / 3.0; - if (ly_is_procedure (func)) - { - SCM s = scm_call_2 (func, me->self_scm (), scm_from_int (get_beam_count (me))); - return scm_to_double (s); - } - else - return 0.81; + return fract * beam_translation; } /* Maximum beam_count. */ @@ -95,25 +97,6 @@ Beam::get_beam_count (Grob *me) return m; } -/* - Space return space between beams. -*/ -MAKE_SCHEME_CALLBACK (Beam, space_function, 2); -SCM -Beam::space_function (SCM smob, SCM beam_count) -{ - Grob *me = unsmob_grob (smob); - - Real staff_space = Staff_symbol_referencer::staff_space (me); - Real line = Staff_symbol_referencer::line_thickness (me); - Real thickness = get_thickness (me); - - Real beam_translation = scm_to_int (beam_count) < 4 - ? (2 * staff_space + line - thickness) / 2.0 - : (3 * staff_space + line - thickness) / 3.0; - - return scm_from_double (beam_translation); -} /* After pre-processing all directions should be set. Several post-processing routines (stem, slur, script) need stem/beam @@ -427,10 +410,11 @@ Beam::print (SCM grob) if (stem) { int t = Stem::duration_log (stem); - - SCM proc = me->get_property ("flag-width-function"); - SCM result = scm_call_1 (proc, scm_from_int (t)); - nw_f = scm_to_double (result); + // ugh. hardcoded. + if (t == 1) + nw_f = 1.98; + else + nw_f = 1.32; } else nw_f = break_overshoot[RIGHT] / 2; @@ -1395,11 +1379,11 @@ ADD_INTERFACE (Beam, "damping " "details " "direction " - "flag-width-function " "gap " "gap-count " "inspect-quants " "knee " + "length-fraction " "least-squares-dy " "neutral-direction " "position-callbacks " diff --git a/lily/include/beam.hh b/lily/include/beam.hh index da210d56b9..1fdf5732af 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -56,7 +56,6 @@ public: static void connect_beams (Grob *me); DECLARE_SCHEME_CALLBACK (rest_collision_callback, (SCM element, SCM axis)); - DECLARE_SCHEME_CALLBACK (space_function, (SCM, SCM)); DECLARE_SCHEME_CALLBACK (print, (SCM)); DECLARE_SCHEME_CALLBACK (calc_direction, (SCM)); DECLARE_SCHEME_CALLBACK (calc_positions, (SCM)); diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index c2576b312c..3c59a45e45 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -551,14 +551,12 @@ AncientRemoveEmptyStaffContext = \context { graceSettings = #`( (Voice Stem direction 1) (Voice Stem font-size -3) - (Voice NoteHead font-size -3) + (Voice NoteHead font-size -3) (Voice Dots font-size -3) (Voice Stem length-fraction 0.8) (Voice Stem no-stem-extend #t) (Voice Beam thickness 0.384) - (Voice Beam space-function ,(lambda (beam mult) - (* 0.8 (Beam::space_function - beam mult)))) + (Voice Beam length-fraction 0.8) (Voice Accidental font-size -4) (Voice Slur direction -1) ) diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 0c2d656d36..74522da880 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -192,7 +192,6 @@ typeset on a Stem. Valid options include @code{()} and @code{mensural}. Additionally, @code{\"no-flag\"} switches off the flag.") - (flag-width-function ,procedure? "Procedure that computes the width of a half-beam (a non-connecting beam.).") (strict-note-spacing ,boolean? "If set, unbroken columns with non-musical material (clefs, barlines, etc.) are not spaced separately, but put before musical columns.") @@ -390,9 +389,6 @@ prefatory items, like clef and time-signature. The format is an alist of spacing tuples: @code{(@var{break-align-symbol} @var{type} . @var{distance})}, where @var{type} can be the symbols @code{minimum-space} or @code{extra-space}.") - (space-function ,procedure? "Calculate the vertical space between -two beams. This function takes a beam grob and the maximum number of -beams.") (spacing-increment ,number? "Add this much space for a doubled duration. Typically, the width of a note head. See also diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index bf73845789..51f22fe34b 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -286,15 +286,11 @@ ;; isolated shortened beams look nice and a bit shortened, ;; sadly possibly breaking patterns with high order beams. (beamed-stem-shorten . (1.0 0.5 0.25)) - - (flag-width-function . ,beam-flag-width-function) (damping . 1) (auto-knee-gap . 5.5) ;; only for debugging. (font-family . roman) - - (space-function . ,Beam::space_function) (meta . ((class . Spanner) (interfaces . (staff-symbol-referencer-interface beam-interface)))))) diff --git a/scm/layout-beam.scm b/scm/layout-beam.scm index 6c790e02b5..29a7405223 100644 --- a/scm/layout-beam.scm +++ b/scm/layout-beam.scm @@ -6,15 +6,6 @@ ;;;; (c) 2000--2005 Jan Nieuwenhuizen ;;;; -;; -;; width in staff space. -;; -(define (beam-flag-width-function type) - (cond - ((eq? type 1) 1.98) - ((eq? type 1) 1.65) ;; FIXME: check what this should be and why - (else 1.32))) - (define ((check-beam-quant posl posr) beam) "Check whether BEAM has POSL and POSR quants. POSL are (POSITION . QUANT) pairs, where QUANT is -1 (hang), 0 (center), 1 (sit) or -2/ 2 (inter) -- 2.39.2