diff options
author | Neil Puttock <n.puttock@gmail.com> | 2008-09-14 21:23:25 +0100 |
---|---|---|
committer | Jan Nieuwenhuizen <janneke@gnu.org> | 2010-08-24 15:24:25 +0200 |
commit | d31881bf4e0a6f26efd0ad3715e0abf2804f0abd (patch) | |
tree | 3b3b766889f2f0c4b7539229d701ffc81a53108f /lily | |
parent | d3d40f3469eda2cb327bebbd392c1ce88b114394 (diff) |
Break-alignable metronome marks.
Diffstat (limited to 'lily')
-rw-r--r-- | lily/metronome-engraver.cc | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/lily/metronome-engraver.cc b/lily/metronome-engraver.cc index 9d585af827..f3f04f1d3c 100644 --- a/lily/metronome-engraver.cc +++ b/lily/metronome-engraver.cc @@ -42,6 +42,9 @@ protected: SCM last_duration_; SCM last_count_; SCM last_text_; + + DECLARE_ACKNOWLEDGER (break_aligned); + DECLARE_ACKNOWLEDGER (break_alignment); protected: virtual void derived_mark () const; @@ -66,12 +69,42 @@ Metronome_mark_engraver::derived_mark () const } void +Metronome_mark_engraver::acknowledge_break_aligned (Grob_info inf) +{ + Grob *s = inf.grob (); + if (text_ + && !text_->get_parent (X_AXIS) + && dynamic_cast<Item *> (s) + && (s->get_property_data ("break-align-symbol") + == text_->get_property_data ("break-align-symbol"))) + text_->set_parent (s, X_AXIS); +} + +void +Metronome_mark_engraver::acknowledge_break_alignment (Grob_info inf) +{ + Grob *s = inf.grob (); + if (text_ + && dynamic_cast<Item *> (s)) + { + text_->set_parent (s, X_AXIS); + } +} + + +void Metronome_mark_engraver::stop_translation_timestep () { if (text_) { - Grob *mc = unsmob_grob (get_property ("currentMusicalColumn")); - text_->set_parent (mc, X_AXIS); + /* + Problem: how to set musical columns as parent + when there's no breakable object of interest nearby? + We don't want metronome marks aligned to paper columns. + + Grob *mc = unsmob_grob (get_property ("currentMusicalColumn")); + text_->set_parent (mc, X_AXIS); + */ text_->set_object ("side-support-elements", grob_list_to_grob_array (get_property ("stavesFound"))); text_ = 0; @@ -108,6 +141,11 @@ Metronome_mark_engraver::process_music () last_text_ = text; } + + +ADD_ACKNOWLEDGER (Metronome_mark_engraver, break_aligned); +ADD_ACKNOWLEDGER (Metronome_mark_engraver, break_alignment); + ADD_TRANSLATOR (Metronome_mark_engraver, /* doc */ "Engrave metronome marking. This delegates the formatting" |