]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/bar.cc
release: 1.1.28
[lilypond.git] / lily / bar.cc
index 96071ad385b8a7001f9bf75db1ff2b2e72767040..0bb7365076bac158c4bfd660dffdef3e8f1d9b7f 100644 (file)
@@ -1,9 +1,9 @@
 /*
   bar.cc -- implement Bar
 
-  source file of the LilyPond music typesetter
+  source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "bar.hh"
 #include "lookup.hh"
 #include "debug.hh"
 
-Bar::Bar( String t)
+
+Bar::Bar ()
 {
-    type = t;
+  breakable_b_ = true;
+  type_str_ = "|";
+  at_line_start_b_ = false;
 }
 
-IMPLEMENT_STATIC_NAME(Bar);
-
 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 ();
+  Molecule *output = new Molecule (lookup_l ()->bar (type_str_, p->get_var ("barsize")));
+  
+  return output;
 }
+
+/**
+  Prescriptions for splitting bars.
+  TODO: parametrise this (input-settable)
+ */
+static char const *bar_breaks[][3] ={
+  {":|", ":|:", "|:"},
+  {"|", "|", ""},
+  {"", "|s", "|"},
+  {"", "|:", "|:"},
+  {"|.", "|.", ""},
+  {":|", ":|", ""},
+  {"||", "||", ""},
+  {".|.", ".|.", ""},
+  {"", "scorebar", "|"},
+  {"", "{", "{"},
+  {"", "[", "["},  
+  {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];
+         if (at_line_start_b_ && (break_status_dir_ == 1) && (type_str_ == ""))
+           {
+             type_str_ = "|";
+           }
+       }
+    }
+  
+  /*
+    span_score_bar needs dims, so don't do
+  
+    transparent_b_ = empty_b_ = (!type_str_);
     
+    */
+}
+