]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/spring.cc
release: 1.5.29
[lilypond.git] / lily / spring.cc
index b061067833e1d9a06b7b5ec4e3529c18b032f98c..6c6e9de6dc921af3f537823b1d94db449f4019f8 100644 (file)
@@ -3,13 +3,14 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
 #include "spring.hh"
 #include "debug.hh"
 #include "item.hh"
+#include "spaceable-grob.hh"
 #include "paper-column.hh"
 
 Spring::Spring ()
@@ -19,19 +20,30 @@ Spring::Spring ()
   strength_f_ =1.0;
 }
 
+/*
+
+ ugh : if we go from items to cols, we should adjust distance and strength.
+ */
+
 void
 Spring::add_to_cols ()
+{
+  Spaceable_grob::add_spring (item_l_drul_[LEFT]->column_l (),
+                                item_l_drul_[RIGHT]->column_l (),
+                                distance_f_, strength_f_);
+}
+
+void
+Spring::set_to_cols( )
 {
   Direction d = LEFT;
   do
     {
-      item_l_drul_[-d]->column_l ()->add_spring
-       (item_l_drul_[d]->column_l (),
-        distance_f_, strength_f_);
+      item_l_drul_[d] = item_l_drul_[d]->column_l ();
     }
-  while ((flip (&d))!=LEFT);
-}
+  while (flip (&d) != LEFT);
 
+}
 
 Column_spring::Column_spring ()
 {
@@ -41,18 +53,4 @@ Column_spring::Column_spring ()
 }
 
 
-int
-Column_spring::compare (Column_spring const & r1, Column_spring const &r2)
-{
-  return r1.other_l_->rank_i() - r2.other_l_->rank_i();
-}
 
-void
-Column_spring::print () const
-{
-#ifndef NPRINT
-  DEBUG_OUT << "Column_spring { rank = "
-       << other_l_->rank_i () << ", dist = " << distance_f_ << "}\n";   
-
-#endif
-}