]> git.donarmstrong.com Git - lilypond.git/blob - lily/bar.cc
b45d977b2625914282ed1c060376f8e64d84ccdf
[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     spanned_i_ = 0;
20 }
21
22
23
24 IMPLEMENT_IS_TYPE_B1(Bar,Item);
25
26 void
27 Bar::do_print()const
28 {
29     mtor << type_str_;
30 }
31
32 Molecule*
33 Bar::brew_molecule_p()const
34 {    
35     Paper_def *p = paper();
36     Symbol s = p->lookup_l()->bar( type_str_, 
37                                    p->get_var("bar_size") );
38     Molecule*output = new Molecule(Atom(s));
39     return output;
40 }
41
42 /**
43   TODO: parametrise this (input-settable)
44  */
45 char const *bar_breaks[][3] ={
46     {":|", ":|:", "|:"},
47     {"|", "|", ""},
48     {"", "|:", "|:"},
49     {"||.", "||.", ""},
50     {0,0,0}
51 };
52
53 void
54 Bar::do_pre_processing()
55 {
56     for (int i=0; bar_breaks[i][0]; i++) {
57         if (bar_breaks[i][1] == type_str_)
58             type_str_ = bar_breaks[i][break_status_i()+1];
59     }
60   
61     // span_score_bar needs dims.
62 //    transparent_b_ = empty_b_ = (type_str_ == "");
63 }
64