]> git.donarmstrong.com Git - lilypond.git/blob - lily/dots.cc
cleanup. Separate into internal
[lilypond.git] / lily / dots.cc
1 /*
2   dots.cc -- implement Dots
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "dots.hh"
10 #include "item.hh"
11 #include "molecule.hh"
12 #include "paper-def.hh"
13 #include "font-interface.hh"
14 #include "lookup.hh"
15 #include "staff-symbol-referencer.hh"
16 #include "directional-element-interface.hh"
17
18 MAKE_SCHEME_CALLBACK (Dots,print,1);
19 SCM  
20 Dots::print (SCM d)
21 {
22   Grob *sc = unsmob_grob (d);
23   Molecule mol;
24   
25   SCM c = sc->get_grob_property ("dot-count");
26
27   if (gh_number_p (c))
28     {
29       Molecule d = Font_interface::get_default_font (sc)->find_by_name (String ("dots-dot"));
30       Real dw = d.extent (X_AXIS).length ();
31       
32
33       /*
34         we need to add a real blank box, to assure that
35         side-positioning doth not cancel the left-most padding.  */
36
37       /*
38         TODO: this should  be handled by side-position padding.
39        */
40       mol = Lookup::blank (Box (Interval (0,0),
41                                 Interval (0,0)));
42   
43       for (int i = gh_scm2int (c); i--;)
44         {
45           d.translate_axis (2*dw,X_AXIS);
46           mol.add_at_edge (X_AXIS, RIGHT, d, dw, 0);
47         }
48     }
49   return mol.smobbed_copy ();
50 }
51
52
53
54
55 ADD_INTERFACE (Dots, "dots-interface",
56   "The dots to go with a notehead/rest.  A separate interface, since they "
57 " are a party in collision resolution. "
58 " #'direction is the Direction to handle staff-line collisions in.",
59   "direction dot-count");
60
61