lilypond-1.3.67
[lilypond.git] / lily / clef-item.cc
blob26bf3e2856bf02e598e02e29972190d3b183cf82
1 /*
2 clef-item.cc -- implement Clef_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
10 #include "clef-item.hh"
11 #include "string.hh"
12 #include "molecule.hh"
13 #include "item.hh"
16 /**
17 Set a clef in a staff.
19 properties:
21 non-default -- not set because of existence of a bar?
23 change -- is this a change clef (smaller size)?
25 glyph -- a string determining what glyph is typeset
28 struct Clef
30 static SCM before_line_breaking (SCM);
35 FIXME: should use symbol.
38 MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Clef,before_line_breaking);
39 SCM
40 Clef::before_line_breaking (SCM smob)
42 Item * s = dynamic_cast<Item*> (unsmob_element (smob));
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);
49 SCM glyph = s->get_elt_property ("glyph");
51 if (gh_string_p (glyph))
53 String str = ly_scm2string (glyph);
56 FIXME: should use fontsize property to set clef changes.
58 if (s->get_elt_property ("non-default") &&
59 s->break_status_dir() != RIGHT && style != "fullSizeChanges")
61 str += "_change";
62 s->set_elt_property ("glyph", ly_str02scm (str.ch_C()));
65 else
67 s->suicide ();
68 return SCM_UNDEFINED;
71 return SCM_UNDEFINED;