]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/group-interface.cc
* lily/translator-scheme.cc (ly:translator-property): Remove.
[lilypond.git] / lily / group-interface.cc
index ffbbf06c5d9d795af84f518d0e3d683c589e6274..9fbd329e7cf15aacabab9acdca993c4f0a81a57b 100644 (file)
@@ -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 <hanwen@cs.uu.nl>
-  
- */
+
+  (c) 1999--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
 #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<Grob>
+extract_grob_array (Grob const *elt, SCM symbol)
 {
-  return scm_ilength (elt_l_->get_elt_property (name_.ch_C()));
+  Link_array<Grob> 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<Item>
+extract_item_array (Grob const *elt, SCM symbol)
 {
-  if (!has_interface ())
+  Link_array<Item> 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<Item *> (unsmob_grob (e)));
     }
-}
 
+  arr.reverse ();
+  return arr;
+}