Hi Reinhold, 2008/9/14 Reinhold Kainhofer <[EMAIL PROTECTED]>:
> So, yes, I think that MetronomeMark should support break-align-symbols, but my > trial-and-error attempts to code this similar to RehearsalMark have only lead > to crashes or no change. I've just given this another go; would you mind having a look at the attached patch? The alignment's good when there's a time signature present, but the stumbling block is how to align to note columns; I can't work out how the metronome marks get attached to a paper column when there's no breakable object nearby. :( Regards, Neil
<<attachment: metronome.png>>
From 291d600c0ee777615b9a7f36913328cebaab984f Mon Sep 17 00:00:00 2001
From: Neil Puttock <[EMAIL PROTECTED]>
Date: Sun, 14 Sep 2008 21:23:25 +0100
Subject: [PATCH] Break-alignable metronome marks.
---
lily/metronome-engraver.cc | 42 ++++++++++++++++++++++++++++++++++++++++--
scm/define-grobs.scm | 10 ++++++++++
2 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/lily/metronome-engraver.cc b/lily/metronome-engraver.cc
index 069e67d..9e46f4e 100644
--- a/lily/metronome-engraver.cc
+++ b/lily/metronome-engraver.cc
@@ -31,6 +31,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;
@@ -55,12 +58,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;
@@ -97,6 +130,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"
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index 975d425..07361da 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -1061,10 +1061,19 @@
(side-axis . ,Y)
(extra-spacing-width . (+inf.0 . -inf.0))
(outside-staff-priority . 1000)
+ (X-offset . ,(ly:make-simple-closure
+ `(,+
+ ,(ly:make-simple-closure
+ (list ly:break-alignable-interface::self-align-callback))
+ ,(ly:make-simple-closure
+ (list ly:self-alignment-interface::x-aligned-on-self)))))
+ (self-alignment-X . -1)
+ (break-align-symbols . (time-signature))
(meta . ((class . Item)
(interfaces . (text-interface
side-position-interface
font-interface
+ break-alignable-interface
metronome-mark-interface))))))
(MultiMeasureRest
@@ -1945,6 +1954,7 @@
(break-align-symbol . time-signature)
(break-align-anchor
. ,ly:break-aligned-interface::calc-extent-aligned-anchor)
+ (break-align-anchor-alignment . ,LEFT)
(break-visibility . ,all-visible)
(avoid-slur . inside)
(extra-spacing-height . (-1.0 . 1.0))
--
1.5.4.3
_______________________________________________ lilypond-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/lilypond-devel
