]> git.donarmstrong.com Git - lilypond.git/blob - lily/breathing-sign.cc
release: 1.3.62
[lilypond.git] / lily / breathing-sign.cc
1 /*
2   breathing_sign.cc -- implement Breathing_sign
3
4   Copyright (C) 1999 Michael Krause
5
6   written for the GNU LilyPond music typesetter
7
8   TODO: --> see breathing-sign-engraver.cc
9
10 */
11
12 #include "staff-symbol-referencer.hh"
13 #include "directional-element-interface.hh"
14 #include "breathing-sign.hh"
15 #include "string.hh"
16 #include "molecule.hh"
17 #include "paper-def.hh"
18 #include "lookup.hh"
19 #include "debug.hh"
20 #include "dimensions.hh"
21 #include "direction.hh"
22
23
24 Breathing_sign::Breathing_sign (SCM  s)
25   : Item (s)
26 {
27 }
28
29
30
31 MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Breathing_sign,brew_molecule);
32
33 SCM 
34 Breathing_sign::brew_molecule (SCM smob)
35 {
36   Score_element * sc = unsmob_element (smob);
37   Staff_symbol_referencer_interface si (sc);
38   
39   Real space = si.staff_space();
40
41   // todo: cfg'able.
42   Interval i1(0, space / 6), i2(-space / 2, space / 2);
43   Box b(i1, i2);
44
45   return sc->lookup_l()->filledbox(b).create_scheme ();
46 }
47
48 GLUE_SCORE_ELEMENT(Breathing_sign,after_line_breaking);
49 SCM
50 Breathing_sign::member_after_line_breaking ()
51 {
52   Real space = staff_symbol_referencer (this).staff_space();
53   Direction d = directional_element (this). get ();
54   if (!d)
55     {
56       d = UP;
57       directional_element(this).set (d);
58     }
59
60   translate_axis(2.0 * space * d, Y_AXIS);
61
62   return SCM_UNDEFINED;
63 }
64