]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/bar.cc
release: 1.3.19
[lilypond.git] / lily / bar.cc
index 314f8e01a2d2227cf96fd52cad10f0c71c951b07..cfbecaa64551ebcf169542d0fe75aa07a2118dfe 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "dimension-cache.hh"
 
 Bar::Bar ()
 {
-  set_elt_property (breakable_scm_sym, SCM_BOOL_T);
-  type_str_ = "|";
+  set_elt_property ("breakable", SCM_BOOL_T);
 }
 
-void
-Bar::do_print () const
-{
-#ifndef NPRINT
-  String s = type_str_;
-  DOUT << "type = " << s;
-#endif
-}
 
 Real
 Bar::get_bar_size () const
@@ -40,49 +31,49 @@ Bar::get_bar_size () const
 
 Molecule*
 Bar::do_brew_molecule_p () const
-{    
-  Molecule *output = new Molecule (lookup_l ()->bar (type_str_, get_bar_size (), paper_l ()));
+{
+  String s = ly_scm2string (get_elt_property ("glyph"));
+  Molecule *output
+    = new Molecule (lookup_l ()->bar (s, get_bar_size (), paper_l ()));
   
   return output;
 }
 
-/**
-  Prescriptions for splitting bars.
-  TODO: put this in SCM.
- */
-static char const *bar_breaks[][3] ={
-  {":|", ":|:", "|:"},
-  {"|", "|", ""},
-  {"", "|s", "|"},
-  {"|", "|:", "|:"},
-  {"|.", "|.", ""},
-  {":|", ":|", ""},
-  {"||", "||", ""},
-  {".|.", ".|.", ""},
-  {"", "scorebar", "scorepostbreak"},
-  {"", "brace", "brace"},
-  {"", "bracket", "bracket"},  
-  {0,0,0}
-};
+
 
 void
 Bar::do_pre_processing ()
 {
-  for (int i=0; bar_breaks[i][0]; i++) 
+  SCM g = get_elt_property ("glyph");
+  SCM breakdir = gh_int2scm (break_status_dir ());
+  
+  if (gh_string_p (g))
+    {
+      g = scm_eval (gh_list (ly_symbol2scm ("break-barline"),
+                            g,
+                            breakdir,
+                            SCM_UNDEFINED));
+    }
+  else
     {
-      if (bar_breaks[i][1] == type_str_)
-       {
-         type_str_ = bar_breaks[i][break_status_dir ()+1];
-         break;
-       }
+      g = SCM_UNDEFINED;
     }
-  if (remove_elt_property (at_line_start_scm_sym)!= SCM_BOOL_F
+  
+#if 0  
+  if (remove_elt_property ("at-line-start") == SCM_BOOL_T      // UGR.
       && (break_status_dir () == RIGHT) && (type_str_ == ""))
     {
       type_str_ = "|";
     }
-
-  if (type_str_ =="")
-    set_empty (true, X_AXIS);
+#endif
+  
+  if (!gh_string_p (g))
+    {
+      set_elt_property ("transparent", SCM_BOOL_T);
+      set_empty (X_AXIS);      
+    }
+  else
+    set_elt_property ("glyph", g);
 }
   
+