* lily/music-iterator.cc (quit, do_quit): new function: break link
[lilypond.git] / lily / breathing-sign.cc
blob730a3f496485574b2a8a33e826708be9de3a506d
1 /*
2 breathing_sign.cc -- implement Breathing_sign
4 Copyright (C) 1999 Michael Krause
6 written for the GNU LilyPond music typesetter
8 TODO: --> see breathing-sign-engraver.cc
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"
20 #include "dimensions.hh"
21 #include "direction.hh"
23 MAKE_SCHEME_CALLBACK (Breathing_sign,brew_molecule,1);
24 SCM
25 Breathing_sign::brew_molecule (SCM smob)
27 Grob * me = unsmob_grob (smob);
28 Real space = Staff_symbol_referencer::staff_space (me);
30 // todo: cfg'able.
31 Interval i1 (0, space / 6), i2 (-space / 2, space / 2);
32 Box b (i1, i2);
34 return Lookup::filledbox (b).smobbed_copy ();
37 MAKE_SCHEME_CALLBACK (Breathing_sign,offset_callback,2);
38 SCM
39 Breathing_sign::offset_callback (SCM element_smob, SCM)
41 Grob *me = unsmob_grob (element_smob);
43 Direction d = Directional_element_interface::get (me);
44 if (!d)
46 d = UP;
47 Directional_element_interface::set (me, d);
50 Real inter_f = Staff_symbol_referencer::staff_space (me)/2;
51 int sz = Staff_symbol_referencer::line_count (me)-1;
52 return gh_double2scm (inter_f * sz * d);
56 ADD_INTERFACE(Breathing_sign, "breathing-sign-interface",
57 "A breathing sign.",
58 "direction");