On Sat, May 23, 2009 at 7:49 AM, Reinhold Kainhofer
<reinh...@kainhofer.com> wrote:
>
> Actually, this bug is not that easy. I was also quite annoyed by this a while
> ago, and started looking at it, but I ran into dead ends. This is one of the
> things that makes my orchestral scores not look quite as professional as they
> could be. Otherwise I would have submitted a patch already, but the problem is
> simply over my head.
>

What are the issues with Neil's patch? I've been playing around with
it and it seems to do what I want. Well, it's a similar patch really
(see attached).

Neil's comment from Issue 684: "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."

How often is a situation like this encountered (not that I really
understand what it means)? The most common usage (tempo mark on the
bar) works fine. Perhaps if it can't be worked out we could create a
patch that works in 99% of cases and leave an enhancement open to work
on the other cases later.

Thanks for the help. (Also sorry about starting another one of "those"
threads. That was not my intention.)

-----Jay
diff --git a/lily/metronome-engraver.cc b/lily/metronome-engraver.cc
index aa75bcb..5a6dbc5 100644
--- a/lily/metronome-engraver.cc
+++ b/lily/metronome-engraver.cc
@@ -36,6 +36,8 @@ protected:
   virtual void derived_mark () const;
   void stop_translation_timestep ();
   void process_music ();
+
+  DECLARE_ACKNOWLEDGER (break_alignment);
 };
 
 Metronome_mark_engraver::Metronome_mark_engraver ()
@@ -55,12 +57,23 @@ Metronome_mark_engraver::derived_mark () const
 }
 
 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);
+      //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 +110,8 @@ Metronome_mark_engraver::process_music ()
   last_text_ = text;
 }
 
+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 58a6440..2dff510 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -1078,17 +1078,28 @@
     (MetronomeMark
      . (
 	(stencil . ,ly:text-interface::print)
+	(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)))))
 	(Y-offset . ,ly:side-position-interface::y-aligned-side)
+	(extra-spacing-width . (+inf.0 . -inf.0))
+	(self-alignment-X . ,LEFT)
 	(direction . ,UP)
 	(padding . 0.8)
 	(side-axis . ,Y)
-	(extra-spacing-width . (+inf.0 . -inf.0))
 	(outside-staff-priority . 1000)
+	(break-visibility . ,end-of-line-invisible)
+	(break-align-symbols . (time-signature))
 	(meta . ((class . Item)
 		 (interfaces . (text-interface
 				side-position-interface
+				break-alignable-interface
 				font-interface
-				metronome-mark-interface))))))
+				metronome-mark-interface
+				self-alignment-interface))))))
 
     (MultiMeasureRest
      . (
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to