X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fkey-signature-interface.cc;h=60a11db86ab831cbc0db12dd035ec20bc3773f96;hb=2bd855122d7bf610fe568d061d884ac006f17c7b;hp=bcaa2594e71b343cb688269dc4a1d05d7cb17f8c;hpb=92ae3c64da38e2136f9d146429ca8c1b04c1ab91;p=lilypond.git diff --git a/lily/key-signature-interface.cc b/lily/key-signature-interface.cc index bcaa2594e7..60a11db86a 100644 --- a/lily/key-signature-interface.cc +++ b/lily/key-signature-interface.cc @@ -3,23 +3,24 @@ source file of the GNU LilyPond music typesetter - (c) 1996--2005 Han-Wen Nienhuys + (c) 1996--2006 Han-Wen Nienhuys keyplacement by Mats Bengtsson */ +#include "accidental-interface.hh" +#include "font-interface.hh" +#include "international.hh" #include "item.hh" +#include "lookup.hh" #include "output-def.hh" -#include "font-interface.hh" #include "staff-symbol-referencer.hh" -#include "lookup.hh" -#include "accidental-interface.hh" struct Key_signature_interface { DECLARE_SCHEME_CALLBACK (print, (SCM)); - static bool has_interface (Grob *); + DECLARE_GROB_INTERFACE(); }; /* @@ -86,20 +87,16 @@ MAKE_SCHEME_CALLBACK (Key_signature_interface, print, 1); SCM Key_signature_interface::print (SCM smob) { - Item *me = dynamic_cast (unsmob_grob (smob)); + Item *me = dynamic_cast (unsmob_grob (smob)); Real inter = Staff_symbol_referencer::staff_space (me) / 2.0; SCM scm_style = me->get_property ("style"); - String style; + string style; if (scm_is_symbol (scm_style)) - { - style = ly_symbol2string (scm_style); - } + style = ly_symbol2string (scm_style); else - { - style = ""; - } + style = ""; SCM newas = me->get_property ("alteration-alist"); Stencil mol; @@ -119,32 +116,29 @@ Key_signature_interface::print (SCM smob) for (SCM s = newas; scm_is_pair (s); s = scm_cdr (s)) { int alteration = scm_to_int (scm_cdar (s)); - String font_char + string font_char = Accidental_interface::get_fontcharname (style, alteration); Stencil acc (fm->find_by_name ("accidentals." + font_char)); if (acc.is_empty ()) - { - me->warning (_f ("accidental `%s' not found", font_char)); - } + me->warning (_f ("accidental `%s' not found", font_char)); else { SCM what = scm_caar (s); int pos = alteration_pos (what, alteration, c0p); acc.translate_axis (pos * inter, Y_AXIS); - - /* - The natural sign (unlike flat & sharp) - has vertical edges on both sides. A little padding is - needed to prevent collisions. - */ + /* + The natural sign (unlike flat & sharp) + has vertical edges on both sides. A little padding is + needed to prevent collisions. + */ Real padding = 0.0; if (alteration == 0 && last_pos < pos + 2 && last_pos > pos - 6) padding = 0.3; - + mol.add_at_edge (X_AXIS, LEFT, acc, padding, 0); last_pos = pos; } @@ -155,6 +149,6 @@ Key_signature_interface::print (SCM smob) return mol.smobbed_copy (); } -ADD_INTERFACE (Key_signature_interface, "key-signature-interface", +ADD_INTERFACE (Key_signature_interface, "A group of accidentals, to be printed as signature sign.", "style c0-position alteration-alist");