X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Frhythmic-head.cc;h=f771c75edc910e727b5d44eaa220d0608b3caaff;hb=7440997e6cb838533b460d45db89108b331c165d;hp=d3ac1a48677b4c1c9550add9734712f4e73589be;hpb=07a5ed85c189a97d04c550679826dfc5eca2eb18;p=lilypond.git diff --git a/lily/rhythmic-head.cc b/lily/rhythmic-head.cc index d3ac1a4867..f771c75edc 100644 --- a/lily/rhythmic-head.cc +++ b/lily/rhythmic-head.cc @@ -3,61 +3,59 @@ source file of the GNU LilyPond music typesetter - (c) 1997--2000 Han-Wen Nienhuys + (c) 1997--2006 Han-Wen Nienhuys */ #include "rhythmic-head.hh" -#include "debug.hh" + +#include "warn.hh" #include "rest.hh" #include "stem.hh" #include "staff-symbol-referencer.hh" #include "item.hh" +Item * +Rhythmic_head::get_dots (Grob *me) +{ + SCM s = me->get_object ("dot"); + return unsmob_item (s); +} -Item* -Rhythmic_head::dots_l (Grob*me) +Item * +Rhythmic_head::get_stem (Grob *me) { - SCM s = me->get_grob_property ("dot"); - return dynamic_cast (unsmob_grob (s)); + SCM s = me->get_object ("stem"); + return unsmob_item (s); } int -Rhythmic_head::balltype_i (Grob*me) +Rhythmic_head::dot_count (Grob *me) { - SCM s = me->get_grob_property ("duration-log"); - - return gh_number_p (s) ? gh_scm2int (s) : 0; + return get_dots (me) + ? scm_to_int (get_dots (me)->get_property ("dot-count")) : 0; } -Item* -Rhythmic_head::stem_l (Grob*me) +void +Rhythmic_head::set_dots (Grob *me, Item *dot) { - SCM s = me->get_grob_property ("stem"); - return dynamic_cast (unsmob_grob (s)); + me->set_object ("dot", dot->self_scm ()); } int -Rhythmic_head::dot_count (Grob*me) +Rhythmic_head::duration_log (Grob *me) { - return dots_l (me) - ? gh_scm2int (dots_l (me)->get_grob_property ("dot-count")) : 0; + SCM s = me->get_property ("duration-log"); + return scm_is_number (s) ? scm_to_int (s) : 0; } -void -Rhythmic_head::set_dots (Grob*me,Item *dot_l) -{ - me->set_grob_property ("dot", dot_l->self_scm ()); -} +ADD_INTERFACE (Rhythmic_head, + "rhythmic-head-interface", -void -Rhythmic_head::set_interface (Grob*me) -{ - me->set_interface (ly_symbol2scm ("rhythmic-head-interface")); -} + "Note head or rest", + + "dot " + "duration-log " + "stem " + ); -bool -Rhythmic_head::has_interface (Grob*me) -{ - return me && me->has_interface (ly_symbol2scm ("rhythmic-head-interface")); -}