From: Han-Wen Nienhuys Date: Sat, 6 Jan 2007 22:32:21 +0000 (+0100) Subject: Fix #223. X-Git-Tag: release/2.10.10-1~17 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=bf9c5728d69f0b200b50ee3c20353f1c6f77761d;p=lilypond.git Fix #223. 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. --- diff --git a/lily/dot-column-engraver.cc b/lily/dot-column-engraver.cc index 04a75241c6..86fe8c40de 100644 --- a/lily/dot-column-engraver.cc +++ b/lily/dot-column-engraver.cc @@ -15,7 +15,6 @@ class Dot_column_engraver : public Engraver { Grob *dotcol_; - vector heads_; public: TRANSLATOR_DECLARATIONS (Dot_column_engraver); @@ -35,7 +34,6 @@ void Dot_column_engraver::stop_translation_timestep () { dotcol_ = 0; - heads_.clear (); } void diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 4683c51cb5..82608cb342 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -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_) diff --git a/lily/dots.cc b/lily/dots.cc index f697752e35..cff60a3f6e 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -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); diff --git a/lily/rest.cc b/lily/rest.cc index a976cae914..fde240130f 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -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);; diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index f39343b904..790aa0090a 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -524,6 +524,7 @@ . ( (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 diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 88904384cd..82aa83f3b4 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -113,6 +113,21 @@ (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))