]> git.donarmstrong.com Git - lilypond.git/commitdiff
coverage fixes.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 5 Jan 2007 13:38:28 +0000 (14:38 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 5 Jan 2007 13:38:58 +0000 (14:38 +0100)
lily/simple-spacer.cc
lily/spaceable-grob.cc
lily/tie-formatting-problem.cc

index ffc4bfcbfce26bad151ab0240007c89602ed26bd..9c71e6c44808f3900a4ee8caf1f8c708b1d49b04 100644 (file)
@@ -356,29 +356,6 @@ next_spaceable_column (vector<Grob*> const &list, vsize starting)
   return 0;
 }
 
-static void
-get_column_spring (Grob *this_col, Grob *next_col, Real *ideal, Real *inv_hooke)
-{
-  Spring_smob *spring = 0;
-
-  for (SCM s = this_col->get_object ("ideal-distances");
-       !spring && scm_is_pair (s);
-       s = scm_cdr (s))
-    {
-      Spring_smob *sp = unsmob_spring (scm_car (s));
-
-      if (sp->other_ == next_col)
-       spring = sp;
-    }
-
-  if (!spring)
-    programming_error (_f ("No spring between column %d and next one",
-                          Paper_column::get_rank (this_col)));
-
-  *ideal = (spring) ? spring->distance_ : 5.0;
-  *inv_hooke = (spring) ? spring->inverse_strength_ : 1.0;
-}
-
 static Column_description
 get_column_description (vector<Grob*> const &cols, vsize col_index, bool line_starter)
 {
@@ -389,10 +366,10 @@ get_column_description (vector<Grob*> const &cols, vsize col_index, bool line_st
   Column_description description;
   Grob *next_col = next_spaceable_column (cols, col_index);
   if (next_col)
-    get_column_spring (col, next_col, &description.ideal_, &description.inverse_hooke_);
+    Spaceable_grob::get_spring (col, next_col, &description.ideal_, &description.inverse_hooke_);
   Grob *end_col = dynamic_cast<Item*> (cols[col_index+1])->find_prebroken_piece (LEFT);
   if (end_col)
-    get_column_spring (col, end_col, &description.end_ideal_, &description.end_inverse_hooke_);
+    Spaceable_grob::get_spring (col, end_col, &description.end_ideal_, &description.end_inverse_hooke_);
 
   for (SCM s = Spaceable_grob::get_minimum_distances (col);
        scm_is_pair (s); s = scm_cdr (s))
index 7d86ebf9195ac73a7356e1f187a2807430be2fca..4ec46bbd84ff24a6807847e400b0ce96065432f8 100644 (file)
@@ -15,6 +15,7 @@
 #include "pointer-group-interface.hh"
 #include "grob.hh"
 #include "paper-column.hh"
+#include "international.hh"
 
 SCM
 Spaceable_grob::get_minimum_distances (Grob *me)
@@ -98,20 +99,29 @@ Spaceable_grob::add_spring (Grob *me, Grob *other,
 }
 
 void
-Spaceable_grob::get_spring (Grob *me, Grob *other, Real *dist, Real *inv_strength)
+Spaceable_grob::get_spring (Grob *this_col, Grob *next_col, Real *dist, Real *inv_strength)
 {
-  for (SCM s = me->get_object ("ideal-distances");
-       scm_is_pair (s); s = scm_cdr (s))
+  Spring_smob *spring = 0;
+
+  for (SCM s = this_col->get_object ("ideal-distances");
+       !spring && scm_is_pair (s);
+       s = scm_cdr (s))
     {
-      Spring_smob *spring = unsmob_spring (scm_car (s));
-      if (spring && spring->other_ == other)
-       {
-         *dist = spring->distance_;
-         *inv_strength = spring->inverse_strength_;
-       }
+      Spring_smob *sp = unsmob_spring (scm_car (s));
+
+      if (sp && sp->other_ == next_col)
+       spring = sp;
     }
+
+  if (!spring)
+    programming_error (_f ("No spring between column %d and next one",
+                          Paper_column::get_rank (this_col)));
+
+  *dist = (spring) ? spring->distance_ : 5.0;
+  *inv_strength = (spring) ? spring->inverse_strength_ : 1.0;
 }
 
+
 void
 Spaceable_grob::remove_interface (Grob *me)
 {
index d9d58cec70baa673fb738fff12573c0e662f44ee..7a751e14d2fb779025fb20467673519add0b1323 100644 (file)
@@ -294,8 +294,7 @@ Tie_formatting_problem::from_ties (vector<Grob*> const &ties)
       do
        {
          spec.note_head_drul_[d] = Tie::head (ties[i], d);
-         spec.column_ranks_[d] =
-           dynamic_cast<Spanner*> (ties[i])->get_bound (d)->get_column ()->get_rank ();
+         spec.column_ranks_[d] = Tie::get_column_rank (ties[i], d);
        }
       while (flip (&d) != LEFT);
       specifications_.push_back (spec);
@@ -328,7 +327,7 @@ Tie_formatting_problem::from_semi_ties (vector<Grob*> const &semi_ties, Directio
       spec.get_tie_manual_settings (semi_ties[i]);
       
       spec.note_head_drul_[head_dir] = head;
-      column_rank = dynamic_cast<Item*> (head)->get_column ()->get_rank ();
+      column_rank = Tie::get_column_rank (semi_ties[i], head_dir);
       spec.column_ranks_ = Drul_array<int> (column_rank, column_rank);
       heads.push_back (head);
       specifications_.push_back (spec);