]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 1.3.10 release/1.3.10
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 8 Dec 1999 00:07:11 +0000 (01:07 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 8 Dec 1999 00:07:11 +0000 (01:07 +0100)
67 files changed:
CHANGES
DEDICATION
VERSION
lily/align-element.cc
lily/auto-beam-engraver.cc
lily/axis-group-element.cc
lily/beam.cc
lily/break-align-engraver.cc
lily/break-align-item.cc
lily/collision.cc
lily/crescendo.cc
lily/dot-column-engraver.cc
lily/dot-column.cc
lily/extender-spanner.cc
lily/graphical-axis-group.cc [deleted file]
lily/graphical-element.cc [deleted file]
lily/group-interface.cc
lily/hyphen-spanner.cc
lily/include/axis-group-element.hh
lily/include/collision.hh
lily/include/dot-column.hh
lily/include/graphical-axis-group.hh [deleted file]
lily/include/group-interface.hh
lily/include/multi-measure-rest.hh
lily/include/note-column.hh
lily/include/rest-collision.hh
lily/include/rest.hh
lily/include/rhythmic-head.hh
lily/include/score-element.hh
lily/include/script-column.hh
lily/include/slur.hh
lily/include/span-bar.hh
lily/include/stem-staff-side.hh
lily/include/stem.hh
lily/include/tie.hh
lily/include/tuplet-spanner.hh
lily/include/volta-spanner.hh
lily/item.cc
lily/line-of-score.cc
lily/local-key-engraver.cc
lily/multi-measure-rest-engraver.cc
lily/multi-measure-rest.cc
lily/note-column.cc
lily/note-head.cc
lily/note-heads-engraver.cc
lily/paper-score.cc
lily/rest-collision.cc
lily/rest-engraver.cc
lily/rest.cc
lily/rhythmic-head.cc
lily/score-element.cc
lily/script-column.cc
lily/separating-group-spanner.cc
lily/slur.cc
lily/spacing-spanner.cc
lily/span-bar.cc
lily/spanner.cc
lily/staff-side.cc
lily/staff-symbol-referencer.cc
lily/stem-engraver.cc
lily/stem-tremolo.cc
lily/stem.cc
lily/tie.cc
lily/tuplet-spanner.cc
lily/volta-spanner.cc
make/out/lilypond.lsm
make/out/lilypond.spec

diff --git a/CHANGES b/CHANGES
index bcb9d4b971fe69ac438dcc42b1c3277ec003c98f..6742e3945cc6943ca5f3a6296e03460d3c3497fe 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,15 +5,8 @@ pl 9.hwn1
        - junk Score_element::do_{width,height}: set callbacks directly.
        - merge Score_element, Graphical_element
        - merge Axis_group_element, Graphical_axis_group
-       - junk pointer fields from
-         * Single_malt_grouping_item
-         * Separating_group_spanner
-         * Stem_tremolo
-         * Hara_kiri_vertical_group_spanner
-         * Stem
-         * Axis_group_element
-         * Align_element
-         * Beam
+       - junk pointer fields fromScore_element derived classes
+       - junk obsolete do_substitute_dependency code.
 
 **********
 
index 5ce61d6331a9a7395d61634b1e9862311d968a89..03d11e0b40b5849bc3d00b97a52fee29ce607db1 100644 (file)
@@ -21,7 +21,7 @@ Eva, Roos, Judith, Tim, and, of course, Wendy!
  
 
 Of course, our other friends in the `Eindhovens Jongeren Ensemble'
-(http://www.cs.uu.nl/~hanwen/eje/) cannot go unmentioned either.
+cannot go unmentioned either.
 
 
                               --- * ---
diff --git a/VERSION b/VERSION
index fe652d9364212749892ef09ed5669be4181c2642..978773045b1b91f64e82ff4b5cb6266373b0682e 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,8 +1,8 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
-PATCH_LEVEL=9
-MY_PATCH_LEVEL=hwn2
+PATCH_LEVEL=10
+MY_PATCH_LEVEL=
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index 2297ddd017b8c87fc71fb21081d7bea22c3cdeac..4134d8e3e2579cfb1185d0b9cce9ee586bff1aa2 100644 (file)
@@ -64,8 +64,7 @@ Align_element::do_side_processing ()
   Real where_f=0;
   Real center_f = 0.0;
   SCM scenter = get_elt_property ("center-element");
-  Score_element *center_elt = (SMOB_IS_TYPE_B(Score_element,scenter))
-    ? SMOB_TO_TYPE(Score_element,scenter) : 0;
+  Score_element *center_elt = unsmob_element (scenter);
   
   for (int i=0 ;  i < elems.size(); i++) 
     {
index 6e1e805b3d3da27d8d53d27bc274dcaac95b1d91..81e7cf94b8694763477d4a2aa20e083d965d0f29 100644 (file)
@@ -327,7 +327,7 @@ Auto_beam_engraver::acknowledge_element (Score_element_info info)
       /*
        Don't (start) auto-beam over empty stems; skips or rests
        */
-      if (!stem_l->head_l_arr_.size ())
+      if (!stem_l->first_head ())
        {
          if (stem_l_arr_p_)
            end_beam ();
index 306d9d481bf686b43528811fef4e4f352a169903..5992ea461455522ca4fa17bf50d877b6b6155042 100644 (file)
@@ -27,7 +27,7 @@ Axis_group_element::elem_l_arr () const
   for (SCM s = get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
     {
       SCM e=gh_car (s); 
-      r.push (dynamic_cast<Score_element*>(SMOB_TO_TYPE (Score_element, e)));
+      r.push (unsmob_element (e));
     }
       
   return r;
@@ -85,7 +85,7 @@ Axis_group_element::extent_callback (Dimension_cache const *c)
   for (SCM s = me->get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
     {
       SCM e=gh_car (s); 
-      Score_element * se = dynamic_cast<Score_element*>(SMOB_TO_TYPE (Score_element, e));
+      Score_element * se = SMOB_TO_TYPE (Score_element, e);
 
       Interval dims = se->extent (a);
       if (!dims.empty_b ())
index 10e1355d02622930022dadf6816c5c082efd5ba8..0335ff72565218e592c032d95588e3cf6f1af069 100644 (file)
@@ -59,7 +59,7 @@ Beam::stem (int i)const
 int
 Beam::stem_count ()const
 {
-  Group_interface gi (this);
+  Group_interface gi (this, "stems");
   return gi.count ();
 }
 
@@ -67,7 +67,7 @@ Beam::stem_count ()const
 void
 Beam::add_stem (Stem*s)
 {
-  Group_interface gi (this);
+  Group_interface gi (this, "stems");
   gi.add_element (s);
   
   s->add_dependency (this);
@@ -728,7 +728,7 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
 
   // UGH
   Real nw_f;
-  if (!here->head_l_arr_.size ())
+  if (!here->first_head ())
     nw_f = 0;
   else if (here->type_i ()== 1)
     nw_f = paper_l ()->get_var ("wholewidth");
index 20909e5b03a761d2dcdbd2bdf6af2dca2c240f5a..f735fe9e8c65eb52eb3151e646040c086002e06f 100644 (file)
@@ -32,7 +32,7 @@ ADD_THIS_TRANSLATOR(Break_align_engraver);
 void
 Break_align_engraver::add_column (SCM smob)
 {
-  Score_element * e = SMOB_TO_TYPE (Score_element, smob);
+  Score_element * e = unsmob_element (smob);
   align_l_->add_element (e);
   typeset_element (e);
 }
@@ -105,7 +105,7 @@ Break_align_engraver::acknowledge_element (Score_element_info inf)
       Axis_group_item * group = 0;
       if (s != SCM_BOOL_F)
        {
-         Score_element *e =  SMOB_TO_TYPE(Score_element, gh_cdr(s));
+         Score_element *e =  unsmob_element (gh_cdr(s));
          group = dynamic_cast<Axis_group_item*> (e);
        }
       else
index e4c518834c4a010b2731547987a2fd5561bcf43d..c4b6963bbcbfeb359ea169c6b45e9dfd3ba12f50 100644 (file)
@@ -33,11 +33,13 @@ Break_align_item::do_pre_processing()
   Real interline= paper_l ()->get_var ("interline");   
   
   Link_array<Score_element> elems;
-  for (int i=0; i < elem_l_arr_.size(); i++) 
+  Link_array<Score_element> all_elems (elem_l_arr ());
+  
+  for (int i=0; i < all_elems.size(); i++) 
     {
-      Interval y = elem_l_arr_[i]->extent(axis ());
+      Interval y = all_elems[i]->extent(axis ());
       if (!y.empty_b())
-       elems.push (dynamic_cast<Score_element*> (elem_l_arr_[i]));
+       elems.push (dynamic_cast<Score_element*> (all_elems[i]));
     }
   
   if (!elems.size ())
index 48148c21ef7b4c9c3d2df5cfedda2ae384c0f888..f1691792c64754faccc7d43f2a79c7179c0a065d 100644 (file)
@@ -11,8 +11,6 @@
 #include "note-head.hh"
 #include "paper-def.hh"
 
-#include "tuple.hh"
-
 Collision::Collision()
 {
   set_axes (X_AXIS, Y_AXIS);
@@ -21,17 +19,20 @@ Collision::Collision()
 void
 Collision::add_column (Note_column* ncol_l)
 {
-  clash_l_arr_.push (ncol_l);
   add_element (ncol_l);
   add_dependency (ncol_l);
 }
 
+/*
+  UGH.  junk Shift_tup .
+ */
+
 void
 Collision::do_pre_processing()
 {
   Array<Shift_tup> autos (automatic_shift ());
   Array<Shift_tup> hand (forced_shift ());
-  Link_array<Note_column> done;
+  Link_array<Score_element> done;
   
   Real wid = paper_l ()->get_var ("collision_note_width");
   for (int i=0; i < hand.size (); i++)
@@ -60,10 +61,15 @@ Collision::automatic_shift ()
   Drul_array<Array<int> > shifts;
   Array<Shift_tup>  tups;
 
-  
-  for (int i=0; i < clash_l_arr_.size(); i++)
+
+  SCM s = get_elt_property ("elements");
+  for (; gh_pair_p (s); s = gh_cdr (s))
     {
-      clash_groups[clash_l_arr_[i]->dir ()].push (clash_l_arr_[i]);
+      SCM car = gh_car (s);
+
+      Score_element * se = unsmob_element (car);
+      if (Note_column * col = dynamic_cast<Note_column*> (se))
+       clash_groups[col->dir ()].push (col);
     }
 
   
@@ -134,8 +140,16 @@ Collision::automatic_shift ()
     {
       Note_column *cu_l =clash_groups[UP][0];
       Note_column *cd_l =clash_groups[DOWN][0];
-      Note_head * nu_l= cu_l->head_l_arr_[0];
-      Note_head * nd_l = cd_l->head_l_arr_.top();
+
+
+      /*
+       TODO.
+       */
+      Note_head * nu_l= cu_l->first_head();  // cu_l->head_l_arr_[0];
+      Note_head * nd_l = cd_l->first_head(); // cd_l->head_l_arr_.top();
+
+
+      
       int downpos =    cd_l->head_positions_interval ()[BIGGER];
       int uppos =      cu_l->head_positions_interval ()[SMALLER];      
       
@@ -174,26 +188,19 @@ Collision::forced_shift ()
 {
   Array<Shift_tup> tups;
   
-  for (int i=0; i < clash_l_arr_.size (); i++)
+  SCM s = get_elt_property ("elements");
+  for (; gh_pair_p (s); s = gh_cdr (s))
     {
-      SCM force =  clash_l_arr_[i]->remove_elt_property ("force-hshift");
+      Score_element * se = unsmob_element ( gh_car (s));
+
+      SCM force =  se->remove_elt_property ("force-hshift");
       if (force != SCM_UNDEFINED)
        {
-         tups. push (Shift_tup (clash_l_arr_[i], gh_scm2double (force)));
+         tups. push (Shift_tup (se, gh_scm2double (force)));
        }
     }
   return tups;
 }
 
 
-void
-Collision::do_substitute_element_pointer (Score_element*o_l,Score_element*n_l)
-{
-  if (o_l)
-    {
-      clash_l_arr_.substitute (dynamic_cast<Note_column *> (o_l),
-                              dynamic_cast <Note_column *> (n_l));
-
-    }
-}
 
index b8ab2137faed4ffa55c605484fdc50912c055d9b..ccd2e91b80442cb7873eddc1f39218f2a6e9bdb7 100644 (file)
@@ -23,7 +23,7 @@ Crescendo::Crescendo ()
 Molecule
 Crescendo::get_symbol () const
 {
-  Real w_dim = extent (X_AXIS).length () - get_broken_left_end_align ();
+  Real w_dim = spanner_length()- get_broken_left_end_align ();
   Real absdyn_dim = paper_l ()-> get_var ("crescendo_shorten");
   if (dyn_b_drul_[LEFT])
     {
index ece651bc9ac74e86ad9ada3b60c7c37633a3df40..ccf70320b4df75720b767ea4d1ee7fb42e3011de 100644 (file)
@@ -34,7 +34,7 @@ Dot_column_engraver::acknowledge_element (Score_element_info info)
   if (!h)
       return;
 
-  if (!h->dots_l_)
+  if (!h->dots_l ())
     return;
 
   if (!dotcol_p_)
index 5ca15e946ddbe9421f454531c694b404735c5e71..730228eeecad7cdbeae88bcb94eb9cf3808e3c71 100644 (file)
@@ -9,11 +9,14 @@
 #include "dots.hh"
 #include "dot-column.hh"
 #include "rhythmic-head.hh"
+#include "group-interface.hh"
 
 void
 Dot_column::add_dots (Dots *d)
 {
-  dot_l_arr_.push (d);
+  Group_interface gi (this, "dots");
+  gi.add_element (d);
+
   add_dependency (d);
   add_element (d);
 }
@@ -21,20 +24,13 @@ Dot_column::add_dots (Dots *d)
 void
 Dot_column::add_head (Rhythmic_head *r)
 {
-  if (!r->dots_l_)
+  if (!r->dots_l ())
     return ;
 
   add_support (r);
-  add_dots (r->dots_l_);
+  add_dots (r->dots_l ());
 }
 
-void
-Dot_column::do_substitute_element_pointer (Score_element*o,Score_element*n)
-{
-  Note_head_side::do_substitute_element_pointer (o,n);
-  if (Dots * d = dynamic_cast<Dots*> (o))
-    dot_l_arr_.substitute (d, dynamic_cast<Dots*> (n));
-}
 
 int
 Dot_column::compare (Dots * const &d1, Dots * const &d2)
@@ -42,15 +38,12 @@ Dot_column::compare (Dots * const &d1, Dots * const &d2)
   return int (d1->position_f () - d2->position_f ());
 }
 
-void
-Dot_column::do_pre_processing ()
-{
-  dot_l_arr_.sort (Dot_column::compare);
-  Note_head_side::do_pre_processing ();
-}
 
 Dot_column::Dot_column ()
 {
+  Group_interface gi (this, "dots");
+  gi.set_interface ();
+  
   set_direction (RIGHT);
   set_axes(X_AXIS,X_AXIS);
 }
@@ -73,21 +66,24 @@ Dot_column::Dot_column ()
 void
 Dot_column::do_post_processing ()
 {
-  if (dot_l_arr_.size () < 2)
+  Link_array<Dots> dots = Group_interface__extract_elements (this, (Dots*)0 , "dots"); 
+  dots.sort (Dot_column::compare);
+  
+  if (dots.size () < 2)
     return;
   Slice s;
   s.set_empty ();
 
   Array<int> taken_posns;
   int conflicts = 0;
-  for (int i=0; i < dot_l_arr_.size (); i++)
+  for (int i=0; i < dots.size (); i++)
     {
       for (int j=0; j < taken_posns.size (); j++)
-       if (taken_posns[j] == (int) dot_l_arr_[i]->position_f ())
+       if (taken_posns[j] == (int) dots[i]->position_f ())
          conflicts++;
-      taken_posns.push ((int)dot_l_arr_[i]->position_f ());
-      s.unite (Slice ((int)dot_l_arr_[i]->position_f (),
-                     (int)dot_l_arr_[i]->position_f ()));      
+      taken_posns.push ((int)dots[i]->position_f ());
+      s.unite (Slice ((int)dots[i]->position_f (),
+                     (int)dots[i]->position_f ()));      
     }
 
   if (!conflicts)
@@ -97,12 +93,12 @@ Dot_column::do_post_processing ()
   /*
     +1 -> off by one 
    */
-  int pos = middle - dot_l_arr_.size () + 1;
+  int pos = middle - dots.size () + 1;
   if (!(pos % 2))
     pos ++;                    // center () rounds down.
 
-  for (int i=0; i  <dot_l_arr_.size (); pos += 2, i++)
+  for (int i=0; i  <dots.size (); pos += 2, i++)
     {
-      dot_l_arr_[i]->set_position(pos);
+      dots[i]->set_position(pos);
     }
 }
index b9f4f487b5fa04a85fad093e1f723bad9e5ca58e..a9eb6640c59dd66286073bd1adc46401b6123d9b 100644 (file)
@@ -35,7 +35,7 @@ Extender_spanner::do_brew_molecule_p () const
 {
   Molecule* mol_p = new Molecule;
 
-  Real w = extent (X_AXIS).length ();
+  Real w = spanner_length ();
   
   w += (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]);
   Real h = paper_l ()->get_var ("extender_height");
diff --git a/lily/graphical-axis-group.cc b/lily/graphical-axis-group.cc
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/lily/graphical-element.cc b/lily/graphical-element.cc
deleted file mode 100644 (file)
index e69de29..0000000
index b91d50e9367e28d99598dfff4629041dc866523b..e9b79eeb19a05a195a58cdb8100fbd3a96206610 100644 (file)
@@ -9,16 +9,16 @@
 #include "group-interface.hh"
 #include "score-element.hh"
 
-Group_interface::Group_interface (Score_element* e)
+Group_interface::Group_interface (Score_element const* e)
 {
-  elt_l_ = e;
+  elt_l_ = (Score_element*)e;
   name_ = "elements";
 }
 
 
-Group_interface::Group_interface (Score_element *e, String s)
+Group_interface::Group_interface (Score_element const *e, String s)
 {
-  elt_l_ =e;
+  elt_l_ =(Score_element*)e;
   name_ = s;
 } 
 bool
@@ -40,7 +40,7 @@ Group_interface::add_element (Score_element*p)
 int
 Group_interface::count ()
 {
-  return scm_ilength (elt_l_->get_elt_property ("name"));
+  return scm_ilength (elt_l_->get_elt_property (name_));
 }
 
 void
index 411ab3670d48d366d7b02a80532965cd31d0d08e..ebb02d18d471c8925277c8bb043461246c837505 100644 (file)
@@ -35,7 +35,7 @@ Hyphen_spanner::do_brew_molecule_p () const
 {
   Molecule* mol_p = new Molecule;
 
-  Real w = extent (X_AXIS).length ();
+  Real w = spanner_length ();
 
   w += (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]);
 
index d2ea0b96ea885cfc22073919e0cbd5d7e02245c2..270bcdb03e2b4c91dd2e8ddf79eef9d304181938 100644 (file)
@@ -19,8 +19,6 @@
   */
 class Axis_group_element : public virtual Score_element
 {
-  Link_array<Score_element> extra_elems_;
-
   /// modify fields of E for removal.
   void do_remove (Score_element*e);
   void purge_extra ();
@@ -38,7 +36,6 @@ protected:
 public:
   // keep array in order.
   bool ordered_b_;             
-  Link_array<Score_element> elem_l_arr_;
   Axis axes_[2];
     
   Interval my_extent (Axis) const;
index c0d51b35aad384d16a53d3304063f3f2ebe1ff35..a1ee164ff0f007d8f93450bcde79ae9991233fbe 100644 (file)
@@ -14,7 +14,7 @@
 #include "tuple.hh"
 
 
-typedef Tuple<Note_column*, Real> Shift_tup;
+typedef Tuple<Score_element*, Real> Shift_tup;
 
 /**
   Resolve conflicts between various Note_columns (chords).
@@ -29,10 +29,8 @@ protected:
   Array<Shift_tup> automatic_shift ();
   Array<Shift_tup> forced_shift ();
   
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
   virtual void do_pre_processing();
 public:
-  Link_array<Note_column> clash_l_arr_;
     
   void add_column (Note_column*ncol_l);
   Collision();
index 3562441c8ae758b93798a1be498db97980a20b36..0389f516858e93c99f2b8c81fdc23b38f83c4c84 100644 (file)
  */
 class Dot_column : public Axis_group_item, public Note_head_side
 {
-  Link_array<Dots> dot_l_arr_;
   static int compare (Dots * const&,Dots * const&);
+  void add_dots (Dots*);
 public:
   VIRTUAL_COPY_CONS (Score_element);
   void add_head (Rhythmic_head*);
-  void add_dots (Dots*);
   Dot_column ();
 
 protected:
-
-  virtual void do_pre_processing ();
   virtual void do_post_processing ();
-  virtual void do_substitute_element_pointer (Score_element *o, Score_element*n);
 };
 #endif // DOT_COLUMN_HH
diff --git a/lily/include/graphical-axis-group.hh b/lily/include/graphical-axis-group.hh
deleted file mode 100644 (file)
index e69de29..0000000
index 06c20b10a398aee31360aa326bbb0c18e940aebe..289ba913ba4ff236f8f6d2917549e19d1ecb3fea 100644 (file)
@@ -20,8 +20,8 @@ struct Group_interface
   Score_element * elt_l_;
   String name_;
 public:
-  Group_interface (Score_element*);
-  Group_interface (Score_element*, String);
+  Group_interface (Score_element const*);
+  Group_interface (Score_element const*, String);
   int count ();
   bool supports_interface_b ();
   void set_interface ();
@@ -34,7 +34,7 @@ public:
 */
 template<class T>
 Link_array<T>
-Group_interface__extract_elements (Score_element *elt, T *, String name)
+Group_interface__extract_elements (Score_element const *elt, T *, String name)
 {
   Link_array<T> arr;
 
index 45fc8dddce74e2697269a2ccca41f5de520a38bd..23cea928fdbde82d662ec18b54995f863cdaf8dd 100644 (file)
@@ -20,8 +20,6 @@ public:
   int measures_i_;
   void add_column (Item*);
 
-  Link_array<Item> column_arr_;
-
 protected:
   virtual Molecule *do_brew_molecule_p () const;
   VIRTUAL_COPY_CONS (Score_element);
@@ -30,7 +28,6 @@ protected:
   virtual void do_post_processing ();
   virtual void do_print () const;
   virtual Array<Rod> get_rods () const;
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
 };
 
 #endif /* MULTI_MEASURE_REST_HH */
index e8fe19a0b170665eb7620790edc395a5764e5dbd..1738e427e2aa3d76298f2e72aa1ed0da591a23a4 100644 (file)
@@ -18,8 +18,6 @@
 class Note_column : public Axis_group_item {
 protected:
   virtual void do_post_processing () ;
-  virtual void do_print () const;
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
 public:
 
   static int shift_compare (Note_column *const &, Note_column*const&);
@@ -30,22 +28,21 @@ public:
     JUNKME.
     */
   Direction dir () const;
-  Stem* stem_l_;
 
-  Link_array<Note_head> head_l_arr_;
-  Link_array<Rest> rest_l_arr_;
 
   Interval_t<int> head_positions_interval() const;
   //  Interval width () const;
 
   void translate_rests(int dy);
-  
+  Note_head * first_head ()const;
+  Interval rest_dim ()const ;
   Note_column ();
   void set_stem (Stem*);
   void set_dotcol (Dot_column*);
   void add_head (Rhythmic_head*);
   bool rest_b () const;
-  void sort ();
+
+  Stem *stem_l()const;
 };
 
 #endif // NOTE_COLUMN_HH
index 2e1150d6511a427dbe0a4876334503951bd03bf7..e500c2aa12f39f9e84e057c0ad94950083756656 100644 (file)
 #include "item.hh"
 
 class Rest_collision : public Item {
-    Link_array<Note_column> rest_l_arr_;
-    Link_array<Note_column> ncol_l_arr_;
 public:
-    void add_column (Note_column*);
+  void add_column (Note_column*);
+  Interval rest_dim () const;
     
-    Rest_collision();
+  Rest_collision();
 protected:
-    virtual void do_pre_processing();
-    virtual void do_print() const;
-    virtual void do_substitute_element_pointer (Score_element*,Score_element*);
+  virtual void do_pre_processing();
 };
 #endif // REST_COLLISION_HH
index 39b6bb2b203c0cfc213a74eddb7b67128780ced1..86147896843ee851a365049624fc350783e02933 100644 (file)
@@ -15,7 +15,7 @@
 class  Rest : public Rhythmic_head
 {
 public:
-  void add_dots (Dots*);
+
 protected:
   virtual void do_add_processing ();
   virtual void do_post_processing ();
index 25d63ecd14260d568026380171925c59fb19c6e4..58063bd501bf49288c4ec491ce411899c6dfac78 100644 (file)
 
 class Rhythmic_head : public Item, public Staff_symbol_referencer
 {
-public:
-  Stem * stem_l_;
   Dots * dots_l_;
-    int balltype_i_;
+  Stem * stem_l_;
+public:
+
+  int balltype_i_;
 
   void add_dots (Dots *);
   Rhythmic_head ();
-
+  Stem * stem_l ()const;
+  Dots * dots_l ()const;
   int dots_i ()const;
 protected:
   virtual void do_post_processing ();
 
   virtual void do_print () const;
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
 };
 
 #endif // RHYTHMIC_HEAD_HH
index ed4bc4ba8de1bd422b5c6aca39c30864857647d3..f5a26a030f5a8c63ccd191c0378394c1a2113d19 100644 (file)
@@ -82,8 +82,6 @@ public:
 
   void add_processing ();
 
-  void substitute_dependency (Score_element*,Score_element*);
-  void remove_dependency (Score_element*);
   /**
     add a dependency. It may be the 0 pointer, in which case, it is ignored.
     */
@@ -103,6 +101,8 @@ public:
   void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr);
 
   static SCM handle_broken_smobs (SCM, SCM criterion);
+  void recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)());
+
 
   virtual Score_element *find_broken_piece (Line_of_score*) const;
 protected:
@@ -134,7 +134,6 @@ protected:
   /// do calculations after determining horizontal spacing
   virtual void do_post_processing ();
     
-  virtual void do_substitute_element_pointer (Score_element * , Score_element *);
   virtual void do_break_processing ();
 
   virtual Link_array<Score_element> get_extra_dependencies () const;
@@ -188,6 +187,7 @@ public:
   void fixup_refpoint ();
 };
 
+Score_element * unsmob_element (SCM);
 
 
 
index 366a4f7f188b7bfdd7d70dfa89c746510ded20a2..4f6e2bca81daedf0a370ead98a2d97a79165e2ad 100644 (file)
 
 class Script_column : public Item
 {
-  /**
-     Array of objects that are placed by staffsides
-   */
-  Link_array<Item> staff_sided_item_l_arr_;
 public:
+  Script_column();
   void add_staff_sided (Item*);
 protected:
   virtual void do_pre_processing ();
index 2fb4b5ede408b624dfc1a1564871347899ae8eed..4bc355db512ea6f8117e7fe9205deaab8fc4da39 100644 (file)
@@ -23,8 +23,6 @@ public:
 
   void add_column (Note_column*);
 
-  Link_array<Note_column> encompass_arr_;
-
 protected:
   virtual Array<Offset> get_encompass_offset_arr () const;
 
@@ -32,7 +30,6 @@ protected:
   virtual void do_post_processing ();
   virtual void do_add_processing ();
   virtual void do_pre_processing ();
-  virtual void do_substitute_element_pointer (Score_element*, Score_element*);
   Array<Rod> get_rods () const;
 };
 
index dad0191da4f11cc47845f05dedc32f249407b6c9..6d6e01c1a2ee12c3e49cf2b853a08e3984160703 100644 (file)
@@ -23,7 +23,6 @@
 */
 class Span_bar : public Bar
 {
-  Link_array<Score_element> spanning_l_arr_;
   Interval get_spanned_interval () const;
 public:
   Span_bar();
@@ -39,7 +38,6 @@ protected:
   
   virtual void do_pre_processing();
   virtual void do_post_processing();
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
   virtual Molecule * do_brew_molecule_p() const;
 };
 
index 10dd3b5e5267c0345943f431f65365abc10d5dc4..7e649c96ec2aa6fc9cfdc0c5352829988f4d6186 100644 (file)
@@ -36,7 +36,6 @@ protected:
   virtual Direction get_default_direction ()const;
   virtual void do_pre_processing ();
   virtual void do_post_processing ();
-  virtual void do_substitute_element_pointer (Score_element*o,Score_element*e);
 };
 
 #endif /* Stem_STAFF_SIDE_HH */
index 9fad0e51db1af3e1d304d69095682324bd8f14a7..3f1b58356509d247391b933616c4fd22af0ad9da 100644 (file)
@@ -53,8 +53,6 @@ class Stem : public Item, public Staff_symbol_referencer,
 
 public:
 
-  Link_array<Note_head> head_l_arr_;
-  Link_array<Rest> rest_l_arr_;
     
   /// log of the duration. Eg. 4 -> 16th note -> 2 flags
   int flag_i_;
@@ -64,6 +62,7 @@ public:
     our beam, for aligning abbrev flags
    */
   Beam* beam_l () const;
+  Note_head * first_head () const;
 
   Drul_array<int> beams_i_drul_;
   Stem ();
@@ -98,7 +97,7 @@ public:
 
 protected:
   Molecule flag () const;
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
+
   virtual void do_pre_processing();
   static Interval dim_callback (Dimension_cache const*);
   virtual Molecule* do_brew_molecule_p() const;
index cb6eb72ebf046234b4e72cb03ee0b6587db00f55..a89088ab8a451edfc90105e4d6d909d80e1ebe16 100644 (file)
@@ -23,12 +23,12 @@ public:
   void set_head (Direction, Note_head*head_l);
   VIRTUAL_COPY_CONS(Score_element);
 
-  Drul_array<Note_head *> head_l_drul_;
+  Note_head* head (Direction) const;
 protected:
   virtual void do_add_processing ();
   virtual void do_post_processing ();
   virtual Direction get_default_dir() const;
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
+
   virtual Array<Rod> get_rods () const;
 
   Array<Offset> get_controls () const;
index 2faa3bcd489d1ccb2d97c09eda9eda6f0c616c25..2fd0a5ff16efd2660d1edd9acfc81ab673682179 100644 (file)
@@ -31,15 +31,11 @@ public:
   bool parallel_beam_b_;
   
 protected:
-  Link_array<Beam> beam_l_arr_;
-  Link_array<Note_column> column_arr_;
-
   virtual Molecule* do_brew_molecule_p () const;
   VIRTUAL_COPY_CONS(Score_element);
   virtual void do_add_processing ();
   virtual void do_post_processing ();
   virtual Direction get_default_dir () const;
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
 };
 
 #endif // Tuplet_spanner_HH
index e3f30af740a1464617a72abba111658de7ae3a25..0ef810209f0a202c7ad5459989618aa1c9c9f446 100644 (file)
@@ -22,8 +22,6 @@ public:
   void add_bar (Bar*);
  
   String number_str_;
-  Link_array<Bar> bar_arr_;
-  Link_array<Note_column> note_column_arr_;
   bool last_b_;
 
  
@@ -34,7 +32,6 @@ protected:
   virtual void do_add_processing ();
   static  Interval dim_callback (Dimension_cache const*);
   virtual void do_post_processing ();
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
 };
 
 #endif // VOLTA_SPANNER_HH
index 283010a4bde992141dd54c282aab2d2c64a37ede..fc082e41669cb1e3d2c611e0ecc7090a9bc2b752 100644 (file)
@@ -188,47 +188,6 @@ Item::Item (Item const &s)
   broken_to_drul_[LEFT] = broken_to_drul_[RIGHT] =0;
 }
 
-#if 0
-void
-Item::handle_prebroken_dependents ()
-{
-  Item * parent =  dynamic_cast<Item*> (parent_l (X_AXIS));
-  if (breakable_b () && parent)
-    {
-       if(!(broken_to_drul_[LEFT] || broken_to_drul_[RIGHT]))
-       do_break ();
-
-      Direction d = LEFT;
-      do
-       {
-         Item * broken_self = find_broken_piece (d);
-         Item * broken_parent = parent->find_broken_piece (d);
-
-         broken_self->set_parent (broken_parent, X_AXIS);
-
-         /*
-           ugh. Should do this is after breaking?
-          */
-         if (!broken_self->parent_l (Y_AXIS))
-           {
-             Score_element * yparent =dynamic_cast<Score_element*>(parent_l (Y_AXIS));
-             Item *yparenti = dynamic_cast<Item*> (yparent);
-             Item *broken_yparent = yparenti ?
-               yparenti->find_broken_piece (d) : 0;
-             
-             if (!yparent)
-               programming_error ("Vertical refpoint lost!");
-             else if (yparenti)
-               {
-                 broken_self->set_parent (broken_yparent, Y_AXIS);
-               }
-           }
-       }
-      while ((flip (&d))!=LEFT);
-    }
-}
-#endif
-
 Direction
 Item::break_status_dir () const
 {
index 8d004831cd95e0da6b9a026dbbf22809cb1aebee..5fb4931a2a0fbb1bb3dbc21efb8f410211726bf7 100644 (file)
@@ -17,6 +17,7 @@
 
 Line_of_score::Line_of_score()
 {
+  set_elt_property ("columns", SCM_EOL);
   set_axes (Y_AXIS,X_AXIS);
 }
 
@@ -51,8 +52,8 @@ Line_of_score::break_into_pieces (Array<Column_x_positions> const &breaking)
       line_l->set_bounds(RIGHT,c.top ());
       for (int j=0; j < c.size(); j++)
        {
-         c[i]->translate_axis (breaking[i].config_[j],X_AXIS);
-         c[i]->line_l_ = line_l;
+         c[j]->translate_axis (breaking[i].config_[j],X_AXIS);
+         c[j]->line_l_ = line_l;
        }
       
       broken_into_l_arr_.push (line_l);
index a78a19b681f1ff3e090209881c009106155bc51c..beff1c9148d828b4e398b7f04247a422a110aac1 100644 (file)
@@ -166,7 +166,7 @@ Local_key_engraver::acknowledge_element (Score_element_info info)
     }
  else if (Tie * tie_l = dynamic_cast<Tie *> (info.elem_l_))
     {
-      tied_l_arr_.push (tie_l-> head_l_drul_[RIGHT]);
+      tied_l_arr_.push (tie_l->head (RIGHT));
     }
 }
 
index cd6efa31723b2ed8875264042e9daaeb850e510e..609cf8c72058ec5d5d0026f2a6dc108215ed03b4 100644 (file)
@@ -95,7 +95,7 @@ Multi_measure_rest_engraver::do_pre_move_processing ()
 
   if (mmrest_p_ && (now >= rest_moments_[START]) 
     && !time->measure_position ()
-    && (mmrest_p_->column_arr_.size () >= 2))
+    && (scm_ilength (mmrest_p_->get_elt_property ("columns")) >= 2))
     {
       typeset_element (mmrest_p_);
       /*
index 8dbfec3c8329999f7620f1c443c583c040d1ac49..d69333940f1c66f4d68ccfe3ff60c25a06d9c75c 100644 (file)
 #include "rest.hh"
 #include "molecule.hh"
 #include "misc.hh"
-
+#include "group-interface.hh"
+#include "stem.hh"
 
 Multi_measure_rest::Multi_measure_rest ()
 {
   measures_i_ = 0;
+  set_elt_property ("columns", SCM_EOL);
 }
 
 void
@@ -99,7 +101,7 @@ Multi_measure_rest::do_brew_molecule_p () const
     }
   else if (measures_i_ > 1)
     {
-      Molecule s ( lookup_l ()->text ("number", to_str (measures_i_), paper_l ()));
+      Molecule s (lookup_l ()->text ("number", to_str (measures_i_), paper_l ()));
       s.align_to (X_AXIS, CENTER);
       s.translate_axis (3.0 * interline_f, Y_AXIS);
       mol_p->add_molecule (s);
@@ -108,36 +110,38 @@ Multi_measure_rest::do_brew_molecule_p () const
   return mol_p;
 }
 
+/*
+  UGH. JUNKME elt prop "columns" isn't really needed. 
+ */
+
 void
 Multi_measure_rest::do_add_processing ()
 {
-  if (column_arr_.size ())
+  if (gh_pair_p (get_elt_property ("columns")))
     {
-      set_bounds (LEFT, column_arr_[0 >? column_arr_.size () - 2]);
-      set_bounds (RIGHT, column_arr_[column_arr_.size () - 1]);
+      Link_array<Item> column_arr (Group_interface__extract_elements (this, (Item*)0, "columns"));
+                                   
+      set_bounds (LEFT, column_arr[0 >? column_arr.size () - 2]);
+      set_bounds (RIGHT, column_arr.top ());
     }
 }
   
 void
 Multi_measure_rest::do_post_processing ()
 {
-  if (!column_arr_.size ())
+  if (!gh_pair_p (get_elt_property ("columns")))
     set_elt_property ("transparent", SCM_BOOL_T);
 }
 
 
-void
-Multi_measure_rest::do_substitute_element_pointer (Score_element* o, Score_element* n)
-{
-  Staff_symbol_referencer::do_substitute_element_pointer (o,n);
-  if (Item* c = dynamic_cast <Item*> (o))
-    column_arr_.substitute (c, dynamic_cast<Item*> (n));
-}
-  
 void
 Multi_measure_rest::add_column (Item* c)
 {
-  column_arr_.push (c);
+  Group_interface gi (this, "columns");
+  gi.add_element (c);
+
+  
   add_dependency (c);
 }
 
index 844ad7701ad6e00371ecaf5e80487046c843e630..21740f4513ccd9a02707d047e05ad84760a362bc 100644 (file)
 #include "rest.hh"
 #include "debug.hh"
 #include "paper-def.hh"
+#include "group-interface.hh"
 
 bool
 Note_column::rest_b () const
 {
-  return rest_l_arr_.size ();
+  SCM r = get_elt_property ("rests");
+
+  return gh_pair_p (r);
 }
 
 int
@@ -33,15 +36,19 @@ Note_column::shift_compare (Note_column *const &p1, Note_column*const&p2)
 
 Note_column::Note_column()
 {
+  set_elt_property ("rests", SCM_EOL);
+  set_elt_property ("note-heads", SCM_EOL);  
   set_axes (X_AXIS, Y_AXIS);
-  stem_l_ = 0;
 }
 
-void
-Note_column::sort()
+Stem *
+Note_column::stem_l () const
 {
-  head_l_arr_.sort (Note_head::compare);
+  SCM s = get_elt_property ("stem");
+  return dynamic_cast<Stem*> (unsmob_element (s));
+
 }
+
   
 Slice
 Note_column::head_positions_interval() const
@@ -49,9 +56,13 @@ Note_column::head_positions_interval() const
   Slice  iv;
 
   iv.set_empty ();
-  for (int i=0; i <head_l_arr_.size ();i ++)
+
+  SCM h = get_elt_property ("note-heads");
+  for (; gh_pair_p (h); h = gh_cdr (h))
     {
-      int j = int (head_l_arr_[i]->position_f ());
+      Score_element *se = unsmob_element (gh_car (h));
+      
+      int j = int (dynamic_cast<Staff_symbol_referencer*> (se)->position_f ());
       iv.unite (Slice (j,j));
     }
   return iv;
@@ -60,9 +71,9 @@ Note_column::head_positions_interval() const
 Direction
 Note_column::dir () const
 {
-  if (stem_l_)
-    return stem_l_->get_direction ();
-  else if (head_l_arr_.size ())
+  if (stem_l ())
+    return stem_l ()->get_direction ();
+  else if (gh_pair_p (get_elt_property ("note-heads")))
     return (Direction)sign (head_positions_interval().center ());
 
   programming_error ("Note column without heads and stem!");
@@ -73,42 +84,26 @@ Note_column::dir () const
 void
 Note_column::set_stem (Stem * stem_l)
 {
-  stem_l_ = stem_l;
+  set_elt_property ("stem", stem_l->self_scm_);
+
   add_dependency (stem_l);
   add_element (stem_l);
 }
 
 
-void
-Note_column::do_substitute_element_pointer (Score_element*o, Score_element*n)
-{
-  if (stem_l_ == o) 
-    {
-      stem_l_ = n ? dynamic_cast<Stem *> (n):0;
-    }
-  if (dynamic_cast<Note_head *> (o))
-    {
-      head_l_arr_.substitute (dynamic_cast<Note_head *> (o), 
-                             (n)? dynamic_cast<Note_head *> (n) : 0);
-    }
-
-  if (dynamic_cast<Rest *> (o)) 
-    {
-      rest_l_arr_.substitute (dynamic_cast<Rest *> (o), 
-                             (n)? dynamic_cast<Rest *> (n) : 0);
-    }
-}
 
 void
 Note_column::add_head (Rhythmic_head *h)
 {
   if (Rest*r=dynamic_cast<Rest *> (h))
     {
-      rest_l_arr_.push (r);
+      Group_interface gi (this, "rests");
+      gi.add_element (h);
     }
   if (Note_head *nh=dynamic_cast<Note_head *> (h))
     {
-      head_l_arr_.push (nh);
+      Group_interface gi (this, "note-heads");
+      gi.add_element (nh);
     }
   add_element (h);
 }
@@ -120,20 +115,17 @@ void
 Note_column::translate_rests (int dy_i)
 {
   invalidate_cache (Y_AXIS);
-  for (int i=0; i < rest_l_arr_.size(); i++)
-    rest_l_arr_[i]->translate_axis (dy_i  * rest_l_arr_[i]->staff_line_leading_f ()/2.0,
-                                   Y_AXIS);
-}
 
-void
-Note_column::do_print() const
-{
-#ifndef NPRINT
-  DEBUG_OUT << "rests: " << rest_l_arr_.size() << ", ";
-  DEBUG_OUT << "heads: " << head_l_arr_.size();
-#endif
+  SCM s = get_elt_property ("rests");
+  for (; gh_pair_p (s); s = gh_cdr (s))
+    {
+      Score_element * se = unsmob_element ( gh_car (s));
+      Staff_symbol_referencer *str = dynamic_cast<Staff_symbol_referencer*> (se);
+      se->translate_axis (dy_i * str->staff_line_leading_f ()/2.0, Y_AXIS);
+    }
 }
 
+
 void
 Note_column::set_dotcol (Dot_column *d)
 {
@@ -154,18 +146,22 @@ Note_column::set_dotcol (Dot_column *d)
 void
 Note_column::do_post_processing ()
 {
-  if (!stem_l_ || !rest_b ())
+  if (!stem_l () || !rest_b ())
     return;
 
-  Beam * b = stem_l_->beam_l ();
+  Beam * b = stem_l ()->beam_l ();
   if (!b || !b->stem_count ())
     return;
   
   /* ugh. Should be done by beam. */
-  Direction d = stem_l_->get_direction ();
-  Real beamy = (stem_l_->hpos_f () - b->stem(0)->hpos_f ()) * b->slope_f_ + b->left_y_;
+  Direction d = stem_l ()->get_direction ();
+  Real beamy = (stem_l ()->hpos_f () - b->stem(0)->hpos_f ()) * b->slope_f_ + b->left_y_;
+
+  SCM s = get_elt_property ("rests");
+  Score_element * se = unsmob_element (gh_car (s));
+  Staff_symbol_referencer *str = dynamic_cast<Staff_symbol_referencer*> (se);
 
-  Real staff_space = rest_l_arr_[0]->staff_line_leading_f ();      
+  Real staff_space = str->staff_line_leading_f ();      
   Real rest_dim = extent (Y_AXIS)[d]*2.0  /staff_space ;
 
   Real minimum_dist
@@ -173,7 +169,7 @@ Note_column::do_post_processing ()
   Real dist =
     minimum_dist +  -d  * (beamy - rest_dim) >? 0;
 
-  int stafflines = rest_l_arr_[0]->lines_i ();
+  int stafflines = str->lines_i ();
 
   // move discretely by half spaces.
   int discrete_dist = int (ceil (dist ));
@@ -185,3 +181,25 @@ Note_column::do_post_processing ()
   translate_rests (-d *  discrete_dist);
 }
 
+
+Interval
+Note_column::rest_dim () const
+{
+  Interval restdim;
+  SCM s = get_elt_property ("rests");
+  for (; gh_pair_p (s); s = gh_cdr (s))
+    {
+      Score_element * sc = unsmob_element ( gh_car (s));
+      restdim.unite (sc->extent (Y_AXIS));
+    }
+  
+  return restdim;
+}
+
+Note_head*
+Note_column::first_head () const
+{
+  Stem * st = stem_l ();
+  return st?  st->first_head (): 0; 
+
+}
index 4a631d05153d78eb10450f47c464c441a9ece1bb..17bc7d6b30ff0555b069aba9db3a41141121afb3 100644 (file)
@@ -13,7 +13,6 @@
 #include "lookup.hh"
 #include "molecule.hh"
 #include "musical-request.hh"
-#include "stem.hh"
 #include "dimension-cache.hh"
 
 void
@@ -52,8 +51,8 @@ Note_head::do_pre_processing ()
   if (balltype_i_ > 2 || type == "harmonic" || type == "cross")
     balltype_i_ = 2;
 
-  if (dots_l_)                 // move into Rhythmic_head?
-    dots_l_->set_position(int (position_f ()));
+  if (dots_l ())                       // move into Rhythmic_head?
+    dots_l ()->set_position(int (position_f ()));
 
  
 }
index 1f817347bf72e4ea0895cd2a0c1aacb2159118bc..c1bfea9317267b6349d6ed925e095b257fe1c8a6 100644 (file)
@@ -68,7 +68,7 @@ Note_heads_engraver::do_process_requests()
       if (note_req_l->duration_.dots_i_)
        {
          Dots * d = new Dots;
-         note_p->dots_l_ = d;
+         note_p->add_dots (d);
          d->dots_i_ = note_req_l->duration_.dots_i_;
          announce_element (Score_element_info (d,0));
          dot_p_arr_.push (d);
index 4a78ff3fb358ac223fdba3768a61cfd7c32af234..960dffd675026835608966d97bbbfb2fa1a9776a 100644 (file)
@@ -213,7 +213,7 @@ Paper_score::fixup_refpoints ()
       SCM e = gh_car (s);
       if (SMOB_IS_TYPE_B(Score_element, e))
        {
-         Score_element * se = SMOB_TO_TYPE (Score_element,e );
+         Score_element * se = unsmob_element (e);
          se->fixup_refpoint ();
        }
     }
index 0b065747bb058f301a988e5fc00354e0ddead3f7..8dd85f8a4b9283132859453fc5ff5fa668a23076 100644 (file)
 #include "collision.hh"
 #include "paper-def.hh"
 #include "rest.hh"
+#include "group-interface.hh"
 
 void
 Rest_collision::add_column (Note_column *nc_l)
 {
   add_dependency (nc_l);
+  Group_interface gi (this);  
   if (nc_l->rest_b ())
-    rest_l_arr_.push (nc_l);
+    gi.name_ = "rests";
   else
-    ncol_l_arr_.push (nc_l);
+    gi.name_ = "notes";
+  
+  gi.add_element (nc_l);
 }
 
 void
 Rest_collision::do_pre_processing()
 {
+  Link_array<Note_column> rest_l_arr =
+    Group_interface__extract_elements (this, (Note_column*) 0, "rests");
+  Link_array<Note_column> ncol_l_arr =
+    Group_interface__extract_elements (this, (Note_column*) 0, "notes");
+                                     
+  
   /* 
      handle rest-rest and rest-note collisions
 
@@ -38,49 +48,50 @@ Rest_collision::do_pre_processing()
    */
 
   // no rests to collide
-  if (!rest_l_arr_.size())
+  if (!rest_l_arr.size())
     return;
 
   // no partners to collide with
-  if (rest_l_arr_.size() + ncol_l_arr_.size () < 2)
+  if (rest_l_arr.size() + ncol_l_arr.size () < 2)
     return;
 
   // meisjes met meisjes
-  if (!ncol_l_arr_.size()) 
+  if (!ncol_l_arr.size()) 
     {
       /*
        UGH.  Should get dims from table.  Should have minimum dist.
        */
-      int dy = rest_l_arr_.size() > 2 ? 6 : 4;
+      int dy = rest_l_arr.size() > 2 ? 6 : 4;
        
-      rest_l_arr_[0]->translate_rests (rest_l_arr_[0]->dir () *dy);    
-      rest_l_arr_.top()->translate_rests (rest_l_arr_.top ()->dir ()* dy);
+      rest_l_arr[0]->translate_rests (rest_l_arr[0]->dir () *dy);      
+      rest_l_arr.top()->translate_rests (rest_l_arr.top ()->dir ()* dy);
     }
   // meisjes met jongetjes
   else 
     {
-      if (rest_l_arr_.size () > 1)
+      if (rest_l_arr.size () > 1)
        {
          warning (_("too many colliding rests"));
        }
-      if (ncol_l_arr_.size () > 1)
+      if (ncol_l_arr.size () > 1)
        {
          warning (_("too many notes for rest collision"));
        }
-      Note_column * rcol = rest_l_arr_[0];
+      Note_column * rcol = rest_l_arr[0];
 
       // try to be opposite of noteheads. 
-      Direction dir = - ncol_l_arr_[0]->dir();
-
-      Interval restdim;
-      for (int i=0; i < rcol->rest_l_arr_.size(); i++)
-       restdim.unite (rcol->rest_l_arr_[i]->extent (Y_AXIS));
+      Direction dir = - ncol_l_arr[0]->dir();
 
+      Interval restdim = rcol->rest_dim ();
       if (restdim.empty_b ())
        return;
       
       // staff ref'd?
-      Real staff_space = rcol->rest_l_arr_[0]->staff_line_leading_f ();      
+      Real staff_space = paper_l()->get_var ("interline");
+
+       /* FIXME
+         staff_space =  rcol->rest_l_arr[0]->staff_line_leading_f ();
+       */
       Real internote_f = staff_space/2;
       Real minimum_dist = paper_l ()->get_var ("restcollision_minimum_dist")
        * internote_f;
@@ -89,9 +100,9 @@ Rest_collision::do_pre_processing()
        assumption: ref points are the same. 
        */
       Interval notedim;
-      for (int i = 0; i < ncol_l_arr_.size(); i++) 
+      for (int i = 0; i < ncol_l_arr.size(); i++) 
        {
-         notedim.unite (ncol_l_arr_[i]->extent (Y_AXIS));
+         notedim.unite (ncol_l_arr[i]->extent (Y_AXIS));
        }
 
       Interval inter (notedim);
@@ -101,7 +112,8 @@ Rest_collision::do_pre_processing()
        minimum_dist +  dir * (notedim[dir] - restdim[-dir]) >? 0;
 
 
-      int stafflines = rcol->rest_l_arr_[0]->lines_i ();
+      // FIXME
+      int stafflines = 5; // rcol->rest_l_arr[0]->lines_i ();
 
       
       // move discretely by half spaces.
@@ -115,28 +127,11 @@ Rest_collision::do_pre_processing()
     }
 }
 
-void
-Rest_collision::do_print() const
-{
-#ifndef NPRINT
-  DEBUG_OUT << "rests: " << rest_l_arr_.size() << ", ";
-  DEBUG_OUT << "cols: " << ncol_l_arr_.size();
-#endif
-}
-
-void
-Rest_collision::do_substitute_element_pointer (Score_element*o,Score_element*n)
-{
-  if (Note_column *onl = dynamic_cast<Note_column *> (o))
-    {
-      Note_column *n_l = n?dynamic_cast<Note_column *> (n):0;
-      rest_l_arr_.substitute (onl, n_l);
-      ncol_l_arr_.substitute (onl, n_l);
-    }
-}
 
 Rest_collision::Rest_collision()
 {
+  set_elt_property ("rests", SCM_EOL);
+  set_elt_property ("notes", SCM_EOL);
   set_elt_property ("transparent", SCM_BOOL_T);
   set_empty (X_AXIS);
   set_empty (Y_AXIS);
index dde03daa1c844476d32ebdc6dcd2a5126874692c..93b182591f0e21391cc8a62be7701205b02d9dc7 100644 (file)
@@ -52,7 +52,7 @@ Rest_engraver::do_process_requests ()
       if (rest_req_l_->duration_.dots_i_)
        {
          dot_p_ = new Dots;
-         rest_p_->dots_l_  =dot_p_;
+         rest_p_->add_dots (dot_p_);
          dot_p_->dots_i_ = rest_req_l_->duration_.dots_i_;       
          announce_element (Score_element_info (dot_p_,0));
        }
index fbfbdb5ff1fe3b6a3c46c88fe4463479866d3f7e..10455405f886898c89a4b66b527a410fa0a5c0ab 100644 (file)
@@ -1,5 +1,5 @@
 /*
 rest.cc -- implement Rest
+ rest.cc -- implement Rest
 
   source file of the GNU LilyPond music typesetter
 
@@ -27,16 +27,16 @@ void
 Rest::do_post_processing ()
 {
   Rhythmic_head::do_post_processing ();
-  if (dots_l_
+  if (dots_l ()
       && balltype_i_ > 4) // UGH.
     {
       /*
        UGH. 
        */
       if (balltype_i_ == 7)
-       dots_l_->set_position (4);
+       dots_l ()->set_position (4);
       else
-       dots_l_->set_position (3);
+       dots_l ()->set_position (3);
     }
 }
 
index 0698b0c3cf2578626f19e5926c92ad06fff8d5db..171c93cb7b9f6071efe13bfb896bf9441acb2388 100644 (file)
 #include "stem.hh"
 
 
+Dots*
+Rhythmic_head::dots_l () const
+{
+  SCM s = get_elt_property ("dot");
+  return dynamic_cast<Dots*> (unsmob_element (s));
+}
+
+Stem*
+Rhythmic_head::stem_l () const
+{
+  SCM s = get_elt_property ("stem");
+  return dynamic_cast<Stem*> (unsmob_element (s));
+}
 
 int
 Rhythmic_head::dots_i () const
 {
-  return dots_l_ ? dots_l_->dots_i_ : 0;
+  return dots_l () ? dots_l ()->dots_i_ : 0;
 }
   
 void
 Rhythmic_head::do_post_processing ()
 {
-  if (dots_l_)
+  if (dots_l ())
     {
-      dots_l_->set_position(int (position_f ()));
+      dots_l ()->set_position(int (position_f ()));
     }
 }
 
@@ -38,26 +51,15 @@ Rhythmic_head::do_post_processing ()
 void
 Rhythmic_head::add_dots (Dots *dot_l)
 {
-  dots_l_ = dot_l;  
+  set_elt_property ("dot", dot_l->self_scm_);
   dot_l->add_dependency (this);  
 }
 
 Rhythmic_head::Rhythmic_head ()
 {
-  dots_l_ =0;
   balltype_i_ =0;
-  stem_l_ =0;
 }
 
-void
-Rhythmic_head::do_substitute_element_pointer (Score_element*o,Score_element*n)
-{
-  Staff_symbol_referencer::do_substitute_element_pointer (o,n);
-  if (o == dots_l_)
-    dots_l_ = dynamic_cast<Dots *> (n) ;
-  else if (o == stem_l_)
-    stem_l_ = dynamic_cast<Stem*>(n);
-}
 
 
 void
index e8b5154c81c7c48ee3eaba945cafd1c9f71e626f..45fbc03ed65605525260fa310fbd28d9ff24cda3 100644 (file)
@@ -85,8 +85,6 @@ Score_element::Score_element (Score_element const&s)
   pscore_l_ = s.pscore_l_;
 
   smobify_self ();
-
-  
 }
 
 Score_element::~Score_element()
@@ -324,10 +322,6 @@ Score_element::do_add_processing()
 {
 }
 
-void
-Score_element::do_substitute_element_pointer (Score_element*,Score_element*)
-{
-}
 
 
 Molecule*
@@ -358,12 +352,7 @@ Score_element::add_dependency (Score_element*e)
     programming_error ("Null dependency added");
 }
 
-void
-Score_element::substitute_dependency (Score_element* old, Score_element* new_l)
-{
-  do_substitute_element_pointer (old,new_l);
-  old->do_substitute_element_pointer (this, 0);
-}
+
 
 
 /**
@@ -373,10 +362,9 @@ Score_element::substitute_dependency (Score_element* old, Score_element* new_l)
 SCM
 Score_element::handle_broken_smobs (SCM s, SCM criterion)
 {
-  if (SMOB_IS_TYPE_B (Score_element, s))
+  Score_element *sc = unsmob_element ( s);
+  if (sc)
     {
-      Score_element *sc = SMOB_TO_TYPE (Score_element, s);
-
       if (criterion == SCM_UNDEFINED)
        return SCM_UNDEFINED;
       else if (gh_number_p (criterion))
@@ -391,7 +379,7 @@ Score_element::handle_broken_smobs (SCM s, SCM criterion)
        }
       else
        {
-         Score_element * ln = SMOB_TO_TYPE (Score_element, criterion);
+         Score_element * ln = unsmob_element ( criterion);
          Line_of_score * line = dynamic_cast<Line_of_score*> (ln);
          Score_element * br =0;
          Line_of_score * dep_line = sc->line_l ();
@@ -412,18 +400,44 @@ Score_element::handle_broken_smobs (SCM s, SCM criterion)
       gh_set_car_x (s, handle_broken_smobs (gh_car (s), criterion));
       gh_set_cdr_x (s, handle_broken_smobs (gh_cdr (s), criterion));
 
-      if (gh_car (s) == SCM_UNDEFINED)
+      if (gh_car (s) == SCM_UNDEFINED && gh_list_p (gh_cdr(s)))
        return gh_cdr (s);
     }
   return s;
 }
 
+void
+Score_element::recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)())
+{
+  Score_element * sc = unsmob_element ( s);
+  if (sc)
+    {
+      (sc->*meth_ptr) ();
+    }
+  else if (gh_pair_p (s))
+    {
+      recurse_into_smobs (gh_car (s), meth_ptr);
+      recurse_into_smobs (gh_cdr (s), meth_ptr);      
+    }
+}
+
 void
 Score_element::handle_broken_dependencies()
 {
   Line_of_score *line  = line_l();
+  
+  SCM rec = get_elt_property ("handle-broken-deps");
+  if (gh_boolean_p (rec) && gh_scm2bool (rec))
+    return;
+  
+  set_elt_property ("handle-broken-deps", SCM_BOOL_T);
   element_property_alist_ = handle_broken_smobs (element_property_alist_,
                                                 line ? line->self_scm_ : SCM_UNDEFINED);
+
+
+  recurse_into_smobs (element_property_alist_,
+                     &Score_element::handle_broken_dependencies);
+  
   if (!line)
     return;
 
@@ -436,7 +450,6 @@ Score_element::handle_broken_dependencies()
       if (elt->line_l() != line)
        {
          Score_element * broken = elt->find_broken_piece (line);
-         substitute_dependency (elt, broken);
          elt  = broken ;
        }
       if (elt)
@@ -458,49 +471,9 @@ Score_element::handle_prebroken_dependencies()
        = handle_broken_smobs (element_property_alist_,
                               gh_int2scm (i->break_status_dir ()));
     }
-
-  Link_array<Score_element> old_arr, new_arr;
-  
-  for (int i=0; i < dependency_size(); i++) 
-    {
-      Score_element * elt = dependency (i);
-      Item *it_l = dynamic_cast <Item *> (elt);
-      if (it_l && it_l->broken_original_b ())
-       if (Item *me = dynamic_cast<Item*> (this) )
-         {
-           Score_element *new_l = it_l->find_broken_piece (me->break_status_dir ());
-           if (new_l != elt) 
-             {
-               new_arr.push (new_l);
-               old_arr.push (elt);
-             }
-         }
-       else 
-         {
-           Direction d = LEFT;
-           do {
-             old_arr.push (0);
-             new_arr.push (it_l->find_broken_piece (d));
-           } while (flip(&d)!= LEFT);
-         }
-    }
-  
-  for (int i=0;  i < old_arr.size(); i++)
-    if (old_arr[i])
-      substitute_dependency (old_arr[i], new_arr[i]);
 }
 
-#if 0
-void
-Score_element::handle_prebroken_dependents()
-{
-}
 
-void
-Score_element::handle_broken_dependents()
-{
-}
-#endif
 
 
 
@@ -546,21 +519,7 @@ Score_element::print_smob (SCM s, SCM port, scm_print_state *)
      
   scm_puts ("#<Score_element ", port);
   scm_puts ((char *)sc->name (), port);
-#if 0
-  for (SCM s = sc->element_property_alist_; gh_pair_p (s); s = gh_cdr (s))
-    {
-      scm_display (gh_caar(s), port);
-      SCM val = gh_cdar(s);
-      if (SMOB_IS_TYPE_B (Score_element, val))
-       {
-         scm_puts ("#<:", port);
-         scm_puts ((SMOB_TO_TYPE(Score_element,val))->name(), port);
-         scm_puts (">", port);
-       }
-      else
-       scm_display (val, port);      
-    }
-#endif
+
   // scm_puts (" properties = ", port);
   // scm_display (sc->element_property_alist_, port);
   scm_puts (" >", port);
@@ -622,7 +581,14 @@ Score_element::extent (Axis a) const
   return d->get_dim ();
 }
 
-
+Score_element*
+unsmob_element (SCM s)
+{
+  if (SMOB_IS_TYPE_B (Score_element, s))
+    return SMOB_TO_TYPE(Score_element,s);
+  else
+    return 0;
+}
 
 
 /*
index 19983c4f93f3a4936f1a575547408963be3256cb..d9da8bc7894ed639114731250fa01f31c06c0100 100644 (file)
@@ -9,7 +9,7 @@
 #include "script-column.hh"
 #include "staff-side.hh"
 #include "dimension-cache.hh"
-
+#include "group-interface.hh"
 
 void
 Script_column::add_staff_sided (Item *i)
@@ -18,10 +18,18 @@ Script_column::add_staff_sided (Item *i)
   if (p == SCM_UNDEFINED)
     return;
   
-  staff_sided_item_l_arr_.push (i);
+
+  Group_interface gi (this, "scripts");
+  gi.add_element (i);
+  
   add_dependency (i);
 }
 
+Script_column::Script_column ()
+{
+  set_elt_property ("scripts", SCM_EOL);  
+}
+
 static int
 staff_side_compare (Item * const &i1,
                    Item * const &i2)
@@ -36,11 +44,14 @@ void
 Script_column::do_pre_processing ()
 {
   Drul_array<Link_array<Item> > arrs;
-
-  for (int i=0; i < staff_sided_item_l_arr_.size (); i++)
+  Link_array<Item> staff_sided 
+    = Group_interface__extract_elements (this, (Item*)0, "scripts");
+                                    
+                                    
+  for (int i=0; i < staff_sided.size (); i++)
     {
-      Side_position_interface st (staff_sided_item_l_arr_[i]);
-      arrs[st.get_direction ()].push (staff_sided_item_l_arr_[i]);
+      Side_position_interface st (staff_sided[i]);
+      arrs[st.get_direction ()].push (staff_sided[i]);
     }
 
   Direction d = DOWN;
index 4da73f8dbc9811d6e07a32352aa6f4ad0a5950e3..4a3d0ccaa2e98c0eedcb1930c1f704c7057687b5 100644 (file)
@@ -40,17 +40,17 @@ Separating_group_spanner::get_rods () const
   for (SCM s = get_elt_property ("elements"); gh_pair_p (s) && gh_pair_p (gh_cdr (s)); s = gh_cdr (s))
     {
       SCM elt = gh_car (s);
-      if (!SMOB_IS_TYPE_B(Score_element, elt))
-       continue;
-
       SCM next_elt = gh_cadr (s);
-      if (!SMOB_IS_TYPE_B(Score_element, next_elt))
-       continue;
 
-      Single_malt_grouping_item *l = dynamic_cast<Single_malt_grouping_item*> (SMOB_TO_TYPE(Score_element, elt));
+      Single_malt_grouping_item *l = dynamic_cast<Single_malt_grouping_item*> (unsmob_element (elt));
+      Single_malt_grouping_item *r = dynamic_cast<Single_malt_grouping_item*> (unsmob_element ( next_elt));
+
+      if (!r || !l)
+       continue;
+      
       Single_malt_grouping_item *lb
        = dynamic_cast<Single_malt_grouping_item*>(l->find_broken_piece (RIGHT));
-      Single_malt_grouping_item *r = dynamic_cast<Single_malt_grouping_item*> (SMOB_TO_TYPE(Score_element, next_elt));
+
       Single_malt_grouping_item *rb
        = dynamic_cast<Single_malt_grouping_item*>(r->find_broken_piece (LEFT));
       
index 45e74b09df9587345dee79abb935b84ddd19d741..aff1365a279f495c4f5382ee346035b3d1f0734a 100644 (file)
@@ -13,8 +13,8 @@
     * broken slur should have uniform trend
  */
 
+#include "group-interface.hh"
 #include "slur.hh"
-
 #include "lookup.hh"
 #include "paper-def.hh"
 #include "note-column.hh"
 #include "bezier.hh"
 #include "main.hh"
 #include "cross-staff.hh"
+#include "group-interface.hh"
 
 Slur::Slur ()
 {
+  set_elt_property ("note-columns", SCM_EOL);
 }
 
 void
 Slur::add_column (Note_column*n)
 {
-  if (!n->head_l_arr_.size ())
+  if (!gh_pair_p (n->get_elt_property ("note-heads")))
     warning (_ ("Putting slur over rest.  Ignoring."));
   else
     {
-      encompass_arr_.push (n);
+      Group_interface gi (this, "note-columns");
+      gi.add_element (n);
       add_dependency (n);
     }
 }
@@ -46,10 +49,13 @@ Slur::add_column (Note_column*n)
 Direction
 Slur::get_default_dir () const
 {
+  Link_array<Note_column> encompass_arr =
+    Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+  
   Direction d = DOWN;
-  for (int i=0; i < encompass_arr_.size (); i ++) 
+  for (int i=0; i < encompass_arr.size (); i ++) 
     {
-      if (encompass_arr_[i]->dir () < 0) 
+      if (encompass_arr[i]->dir () < 0) 
        {
          d = UP;
          break;
@@ -61,9 +67,11 @@ Slur::get_default_dir () const
 void
 Slur::do_add_processing ()
 {
-  set_bounds (LEFT, encompass_arr_[0]);    
-  if (encompass_arr_.size () > 1)
-    set_bounds (RIGHT, encompass_arr_.top ());
+  Link_array<Note_column> encompass_arr =
+    Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+  set_bounds (LEFT, encompass_arr[0]);    
+  if (encompass_arr.size () > 1)
+    set_bounds (RIGHT, encompass_arr.top ());
 }
 
 void
@@ -72,18 +80,6 @@ Slur::do_pre_processing ()
   // don't set directions
 }
 
-void
-Slur::do_substitute_element_pointer (Score_element*o, Score_element*n)
-{
-  int i;
-  while ((i = encompass_arr_.find_i (dynamic_cast<Note_column *> (o))) >=0) 
-    {
-      if (n)
-       encompass_arr_[i] = dynamic_cast<Note_column *> (n);
-      else
-       encompass_arr_.del (i);
-    }
-}
 
 static int 
 Note_column_compare (Note_column *const&n1 , Note_column* const&n2)
@@ -96,7 +92,7 @@ Offset
 Slur::encompass_offset (Note_column const* col) const
 {
   Offset o;
-  Stem* stem_l = col->stem_l_;
+  Stem* stem_l = col->stem_l ();
   if (!stem_l)
     {
       warning (_ ("Slur over rest?"));
@@ -139,7 +135,10 @@ Slur::encompass_offset (Note_column const* col) const
 void
 Slur::do_post_processing ()
 {
-  encompass_arr_.sort (Note_column_compare);
+    Link_array<Note_column> encompass_arr =
+    Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+
+  encompass_arr.sort (Note_column_compare);
   if (!get_direction ())
     set_direction (get_default_dir ());
 
@@ -161,8 +160,8 @@ Slur::do_post_processing ()
   Real y_gap_f = paper_l ()->get_var ("slur_y_gap");
 
   Drul_array<Note_column*> note_column_drul;
-  note_column_drul[LEFT] = encompass_arr_[0];
-  note_column_drul[RIGHT] = encompass_arr_.top ();
+  note_column_drul[LEFT] = encompass_arr[0];
+  note_column_drul[RIGHT] = encompass_arr.top ();
 
   bool fix_broken_b = false;
   Direction d = LEFT;
@@ -170,10 +169,10 @@ Slur::do_post_processing ()
     {
       dx_f_drul_[d] = dy_f_drul_[d] = 0;
       if ((note_column_drul[d] == spanned_drul_[d])
-         && note_column_drul[d]->head_l_arr_.size ()
-         && (note_column_drul[d]->stem_l_))
+         && note_column_drul[d]->first_head ()
+         && (note_column_drul[d]->stem_l ()))
        {
-         Stem* stem_l = note_column_drul[d]->stem_l_;
+         Stem* stem_l = note_column_drul[d]->stem_l ();
          /*
            side directly attached to note head;
            no beam getting in the way
@@ -244,15 +243,15 @@ Slur::do_post_processing ()
   while (flip (&d) != LEFT);
 
   int cross_count =  cross_staff_count ();
-  bool interstaff_b = (0 < cross_count) && (cross_count < encompass_arr_.size ());
+  bool interstaff_b = (0 < cross_count) && (cross_count < encompass_arr.size ());
 
   Drul_array<Offset> info_drul;
   Drul_array<Real> interstaff_interval;
 
   do
     {
-      info_drul[d] = encompass_offset (encompass_arr_.boundary (d, 0));
-      interstaff_interval[d] = calc_interstaff_dist (encompass_arr_.boundary (d,0),
+      info_drul[d] = encompass_offset (encompass_arr.boundary (d, 0));
+      interstaff_interval[d] = calc_interstaff_dist (encompass_arr.boundary (d,0),
                                                     this);
     }
   while (flip (&d) != LEFT);
@@ -261,7 +260,7 @@ Slur::do_post_processing ()
 
   if (fix_broken_b)
     {
-      Direction d = (encompass_arr_.top () != spanned_drul_[RIGHT]) ?
+      Direction d = (encompass_arr.top () != spanned_drul_[RIGHT]) ?
        RIGHT : LEFT;
       dy_f_drul_[d] = info_drul[d][Y_AXIS];
       if (!interstaff_b)
@@ -368,19 +367,19 @@ Slur::do_post_processing ()
     {
       Note_column * nc = note_column_drul[d];
       if (nc == spanned_drul_[d]
-         && nc->stem_l_
-         && nc->stem_l_->get_direction () == get_direction ()
-         && abs (nc->stem_l_->extent (Y_AXIS)[get_direction ()]
+         && nc->stem_l ()
+         && nc->stem_l ()->get_direction () == get_direction ()
+         && abs (nc->stem_l ()->extent (Y_AXIS)[get_direction ()]
                  - dy_f_drul_[d] + (d == LEFT ? 0 : interstaff_f))
              <= snap_f)
        {
          /*
            prepare to attach to stem-end
          */
-         snapx_f_drul[d] = nc->stem_l_->hpos_f ()
+         snapx_f_drul[d] = nc->stem_l ()->hpos_f ()
            - spanned_drul_[d]->relative_coordinate (0, X_AXIS);
 
-         snapy_f_drul[d] = nc->stem_l_->extent (Y_AXIS)[get_direction ()]
+         snapy_f_drul[d] = nc->stem_l ()->extent (Y_AXIS)[get_direction ()]
            + interstaff_interval[d]
            + get_direction () * 2 * y_gap_f;
          
@@ -431,11 +430,14 @@ Slur::do_post_processing ()
 int
 Slur::cross_staff_count ()const
 {
+  Link_array<Note_column> encompass_arr =
+    Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+
   int k=0;
 
-  for (int i = 0; i < encompass_arr_.size (); i++)
+  for (int i = 0; i < encompass_arr.size (); i++)
     {
-      if (calc_interstaff_dist (encompass_arr_[i], this))
+      if (calc_interstaff_dist (encompass_arr[i], this))
        k++;
     }
   return k;
@@ -445,6 +447,9 @@ Slur::cross_staff_count ()const
 Array<Offset>
 Slur::get_encompass_offset_arr () const
 {
+  Link_array<Note_column> encompass_arr =
+    Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+  
   Array<Offset> offset_arr;
 #if 0
   /*
@@ -459,7 +464,7 @@ Slur::get_encompass_offset_arr () const
   Offset origin (relative_coordinate (0, X_AXIS), 0);
 
   int first = 1;
-  int last = encompass_arr_.size () - 2;
+  int last = encompass_arr.size () - 2;
 
   offset_arr.push (Offset (dx_f_drul_[LEFT], dy_f_drul_[LEFT]));
 
@@ -468,11 +473,11 @@ Slur::get_encompass_offset_arr () const
   */
 
   int cross_count  = cross_staff_count ();
-  bool cross_b = cross_count && cross_count < encompass_arr_.size ();
-  if (encompass_arr_[0] != spanned_drul_[LEFT])
+  bool cross_b = cross_count && cross_count < encompass_arr.size ();
+  if (encompass_arr[0] != spanned_drul_[LEFT])
     {
       first--;
-      Real is   = calc_interstaff_dist (encompass_arr_[0], this);
+      Real is   = calc_interstaff_dist (encompass_arr[0], this);
       if (cross_b)
        offset_arr[0][Y_AXIS] += is;
     }
@@ -480,14 +485,14 @@ Slur::get_encompass_offset_arr () const
   /*
     right is broken edge
   */
-  if (encompass_arr_.top () != spanned_drul_[RIGHT])
+  if (encompass_arr.top () != spanned_drul_[RIGHT])
     {
       last++;
     }
 
   for (int i = first; i <= last; i++)
     {
-      Offset o (encompass_offset (encompass_arr_[i]));
+      Offset o (encompass_offset (encompass_arr[i]));
       offset_arr.push (o - origin);
     }
 
index 69632b2af8b8581d098975efb3a733b79575cf0b..ab8d82ae4a76176eea862e266fe7449211802df0 100644 (file)
@@ -59,7 +59,7 @@ Spacing_spanner::do_measure (Link_array<Score_column> cols) const
   Array<Spring> meas_springs;
 
   Real non_musical_space_strength = paper_l ()->get_var ("breakable_column_space_strength");
-  for (int i= 0; i < cols.size (); i++)
+  for (int i= 0; i < cols.size () - 1; i++)
     {
       Item * l = cols[i];
       Item * r = cols[i+1];
@@ -291,8 +291,8 @@ Spacing_spanner::get_springs () const
   Link_array<Score_column> measure;
   for (SCM s = last_col; gh_pair_p (s); s = gh_cdr (s))
     {
-      SCM elt = gh_car (s);
-      Score_column* sc = dynamic_cast<Score_column*> (SMOB_TO_TYPE (Score_column, elt));
+      Score_element * elt = unsmob_element (gh_car (s));
+      Score_column* sc = dynamic_cast<Score_column*> (elt);
       measure.push (sc);
       if (sc->breakable_b ())
         {
index 34c9f39ea1bc1f1da7e28f954fb03a2c33569ffc..2f43cd985f8b5b60aa14006ac9a8ffd866da2663 100644 (file)
 #include "molecule.hh"
 #include "align-element.hh"
 #include "warn.hh"
+#include "group-interface.hh"
+
 
 void
 Span_bar::add_bar (Score_element*b)
 {
-  spanning_l_arr_.push (b);
-  add_dependency (b);
-}
+  Group_interface gi (this);
+  gi.add_element (b);
 
-void
-Span_bar::do_substitute_element_pointer (Score_element*o, Score_element*n)
-{
-  spanning_l_arr_.unordered_substitute (o, n);
+  add_dependency (b);
 }
 
 
@@ -59,7 +57,7 @@ Span_bar::do_post_processing ()
 void
 Span_bar::evaluate_empty ()
 { 
-  if (spanning_l_arr_.size () < 1
+  if (!gh_pair_p (get_elt_property ("elements"))
     {
       set_elt_property ("transparent", SCM_BOOL_T);
       set_empty (X_AXIS);
@@ -90,13 +88,23 @@ Span_bar::get_spanned_interval () const
 {
   Interval y_int;
 
-  for (int i=0; i < spanning_l_arr_.size (); i++) 
+  for (SCM s = get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
     {
-      Score_element*common = common_refpoint (spanning_l_arr_[i], Y_AXIS);
-      Real y = spanning_l_arr_[i]->relative_coordinate (common, Y_AXIS)  
-       - relative_coordinate (common, Y_AXIS);
+      Score_element *bar = unsmob_element ( gh_car (s));
+
+      if (!bar)
+       continue;
+      
+      Score_element*common = common_refpoint (bar, Y_AXIS);
+
+      Interval iv (bar->extent(Y_AXIS));
+      if (!iv.empty_b ())
+       {
+         Real y = bar->relative_coordinate (common, Y_AXIS)  
+           - relative_coordinate (common, Y_AXIS);
 
-      y_int.unite (y + spanning_l_arr_[i]->extent(Y_AXIS));
+         y_int.unite (y + iv);
+       }
     }
   return y_int;
 }
index 9aeaaab4075c518db3fdc4d69aed1ca0f2bb86f4..dd3d24ead3276ff9e2dbcc58755cf8042fdf02b0 100644 (file)
@@ -15,6 +15,7 @@
 #include "paper-outputter.hh"
 #include "score-column.hh"
 #include "line-of-score.hh"
+#include "break-align-item.hh"
 
 void
 Spanner::break_into_pieces ()
@@ -201,30 +202,6 @@ Spanner::do_space_processing ()
     }
 }
 
-#if 0
-/*
-  UGH.
- */
-void
-Spanner::handle_broken_dependents ()
-{
-  Spanner *unbrok = dynamic_cast<Spanner*> (original_l_);
-  if (!unbrok || parent_l(Y_AXIS))
-    return;
-  
-  Spanner *refpoint = dynamic_cast<Spanner*> (unbrok->parent_l (Y_AXIS));
-  
-  if (refpoint)
-    {
-      Score_element * broken_refpoint = refpoint->find_broken_piece (line_l ());
-      if (broken_refpoint)
-       set_parent (broken_refpoint,Y_AXIS);
-      else
-       programming_error ("Spanner y -refpoint lost.");
-    }
-}
-#endif
-
 /*
   If this is a broken spanner, return the amount the left end is to be
   shifted horizontally so that the spanner starts after the initial
@@ -234,8 +211,6 @@ Spanner::handle_broken_dependents ()
 Real
 Spanner::get_broken_left_end_align () const
 {
-  int i;
-
   Score_column *sc = dynamic_cast<Score_column*> (spanned_drul_[LEFT]->column_l());
 
   // Relevant only if left span point is first column in line
@@ -244,13 +219,23 @@ Spanner::get_broken_left_end_align () const
     {
       // We could possibly return the right edge of the whole Score_column here,
       // but we do a full search for the Break_align_item.
-      for(i = 0; i < sc->elem_l_arr_.size (); i++)
+
+      /*
+       In fact that doesn't make a difference, since the Score_column
+       is likely to contain only a Break_align_item.
+      */
+#if 0
+      for(SCM s = sc->get_elt_property ("elements"); gh_pair_p (s);
+         s = gh_cdr (s))
        {
-         if(0 == strcmp (classname (sc->elem_l_arr_[i]), "Break_align_item"))
+         Score_element *e = SMOB_TO_TYPE (Score_element, gh_car (s));
+         if(dynamic_cast<Break_align_item*> (e))
            {
-             return sc->elem_l_arr_[i]->extent (X_AXIS) [RIGHT];
+             return e->extent (X_AXIS) [RIGHT];
            }
        }
+#endif
+      return sc->extent (X_AXIS)[RIGHT];
     }
 
   return 0.0;
index 20440aa923eb27197df2a5b0467ab9d01314bfc7..068ff7b2c2d0c6ef0adcf6b83412849ac2749384 100644 (file)
@@ -45,10 +45,9 @@ Side_position_interface::get_direction () const
     }
   
   SCM other_elt = elt_l_->get_elt_property ("direction-source");
-  if (SMOB_IS_TYPE_B (Score_element, other_elt))
+  Score_element * e = unsmob_element(other_elt);
+  if (e)
     {
-      Score_element * e = SMOB_TO_TYPE(Score_element,other_elt);
-
       return relative_dir * Side_position_interface (e).get_direction ();
     }
   
@@ -69,25 +68,23 @@ Side_position_interface::side_position (Dimension_cache const * c)
   SCM support = me->get_elt_property ("side-support");
   for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
     {
-      if (!SMOB_IS_TYPE_B (Score_element, gh_car (s)))
-       continue;
-      
-      Score_element * e  = SMOB_TO_TYPE(Score_element, gh_car (s));
-      common = common->common_refpoint (e, axis);
+      Score_element * e  = unsmob_element ( gh_car (s));
+      if (e)
+       common = common->common_refpoint (e, axis);
     }
   
   for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
     {
-      if (!SMOB_IS_TYPE_B (Score_element, gh_car (s)))
-       continue;
 
-      Score_element * e  = SMOB_TO_TYPE(Score_element, gh_car (s));
-      Real coord = e->relative_coordinate (common, axis);
+      Score_element * e  = unsmob_element ( gh_car (s));
+      if (e)
+       {
+         Real coord = e->relative_coordinate (common, axis);
 
-      dim.unite (coord + e->extent (axis));
+         dim.unite (coord + e->extent (axis));
+       }
     }
 
-
   if (dim.empty_b ())
     {
       dim = Interval(0,0);
index d07dbea01aea14a302623a83a50e92e21c406e0b..f2532f0d43e0cbda93eef0d2356e565a8f7d4ef0 100644 (file)
@@ -31,10 +31,7 @@ Staff_symbol*
 Staff_symbol_referencer::staff_symbol_l () const
 {
   SCM st = get_elt_property ("staff-symbol");
-  if (SMOB_IS_TYPE_B (Score_element, st))
-    return dynamic_cast<Staff_symbol* > (SMOB_TO_TYPE (Score_element,st));
-  else
-    return 0;
+  return dynamic_cast<Staff_symbol* > (unsmob_element(st));
 }
 
 Real
index dd5ddb1c8a04bb99b6977f5b2b8e165842b2ba2c..cdb819767c0e81475436694b0bc91aa7233008d1 100644 (file)
@@ -40,7 +40,7 @@ Stem_engraver::acknowledge_element(Score_element_info i)
 {
   if (Rhythmic_head * h = dynamic_cast<Rhythmic_head *> (i.elem_l_))
     {
-      if (h->stem_l_)
+      if (h->stem_l ())
        return;
       
       Rhythmic_req * r = dynamic_cast <Rhythmic_req *> (i.req_l_);
index 24f1405b5b76e37cadce8a4f40376512c8989055..d55cd55272200002c3036e6de523a77e3c91e5fd 100644 (file)
@@ -32,12 +32,8 @@ Stem *
 Stem_tremolo::stem_l ()const
 {
   SCM s =   get_elt_property ("stem");
-  if (SMOB_IS_TYPE_B (Score_element, s))
-    {
-      return dynamic_cast<Stem*> (SMOB_TO_TYPE (Score_element,s));
-    }
-  else
-    return 0;
+
+  return dynamic_cast<Stem*> (  unsmob_element (s));
 }
 
 Interval
index 74ac9349aec235fc5a192121f019db55bc48e095..1edd92bc53cb3f7c7dea32e05afba42394483379 100644 (file)
@@ -18,6 +18,7 @@
 #include "misc.hh"
 #include "beam.hh"
 #include "rest.hh"
+#include "group-interface.hh"
 
 Stem::Stem ()
 {
@@ -34,15 +35,18 @@ Stem::head_positions () const
     trigger FP exceptions on FreeBSD.  Fix: do not return infinity 
 
    */
-  if (!head_l_arr_.size ())
+  if (!first_head ())
     {
       return Interval_t<int> (100,-100);       
     }
 
+  Link_array<Note_head> head_l_arr =
+    Group_interface__extract_elements (this, (Note_head*)0, "heads");
+  
   Interval_t<int> r;
-  for (int i =0; i < head_l_arr_.size (); i++)
+  for (int i =0; i < head_l_arr.size (); i++)
     {
-      int p = (int)head_l_arr_[i]->position_f ();
+      int p = (int)head_l_arr[i]->position_f ();
       r[BIGGER] = r[BIGGER] >? p;
       r[SMALLER] = r[SMALLER] <? p;
     }
@@ -96,29 +100,42 @@ Stem::set_stemend (Real se)
 int
 Stem::type_i () const
 {
-  return head_l_arr_[0]->balltype_i_;
+  
+  return first_head ()->balltype_i_;
+}
+
+Note_head*
+Stem::first_head () const
+{
+  SCM h =get_elt_property ("heads");
+  if (!gh_pair_p (h))
+    return 0;
+
+  Score_element * sc = unsmob_element (gh_car (h));
+
+  return dynamic_cast<Note_head*> (sc);
 }
 
 void
 Stem::add_head (Rhythmic_head *n)
 {
-  n->stem_l_ = this;
+  n->set_elt_property ("stem", this->self_scm_);
   n->add_dependency (this);    // ?
+  
+
+  Group_interface gi (this);
   if (Note_head *nh = dynamic_cast<Note_head *> (n))
-    {
-      head_l_arr_.push (nh);
-    }
-  else if (Rest *r = dynamic_cast<Rest *> (n))
-    {
-      rest_l_arr_.push (r);
-    }
+    gi.name_ = "heads";
+  else
+    gi.name_ = "rests";
+
+  gi.add_element (n);
 }
 
 bool
 Stem::invisible_b () const
 {
-  return (!head_l_arr_.size () ||
-    head_l_arr_[0]->balltype_i_ <= 0);
+  return !(first_head () && first_head()->balltype_i_ >= 1);
 }
 
 int
@@ -196,32 +213,37 @@ Stem::set_default_extents ()
 void
 Stem::set_noteheads ()
 {
-  if (!head_l_arr_.size ())
+  if (!first_head ())
     return;
-  head_l_arr_.sort (Note_head::compare);
+
+  
+  Link_array<Note_head> head_l_arr =
+    Group_interface__extract_elements (this, (Note_head*)0, "heads");
+
+  head_l_arr.sort (Note_head::compare);
   if (get_direction () < 0)
-    head_l_arr_.reverse ();
+    head_l_arr.reverse ();
 
-  Note_head * beginhead =   head_l_arr_[0];
+  Note_head * beginhead =   first_head ();
   beginhead->set_elt_property ("extremal", SCM_BOOL_T);
-  if  (beginhead !=   head_l_arr_.top ())
-    head_l_arr_.top ()->set_elt_property ("extremal", SCM_BOOL_T);
+  if  (beginhead !=   head_l_arr.top ())
+    head_l_arr.top ()->set_elt_property ("extremal", SCM_BOOL_T);
   
   int parity=1;
   int lastpos = int (beginhead->position_f ());
-  for (int i=1; i < head_l_arr_.size (); i ++)
+  for (int i=1; i < head_l_arr.size (); i ++)
     {
-      int dy =abs (lastpos- (int)head_l_arr_[i]->position_f ());
+      int dy =abs (lastpos- (int)head_l_arr[i]->position_f ());
 
       if (dy <= 1)
        {
          if (parity)
-           head_l_arr_[i]->flip_around_stem (get_direction ());
+           head_l_arr[i]->flip_around_stem (get_direction ());
          parity = !parity;
        }
       else
        parity = 1;
-      lastpos = int (head_l_arr_[i]->position_f ());
+      lastpos = int (head_l_arr[i]->position_f ());
     }
 }
 
@@ -318,8 +340,8 @@ Stem::do_brew_molecule_p () const
   Real dy = staff_line_leading_f ()/2.0;
 
   Real head_wid = 0;
-  if (head_l_arr_.size ())
-    head_wid = head_l_arr_[0]->extent (X_AXIS).length ();
+  if (first_head ())
+    head_wid = first_head ()->extent (X_AXIS).length ();
   stem_y[Direction(-get_direction ())] += get_direction () * head_wid * tan(ANGLE)/(2*dy);
   
   if (!invisible_b ())
@@ -338,7 +360,7 @@ Stem::do_brew_molecule_p () const
       mol_p->add_molecule (fl);
     }
 
-  if (head_l_arr_.size())
+  if (first_head ())
     {
       mol_p->translate_axis (note_delta_f (), X_AXIS);
     }
@@ -349,9 +371,9 @@ Real
 Stem::note_delta_f () const
 {
   Real r=0;
-  if (head_l_arr_.size())
+  if (first_head ())
     {
-      Interval head_wid(0,  head_l_arr_[0]->extent (X_AXIS).length ());
+      Interval head_wid(0,  first_head()->extent (X_AXIS).length ());
          Real rule_thick = paper_l ()->get_var ("stemthickness");
 
       Interval stem_wid(-rule_thick/2, rule_thick/2);
@@ -369,21 +391,10 @@ Stem::hpos_f () const
   return note_delta_f () + Item::hpos_f ();
 }
 
-void
-Stem::do_substitute_element_pointer (Score_element*o,Score_element*n)
-{
-  if (Note_head*h=dynamic_cast<Note_head*> (o))
-    head_l_arr_.substitute (h, dynamic_cast<Note_head*>(n));
-  if (Rest *r=dynamic_cast<Rest*> (o))
-    rest_l_arr_.substitute (r, dynamic_cast<Rest*>(n));
-}
 
 Beam*
 Stem::beam_l ()const
 {
   SCM b=  get_elt_property ("beam");
-  if (SMOB_IS_TYPE_B(Score_element, b))
-    return dynamic_cast<Beam*> (SMOB_TO_TYPE(Score_element,b));
-  else
-    return 0;
+  return dynamic_cast<Beam*> (unsmob_element (b));
 }
index af2c6fb1a50be54c81f5831a27c9ed8a5a6d430e..6959854d0f659f796905f8ca2d0d59eeecb36fef 100644 (file)
 #include "note-head.hh"
 #include "paper-column.hh"
 #include "debug.hh"
+#include "group-interface.hh"
+
 
 
 
 void
 Tie::set_head (Direction d, Note_head * head_l)
 {
-  assert (!head_l_drul_[d]);
-  head_l_drul_[d] = head_l;
+  assert (!head (d));
+  if (d == LEFT)
+    gh_set_car_x (get_elt_property ("heads"), head_l->self_scm_ );
+  else if (d == LEFT)
+    gh_set_cdr_x (get_elt_property ("heads"), head_l->self_scm_ );
+  
   set_bounds (d, head_l);
 
   add_dependency (head_l);
@@ -26,8 +32,16 @@ Tie::set_head (Direction d, Note_head * head_l)
 
 Tie::Tie()
 {
-  head_l_drul_[RIGHT] =0;
-  head_l_drul_[LEFT] =0;
+  set_elt_property ("heads", gh_cons (SCM_EOL, SCM_EOL));
+}
+
+Note_head* 
+Tie::head (Direction d) const
+{
+  SCM c = get_elt_property ("heads");
+  c = index_cell (c, d);
+
+  return dynamic_cast<Note_head*> (unsmob_element (c));  
 }
 
 
@@ -37,8 +51,8 @@ Tie::Tie()
 Direction
 Tie::get_default_dir () const
 {
-  int m = int (head_l_drul_[LEFT]->position_f () 
-              + head_l_drul_[RIGHT]->position_f ()) /2;
+  int m = int (head (LEFT)->position_f () 
+              + head (RIGHT)->position_f ()) /2;
 
   /*
     If dir is not determined: inverse of stem: down
@@ -51,22 +65,26 @@ Tie::get_default_dir () const
 void
 Tie::do_add_processing()
 {
-  if (!(head_l_drul_[LEFT] && head_l_drul_[RIGHT]))
+  if (!(head (LEFT) && head (RIGHT)))
     warning (_ ("lonely tie"));
 
   Direction d = LEFT;
-  Drul_array<Note_head *> new_head_drul = head_l_drul_;
+  Drul_array<Note_head *> new_head_drul;
+  new_head_drul[LEFT] = head(LEFT);
+  new_head_drul[RIGHT] = head(RIGHT);  
   do {
-    if (!head_l_drul_[d])
-      new_head_drul[d] = head_l_drul_[(Direction)-d];
+    if (!head (d))
+      new_head_drul[d] = head((Direction)-d);
   } while (flip(&d) != LEFT);
-  head_l_drul_ = new_head_drul;
+
+  gh_set_car_x (get_elt_property ("heads"), new_head_drul[LEFT]->self_scm_ );
+  gh_set_cdr_x (get_elt_property ("heads"), new_head_drul[RIGHT]->self_scm_ );
 }
 
 void
 Tie::do_post_processing()
 {
-  assert (head_l_drul_[LEFT] || head_l_drul_[RIGHT]);
+  assert (head (LEFT) || head (RIGHT));
 
   Real interline_f = paper_l ()->get_var ("interline");
   Real internote_f = interline_f / 2;
@@ -91,13 +109,13 @@ Tie::do_post_processing()
   Direction d = LEFT;
   do
     {
-      Real head_width_f = head_l_drul_[d]
-       ? head_l_drul_[d]->extent (X_AXIS).length ()
+      Real head_width_f = head (d)
+       ? head (d)->extent (X_AXIS).length ()
        : 0;
       /*
        side attached to outer (upper or lower) notehead of chord
       */
-      if (head_l_drul_[d]
+      if (head (d)
          /*
 
                a~a~a;
@@ -107,7 +125,7 @@ Tie::do_post_processing()
            Getting scared a bit by score-element's comment:
            // is this a good idea?
          */
-         && (head_l_drul_[d]->get_elt_property ("extremal")
+         && (head (d)->get_elt_property ("extremal")
              != SCM_UNDEFINED))
        {
        if (d == LEFT)
@@ -125,8 +143,8 @@ Tie::do_post_processing()
 
 #else
 
-  if (head_l_drul_[LEFT])
-    dx_f_drul_[LEFT] = head_l_drul_[LEFT]->extent (X_AXIS).length ();
+  if (head (LEFT))
+    dx_f_drul_[LEFT] = head (LEFT)->extent (X_AXIS).length ();
   else
     dx_f_drul_[LEFT] = get_broken_left_end_align ();
   dx_f_drul_[LEFT] += x_gap_f;
@@ -149,8 +167,8 @@ Tie::do_post_processing()
         for smal slurs
    */
 
-  Real ypos = head_l_drul_[LEFT] ? head_l_drul_[LEFT]->position_f ()
-    : head_l_drul_[RIGHT]->position_f ();
+  Real ypos = head (LEFT) ? head (LEFT)->position_f ()
+    : head (RIGHT)->position_f ();
 
   Real y_f = internote_f * ypos; 
   int ypos_i = int (ypos);
@@ -173,15 +191,6 @@ Tie::do_post_processing()
   dy_f_drul_[LEFT] = dy_f_drul_[RIGHT] = y_f;
 }
 
-void
-Tie::do_substitute_element_pointer (Score_element*o, Score_element*n)
-{
-  Note_head *new_l = n ? dynamic_cast<Note_head *> (n) : 0;
-  if (dynamic_cast <Item *> (o) == head_l_drul_[LEFT])
-    head_l_drul_[LEFT] = new_l;
-  else if (dynamic_cast <Item *> (o) == head_l_drul_[RIGHT])
-    head_l_drul_[RIGHT] = new_l;
-}
 
 
 Array<Rod>
index 7fed879b85e87ced82b247d42e5aeb05c5b91caf..3b9565ce1102e9e089ed74aa8cdc4e62d46f9c3e 100644 (file)
@@ -17,6 +17,8 @@
 #include "stem.hh"
 #include "note-column.hh"
 #include "dimensions.hh"
+#include "group-interface.hh"
+
 
 
 Tuplet_spanner::Tuplet_spanner ()
@@ -25,6 +27,8 @@ Tuplet_spanner::Tuplet_spanner ()
     -> GUILE
    */
   parallel_beam_b_ = false;
+  set_elt_property ("beams", SCM_EOL);
+  set_elt_property ("columns", SCM_EOL);  
 }
 
 /*
@@ -58,77 +62,78 @@ Tuplet_spanner::do_brew_molecule_p () const
                           (value == 2 && !parallel_beam_b_));
     }
   
-  if (column_arr_.size ()){
-    Real ncw = column_arr_.top ()->extent (X_AXIS).length ();
-    Real w = extent (X_AXIS).length () + ncw;
-    Molecule num (lookup_l ()->text ("italic",
-                                    number_str_, paper_l ()));
-    num.align_to (X_AXIS, CENTER);
-    num.translate_axis (w/2, X_AXIS);
-    Real interline = paper_l ()->get_var ("interline");
-    Real dy = column_arr_.top ()->extent (Y_AXIS) [get_direction ()]
-      - column_arr_[0]->extent (Y_AXIS) [get_direction ()];
-    num.align_to (Y_AXIS, CENTER);
-    num.translate_axis (get_direction () * interline, Y_AXIS);
+  if (gh_pair_p (get_elt_property ("columns")))
+    {
+      Link_array<Note_column> column_arr=
+       Group_interface__extract_elements (this, (Note_column*)0, "columns");
+       
+      Real ncw = column_arr.top ()->extent(X_AXIS).length ();
+      Real w = spanner_length () + ncw;
+      Molecule num (lookup_l ()->text ("italic",
+                                      number_str_, paper_l ()));
+      num.align_to (X_AXIS, CENTER);
+      num.translate_axis (w/2, X_AXIS);
+      Real interline = paper_l ()->get_var ("interline");
+      Real dy = column_arr.top ()->extent (Y_AXIS) [get_direction ()]
+       - column_arr[0]->extent (Y_AXIS) [get_direction ()];
+      num.align_to (Y_AXIS, CENTER);
+      num.translate_axis (get_direction () * interline, Y_AXIS);
        
-    num.translate_axis (dy/2, Y_AXIS);
+      num.translate_axis (dy/2, Y_AXIS);
     
-    Real thick = paper_l ()->get_var ("tuplet_thick");
-    if (bracket_visibility)      
-      {
-       Real gap = paper_l () -> get_var ("tuplet_spanner_gap");
+      Real thick = paper_l ()->get_var ("tuplet_thick");
+      if (bracket_visibility)      
+       {
+         Real gap = paper_l () -> get_var ("tuplet_spanner_gap");
        
-       mol_p->add_molecule (lookup_l ()->tuplet_bracket (dy, w, thick, gap, interline, get_direction ()));
-      }
-
-    if (number_visibility)
-      {
-       mol_p->add_molecule (num);
-      }
-    mol_p->translate_axis (get_direction () * interline, Y_AXIS);
-  }
+         mol_p->add_molecule (lookup_l ()->tuplet_bracket (dy, w, thick, gap, interline, get_direction ()));
+       }
+
+      if (number_visibility)
+       {
+         mol_p->add_molecule (num);
+       }
+      mol_p->translate_axis (get_direction () * interline, Y_AXIS);
+    }
   return mol_p;
 }
   
 void
 Tuplet_spanner::do_add_processing ()
 {
-  if (column_arr_.size ())
+  if (gh_pair_p (get_elt_property ("columns")))
     {
-      set_bounds (LEFT, column_arr_[0]);
-      set_bounds (RIGHT, column_arr_.top ());  
+      Link_array<Note_column> column_arr=
+       Group_interface__extract_elements (this, (Note_column*)0, "columns");
+      
+      set_bounds (LEFT, column_arr[0]);
+      set_bounds (RIGHT, column_arr.top ());  
     }
 }
   
 void
 Tuplet_spanner::do_post_processing ()
 {
-  if (column_arr_.size())
-    translate_axis (column_arr_[0]->extent (Y_AXIS)[get_direction ()], Y_AXIS);
+  Link_array<Note_column> column_arr=
+    Group_interface__extract_elements (this, (Note_column*)0, "columns");
+      
+
+  if (column_arr.size())
+    translate_axis (column_arr[0]->extent (Y_AXIS)[get_direction ()], Y_AXIS);
 
-  if (beam_l_arr_.size () == 1)
+  
+  if (scm_ilength (get_elt_property ("beams")) == 1)
     {
-      Beam * beam_l = beam_l_arr_[0];
+      SCM bs = get_elt_property ("beams");
+      Score_element *b = unsmob_element (gh_car (bs));
+      Beam * beam_l = dynamic_cast<Beam*> (b);
       if (!broken_b () 
          && spanned_drul_[LEFT]->column_l () == beam_l->spanned_drul_[LEFT]->column_l ()
          && spanned_drul_[RIGHT]->column_l () == beam_l->spanned_drul_[RIGHT]->column_l ())
        parallel_beam_b_ = true;
     }
-
-  //  if (column_arr_.size () == 1)
-  //    bracket_visibility_b_ = false;
 }
 
-void
-Tuplet_spanner::do_substitute_element_pointer (Score_element* o, Score_element* n)
-{
-  if (Note_column *onc = dynamic_cast <Note_column *> (o))
-    column_arr_.substitute (onc, dynamic_cast<Note_column*> (n));
-  else if (Beam * b = dynamic_cast<Beam* > (o))
-    {
-      beam_l_arr_.substitute (b,  dynamic_cast<Beam*> (n));
-    }
-}
 
 Direction
 Tuplet_spanner::get_default_dir () const
@@ -141,14 +146,17 @@ Tuplet_spanner::get_default_dir () const
       return d;
   }
 
-  for (int i=0; i < column_arr_.size (); i ++) 
+  for (SCM s = get_elt_property ("columns"); gh_pair_p (s); s = gh_cdr (s))
     {
-      if (column_arr_[i]->dir () < 0) 
+      Score_element * sc = unsmob_element (gh_car (s));
+      Note_column * nc = dynamic_cast<Note_column*> (sc);
+      if (nc->dir () < 0) 
        {
          d = DOWN;
          break;
        }
     }
+  
   return d;
 }
 
@@ -156,13 +164,16 @@ void
 Tuplet_spanner::add_beam (Beam *b)
 {
   add_dependency (b);
-  beam_l_arr_.push (b);
+  Group_interface gi (this, "beams");
+  gi.add_element (b);
 }
 
 void
 Tuplet_spanner::add_column (Note_column*n)
 {
-  column_arr_.push (n);
+  Group_interface gi (this, "columns");
+  gi.add_element (n);
+
   add_dependency (n);
 }
 
index f1e641b78230c07a70105bffbe24fd5d221719fc..ac0973f9e5954f210780934254de57346042b2fd 100644 (file)
 #include "volta-spanner.hh"
 #include "stem.hh"
 #include "dimension-cache.hh"
-#include "pointer.tcc"
+#include "group-interface.hh"
 
 Volta_spanner::Volta_spanner ()
 {
   last_b_ = false;
   dim_cache_ [Y_AXIS]->set_callback (dim_callback);
+  set_elt_property ("bars", SCM_EOL);
+  set_elt_property ("note-columns", SCM_EOL);
 }
 
 Molecule*
@@ -31,8 +33,15 @@ Volta_spanner::do_brew_molecule_p () const
 {
   Molecule* mol_p = new Molecule;
 
-  if (!bar_arr_.size ())
+  Link_array<Bar> bar_arr
+    = Group_interface__extract_elements (this, (Bar*)0, "bars");
+
+  if (!bar_arr.size ())
     return mol_p;
+
+  Link_array<Bar> note_column_arr
+    = Group_interface__extract_elements (this, (Bar*)0, "note-columns");
+
   
   bool no_vertical_start = false;
   bool no_vertical_end = last_b_;
@@ -41,7 +50,7 @@ Volta_spanner::do_brew_molecule_p () const
     no_vertical_start = true;
   if (orig_span && (orig_span->broken_into_l_arr_.top () != (Spanner*)this))
     no_vertical_end = true;
-  if (bar_arr_.top ()->type_str_.length_i () > 1)
+  if (bar_arr.top ()->type_str_.length_i () > 1)
     no_vertical_end = false;
 
   Real interline_f = paper_l ()->get_var ("interline");
@@ -49,18 +58,18 @@ Volta_spanner::do_brew_molecule_p () const
   Real t = paper_l ()->get_var ("volta_thick");
 
   Real dx = internote_f;
-  Real w = extent (X_AXIS).length () - dx - get_broken_left_end_align ();
+  Real w = spanner_length() - dx - get_broken_left_end_align ();
   Real h = paper_l()->get_var ("volta_spanner_height");
   Molecule volta (lookup_l ()->volta (h, w, t, no_vertical_start, no_vertical_end));
 
   
   Molecule num (lookup_l ()->text ("volta", number_str_, paper_l ()));
-  Real dy = bar_arr_.top ()->extent (Y_AXIS) [UP] > 
-     bar_arr_[0]->extent (Y_AXIS) [UP];
+  Real dy = bar_arr.top ()->extent (Y_AXIS) [UP] > 
+     bar_arr[0]->extent (Y_AXIS) [UP];
   dy += 2 * h;
 
-  for (int i = 0; i < note_column_arr_.size (); i++)
-    dy = dy >? note_column_arr_[i]->extent (Y_AXIS)[BIGGER];
+  for (int i = 0; i < note_column_arr.size (); i++)
+    dy = dy >? note_column_arr[i]->extent (Y_AXIS)[BIGGER];
   dy -= h;
 
   Molecule two (lookup_l ()->text ("number", "2", paper_l ()));
@@ -77,10 +86,14 @@ Volta_spanner::do_brew_molecule_p () const
 void
 Volta_spanner::do_add_processing ()
 {
-  if (bar_arr_.size ())
+
+  Link_array<Bar> bar_arr
+    = Group_interface__extract_elements (this, (Bar*)0, "bars");
+
+  if (bar_arr.size ())
     {
-      set_bounds (LEFT, bar_arr_[0]);
-      set_bounds (RIGHT, bar_arr_.top ());  
+      set_bounds (LEFT, bar_arr[0]);
+      set_bounds (RIGHT, bar_arr.top ());  
     }
 }
 
@@ -104,31 +117,32 @@ Volta_spanner::dim_callback (Dimension_cache const *c)
 void
 Volta_spanner::do_post_processing ()
 {
-  if (bar_arr_.size())
-    translate_axis (bar_arr_[0]->extent (Y_AXIS)[UP], Y_AXIS);
+
+  Link_array<Bar> bar_arr
+    = Group_interface__extract_elements (this, (Bar*)0, "bars");
+  
+  if (bar_arr.size())
+    translate_axis (bar_arr[0]->extent (Y_AXIS)[UP], Y_AXIS);
   translate_axis (get_broken_left_end_align (), X_AXIS);
 }
 
-void
-Volta_spanner::do_substitute_element_pointer (Score_element* o, Score_element* n)
-{
-  if (Note_column* c = dynamic_cast <Note_column*> (o))
-    note_column_arr_.substitute (c, dynamic_cast<Note_column*> (n));
-  else if (Bar* c = dynamic_cast <Bar*> (o))
-    bar_arr_.substitute (c, dynamic_cast<Bar*> (n));
-}
+
   
 void
 Volta_spanner::add_bar  (Bar* c)
 {
-  bar_arr_.push (c);
+  Group_interface gi(this, "bars");
+  gi.add_element (c);
+
   add_dependency (c);
 }
 
 void
 Volta_spanner::add_column (Note_column* c)
 {
-  note_column_arr_.push (c);
+  Group_interface gi(this, "note-columns");
+  gi.add_element (c);
+
   add_dependency (c);
 }
 
index 9663028c13c29d8357f12276dd3fcb6a375eefbe..373b9359ddca06a79cf37f3397f5c337dca6eab2 100644 (file)
@@ -1,15 +1,15 @@
 Begin3
 Title: LilyPond
-Version: 1.3.9
-Entered-date: 02DEC99
+Version: 1.3.10
+Entered-date: 08DEC99
 Description: 
 Keywords: music notation typesetting midi fonts engraving
 Author: hanwen@cs.uu.nl (Han-Wen Nienhuys)
        janneke@gnu.org (Jan Nieuwenhuizen)
 Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
 Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert
-       1000k lilypond-1.3.9.tar.gz 
+       1000k lilypond-1.3.10.tar.gz 
 Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
-       1000k lilypond-1.3.9.tar.gz 
+       1000k lilypond-1.3.10.tar.gz 
 Copying-policy: GPL
 End
index 51cb9ffde081b94a2f60236396d9d01209e9d80b..63cc2657f13646666fa29a59420db1c5f515de0c 100644 (file)
@@ -1,9 +1,9 @@
 Name: lilypond
-Version: 1.3.9
+Version: 1.3.10
 Release: 1
 Copyright: GPL
 Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.9.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.10.tar.gz
 Summary: A program for printing sheet music.
 URL: http://www.cs.uu.nl/~hanwen/lilypond
 # get Packager from (undocumented?) ~/.rpmmacros!