]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/break-algorithm.cc
patch::: 1.3.48.jcn1
[lilypond.git] / lily / break-algorithm.cc
index fd5955fc3845a604f55641acf4e0d33e65a6794d..3337bff317a95f570e15a14b6314022e3f34377f 100644 (file)
@@ -3,10 +3,10 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1996,  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1996--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "score-column.hh"
+#include "paper-column.hh"
 #include "break-algorithm.hh"
 #include "paper-def.hh"
 #include "debug.hh"
 #include "cpu-timer.hh"
 #include "command-request.hh"
 #include "simple-spacer.hh"
-
-
-
+#include "group-interface.hh"
 
 
 Array<int>
 Break_algorithm::find_break_indices () const
 {
-  Line_of_cols all (pscore_l_->col_l_arr_);
+  Link_array<Paper_column> all = pscore_l_->line_l_->column_l_arr ();
+  
+                                        
   Array<int> retval;
 
   for (int i=0; i < all.size (); i++)
     if (all[i]->breakable_b ())
       retval.push (i);
 
-  if (linelength <=0)
+  if (linewidth_f_ <=0)
     while (retval.size () >2)
       retval.del (1);
 
@@ -39,17 +39,18 @@ Break_algorithm::find_break_indices () const
 }
 
 
-Line_of_cols
+Link_array<Paper_column>
 Break_algorithm::find_breaks () const
 {
-  Line_of_cols all (pscore_l_->col_l_arr_);
-  Line_of_cols retval;
+  Link_array<Paper_column> all = pscore_l_->line_l_->column_l_arr ();
+    
+  Link_array<Paper_column> retval;
 
   for (int i=0; i < all.size (); i++)
     if (all[i]->breakable_b ())
       retval.push (all[i]);
 
-  if (linelength <=0)
+  if (linewidth_f_ <=0)
     while (retval.size () >2)
       retval.del (1);
 
@@ -58,7 +59,7 @@ Break_algorithm::find_breaks () const
 
 
 Simple_spacer*
-Break_algorithm::generate_spacing_problem (Line_of_cols curline, Interval line) const
+Break_algorithm::generate_spacing_problem (Link_array<Paper_column> curline, Interval line) const
 {
   Simple_spacer * sp =  new Simple_spacer;
   Paper_def * d = pscore_l_->paper_l_;
@@ -86,43 +87,14 @@ Break_algorithm::generate_spacing_problem (Line_of_cols curline, Interval line)
 Break_algorithm::Break_algorithm ()
 {
   pscore_l_ = 0;
-  linelength = 0;
+  linewidth_f_ = 0;
 }
 
 void
 Break_algorithm::set_pscore (Paper_score*s)
 {
   pscore_l_ = s;
-  linelength = s->paper_l_->linewidth_f ();
-  do_set_pscore ();
-}
-
-bool
-Break_algorithm::feasible (Line_of_cols curline) const
-{
-  if (linelength <=  0)
-    return true;
-
-  for (int i=0; i < curline.size (); i++)
-    {
-      if (i && i < curline.size () -1
-         && ((dynamic_cast<Score_column*>(curline[i]))->break_penalty_i () >= Break_req::FORCE))
-       return false;
-    }
-  return true;
-}
-
-void
-Break_algorithm::problem_OK () const
-{
-  if (pscore_l_->col_l_arr_.empty ())
-    error (_("Score does not have any columns"));
-  OK ();
-}
-
-void
-Break_algorithm::OK () const
-{
+  linewidth_f_ = s->paper_l_->get_var("linewidth");
 }
 
 Array<Column_x_positions>
@@ -133,8 +105,3 @@ Break_algorithm::solve () const
   return h;
 }
 
-void
-Break_algorithm::do_set_pscore ()
-{
-
-}