]> git.donarmstrong.com Git - lilypond.git/blob - lily/bar.cc
release: 1.1.24
[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--1998 Han-Wen Nienhuys <hanwen@cs.uu.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
17 Bar::Bar ()
18 {
19   breakable_b_ = true;
20   type_str_ = "|";
21 }
22
23 void
24 Bar::do_print () const
25 {
26 #ifndef NPRINT
27   DOUT << type_str_;
28 #endif
29 }
30
31 Molecule*
32 Bar::do_brew_molecule_p () const
33 {    
34   Paper_def *p = paper ();
35   Molecule *output = new Molecule (lookup_l ()->bar (type_str_, p->get_var ("barsize")));
36   
37   return output;
38 }
39
40 /**
41   Prescriptions for splitting bars.
42   TODO: parametrise this (input-settable)
43  */
44 static char const *bar_breaks[][3] ={
45   {":|", ":|:", "|:"},
46   {"|", "|", ""},
47   {"", "|s", "|"},
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     {
61       if (bar_breaks[i][1] == type_str_)
62         type_str_ = bar_breaks[i][break_status_dir ()+1];
63     }
64   
65   /*
66     span_score_bar needs dims, so don't do
67   
68     transparent_b_ = empty_b_ = (!type_str_);
69     
70     */
71 }
72