]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/bar.cc
patch::: 1.3.98.jcn1
[lilypond.git] / lily / bar.cc
index 721c807da494a5c251e0f4ce218a717d79843f0e..4192fd0780b254741076798413283792eb10dab7 100644 (file)
@@ -7,6 +7,7 @@
 */
 #include <math.h>
 
+#include "paper-column.hh"
 #include "main.hh"
 #include "dimensions.hh"
 #include "score-element.hh"
@@ -20,7 +21,7 @@
 #include "item.hh"
 #include "staff-symbol-referencer.hh"
 
-MAKE_SCHEME_CALLBACK(Bar,brew_molecule);
+MAKE_SCHEME_CALLBACK(Bar,brew_molecule,1);
 
 SCM 
 Bar::brew_molecule (SCM smob) 
@@ -122,7 +123,7 @@ Bar::simple_barline (Score_element*me,Real w, Real h)
   return me->lookup_l ()->filledbox (Box (Interval(0,w), Interval(-h/2, h/2)));
 }
 
-MAKE_SCHEME_CALLBACK(Bar,before_line_breaking );
+MAKE_SCHEME_CALLBACK(Bar,before_line_breaking ,1);
 
 SCM
 Bar::before_line_breaking  (SCM smob)
@@ -133,53 +134,61 @@ Bar::before_line_breaking  (SCM smob)
   SCM g = me->get_elt_property ("glyph");
   SCM orig = g;
   Direction bsd = item->break_status_dir ();
-  if (gh_string_p (g))
-    {
-      if (bsd)
-       {
-         SCM breakdir = gh_int2scm (bsd);
-         g = scm_eval2 (gh_list (ly_symbol2scm ("break-barline"),
-                                g,
-                                breakdir,
-                                SCM_UNDEFINED),
-                        SCM_EOL);
-       }
-    }
-  else
+  if (gh_string_p (g) && bsd)
     {
-      g = SCM_EOL;
+      SCM proc = me->get_elt_property ("break-glyph-function");
+      g = gh_call2 (proc, g, gh_int2scm (bsd));
     }
+
   
   if (!gh_string_p (g))
     {
       me->set_elt_property ("molecule-callback", SCM_BOOL_T);
-      me->set_extent_callback (0, X_AXIS);
-
+      me->set_extent_callback (SCM_EOL, X_AXIS);
       // leave y_extent for spanbar? 
     }
 
   if (! gh_equal_p  (g, orig))
     me->set_elt_property ("glyph", g);
 
+  
+  /*
+    set a (pseudo) stem-direction, so we extra space is inserted
+    between stemup and barline.
+
+    TODO: should check if the barline is the leftmost object of the
+    break alignment.
 
+  */
+  if (gh_string_p (g))
+    {
+      Score_element * col = item->column_l ();
+      SCM dirlist = col->get_elt_property ("dir-list");
+      SCM scmdir = gh_int2scm (-1); 
+      if (scm_memq (scmdir, dirlist) == SCM_BOOL_F)
+       {
+         dirlist = gh_cons (scmdir, dirlist);
+         col->set_elt_property ("dir-list", dirlist);
+       }
+    }
+  
   return SCM_UNSPECIFIED;
 }
   
 void
 Bar::set_interface (Score_element*me)
 {
-  me->set_elt_property ("interfaces",
-                       gh_cons (ly_symbol2scm ("bar-interface"), me->get_elt_property ("interfaces")));
+  me->set_interface (ly_symbol2scm ("bar-line-interface"));
 }
 
 bool
 Bar::has_interface (Score_element*m)
 {
-  return m && m->has_interface (ly_symbol2scm ("bar-interface"));
+  return m && m->has_interface (ly_symbol2scm ("bar-line-interface"));
 }
 
 
-MAKE_SCHEME_CALLBACK(Bar,get_staff_bar_size);
+MAKE_SCHEME_CALLBACK(Bar,get_staff_bar_size,1);
 SCM
 Bar::get_staff_bar_size (SCM smob) 
 {