From: hanwen <hanwen>
Date: Mon, 30 May 2005 09:45:14 +0000 (+0000)
Subject: * lily/span-bar.cc (print): sort bar line extents. Fixes problem
X-Git-Tag: release/2.5.32^2~118
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ef56428006a8a8625537e5ed30ae8964968db3be;p=lilypond.git

* 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.
---

diff --git a/ChangeLog b/ChangeLog
index c3f89021f9..396436c90b 100644
--- 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
diff --git a/Documentation/user/point-and-click.itely b/Documentation/user/point-and-click.itely
index 663797d7d3..33c15a2ece 100644
--- a/Documentation/user/point-and-click.itely
+++ b/Documentation/user/point-and-click.itely
@@ -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)'"
diff --git a/flower/include/interval.hh b/flower/include/interval.hh
index ddfdefd70b..c3471a5765 100644
--- a/flower/include/interval.hh
+++ b/flower/include/interval.hh
@@ -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]);
+  }
 };
 
 /**
diff --git a/lily/property-iterator.cc b/lily/property-iterator.cc
index 35eee1dbe2..f6eb1f9cc2 100644
--- a/lily/property-iterator.cc
+++ b/lily/property-iterator.cc
@@ -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)
 {
diff --git a/lily/span-bar.cc b/lily/span-bar.cc
index 388ab5666d..548961d8ef 100644
--- a/lily/span-bar.cc
+++ b/lily/span-bar.cc
@@ -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);
diff --git a/scm/lily.scm b/scm/lily.scm
index a37a25aaed..6f6ce09b80 100644
--- a/scm/lily.scm
+++ b/scm/lily.scm
@@ -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
diff --git a/scm/output-ps.scm b/scm/output-ps.scm
index 2bf3a3d103..6f8795915d 100644
--- a/scm/output-ps.scm
+++ b/scm/output-ps.scm
@@ -51,14 +51,6 @@
 	     (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))