]> git.donarmstrong.com Git - lilypond.git/blob - lily/clef.cc
make implementation for Class::has_interface automatically. Junk all
[lilypond.git] / lily / clef.cc
1
2 /*
3   clef.cc -- implement Clef_item
4
5   source file of the GNU LilyPond music typesetter
6
7   (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
9
10
11 #include "clef.hh"
12 #include "string.hh"
13 #include "molecule.hh"
14 #include "item.hh"
15 #include "font-interface.hh"
16
17 /*
18  FIXME: should use symbol for #'style.
19 */
20 MAKE_SCHEME_CALLBACK (Clef,before_line_breaking,1);
21 SCM
22 Clef::before_line_breaking (SCM smob)
23 {
24   Item * s = unsmob_item (smob);
25
26   SCM glyph = s->get_grob_property ("glyph-name");
27   
28   if (gh_string_p (glyph))
29     {
30       String str = ly_scm2string (glyph);
31
32       if (to_boolean (s->get_grob_property ("non-default"))
33           && s->break_status_dir () != RIGHT
34           && !to_boolean (s->get_grob_property ("full-size-change")))
35         {
36           str += "_change";
37           s->set_grob_property ("glyph-name", ly_str02scm (str.ch_C ()));         
38         }
39     }
40   else
41     {
42       s->suicide ();
43       return SCM_UNSPECIFIED;
44     }
45
46   return SCM_UNSPECIFIED;
47 }
48
49
50
51
52 MAKE_SCHEME_CALLBACK (Clef,brew_molecule,1)
53 SCM
54 Clef::brew_molecule (SCM smob) 
55 {
56   Grob * sc = unsmob_grob (smob);
57   SCM glyph = sc->get_grob_property ("glyph-name");
58   if (gh_string_p (glyph))
59     {
60       return Font_interface::get_default_font (sc)->find_by_name (String (ly_scm2string (glyph))).smobbed_copy ();
61     }
62   else
63     {
64       return SCM_EOL;
65     }
66 }
67
68
69 ADD_INTERFACE (Clef, "clef-interface",
70   "A clef sign",
71   "non-default full-size-change glyph-name");
72