]> git.donarmstrong.com Git - lilypond.git/blob - lily/g-script.cc
release: 1.1.42
[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   SCM s = get_elt_property (molecule_scm_sym);
38   assert  (s != SCM_BOOL_F);
39
40   s = SCM_CDR(s);
41   SCM key = SCM_CAR (s);
42   if (key == ly_symbol ("feta"))
43     {
44       return lookup_l ()->afm_find ("scripts-" +
45                                     ly_scm2string (index_cell (SCM_CDR (s), d)));
46     }
47   else if (key == ly_symbol ("accordion"))
48     {
49       return lookup_l ()->accordion (SCM_CDR(s));
50     }
51
52   else assert (false);
53
54   return Molecule ();
55 }
56
57
58 void
59 G_script::do_pre_processing ()
60 {
61   Graphical_element * e
62     = staff_side_l_->dim_cache_[X_AXIS]->parent_l_->element_l();
63   translate_axis (e->extent (X_AXIS).center (), X_AXIS);
64 }
65
66 void
67 G_script::do_post_processing ()
68 {
69   Direction d =  staff_side_l_->dir_;
70   Molecule m (get_molecule(d));
71   translate_axis (- m.dim_[Y_AXIS][Direction (-d)], Y_AXIS);
72 }
73
74 void
75 G_script::set_staff_side (G_staff_side_item*g)
76 {
77   staff_side_l_ = g;
78   add_dependency (g);
79   dim_cache_[Y_AXIS]->parent_l_ = g->dim_cache_[Y_AXIS];
80 }
81
82 Molecule*
83 G_script::do_brew_molecule_p () const
84 {
85   return new Molecule (get_molecule (staff_side_l_->dir_));
86 }
87
88 void
89 G_script::do_print () const
90 {
91
92 }