]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/gourlay-breaking.cc
(Paper_column): copy rank_. This fixes
[lilypond.git] / lily / gourlay-breaking.cc
index 789710daba5c2eb9b6df630f2393e861f25a03c4..c25d2403a6940d58db6c9c45a2b710c904e3d996 100644 (file)
@@ -5,16 +5,17 @@
 
   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
-#include <math.h>              // rint
-#include <stdio.h>
 
 #include "gourlay-breaking.hh"
-#include "column-x-positions.hh"
+
+#include <math.h>              // rint
+#include <cstdio>
+
 #include "warn.hh"
 #include "main.hh"
 #include "paper-column.hh"
 #include "paper-score.hh"
-#include "paper-def.hh"
+#include "output-def.hh"
 #include "simple-spacer.hh"
 #include "system.hh"
 
@@ -55,7 +56,7 @@ struct Break_node {
 void
 print_break_nodes (Array<Break_node> const & arr)
 {
-  for (int i =0; i < arr.size (); i++)
+  for (int i = 0; i < arr.size (); i++)
     {
       printf ( "node %d: ", i); 
       arr[i].print ();
@@ -66,6 +67,10 @@ print_break_nodes (Array<Break_node> const & arr)
   This algorithms is adapted from the OSU Tech report on breaking lines.
 
   this function is longish, but not very complicated.
+
+  TODO: should rewrite. See the function in scm/page-layout.scm for
+  inspiration.
+  
  */
 Array<Column_x_positions>
 Gourlay_breaking::do_solve () const
@@ -79,8 +84,8 @@ Gourlay_breaking::do_solve () const
   Break_node first_node ;
   optimal_paths.push (first_node);
 
-  bool ragged_right = to_boolean (pscore_->paper_->c_variable ("raggedright"));
-  bool ragged_last = to_boolean (pscore_->paper_->c_variable ("raggedlast"));
+  bool ragged_right = to_boolean (pscore_->layout_->c_variable ("raggedright"));
+  bool ragged_last = to_boolean (pscore_->layout_->c_variable ("raggedlast"));
 
   Real worst_force = 0.0;
   for (int break_idx = 1; break_idx< breaks.size (); break_idx++) 
@@ -106,8 +111,8 @@ Gourlay_breaking::do_solve () const
          cp.cols_ = line;
 
          Interval line_dims
-           = pscore_->paper_->line_dimensions_int (optimal_paths[start_idx].line_);
-         Simple_spacer * sp = generate_spacing_problem (line, line_dims);
+           = line_dimensions_int (pscore_->layout_, optimal_paths[start_idx].line_);
+         Simple_spacer_wrapper * sp = generate_spacing_problem (line, line_dims);
          bool last_line = break_idx == breaks.size ()-1;
          bool ragged = ragged_right
            || (last_line && ragged_last);
@@ -233,9 +238,9 @@ Gourlay_breaking::combine_demerits (Column_x_positions const &prev,
   if (pc->original_)
     {
       SCM pen = pc->get_property ("penalty");
-      if (ly_c_number_p (pen) && fabs (ly_scm2double (pen)) < 10000)
+      if (scm_is_number (pen) && fabs (scm_to_double (pen)) < 10000)
        {
-         break_penalties += ly_scm2double (pen);
+         break_penalties += scm_to_double (pen);
        }
     }