]> git.donarmstrong.com Git - lilypond.git/commitdiff
* input/regression/alignment-vertical-manual-setting.ly (Module):
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 26 Jan 2006 13:54:57 +0000 (13:54 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 26 Jan 2006 13:54:57 +0000 (13:54 +0000)
new file.

* lily/align-interface.cc (align_elements_to_extents): overwrite
translations with numbers in alignment-offsets from left bound

* Documentation/topdocs/NEWS.tely (Top): document new features.

ChangeLog
Documentation/topdocs/NEWS.tely
input/regression/alignment-vertical-manual-setting.ly [new file with mode: 0644]
lily/align-interface.cc

index be5bc062e5fbe3e16700c49674edf10cd3e05b11..30ac881cadc379825dcdfb26900c8d0741e15ca6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2006-01-26  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * input/regression/alignment-vertical-manual-setting.ly (Module):
+       new file.
+
+       * lily/align-interface.cc (align_elements_to_extents): overwrite
+       translations with numbers in alignment-offsets from left bound
+
        * scm/page.scm (make-page-stencil): read X-offset from paper-system.
        (page-translate-systems): new function: take into account Y-offset.
 
index 5f89cdddf1ae5d02d4d33c68da24e10ef78729b3..4aa94dff731bbe52a2a607f335e04cc5b426bf71 100644 (file)
@@ -46,8 +46,29 @@ the @uref{../,LilyPond Documentation}
 
 
 @itemize @bullet
+@item Alignments of staves may be tuned per system.   
+@lilypond[]
+\relative c'' \new StaffGroup <<
+      \new Staff { c1 c }
+      \new Staff { c c  }
+      \new Staff { 
+       \overrideProperty
+       #"Score.NonMusicalPaperColumn"
+       #'line-break-system-details
+       #'((alignment-offsets . (0 -5 -20)))
+       c1 \break
+       \overrideProperty
+       #"Score.NonMusicalPaperColumn"
+       #'line-break-system-details
+       #'((alignment-offsets . (0 -15 -20)))
+       c1 
+      }
+    >>
+@end lilypond
+
+This feature was sponsored by Trevor Bača.
 
-@item Systems individual systems may be positioned manually.
+@item Individual systems may be positioned manually,
 
 @lilypond[]
 \header{
@@ -82,8 +103,11 @@ This feature was sponsored by Trevor Bača and Nicolas Sceaux.
 
 @item A linebreaking configuration can now be saved as a @file{.ly}
 file automatically. This allows vertical alignments to be stretched to
-fit pages in a second formatting run. This feature was sponsored by  
-Trevor Bača and Nicolas Sceaux.
+fit pages in a second formatting run. See
+@inputfileref{input/regression/,page-layout-twopass.ly} for an
+example.
+
+This feature was sponsored by Trevor Bača and Nicolas Sceaux.
 
 @item The tie formatting for chords has been further polished. More
 cases are handled gracefully, and all scoring parameters may now be
diff --git a/input/regression/alignment-vertical-manual-setting.ly b/input/regression/alignment-vertical-manual-setting.ly
new file mode 100644 (file)
index 0000000..17c332a
--- /dev/null
@@ -0,0 +1,33 @@
+\header {
+
+  texidoc = "Alignments may be changed pre system by setting
+  @code{alignment-offsets} in the @code{line-break-system-details}
+  property"
+
+}
+
+\book {
+  \score {
+    \relative c'' \new StaffGroup <<
+      \new Staff { c1 c c c }
+      \new Staff { c c c c }
+      \new Staff { 
+       \overrideProperty
+       #"Score.NonMusicalPaperColumn"
+       #'line-break-system-details
+       #'((alignment-offsets . (#f #f -30)))
+       c1 \break
+       \overrideProperty
+       #"Score.NonMusicalPaperColumn"
+       #'line-break-system-details
+       #'((alignment-offsets . (0 -5 -20)))
+       c1 \break
+       \overrideProperty
+       #"Score.NonMusicalPaperColumn"
+       #'line-break-system-details
+       #'((alignment-offsets . (0 -15 -20)))
+       c1 c
+      }
+    >>
+  }
+}
index dfccf028858eb5ded3eb133a73a64ccdc9e9a856..b9335706d0fdc7ec9e05b0e7b282fed10925c905 100644 (file)
@@ -146,37 +146,20 @@ Align_interface::align_to_fixed_distance (Grob *me, Axis a)
 void
 Align_interface::align_elements_to_extents (Grob *me, Axis a)
 {
-  Real extra_space = 0.0;
   Spanner *me_spanner = dynamic_cast<Spanner *> (me);
-  if (a == Y_AXIS
-      && me_spanner)
-    {
-#if 0
-      /*
-       TODO: messes up for figured bass alignments. 
-       */
-      if (me_spanner->get_bound (LEFT)->break_status_dir () == CENTER)
-       me->warning (_ ("vertical alignment called before line-breaking. "
-                       "Only do cross-staff spanners with PianoStaff."));
-#endif
 
-      SCM details =  me_spanner->get_bound (LEFT)->get_property ("line-break-system-details");
-      SCM extra_space_handle = scm_assoc (ly_symbol2scm ("alignment-extra-space"), details);
 
-      extra_space = robust_scm2double (scm_is_pair (extra_space_handle)
-                                      ? scm_cdr (extra_space_handle)
-                                      : SCM_EOL,
-                                      extra_space);
-    }
+  SCM line_break_details = SCM_EOL;
+  if (a == Y_AXIS && me_spanner)
+    line_break_details =  me_spanner->get_bound (LEFT)->get_property ("line-break-system-details");
   
   Direction stacking_dir = robust_scm2dir (me->get_property ("stacking-dir"),
-                                              DOWN);
+                                          DOWN);
 
   Interval threshold = robust_scm2interval (me->get_property ("threshold"),
                                            Interval (0, Interval::infinity ()));
 
   Array<Interval> dims;
-
   Link_array<Grob> elems;
 
   extract_grob_set (me, "elements", all_grobs);
@@ -202,10 +185,17 @@ Align_interface::align_elements_to_extents (Grob *me, Axis a)
             ? me->get_property ("self-alignment-X")
             : me->get_property ("self-alignment-Y"));
 
-  Array<Real> translates;
   Interval total;
   Real where = 0;
+  Real extra_space = 0.0;
+  SCM extra_space_handle = scm_assq (ly_symbol2scm ("alignment-extra-space"), line_break_details);
 
+  extra_space = robust_scm2double (scm_is_pair (extra_space_handle)
+                                  ? scm_cdr (extra_space_handle)
+                                  : SCM_EOL,
+                                  extra_space);
+  
+  Array<Real> translates;
   for (int j = 0; j < elems.size (); j++)
     {
       Real dy = -dims[j][-stacking_dir];
@@ -224,6 +214,19 @@ Align_interface::align_elements_to_extents (Grob *me, Axis a)
       translates.push (where);
     }
 
+  SCM offsets_handle = scm_assq (ly_symbol2scm ("alignment-offsets"), line_break_details);
+  if (scm_is_pair (offsets_handle))
+    {
+      int i = 0;
+      for (SCM s = scm_cdr (offsets_handle); scm_is_pair (s) && i < translates.size (); s = scm_cdr (s), i++)
+       {
+         if (scm_is_number (scm_car (s)))
+           translates[i] = scm_to_double (scm_car (s));
+       }
+    }
+
+  
   Real center_offset = 0.0;
   
   /*