]> git.donarmstrong.com Git - lilypond.git/blob - lily/dots.cc
release: 1.3.29
[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--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "dots.hh"
10 #include "molecule.hh"
11 #include "paper-def.hh"
12 #include "lookup.hh"
13 #include "staff-symbol-referencer.hh"
14 #include "directional-element-interface.hh"
15
16 Dots::Dots ()
17 {
18   set_elt_property ("dot-count", gh_int2scm (0));
19 }
20
21 void
22 Dots::do_post_processing ()
23 {
24   SCM d= get_elt_property ("dot-count");
25   if (!gh_number_p (d) || !gh_scm2int (d))
26     {
27       set_elt_property ("transparent", SCM_BOOL_T);
28       set_empty (X_AXIS);
29       set_empty (Y_AXIS);
30     }
31   else
32     {
33       if (!directional_element (this).get ())
34         directional_element (this).set (UP);
35
36       Staff_symbol_referencer_interface si (this);
37       int p = int (si.position_f ());
38       if (!(p % 2))
39         si.set_position (p  + directional_element (this).get ());
40     }
41 }
42 Molecule  
43 Dots::do_brew_molecule () const
44 {
45   Molecule mol (lookup_l ()->fill (Box (Interval (0,0),
46                                           Interval (0,0))));
47   Molecule d = lookup_l ()->afm_find (String ("dots-dot"));
48
49   Real dw = d.dim_[X_AXIS].length ();
50   d.translate_axis (-dw, X_AXIS);
51
52
53   for (int i = gh_scm2int (get_elt_property ("dot-count")); i--; )
54     {
55       d.translate_axis (2*dw,X_AXIS);
56       mol.add_molecule (d);
57     }
58
59   return mol;
60 }
61
62
63