]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/bar.cc
release: 1.1.53
[lilypond.git] / lily / bar.cc
index 6d50fa0fc91d14771654b77947a3d28bbc3f072b..913c2c72ed1c0622c0107c4ef11829ec30fef4af 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "bar.hh"
 #include "lookup.hh"
 #include "debug.hh"
 
-Bar::Bar()
+
+Bar::Bar ()
 {
-    type_str_ = "|";
-    spanned_i_ = 0;
+  set_elt_property (breakable_scm_sym, SCM_BOOL_T);
+  type_str_ = "|";
 }
 
-
-IMPLEMENT_STATIC_NAME(Bar);
-IMPLEMENT_IS_TYPE_B1(Bar,Item);
-
 void
-Bar::do_print()const
+Bar::do_print () const
 {
-    mtor << type_str_;
+#ifndef NPRINT
+  String s = type_str_;
+  DOUT << "type = " << s;
+#endif
 }
 
+Real
+Bar::get_bar_size () const
+{
+  // Never called!
+  return 0;
+}
+
+
 Molecule*
-Bar::brew_molecule_p()const
+Bar::do_brew_molecule_p () const
 {    
-    Paper_def *p = paper();
-    Symbol s = p->lookup_l()->bar( type_str_, 
-                                  p->get_var("bar_size") );
-    Molecule*output = new Molecule(Atom(s));
-    return output;
+  Molecule *output = new Molecule (lookup_l ()->bar (type_str_, get_bar_size (), paper_l ()));
+  
+  return output;
 }
 
 /**
-  TODO: parametrise this (input-settable)
+  Prescriptions for splitting bars.
+  TODO: put this in SCM.
  */
-char const *bar_breaks[][3] ={
-    {":|", ":|:", "|:"},
-    {"|", "|", ""},
-    {"", "|:", "|:"},
-    {"||.", "||.", ""},
-    {0,0,0}
+static char const *bar_breaks[][3] ={
+  {":|", ":|:", "|:"},
+  {"|", "|", ""},
+  {"", "|s", "|"},
+  {"|", "|:", "|:"},
+  {"|.", "|.", ""},
+  {":|", ":|", ""},
+  {"||", "||", ""},
+  {".|.", ".|.", ""},
+  {"", "scorebar", "scorepostbreak"},
+  {"", "brace", "brace"},
+  {"", "bracket", "bracket"},  
+  {0,0,0}
 };
 
 void
-Bar::do_pre_processing()
+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_i()+1];
+  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];
+         break;
+       }
     }
-    
-    transparent_b_ = empty_b_ = (type_str_ == "");
+  if (remove_elt_property (at_line_start_scm_sym)!= SCM_BOOL_F
+      && (break_status_dir () == RIGHT) && (type_str_ == ""))
+    {
+      type_str_ = "|";
+    }
+
+  if (type_str_ =="")
+    dim_cache_[X_AXIS]->set_empty (true);
 }
-    
+