]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/span-bar.cc (print): sort bar line extents. Fixes problem
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 30 May 2005 09:45:14 +0000 (09:45 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 30 May 2005 09:45:14 +0000 (09:45 +0000)
with disappearing span bars when alignAboveContext is active

* lily/property-iterator.cc (check_grob): use is-grob?
object-property. Fixes crash-key-sig-font-size.ly.

ChangeLog
Documentation/user/point-and-click.itely
flower/include/interval.hh
lily/property-iterator.cc
lily/span-bar.cc
scm/lily.scm
scm/output-ps.scm

index c3f89021f90fdd1b7849e9426435694867d58996..396436c90b4d1d4c9837eaef60fffae9e1816545 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-05-30  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * lily/span-bar.cc (print): sort bar line extents. Fixes problem
+       with disappearing span bars when alignAboveContext is active
+
+       * lily/property-iterator.cc (check_grob): use is-grob?
+       object-property. Fixes crash-key-sig-font-size.ly. 
+
 2005-05-29  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
        * lily/bar-line.cc (print): don't round barlines; this produces
index 663797d7d33f7c2c9eaf3a1adde0b699fbf0ba6e..33c15a2ece37acc07aa9f8bbe320af6fb25685f0 100644 (file)
@@ -21,7 +21,7 @@ using Mozilla Firefox.
 
 For Xpdf on Unix, the following should be present in
 @file{xpdfrc}@footnote{On unix, this file is found either in
-@file{/etc} or your home directory.}
+@file{/etc/xpdfrc} or as @file{.xpdfrc} in your home directory.}
 
 @example
 urlCommand     "firefox -remote 'OpenURL(%s)'"
index ddfdefd70b7d2a31b58a603258e5b578b82bf66d..c3471a576571934bb2df137a2c268d8f46f5bb18 100644 (file)
@@ -119,6 +119,11 @@ struct Interval_t : public Drul_array<T>
     elem_ref (LEFT) = elem (RIGHT);
     elem_ref (RIGHT) = t;
   }
+
+  static int left_comparison (Interval_t<T> const &a, Interval_t<T> const &b)
+  {
+    return sign (a[LEFT] - b[RIGHT]);
+  }
 };
 
 /**
index 35eee1dbe264f87de76abe7be55523f3aadf6b0c..f6eb1f9cc20585c8eabd911b31c8699332863ba1 100644 (file)
@@ -71,27 +71,19 @@ Property_iterator::do_quit ()
     }
 }
 
-SCM list_p = 0;
-
-/*
-  This is a rather crude check: we merely check if the translator
-  property is a list.
-*/
 bool
 check_grob (Music *mus, SCM sym)
 {
-  if (!list_p)
-    list_p = scm_c_eval_string ("list?");
+  bool g = to_boolean (scm_object_property (sym, ly_symbol2scm ("is-grob?")));
 
-  SCM type = scm_object_property (sym, ly_symbol2scm ("translation-type?"));
-  bool ok = type == list_p;
-
-  if (!ok)
+  if (!g)
     mus->origin ()->warning (_f ("not a grob name, `%s'",
                                 ly_symbol2string (sym)));
-  return ok;
+
+  return g;
 }
 
