]> git.donarmstrong.com Git - lilypond.git/blob - lily/script.cc
release: 1.3.62
[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 "dimension-cache.hh"
16
17 Script ::Script (SCM s)
18   : Item (s)
19 {
20 }
21
22 Molecule
23 Script::get_molecule(Direction d) const
24 {
25   SCM s = get_elt_property ("molecule");
26   assert (gh_pair_p (s));
27
28   SCM key = gh_car  (s);
29   if (key == ly_symbol2scm ("feta"))
30     {
31       return lookup_l ()->afm_find ("scripts-" +
32                                     ly_scm2string (index_cell (gh_cdr (s), d)));
33     }
34   else if (key == ly_symbol2scm ("accordion"))
35     {
36       return lookup_l ()->accordion (gh_cdr (s), paper_l()->get_var("interline"));
37     }
38
39   else assert (false);
40
41   return Molecule ();
42 }
43
44
45 GLUE_SCORE_ELEMENT(Script,before_line_breaking);
46 SCM
47 Script::member_before_line_breaking ()
48 {
49   /*
50     center my self on the note head.
51    */
52   Score_element * e = parent_l(X_AXIS);
53   translate_axis (e->extent (X_AXIS).center (), X_AXIS);
54
55   return SCM_UNDEFINED;
56 }
57
58 GLUE_SCORE_ELEMENT(Script,after_line_breaking);
59 SCM
60 Script::member_after_line_breaking ()
61 {
62   Side_position_interface i (this);
63   Direction d =  i.get_direction ();
64   i.set_direction (d);
65
66   return SCM_UNDEFINED;
67 }
68
69
70 GLUE_SCORE_ELEMENT(Script,brew_molecule);
71
72 SCM
73 Script::member_brew_molecule () const
74 {
75   Direction dir = DOWN;
76   SCM d = get_elt_property ("direction");
77   if (isdir_b (d))
78     dir = to_dir (d);
79   
80   return get_molecule (dir).create_scheme();
81 }
82
83
84