X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fgroup-interface.cc;h=9fbd329e7cf15aacabab9acdca993c4f0a81a57b;hb=e1b465ac050fed8f3957c999ec469fda0b66d351;hp=ffbbf06c5d9d795af84f518d0e3d683c589e6274;hpb=422004486569407b8809da7f3c7053c1e4767bff;p=lilypond.git diff --git a/lily/group-interface.cc b/lily/group-interface.cc index ffbbf06c5d..9fbd329e7c 100644 --- a/lily/group-interface.cc +++ b/lily/group-interface.cc @@ -1,59 +1,57 @@ -/* - group-interface.cc -- implement Group_interface - +/* + group-interface.cc -- implement Group_interface + source file of the GNU LilyPond music typesetter - - (c) 1999--2000 Han-Wen Nienhuys - - */ + + (c) 1999--2005 Han-Wen Nienhuys +*/ + #include "group-interface.hh" -#include "score-element.hh" +#include "item.hh" -/* - ugh: clean me, junk elt_l_ field - */ -Group_interface::Group_interface (Score_element * e) +void +Group_interface::add_thing (Grob *me, SCM sym, SCM thing) { - elt_l_ = (Score_element*)e; - name_ = "elements"; + me->add_to_list_property (sym, thing); } - -Group_interface::Group_interface (Score_element *e, String s) -{ - elt_l_ =(Score_element*)e; - name_ = s; -} -bool -Group_interface::has_interface () +int +Group_interface::count (Grob *me, SCM sym) { - SCM el = elt_l_->get_elt_property (name_.ch_C()); - - return el == SCM_EOL || gh_pair_p (el); + return scm_ilength (me->internal_get_property (sym)); } - - void -Group_interface::add_thing (SCM s) +Pointer_group_interface::add_grob (Grob *me, SCM name, Grob *p) { - elt_l_->set_elt_property (name_.ch_C (), - gh_cons (s, elt_l_->get_elt_property (name_.ch_C()))); + Group_interface::add_thing (me, name, p->self_scm ()); } - -int -Group_interface::count () +Link_array +extract_grob_array (Grob const *elt, SCM symbol) { - return scm_ilength (elt_l_->get_elt_property (name_.ch_C())); + Link_array arr; + + for (SCM s = elt->internal_get_property (symbol); scm_is_pair (s); s = scm_cdr (s)) + { + SCM e = scm_car (s); + arr.push (unsmob_grob (e)); + } + + arr.reverse (); + return arr; } -void -Group_interface::set_interface () +Link_array +extract_item_array (Grob const *elt, SCM symbol) { - if (!has_interface ()) + Link_array arr; + for (SCM s = elt->internal_get_property (symbol); scm_is_pair (s); s = scm_cdr (s)) { - elt_l_->set_elt_property (name_.ch_C (), SCM_EOL); + SCM e = scm_car (s); + arr.push (dynamic_cast (unsmob_grob (e))); } -} + arr.reverse (); + return arr; +}