]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/span-bar.cc
release: 1.3.42
[lilypond.git] / lily / span-bar.cc
index 2ed93ad54503940fd1dd9fb5b4a77de94ae0510c..494a90b2ffdb997ba050d27d1ac1e7fb157b540c 100644 (file)
@@ -12,9 +12,9 @@
 #include "paper-def.hh"
 #include "molecule.hh"
 #include "warn.hh"
+#include "axis-group-interface.hh"
 #include "group-interface.hh"
 
-
 void
 Span_bar::add_bar (Score_element*b)
 {
@@ -31,7 +31,8 @@ Span_bar::width_callback (Dimension_cache const * c)
   Span_bar*  s= dynamic_cast<Span_bar*> (c->element_l ());  
   String gl = ly_scm2string (s->get_elt_property ("glyph"));
 
-  /*urg.
+  /*
+    urg.
    */
   Molecule m = s->compound_barline (gl, 40 PT);
   
@@ -41,26 +42,15 @@ Span_bar::width_callback (Dimension_cache const * c)
 void
 Span_bar::before_line_breaking ()
 {
-  evaluate_empty ();
-  
   Bar::before_line_breaking ();
   
-  //  set_empty (false, Y_AXIS); // a hack to make mark scripts work.
+  evaluate_empty ();
 }
 
 void
 Span_bar::after_line_breaking ()
 {
   Bar::after_line_breaking ();
-  SCM s = get_elt_property ("collapse-height");
-  if (gh_number_p (s)
-      && get_spanned_interval ().length () < gh_scm2double (s))
-    {
-      set_elt_property ("transparent", SCM_BOOL_T);
-      set_empty (X_AXIS);
-      set_empty (Y_AXIS);   
-    }
-
   Interval i (get_spanned_interval ());
   translate_axis (i.center (), Y_AXIS);
 }
@@ -94,45 +84,21 @@ Span_bar::evaluate_empty ()
     }
   else if (type_str== ":|:")
     {
-      type_str= ";|;";
+      type_str= ".|.";
     }
-    set_elt_property ("glyph", ly_str02scm (type_str.ch_C ()));
   }
+
+  /*
+    uhh. should do something with type_str ?!!
+   */
 }
 
 Interval
 Span_bar::get_spanned_interval () const
 {
-  Interval y_int;
-
-  for (SCM s = get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
-    {
-      Score_element *bar = unsmob_element ( gh_car (s));
-
-      if (!bar)
-       continue;
-      
-      Score_element*common = common_refpoint (bar, Y_AXIS);
-
-      Interval iv (bar->extent(Y_AXIS));
-      if (!iv.empty_b ())
-       {
-         Real y = bar->relative_coordinate (common, Y_AXIS)  
-           - relative_coordinate (common, Y_AXIS);
-
-         y_int.unite (y + iv);
-       }
-    }
-  
-  return y_int;
+  return Axis_group_interface::group_extent_callback (dim_cache_[Y_AXIS]);  
 }
 
-Interval
-Span_bar::height_callback (Dimension_cache const *c) 
-{
-  Span_bar * s= dynamic_cast<Span_bar*> (c->element_l ()); 
-  return s->get_spanned_interval ();
-}
 
 Real
 Span_bar::get_bar_size () const
@@ -150,6 +116,6 @@ Span_bar::Span_bar ()
 {
   group (this).set_interface ();
   dim_cache_[X_AXIS]->set_extent_callback (width_callback);
-  dim_cache_[Y_AXIS]->set_extent_callback (height_callback);  
+  dim_cache_[Y_AXIS]->set_extent_callback (Axis_group_interface::group_extent_callback);  
 }