2 dots.cc -- implement Dots
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "molecule.hh"
12 #include "paper-def.hh"
13 #include "font-interface.hh"
15 #include "staff-symbol-referencer.hh"
16 #include "directional-element-interface.hh"
19 MAKE_SCHEME_CALLBACK(Dots,quantised_position_callback,2);
21 Dots::quantised_position_callback (SCM element_smob, SCM axis)
23 Score_element *me = unsmob_element (element_smob);
24 Axis a = (Axis) gh_scm2int (axis);
27 SCM d= me->get_elt_property ("dot-count");
28 if (gh_number_p (d) && gh_scm2int (d))
30 if (!Directional_element_interface::get (me))
31 Directional_element_interface::set (me, UP);
33 if (Staff_symbol_referencer::on_staffline (me))
34 return gh_double2scm (Staff_symbol_referencer::staff_space (me) / 2.0 * Directional_element_interface::get (me));
37 return gh_double2scm (0.0);
41 MAKE_SCHEME_CALLBACK(Dots,brew_molecule,1);
43 Dots::brew_molecule (SCM d)
45 Score_element *sc = unsmob_element (d);
47 Molecule mol (Lookup::blank (Box (Interval (0,0),
53 SCM c = sc->get_elt_property ("dot-count");
57 Molecule d = Font_interface::get_default_font (sc)->find_by_name (String ("dots-dot"));
58 Real dw = d.extent (X_AXIS).length ();
59 // d.translate_axis (-dw, X_AXIS);
61 for (int i = gh_scm2int (c); i--; )
63 d.translate_axis (2*dw,X_AXIS);
64 mol.add_at_edge (X_AXIS, RIGHT, d, dw);
67 return mol.create_scheme ();