]> git.donarmstrong.com Git - lilypond.git/blob - lily/bar.cc
release: 0.0.68pre
[lilypond.git] / lily / bar.cc
1 /*
2   bar.cc -- implement Bar
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
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"
15
16 Bar::Bar()
17 {
18     type_str_ = "|";
19 }
20
21
22 IMPLEMENT_STATIC_NAME(Bar);
23 IMPLEMENT_IS_TYPE_B1(Bar,Item);
24
25 void
26 Bar::do_print()const
27 {
28     mtor << type_str_;
29 }
30
31 Molecule*
32 Bar::brew_molecule_p()const
33 {    
34     Symbol s = paper()->lookup_l()->bar(type_str_);
35     Molecule*output = new Molecule(Atom(s));
36     return output;
37 }
38
39 /**
40   TODO: parametrise this (input-settable)
41  */
42 char const *bar_breaks[][3] ={
43     {":|", ":|:", "|:"},
44     {"|", "|", ""},
45     {"", "|:", "|:"},
46     {"||.", "||.", ""},
47     {0,0,0}
48 };
49
50 void
51 Bar::do_pre_processing()
52 {
53     for (int i=0; bar_breaks[i][0]; i++) {
54         if (bar_breaks[i][1] == type_str_)
55             type_str_ = bar_breaks[i][break_status_i()+1];
56     }
57     
58     transparent_b_ = empty_b_ = (type_str_ == "");
59 }
60