]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/tuplet-spanner.cc
release: 1.3.101
[lilypond.git] / lily / tuplet-spanner.cc
index 9a2e596b7c606e9aa160a5860c066021c3a4fd2f..312bb37b9658894cf1f1cb9e6de82d5e916f9d6b 100644 (file)
 #include "beam.hh"
 #include "box.hh"
 #include "debug.hh"
-#include "lookup.hh"
+#include "font-interface.hh"
 #include "molecule.hh"
 #include "paper-column.hh"
 #include "paper-def.hh"
+#include "text-item.hh"
 #include "tuplet-spanner.hh"
 #include "stem.hh"
 #include "note-column.hh"
@@ -66,18 +67,17 @@ Tuplet_spanner::brew_molecule (SCM smob)
       Link_array<Score_element> column_arr=
        Pointer_group_interface__extract_elements (me, (Score_element*)0, "columns");
        
-      Real ncw = column_arr.top ()->extent(X_AXIS).length ();
+      Real ncw = column_arr.top ()->extent(column_arr.top (), X_AXIS).length ();
       Real w = dynamic_cast<Spanner*>(me)->spanner_length () + ncw;
 
-      Real staff_space = me->paper_l ()->get_var ("staffspace");
+      Real staff_space = 1.0;
       Direction dir = Directional_element_interface::get (me);
       Real dy = gh_scm2double (me->get_elt_property ("delta-y"));
       SCM number = me->get_elt_property ("text");
       if (gh_string_p (number) && number_visibility)
        {
-         Molecule
-           num (me->lookup_l ()->text ("italic",
-                                   ly_scm2string (number), me->paper_l ()));
+         SCM properties = Font_interface::font_alist_chain (me);
+         Molecule num = Text_item::text2molecule (me, number, properties);
          num.align_to (X_AXIS, CENTER);
          num.translate_axis (w/2, X_AXIS);
          num.align_to (Y_AXIS, CENTER);
@@ -90,18 +90,17 @@ Tuplet_spanner::brew_molecule (SCM smob)
       
       if (bracket_visibility)      
        {
-         SCM ss = me->paper_l ()->get_scmvar ("staffspace");
-         SCM lt =  me->paper_l ()->get_scmvar ("stafflinethickness");
+         Real  lt =  me->paper_l ()->get_var ("stafflinethickness");
          
          SCM thick = me->get_elt_property ("thick");
          SCM gap = me->get_elt_property ("number-gap");
          
          SCM at =gh_list(ly_symbol2scm ("tuplet"),
-                         ss,
-                         scm_product (gap, ss),
+                         gh_double2scm (1.0),
+                         gap,
                          gh_double2scm (w),
                          gh_double2scm (dy),
-                         scm_product (thick, lt),
+                         gh_double2scm (gh_scm2double (thick)* lt),
                          gh_int2scm (dir),
                          SCM_UNDEFINED);
 
@@ -143,8 +142,8 @@ Tuplet_spanner::calc_position_and_height (Score_element*me,Real *offset, Real *
   
   if (l < r)
     {
-      *dy = column_arr[r]->extent (Y_AXIS) [d] + column_arr[r]->relative_coordinate (commony, Y_AXIS)
-       - column_arr[l]->extent (Y_AXIS) [d] - column_arr[l]->relative_coordinate (commony, Y_AXIS);
+      *dy = column_arr[r]->extent (commony, Y_AXIS) [d]
+       - column_arr[l]->extent (commony, Y_AXIS) [d] ;
     }
   else
     * dy = 0;
@@ -162,8 +161,7 @@ Tuplet_spanner::calc_position_and_height (Score_element*me,Real *offset, Real *
   
   for (int i = 0; i < column_arr.size ();  i++)
     {
-      Real notey = column_arr[i]->extent (Y_AXIS)[d] 
-       + column_arr[i]->relative_coordinate (commony, Y_AXIS)
+      Real notey = column_arr[i]->extent (commony, Y_AXIS)[d] 
        - me->relative_coordinate (commony, Y_AXIS);
 
       Real x = column_arr[i]->relative_coordinate (commonx, X_AXIS) - x0;
@@ -182,10 +180,13 @@ Tuplet_spanner::calc_dy (Score_element*me,Real * dy)
 {
   Link_array<Score_element> column_arr=
     Pointer_group_interface__extract_elements (me, (Score_element*)0, "columns");
+
+  /*
+    ugh. refps.
+   */
   Direction d = Directional_element_interface::get (me);
-  *dy = column_arr.top ()->extent (Y_AXIS) [d]
-    - column_arr[0]->extent (Y_AXIS) [d];
+  *dy = column_arr.top ()->extent (column_arr.top (), Y_AXIS) [d]
+    - column_arr[0]->extent (column_arr[0], Y_AXIS) [d];
 }
 MAKE_SCHEME_CALLBACK(Tuplet_spanner,after_line_breaking,1);
 
@@ -263,15 +264,13 @@ void
 Tuplet_spanner::add_beam (Score_element*me, Score_element *b)
 {
   me->add_dependency (b);
-  Pointer_group_interface gi (me, "beams");
-  gi.add_element (b);
+  Pointer_group_interface::add_element (me, "beams",b);
 }
 
 void
 Tuplet_spanner::add_column (Score_element*me, Item*n)
 {
-  Pointer_group_interface gi (me, "columns");
-  gi.add_element (n);
+  Pointer_group_interface::add_element (me, "columns",n);
   me->add_dependency (n);
 
   add_bound_item (dynamic_cast<Spanner*> (me), n);