]> git.donarmstrong.com Git - lilypond.git/commitdiff
even more robust attachment of loose columns.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 1 Jan 2007 13:36:33 +0000 (14:36 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 1 Jan 2007 13:36:33 +0000 (14:36 +0100)
lily/include/spacing-spanner.hh
lily/spacing-loose-columns.cc

index 7d46f78e1ce2b93151378fb37e4febe6f9638bfa..6a27eb158b7ae57e4123c27b3cdbc92d1ba185c6 100644 (file)
 #include "std-vector.hh"
 #include "grob-interface.hh"
 
-/*
-  TODO: prune to public interface.
-*/
 class Spacing_spanner
-
 {
-public:
+private:
   static void set_distances_for_loose_col (Grob *me, Grob *c, Drul_array<Item *> next_door, Spacing_options const *);
   static void generate_pair_spacing (Grob *me,
                                     Paper_column *l, Paper_column *r,
                                     Paper_column *nextr,
                                     Spacing_options const *options);
-  static void standard_breakable_column_spacing (Grob *me, Item *l, Item *r,
-                                                Real *fixed, Real *space,
-                                                Spacing_options const *);
   static Real default_bar_spacing (Grob *, Grob *, Grob *, Moment);
-  static Real note_spacing (Grob *, Grob *, Grob *, Spacing_options const *, bool *);
   static Real get_duration_space (Moment dur, Spacing_options const *, bool *);
   static Rational effective_shortest_duration (Grob *me, vector<Grob*> const &all);
   static void breakable_column_spacing (Grob *, Item *l, Item *r, Spacing_options const *);
@@ -40,7 +32,13 @@ public:
   static void generate_springs (Grob *me, vector<Grob*> const &cols, Spacing_options const *);
   static void musical_column_spacing (Grob *, Item *, Item *, Spacing_options const *);
   static vector<Grob*> get_columns (Spanner *me);
-
+  
+public:
+  static Real note_spacing (Grob *, Grob *, Grob *, Spacing_options const *, bool *);
+  static void standard_breakable_column_spacing (Grob *me, Item *l, Item *r,
+                                                Real *fixed, Real *space,
+                                                Spacing_options const *);
+  
   DECLARE_SCHEME_CALLBACK (set_springs, (SCM));
   DECLARE_SCHEME_CALLBACK (calc_common_shortest_duration, (SCM));
   DECLARE_GROB_INTERFACE();
index 069ff0e231001d87c423fefeba70c5de82c15912..4102ecdecc2009dfade508156a291c8b53b3cd94 100644 (file)
@@ -77,9 +77,23 @@ set_loose_columns (System *which, Column_x_positions const *posns)
       else
        {
          clique.back ()->programming_error ("Loose column does not have right side to attach to.");
-         right = which->get_bound (RIGHT);
+         System *base_system = dynamic_cast<System*> (which->original ());
+         int j = Paper_column::get_rank (clique.back ()) + 1;
+         int end_rank = Paper_column::get_rank (which->get_bound (RIGHT));
+         extract_grob_set (base_system, "columns", base_cols);
+         for (; j < end_rank; j++)
+           {
+             if (base_cols[j]->get_system () == which)
+               right = dynamic_cast<Item*> ((Grob*)base_cols[j]);
+           }
        }
       
+
+      if (!right)
+       {
+         programming_error ("Can't attach loose column sensibly. Attaching to end of system.");
+         right = which->get_bound (RIGHT);
+       }
       Grob *common = right->common_refpoint (left, X_AXIS);
 
       clique.push_back (right);