2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2014--2015 Janek WarchoĊ <lemniskata.bernoullego@gmail.com>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
24 DECLARE_SCHEME_CALLBACK (calc_parent_alignment, (SCM));
27 MAKE_SCHEME_CALLBACK (Clef_modifier, calc_parent_alignment, 1)
29 Clef_modifier::calc_parent_alignment (SCM smob)
31 Grob *me = unsmob<Grob> (smob);
32 Grob *clef = me->get_parent (X_AXIS);
33 string full_clef_name = ly_scm2string (clef->get_property ("glyph"));
34 string clef_name = replace_all(&full_clef_name, "clefs.", "");
36 // find entry with keyname clef_type in clef-alignments
37 SCM alist_entry = scm_assq (ly_symbol2scm (clef_name.c_str ()),
38 me->get_property ("clef-alignments"));
40 if (scm_is_pair (alist_entry))
42 SCM entry_value = scm_cdr (alist_entry);
43 // the value should be a pair of numbers - first is the alignment
44 // for modifiers below the clef, second for those above.
45 if (scm_is_pair (entry_value))
46 if (robust_scm2dir (me->get_property ("direction"), DOWN) == DOWN)
47 return scm_car (entry_value);
49 return scm_cdr (entry_value);
51 else // default alignment = centered
52 return scm_from_double (0);
54 else // default alignment = centered
55 return scm_from_double (0);
58 ADD_INTERFACE (Clef_modifier,
59 "The number describing transposition of the clef, placed below\n"
60 "or above clef sign. Usually this is 8 (octave transposition)\n"
61 "or 15 (two octaves), but LilyPond allows any integer here.",