]> git.donarmstrong.com Git - lilypond.git/blob - lily/g-script.cc
release: 1.1.38
[lilypond.git] / lily / g-script.cc
1 /*   
2   g-script.cc --  implement G_script
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 /*
11
12   TODO: Quantisation support (staccato dots between stafflines)
13
14 */
15 #include "debug.hh"
16 #include "g-script.hh"
17 #include "lookup.hh"
18 #include "g-staff-side.hh"
19
20 G_script::G_script ()
21 {
22   staff_side_l_ =0;
23 }
24
25 void
26 G_script::do_substitute_element_pointer (Score_element*o, Score_element*n)
27 {
28   if (o == staff_side_l_)
29     staff_side_l_ = dynamic_cast<G_staff_side_item*>(n);
30 }
31
32
33
34 Molecule
35 G_script::get_molecule(Direction d) const
36 {
37   return lookup_l ()->afm_find ("scripts-" + indices_drul_[d]);
38 }
39
40
41 void
42 G_script::do_pre_processing ()
43 {
44   Graphical_element * e
45     = staff_side_l_->dim_cache_[X_AXIS].parent_l_->element_l();
46   translate_axis (e->extent (X_AXIS).center (), X_AXIS);
47 }
48
49 void
50 G_script::do_post_processing ()
51 {
52   Direction d =  staff_side_l_->dir_;
53   Molecule m (get_molecule(d));
54   translate_axis (- m.dim_[Y_AXIS][Direction (-d)], Y_AXIS);
55 }
56
57 void
58 G_script::set_staff_side (G_staff_side_item*g)
59 {
60   staff_side_l_ = g;
61   add_dependency (g);
62   dim_cache_[Y_AXIS].parent_l_ = & g->dim_cache_[Y_AXIS];
63 }
64
65 Molecule*
66 G_script::do_brew_molecule_p () const
67 {
68   return new Molecule (get_molecule (staff_side_l_->dir_));
69 }
70
71 void
72 G_script::do_print () const
73 {
74   DOUT << "Indices: " << indices_drul_[LEFT] << ", " << indices_drul_[RIGHT];
75 }