lilypond-1.3.28
[lilypond.git] / lily / bar.cc
blob90de71251c4796c240c84562c1ad47e7909b23c4
1 /*
2 bar.cc -- implement Bar
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 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);
24 Real
25 Bar::get_bar_size () const
27 // Never called!
28 return 0;
32 Molecule*
33 Bar::do_brew_molecule_p () const
35 String s = ly_scm2string (get_elt_property ("glyph"));
36 Molecule *output
37 = new Molecule (lookup_l ()->bar (s, get_bar_size (), paper_l ()));
39 return output;
44 void
45 Bar::do_pre_processing ()
47 SCM g = get_elt_property ("glyph");
48 Direction bsd = break_status_dir ();
49 if (gh_string_p (g))
51 if (bsd)
53 SCM breakdir = gh_int2scm (bsd);
54 g = scm_eval (gh_list (ly_symbol2scm ("break-barline"),
56 breakdir,
57 SCM_UNDEFINED));
60 else
62 g = SCM_UNDEFINED;
65 if (!gh_string_p (g))
67 set_elt_property ("transparent", SCM_BOOL_T);
68 set_empty (X_AXIS);
70 else
71 set_elt_property ("glyph", g);