]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge branch 'master' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond
authorJohn Mandereau <john.mandereau@gmail.com>
Sun, 19 Aug 2007 17:06:23 +0000 (19:06 +0200)
committerJohn Mandereau <john.mandereau@gmail.com>
Sun, 19 Aug 2007 17:06:23 +0000 (19:06 +0200)
* 'master' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond:
  Add a space-to-barline property to allow looser spacing of clefs.
  Fix 392.
  Fix 369.
  Fix 399 again.
  Don't count accidentals in paper-columns except as conditional items.
  Use less space between notes and non-barlines.
  Fix commit de8fda6a51 to only decrease the amount of whitespace.
  Refer to Text Marks from Rehearsal Marks instead of duplicating information.
  Use less whitespace at the end of a measure.

12 files changed:
Documentation/user/advanced-notation.itely
input/regression/slur-cross-staff-beam.ly [new file with mode: 0644]
input/regression/spacing-space-to-barline.ly [new file with mode: 0644]
lily/note-spacing.cc
lily/paper-column-engraver.cc
lily/paper-column.cc
lily/slur.cc
lily/spacing-determine-loose-columns.cc
lily/spacing-interface.cc
scm/define-grob-properties.scm
scm/define-grobs.scm
vim/lilypond-compiler.vim

index 69beebf8204fba524fa967f6145cf83fcc1c0739..428a793359a6ea6b36274293982f26c812fa2a5a 100644 (file)
@@ -371,6 +371,11 @@ bar lines,
 }
 @end lilypond
 
+Possible symbols for the @code{break-align-symbols} list are
+@code{ambitus}, @code{breathing-sign}, @code{clef}, @code{custos},
+@code{staff-bar}, @code{left-edge}, @code{key-cancellation},
+@code{key-signature}, and @code{time-signature}.
+
 The text marks will, by default, be aligned with the middle of the notation
 object, but this can be changed by overriding the
 @code{break-align-anchor-alignment} and
@@ -392,9 +397,10 @@ object, but this can be changed by overriding the
   \once \override Staff.KeySignature #'break-align-anchor-alignment = #RIGHT
   \mark \default
   ces1
+  \key cis \major
 
-  % the RehearsalMark will be aligned with the right edge of the KeySignature
-  % and then shifted right by an additional 2 units.
+  % the RehearsalMark will be aligned with the left edge of the KeySignature
+  % and then shifted right by 2 units.
   \once \override Staff.KeySignature #'break-align-anchor = #2
   \mark \default
   ces1
@@ -1085,30 +1091,7 @@ c1
 See @ref{The Feta font}, for a list of symbols which may be
 printed with @code{\musicglyph}.
 
-The horizontal location of rehearsal marks can be adjusted by
-setting @code{break-align-symbol}
-
-@lilypond[fragment,quote,ragged-right,verbatim,relative]
-c1
-\key cis \major
-\clef alto
-\override Score.RehearsalMark #'break-align-symbols = #'(key-signature)
-\mark "on-key"
-cis
-\key ces \major
-\override Score.RehearsalMark #'break-align-symbols = #'(clef)
-\clef treble
-\mark "on clef"
-ces
-@end lilypond
-
-@code{break-align-symbol} may also accept the following values:
-@code{ambitus}, @code{breathing-sign}, @code{clef}, @code{custos},
-@code{staff-bar}, @code{left-edge}, @code{key-cancellation},
-@code{key-signature}, and @code{time-signature}.  Setting
-@code{break-align-symbol} will only have an effect if the symbol
-appears at that point in the music.
-
+For common tweaks to the positioning of rehearsal marks, see @ref{Text marks}.
 
 @seealso
 
