lilypond-1.3.154
[lilypond.git] / lily / chord-name.cc
blob8c0d543487e28d188b282c072017562a68bbc780
1 /*
2 chord-name.cc -- implement Chord_name
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2001 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
9 #include "chord-name.hh"
10 #include "molecule.hh"
11 #include "paper-def.hh"
12 #include "font-interface.hh"
13 #include "grob.hh"
14 #include "paper-column.hh"
15 #include "line-of-score.hh"
16 #include "staff-symbol-referencer.hh"
17 #include "text-item.hh"
19 MAKE_SCHEME_CALLBACK (Chord_name,after_line_breaking,1);
20 SCM
21 Chord_name::after_line_breaking (SCM smob)
23 Item* me = dynamic_cast<Item*> (unsmob_grob (smob));
24 assert (me);
26 SCM s = me->get_grob_property ("begin-of-line-visible");
27 if (to_boolean (s))
29 if (Paper_column::rank_i (me->column_l ()) -
31 hmm, what's my column number in this line?
32 why doesn't this work?
33 me->line_l ()->rank_i_ > 2)
35 me->line_l ()->spanned_rank_iv ()[LEFT] > 1)
36 me->suicide ();
38 return SCM_UNSPECIFIED;
41 MAKE_SCHEME_CALLBACK (Chord_name,brew_molecule,1);
42 SCM
43 Chord_name::brew_molecule (SCM smob)
45 Grob *me = unsmob_grob (smob);
46 SCM style = me->get_grob_property ("style");
48 if (!gh_symbol_p (style))
49 style = ly_symbol2scm ("banter");
51 SCM chord = me-> get_grob_property ("chord");
52 SCM func = me->get_grob_property (ly_symbol2scm ("chord-name-function"));
53 SCM text = gh_call2 (func, style, chord);
55 SCM properties = Font_interface::font_alist_chain (me);
56 Molecule mol = Text_item::text2molecule (me, text, properties);
58 SCM space = me->get_grob_property ("word-space");
59 if (gh_number_p (space))
61 Molecule m;
62 m.set_empty (false);
63 mol.add_at_edge (X_AXIS, RIGHT, m, gh_scm2double (space)*
64 Staff_symbol_referencer::staff_space (me));
67 return mol.smobbed_copy ();