]> git.donarmstrong.com Git - lilypond.git/blob - lily/bar.cc
patch::: 1.3.18.jcn2
[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--1999 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_p () const
34 {
35   String s = ly_scm2string (get_elt_property ("glyph"));
36   Molecule *output
37     = new Molecule (lookup_l ()->bar (s, get_bar_size (), paper_l ()));
38   
39   return output;
40 }
41
42
43
44 void
45 Bar::do_pre_processing ()
46 {
47   SCM def = remove_elt_property ("default-glyph");
48   SCM g = get_elt_property ("glyph");
49   if (!gh_string_p (g) && gh_string_p (def))
50     {
51       set_elt_property ("glyph", def);
52       g = get_elt_property ("glyph");
53     }
54
55   SCM breakdir = gh_int2scm (break_status_dir ());
56   
57   if (gh_string_p (g))
58     {
59       g = scm_eval (gh_list (ly_symbol2scm ("break-barline"),
60                              g,
61                              breakdir,
62                              SCM_UNDEFINED));
63     }
64   else
65     {
66       g = SCM_UNDEFINED;
67     }
68   
69 #if 0  
70   if (remove_elt_property ("at-line-start") == SCM_BOOL_T       // UGR.
71       && (break_status_dir () == RIGHT) && (type_str_ == ""))
72     {
73       type_str_ = "|";
74     }
75 #endif
76   
77   if (!gh_string_p (g))
78     {
79       set_elt_property ("transparent", SCM_BOOL_T);
80       set_empty (X_AXIS);      
81     }
82   else
83     set_elt_property ("glyph", g);
84 }
85   
86