]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/cross-staff.cc
release: 1.3.73
[lilypond.git] / lily / cross-staff.cc
index 47300e660ddf5b997ab27fa36030e4601aff4087..68a18a9de41b6f07acc5bc414a584a97eaa98244 100644 (file)
@@ -1,35 +1,42 @@
 #include "cross-staff.hh"
 #include "item.hh"
-#include "align-element.hh"
+#include "align-interface.hh"
 #include "spanner.hh"
 #include "warn.hh"
 
+/*
+  JUNKME
+ */
 Real
-calc_interstaff_dist (Item const *item, Spanner const *span)
+calc_interstaff_dist (Item  *item, Spanner  *span)
 {
   Real interstaff = 0.0; 
-  Graphical_element *common = item->common_refpoint (span, Y_AXIS);
-  Align_element * align = dynamic_cast<Align_element*> (common);
-  if (align && align->axis() == Y_AXIS)
+  Score_element *common = item->common_refpoint (span, Y_AXIS);
+
+
+  if (Align_interface::has_interface (common) && Align_interface::axis(common) == Y_AXIS)
     {
-      if (align->threshold_interval_[MIN] != 
-         align->threshold_interval_[MAX])
+      SCM threshold = common->get_elt_property ("threshold");
+      if (!gh_pair_p (threshold)
+         || !scm_equal_p (gh_car (threshold), gh_cdr (threshold)))
        warning (_ ("minVerticalAlign != maxVerticalAlign: cross staff spanners may be broken"));
 
-      interstaff = align->threshold_interval_[MIN];
+      interstaff = 0.0;
+      if (gh_pair_p (threshold))
+       interstaff =  gh_scm2double (gh_car (threshold));
 
-      Graphical_element const * span_refpoint = span;
+      Score_element  * span_refpoint = span;
       while (span_refpoint->parent_l  (Y_AXIS) != common)
        span_refpoint = span_refpoint->parent_l (Y_AXIS);
 
-      Graphical_element const * note_refpoint = item;
+      Score_element  * note_refpoint = item;
       while (note_refpoint->parent_l (Y_AXIS) != common)
        note_refpoint = note_refpoint->parent_l (Y_AXIS);
 
       int span_prio =
-       align->get_priority ((Score_element*) dynamic_cast<Score_element const*> (span_refpoint));
+       Align_interface::get_count (common,(Score_element*) dynamic_cast<Score_element *> (span_refpoint));
       int item_prio =
-       align->get_priority ((Score_element*) dynamic_cast<Score_element  const *> (note_refpoint));
+       Align_interface::get_count (common,(Score_element*) dynamic_cast<Score_element   *> (note_refpoint));
 
       /*
        our staff is lower -> interstaff *= -1