lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix #1695: Clef change placed outside score. (issue4683043)


From: n . puttock
Subject: Fix #1695: Clef change placed outside score. (issue4683043)
Date: Wed, 13 Jul 2011 21:37:04 +0000

Reviewers: ,

Message:
A MetronomeMark represents a special case for a break-alignable grob,
since sometimes it will be aligned on noteheads rather than prefatory
material.  In this case, we don't want it to be acknowledged by the
Break_alignment_engraver, since it will hijack the X-parent before the
Metronome_engraver can set it at the end of the timestep.  This causes
the Paper_column_engraver to add the MetronomeMark to the 'elements list
of a NonMusicalPaperColumn.  If this paper column is loose, its X-extent
calculation will be incorrect, since it includes the extent of the
MetronomeMark whose common refpoint is different (a System).  This
results in the column being translated away from the MetronomeMark into
the left margin.

This patch fixes issue 1695 by removing the default setting for
'non-musical and setting it dynamically in the Metronome_engraver.  Note
that this isn't sufficient in itself since `non-musical' checks use
Item::non_musical (), which recursively checks parents; in the case
where a MetronomeMark is effectively musical (i.e., aligned on a
notehead, and parented by a PaperColumn), we also need to return from
the Break_alignment_engraver without potentially creating a new
BreakAlignment and setting the temporary X-parent.

Phew :)

Description:
Fix #1695: Clef change placed outside score.

* lily/break-align-engraver.cc (acknowledge_break_alignable):

  return if ack'd grob is musical (only applies to MetronomeMark)

* lily/metronome-engraver.cc (acknowledge_break_aligned):

  if a valid break-aligned grob has been ack'd, set non-musical for
  MetronomeMark

* scm/define-grobs.scm (all-grob-descriptions):

  remove default setting for non-musical in MetronomeMark definition

Please review this at http://codereview.appspot.com/4683043/

Affected files:
  A input/regression/metronome-mark-loose-column.ly
  M lily/break-align-engraver.cc
  M lily/metronome-engraver.cc
  M scm/define-grobs.scm


Index: input/regression/metronome-mark-loose-column.ly
diff --git a/input/regression/metronome-mark-loose-column.ly b/input/regression/metronome-mark-loose-column.ly
new file mode 100644
index 0000000000000000000000000000000000000000..c9026b32467d087c4042245f5deb1b561f53d402
--- /dev/null
+++ b/input/regression/metronome-mark-loose-column.ly
@@ -0,0 +1,27 @@
+\version "2.15.6"
+
+\header {
+  texidoc = "Metronome marks aligned on notes do not interfere with
+the positioning of loose columns in other staves.  Here the loose
+column supporting the clef is correctly placed immediately before
+the second note in the lower staff."
+}
+
+\score {
+  <<
+    \new Staff \relative c' {
+      c8 c c c
+      \tempo 4 = 60
+      c2
+    }
+    \new Staff \relative c' {
+      c2 \clef bass c2
+    }
+  >>
+  \layout {
+    \context {
+      \Score
+      \override NonMusicalPaperColumn #'stencil = #ly:paper-column::print
+    }
+  }
+}
Index: lily/break-align-engraver.cc
diff --git a/lily/break-align-engraver.cc b/lily/break-align-engraver.cc
index 73f7db34ae973b2d7a7c8fd487be638715a40a34..45dd6911a5d319b981f3901111327fd8feff38f7 100644
--- a/lily/break-align-engraver.cc
+++ b/lily/break-align-engraver.cc
@@ -69,6 +69,9 @@ Break_align_engraver::derived_mark () const
 void
 Break_align_engraver::acknowledge_break_alignable (Grob_info inf)
 {
+  if (!Item::is_non_musical (inf.item ()))
+    return;
+
   if (!align_)
     create_alignment (inf);

@@ -95,7 +98,7 @@ Break_align_engraver::acknowledge_break_aligned (Grob_info inf)
       SCM align_name = item->get_property ("break-align-symbol");
       if (!scm_is_symbol (align_name))
        return;
-       
+
       if (!align_)
        create_alignment (inf);

Index: lily/metronome-engraver.cc
diff --git a/lily/metronome-engraver.cc b/lily/metronome-engraver.cc
index 09673b7e14a95c9bb5ca8ee42b02c15aeb2bcb71..09606c261e655185bee87ee4d76ab277d4cd02c1 100644
--- a/lily/metronome-engraver.cc
+++ b/lily/metronome-engraver.cc
@@ -93,6 +93,8 @@ Metronome_mark_engraver::acknowledge_break_aligned (Grob_info info)
       support_ = g;
       text_->set_parent (g, X_AXIS);
     }
+  if (bar_ || support_)
+    text_->set_property ("non-musical", SCM_BOOL_T);
 }

 void
Index: scm/define-grobs.scm
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index 177ebafc847426248949e66dc7d4d4c02b697415..e490f34224613ea41df494d1d7aaa4b5837ebef7 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -1291,7 +1291,6 @@
        (self-alignment-X . ,LEFT)
        (break-align-symbols . (time-signature))
        (non-break-align-symbols . (multi-measure-rest-interface))
-       (non-musical . #t)
        (meta . ((class . Item)
                 (interfaces . (break-alignable-interface
                                font-interface





reply via email to

[Prev in Thread] Current Thread [Next in Thread]