diff --git a/input/regression/slur-cross-staff-beam.ly b/input/regression/slur-cross-staff-beam.ly
new file mode 100644 (file)
index 0000000..ea9d13d
--- /dev/null
@@ -0,0 +1,13 @@
+\version "2.11.29"
+
+\header {
+  texidoc = "Slurs that depend on a cross-staff beam are not calculated until after line-breaking."
+}
+
+\paper{ ragged-right=##t }
+\score {
+    \new PianoStaff <<
+    \context Staff = rh \relative { c'8([ d) \change Staff = lh c,] }
+    \context Staff = lh { s4. }
+    >>
+}
\ No newline at end of file
diff --git a/input/regression/spacing-space-to-barline.ly b/input/regression/spacing-space-to-barline.ly
new file mode 100644 (file)
index 0000000..a1fe2fc
--- /dev/null
@@ -0,0 +1,23 @@
+\version "2.11.29"
+
+\header {
+  texidoc = "When space-to-barline is false, we measure the space between the note and the
+start of the clef. When space-to-barline is true, we measure the space between the note and
+the start of the barline."
+}
+
+\paper {ragged-right = ##t}
+
+{
+  \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 16)
+  c'2 \clef bass c'2 \clef treble
+  \override NoteSpacing #'space-to-barline = ##f
+  c'2 \clef bass c'2 \clef treble
+
+  % the following two measures should be spaced identically
+  \override NoteSpacing #'space-to-barline = ##t
+  c'2 c'2
+  \override NoteSpacing #'space-to-barline = ##f
+  c'2 c'2
+  c'1
+}
\ No newline at end of file
index d476f70fa08c617b835ee5181be228db13c9eb84..96f7b8f8e35078da3b53b6be2f5daa18c38d619b 100644 (file)
@@ -74,20 +74,28 @@ Note_spacing::get_spacing (Grob *me, Item *right_col,
 
   /* If we have a NonMusical column on the right, we measure the ideal distance
      to the bar-line (if present), not the start of the column. */
-  if (!Paper_column::is_musical (right_col) && !skys[RIGHT].is_empty ())
+  if (!Paper_column::is_musical (right_col)
+      && !skys[RIGHT].is_empty ()
+      && to_boolean (me->get_property ("space-to-barline")))
     {
       Grob *bar = Pointer_group_interface::find_grob (right_col,
                                                      ly_symbol2scm ("elements"),
                                                      Bar_line::has_interface);
 
       if (bar)
-       ideal -= bar->extent (right_col, X_AXIS)[LEFT];
+       {
+         Real shift = bar->extent (right_col, X_AXIS)[LEFT];
+         ideal -= shift;
+         min_desired_space -= max (shift, 0.0);
+       }
+      else
+       ideal -= right_col->extent (right_col, X_AXIS)[RIGHT];
     }
 
   ideal = max (ideal, min_desired_space);
   stem_dir_correction (me, right_col, increment, &ideal, &min_desired_space);
 
-  Spring ret (ideal, min_dist);
+  Spring ret (max (0.0, ideal), min_dist);
   ret.set_inverse_compress_strength (max (0.0, ideal - min_desired_space));
   ret.set_inverse_stretch_strength (max (0.1, base_space - increment));
   return ret;
@@ -309,6 +317,7 @@ ADD_INTERFACE (Note_spacing,
               "right-items "
               "same-direction-correction "
               "stem-spacing-correction "
+              "space-to-barline "
 
               );
 
index 1396c1280d94f8815e0ce6ba32f5ee26fd41bd52..481ffd14645b049bb523a3d04d02b99f08282791 100644 (file)
@@ -10,6 +10,7 @@
 #include "system.hh"
 #include "international.hh"
 #include "accidental-placement.hh"
+#include "accidental-interface.hh"
 #include "axis-group-interface.hh"
 #include "context.hh"
 #include "note-spacing.hh"
@@ -196,14 +197,14 @@ Paper_column_engraver::stop_translation_timestep ()
       Item *elem = items_[i];
       Grob *col = Item::is_non_musical (elem) ? command_column_ : musical_column_;
 
-      if (!elem->get_parent (X_AXIS)
-         || !unsmob_grob (elem->get_object ("axis-group-parent-X")))
-       {
-         Axis_group_interface::add_element (col, elem);
-       }
-      else if (Accidental_placement::has_interface (elem))
+      if (!elem->get_parent (X_AXIS))
+       elem->set_parent (col, X_AXIS);
+      if (!unsmob_grob (elem->get_object ("axis-group-parent-X")))
+       elem->set_object ("axis-group-parent-X", col->self_scm ());
+
+      if (Accidental_placement::has_interface (elem))
        Separation_item::add_conditional_item (col, elem);
-      else
+      else if (!Accidental_interface::has_interface (elem))
        Separation_item::add_item (col, elem);
     }
   items_.clear ();
index bb827db18b72fe183cc0d7b9a59ea706710f572a..53dfd4a906a2b907baeb59ced8b2ae998bcd3a7e 100644 (file)
@@ -152,6 +152,8 @@ Paper_column::minimum_distance (Grob *left, Grob *right)
     }
   while (flip (&d) != LEFT);
 
+  skys[RIGHT].merge (Separation_item::conditional_skyline (right, left));
+
   return max (0.0, skys[LEFT].distance (skys[RIGHT]));
 }
 
index 22535ef7658c2c9ef8f8d65a96ff4c289ac4d6cd..c37aa72ad9b53a98cd6e395fa9e8b0da5e8ade96 100644 (file)
@@ -14,6 +14,7 @@
 #include "bezier.hh"
 #include "directional-element-interface.hh"
 #include "font-interface.hh"
+#include "item.hh"
 #include "pointer-group-interface.hh"
 #include "lookup.hh"
 #include "main.hh"             // DEBUG_SLUR_SCORING
@@ -368,6 +369,13 @@ Slur::calc_cross_staff (SCM smob)
   extract_grob_set (me, "note-columns", cols);
   extract_grob_set (me, "encompass-objects", extras);
 
