lilypond-1.5.9
[lilypond.git] / lily / g-script.cc
blob5be368383134eade5e91ad465374d70aeb3a0de1
1 /*
2 g-script.cc -- implement G_script
4 source file of the GNU LilyPond music typesetter
6 (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
12 TODO: Quantisation support (staccato dots between stafflines)
15 #include "debug.hh"
16 #include "g-script.hh"
17 #include "lookup.hh"
18 #include "g-staff-side.hh"
19 #include "paper-def.hh"
21 G_script::G_script ()
23 staff_side_l_ =0;
26 void
27 G_script::do_substitute_element_pointer (Score_element*o, Score_element*n)
29 if (o == staff_side_l_)
30 staff_side_l_ = dynamic_cast<G_staff_side_item*>(n);
35 Molecule
36 G_script::get_molecule(Direction d) const
38 SCM s = get_elt_property (molecule_scm_sym);
39 assert (s != SCM_BOOL_F);
41 s = SCM_CDR(s);
42 SCM key = SCM_CAR (s);
43 if (key == ly_symbol ("feta"))
45 return lookup_l ()->afm_find ("scripts-" +
46 ly_scm2string (index_cell (SCM_CDR (s), d)));
48 else if (key == ly_symbol ("accordion"))
50 return lookup_l ()->accordion (SCM_CDR(s), paper_l()->get_realvar(interline_scm_sym));
53 else assert (false);
55 return Molecule ();
59 void
60 G_script::do_pre_processing ()
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);
67 void
68 G_script::do_post_processing ()
70 Direction d = staff_side_l_->dir_;
71 Molecule m (get_molecule(d));
72 translate_axis (- m.dim_[Y_AXIS][Direction (-d)], Y_AXIS);
75 void
76 G_script::set_staff_side (G_staff_side_item*g)
78 staff_side_l_ = g;
79 add_dependency (g);
80 dim_cache_[Y_AXIS]->parent_l_ = g->dim_cache_[Y_AXIS];
83 Molecule*
84 G_script::do_brew_molecule_p () const
86 return new Molecule (get_molecule (staff_side_l_->dir_));
89 void
90 G_script::do_print () const