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