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