]> git.donarmstrong.com Git - lilypond.git/blob - lily/script.cc
release: 1.3.71
[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--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #include "debug.hh"
11 #include "script.hh"
12 #include "lookup.hh"
13 #include "side-position-interface.hh"
14 #include "paper-def.hh"
15 #include "item.hh"
16
17 Molecule
18 Script::get_molecule(Score_element * me, Direction d)
19 {
20   SCM s = me->get_elt_property ("molecule");
21   assert (gh_pair_p (s));
22
23   SCM key = gh_car  (s);
24   if (key == ly_symbol2scm ("feta"))
25     {
26       return me->lookup_l ()->afm_find ("scripts-" +
27                                     ly_scm2string (index_cell (gh_cdr (s), d)));
28     }
29   else if (key == ly_symbol2scm ("accordion"))
30     {
31       return me->lookup_l ()->accordion (gh_cdr (s), me->paper_l()->get_var("interline"));
32     }
33   else
34     assert (false);
35
36   return Molecule ();
37 }
38
39 MAKE_SCHEME_CALLBACK(Script,after_line_breaking);
40 SCM
41 Script::after_line_breaking (SCM smob)
42 {
43   Score_element * me = unsmob_element (smob);
44
45   Direction d = Side_position::get_direction (me);
46   Side_position::set_direction (me,d);
47
48   return SCM_UNDEFINED;
49 }
50
51 MAKE_SCHEME_CALLBACK(Script,brew_molecule);
52
53 SCM
54 Script::brew_molecule (SCM smob)
55 {
56   Score_element *me= unsmob_element (smob);
57   Direction dir = DOWN;
58   SCM d = me->get_elt_property ("direction");
59   if (isdir_b (d))
60     dir = to_dir (d);
61   
62   return get_molecule (me, dir).create_scheme();
63 }
64
65 bool
66 Script::has_interface (Score_element*me)
67 {
68   return me->has_interface (ly_symbol2scm ("script-interface"));
69 }
70
71 void
72 Script::set_interface (Score_element*me)
73 {
74   return me->set_interface (ly_symbol2scm ("script-interface"));
75 }