]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/bar.cc
release: 1.1.18
[lilypond.git] / lily / bar.cc
index 8b831d206abb23b98558f03060a860e95fa06c29..58e4ab9ed650f2df7d61220064801e664454084d 100644 (file)
@@ -1,3 +1,11 @@
+/*
+  bar.cc -- implement Bar
+
+  source file of the GNU LilyPond music typesetter
+
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
 #include "bar.hh"
 #include "string.hh"
 #include "molecule.hh"
 
 
 
-Bar::Bar( String t)
+Bar::Bar ()
 {
-    type = t;
+  breakable_b_ = true;
+  type_str_ = "|";
 }
 
 void
-Bar::do_print()const
+Bar::do_print () const
 {
-    mtor << type;
+#ifndef NPRINT
+  DOUT << type_str_;
+#endif
 }
 
 Molecule*
-Bar::brew_molecule_p()const
+Bar::do_brew_molecule_p () const
 {    
-    Symbol s = paper()->lookup_l()->bar(type);
-    Molecule*output = new Molecule(Atom(s));
-    return output;
+  Paper_def *p = paper ();
+  Atom s = lookup_l ()->bar (type_str_, p->get_var ("barsize"));
+  
+  Molecule*output = new Molecule (Atom (s));
+  return output;
 }
+
+/**
+  Prescriptions for splitting bars.
+  TODO: parametrise this (input-settable)
+ */
+static char const *bar_breaks[][3] ={
+  {":|", ":|:", "|:"},
+  {"|", "|", ""},
+  {"", "|s", "|"},
+  {"", "|:", "|:"},
+  {"|.", "|.", ""},
+  {":|", ":|", ""},
+  {"||", "||", ""},
+  {".|.", ".|.", ""},
+  {0,0,0}
+};
+
+void
+Bar::do_pre_processing ()
+{
+  for (int i=0; bar_breaks[i][0]; i++) 
+    {
+      if (bar_breaks[i][1] == type_str_)
+       type_str_ = bar_breaks[i][break_status_dir ()+1];
+    }
+  
+  /*
+    span_score_bar needs dims, so don't do
+  
+    transparent_b_ = empty_b_ = (!type_str_);
     
+    */
+}
+