]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/simple-spacer.cc
Merge branch 'master' of git+ssh://git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / lily / simple-spacer.cc
index 560dfecacdb080ecd277cd55a99f3d02a6254b91..ffc4bfcbfce26bad151ab0240007c89602ed26bd 100644 (file)
@@ -332,8 +332,6 @@ struct Column_description
   }
 };
 
-static int compare_paper_column_rank (Grob *const &a, Grob *const &b);
-
 static bool
 is_loose (Grob *g)
 {
@@ -400,7 +398,7 @@ get_column_description (vector<Grob*> const &cols, vsize col_index, bool line_st
        scm_is_pair (s); s = scm_cdr (s))
     {
       Grob *other = unsmob_grob (scm_caar (s));
-      vsize j = binary_search (cols, other, &compare_paper_column_rank, col_index);
+      vsize j = binary_search (cols, other, Paper_column::less_than, col_index);
       if (j != VPOS)
        {
          if (cols[j] == other)
@@ -409,8 +407,10 @@ get_column_description (vector<Grob*> const &cols, vsize col_index, bool line_st
            description.end_rods_.push_back (Rod_description (j, scm_to_double (scm_cdar (s))));
        }
     }
+  
   if (!line_starter && to_boolean (col->get_property ("keep-inside-line")))
     description.keep_inside_line_ = col->extent (col, X_AXIS);
+
   description.break_permission_ = col->get_property ("line-break-permission");
   return description;
 }
@@ -468,7 +468,7 @@ get_line_forces (vector<Grob*> const &columns,
              if (!cols[i].keep_inside_line_.is_empty ())
                {
                  spacer.add_rod (i - st, end - st, cols[i].keep_inside_line_[RIGHT]);
-                 spacer.add_rod (0, i - st, cols[i].keep_inside_line_[LEFT]);
+                 spacer.add_rod (0, i - st, -cols[i].keep_inside_line_[LEFT]);
                }
            }
          spacer.solve ((b == 0) ? line_len - indent : line_len, ragged);
@@ -481,8 +481,6 @@ get_line_forces (vector<Grob*> const &columns,
          Real f = spacer.force ();
          force[b * breaks.size () + c] = f - (f < 0 ? f*f*f*f*4 : 0);
 
-         if (end < cols.size () && cols[end].break_permission_ == force_break)
-           break;
          if (!spacer.fits ())
            {
              if (c == b + 1)
@@ -491,6 +489,8 @@ get_line_forces (vector<Grob*> const &columns,
                force[b * breaks.size () + c] = infinity_f;
              break;
            }
+         if (end < cols.size () && cols[end].break_permission_ == force_break)
+           break;
        }
     }
   return force;
@@ -531,7 +531,7 @@ get_line_configuration (vector<Grob*> const &columns,
       if (!cols[i].keep_inside_line_.is_empty ())
        {
          spacer.add_rod (i, cols.size (), cols[i].keep_inside_line_[RIGHT]);
-         spacer.add_rod (0, i, cols[i].keep_inside_line_[LEFT]);
+         spacer.add_rod (0, i, -cols[i].keep_inside_line_[LEFT]);
        }
     }
 
@@ -561,9 +561,3 @@ get_line_configuration (vector<Grob*> const &columns,
   return ret;
 }
 
-static int
-compare_paper_column_rank (Grob *const &a,
-                          Grob *const &b)
-{
-  return Paper_column::get_rank (a) - Paper_column::get_rank (b);
-}