lilypond-0.1.57
[lilypond.git] / lily / bar.cc
blob0a699a26abcd36cfd1db10eec3d7fcad9ed55377
1 /*
2 bar.cc -- implement Bar
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.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 Bar::Bar()
18 breakable_b_ = true;
19 type_str_ = "|";
24 IMPLEMENT_IS_TYPE_B1(Bar,Item);
26 void
27 Bar::do_print() const
29 #ifndef NPRINT
30 DOUT << type_str_;
31 #endif
34 Molecule*
35 Bar::brew_molecule_p() const
37 Paper_def *p = paper();
38 Atom s = p->lookup_l()->bar (type_str_,
39 p->get_var ("barsize"));
41 Molecule*output = new Molecule (Atom (s));
42 return output;
45 /**
46 Prescriptions for splitting bars.
47 TODO: parametrise this (input-settable)
49 static char const *bar_breaks[][3] ={
50 {":|", ":|:", "|:"},
51 {"|", "|", ""},
52 {"", "|s", "|"},
53 {"", "|:", "|:"},
54 {"||.", "||.", ""},
55 {":|", ":|", ""},
56 {"||", "||", ""},
57 {0,0,0}
60 void
61 Bar::do_pre_processing()
63 for (int i=0; bar_breaks[i][0]; i++)
65 if (bar_breaks[i][1] == type_str_)
66 type_str_ = bar_breaks[i][break_status_i()+1];
70 span_score_bar needs dims, so don't do
72 transparent_b_ = empty_b_ = (!type_str_);