lilypond-1.3.12
[lilypond.git] / lily / bar.cc
blob04214d4068f1d263ac824fff1e4cfd5d3e9d0da8
1 /*
2 bar.cc -- implement Bar
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "dimension-cache.hh"
10 #include "bar.hh"
11 #include "string.hh"
12 #include "molecule.hh"
13 #include "paper-def.hh"
14 #include "lookup.hh"
15 #include "debug.hh"
18 Bar::Bar ()
20 set_elt_property ("breakable", SCM_BOOL_T);
21 type_str_ = "|";
24 void
25 Bar::do_print () const
27 #ifndef NPRINT
28 String s = type_str_;
29 DEBUG_OUT << "type = " << s;
30 #endif
33 Real
34 Bar::get_bar_size () const
36 // Never called!
37 return 0;
41 Molecule*
42 Bar::do_brew_molecule_p () const
44 Molecule *output = new Molecule (lookup_l ()->bar (type_str_, get_bar_size (), paper_l ()));
46 return output;
49 /**
50 Prescriptions for splitting bars.
51 TODO: put this in SCM.
53 static char const *bar_breaks[][3] ={
54 {":|", ":|:", "|:"},
55 {"|", "|", ""},
56 {"", "|s", "|"},
57 {"|", "|:", "|:"},
58 {"|.", "|.", ""},
59 {":|", ":|", ""},
60 {"||", "||", ""},
61 {".|.", ".|.", ""},
62 {"", "scorebar", "scorepostbreak"},
63 {"", "brace", "brace"},
64 {"", "bracket", "bracket"},
65 {0,0,0}
68 void
69 Bar::do_pre_processing ()
71 for (int i=0; bar_breaks[i][0]; i++)
73 if (bar_breaks[i][1] == type_str_)
75 type_str_ = bar_breaks[i][break_status_dir ()+1];
76 break;
81 if (remove_elt_property ("at-line-start") == SCM_BOOL_T // UGR.
82 && (break_status_dir () == RIGHT) && (type_str_ == ""))
84 type_str_ = "|";
87 if (type_str_ =="")
88 set_empty (X_AXIS);