]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/spacing-spanner.cc
release commit
[lilypond.git] / lily / spacing-spanner.cc
index 861522122eb5d7f75b7dd9da975b7da7b73ff290..f56af93598cc577404b9690d27527a2a87922cb2 100644 (file)
@@ -3,11 +3,13 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1999--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include <math.h>
+
 #include <cstdio>
+using namespace std;
 
 #include "spacing-spanner.hh"
 #include "paper-column.hh"
 #include "staff-spacing.hh"
 #include "spacing-interface.hh"
 
-
-
 Rational
-Spacing_spanner::effective_shortest_duration (Grob *me, Link_array<Grob> const &all)
+Spacing_spanner::effective_shortest_duration (Grob *me,
+                                             Link_array<Grob> const &all)
 {
   SCM preset_shortest = me->get_property ("common-shortest-duration");
   Rational global_shortest;
   if (unsmob_moment (preset_shortest))
-    {
-      global_shortest = unsmob_moment (preset_shortest)->main_part_;
-    }
+    global_shortest = unsmob_moment (preset_shortest)->main_part_;
   else
     {
       global_shortest = Spacing_spanner::find_shortest (me, all);
@@ -54,14 +53,14 @@ Spacing_spanner::set_springs (SCM smob)
   /*
     can't use get_system() ? --hwn.
   */
-  Link_array<Grob> all (me->pscore_->root_system ()->columns ());
+  Link_array<Grob> all (get_root_system (me)->columns ());
 
   set_explicit_neighbor_columns (all);
 
   Spacing_options options;
   options.init_from_grob (me);
   options.global_shortest_ = effective_shortest_duration (me, all);
-  
+
   prune_loose_columns (me, &all, &options);
   set_implicit_neighbor_columns (all);
   generate_springs (me, all, &options);
@@ -170,14 +169,12 @@ Spacing_spanner::generate_pair_spacing (Grob *me,
   if (Paper_column::is_musical (left_col))
     {
       bool skip_unbroken_right = false;
-      
+
       if (!Paper_column::is_musical (right_col)
          && options->float_nonmusical_columns_
          && after_right_col
          && Paper_column::is_musical (after_right_col))
-       {
-         skip_unbroken_right = true;
-       }
+       skip_unbroken_right = true;
 
       if (skip_unbroken_right)
        {
@@ -190,7 +187,6 @@ Spacing_spanner::generate_pair_spacing (Grob *me,
        }
       else
        musical_column_spacing (me, left_col, right_col, options);
-      
 
       if (Item *rb = right_col->find_prebroken_piece (LEFT))
        musical_column_spacing (me, left_col, rb, options);
@@ -207,7 +203,7 @@ Spacing_spanner::generate_pair_spacing (Grob *me,
 
       if (left_col && right_col)
        breakable_column_spacing (me, left_col, right_col, options);
-         
+
       if (lb && right_col)
        breakable_column_spacing (me, lb, right_col, options);
 
@@ -249,14 +245,12 @@ Spacing_spanner::musical_column_spacing (Grob *me,
 {
   bool expand_only = false;
   Real base_note_space = note_spacing (me, left_col, right_col, options, &expand_only);
-  
+
   Real compound_note_space = 0.0;
   Real compound_fixed_note_space = 0.0;
 
   if (options->stretch_uniformly_)
-    {
-      compound_note_space = base_note_space;
-    }
+    compound_note_space = base_note_space;
   else
     {
       int wish_count = 0;
@@ -274,7 +268,7 @@ Spacing_spanner::musical_column_spacing (Grob *me,
 
          Item *wish_rcol = Note_spacing::right_column (wish);
          if (Note_spacing::left_column (wish) != left_col
-             || (wish_rcol != right_col && wish_rcol != right_col->original_))
+             || (wish_rcol != right_col && wish_rcol != right_col->original ()))
            continue;
 
          /*
@@ -323,7 +317,7 @@ Spacing_spanner::musical_column_spacing (Grob *me,
       compound_fixed_note_space = min (compound_fixed_note_space,
                                       compound_note_space);
     }
-  
+
   Real inverse_strength = 1.0;
   Real distance = 1.0;
 
@@ -419,10 +413,8 @@ Spacing_spanner::breakable_column_spacing (Grob *me, Item *l, Item *r,
     }
 
   if (options->stretch_uniformly_ && l->break_status_dir () != RIGHT)
-    {
-      compound_fixed = 0.0;
-    }
-  
+    compound_fixed = 0.0;
+
   assert (!isinf (compound_space));
   compound_space = max (compound_space, compound_fixed);
 
@@ -449,11 +441,15 @@ ADD_INTERFACE (Spacing_spanner, "spacing-spanner-interface",
               "gets 2 note heads width (i.e. the space following a note is 1 note\n"
               "head width) A 16th note is followed by 0.5 note head width. The\n"
               "quarter note is followed by  3 NHW, the half by 4 NHW, etc.\n",
-              
-              "grace-space-factor spacing-increment base-shortest-duration strict-note-spacing "
-              "shortest-duration-space common-shortest-duration uniform-stretching "
-              "packed-spacing "
 
+              "grace-space-factor "
+              "spacing-increment "
+              "base-shortest-duration "
+              "strict-note-spacing "
+              "shortest-duration-space "
+              "common-shortest-duration "
+              "uniform-stretching "
+              "packed-spacing "
               );
 
 ADD_INTERFACE (Spacing_interface, "spacing-interface",