]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/beam.cc: use length-fraction too.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 16 Oct 2005 14:20:45 +0000 (14:20 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 16 Oct 2005 14:20:45 +0000 (14:20 +0000)
* 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
lily/beam.cc
lily/include/beam.hh
ly/engraver-init.ly
scm/define-grob-properties.scm
scm/define-grobs.scm
scm/layout-beam.scm

index 2270144618c38402245d30ca24dc59145e3ce3a4..59b7b782559ec26bb662e810d60eb77f2a9449e3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 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.
index c4fc1147c4a26f4c084d3a82c715a9f44ab5c171..839930d899199fac88a14e09c4e18f983172cc35 100644 (file)
@@ -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 "
index da210d56b94b94b544c4eef344787a337f216b8f..1fdf5732af9decd1d34c2efed8c2da3fba6f7a8b 100644 (file)
@@ -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));
index c2576b312c29bb6846a29aaaf4a645d9b48a7511..3c59a45e4507be2cf00752ceef9adb25ee3248d0 100644 (file)
@@ -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)
   )
index 0c2d656d36a4fa2c8f97cc1e88f05e4f3cc1cc10..74522da880f7757957c173cb23cf28bd184c453d 100644 (file)
@@ -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
index bf7384578905261c2963eb81e93eefa8ca245d70..51f22fe34b38ed25d75f350e5f4a02ffe8618885 100644 (file)
        ;; 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))))))
index 6c790e02b5e3f37aafb4b0a071fbe71be41b410c..29a74052232d2ddbd7200ae4d66a4de4192ef00c 100644 (file)
@@ -6,15 +6,6 @@
 ;;;; (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)