]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #223.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 6 Jan 2007 22:32:21 +0000 (23:32 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 8 Jan 2007 10:22:54 +0000 (11:22 +0100)
Set a callback for Dots #'staff-position, depending on duration-log of
the rest.  This fixes the longest standing regression in Lily as yet,
as this did work in Lily 2.0.

lily/dot-column-engraver.cc
lily/dot-column.cc
lily/dots.cc
lily/rest.cc
scm/define-grobs.scm
scm/output-lib.scm

index 04a75241c6cd17eea49ffb67fdf5246e82c718f9..86fe8c40de7df8fd3a29b84533abdc781c6f2151 100644 (file)
@@ -15,7 +15,6 @@
 class Dot_column_engraver : public Engraver
 {
   Grob *dotcol_;
-  vector<Item*> heads_;
 public:
   TRANSLATOR_DECLARATIONS (Dot_column_engraver);
 
@@ -35,7 +34,6 @@ void
 Dot_column_engraver::stop_translation_timestep ()
 {
   dotcol_ = 0;
-  heads_.clear ();
 }
 
 void
index 4683c51cb53faa05d0a0edef971ef1a2f81b9c61..82608cb3421a64727c7d7339302aa3161959397e 100644 (file)
@@ -255,6 +255,10 @@ Dot_column::calc_positioning_done (SCM smob)
        }
 
       int p = Staff_symbol_referencer::get_rounded_position (dp.dot_);
+
+      /* icky, since this should go via a Staff_symbol_referencer
+        offset callback but adding a dot overwrites Y-offset. */
+      p += (int) robust_scm2double (dp.dot_->get_property ("staff-position"), 0.0);
       dp.pos_ = p;
 
       if (dp.extremal_head_)
index f697752e35f9b30f4f46c93bb05328a774244d9a..cff60a3f6efb23f3dd1b56ecd36594f012957f39 100644 (file)
@@ -13,7 +13,6 @@
 #include "font-interface.hh"
 #include "lookup.hh"
 #include "staff-symbol-referencer.hh"
-#include "directional-element-interface.hh"
 #include "international.hh"
 
 MAKE_SCHEME_CALLBACK (Dots, print, 1);
index a976cae9142ea62ffa24a2631e9fa2403f2614c0..fde240130fbdd2b61b2203c082fd52e60c3cf0c4 100644 (file)
@@ -39,18 +39,6 @@ Rest::y_offset_callback (SCM smob)
   else
     amount += ss / 2;
 
-  Grob *dot = unsmob_grob (me->get_object ("dot"));
-  if (dot && duration_log > 4) // UGH.
-    {
-      dot->set_property ("staff-position",
-                      scm_from_int ((duration_log == 7) ? 4 : 3));
-    }
-  if (dot && duration_log >= -1 && duration_log <= 1) // UGH again.
-    {
-      dot->set_property ("staff-position",
-                        scm_from_int ((duration_log == 0) ? -1 : 1));
-    }
-
   if (!position_override)
     amount += 2 * ss * get_grob_direction (me);; 
   
index f39343b90449ab74bff7fd19703645a2564e1b00..790aa0090aad5d1b5a3cf37cb801bf6cf4a5eadc 100644 (file)
      . (
        (stencil . ,ly:dots::print)
        (dot-count . ,dots::calc-dot-count)
+       (staff-position . ,dots::calc-staff-position)
        (meta . ((class . Item)
                 (interfaces . (font-interface
                                staff-symbol-referencer-interface
index 88904384cda91c194bd235967ff3c7b963326b31..82aa83f3b46d573e1c461a5c6e8affde1332bf14 100644 (file)
   (ly:duration-dot-count
    (ly:event-property (event-cause grob) 'duration)))
 
+(define-public (dots::calc-staff-position grob)
+  (let*
+      ((head (ly:grob-parent grob Y))
+       (log (ly:grob-property head 'duration-log)))
+
+    (cond
+     ((or (not (grob::has-interface head 'rest-interface))
+        (not (integer? log))) 0)
+     ((= log 7) 4)
+     ((> log 4) 3)
+     ((= log 0) -1)
+     ((= log 1) 1)
+     ((= log -1) 1)
+     (else 0))))
+
 (define (note-head::calc-tablature-stem-attachment grob)
   (cons 0.0 1.35))