]> git.donarmstrong.com Git - lilypond.git/blob - lily/script.cc
patch::: 1.3.8.uu1
[lilypond.git] / lily / script.cc
1 /*   
2      script.cc --  implement 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 "script.hh"
17 #include "lookup.hh"
18 #include "staff-side.hh"
19 #include "paper-def.hh"
20 #include "dimension-cache.hh"
21
22
23 Molecule
24 Script::get_molecule(Direction d) const
25 {
26   SCM s = get_elt_property ("molecule");
27   assert (s != SCM_UNDEFINED);
28
29   SCM key = SCM_CAR (s);
30   if (key == ly_symbol2scm ("feta"))
31     {
32       return lookup_l ()->afm_find ("scripts-" +
33                                     ly_scm2string (index_cell (gh_cdr (s), d)));
34     }
35   else if (key == ly_symbol2scm ("accordion"))
36     {
37       return lookup_l ()->accordion (s, paper_l()->get_var("interline"));
38     }
39
40   else assert (false);
41
42   return Molecule ();
43 }
44
45
46 void
47 Script::do_pre_processing ()
48 {
49   /*
50     center my self on the note head.
51    */
52   Graphical_element * e = parent_l(X_AXIS);
53   translate_axis (e->extent (X_AXIS).center (), X_AXIS);
54 }
55
56 void
57 Script::do_post_processing ()
58 {
59   Direction d =  Side_position_interface (this).get_direction ();
60   Molecule m (get_molecule(d));
61
62   /*
63     UGH UGH UGH
64    */
65 #if 0
66   if (staff_side_l_->get_elt_property ("no-staff-support") == SCM_UNDEFINED) 
67     translate_axis (- m.dim_[Y_AXIS][Direction (-d)], Y_AXIS);
68 #endif
69 }
70
71
72 Molecule*
73 Script::do_brew_molecule_p () const
74 {
75   Direction dir = DOWN;
76   SCM d = get_elt_property ("direction");
77   if (isdir_b (d))
78     dir = to_dir (d);
79   
80   return new Molecule (get_molecule (dir));
81 }
82
83
84