]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge branch 'master' of git+ssh://jneem@git.sv.gnu.org/srv/git/lilypond
authorJoe Neeman <joeneeman@gmail.com>
Wed, 24 Jan 2007 07:05:14 +0000 (09:05 +0200)
committerJoe Neeman <joeneeman@gmail.com>
Wed, 24 Jan 2007 07:05:14 +0000 (09:05 +0200)
1  2 
lily/constrained-breaking.cc
lily/page-breaking.cc

index d01bc2ab2efcc7ddec191b562225664ca208ed85,5fbc3f7fab55e743a7f5977092ec4c55f7986622..a4f3ac4b57a286d514518cb62bbe448f723fc80e
@@@ -4,7 -4,7 +4,7 @@@
  
    source file of the GNU LilyPond music typesetter
  
-   (c) 2006 Joe Neeman <joeneeman@gmail.com>
+   (c) 2006--2007 Joe Neeman <joeneeman@gmail.com>
  */
  
  #include "constrained-breaking.hh"
@@@ -274,7 -274,7 +274,7 @@@ Constrained_breaking::get_min_systems (
  int
  Constrained_breaking::get_max_systems (vsize start, vsize end)
  {
 -  vsize brk = (end >= start_.size ()) ? breaks_.size () - 1 : starting_breakpoints_[end];
 +  vsize brk = (end >= start_.size ()) ? breaks_.size () : starting_breakpoints_[end];
    return brk - starting_breakpoints_[start];
  }
  
@@@ -322,20 -322,23 +322,23 @@@ Constrained_breaking::initialize (
        
    Output_def *l = pscore_->layout ();
    System *sys = pscore_->root_system ();
-   Real padding = robust_scm2double (l->c_variable ("page-breaking-between-system-padding"), 0);
    Real space = robust_scm2double (l->c_variable ("ideal-system-space"), 0);
+   SCM padding_scm = l->c_variable ("page-breaking-between-system-padding");
+   if (!scm_is_number (padding_scm))
+     padding_scm = l->c_variable ("between-system-padding");
+   Real padding = robust_scm2double (padding_scm, 0.0);
  
    Interval first_line = line_dimensions_int (pscore_->layout (), 0);
    Interval other_lines = line_dimensions_int (pscore_->layout (), 1);
    /* do all the rod/spring problems */
    breaks_ = pscore_->find_break_indices ();
-   all_ = pscore_->root_system ()->columns ();
+   all_ = pscore_->root_system ()->used_columns ();
    lines_.resize (breaks_.size (), breaks_.size (), Line_details ());
    vector<Real> forces = get_line_forces (all_,
                                         other_lines.length (),
                                         other_lines.length () - first_line.length (),
                                         ragged_right_);
-   for (vsize i = 0; i < breaks_.size () - 1; i++)
+   for (vsize i = 0; i + 1 < breaks_.size (); i++)
      {
        Real max_ext = 0;
        for (vsize j = i + 1; j < breaks_.size (); j++)
    for (vsize i = 0; i < start_.size (); i++)
      {
        vsize j;
-       for (j = 0; j < breaks_.size () - 1 && breaks_[j] < start_[i]; j++)
+       for (j = 0; j + 1 < breaks_.size () && breaks_[j] < start_[i]; j++)
        ;
        starting_breakpoints_.push_back (j);
        start_[i] = breaks_[j];
diff --combined lily/page-breaking.cc
index 5c81dc392caf1a789255ac9f594b45d8bc296bf7,e531b7f4addd8de689e58e797c66e6d02a0d59f1..76a874d4e38f1aac87035c9c09016234fc8b5f23
@@@ -4,7 -4,7 +4,7 @@@
  
    source file of the GNU LilyPond music typesetter
  
-   (c) 2006 Joe Neeman <joeneeman@gmail.com>
+   (c) 2006--2007 Joe Neeman <joeneeman@gmail.com>
  */
  
  #include "page-breaking.hh"
@@@ -75,15 -75,9 +75,15 @@@ voi
  Page_breaking::break_into_pieces (vsize start_break, vsize end_break, Line_division const &div)
  {
    vector<Break_position> chunks = chunk_list (start_break, end_break);
 -  assert (chunks.size () == div.size () + 1);
 +  bool ignore_div = false;
 +  if (chunks.size () != div.size () + 1)
 +    {
 +      programming_error ("did not find a valid page breaking configuration");
 +      ignore_div = true;
 +      assert (0);
 +    }
  
-   for (vsize i = 0; i < chunks.size () - 1; i++)
+   for (vsize i = 0; i + 1 < chunks.size (); i++)
      {
        vsize sys = next_system (chunks[i]);
        if (all_[sys].pscore_)
@@@ -92,9 -86,7 +92,9 @@@
          vsize end;
          line_breaker_args (sys, chunks[i], chunks[i+1], &start, &end);
  
 -        vector<Column_x_positions> pos = line_breaking_[sys].get_solution (start, end, div[i]);
 +        vector<Column_x_positions> pos = ignore_div
 +          ? line_breaking_[sys].get_best_solution (start, end)
 +          : line_breaking_[sys].get_solution (start, end, div[i]);
          all_[sys].pscore_->root_system ()->break_into_pieces (pos);
        }
      }
@@@ -128,7 -120,7 +128,7 @@@ Page_breaking::line_details (vsize star
    vector<Line_details> ret;
    assert (chunks.size () == div.size () + 1);
  
-   for (vsize i = 0; i < chunks.size () - 1; i++)
+   for (vsize i = 0; i + 1 < chunks.size (); i++)
      {
        vsize sys = next_system (chunks[i]);
        if (all_[sys].pscore_)
@@@ -263,7 -255,7 +263,7 @@@ Page_breaking::find_chunks_and_breaks (
      {
        if (all_[i].pscore_)
        {
-         vector<Grob*> cols = all_[i].pscore_->root_system ()->columns ();
+         vector<Grob*> cols = all_[i].pscore_->root_system ()->used_columns ();
          vector<vsize> line_breaker_columns;
          line_breaker_columns.push_back (0);
  
@@@ -349,7 -341,7 +349,7 @@@ Page_breaking::system_count_bounds (vec
    Line_division ret;
    ret.resize (chunks.size () - 1, 1);
  
-   for (vsize i = 0; i < chunks.size () - 1; i++)
+   for (vsize i = 0; i + 1 < chunks.size (); i++)
      {
        vsize sys = next_system (chunks[i]);
        if (all_[sys].pscore_)