]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/break-align-interface.cc
* VERSION (MY_PATCH_LEVEL): make 1.7.0
[lilypond.git] / lily / break-align-interface.cc
index fd2ae3e9f5fcecc6cbf85080f7a3d1adbfe7cda4..9bf4e4503a22ce4e6eb0f0fd818bf2ee5a27020b 100644 (file)
@@ -52,13 +52,13 @@ Break_align_interface::self_align_callback (SCM element_smob, SCM axis)
   Direction bsd = item->break_status_dir ();
   if (bsd == LEFT)
     {
-      me->set_grob_property ("self-alignment-X", gh_int2scm (RIGHT));
+      me->set_grob_property ("self-alignment-X", scm_int2num (RIGHT));
     }
 
   /*
     Force break alignment itself to be done first, in the case
    */
-  return Side_position_interface::aligned_on_self (element_smob, axis);  
+  return Self_alignment_interface::aligned_on_self (element_smob, axis);  
 }
 
 void
@@ -71,7 +71,7 @@ void
 Break_align_interface::do_alignment (Grob *me)
 {
   Item * item = dynamic_cast<Item*> (me);
-
+  int rank = Paper_column::get_rank (item->get_column ());
   Link_array<Grob> elems
     = Pointer_group_interface__extract_grobs (me, (Grob*)0,
                                                 "elements");
@@ -95,14 +95,13 @@ Break_align_interface::do_alignment (Grob *me)
 
 
   int edge_idx = -1;
-  while (idx < elems.size())
+  while (idx < elems.size() - 1)
     {
       int next_idx = idx+1;
-      while ( next_idx < elems.size() && extents[next_idx].empty_b())
+      while (next_idx < elems.size() &&
+            extents[next_idx].empty_b()
+            && next_idx != elems.size() -1 )
        next_idx++;
-
-      if (next_idx == elems.size())
-       break;
       
       Grob *l = elems[idx];
       Grob *r = elems[next_idx];
@@ -133,18 +132,18 @@ Break_align_interface::do_alignment (Grob *me)
        table, but that gets icky when that grob is suicided for some
        reason.
       */
-      for (SCM s = r->get_grob_property ("elements");
-          gh_pair_p (s); s = gh_cdr (s))
-       {
-         Grob * elt =unsmob_grob(gh_car (s));
-
-         SCM sym = elt->get_grob_property ("break-align-symbol");
-         if (gh_symbol_p (sym))
-           {
-             rsym = sym;
-             break;
-           }
-       }
+       for (SCM s = r->get_grob_property ("elements");
+            gh_pair_p (s); s = gh_cdr (s))
+         {
+           Grob * elt =unsmob_grob(gh_car (s));
+
+           SCM sym = elt->get_grob_property ("break-align-symbol");
+           if (gh_symbol_p (sym))
+             {
+               rsym = sym;
+               break;
+             }
+         }
       if (rsym  == ly_symbol2scm("left-edge"))
        edge_idx = next_idx;
 
@@ -155,17 +154,17 @@ Break_align_interface::do_alignment (Grob *me)
       bool entry_found = gh_pair_p (entry);
       if (!entry_found)
        {
-         String sym_str;
-         if(gh_symbol_p(rsym))
-           sym_str = ly_symbol2string (rsym);
+         String sym_string;
+         if(gh_symbol_p (rsym))
+           sym_string = ly_symbol2string (rsym);
 
-         String orig_str ;
+         String orig_string ;
          if (unsmob_grob (l->get_grob_property ("cause")))
-           orig_str = unsmob_grob (l->get_grob_property ("cause"))->name ();
+           orig_string = unsmob_grob (l->get_grob_property ("cause"))->name ();
          
          programming_error (_f("No spacing entry from %s to `%s'",
-                               orig_str.ch_C (),
-                               sym_str.ch_C()));
+                               orig_string.to_str0 (),
+                               sym_string.to_str0 ()));
        }
 
       Real distance = 1.0;
@@ -183,7 +182,7 @@ Break_align_interface::do_alignment (Grob *me)
        offsets[next_idx] = extents[idx][RIGHT] + distance;
       else if (type == ly_symbol2scm("minimum-space"))
        offsets[next_idx] = extents[idx][RIGHT] >? distance;
-
+      
       idx = next_idx;
     }
 
@@ -215,7 +214,6 @@ Break_align_interface::do_alignment (Grob *me)
 }
 
 
-
 ADD_INTERFACE (Break_aligned_interface, "break-aligned-interface",
   "Items that are aligned in prefatory matter.
 
@@ -229,6 +227,10 @@ of the associated space. The space definition is either (extra-space
 Special keys for the alist are 'first-note and 'next-note, signifyign
 the first note on a line, and the next note halfway a line.
 
+Rules for this spacing are much more complicated than this. 
+See [Wanske] page 126 -- 134, [Ross] pg 143 -- 147
+
+
 ",
   "break-align-symbol break-alignment-done space-alist");