]> git.donarmstrong.com Git - lilypond.git/blob - lily/script.cc
release: 1.1.51
[lilypond.git] / lily / script.cc
1 /*   
2   g-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
21 Script::Script ()
22 {
23   staff_side_l_ =0;
24 }
25
26 void
27 Script::do_substitute_element_pointer (Score_element*o, Score_element*n)
28 {
29   if (o == staff_side_l_)
30     staff_side_l_ = dynamic_cast<Staff_side_item*>(n);
31 }
32
33
34
35 Molecule
36 Script::get_molecule(Direction d) const
37 {
38   SCM s = get_elt_property (molecule_scm_sym);
39   assert  (s != SCM_BOOL_F);
40
41   s = SCM_CDR(s);
42   SCM key = SCM_CAR (s);
43   if (key == ly_symbol ("feta"))
44     {
45       return lookup_l ()->afm_find ("scripts-" +
46                                     ly_scm2string (index_cell (SCM_CDR (s), d)));
47     }
48   else if (key == ly_symbol ("accordion"))
49     {
50       return lookup_l ()->accordion (SCM_CDR(s), paper_l()->get_realvar(interline_scm_sym));
51     }
52
53   else assert (false);
54
55   return Molecule ();
56 }
57
58
59 void
60 Script::do_pre_processing ()
61 {
62   Graphical_element * e
63     = staff_side_l_->dim_cache_[X_AXIS]->parent_l_->element_l();
64   translate_axis (e->extent (X_AXIS).center (), X_AXIS);
65 }
66
67 void
68 Script::do_post_processing ()
69 {
70   Direction d =  staff_side_l_->dir_;
71   Molecule m (get_molecule(d));
72   translate_axis (- m.dim_[Y_AXIS][Direction (-d)], Y_AXIS);
73 }
74
75 void
76 Script::set_staff_side (Staff_side_item*g)
77 {
78   staff_side_l_ = g;
79   add_dependency (g);
80   dim_cache_[Y_AXIS]->parent_l_ = g->dim_cache_[Y_AXIS];
81 }
82
83 Molecule*
84 Script::do_brew_molecule_p () const
85 {
86   return new Molecule (get_molecule (staff_side_l_->dir_));
87 }
88
89 void
90 Script::do_print () const
91 {
92
93 }