+
 void
 Push_property_iterator::process (Moment m)
 {
index 388ab5666d0b0743cbb1424f650b2015c186e8a0..548961d8efe7e398ce09787c7fc47d12cdd9072d 100644 (file)
@@ -32,11 +32,6 @@ MAKE_SCHEME_CALLBACK (Span_bar, print, 1);
 ordered according to their y coordinates relative to their common
 axis group parent.  Otherwise, the computation goes mad.
 
-(TODO:
-apply a sort algorithm that ensures this precondition.)  However,
-until now, I have seen no case where lily has not fulfilled this
-precondition.
-
 (2) This method depends on bar_engraver not being removed from
 staff context.  If bar_engraver is removed, the size of the staff
 lines is evaluated as 0, which results in a solid span bar line
@@ -48,17 +43,9 @@ SCM
 Span_bar::print (SCM smobbed_me)
 {
   Grob *me = unsmob_grob (smobbed_me);
-  SCM first_elt = me->get_property ("elements");
-
-  /* compute common refpoint of elements */
-  Grob *refp = me;
-  for (SCM elts = first_elt; scm_is_pair (elts); elts = scm_cdr (elts))
-    {
-      SCM smobbed_staff_bar = scm_car (elts);
-      Grob *staff_bar = unsmob_grob (smobbed_staff_bar);
-      refp = staff_bar->common_refpoint (refp, Y_AXIS);
-    }
+  SCM elements = me->get_property ("elements");
 
+  Grob *refp = common_refpoint_of_list (elements, me, Y_AXIS);
   Span_bar::evaluate_glyph (me);
   SCM glyph = me->get_property ("glyph");
 
@@ -70,17 +57,29 @@ Span_bar::print (SCM smobbed_me)
   String glyph_string = ly_scm2string (glyph);
 
   /* compose span_bar_mol */
-  Stencil span_bar_mol;
-
-  Interval prev_extent;
-  for (SCM elts = first_elt; scm_is_pair (elts); elts = scm_cdr (elts))
+  Array<Interval> extents;
+  Grob *model_bar = 0;
+  for (SCM elts = elements; scm_is_pair (elts); elts = scm_cdr (elts))
     {
-      SCM smobbed_staff_bar = scm_car (elts);
-      Grob *staff_bar = unsmob_grob (smobbed_staff_bar);
-      Interval ext = staff_bar->extent (refp, Y_AXIS);
+      Grob *bar = unsmob_grob (scm_car (elts));
+      Interval ext = bar->extent (refp, Y_AXIS);
       if (ext.is_empty ())
        continue;
 
+      extents.push (ext);
+      model_bar = bar;
+    }
+
+  if (!model_bar)
+    model_bar = me;
+  
+  extents.sort (&Interval::left_comparison);
+
+  Stencil span_bar;
+  for (int i = 1; i < extents.size (); i ++)
+    {
+      Interval prev_extent = extents[i-1];
+      Interval ext = extents[i]; 
       if (!prev_extent.is_empty ())
        {
          Interval l (prev_extent [UP],
@@ -92,21 +91,21 @@ Span_bar::print (SCM smobbed_me)
            }
          else
            {
-             Stencil interbar = Bar_line::compound_barline (staff_bar,
+             Stencil interbar = Bar_line::compound_barline (model_bar,
                                                             glyph_string,
                                                             l.length (),
                                                             false);
              interbar.translate_axis (l.center (), Y_AXIS);
-             span_bar_mol.add_stencil (interbar);
+             span_bar.add_stencil (interbar);
            }
        }
       prev_extent = ext;
     }
 
-  span_bar_mol.translate_axis (- me->relative_coordinate (refp, Y_AXIS),
+  span_bar.translate_axis (- me->relative_coordinate (refp, Y_AXIS),
                               Y_AXIS);
 
-  return span_bar_mol.smobbed_copy ();
+  return span_bar.smobbed_copy ();
 }
 
 MAKE_SCHEME_CALLBACK (Span_bar, width_callback, 2);
index a37a25aaed6947fef5c5eeb3ccd710fef73062af..6f6ce09b80cd530ee7462c52bbd52dd9fd9fd55a 100644 (file)
@@ -186,7 +186,6 @@ predicates. Print a message at LOCATION if any predicate failed."
 (define-public (ly:all-output-backend-commands)
   "Return list of output backend commands."
   '(
-    comment
     grob-cause
     no-origin
     placebox
index 2bf3a3d103ae4b5bd6ef6403e70ed825dfafabd5..6f8795915d6c74c91aefe9e001cef16c71ff79f6 100644 (file)
             (scm framework-ps)
             (lily))
 
-
-;;(map export
-;;   (append (ly:all-stencil-expressions) (ly:all-output-backend-commands)))
-
-;; huh?
-;;(write (ly:all-output-backend-commands))
-;;(write (ly:all-stencil-expressions))
-
 ;;; helper functions, not part of output interface
 (define (escape-parentheses s)
   (regexp-substitute/global #f "(^|[^\\])([\\(\\)])" s 'pre 1 "\\" 2 'post))