]> git.donarmstrong.com Git - lilypond.git/blob - lily/clef-item.cc
patch::: 1.3.63.uu1: Re: Lilypond?
[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-item.hh"
11 #include "string.hh"
12 #include "molecule.hh"
13 #include "item.hh"
14
15
16 /**
17   Set a clef in a staff.
18
19   properties:
20
21   non-default -- not set because of existence of a bar?
22
23   change -- is this a change clef (smaller size)?
24
25   glyph -- a string determining what glyph is typeset
26   
27  */
28 struct Clef 
29 {
30   static SCM before_line_breaking (SCM);
31 };
32
33
34 /*
35 FIXME: should use symbol.
36
37 */
38 MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Clef,before_line_breaking);
39 SCM
40 Clef::before_line_breaking (SCM smob)
41 {
42   Item * s = dynamic_cast<Item*> (unsmob_element (smob));
43
44   SCM style_sym =s->get_elt_property ("style");
45   String style;
46   if (gh_string_p (style_sym))
47     style = ly_scm2string (style_sym);
48
49   SCM glyph = s->get_elt_property ("glyph");
50   
51   if (gh_string_p (glyph))
52     {
53       String str = ly_scm2string (glyph);
54
55       /*
56         FIXME: should use fontsize property to set clef changes.
57        */
58       if (s->get_elt_property ("non-default") &&
59           s->break_status_dir() != RIGHT && style != "fullSizeChanges")
60         {
61           str += "_change";
62           s->set_elt_property ("glyph", ly_str02scm (str.ch_C()));        
63         }
64     }
65   else
66     {
67       s->suicide ();
68       return SCM_UNDEFINED;
69     }
70
71   return SCM_UNDEFINED;
72 }
73
74
75