]> git.donarmstrong.com Git - lilypond.git/blob - lily/clef-item.cc
release: 1.3.93
[lilypond.git] / lily / clef-item.cc
1 /*
2   clef-item.cc -- implement Clef_item
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9
10 #include "clef.hh"
11 #include "string.hh"
12 #include "molecule.hh"
13 #include "item.hh"
14
15 /*
16 FIXME: should use symbol for #'style.
17
18 */
19 MAKE_SCHEME_CALLBACK(Clef,before_line_breaking);
20 SCM
21 Clef::before_line_breaking (SCM smob)
22 {
23   Item * s = dynamic_cast<Item*> (unsmob_element (smob));
24
25   SCM style_sym =s->get_elt_property ("style");
26   String style;
27   if (gh_string_p (style_sym))
28     style = ly_scm2string (style_sym);
29
30   SCM glyph = s->get_elt_property ("glyph");
31   
32   if (gh_string_p (glyph))
33     {
34       String str = ly_scm2string (glyph);
35
36       /*
37         FIXME: should use fontsize property to set clef changes.
38        */
39       if (s->get_elt_property ("non-default") &&
40           s->break_status_dir() != RIGHT && style != "fullSizeChanges")
41         {
42           str += "_change";
43           s->set_elt_property ("glyph", ly_str02scm (str.ch_C()));        
44         }
45     }
46   else
47     {
48       s->suicide ();
49       return SCM_UNSPECIFIED;
50     }
51
52   return SCM_UNSPECIFIED;
53 }
54
55 bool
56 Clef::has_interface (Score_element* me)
57 {
58   return me->has_interface (ly_symbol2scm ("clef-interface"));
59 }
60
61
62 void
63 Clef::set_interface (Score_element* me)
64 {
65   me->set_interface (ly_symbol2scm ("clef-interface"));
66 }
67
68