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>
9 #include "chord-name.hh"
10 #include "molecule.hh"
11 #include "paper-def.hh"
12 #include "font-interface.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);
21 Chord_name::after_line_breaking (SCM smob
)
23 Item
* me
= dynamic_cast<Item
*> (unsmob_grob (smob
));
26 SCM s
= me
->get_grob_property ("begin-of-line-visible");
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)
38 return SCM_UNSPECIFIED
;
41 MAKE_SCHEME_CALLBACK (Chord_name
,brew_molecule
,1);
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
))
63 mol
.add_at_edge (X_AXIS
, RIGHT
, m
, gh_scm2double (space
)*
64 Staff_symbol_referencer::staff_space (me
));
67 return mol
.smobbed_copy ();