+  for (vsize i = 0; i < cols.size (); i++)
+    {
+      if (Grob *s = Note_column::get_stem (cols[i]))
+       if (to_boolean (s->get_property ("cross-staff")))
+         return SCM_BOOL_T;
+    }
+
   /* the separation items are dealt with in replace_breakable_encompass_objects
      so we can ignore them here */
   vector<Grob*> non_sep_extras;
index 5b13c82264362ded0f7f8717ee82bae0b77e824f..fe072bca0aba3a93097095595e49101faaded388 100644 (file)
@@ -157,7 +157,7 @@ Spacing_spanner::set_distances_for_loose_col (Grob *me, Grob *c,
              Real base = note_spacing (me, lc, rc, options);
              Spring spring = Note_spacing::get_spacing (sp, rc, base, options->increment_);
 
-             dists[d] = max (dists[d], spring.distance () - options->increment_);
+             dists[d] = max (dists[d], spring.min_distance ());
            }
          else if (Staff_spacing::has_interface (sp))
            {
index 1cf1a02cdc941a30a54e2c0e7cfab31aac668484..65ac96834fe505e668cd7bfea1a7c5823fbb89dc 100644 (file)
@@ -96,6 +96,15 @@ Spacing_interface::minimum_distance (Grob *me, Grob *right)
   this will add a new column to RIGHT-ITEMS. Here we look at the
   columns, and return the left-most. If there are multiple columns, we
   prune RIGHT-ITEMS.
+
+  If we end up pruning, we add a left-neighbor to every column that
+  gets pruned. This ensures that loose columns in cross-staff music
+  do indeed get marked as loose. The problem situation is when a voice
+  passes from staff 1 to staff 2 and a clef appears later on in staff 1.
+  Then the NoteSpacing attached to the last note in staff 1 has two
+  right-items: one pointing to the next note in staff 2 and one pointing
+  to the clef. We will prune the clef right-item here and, unless we add
+  a left-neighbor to the clef, it won't get marked as loose.
 */
 Item *
 Spacing_interface::right_column (Grob *me)
@@ -122,6 +131,8 @@ Spacing_interface::right_column (Grob *me)
 
          mincol = col;
        }
+      else if (rank > min_rank)
+       prune = true;
     }
 
   if (prune && a)
@@ -130,7 +141,15 @@ Spacing_interface::right_column (Grob *me)
       for (vsize i = right.size (); i--;)
        {
          if (dynamic_cast<Item *> (right[i])->get_column () != mincol)
-           right.erase (right.begin () + i);
+           {
+             extract_grob_set (right[i], "left-neighbors", lns);
+             if (lns.empty ())
+               Pointer_group_interface::add_grob (right[i],
+                                                  ly_symbol2scm ("left-neighbors"),
+                                                  dynamic_cast<Item*> (me)->get_column ());
+
+             right.erase (right.begin () + i);
+           }
        }
     }
 
index 598e4a838ad9f8797d17e54d3b1cfebb8da3647f..847a1aa18fcf6c245a3b6aadb4d2f7150a02484e 100644 (file)
@@ -468,6 +468,11 @@ prefatory items, like clef and time-signature.  The format is an alist
 of spacing tuples: @code{(@var{break-align-symbol} @var{type}
 . @var{distance})}, where @var{type} can be the symbols
 @code{minimum-space} or @code{extra-space}.")
+     (space-to-barline ,boolean? "If set, the distance between a note
+and the following non-musical column will be measured to the barline
+instead of to the beginning of the non-musical column. If there is a
+clef change followed by a barline, for example, this means that we will
+try to space the non-musical column as though the clef is not there.")
      (spacing-increment ,number? "Add this much space for a doubled
 duration.  Typically, the width of a note head. See also
 @internalsref{spacing-spanner-interface}.")
index 436aa9ebfdfabdf1a550c460c444657cb9f0d013..ce76c346f861aae96b3daefcb6446e497e5621f2 100644 (file)
      . (
        (stem-spacing-correction . 0.5)
        (same-direction-correction . 0.25)
+       (space-to-barline . #t)
        ;; Changed this from 0.75.
        ;; If you ever change this back, please document! --hwn
        (knee-spacing-correction . 1.0)
index 7087f3d0644dedfe9110cd43e7300a1dfd1906b3..a998a3ebb0b41f99f180da18a2f46ef8bbc42edf 100644 (file)
@@ -12,7 +12,7 @@ endif
 let current_compiler = "lilypond"
 
 " default make
-setlocal makeprg=lilypond $*
+setlocal makeprg=lilypond\ $*
 " errorformat for lily (with columns) and gcc
 " (how to see multiple-line error messages?)
 setlocal errorformat=%f:%l:%c:\ %m,%f:%l:\ %m,In\ file\ included\ from\ %f:%l:,\^I\^Ifrom\ %f:%l%m