]> git.donarmstrong.com Git - lilypond.git/blob - lily/directional-element-interface.cc
release: 1.3.84
[lilypond.git] / lily / directional-element-interface.cc
1 /*   
2   directional-element.cc -- implement Directional_element
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 "directional-element-interface.hh"
11
12
13 SCM Directional_element_interface::direction_sym;
14
15 static void
16 init_functions ()
17 {
18   Directional_element_interface::direction_sym = scm_permanent_object (ly_symbol2scm ("direction"));
19 }
20 ADD_SCM_INIT_FUNC(Directional, init_functions);
21
22
23 bool
24 Directional_element_interface::has_interface (Score_element*me) 
25 {
26   return isdir_b (me->get_elt_property (direction_sym));
27 }
28
29 Direction
30 Directional_element_interface::get (Score_element*me) 
31 {
32   // return dir_;
33   SCM d= me->get_elt_property (direction_sym);
34   if (!isdir_b(d))
35     return CENTER;
36       
37   return to_dir (d);
38 }
39
40 void
41 Directional_element_interface::set (Score_element*me, Direction d) 
42 {
43   SCM sd = gh_int2scm (d);
44
45   if (me->get_elt_property (direction_sym) != sd)
46     me->set_elt_property (direction_sym, sd);
47 }