X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Feasy-notation.cc;h=8838efee2dc2b849164ad97cda0d2aae92e10b5f;hb=88bcceedeb566ced9edcef51c7049a79f4fde10e;hp=a786372441601d9cbfcb70efb2106f7961971d26;hpb=2c22efe5a46a37065b10c3f51c5d7db00d07d318;p=lilypond.git diff --git a/lily/easy-notation.cc b/lily/easy-notation.cc index a786372441..8838efee2d 100644 --- a/lily/easy-notation.cc +++ b/lily/easy-notation.cc @@ -3,30 +3,38 @@ source file of the GNU LilyPond music typesetter - (c) 2005 Han-Wen Nienhuys + (c) 2005--2009 Han-Wen Nienhuys */ #include "note-head.hh" -#include "text-interface.hh" +#include +using namespace std; + +#include "font-interface.hh" #include "grob.hh" -#include "output-def.hh" #include "music.hh" -#include "pitch.hh" -#include "font-interface.hh" +#include "output-def.hh" #include "staff-symbol-referencer.hh" #include "stem.hh" -#include +#include "stream-event.hh" +#include "text-interface.hh" +#include "rhythmic-head.hh" +/* + +TODO: move to scheme + +*/ MAKE_SCHEME_CALLBACK (Note_head, brew_ez_stencil, 1); SCM Note_head::brew_ez_stencil (SCM smob) { Grob *me = unsmob_grob (smob); - int log = Note_head::get_balltype (me); + int log = Rhythmic_head::duration_log (me); SCM cause = me->get_property ("cause"); - SCM spitch = unsmob_music (cause)->get_property ("pitch"); + SCM spitch = unsmob_stream_event (cause)->get_property ("pitch"); Pitch *pit = unsmob_pitch (spitch); SCM idx = scm_from_int (pit->get_notename ()); @@ -37,32 +45,28 @@ Note_head::brew_ez_stencil (SCM smob) else { char s[2] = "a"; - s[0] = (pit->get_notename () + 2) % 7 + 'a'; - s[0] = toupper (s[0]); - charstr = scm_makfrom0str (s); + s[0] = char ((pit->get_notename () + 2) % 7 + 'a'); + s[0] = char (toupper (s[0])); + charstr = scm_from_locale_string (s); } - SCM letter - = Text_interface::interpret_string (me->get_layout()->self_scm (), + = Text_interface::interpret_string (me->layout ()->self_scm (), Font_interface::text_font_alist_chain (me), charstr); - + Stencil l (*unsmob_stencil (letter)); l.align_to (X_AXIS, CENTER); l.align_to (Y_AXIS, CENTER); - - l = Stencil (Box (), l.expr ()); + l = Stencil (Box (), l.expr ()); Real ss = Staff_symbol_referencer::staff_space (me); Real lt = Staff_symbol_referencer::line_thickness (me); Real radius = (ss + lt) / 2.0; - Real stem_thick = 1.3 * lt; + Real stem_thick = 1.3 * lt; if (Grob *stem = unsmob_grob (me->get_object ("stem"))) - { - stem_thick = Stem::thickness (stem); - } + stem_thick = Stem::thickness (stem); int black = (log >= 2); @@ -77,9 +81,7 @@ Note_head::brew_ez_stencil (SCM smob) SCM_BOOL_T)); Stencil white_head; if (black) - { - l = l.in_color (1, 1, 1); - } + l = l.in_color (1, 1, 1); else { white_head = Stencil (extent,