2 chord-name.cc -- implement Chord_name
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2002 Jan Nieuwenhuizen <janneke@gnu.org>
9 #include "chord-name.hh"
10 #include "molecule.hh"
11 #include "paper-def.hh"
12 #include "font-interface.hh"
14 #include "paper-column.hh"
16 #include "staff-symbol-referencer.hh"
17 #include "text-item.hh"
19 MAKE_SCHEME_CALLBACK (Chord_name,after_line_breaking,1);
21 Chord_name::after_line_breaking (SCM smob)
23 Item* me = unsmob_item (smob);
26 SCM s = me->get_grob_property ("begin-of-line-visible");
29 if (Paper_column::get_rank (me->get_column ()) -
30 me->get_system ()->spanned_rank_iv ()[LEFT] > 1)
33 return SCM_UNSPECIFIED;
36 MAKE_SCHEME_CALLBACK (Chord_name,brew_molecule,1);
38 Chord_name::brew_molecule (SCM smob)
40 Grob *me = unsmob_grob (smob);
41 SCM style = me->get_grob_property ("style");
43 if (!gh_symbol_p (style))
44 style = ly_symbol2scm ("banter");
46 SCM chord = me->get_grob_property ("chord");
47 SCM func = me->get_grob_property ("chord-name-function");
48 SCM text = gh_call2 (func, style, chord);
50 SCM properties = Font_interface::font_alist_chain (me);
51 Molecule mol = Text_item::text2molecule (me, text, properties);
53 SCM space = me->get_grob_property ("word-space");
54 if (gh_number_p (space))
58 mol.add_at_edge (X_AXIS, RIGHT, m, gh_scm2double (space)*
59 Staff_symbol_referencer::staff_space (me));
62 return mol.smobbed_copy ();
66 ADD_INTERFACE (Chord_name, "chord-name-interface",
67 "generate a chord name",
68 "pitches chord style chord-name-function inversion bass begin-of-line-visible");