2005-10-16 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * 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.
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. */
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
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;
"damping "
"details "
"direction "
- "flag-width-function "
"gap "
"gap-count "
"inspect-quants "
"knee "
+ "length-fraction "
"least-squares-dy "
"neutral-direction "
"position-callbacks "
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));
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)
)
@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.")
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
;; 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))))))
;;;; (c) 2000--2005 Jan Nieuwenhuizen <janneke@gnu.org>
;;;;
-;;
-;; 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)