]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/system.cc
CG: Add LILYPOND_BUILD_DIR environment variable, fix issues 2604 and 2524.
[lilypond.git] / lily / system.cc
index 87f139d164ed8d1fbf9919569cb73c54f5d9b195..be3c9ec1921ac34a571911de5e7705b87ef31c3f 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1996--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1996--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -23,7 +23,6 @@
 #include "all-font-metrics.hh"
 #include "axis-group-interface.hh"
 #include "break-align-interface.hh"
-#include "column-description.hh"
 #include "grob-array.hh"
 #include "hara-kiri-group-spanner.hh"
 #include "international.hh"
@@ -207,7 +206,7 @@ System::get_broken_system_grobs ()
   SCM ret = SCM_EOL;
   for (vsize i = 0; i < broken_intos_.size (); i++)
     ret = scm_cons (broken_intos_[i]->self_scm (), ret);
-  return scm_reverse (ret);
+  return scm_reverse_x (ret, SCM_EOL);
 }
 
 SCM
@@ -255,6 +254,12 @@ System::get_footnote_grobs_in_range (vsize start, vsize end)
 
       if (Item *item = dynamic_cast<Item *>(at_bat))
         {
+          /*
+            We use this to weed out grobs that fall at the end
+            of the line when we want grobs at the beginning.
+          */
+          end_of_line_visible = item->break_status_dir () == LEFT;
+
           if (!Item::break_visible (item))
             continue;
           // safeguard to bring down the column rank so that end of line footnotes show up on the correct line
@@ -276,6 +281,14 @@ System::get_footnote_grobs_in_range (vsize start, vsize end)
         continue;
       if (!at_bat->is_live ())
         continue;
+      /*
+        TODO
+        Sometimes, there are duplicate entries in the all_elements_
+        list. In a separate patch, this practice should be squashed
+        so that the check below can be eliminated.
+      */
+      if (find (out.begin (), out.end (), at_bat) != out.end ())
+        continue;
 
       out.push_back (at_bat);
     }
@@ -783,82 +796,6 @@ System::get_neighboring_staff (Direction dir, Grob *vertical_axis_group, Interva
   return 0;
 }
 
-vector<Simple_spacer>
-System::get_simple_spacers (Real line_len, Real indent, bool ragged)
-{
-  if (!simple_spacers_.size ())
-    gen_simple_spacers (line_len, indent, ragged);
-
-  return simple_spacers_;
-}
-
-void
-System::gen_simple_spacers (Real line_len, Real indent, bool ragged)
-{
-  vector<vsize> breaks;
-  vector<Grob *> non_loose;
-  vector<Column_description> cols;
-  SCM force_break = ly_symbol2scm ("force");
-  vector<Grob *> columns = used_columns ();
-
-  for (vsize i = 0; i < columns.size (); i++)
-    if (!Paper_column::is_loose (columns[i])
-        || Paper_column::is_breakable (columns[i]))
-      non_loose.push_back (columns[i]);
-
-  breaks.clear ();
-  breaks.push_back (0);
-  cols.push_back (Column_description ());
-  for (vsize i = 1; i + 1 < non_loose.size (); i++)
-    {
-      if (Paper_column::is_breakable (non_loose[i]))
-        breaks.push_back (cols.size ());
-
-      cols.push_back (Column_description::get_column_description (non_loose, i, false));
-    }
-  breaks.push_back (cols.size ());
-  simple_spacers_.resize (breaks.size () * breaks.size (), Simple_spacer ());
-
-  for (vsize b = 0; b + 1 < breaks.size (); b++)
-    {
-      cols[breaks[b]] = Column_description::get_column_description (non_loose, breaks[b], true);
-      vsize st = breaks[b];
-
-      for (vsize c = b + 1; c < breaks.size (); c++)
-        {
-          vsize end = breaks[c];
-          Simple_spacer spacer;
-
-          for (vsize i = breaks[b]; i < end - 1; i++)
-            spacer.add_spring (cols[i].spring_);
-          spacer.add_spring (cols[end - 1].end_spring_);
-
-          for (vsize i = breaks[b]; i < end; i++)
-            {
-              for (vsize r = 0; r < cols[i].rods_.size (); r++)
-                if (cols[i].rods_[r].r_ < end)
-                  spacer.add_rod (i - st, cols[i].rods_[r].r_ - st, cols[i].rods_[r].dist_);
-              for (vsize r = 0; r < cols[i].end_rods_.size (); r++)
-                if (cols[i].end_rods_[r].r_ == end)
-                  spacer.add_rod (i - st, end - st, cols[i].end_rods_[r].dist_);
-              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.solve ((b == 0) ? line_len - indent : line_len, ragged);
-          spacer.minimal_ = c == b + 1;
-          simple_spacers_[b * breaks.size () + c] = spacer;
-
-          if (!spacer.fits ()
-              || (end < cols.size ()
-                  && cols[end].break_permission_ == force_break))
-            break;
-        }
-    }
-}
-
 Interval
 System::pure_refpoint_extent (vsize start, vsize end)
 {
@@ -951,14 +888,12 @@ System::calc_pure_relevant_grobs (SCM smob)
 
           if (Item *it = dynamic_cast<Item *> (elts[i]))
             {
-              Direction d = LEFT;
-              do
+              for (LEFT_and_RIGHT (d))
                 {
                   Item *piece = it->find_prebroken_piece (d);
                   if (piece && to_boolean (scm_apply_1 (pure_relevant_p, piece->self_scm (), SCM_EOL)))
                     relevant_grobs.push_back (piece);
                 }
-              while (flip (&d) != LEFT);
             }
         }
     }