lilypond-1.3.69
[lilypond.git] / lily / script.cc
blobc4dcc30cd401cfe2c03a4122d1bc03dfb17dd15e
1 /*
2 script.cc -- implement Script
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include "debug.hh"
11 #include "script.hh"
12 #include "lookup.hh"
13 #include "side-position-interface.hh"
14 #include "paper-def.hh"
17 Script ::Script (SCM s)
18 : Item (s)
22 Molecule
23 Script::get_molecule(Score_element * me, Direction d)
25 SCM s = me->get_elt_property ("molecule");
26 assert (gh_pair_p (s));
28 SCM key = gh_car (s);
29 if (key == ly_symbol2scm ("feta"))
31 return me->lookup_l ()->afm_find ("scripts-" +
32 ly_scm2string (index_cell (gh_cdr (s), d)));
34 else if (key == ly_symbol2scm ("accordion"))
36 return me->lookup_l ()->accordion (gh_cdr (s), me->paper_l()->get_var("interline"));
38 else
39 assert (false);
41 return Molecule ();
46 MAKE_SCHEME_CALLBACK(Script,after_line_breaking);
47 SCM
48 Script::after_line_breaking (SCM smob)
50 Score_element * me = unsmob_element (smob);
52 Direction d = Side_position::get_direction (me);
53 Side_position::set_direction (me,d);
55 return SCM_UNDEFINED;
59 MAKE_SCHEME_CALLBACK(Script,brew_molecule);
61 SCM
62 Script::brew_molecule (SCM smob)
64 Score_element *me= unsmob_element (smob);
65 Direction dir = DOWN;
66 SCM d = me->get_elt_property ("direction");
67 if (isdir_b (d))
68 dir = to_dir (d);
70 return get_molecule (me, dir).create_scheme();