]> git.donarmstrong.com Git - lilypond.git/blob - lily/bar.cc
release: 1.3.29
[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--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
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"
16
17
18 Bar::Bar ()
19 {
20   set_elt_property ("breakable", SCM_BOOL_T);
21 }
22
23
24 Real
25 Bar::get_bar_size () const
26 {
27   // Never called!
28   return 0;
29 }
30
31
32 Molecule 
33 Bar::do_brew_molecule () const
34 {
35   String s = ly_scm2string (get_elt_property ("glyph"));
36   return lookup_l ()->bar (s, get_bar_size (), paper_l ());
37 }
38
39
40
41 void
42 Bar::do_pre_processing ()
43 {
44   SCM g = get_elt_property ("glyph");
45   Direction bsd = break_status_dir ();
46   if (gh_string_p (g))
47     {
48       if (bsd)
49         {
50           SCM breakdir = gh_int2scm (bsd);
51           g = scm_eval (gh_list (ly_symbol2scm ("break-barline"),
52                                  g,
53                                  breakdir,
54                                  SCM_UNDEFINED));
55         }
56     }
57   else
58     {
59       g = SCM_UNDEFINED;
60     }
61   
62   if (!gh_string_p (g))
63     {
64       set_elt_property ("transparent", SCM_BOOL_T);
65       set_empty (X_AXIS);      
66     }
67   else
68     set_elt_property ("glyph", g);
69 }
70   
71