X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fspacing-engraver.cc;h=65cea5cbeca7cc2bb8e180db0fa58fc0aff3f92b;hb=76d60ecc1f921719d48a9b1b5c65f00cfa9d3930;hp=914c672ccd59cd073cb546da1f082960a3ada0ee;hpb=68f8545bd6a0221ee1100336e4ad49399a7ffaa4;p=lilypond.git diff --git a/lily/spacing-engraver.cc b/lily/spacing-engraver.cc index 914c672ccd..65cea5cbec 100644 --- a/lily/spacing-engraver.cc +++ b/lily/spacing-engraver.cc @@ -1,9 +1,20 @@ /* - spacing-engraver.cc -- implement Spacing_engraver + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 1999--2011 Han-Wen Nienhuys - (c) 1999--2006 Han-Wen Nienhuys + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "engraver.hh" @@ -68,12 +79,14 @@ protected: DECLARE_ACKNOWLEDGER (staff_spacing); DECLARE_ACKNOWLEDGER (note_spacing); DECLARE_ACKNOWLEDGER (rhythmic_head); + DECLARE_ACKNOWLEDGER (rhythmic_grob); DECLARE_TRANSLATOR_LISTENER (spacing_section); void start_translation_timestep (); void stop_translation_timestep (); void process_music (); - + void add_starter_duration (Grob_info i); + virtual void finalize (); void start_spanner (); @@ -144,8 +157,21 @@ Spacing_engraver::acknowledge_staff_spacing (Grob_info i) Pointer_group_interface::add_grob (spacing_, ly_symbol2scm ("wishes"), i.grob ()); } +void +Spacing_engraver::acknowledge_rhythmic_grob (Grob_info i) +{ + add_starter_duration (i); +} + void Spacing_engraver::acknowledge_rhythmic_head (Grob_info i) +{ + add_starter_duration (i); +} + + +void +Spacing_engraver::add_starter_duration (Grob_info i) { if (i.grob ()->internal_has_interface (ly_symbol2scm ("lyric-syllable-interface")) || i.grob ()->internal_has_interface (ly_symbol2scm ("multi-measure-interface"))) @@ -159,7 +185,7 @@ Spacing_engraver::acknowledge_rhythmic_head (Grob_info i) Stream_event *r = i.event_cause (); if (r && r->in_event_class ("rhythmic-event")) { - Moment len = get_event_length (r); + Moment len = get_event_length (r, now_); Rhythmic_tuple t (i, now_mom () + len); now_durations_.push_back (t); } @@ -185,6 +211,7 @@ Spacing_engraver::stop_translation_timestep () { musical_column->set_property ("shortest-playing-duration", proportional); musical_column->set_property ("shortest-starter-duration", proportional); + musical_column->set_property ("used", SCM_BOOL_T); return; } @@ -195,6 +222,7 @@ Spacing_engraver::stop_translation_timestep () Stream_event *ev = playing_durations_[i].info_.event_cause (); if (ev) { + Moment now = now_mom (); Moment m = get_event_length (ev); shortest_playing = min (shortest_playing, m); } @@ -242,17 +270,21 @@ Spacing_engraver::start_translation_timestep () ADD_ACKNOWLEDGER (Spacing_engraver, staff_spacing); ADD_ACKNOWLEDGER (Spacing_engraver, note_spacing); ADD_ACKNOWLEDGER (Spacing_engraver, rhythmic_head); +ADD_ACKNOWLEDGER (Spacing_engraver, rhythmic_grob); ADD_TRANSLATOR (Spacing_engraver, - "make a SpacingSpanner and do " - "bookkeeping of shortest starting and playing notes ", + /* doc */ + "Make a @code{SpacingSpanner} and do bookkeeping of shortest" + " starting and playing notes.", + + /* create */ + "SpacingSpanner ", - /* create */ "SpacingSpanner", - /* accept */ - "spacing-section-event ", /* read */ "currentMusicalColumn " "currentCommandColumn " - "proportionalNotationDuration", + "proportionalNotationDuration ", - /* write */ ""); + /* write */ + "" + );