lilypond-1.0.8
[lilypond.git] / lily / bar.cc
blob32120fa1bf72ee0db17fba6092807936f9342008
1 /*
2 bar.cc -- implement Bar
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "bar.hh"
10 #include "string.hh"
11 #include "molecule.hh"
12 #include "paper-def.hh"
13 #include "lookup.hh"
14 #include "debug.hh"
16 IMPLEMENT_IS_TYPE_B1 (Bar,Item);
18 Bar::Bar ()
20 breakable_b_ = true;
21 type_str_ = "|";
24 void
25 Bar::do_print () const
27 #ifndef NPRINT
28 DOUT << type_str_;
29 #endif
32 Molecule*
33 Bar::brew_molecule_p () const
35 Paper_def *p = paper ();
36 Atom s = lookup_l ()->bar (type_str_, p->get_var ("barsize"));
38 Molecule*output = new Molecule (Atom (s));
39 return output;
42 /**
43 Prescriptions for splitting bars.
44 TODO: parametrise this (input-settable)
46 static char const *bar_breaks[][3] ={
47 {":|", ":|:", "|:"},
48 {"|", "|", ""},
49 {"", "|s", "|"},
50 {"", "|:", "|:"},
51 {"|.", "|.", ""},
52 {":|", ":|", ""},
53 {"||", "||", ""},
54 {".|.", ".|.", ""},
55 {0,0,0}
58 void
59 Bar::do_pre_processing ()
61 for (int i=0; bar_breaks[i][0]; i++)
63 if (bar_breaks[i][1] == type_str_)
64 type_str_ = bar_breaks[i][break_status_dir ()+1];
68 span_score_bar needs dims, so don't do
70 transparent_b_ = empty_b_ = (!type_str_);