]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.10
authorfred <fred>
Tue, 26 Mar 2002 22:44:06 +0000 (22:44 +0000)
committerfred <fred>
Tue, 26 Mar 2002 22:44:06 +0000 (22:44 +0000)
109 files changed:
CHANGES
VERSION
input/test/staccato-pos.sly
lily/align-element.cc
lily/auto-beam-engraver.cc
lily/axis-group-element.cc
lily/axis-group-item.cc
lily/axis-group-spanner.cc
lily/bar.cc
lily/beam-engraver.cc
lily/beam.cc
lily/bow.cc
lily/break-align-engraver.cc
lily/break-align-item.cc
lily/clef-engraver.cc
lily/clef-item.cc
lily/cross-staff.cc
lily/dimension-cache.cc
lily/directional-spanner.cc
lily/dot-column-engraver.cc
lily/dot-column.cc
lily/dots.cc
lily/gdb.cc
lily/grace-position-engraver.cc
lily/group-interface.cc [new file with mode: 0644]
lily/hara-kiri-vertical-group-spanner.cc
lily/include/align-element.hh
lily/include/axis-group-element.hh
lily/include/axis-group-item.hh
lily/include/axis-group-spanner.hh
lily/include/beam.hh
lily/include/bow.hh
lily/include/collision.hh
lily/include/dimension-cache.hh
lily/include/directional-spanner.hh
lily/include/dot-column.hh
lily/include/extender-spanner.hh
lily/include/graphical-element.hh
lily/include/group-interface.hh [new file with mode: 0644]
lily/include/hara-kiri-vertical-group-spanner.hh
lily/include/hyphen-spanner.hh
lily/include/item.hh
lily/include/lily-proto.hh
lily/include/line-of-score.hh
lily/include/multi-measure-rest.hh
lily/include/note-column.hh
lily/include/note-head.hh
lily/include/paper-score.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/separating-group-spanner.hh
lily/include/single-malt-grouping-item.hh
lily/include/slur.hh
lily/include/spacing-spanner.hh
lily/include/span-bar.hh
lily/include/spanner.hh
lily/include/staff-side.hh
lily/include/staff-symbol-referencer.hh
lily/include/staff-symbol.hh
lily/include/stem-staff-side.hh
lily/include/stem-tremolo.hh
lily/include/stem.hh
lily/include/tie.hh
lily/include/tuplet-spanner.hh
lily/include/volta-spanner.hh
lily/item.cc
lily/lily-guile.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-column.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/script-engraver.cc
lily/script.cc
lily/separating-group-spanner.cc
lily/separating-line-group-engraver.cc
lily/single-malt-grouping-item.cc
lily/slur.cc
lily/spacing-spanner.cc
lily/span-bar.cc
lily/span-score-bar-engraver.cc
lily/spanner.cc
lily/staff-side.cc
lily/staff-sym-engraver.cc
lily/staff-sym.cc
lily/staff-symbol-referencer.cc
lily/stem-engraver.cc
lily/stem-info.cc
lily/stem-tremolo.cc
lily/stem.cc
lily/super-element.cc
lily/text-engraver.cc
lily/tie.cc
ly/params.ly
make/toplevel.make.in
mutopia/F.Schubert/standchen.ly

diff --git a/CHANGES b/CHANGES
index dcf9175885615a8a0defb5ce51bc520dedaaf5e0..6742e3945cc6943ca5f3a6296e03460d3c3497fe 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,15 @@
+pl 9.hwn1
+       - abstracting Staff_symbol_referencer to an interface.
+       - quantised_position for staccato dots.
+       - standchen fixes
+       - junk Score_element::do_{width,height}: set callbacks directly.
+       - merge Score_element, Graphical_element
+       - merge Axis_group_element, Graphical_axis_group
+       - junk pointer fields fromScore_element derived classes
+       - junk obsolete do_substitute_dependency code.
+
+**********
+
 pl 8.hwn2
        - staff-support for Crescendi.
        - padding for accidentals.
@@ -7,10 +19,9 @@ pl 8.hwn1
        - note-head-side 
        - naming Staff_sidify -> Side_position_interface
 
-
-
 ***********
-pl7.mb1
+
+pl 7.mb1
        - bf: timeSignatureStyle works again
 
 pl 7.hwn1
diff --git a/VERSION b/VERSION
index 9c66264a28428ff52db8a955a0d08a6484521b9e..978773045b1b91f64e82ff4b5cb6266373b0682e 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
-PATCH_LEVEL=9
+PATCH_LEVEL=10
 MY_PATCH_LEVEL=
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
index 31bcd80900604a1bd4520decf9d58d85dbe06813..aed9dc91de4b066041e310b9e670c174a54a867f 100644 (file)
@@ -1,3 +1,3 @@
-\stemup
+
 e''4-. f-. d-.
 c,-. b-. c'''-. d-.
index 9ccc1538d6e69620107b27ac8ae16e694b16e4b3..4134d8e3e2579cfb1185d0b9cce9ee586bff1aa2 100644 (file)
 #include "hash-table-iter.hh"
 #include "dimension-cache.hh"
 
-struct Align_element_content {
-  Graphical_element * elem_l_;
-  int priority_i_;
-  
-  static int compare (Align_element_content const &h1, 
-                     Align_element_content const &h2) 
-    {
-      return h1.priority_i_ - h2.priority_i_;
-    }
-  Align_element_content (Graphical_element *elem_l, int p) 
-    {
-      priority_i_ = p;
-      elem_l_ = elem_l;
-    }
-  Align_element_content () {
-    elem_l_ = 0;
-    priority_i_ = 0;
-  }
-};
-
-
-
-void
-Align_element::add_element (Score_element*el_l)
-{
-  int p = elem_l_arr_.size ();
-  add_element_priority (el_l, p);
-}
-
-void
-Align_element::add_element_priority (Score_element *el, int p)
-{
-  assert (! contains_b (el));
-  Axis_group_element::add_element (el);
-  priority_i_hash_[el] = p;
-  add_dependency (el);
-}
-
-void
-Align_element::do_substitute_element_pointer (Score_element*o,
-                                             Score_element*n)
-{
-  Axis_group_element :: do_substitute_element_pointer (o,n);
-  if (o == center_l_)
-    {
-      center_l_ = n;
-    }
-  if (priority_i_hash_.elem_b (o))
-    {
-      priority_i_hash_[n] = priority_i_hash_[o];
-      /*
-       Huh? It seems the old pointers are still used.  Why?
-       */
-      // priority_i_hash_.remove (o);
-    }
-}
-
 void
 Align_element::do_post_processing()
 {
@@ -90,12 +33,13 @@ Align_element::do_side_processing ()
   Array<Interval> dims;
 
   Link_array<Score_element> elems;
-  for (int i=0; i < elem_l_arr_.size(); i++) 
+  Link_array<Score_element> all_elts (elem_l_arr ());
+  for (int i=0; i < elem_l_arr ().size(); i++) 
     {
-      Interval y = elem_l_arr_[i]->extent(axis ()) + elem_l_arr_[i]->relative_coordinate (this, axis ());
+      Interval y = all_elts[i]->extent(axis ()) + all_elts[i]->relative_coordinate (this, axis ());
       if (!y.empty_b())
        {
-         Score_element *e =dynamic_cast<Score_element*>(elem_l_arr_[i]);
+         Score_element *e =dynamic_cast<Score_element*>(all_elts[i]);
 
          // todo: fucks up if item both in Halign & Valign. 
          SCM min_dims = e->remove_elt_property ("minimum-space");
@@ -119,6 +63,9 @@ 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 = unsmob_element (scenter);
+  
   for (int i=0 ;  i < elems.size(); i++) 
     {
       Real dy = - stacking_dir_ * dims[i][-stacking_dir_];
@@ -133,7 +80,7 @@ Align_element::do_side_processing ()
 
       if (!i && align_dir_ == LEFT)
        center_f = where_f;
-      else if (align_dir_ == CENTER && elems[i] == center_l_)
+      else if (align_dir_ == CENTER && elems[i] == center_elt)
        center_f = where_f;
 
       where_f += stacking_dir_ * dy;
@@ -144,7 +91,7 @@ Align_element::do_side_processing ()
     where_f += dims.top ()[stacking_dir_];
   if (align_dir_ == RIGHT)
     center_f = where_f;
-  else if (align_dir_ == CENTER && !center_l_)
+  else if (align_dir_ == CENTER && !center_elt)
     center_f = where_f / 2;
     
   if (center_f)
@@ -159,8 +106,21 @@ Align_element::Align_element()
   threshold_interval_ = Interval (0, Interval::infinity ());
   stacking_dir_ = DOWN;
   align_dir_ = CENTER;
-  center_l_ =0;
-  priority_i_hash_.hash_func_ = pointer_hash;
+}
+
+int
+Align_element::get_count (Score_element*s)const
+{
+  SCM e = get_elt_property ("elements");
+  int c =0;
+  while (gh_pair_p (e))
+    {
+      if (gh_car (e) == s->self_scm_)
+       break;
+      c++;
+      e = gh_cdr (e);
+    }
+  return c;
 }
 
 Axis
@@ -176,62 +136,7 @@ Align_element::set_axis (Axis a)
 }
 
 
-bool
-Align_element::contains_b (Score_element const *e) const
-{
-  return elem_l_arr_.find_l (e);
-}
-
-void
-Align_element::sort_elements ()
-{
-  Array<Align_element_content> content;
-  for  (int i =0; i < elem_l_arr_.size(); i++)
-    {
-      Score_element * e = dynamic_cast<Score_element*> (elem_l_arr_[i]);
-      assert (priority_i_hash_.elem_b (e));
-      int p = priority_i_hash_[e];
-      content.push (Align_element_content (e, p));
-    }
-  content.sort (Align_element_content::compare);
-  
-  elem_l_arr_.clear();
-  priority_i_hash_.clear();
-
-  for  (int i =0; i < content.size(); i++) 
-    {
-      elem_l_arr_.push (content[i].elem_l_);
-    }
-}
 
-void
-Align_element::do_print () const
-{
-#ifndef NPRINT
-  DEBUG_OUT << "contains: ";
-  for (int i=0 ;  i < elem_l_arr_.size(); i++) 
-    DEBUG_OUT << classname (elem_l_arr_[i]) << ", ";
-#endif
-}
 
-Score_element*
-Align_element::get_elt_by_priority (int p) const
-{
-  for (Hash_table_iter<Score_element*, int>  i(priority_i_hash_); i.ok (); i++)
-    {
-      if (i.val () == p)
-       return i.key();
-    }
-  return 0;
-}
 
-int
-Align_element::get_priority (Score_element const * e) const
-{
-  Score_element * nonconst = (Score_element*) e;
-  if ( priority_i_hash_.elem_b (nonconst))
-    return priority_i_hash_[nonconst];
-  else
-    return elem_l_arr_.find_i (nonconst);
-}
 
index bbba952ad21ebed9ae66f8689aa6c4f030074946..81e7cf94b8694763477d4a2aa20e083d965d0f29 100644 (file)
@@ -207,7 +207,7 @@ Auto_beam_engraver::create_beam_p ()
       /*
        watch out for stem tremolos and abbreviation beams
        */
-      if ((*stem_l_arr_p_)[i]->beam_l_)
+      if ((*stem_l_arr_p_)[i]->beam_l ())
        {
          return 0;
        }
@@ -327,14 +327,14 @@ 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 ();
          return;
        }
 
-      if (stem_l->beam_l_)
+      if (stem_l->beam_l ())
        {
          if (stem_l_arr_p_)
            junk_beam ();
index c14b5186e509cd78069d6301708038b67f33bc56..5992ea461455522ca4fa17bf50d877b6b6155042 100644 (file)
@@ -7,7 +7,7 @@
 */
 
 #include "axis-group-element.hh"
-#include "graphical-axis-group.hh"
+#include "axis-group-element.hh"
 #include "dimension-cache.hh"
 
 Link_array<Score_element>
@@ -24,8 +24,11 @@ Axis_group_element::elem_l_arr () const
     ugh. I know
   */
   Link_array<Score_element> r;
-  for (int i=0; i < elem_l_arr_.size (); i++)
-    r.push (dynamic_cast<Score_element*>(elem_l_arr_[i]));
+  for (SCM s = get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
+    {
+      SCM e=gh_car (s); 
+      r.push (unsmob_element (e));
+    }
       
   return r;
 }
@@ -36,7 +39,6 @@ Axis_group_element::get_children ()
   Link_array<Score_element> childs;
   Link_array<Score_element> elems = elem_l_arr ();
 
-  elems.concat (extra_elems_ );
   for (int i=0; i < elems.size (); i++) 
     {
       Score_element* e = elems[i];
@@ -49,69 +51,48 @@ Axis_group_element::get_children ()
   return childs;
 }
 
-void
-Axis_group_element::do_print() const
-{
-  Graphical_axis_group::do_print();
-}
-
 Axis_group_element::Axis_group_element()
 {
+  axes_[0] = (Axis)-1 ; 
+  axes_[1] = (Axis)-1 ;
+
+  set_elt_property ("elements", SCM_EOL);
   set_elt_property ("transparent", SCM_BOOL_T);
 }
 
 void
 Axis_group_element::set_axes (Axis a1, Axis a2)
 {
-  Graphical_axis_group::set_axes (a1,a2);
-  set_empty (a1 != X_AXIS && a2 != X_AXIS, X_AXIS);
-  set_empty (a1 != Y_AXIS && a2 != Y_AXIS, Y_AXIS);
-}
-
-
-void
-Axis_group_element::do_substitute_element_pointer (Score_element*o,
-                                                  Score_element*n)
-{
-  int i;
-  Graphical_element * go = o;
-  Graphical_element * gn = n;  
+  axes_[0] = a1 ; 
+  axes_[1] = a2 ;
+  if (a1 != X_AXIS && a2 != X_AXIS)
+    set_empty (X_AXIS);
+  if (a1 != Y_AXIS && a2 != Y_AXIS)
+    set_empty (Y_AXIS);
   
-  while ((i = elem_l_arr_.find_i (go))>=0)
-    elem_l_arr_.substitute (go,gn);
-
-  extra_elems_.substitute (o, n);
+  dim_cache_[a1]->set_callback(extent_callback);
+  dim_cache_[a2]->set_callback (extent_callback);
 }
 
 Interval
-Axis_group_element::extra_extent (Axis a )const
+Axis_group_element::extent_callback (Dimension_cache const *c) 
 {
-  Interval g;
-  Axis_group_element* urg = (Axis_group_element*)this;
-  urg->purge_extra ();         // Yeah yeah,  const correctness.
-  for (int i=0;  i < extra_elems_.size (); i++)
+  Axis a = c->axis ();
+  Axis_group_element * me
+    = dynamic_cast<Axis_group_element*> (c->element_l ()); 
+
+  Interval r;
+  for (SCM s = me->get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
     {
-      Interval ge = extra_elems_[i]->relative_coordinate (this, a)
-       + extra_elems_[i]->extent (a);
-      g.unite (ge);
-    }
-  return g;
-}
+      SCM e=gh_car (s); 
+      Score_element * se = SMOB_TO_TYPE (Score_element, e);
 
-Interval
-Axis_group_element::do_height () const
-{
-  Interval gag = Graphical_axis_group::extent (Y_AXIS);
-  gag.unite (extra_extent (Y_AXIS));
-  return gag;
-}
+      Interval dims = se->extent (a);
+      if (!dims.empty_b ())
+       r.unite (dims + se->relative_coordinate (me, a));
+    }
 
-Interval
-Axis_group_element::do_width () const
-{
-  Interval gag = Graphical_axis_group::extent (X_AXIS);
-  gag.unite (extra_extent (X_AXIS));
-  return gag;
+  return r;
 }
 
 
@@ -121,49 +102,31 @@ Axis_group_element::do_width () const
 void
 Axis_group_element::add_extra_element (Score_element *e)
 {
-  Link_array<Score_element> se;
-  while (e && e != this)
-    {
-      se.push (e);
-      e = dynamic_cast<Score_element*> (e->parent_l (Y_AXIS));
-    }
-
-  if (1)                       // e == this)
-    {
-      for (int i=0; i < se.size( ); i++) 
-       {
-         extra_elems_.push (se[i]);
-         add_dependency (se[i]);
-         se[i]->set_elt_property (("Axis_group_element::add_extra_element"), SCM_BOOL_T); // UGH GUH.
-       }
-      
-    }
+  add_element (e);
 }
 
-/*
-  UGH GUH
- */
+
 void
-Axis_group_element::purge_extra ()
+Axis_group_element::add_element (Score_element *e)
 {
-  for (int i=0; i < extra_elems_.size ();)
+  used_b_ =true;
+  e->used_b_ = true;
+  
+  for (int i = 0; i < 2; i++)
     {
-      Score_element *e = extra_elems_[i];
-      while (e && e != this)
-       {
-         e = dynamic_cast<Score_element*> (e->parent_l (Y_AXIS));
-       }
-      if (e != this)
-       extra_elems_.del (i);
-      else
-       i++;
+      if (!e->parent_l (axes_[i]))
+       e->set_parent (this, axes_[i]);
     }
+  set_elt_property ("elements",
+                   gh_cons (e->self_scm_,
+                            get_elt_property ("elements")));
+                            
+  assert (e->parent_l(Y_AXIS) == this || e->parent_l (X_AXIS) == this);
 }
 
-Interval
-Axis_group_element::extent (Axis a) const
-{
-  return Graphical_element::extent (a);
-}
-  
+
+
+
+
+
 
index 5068ecd0994f82243cf75c3f07b832aeb7f0e179..fdbcf9cf29b1431db65fe324438fa83f7f9637db 100644 (file)
 
 
 
-void
-Axis_group_item::OK() const
-{
-  Link_array<Score_element> elems = elem_l_arr ();
-  for (int i=0; i < elems.size(); i++) 
-    {
-      Item * it_l = dynamic_cast<Item*> (elems[i]);
-      assert (it_l);
-    }
-}
-
 void
 Axis_group_item::do_breakable_col_processing()
 {
+#if 0
   if (!breakable_b ()) // ugh should merge with Item code
     return;
 
@@ -45,12 +35,7 @@ Axis_group_item::do_breakable_col_processing()
        }
       while (flip(&j)!=LEFT);
     }
+#endif
   Item::do_breakable_col_processing();
 }
 
-void
-Axis_group_item::do_print() const
-{ 
-  Axis_group_element::do_print(); 
-  Item::do_print ();
-}
index 991cf10853f4dae15be17cb6e131057b74773a27..7af3118a1163f9ddb4efc3664cb0fcfc0e352a6b 100644 (file)
@@ -18,6 +18,7 @@
 void
 Axis_group_spanner::do_break_processing_if_unbroken()
 {
+#if 0
   Link_array<Score_element> elems = elem_l_arr ();
   Line_of_score *my_line = line_l();
   for (int i=0; i < elems.size(); i++) 
@@ -46,11 +47,13 @@ Axis_group_spanner::do_break_processing_if_unbroken()
        }
       
     }
+#endif
 }
 
 void
 Axis_group_spanner::do_break_processing()
 {
+  Spanner::do_break_processing ();
 
   bool breaking_self_b = ! Spanner::line_l();
   if (!breaking_self_b)  
@@ -60,6 +63,7 @@ Axis_group_spanner::do_break_processing()
       return;
     }
 
+#if 0
   break_into_pieces ();
   Link_array<Score_element> loose_elems = elem_l_arr ();
 
@@ -134,7 +138,8 @@ Axis_group_spanner::do_break_processing()
                  else
                    {
                      broken_item->set_elt_property ("transparent", SCM_BOOL_T);
-                     broken_item->set_empty (true);
+                     broken_item->set_empty (X_AXIS); // UGH.
+                     broken_item->set_empty (Y_AXIS);                
                    }
 
                }
@@ -153,20 +158,9 @@ Axis_group_spanner::do_break_processing()
     }
   
   Spanner::do_break_processing();
+#endif
 }
 
-void
-Axis_group_spanner::do_print() const
-{
-  Axis_group_element::do_print();
-
-  Spanner::do_print ();
-}
 
 
-Interval
-Axis_group_spanner::do_width () const
-{
-  return Spanner::do_width ();
-}
 
index ad6fb103f466574ef81865e8e4f6a8fee34f4e47..04214d4068f1d263ac824fff1e4cfd5d3e9d0da8 100644 (file)
@@ -85,7 +85,7 @@ Bar::do_pre_processing ()
     }
 
   if (type_str_ =="")
-    set_empty (true, X_AXIS);
+    set_empty (X_AXIS);
 }
   
 
index e98ab845527c6682b8b1ef57824b6cf4af690c45..1d1a70addff36b0a19ba6a42bec0fed9bd58ec70 100644 (file)
@@ -152,7 +152,7 @@ Beam_engraver::acknowledge_element (Score_element_info info)
   if (beam_p_)
     {
       Stem* stem_l = dynamic_cast<Stem *> (info.elem_l_);
-      if (!stem_l || stem_l->beam_l_)
+      if (!stem_l || stem_l->beam_l ())
        return;
 
 
index c489e8f6e74364d5a9d1bfec89c8936348381da4..0335ff72565218e592c032d95588e3cf6f1af069 100644 (file)
@@ -35,33 +35,45 @@ needs what, and what information should be available when.
 #include "stem.hh"
 #include "paper-def.hh"
 #include "lookup.hh"
+#include "group-interface.hh"
 
 Beam::Beam ()
 {
+  Group_interface g (this, "stems");
+  g.set_interface ();
+  
   slope_f_ = 0;
   left_y_ = 0;
   multiple_i_ = 0;
 }
 
+/*
+  TODO: Fix this class. This is wildly inefficient.
+ */
+Stem *
+Beam::stem (int i)const
+{
+  return Group_interface__extract_elements ((Beam*) this, (Stem*) 0, "stems")[i];
+}
+
+int
+Beam::stem_count ()const
+{
+  Group_interface gi (this, "stems");
+  return gi.count ();
+}
+
+
 void
 Beam::add_stem (Stem*s)
 {
-#if 0
-  /*
-    should figure out why this didn't work.
-
-    --hwn.
-   */
-  if (!stems_.size ())
-    {
-      set_parent (s, Y_AXIS);
-    }
-#endif
-  stems_.push (s);
+  Group_interface gi (this, "stems");
+  gi.add_element (s);
+  
   s->add_dependency (this);
 
-  assert (!s->beam_l_);
-  s->beam_l_ = this;
+  assert (!s->beam_l ());
+  s->set_elt_property ("beam", self_scm_);
 
   if (!spanned_drul_[LEFT])
     set_bounds (LEFT,s);
@@ -89,12 +101,12 @@ Beam::do_brew_molecule_p () const
   if (!sinfo_.size ())
     return mol_p;
   
-  Real x0 = stems_[0]->hpos_f ();
-  for (int j=0; j <stems_.size (); j++)
+  Real x0 = stem (0)->hpos_f ();
+  for (int j=0; j <stem_count (); j++)
     {
-      Stem *i = stems_[j];
-      Stem * prev = (j > 0)? stems_[j-1] : 0;
-      Stem * next = (j < stems_.size ()-1) ? stems_[j+1] :0;
+      Stem *i = stem (j);
+      Stem * prev = (j > 0)? stem (j-1) : 0;
+      Stem * next = (j < stem_count ()-1) ? stem (j+1) :0;
 
       Molecule sb = stem_beams (i, next, prev);
       Real  x = i->hpos_f ()-x0;
@@ -127,16 +139,16 @@ Beam::auto_knee (SCM gap, bool interstaff_b)
 {
   bool knee = false;
   int knee_y = 0;
-  Real internote_f = stems_[0]->staff_line_leading_f ()/2;
+  Real internote_f = stem (0)->staff_line_leading_f ()/2;
   if (gap != SCM_UNDEFINED)
     {
       int auto_gap_i = gh_scm2int (gap);
-      for (int i=1; i < stems_.size (); i++)
+      for (int i=1; i < stem_count (); i++)
         {
          bool is_b = (bool)(sinfo_[i].interstaff_f_ - sinfo_[i-1].interstaff_f_);
-         int l_y = (int)(stems_[i-1]->chord_start_f () / internote_f)
+         int l_y = (int)(stem (i-1)->chord_start_f () / internote_f)
            + (int)sinfo_[i-1].interstaff_f_;
-         int r_y = (int)(stems_[i]->chord_start_f () / internote_f)
+         int r_y = (int)(stem (i)->chord_start_f () / internote_f)
            + (int)sinfo_[i].interstaff_f_;
          int gap_i = r_y - l_y;
 
@@ -154,12 +166,12 @@ Beam::auto_knee (SCM gap, bool interstaff_b)
     }
   if (knee)
     {
-      for (int i=0; i < stems_.size (); i++)
+      for (int i=0; i < stem_count (); i++)
         {
-         int y = (int)(stems_[i]->chord_start_f () / internote_f)
+         int y = (int)(stem (i)->chord_start_f () / internote_f)
            + (int)sinfo_[i].interstaff_f_;
-         stems_[i]->set_direction ( y < knee_y ? UP : DOWN);
-         stems_[i]->set_elt_property ("dir-forced", SCM_BOOL_T);
+         stem (i)->set_direction ( y < knee_y ? UP : DOWN);
+         stem (i)->set_elt_property ("dir-forced", SCM_BOOL_T);
        }
     }
   return knee;
@@ -200,7 +212,7 @@ Beam::do_print () const
 void
 Beam::do_post_processing ()
 {
-  if (stems_.size () < 2)
+  if (stem_count () < 2)
     {
       warning (_ ("beam with less than two stems"));
       set_elt_property ("transparent", SCM_BOOL_T);
@@ -228,20 +240,15 @@ Beam::do_post_processing ()
   set_stemlens ();
 }
 
-void
-Beam::do_substitute_element_pointer (Score_element*o,Score_element*n)
-{
-  if (Stem * os = dynamic_cast<Stem*> (o))
-    stems_.substitute (os,
-                      dynamic_cast<Stem *> (n));
-}
 
+#if 0
 Interval
 Beam::do_width () const
 {
-  return Interval (stems_[0]->hpos_f (),
+  return Interval (stem (0)->hpos_f (),
                   stems_.top ()->hpos_f ());
 }
+#endif 
 
 Direction
 Beam::get_default_dir () const
@@ -252,9 +259,9 @@ Beam::get_default_dir () const
   count[UP]  = count[DOWN] = 0;
   Direction d = DOWN;
 
-  for (int i=0; i <stems_.size (); i++)
+  for (int i=0; i <stem_count (); i++)
     do {
-      Stem *s = stems_[i];
+      Stem *s = stem (i);
       int current = s->get_direction () 
        ? (1 + d * s->get_direction ())/2
        : s->get_center_distance ((Direction)-d);
@@ -313,9 +320,9 @@ void
 Beam::set_direction (Direction d)
 {
   Directional_spanner::set_direction (d);
-  for (int i=0; i <stems_.size (); i++)
+  for (int i=0; i <stem_count (); i++)
     {
-      Stem *s = stems_[i];
+      Stem *s = stem (i);
       s->set_elt_property ("beam-dir", gh_int2scm (d));
 
       SCM force = s->remove_elt_property ("dir-forced");
@@ -390,16 +397,16 @@ Beam::check_stemlengths_f (bool set_b)
 void
 Beam::set_steminfo ()
 {
-  if(!stems_.size ())
+  if(!stem_count ())
     return;
   
   assert (multiple_i_);
 
   int total_count_i = 0;
   int forced_count_i = 0;
-  for (int i=0; i < stems_.size (); i++)
+  for (int i=0; i < stem_count (); i++)
     {
-      Stem *s = stems_[i];
+      Stem *s = stem (i);
 
       s->set_default_extents ();
       if (s->invisible_b ())
@@ -416,9 +423,9 @@ Beam::set_steminfo ()
                                        + to_str (multiple_i_ <? stem_max));
     
   Real leftx = 0;
-  for (int i=0; i < stems_.size (); i++)
+  for (int i=0; i < stem_count (); i++)
     {
-      Stem *s = stems_[i];
+      Stem *s = stem (i);
       /*
        Chord tremolo needs to beam over invisible stems of wholes
       */
@@ -463,10 +470,10 @@ Beam::calculate_slope ()
       /*
        steep slope running against lengthened stem is suspect
       */
-      Real dx_f = stems_.top ()->hpos_f () - stems_[0]->hpos_f ();
+      Real dx_f = stem (stem_count () -1)->hpos_f () - stem (0)->hpos_f ();
 
       // urg, these y internote-y-dimensions
-      Real internote_f = stems_[0]->staff_line_leading_f ()/2;
+      Real internote_f = stem (0)->staff_line_leading_f ()/2;
 
       Real lengthened = paper_l ()->get_var ("beam_lengthened") / internote_f;
       Real steep = paper_l ()->get_var ("beam_steep_slope") / internote_f;
@@ -518,12 +525,12 @@ Beam::quantise_dy ()
   if (q == ly_symbol2scm ("none"))
     return;
 
-  Real interline_f = stems_[0]->staff_line_leading_f ();
+  Real interline_f = stem (0)->staff_line_leading_f ();
   Real internote_f = interline_f / 2;
   Real staffline_f = paper_l ()->get_var ("stafflinethickness");
   Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));;
 
-  Real dx_f = stems_.top ()->hpos_f () - stems_[0]->hpos_f ();
+  Real dx_f = stem (stem_count () -1 )->hpos_f () - stem (0)->hpos_f ();
 
   // dim(y) = internote; so slope = (y/internote)/x
   Real dy_f = dx_f * abs (slope_f_ * internote_f);
@@ -571,7 +578,7 @@ Beam::quantise_left_y (bool extend_b)
        hang       straddle   sit        inter      hang
    */
 
-  Real space = stems_[0]->staff_line_leading_f ();
+  Real space = stem (0)->staff_line_leading_f ();
   Real internote_f = space /2;
   Real staffline_f = paper_l ()->get_var ("stafflinethickness");
   Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));;
@@ -599,7 +606,7 @@ Beam::quantise_left_y (bool extend_b)
   // dim(left_y_) = internote
   Real dy_f = get_direction () * left_y_ * internote_f;
 
-  Real beamdx_f = stems_.top ()->hpos_f () - stems_[0]->hpos_f ();
+  Real beamdx_f = stem (stem_count () -1)->hpos_f () - stem (0)->hpos_f ();
   Real beamdy_f = beamdx_f * slope_f_ * internote_f;
 
   Array<Real> allowed_position;
@@ -659,12 +666,12 @@ void
 Beam::set_beaming (Beaming_info_list *beaming)
 {
   Direction d = LEFT;
-  for (int i=0; i  < stems_.size (); i++)
+  for (int i=0; i  < stem_count (); i++)
     {
       do
        {
-         if (stems_[i]->beams_i_drul_[d] < 0)
-           stems_[i]->beams_i_drul_[d] = beaming->infos_.elem (i).beams_i_drul_[d];
+         if (stem (i)->beams_i_drul_[d] < 0)
+           stem (i)->beams_i_drul_[d] = beaming->infos_.elem (i).beams_i_drul_[d];
        }
       while (flip (&d) != LEFT);
     }
@@ -674,18 +681,21 @@ Beam::set_beaming (Beaming_info_list *beaming)
 void
 Beam::do_add_processing ()
 {
-  for (int i=0; i < stems_.size () ; i++) 
+  for (int i=0; i < stem_count () ; i++) 
     {
       Direction d = LEFT;
       do {
-       multiple_i_ = multiple_i_ >? stems_[i]->beams_i_drul_[d];
+       multiple_i_ = multiple_i_ >? stem (i)->beams_i_drul_[d];
       } while ((flip (&d)) != LEFT);
     }
 
-  if (stems_.size ())
+  /*
+    Why?
+   */
+  if (stem_count ())
     {
-      stems_[0]->beams_i_drul_[LEFT] =0;
-      stems_.top()->beams_i_drul_[RIGHT] =0;
+      stem (0)->beams_i_drul_[LEFT] =0;
+      stem (stem_count () -1)->beams_i_drul_[RIGHT] =0;
     }
 }
 
@@ -718,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 6033cfe926b4dd0190dbc9233c06abfe2f63af05..ca967f0ee31008d67678bb3ffc9e38e50f2ae57d 100644 (file)
@@ -6,6 +6,7 @@
   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
       Jan Nieuwenhuizen <janneke@gnu.org>
 */
+#include "dimension-cache.hh"
 
 #include "bow.hh"
 #include "debug.hh"
@@ -51,13 +52,14 @@ Bow::center () const
    Ugh.  Control points are too crude measures.
  */
 Interval
-Bow::do_height () const
+Bow::dim_callback (Dimension_cache const* c) 
 {
   Interval iv;
-  Array<Offset> c (get_controls());
-  for (int i=0; i < c.size (); i++)
+  Bow * b = dynamic_cast<Bow*> (c->element_l ());
+  Array<Offset> p (b->get_controls());
+  for (int i=0; i < p.size (); i++)
     {
-      Real y = c[i][Y_AXIS];
+      Real y = p[i][Y_AXIS];
       iv.unite (Interval (y,y));
     }
   return iv;
@@ -92,7 +94,7 @@ Bow::get_encompass_offset_arr () const
 {
   Array<Offset> offset_arr;
   offset_arr.push (Offset (dx_f_drul_[LEFT], dy_f_drul_[LEFT]));
-  offset_arr.push (Offset (do_width ().length () + dx_f_drul_[RIGHT],
+  offset_arr.push (Offset (spanner_length () + dx_f_drul_[RIGHT],
                      dy_f_drul_[RIGHT]));
                      
   return offset_arr;
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 1d6c6cb89103860179deb40d423f29eb09afc148..c4b6963bbcbfeb359ea169c6b45e9dfd3ba12f50 100644 (file)
@@ -29,15 +29,17 @@ Break_align_item::do_pre_processing()
     align_dir_ = RIGHT;
   
   flip (&align_dir_);
-  sort_elements ();
+
   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 452fda6c671702c8025f392587f8a35d0a373e8b..2ec5e9c56904abb83a8b052d0795719514f838c0 100644 (file)
@@ -11,6 +11,7 @@
 /*
   CLEAN ME UP.
  */
+
 #include <ctype.h>
 #include "bar.hh"
 #include "clef-engraver.hh"
index 32a7d932739da3f72ac4ae5478bd42f60fed661a..838d06a808009c198c04437315f1b7422227c49a 100644 (file)
@@ -15,6 +15,7 @@
 #include "text-item.hh"
 #include "paper-score.hh"
 #include "dimension-cache.hh"
+#include "staff-side.hh"
 
 void
 Clef_item::do_pre_processing()
@@ -30,7 +31,7 @@ Clef_item::do_pre_processing()
   if (style == "transparent")
     {
       set_elt_property ("transparent", SCM_BOOL_T);
-      set_empty (true, X_AXIS);
+      set_empty (X_AXIS);
     }
 }
 
@@ -53,22 +54,21 @@ Clef_item::do_add_processing ()
       Text_item *g =0;
 
       SCM octave_dir = remove_elt_property ("octave-dir");
-      if (octave_dir != SCM_UNDEFINED)
+      if (isdir_b (octave_dir))
        {
-         Direction d = Direction (gh_scm2int (octave_dir));
          g = new Text_item;
+         Side_position_interface spi (g);
+         spi.set_axis (Y_AXIS);
+         
          pscore_l_->typeset_element (g);
       
          g->text_str_ = "8";
          g->set_elt_property ("style", gh_str02scm ("italic"));
          g->set_parent (this, Y_AXIS);
          g->set_parent (this, X_AXIS);   
-
+         g->set_elt_property ("direction", octave_dir);
+         
          add_dependency (g);   // just to be sure.
-
-         Real r = do_height ()[d] - g->extent (Y_AXIS)[-d];
-         g->dim_cache_[Y_AXIS]->set_offset (r);
-
          SCM my_vis = get_elt_property ("visibility-lambda");
          if (my_vis != SCM_UNDEFINED)
            g->set_elt_property ("visibility-lambda", my_vis);
index 47300e660ddf5b997ab27fa36030e4601aff4087..ca44c30e9d19c35a9c6f765b477a2a840b2debd7 100644 (file)
@@ -8,7 +8,7 @@ Real
 calc_interstaff_dist (Item const *item, Spanner const *span)
 {
   Real interstaff = 0.0; 
-  Graphical_element *common = item->common_refpoint (span, Y_AXIS);
+  Score_element *common = item->common_refpoint (span, Y_AXIS);
   Align_element * align = dynamic_cast<Align_element*> (common);
   if (align && align->axis() == Y_AXIS)
     {
@@ -18,18 +18,18 @@ calc_interstaff_dist (Item const *item, Spanner const *span)
 
       interstaff = align->threshold_interval_[MIN];
 
-      Graphical_element const * span_refpoint = span;
+      Score_element const * span_refpoint = span;
       while (span_refpoint->parent_l  (Y_AXIS) != common)
        span_refpoint = span_refpoint->parent_l (Y_AXIS);
 
-      Graphical_element const * note_refpoint = item;
+      Score_element const * note_refpoint = item;
       while (note_refpoint->parent_l (Y_AXIS) != common)
        note_refpoint = note_refpoint->parent_l (Y_AXIS);
 
       int span_prio =
-       align->get_priority ((Score_element*) dynamic_cast<Score_element const*> (span_refpoint));
+       align->get_count ((Score_element*) dynamic_cast<Score_element const*> (span_refpoint));
       int item_prio =
-       align->get_priority ((Score_element*) dynamic_cast<Score_element  const *> (note_refpoint));
+       align->get_count ((Score_element*) dynamic_cast<Score_element  const *> (note_refpoint));
 
       /*
        our staff is lower -> interstaff *= -1
index b7cf04207ab51be2a3d77eaf46161421b7608f9a..aacf58aadc0cc5ed7b115a1ba268968e814c89e8 100644 (file)
@@ -8,17 +8,18 @@
 
 #include "dimension-cache.hh"
 #include "parray.hh"
-#include "graphical-element.hh"
+#include "score-element.hh"
+
 
 Dimension_cache::Dimension_cache (Dimension_cache const &d)
 {
   init();
   callback_l_ = d.callback_l_;
-  empty_b_ = d.empty_b_;
   basic_offset_ = d.basic_offset_;
   extra_offset_ = d.extra_offset_;
   off_valid_b_ = d.off_valid_b_;
   off_callbacks_ = d.off_callbacks_;
+  parent_l_ = d.parent_l_;  
 }
 
 Dimension_cache::Dimension_cache ()
@@ -38,7 +39,6 @@ Dimension_cache::init()
   dim_.set_empty ();
   parent_l_ =0;
   valid_b_ = false;
-  empty_b_ = false;
   off_valid_b_ = false;
 }
 
@@ -127,38 +127,29 @@ Dimension_cache::common_refpoint (Dimension_cache const* s) const
   return (Dimension_cache*) common;
 }
 
-
-
-void
-Dimension_cache::set_empty (bool b)
+Interval
+Dimension_cache::point_dimension_callback (Dimension_cache const* )
 {
-  if (empty_b_ != b)
-    {
-      empty_b_ = b;
-      if (!empty_b_)
-       invalidate ();
-    }
-}  
+  return Interval (0,0);
+}
 
 Interval
 Dimension_cache::get_dim () const
 {
   Interval r;
-  if (empty_b_)
+  Dimension_cache *nc = ((Dimension_cache*)this);
+  if (!callback_l_)
     {
-      r.set_empty ();
-      return r;
+      nc->dim_.set_empty ();
     }
-      
-  if (!valid_b_)
+  else if (!valid_b_)
     {
-      Dimension_cache *nc = ((Dimension_cache*)this);
+
       nc->dim_= (*callback_l_ ) (nc);
       nc->valid_b_ = true;
     }
 
   r=dim_;
-
   return r;
 }
 
index 1ef4574bd9536a0f3be262159150b4029b71dec7..eb6b471fc6abd0ed1d79d0f207f7377e5aae3289 100644 (file)
@@ -1,4 +1,5 @@
 #include "directional-spanner.hh"
+#include "offset.hh"
 
 Direction
 Directional_spanner::get_default_dir() const
@@ -13,7 +14,7 @@ Directional_spanner::do_pre_processing()
     set_direction (get_default_dir());
 }
 
-
+#if 0
 Offset
 Directional_spanner::center () const
 {
@@ -21,3 +22,4 @@ Directional_spanner::center () const
   Offset o (w/2, 0);  
   return o;
 }
+#endif
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 8eda51a6d2fbea9720a1a57cda547e9c78e92430..6fc996328c41064c9939b7f6b543612ef7368ef0 100644 (file)
@@ -22,7 +22,8 @@ Dots::do_post_processing ()
   if (!dots_i_)
     {
       set_elt_property ("transparent", SCM_BOOL_T);
-      set_empty (true, X_AXIS, Y_AXIS);
+      set_empty (X_AXIS);
+      set_empty (Y_AXIS);
     }
   else
     {
index 0df1e5085acb07836453f30bc07ee7fb2d64b6ca..9404eb1c691a3e30cab41552891ee57ad046b100 100644 (file)
@@ -3,12 +3,12 @@
 
 // thanks to GDBs wonderful casting abilities, we need these:
 Item*
-to_item (Graphical_element* g)
+to_item (Score_element* g)
 {
   return dynamic_cast<Item*>(g);
 }
 Spanner*
-to_spanner (Graphical_element*g)
+to_spanner (Score_element*g)
 {
   return dynamic_cast<Spanner*>(g);
 }
index d45ea19b34bcc0b36aec2dbc4dfc82ea7ee93091..172f26968f7fc03228a85f11f673ab68f11196e8 100644 (file)
@@ -82,15 +82,15 @@ Grace_position_engraver::do_pre_move_processing ()
   */
   if (align_l_ && !align_l_->supported_b ())
     {
-      Graphical_element * elt = align_l_->parent_l (X_AXIS);
+      Score_element * elt = align_l_->parent_l (X_AXIS);
       if (elt)
        return;
 
       warning (_("Unattached grace notes.  Attaching to last musical column."));
       Axis_group_element * ae = dynamic_cast<Axis_group_element*> (elt);
-      if (ae)
+      /*      if (ae)
        ae->remove_element (align_l_);
-      else if (elt)
+       else if (elt)*/
        align_l_->set_parent (0, X_AXIS);
       last_musical_col_l_->add_element (align_l_);
     }
diff --git a/lily/group-interface.cc b/lily/group-interface.cc
new file mode 100644 (file)
index 0000000..e9b79ee
--- /dev/null
@@ -0,0 +1,53 @@
+/*   
+  group-interface.cc --  implement Group_interface
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+#include "group-interface.hh"
+#include "score-element.hh"
+
+Group_interface::Group_interface (Score_element const* e)
+{
+  elt_l_ = (Score_element*)e;
+  name_ = "elements";
+}
+
+
+Group_interface::Group_interface (Score_element const *e, String s)
+{
+  elt_l_ =(Score_element*)e;
+  name_ = s;
+} 
+bool
+Group_interface::supports_interface_b () 
+{
+  SCM el = elt_l_->get_elt_property (name_);
+
+  return el == SCM_EOL || gh_pair_p (el);
+}
+
+
+void
+Group_interface::add_element (Score_element*p) 
+{
+  elt_l_->set_elt_property (name_,
+                           gh_cons (p->self_scm_, elt_l_->get_elt_property (name_)));
+}
+
+int
+Group_interface::count ()
+{
+  return scm_ilength (elt_l_->get_elt_property (name_));
+}
+
+void
+Group_interface::set_interface ()
+{
+  if (!supports_interface_b ())
+    {
+      elt_l_->set_elt_property (name_, SCM_EOL);
+    }
+}
index 9ea5c23de1d5366634f0af97581f3e69396b59bf..99293896dede11aadd21d668849e43e2379950ef 100644 (file)
@@ -14,6 +14,7 @@
 
 Hara_kiri_group_spanner::Hara_kiri_group_spanner()
 {
+  set_elt_property ("items-worth-living", SCM_EOL);
   set_axes(Y_AXIS,Y_AXIS);
 }
 
@@ -21,13 +22,16 @@ void
 Hara_kiri_group_spanner::add_interesting_item (Item* n)
 {
   add_dependency (n);
-  interesting_items_.push (n);
+  set_elt_property ("items-worth-living",
+                   gh_cons (n->self_scm_,
+                            get_elt_property ("items-worth-living")));
 }
 
 void 
 Hara_kiri_group_spanner::do_post_processing ()
 {
-  if (!interesting_items_.empty ())
+  SCM worth = get_elt_property ("items-worth-living");
+  if (worth != SCM_EOL && worth != SCM_UNDEFINED)
     return;
 
   Link_array<Score_element> childs = get_children ();
@@ -38,24 +42,13 @@ Hara_kiri_group_spanner::do_post_processing ()
       if ( line_l () != s->line_l ())
        programming_error ("Killing other children too");
       s->set_elt_property ("transparent", SCM_BOOL_T);
-      s->set_empty (true, X_AXIS, Y_AXIS);
+      s->set_empty (X_AXIS);
+      s->set_empty (Y_AXIS);
 
     }
-  set_empty (true);
-}
-
-void
-Hara_kiri_group_spanner::do_substitute_element_pointer (Score_element*o, Score_element*n)
-{
-  Axis_group_spanner::do_substitute_element_pointer (o,n);
-  if (Item *it = dynamic_cast<Item *> (o))
-    interesting_items_.substitute (it, dynamic_cast<Item *> (n));
+  set_empty (X_AXIS);
+  set_empty (Y_AXIS);  
 }
 
 
-void
-Hara_kiri_group_spanner::do_print () const
-{
-  Axis_group_spanner::do_print ();
-}
 
index ff8dddf6f6121704cf406ae1bab1ba2198e3a7ac..f97b7c6162f4b6517445c977106275730eaa357d 100644 (file)
   document usage of this.
  */
 class Align_element : public virtual Axis_group_element {
-
-  /*
-   ugh. JUNKME
-
-  */
-  Hash_table<Score_element*,int> priority_i_hash_;
 public:
   Interval threshold_interval_ ;
 
@@ -49,20 +43,11 @@ public:
   Direction align_dir_;
   
   Axis axis () const;
-  Score_element * center_l_;
   
   Align_element ();
   void set_axis (Axis);
-  void add_element (Score_element*);
-  void add_element_priority (Score_element*, int);
-  bool contains_b (Score_element const*) const;
-
-  Score_element *get_elt_by_priority (int) const;
-  int get_priority (Score_element const*) const;
+  int get_count (Score_element*)const;
 protected:
-  void sort_elements ();
-  virtual void do_print() const;
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
   virtual void do_post_processing() ;
   virtual void do_pre_processing ();
   virtual void do_side_processing ();
index ab81872b52b1b56afec7c9a947299e89eea552e4..270bcdb03e2b4c91dd2e8ddf79eef9d304181938 100644 (file)
 #define AXIS_GROUP_ELEMENT_HH
 
 #include "score-element.hh"
-#include "graphical-axis-group.hh"
+
 
 /** 
   Treat a group of elements a unity in either or both axis sense .
   This is a wrapper around Axis_group_administration
   */
-class Axis_group_element : public virtual Score_element,
-                          public virtual Graphical_axis_group
+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 ();
+
+
 
 protected:
-  virtual void do_print() const;
   virtual Link_array<Score_element> get_extra_dependencies() const;
-  void purge_extra ();
-
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
   virtual Link_array<Score_element> elem_l_arr() const;
+  static Interval extent_callback (Dimension_cache const*);
   
-  virtual Interval do_height () const;
-  virtual Interval do_width () const;
 
 
   Interval extra_extent (Axis a) const;
-
 public:
-  /**
-    Override Graphical_axis_group::extent: make sure that
-    Graphical_element::extent() is used as the public entry point.  */
-  Interval extent (Axis a) const;
+  // keep array in order.
+  bool ordered_b_;             
+  Axis axes_[2];
+    
+  Interval my_extent (Axis) const;
+
+
+
+  bool contains_b (Score_element const *) const;
+  void add_element (Score_element*);
 
   /**
      add an element that only influences size, but does not have  X/Y parent
@@ -51,9 +53,9 @@ public:
 
 
   Axis_group_element ();
-  virtual void set_axes (Axis,Axis);
+  void set_axes (Axis,Axis);
 
-  virtual Link_array<Score_element> get_children ();
+  Link_array<Score_element> get_children ();
 };
 
 #endif // AXIS_GROUP_ELEMENT_HH
index b3701a15348025759f647929fec696386f9a3c88..8f59c298a2b625196d7fd9fb6a818c2dba9e7f1f 100644 (file)
@@ -21,8 +21,6 @@ class Axis_group_item : public virtual Axis_group_element,
                        public virtual Item {
 protected:
   virtual void do_breakable_col_processing();
-  void OK() const;
-  virtual void do_print() const;
 public:
   VIRTUAL_COPY_CONS(Score_element);
 };
index 0de8cc51efb3a6a2eaed60863454b14d2e21eadd..f81b7354c766fb4eded61dfc67dcc26743fd1585 100644 (file)
@@ -22,9 +22,6 @@ class Axis_group_spanner : public virtual Axis_group_element,
   void do_break_processing_if_unbroken();
 protected:
   virtual void do_break_processing();
-  virtual void do_print() const;
-  virtual Interval do_width () const;
-
 public:
   VIRTUAL_COPY_CONS(Score_element);
 };
index de68f6f99ca4936d8d0597da61756bf1e68e22ad..cfcc305e65fb45d43524f9b7d4c82611248d7e0a 100644 (file)
@@ -28,14 +28,10 @@ slope_quantisation: 'none, 'normal or 'traditional
 */
 class Beam : public Directional_spanner  {
 public:
-  /** 
-    The beams should be prevented to conflict with the stafflines, 
-    especially at small slopes.
-    */
-  enum Quantisation { NONE, NORMAL, TRADITIONAL };
-  enum Dir_algorithm { /* DOWN=-1, UP=1, */ MAJORITY=2, MEAN, MEDIAN };
-
-  Link_array<Stem> stems_;
+
+  int stem_count ()const;
+  Stem * stem (int )const;
+
   /**
      the slope of the beam in (staffpositions) per (X-dimension, in PT).
      UGH. standardise this for once and for all.
@@ -61,7 +57,6 @@ public:
   VIRTUAL_COPY_CONS(Score_element);
 
 protected:
-  virtual Interval do_width () const;    
   Offset center () const;
   Direction get_default_dir () const;
   void set_direction (Direction);
@@ -71,7 +66,6 @@ protected:
   
   virtual void do_pre_processing ();
   virtual void do_post_processing ();
-  virtual void do_substitute_element_pointer (Score_element*, Score_element*);
   virtual void do_add_processing ();
   virtual void do_print() const;
   virtual Molecule*do_brew_molecule_p () const;
index 58f7d5fb2cd552888afd5a0d7e3d277c167248dc..da2e7a3f1dde7273dee23b66f49a1bde966d9635 100644 (file)
@@ -33,7 +33,7 @@ protected:
   //  virtual Interval do_width () const;    
   Array<Offset> get_controls () const;
   virtual Array<Offset> get_encompass_offset_arr () const;
-  virtual Interval do_height () const;
+  static Interval dim_callback (Dimension_cache const*);
   Drul_array<Interval> curve_extent_drul () const;
 
   Drul_array<Real> dy_f_drul_;
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 fc23932284e3b78a5d001024c8eb2ecb3c84231a..0a61bc2d74a79ddbbcd0eb2ff40356a492ce7723 100644 (file)
@@ -25,10 +25,6 @@ typedef Real (*Offset_cache_callback)(Dimension_cache const *);
 class Dimension_cache
 {
   bool valid_b_;
-  /** Is this element dimensionless?.
-    This is private to guarantee correctness of the cache
-   */
-  bool empty_b_;
   Interval dim_;
   /**
     The offset wrt. to the center of #parent_l_#
@@ -36,18 +32,19 @@ class Dimension_cache
 
   Real extra_offset_;
   Real basic_offset_;
-  
   bool off_valid_b_;
 
-  
-  Graphical_element *elt_l_;
-  Dim_cache_callback callback_l_;
-  friend class Graphical_element;
+  Score_element *elt_l_;
+  friend class Score_element;
 
   void init ();
 public:
   Array<Offset_cache_callback> off_callbacks_;
-  
+  /**
+     What to call to find extent.  Nil means empty. 
+   */
+  Dim_cache_callback callback_l_;
+  static Interval point_dimension_callback (Dimension_cache const* );
   Axis axis () const;
   Real get_offset () const;
   void set_callback (Dim_cache_callback);
@@ -56,7 +53,7 @@ public:
   void set_offset_callback (Offset_cache_callback);
   Dimension_cache * parent_l_;
 
-  Graphical_element *element_l () const { return elt_l_; }
+  Score_element *element_l () const { return elt_l_; }
 
   void invalidate ();
   void invalidate_dependencies ();
@@ -81,7 +78,7 @@ public:
   void set_offset (Real);
 
   bool valid_b () const { return valid_b_; }
-  bool empty_b() const { return empty_b_; }
+  bool empty_b() const;
   Interval get_dim () const;
 };
 
index e268b20b925e79238a8e708b07a62caaf0a5a343..779a5ed9f4eee8572bef6988aaf7405193372379 100644 (file)
@@ -17,7 +17,7 @@
 class Directional_spanner : public Spanner, public Directional_element {
 public:
   /// offset of "center" relative to left-column/0-pos of staff
-  virtual Offset center() const;
+  //  virtual Offset center() const;
   virtual Direction get_default_dir() const;
   VIRTUAL_COPY_CONS(Score_element);
 protected:
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
index 3da4095ebf88e39b3c4a1051168a75513f587f9d..e0268198e8c6c49b3da2b8e3b6f72cc16efce28f 100644 (file)
 class Extender_spanner : public Directional_spanner
 {
 public:
-Extender_spanner ();
-  Offset center () const;  
+  Extender_spanner ();
   void set_textitem (Direction, Item*);
 
 protected:
   virtual Molecule* do_brew_molecule_p () const;
-  Interval do_height () const;
-
   void do_post_processing ();
  
   VIRTUAL_COPY_CONS (Score_element);
index eeb2582688e929c131373ee4c192b70f2301383f..eab17f40b730726ca6a76d04739b411208ce6211 100644 (file)
 #include "lily-proto.hh"
 #include "interval.hh"
 #include "virtual-methods.hh"
+#error
+
 
 /** The 2d geometric aspects of a score-element.
   */
 class Graphical_element 
 {
-  void init ();
-public:
-  Dimension_cache *dim_cache_[NO_AXES];
-
-  /**
-     Set this if anyone points to me, or if I point to anyone.
-   */
-  bool used_b_;
-  
-  char const * name () const;
-  /**
-     Set empty in direction a1 and a2.  If an argument is NO_AXES, it is ignored.
-   */
-  void set_empty (bool b, Axis a1 = NO_AXES, Axis a2 = NO_AXES);
-  bool empty_b (Axis a1);
-  Graphical_element ();
-  Graphical_element (Graphical_element const&);
-  virtual ~Graphical_element ();
-  
-  void invalidate_cache (Axis);
-  Interval extent (Axis) const;
-  /**
-    translate the symbol.
-    */
-  void translate (Offset);
-  /**
-    translate in one direction
-    */
-    
-  void translate_axis (Real, Axis);
-
-  Real relative_coordinate (Graphical_element const* refp, Axis) const;
-  /**
-    Find the group-element which has both #this# and #s#
-   */
-  Graphical_element*common_refpoint (Graphical_element const* s, Axis a) const;
-  Graphical_element*common_refpoint (Link_array<Graphical_element> elems, Axis a) const;
-
-  /**
-     Set the  parent refpoint of THIS to E
-   */
-  void set_parent (Graphical_element* e, Axis);
-  
-  Graphical_element *parent_l (Axis a) const;
-  
-  virtual void do_print () const;
-  virtual void print () const;  
 };
 
 #endif // GRAPHICAL_ELEMENT_HH
diff --git a/lily/include/group-interface.hh b/lily/include/group-interface.hh
new file mode 100644 (file)
index 0000000..289ba91
--- /dev/null
@@ -0,0 +1,57 @@
+/*   
+  group-interface.hh -- declare Group_interface
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#ifndef GROUP_INTERFACE_HH
+#define GROUP_INTERFACE_HH
+
+#include "lily-proto.hh"
+#include "string.hh"
+#include "lily-guile.hh"
+#include "smobs.hh"
+
+struct Group_interface
+{
+  Score_element * elt_l_;
+  String name_;
+public:
+  Group_interface (Score_element const*);
+  Group_interface (Score_element const*, String);
+  int count ();
+  bool supports_interface_b ();
+  void set_interface ();
+  void add_element (Score_element*);
+};
+
+/*
+  template<class T>
+  Link_array<T> Group_interface__extract_elements (T *, String name);
+*/
+template<class T>
+Link_array<T>
+Group_interface__extract_elements (Score_element const *elt, T *, String name)
+{
+  Link_array<T> arr;
+
+  for (SCM s = elt->get_elt_property (name); gh_pair_p (s); s = gh_cdr (s))
+    {
+      SCM e = gh_car (s);
+      assert (SMOB_IS_TYPE_B(Score_element,e));
+      Score_element* se = SMOB_TO_TYPE(Score_element, e);
+      arr.push (dynamic_cast<T*> (se));
+    }
+
+  arr.reverse ();
+  return arr;
+}
+
+
+
+
+#endif /* GROUP_INTERFACE_HH */
+
index 7479e90b29deb4d2f5f2d1942645e0c1eef32887..a6245449dd4046e4bda8e763244e7acc9638be80 100644 (file)
@@ -25,11 +25,6 @@ public:
   void add_interesting_item (Item* n);
 protected:
   VIRTUAL_COPY_CONS(Score_element);
-
-  virtual void do_substitute_element_pointer (Score_element*, Score_element*);
-  virtual void do_print ()const;
-
-  Link_array<Item> interesting_items_;
 };
 
 
index e1316252c9612d1622dde24dc6dd10f0e114fd2e..d7a15b6c00c11f5795c57a5e8c482d032cb7da7c 100644 (file)
@@ -22,7 +22,6 @@ class Hyphen_spanner : public Directional_spanner
 {
 public:
 Hyphen_spanner ();
-  Offset center () const;  
   void set_textitem (Direction, Item*);
 
 protected:
index be7d981d66c325ef4bf8561152dfddf77b1db7de..1c6135d999cbdbb3ff5fb1b187a18ac4a4893d8c 100644 (file)
@@ -46,6 +46,7 @@ public:
 
   /// I am really to be broken?
   bool breakable_b () const;
+  bool broken_b () const;
   bool broken_original_b () const;
   
   Direction break_status_dir () const;
@@ -65,8 +66,7 @@ public:
 protected:
   virtual void do_breakable_col_processing();
   virtual void handle_prebroken_dependencies();
-  virtual void do_print() const;
-  virtual void handle_prebroken_dependents ();
+  //virtual void handle_prebroken_dependents ();
 
   void copy_breakable_items();
 };
index 0970b575ddbfe86144a212e3dcc475bd53689a00..fae4e4d39827bde6f7f62edec2cf78fe337dd684 100644 (file)
@@ -95,8 +95,6 @@ struct Font_metric;
 struct General_script_def;
 struct Global_translator;
 struct Grace_align_item;
-struct Graphical_axis_group;
-struct Graphical_element;
 struct Hara_kiri_group_spanner;
 struct Hara_kiri_line_group_engraver;
 struct Head_column;
index 6d0bfa66342c6f705fe6ea92118c7f116092a774..a6b937a13fa4c37a562e008d35ae5b766a91dc55 100644 (file)
@@ -15,7 +15,6 @@
 class Line_of_score : public Axis_group_spanner, public Super_element
 {
 public:
-  Link_array<Paper_column> cols_;
   int rank_i_;
   
   Line_of_score();
@@ -23,15 +22,14 @@ public:
   /// is #c# contained in #*this#?
   bool contains_b (Paper_column const *c) const;
     
-  Line_of_score * set_breaking (Array<Column_x_positions> const&, int j);
   static int compare (Line_of_score* const &,Line_of_score* const &);
 
-  void output_all (bool last_line);
+  void break_into_pieces (Array<Column_x_positions> const&);
+  void output_lines ();
+  void output_line (bool last_line);
   void add_column (Paper_column*);
   
 protected:
-  virtual void do_substitute_element_pointer (Score_element*, Score_element*);
-  virtual Link_array<Score_element> get_extra_dependencies () const;
   virtual void do_print() const;
   VIRTUAL_COPY_CONS(Score_element);
 };
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 3becb118748a67fbc305a187bc724a648a4a74fb..308ff1c1eb5a17860a7a8aa0de44a829d1727e96 100644 (file)
@@ -25,7 +25,7 @@ protected:
   Molecule make_molecule () const;
 
   
-  virtual Interval do_width () const;
+  static  Interval dim_callback (Dimension_cache const*);
   virtual void do_pre_processing();
   virtual Molecule* do_brew_molecule_p() const;
 };
index 7fad9b8b3295d2ad7a732e057891c57dbc8b5308..3d33f133bcc633800b5045c5597cf824c1d51a52 100644 (file)
@@ -28,6 +28,9 @@ public:
   Paper_def *paper_l_;
 
   /// the columns, ordered left to right
+  /*
+    UGH. MOVE INTO LINE_OF_SCORE ?!
+   */
   Link_array<Paper_column> col_l_arr_;
 
   Paper_outputter *outputter_l_;  
@@ -35,6 +38,8 @@ public:
   
   Paper_score ();
 
+  void fixup_refpoints ();
+
 
   /// add to bottom of pcols
   void add_column (Paper_column*);
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 2f770ba431dd479eb3abd6fb9f86e9fa93437098..f5a26a030f5a8c63ccd191c0378394c1a2113d19 100644 (file)
@@ -9,8 +9,8 @@
 
 #include "parray.hh"
 #include "virtual-methods.hh"
-#include "graphical-element.hh"
 #include "lily-guile.hh"
+#include "lily-proto.hh"
 #include "smobs.hh"
 
 typedef void (Score_element::*Score_element_method_pointer) (void);
@@ -34,7 +34,7 @@ Boolean (true iff defined)
  transparent -- do not calc. output
 
 */
-class Score_element : public virtual Graphical_element {
+class Score_element  {
   /**
      properties specific for this element. Destructor will not call
      scm_unprotect, so as to allow more flexible GC arrangements.  The
@@ -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:
@@ -116,9 +116,7 @@ protected:
   int dependency_size () const;
   
   virtual void output_processing ();
-  virtual Interval do_height () const;
-  virtual Interval do_width () const;
-
+  static Interval molecule_extent (Dimension_cache const*);
 
   /// do printing of derived info.
   virtual void do_print () const;
@@ -136,39 +134,60 @@ 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 void handle_broken_dependencies ();
-  virtual void handle_prebroken_dependencies ();
-  virtual void handle_prebroken_dependents ();
-  virtual void handle_broken_dependents ();
+
   virtual Link_array<Score_element> get_extra_dependencies () const;
 
   static Interval dim_cache_callback (Dimension_cache const*);
 public:
+  virtual void handle_broken_dependencies ();
+  virtual void handle_prebroken_dependencies ();
+
 
   DECLARE_SMOBS;
-};
 
+  void init ();
+
+public:
+  Dimension_cache *dim_cache_[NO_AXES];
+
+  /**
+     Set this if anyone points to me, or if I point to anyone.
+   */
+  bool used_b_;
+  
+  char const * name () const;
+  /**
+     Set empty in direction A.
+   */
+  void set_empty (Axis a);
+  bool empty_b (Axis a) const;
+  void invalidate_cache (Axis);
+  Interval extent (Axis) const;
+  /**
+    translate in one direction
+    */
+    
+  void translate_axis (Real, Axis);
+
+  Real relative_coordinate (Score_element const* refp, Axis) const;
+  /**
+    Find the group-element which has both #this# and #s#
+   */
+  Score_element*common_refpoint (Score_element const* s, Axis a) const;
+  Score_element*common_refpoint (Link_array<Score_element> elems, Axis a) const;
+
+  /**
+     Set the  parent refpoint of THIS to E
+   */
+  void set_parent (Score_element* e, Axis);
+  
+  Score_element *parent_l (Axis a) const;
+  void fixup_refpoint ();
+};
 
-template<class T>
-void
-substitute_element_array (Link_array<T> &arr, Line_of_score * to)
-{
-  Link_array<T> newarr;
-  for (int i =0; i < arr.size (); i++)
-    {
-      T * t = arr[i];
-      if (t->line_l () != to)
-       {
-         t = dynamic_cast<T*> (t->find_broken_piece (to));
-       }
-      
-      if (t)
-       newarr.push (t);
-    }
-  arr = newarr;
-}
+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 5f4f7e9d020d7c9f4eeeeaaf38040280fa994089..059a3ae7c8c4d1a09b671126b8048de63bca6e91 100644 (file)
 
 #include "spanner.hh"
 
-
 class Separating_group_spanner : public Spanner
 {
-  Link_array<Single_malt_grouping_item> spacing_unit_l_arr_;
 public:
-  /**
-     extra space to add after  postbreak. (FIXME).
-   */
-  Real padding_f_ ;
-  Separating_group_spanner ();
   void add_spacing_unit (Single_malt_grouping_item*);
+  Separating_group_spanner();
 protected:
   VIRTUAL_COPY_CONS(Score_element);
   virtual Array<Rod> get_rods () const;
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
 };
 
 #endif /* SEPARATING_GROUP_SPANNER_HH */
index 2eb025b0475fb5f63e6c101e137dce42e9665f0f..27477b05bdbbcd4efd247027db30be980eb0709a 100644 (file)
 class Single_malt_grouping_item : public Item
 {
   VIRTUAL_COPY_CONS(Score_element);
-  Link_array<Item> item_l_arr_;
 public:
   Single_malt_grouping_item ();
   Interval my_width () const;
   void add_item (Item*);
-  
-protected:
-  virtual  void do_substitute_element_pointer (Score_element*, Score_element*);
-  virtual void do_print () const;
 };
 
+
 #endif /* SINGLE_MALT_GROUPING_ITEM_HH */
 
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 0b8b10586acb0c31c5f77151f84a11992697ec76..fb249675c38273ece2d744581e433b4ae9c12b67 100644 (file)
@@ -16,10 +16,10 @@ class Spacing_spanner : public Spanner
 {
 public:
   Spacing_spanner ();
+
   VIRTUAL_COPY_CONS(Score_element);
-  Score_column *scol (int) const;
-  Array<Spring> do_measure (int,int) const;
-  int col_count () const;
+  Array<Spring> do_measure (Link_array<Score_column>) const;
+
 protected:
   virtual  Array<Spring> get_springs () const;
 
index 9290b5ae357088852a4429254286d79f14f392ee..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();
@@ -34,11 +33,11 @@ public:
 protected:
   void evaluate_empty ();
 
-  virtual Interval do_width() const;
+  static Interval width_callback(Dimension_cache const*) ;
+  static Interval height_callback(Dimension_cache const*) ;  
+  
   virtual void do_pre_processing();
   virtual void do_post_processing();
-  virtual Interval do_height () const;
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
   virtual Molecule * do_brew_molecule_p() const;
 };
 
index 339280466640b8b7953bac84660047402faedd68..08c7f361f32e50d7f65fdc0465e6e36d4b69b1f1 100644 (file)
@@ -44,6 +44,7 @@ public:
   Spanner ();
   Spanner (Spanner const &);
   bool broken_b () const;
+  void do_break ();
 
   static int compare (Spanner * const &,Spanner * const &);
   virtual Array<Rod> get_rods () const;
@@ -62,10 +63,9 @@ protected:
   friend Axis_group_spanner; // UGH
 
   virtual void do_space_processing ();
-  void handle_broken_dependents ();
+  //  void handle_broken_dependents ();
   virtual void do_break_processing ();
-  virtual Interval do_width () const;
-  virtual void do_print () const;
+  Real spanner_length () const;
   virtual Line_of_score*line_l () const;
 };
 #endif
index 690cf1d3bc0e6dc0276dcf1d0f775196f0a64f24..42c1e002894c85eae0790e31748cee89fc0e428d 100644 (file)
@@ -24,8 +24,9 @@ public:
   static Real side_position (Dimension_cache const *);
   static Real self_alignment (Dimension_cache const *);
   static Real aligned_side (Dimension_cache const *);  
-  
+  static Real quantised_position (Dimension_cache const*);
   void set_axis (Axis);
+  void set_quantised (Axis);
   Axis get_axis () const;
   
   bool supported_b () const;
index f90fe8c1e33cf9df15eb1c2425644ff7b2ce66a6..e5f6751a75893eb40f792944cc5a07f06476ebb6 100644 (file)
  */
 class Staff_symbol_referencer : public virtual Score_element
 {
-  Real position_f_;
-  
-protected:
-  Staff_symbol * staff_symbol_l_;
-
 public:
   Staff_symbol_referencer ();
   void set_position (Real);
-  
-  void set_staff_symbol (Staff_symbol*);
+  static Real callback (Dimension_cache const*); 
+
   /**
      Leading are the lead strips between the sticks (lines) of
      typeface. ie. leading is vertical space.
-
    */
   Real staff_line_leading_f () const;
   Staff_symbol * staff_symbol_l () const;
   int lines_i () const;
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
-  virtual void do_pre_processing ();
-  virtual Real position_f () const;
-
+  Real position_f () const;
 };
 
 #endif /* STAFF_SYMBOL_REFERENCER_HH */
index c15a1df10b3f9efba83baa358e6c81d6a7c21dc4..afe679d65b70ab1e8f9a5be34fe3bd1886ab579f 100644 (file)
@@ -26,7 +26,6 @@ public:
   int steps_i() const;
 protected:
   VIRTUAL_COPY_CONS(Score_element);
-  virtual Interval do_height () const;
   virtual Molecule* do_brew_molecule_p() const;
   virtual void do_print() 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 617f2ed60410f32827cdd853d2329db256eb9f22..ef23aadfde82ec64d910386afabae784676d0471 100644 (file)
 
 
 class Stem_tremolo : public Item {
-  Stem * stem_l_;
 protected:
+  Stem * stem_l () const;
   virtual void do_print () const;
   virtual Molecule *do_brew_molecule_p () const;
-  virtual void do_substitute_element_pointer (Score_element*, Score_element*);
-  virtual Interval do_width () const;
-  virtual void do_pre_processing ();
+
+  static Interval dim_callback (Dimension_cache const*);
 public:
   int abbrev_flags_i_;
   Stem_tremolo ();
index 411848696b843cac8d8ba4db0e8df5da1d59a553..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_;
@@ -63,7 +61,8 @@ public:
     don't print flag when in beam.
     our beam, for aligning abbrev flags
    */
-  Beam* beam_l_;
+  Beam* beam_l () const;
+  Note_head * first_head () const;
 
   Drul_array<int> beams_i_drul_;
   Stem ();
@@ -98,9 +97,9 @@ public:
 
 protected:
   Molecule flag () const;
-  virtual void do_substitute_element_pointer (Score_element*,Score_element*);
+
   virtual void do_pre_processing();
-  virtual Interval do_width() const;
+  static Interval dim_callback (Dimension_cache const*);
   virtual Molecule* do_brew_molecule_p() const;
 
   void set_spacing_hints () ;
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 636acf03bba2557444e2c0955c76de4ee7d76b8c..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_;
 
  
@@ -32,9 +30,8 @@ protected:
   VIRTUAL_COPY_CONS (Score_element);
 
   virtual void do_add_processing ();
-  virtual Interval do_height () const;
+  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 eba020f52b8440a63922493cdfefac429123b4eb..fc082e41669cb1e3d2c611e0ecc7090a9bc2b752 100644 (file)
@@ -5,8 +5,8 @@
 
   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
-#include "dimension-cache.hh"
 
+#include "dimension-cache.hh"
 #include "paper-score.hh"
 #include "debug.hh"
 #include "item.hh"
@@ -29,12 +29,6 @@ Item::breakable_b () const
   return (i) ?  i->breakable_b () : get_elt_property( "breakable") != SCM_UNDEFINED;
 }
 
-void
-Item::do_print() const
-{
-}
-
-
 Real 
 Item::hpos_f() const
 {
@@ -44,7 +38,7 @@ Item::hpos_f() const
 Line_of_score *
 Item::line_l() const
 {
-  Graphical_element *g = parent_l (X_AXIS);
+  Score_element *g = parent_l (X_AXIS);
   if (!g)
     return 0;
   return dynamic_cast<Score_element *> (g)-> line_l ();
@@ -54,10 +48,6 @@ Item::line_l() const
 void
 Item::copy_breakable_items()
 {
-  if (broken_to_drul_[LEFT] || broken_to_drul_[RIGHT]
-      || !breakable_b ())
-    return ;
-
   Drul_array<Item *> new_copies;
   Direction  i=LEFT;
   do 
@@ -76,7 +66,6 @@ Item::copy_breakable_items()
        broken_to_drul_[i]->try_visibility_lambda();
     }
   while (flip(&i) != LEFT);
-  try_visibility_lambda ();
 }
 
 void
@@ -91,32 +80,49 @@ Item::try_visibility_lambda ()
       int empty = gh_scm2bool (gh_cdr (result));
 
       if (empty)
-       set_empty (true, X_AXIS, Y_AXIS);
+       {
+         set_empty (X_AXIS);
+         set_empty ( Y_AXIS);
+       }
       if (trans)
        set_elt_property ("transparent", SCM_BOOL_T);
     }
 }
 
+bool
+Item::broken_b () const
+{
+  return broken_to_drul_[LEFT] || broken_to_drul_[RIGHT];
+}
+
 void
 Item::do_break ()
 {
-  copy_breakable_items();
-  handle_prebroken_dependencies();
+  if (broken_b ())
+    return;
+
+  if (breakable_b ())
+    {
+      copy_breakable_items();
+      handle_prebroken_dependencies();
   
-  /*
+      /*
     Otherwise the broken items won't be pre_process()'ed.
   */
-  add_dependency (broken_to_drul_[LEFT]);
-  add_dependency (broken_to_drul_[RIGHT]);
+  
+      if (broken_to_drul_[LEFT])
+       {
+         add_dependency (broken_to_drul_[LEFT]);
+         add_dependency (broken_to_drul_[RIGHT]);
+       }
+    }
+  try_visibility_lambda ();    // ugh.
 }
 
 void
 Item::do_breakable_col_processing()
 {
-  if (breakable_b ())
-    do_break ();
-  else
-    try_visibility_lambda ();
+  do_break ();
 }
 
 Score_element*
@@ -124,10 +130,14 @@ Item::find_broken_piece (Line_of_score*l) const
 {
   if (line_l() == l) 
     return (Item*)(this);
-  else if (broken_to_drul_[LEFT] && broken_to_drul_[LEFT]->line_l() == l)
-    return broken_to_drul_[LEFT];
-  else if (broken_to_drul_[RIGHT] && broken_to_drul_[RIGHT]->line_l() == l)
-    return broken_to_drul_[RIGHT];
+
+  Direction d = LEFT;
+  do {
+    Score_element *s = find_broken_piece (d);
+    if (s && s->line_l () == l)
+      return s;
+  }
+  while (flip (&d) != LEFT);
 
   return 0;
 }
@@ -135,10 +145,14 @@ Item::find_broken_piece (Line_of_score*l) const
 Item*
 Item::find_broken_piece (Direction d) const
 {
+  Item * me = (Item *) (this); 
   if (!d)
-    return (Item *) (this);    // ugh
-  else
-    return dynamic_cast<Item*> (broken_to_drul_[d]);
+    return me;
+  else 
+    {
+      me->do_break ();
+      return dynamic_cast<Item*> (broken_to_drul_[d]);
+    }
 }
 
 void
@@ -174,46 +188,6 @@ Item::Item (Item const &s)
   broken_to_drul_[LEFT] = broken_to_drul_[RIGHT] =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);
-    }
-}
-
 Direction
 Item::break_status_dir () const
 {
index 6e7d4f9eecf242e347a15f69eeef8abf6e2a90cc..20abc957b45668b481d6817892cb44547dfcfc74 100644 (file)
@@ -93,19 +93,10 @@ ly_parse_scm (char const* s, int* n)
 /*
   scm_m_quote doesn't use any env, but needs one for a good signature in GUILE.
 */
-// apparently env arg is ignored.
 SCM
 ly_quote_scm (SCM s)
 {
-#if 0
-  /*
-    This internal quote symbol breaks list->string and display,
-    and thus scm output.
-   */
-  return scm_m_quote (scm_cons2 (SCM_EOL, s, SCM_EOL) ,SCM_EOL);
-#else
   return gh_list (ly_symbol2scm ("quote"), s, SCM_UNDEFINED);
-#endif
 }
 
 
@@ -121,14 +112,6 @@ ly_symbol2string (SCM s)
   return String((Byte*)SCM_CHARS (s), (int) SCM_LENGTH(s));
 }
 
-#if 0
-SCM
-ly_set_x (String name, SCM val)
-{
-  return scm_sysintern ((char*)name.ch_C(), val);
-  
-}
-#endif
 
 /**
    Read a file, and shove it down GUILE.  GUILE also has file read
@@ -288,3 +271,5 @@ to_dir (SCM s)
 {
   return (Direction) gh_scm2int (s);
 }
+
+
index b648ea10c5822d970c494206671ddf54b9ff2e00..5fb4931a2a0fbb1bb3dbc21efb8f410211726bf7 100644 (file)
 #include "paper-column.hh"
 #include "paper-score.hh"
 #include "warn.hh"
+#include "main.hh"
+#include "debug.hh"
 
 Line_of_score::Line_of_score()
 {
+  set_elt_property ("columns", SCM_EOL);
   set_axes (Y_AXIS,X_AXIS);
 }
 
-bool
-Line_of_score::contains_b (Paper_column const* c) const
+
+
+void
+Line_of_score::output_lines ()
 {
-  return cols_.find_l ((Paper_column*)(c));
+  for (int i=0; i < broken_into_l_arr_.size (); i++)
+    {
+      Line_of_score *line_l = dynamic_cast<Line_of_score*> (broken_into_l_arr_[i]);
+
+      *mlog << '[' << flush;
+      line_l->post_processing ();
+      *mlog << i << flush;
+      line_l->output_line (i + 1 == broken_into_l_arr_.size ());
+      *mlog << ']' << flush;
+    }
 }
 
 // const?
-Line_of_score*
-Line_of_score::set_breaking (Array<Column_x_positions> const &breaking, int j) 
+void
+Line_of_score::break_into_pieces (Array<Column_x_positions> const &breaking)
 {
-  const Link_array<Paper_column> &curline (breaking[j].cols_);
-  const Array<Real> &config (breaking[j].config_);
-  Line_of_score *line_l=0;
+  for (int i=0; i < breaking.size (); i++)
+    {
+      Line_of_score *line_l = dynamic_cast <Line_of_score*> (clone());
+      line_l->rank_i_ = i;
+      Link_array<Paper_column> c (breaking[i].cols_);
+      pscore_l_->typeset_element (line_l);
+      line_l->set_bounds(LEFT,c[0]);
+      line_l->set_bounds(RIGHT,c.top ());
+      for (int j=0; j < c.size(); j++)
+       {
+         c[j]->translate_axis (breaking[i].config_[j],X_AXIS);
+         c[j]->line_l_ = line_l;
+       }
+      
+      broken_into_l_arr_.push (line_l);
+    }
 
-  line_l = dynamic_cast <Line_of_score*> (clone());
-  line_l->rank_i_ = j;
-  
-  line_l->cols_ = curline;
-  line_l->set_bounds(LEFT,curline[0]);
-  line_l->set_bounds(RIGHT,curline.top());
-       
-  for (int i=0; i < curline.size(); i++)
+  for (int i=0; i < broken_into_l_arr_.size (); i++)
     {
-      curline[i]->translate_axis (config[i],X_AXIS);
-      curline[i]->line_l_ = dynamic_cast<Line_of_score*> (line_l);
+      broken_into_l_arr_[i]->handle_broken_dependencies ();
     }
 
-  broken_into_l_arr_.push (line_l);
-  return line_l;
+  handle_broken_dependencies ();
 }
 
 void
 Line_of_score::add_column (Paper_column*p)
 {
-  cols_.push (p);
+  set_elt_property ("columns",
+                   gh_cons (p->self_scm_, get_elt_property ("columns")));
   add_element (p);
 }
 
@@ -63,28 +82,12 @@ Line_of_score::do_print() const
   Axis_group_spanner::do_print ();
 }
 
-Link_array<Score_element>
-Line_of_score::get_extra_dependencies () const
-{
-  Link_array<Score_element> r (Axis_group_spanner::get_extra_dependencies ());
-  for (int i=0; i < cols_.size (); i++)
-    r.push (cols_[i]);
-  return r;
-}
-
-void
-Line_of_score::do_substitute_element_pointer (Score_element*o, Score_element*n)
-{
-  if (Paper_column *p = dynamic_cast<Paper_column*>(o))
-    cols_.substitute (p, dynamic_cast<Paper_column*>(n));
-}
-
 void
-Line_of_score::output_all (bool last_line)
+Line_of_score::output_line (bool last_line)
 {
   Interval i(extent(Y_AXIS));
   if (i.empty_b())
-    warning (_ ("Huh?  Empty Line_of_score?"));
+    programming_error ("Huh?  Empty Line_of_score?");
   else
     translate_axis (- i[MAX], Y_AXIS);
   
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 0f8bd3bc38b7c6b9414ef94a7dae525b01dc1150..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_;
-  if (!b || !b->stems_.size ())
+  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->stems_[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 f8e9195607db8d576ef0cfd11cf07ab1e48c61a9..17bc7d6b30ff0555b069aba9db3a41141121afb3 100644 (file)
 #include "lookup.hh"
 #include "molecule.hh"
 #include "musical-request.hh"
-#include "stem.hh"
+#include "dimension-cache.hh"
 
 void
 Note_head::flip_around_stem (Direction d)
 {
-  translate_axis (do_width ().length () * d, X_AXIS);
+  Real l= make_molecule ().dim_[X_AXIS].length ();
+  translate_axis (l * d, X_AXIS);
+}
+
+Interval
+Note_head::dim_callback (Dimension_cache const * c)
+{
+  Note_head* n = dynamic_cast<Note_head*> (c->element_l ());
+  return n->make_molecule ().dim_[X_AXIS];
 }
 
 Note_head::Note_head ()
 {
+  dim_cache_[X_AXIS]->callback_l_ = dim_callback;
 }
 
 void
@@ -42,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 ()));
 
  
 }
@@ -56,14 +65,7 @@ Note_head::compare (Note_head *const  &a, Note_head * const &b)
   return sign(a->position_f () - b->position_f ());
 }
 
-/**
- Don't account for ledgerlines in the width.
- */
-Interval
-Note_head::do_width () const
-{
-  return make_molecule ().dim_[X_AXIS];
-}
+
 
 Molecule
 Note_head::make_molecule () const
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 7c5e0c26844884bed8961b33e42414238516ad70..1b2f4caa8f70a4babe2d2243bd3c2fdc84d5fde1 100644 (file)
@@ -132,11 +132,14 @@ Paper_column::column_l () const
 }
 
 /*
-  ugh.
+  ugh. JUNKME
  */
 void
 Paper_column::preprocess ()
 {
+  /*
+    JUNKME
+   */ 
   minimal_dists_arr_drul_[LEFT].sort (Column_rod::compare);
   minimal_dists_arr_drul_[RIGHT].sort (Column_rod::compare);  
   spring_arr_drul_[LEFT].sort (Column_spring::compare);
index e51b01cef39b821803337c41b1a4760dd6d81650..960dffd675026835608966d97bbbfb2fa1a9776a 100644 (file)
@@ -114,13 +114,14 @@ Paper_score::process ()
   print ();
   *mlog << _ ("Preprocessing elements...") << " " << flush;
   line_l_->breakable_col_processing ();
+  fixup_refpoints ();
   line_l_->pre_processing ();
   
   *mlog << '\n' << _ ("Calculating column positions...") << " " << flush;
   line_l_->space_processing ();
 
   Array<Column_x_positions> breaking = calc_breaking ();
-
+  line_l_->break_into_pieces (breaking);
 
   outputter_l_ = new Paper_outputter ;
   outputter_l_->output_header ();
@@ -154,30 +155,10 @@ Paper_score::process ()
    */
   SCM before_output = outputter_l_->last_cons_;
   
-  Link_array<Line_of_score> lines;
-  for (int i=0; i < breaking.size (); i++)
-    {
-      Line_of_score *line_l = line_l_->set_breaking (breaking, i);
-      lines.push (line_l);
-      if (line_l != line_l_)
-       typeset_element (line_l);
-    }
 
+  fixup_refpoints ();
+  line_l_->output_lines ();
 
-  *mlog << "\n";
-  *mlog << _ ("Line ... ");
-  line_l_->break_processing ();
-  for (int i=0; i < lines.size (); i++)
-    {
-      *mlog << '[' << flush;
-      
-      Line_of_score *line_l = lines[i];
-
-      line_l->post_processing ();
-      *mlog << i << flush;
-      line_l->output_all (i + 1 == lines.size ());
-      *mlog << ']' << flush;
-    }
 
   SCM font_names = ly_quote_scm (all_fonts_global_p->font_descriptions ());
   gh_set_cdr_x (before_output,
@@ -222,3 +203,18 @@ Paper_score::broken_col_range (Item const*l, Item const*r) const
 
   return ret;
 }
+
+
+void
+Paper_score::fixup_refpoints ()
+{
+  for (SCM s = element_smob_list_; gh_pair_p (s); s = gh_cdr (s))
+    {
+      SCM e = gh_car (s);
+      if (SMOB_IS_TYPE_B(Score_element, e))
+       {
+         Score_element * se = unsmob_element (e);
+         se->fixup_refpoint ();
+       }
+    }
+}
index 52c0149bcee8559fdebc2fa2ea1cb657c87cd3ce..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,29 +127,13 @@ 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 (true, X_AXIS, Y_AXIS);
+  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 b87027a0c8dc7c08f22a91fbbaa493211172297a..45fbc03ed65605525260fa310fbd28d9ff24cda3 100644 (file)
 #include "paper-outputter.hh"
 #include "dimension-cache.hh"
 #include "staff-side.hh"
-
-Interval
-Score_element::dim_cache_callback (Dimension_cache const*c)
-{
-  Score_element *  e =dynamic_cast<Score_element*> (c->element_l());
-  if(e->dim_cache_[X_AXIS] == c)
-    return e->do_width ();
-  else
-    return e->do_height ();
-}
+#include "item.hh"
 
 
 Score_element::Score_element()
 {
   output_p_ =0;
-  dim_cache_[X_AXIS]->set_callback (dim_cache_callback);
-  dim_cache_[Y_AXIS]->set_callback (dim_cache_callback); 
+  dim_cache_[X_AXIS] = new Dimension_cache;
+  dim_cache_[Y_AXIS] = new Dimension_cache;
+  dim_cache_[X_AXIS]->elt_l_ = dim_cache_[Y_AXIS]->elt_l_ = this;
+  
+  used_b_ = false;
+
+  dim_cache_[X_AXIS]->set_callback (molecule_extent);
+  dim_cache_[Y_AXIS]->set_callback (molecule_extent); 
   used_b_ = false;
   pscore_l_=0;
   lookup_l_ =0;
@@ -53,9 +50,25 @@ Score_element::Score_element()
   smobify_self ();
 }
 
+SCM ly_deep_copy (SCM);
+
+SCM
+ly_deep_copy (SCM l)
+{
+  if (gh_pair_p (l))
+    {
+      return gh_cons (ly_deep_copy (gh_car (l)), ly_deep_copy (gh_cdr (l)));
+    }
+  else
+    return l;
+}
+
+
 Score_element::Score_element (Score_element const&s)
-  : Graphical_element (s)
 {
+  dim_cache_[X_AXIS] = new Dimension_cache (*s.dim_cache_[X_AXIS]);
+  dim_cache_[Y_AXIS] = new Dimension_cache (*s.dim_cache_[Y_AXIS]);
+  dim_cache_[X_AXIS]->elt_l_ = dim_cache_[Y_AXIS]->elt_l_ = this;
   
   self_scm_ = SCM_EOL;
   used_b_ = true;
@@ -64,7 +77,7 @@ Score_element::Score_element (Score_element const&s)
   /*
     should protect because smobify_self () might trigger GC.
    */
-  element_property_alist_ = scm_protect_object (scm_list_copy (s.element_property_alist_));
+  element_property_alist_ = scm_protect_object (ly_deep_copy (s.element_property_alist_));
   dependency_arr_ = s.dependency_arr_;
   output_p_ =0;
   status_i_ = s.status_i_;
@@ -79,6 +92,9 @@ Score_element::~Score_element()
   assert (!output_p_);
   assert (status_i_ >=0);
   status_i_  = -1;
+
+  delete dim_cache_[X_AXIS];
+  delete dim_cache_[Y_AXIS];  
 }
 
 Score_element*
@@ -139,42 +155,27 @@ Score_element::set_elt_property (String k, SCM v)
 }
 
 Interval
-Score_element::do_width() const 
+Score_element::molecule_extent(Dimension_cache const *c)
 {
-  Interval r;
-
-  Molecule*m = output_p_ ?  output_p_ : do_brew_molecule_p();
-  r = m->extent().x ();
-
-  if (!output_p_)
-    delete m;
-  
-  return r;
+  Score_element *s = dynamic_cast<Score_element*>(c->element_l());
+  Molecule*m = s->do_brew_molecule_p();
+  return  m->extent()[c->axis ()];
 }
 
-Interval
-Score_element::do_height() const 
-{
-  Interval r;
-  Molecule*m = output_p_ ?  output_p_ : do_brew_molecule_p();
-  r = m->extent().y ();
-  if (!output_p_)
-    delete m;
-
-  return r;
-}
 
 void
 Score_element::print() const
 {
 #ifndef NPRINT
   DEBUG_OUT << classname(this) << "{\n";
+  
+  
   if (flower_dstream && !flower_dstream->silent_b ("Score_element"))
     ly_display_scm (element_property_alist_);
+
   DEBUG_OUT << "dependencies: " << dependency_size();
   if (original_l_)
     DEBUG_OUT << "Copy ";
-  Graphical_element::do_print ();
   do_print();
   
   DEBUG_OUT <<  "}\n";
@@ -321,16 +322,14 @@ Score_element::do_add_processing()
 {
 }
 
-void
-Score_element::do_substitute_element_pointer (Score_element*,Score_element*)
-{
-}
 
 
 Molecule*
 Score_element::do_brew_molecule_p() const
 {
-  Molecule a (lookup_l ()->fill (Box (Interval (0,0), Interval (0,0))));
+  Interval emp;
+  emp.set_empty ();
+  Molecule a (lookup_l ()->fill (Box (emp,emp)));
   return new Molecule (a);
 }
 
@@ -353,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);
-}
+
 
 
 /**
@@ -368,11 +362,12 @@ 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 (gh_number_p (criterion))
+      if (criterion == SCM_UNDEFINED)
+       return SCM_UNDEFINED;
+      else if (gh_number_p (criterion))
        {
          Item * i = dynamic_cast<Item*> (sc);
          Direction d = to_dir (criterion);
@@ -384,15 +379,17 @@ 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;
-         if (sc->line_l () != line)
+         Line_of_score * dep_line = sc->line_l ();
+         if (dep_line != line)
            {
              br = sc->find_broken_piece (line);
              return  (br) ?  br->self_scm_ : SCM_UNDEFINED;
            }
-
+         if (!dep_line)
+           return SCM_UNDEFINED;
        }
     }
   else if (gh_pair_p (s))
@@ -402,19 +399,48 @@ 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 && 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;
 
-  element_property_alist_ = handle_broken_smobs (element_property_alist_,
-                                                line->self_scm_);
 
   Link_array<Score_element> new_deps;
 
@@ -424,14 +450,12 @@ 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)
        new_deps.push (elt);
     }
   dependency_arr_ = new_deps;
-
 }
 
 
@@ -447,47 +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]);
 }
 
-void
-Score_element::handle_prebroken_dependents()
-{
-}
 
-void
-Score_element::handle_broken_dependents()
-{
-}
 
 
 
@@ -509,8 +495,6 @@ Score_element::do_print () const
 {
 }
 
-
-
 Score_element*
 Score_element::find_broken_piece (Line_of_score*) const
 {
@@ -535,8 +519,9 @@ Score_element::print_smob (SCM s, SCM port, scm_print_state *)
      
   scm_puts ("#<Score_element ", port);
   scm_puts ((char *)sc->name (), port);
-  scm_puts ("properties = ", port);
-  scm_display (sc->element_property_alist_, port);
+
+  // scm_puts (" properties = ", port);
+  // scm_display (sc->element_property_alist_, port);
   scm_puts (" >", port);
   return 1;
 }
@@ -555,3 +540,128 @@ Score_element::equal_p (SCM a, SCM b)
   return SCM_CDR(a) == SCM_CDR(b) ? SCM_BOOL_T : SCM_BOOL_F;
 }
 
+void
+Score_element::translate_axis (Real y, Axis a)
+{
+  dim_cache_[a]->translate (y);
+}  
+
+Real
+Score_element::relative_coordinate (Score_element const*e, Axis a) const
+{
+  return dim_cache_[a]->relative_coordinate (e ? e->dim_cache_[a] : 0);
+}
+
+Score_element * 
+Score_element::common_refpoint (Score_element const* s, Axis a) const
+{
+  Dimension_cache *dim = dim_cache_[a]->common_refpoint (s->dim_cache_[a]);
+  if (!dim)
+    programming_error ("No  common reference point");
+  return  dim ? dim->element_l () : 0;
+}
+
+void
+Score_element::set_empty (Axis a)
+{
+  dim_cache_[a]->callback_l_ =0;
+}
+
+bool
+Score_element::empty_b (Axis a)const
+{
+  return !dim_cache_[a]->callback_l_;
+}
+
+Interval
+Score_element::extent (Axis a) const
+{
+  Dimension_cache const * d = dim_cache_[a];
+
+  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;
+}
+
+
+/*
+  JUNKME
+ */
+void
+Score_element::invalidate_cache (Axis a)
+{
+  dim_cache_[a]->invalidate ();
+}
+
+Score_element*
+Score_element::parent_l (Axis a) const
+{
+  Dimension_cache*d= dim_cache_[a]->parent_l_;
+  return d ? d->elt_l_ : 0;
+}
+
+Score_element *
+Score_element::common_refpoint (Link_array<Score_element> gs, Axis a) const
+{
+  Dimension_cache * common = dim_cache_[a];
+  for (int i=0; i < gs.size (); i++)
+    {
+      common = common->common_refpoint (gs[i]->dim_cache_[a]);
+    }
+
+  return common->element_l ();
+}
+
+char const *
+Score_element::name () const
+{
+  return classname (this);
+}
+
+
+void
+Score_element::set_parent (Score_element *g, Axis a)
+{
+  dim_cache_[a]->parent_l_ = g ? g->dim_cache_[a]: 0;
+}
+
+void
+Score_element::fixup_refpoint ()
+{
+  for (int a = X_AXIS; a < NO_AXES; a ++)
+    {
+      Axis ax = (Axis)a;
+      Score_element * par = parent_l (ax);
+
+      if (!par)
+       continue;
+      
+      if (par->line_l () != line_l ())
+       {
+         Score_element * newpar = par->find_broken_piece (line_l ());
+         set_parent (newpar, ax);
+       }
+
+      if (Item * i  = dynamic_cast<Item*> (this))
+       {
+         Item *pari = dynamic_cast<Item*> (par);
+
+         if (pari && i)
+           {
+             Direction  my_dir = i->break_status_dir () ;
+             if (my_dir!= pari->break_status_dir())
+               {
+                 Item *newpar =  pari->find_broken_piece (my_dir);
+                 set_parent (newpar, ax);
+               }
+           }
+       }
+    }
+}
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 a959550a7719af26c8f4adbbdac54ccb29a6cf78..cde149793f4e4b721691dd8fdd2c677d5a48a462 100644 (file)
@@ -84,6 +84,9 @@ Script_engraver::do_process_requests()
       if (!follow_staff && ! xaxis)
        p->set_elt_property ("staff-support", SCM_BOOL_T);
 
+      if (!xaxis && follow_staff)
+       stafy.set_quantised (Y_AXIS);
+      
       p->set_elt_property ("script-priority", priority);
   
       script_p_arr_.push (p);
index f523de37bb310d151545aedb4d5bbf50bfc8d997..430b03acfe385711c9486e82106729dc5564982e 100644 (file)
@@ -1,5 +1,5 @@
 /*   
-     script.cc --  implement Script
+  script.cc --  implement Script
   
   source file of the GNU LilyPond music typesetter
   
@@ -44,7 +44,7 @@ Script::do_pre_processing ()
   /*
     center my self on the note head.
    */
-  Graphical_element * e = parent_l(X_AXIS);
+  Score_element * e = parent_l(X_AXIS);
   translate_axis (e->extent (X_AXIS).center (), X_AXIS);
 }
 
index a07381b61526926e87fc9e421215251fd0043ee9..4a3d0ccaa2e98c0eedcb1930c1f704c7057687b5 100644 (file)
@@ -37,20 +37,27 @@ Separating_group_spanner::get_rods () const
 {
   Array<Rod> a;
   
-  for (int i=0; i < spacing_unit_l_arr_.size () -1; i++)
+  for (SCM s = get_elt_property ("elements"); gh_pair_p (s) && gh_pair_p (gh_cdr (s)); s = gh_cdr (s))
     {
-      Single_malt_grouping_item *l =spacing_unit_l_arr_[i];
+      SCM elt = gh_car (s);
+      SCM next_elt = gh_cadr (s);
+
+      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 = spacing_unit_l_arr_[i+1];
+
       Single_malt_grouping_item *rb
        = dynamic_cast<Single_malt_grouping_item*>(r->find_broken_piece (LEFT));
       
-      a.push (make_rod(spacing_unit_l_arr_[i], spacing_unit_l_arr_[i+1]));
+      a.push (make_rod(l,  r));
       if (lb)
        {
          Rod rod(make_rod (lb, r));
-         rod.distance_f_ += padding_f_;
          a.push (rod);
        }
       
@@ -62,7 +69,6 @@ Separating_group_spanner::get_rods () const
       if (lb && rb)
        {
          Rod rod(make_rod (lb, rb));
-         rod.distance_f_ += padding_f_;
          a.push (rod);
        }
     }
@@ -73,22 +79,14 @@ Separating_group_spanner::get_rods () const
 void
 Separating_group_spanner::add_spacing_unit (Single_malt_grouping_item*i)
 {
-  spacing_unit_l_arr_.push (i);
+  set_elt_property ("elements",
+                   gh_cons (i->self_scm_,
+                            get_elt_property ("elements")));
   add_dependency (i);
 }
 
-void
-Separating_group_spanner::do_substitute_element_pointer (Score_element*o,
-                                                        Score_element*n)
-{
-  if (dynamic_cast<Single_malt_grouping_item *> (o))
-    {
-      Single_malt_grouping_item*ns = dynamic_cast<Single_malt_grouping_item *> (n);
-      spacing_unit_l_arr_.substitute (dynamic_cast<Single_malt_grouping_item *> (o), ns);
-    }
-}
 
-Separating_group_spanner::Separating_group_spanner()
+Separating_group_spanner::Separating_group_spanner ()
 {
-  padding_f_ =0.0;
+  set_elt_property ("elements", SCM_EOL);
 }
index b48a0e7689bc840032fa64887522e4d7fbf9dee4..b2ae354ab9752613a3ca22b6d025cb1fc587a7db 100644 (file)
@@ -31,16 +31,6 @@ Separating_line_group_engraver::do_creation_processing ()
 void
 Separating_line_group_engraver::do_removal_processing ()
 {
-  SCM sz (get_property ("postBreakPadding", 0));
-  if (gh_number_p(sz))
-    {
-      sep_span_p_->padding_f_ = Real(sz);
-    }
-  else
-    {
-      sep_span_p_->padding_f_ = paper_l ()->get_realvar (ly_symbol2scm ("postBreakPadding"));
-    }
-
   sep_span_p_->set_bounds (RIGHT, get_staff_info ().command_pcol_l ());
   typeset_element (sep_span_p_);
   sep_span_p_ =0;
index 39fcd793aa376bcef6642627c576b4dc5457f773..4a9a9d929efcb3daf86eaf7f0284b3eeb0eab947 100644 (file)
 Single_malt_grouping_item ::Single_malt_grouping_item()
 {
   set_elt_property ("transparent", SCM_BOOL_T);
+  set_elt_property ("elements", SCM_EOL);
 
   // this is weird! , but needed!
-  set_empty (true, X_AXIS, Y_AXIS);
+  set_empty (X_AXIS);
+  set_empty ( Y_AXIS);
 
 }
 
@@ -24,7 +26,10 @@ void
 Single_malt_grouping_item::add_item (Item* i)
 {
   assert (i);
-  item_l_arr_.push (i);
+  set_elt_property ("elements",
+                   gh_cons (i->self_scm_,
+                            get_elt_property ("elements")));
+
   add_dependency (i);
 }
 
@@ -33,9 +38,16 @@ Single_malt_grouping_item::my_width () const
 {
   Paper_column * pc = column_l ();
   Interval w;
-  for (int i=0; i < item_l_arr_.size (); i++)
+  
+  for (SCM s = get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
     {
-      Item *il = item_l_arr_[i];
+      SCM elt = gh_car (s);
+      if (!SMOB_IS_TYPE_B(Score_element, elt))
+       continue;
+
+      
+      
+      Item *il = dynamic_cast<Item*> (SMOB_TO_TYPE (Score_element, elt));
       if (pc != il->column_l ())
        {
          /* this shouldn't happen, but let's continue anyway. */
@@ -57,25 +69,3 @@ Single_malt_grouping_item::my_width () const
 
 
 
-void
-Single_malt_grouping_item::do_substitute_element_pointer (Score_element*o,
-                                                         Score_element*n)
-{
-  if (dynamic_cast <Item *> (o))
-    {
-      item_l_arr_.unordered_substitute (dynamic_cast <Item *> (o),
-                                       dynamic_cast <Item *> (n));
-    }
-}
-
-void
-Single_malt_grouping_item::do_print () const
-{
-#ifndef NDEBUG
-  for (int i=0; i < item_l_arr_.size (); i++)
-    {
-      DEBUG_OUT << classname (item_l_arr_[i]) << ", ";
-    }
-#endif
-}
-
index ae96ed9771386fd10b51d5f5d4920e9d31fbc134..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
@@ -181,7 +180,7 @@ Slur::do_post_processing ()
          if ((stem_l->extent (Y_AXIS).empty_b ()
               || !((stem_l->get_direction () == get_direction ()) && (get_direction () != d)))
              && !((get_direction () == stem_l->get_direction ())
-                  && stem_l->beam_l_ && (stem_l->beams_i_drul_[-d] >= 1)))
+                  && stem_l->beam_l () && (stem_l->beams_i_drul_[-d] >= 1)))
            {
              dx_f_drul_[d] = spanned_drul_[d]->extent (X_AXIS).length () / 2;
              dx_f_drul_[d] -= d * x_gap_f;
@@ -207,7 +206,7 @@ Slur::do_post_processing ()
              /*
                side attached to beamed stem
               */
-             if (stem_l->beam_l_ && (stem_l->beams_i_drul_[-d] >= 1))
+             if (stem_l->beam_l () && (stem_l->beams_i_drul_[-d] >= 1))
                {
                  dy_f_drul_[d] = stem_l->extent (Y_AXIS)[get_direction ()];
                  dy_f_drul_[d] += get_direction () * 2 * y_gap_f;
@@ -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)
@@ -292,7 +291,7 @@ Slur::do_post_processing ()
   Real dy_f = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT];
   if (!fix_broken_b)
     dy_f -= interstaff_f;
-  Real dx_f = do_width ().length () + dx_f_drul_[RIGHT] - dx_f_drul_[LEFT];
+  Real dx_f = spanner_length ()+ dx_f_drul_[RIGHT] - dx_f_drul_[LEFT];
 
   /*
     Avoid too steep slurs.
@@ -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,18 +485,18 @@ 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);
     }
 
-  offset_arr.push (Offset (do_width ().length () + dx_f_drul_[RIGHT],
+  offset_arr.push (Offset (spanner_length ()+  dx_f_drul_[RIGHT],
                           dy_f_drul_[RIGHT]));
 
   return offset_arr;
index ece98451f7f44b7042563aba873d156b6c540c95..ab8d82ae4a76176eea862e266fe7449211802df0 100644 (file)
 
 Spacing_spanner::Spacing_spanner ()
 {
+  set_empty (X_AXIS);
+  set_empty (Y_AXIS);  
   set_elt_property ("transparent", SCM_BOOL_T);
 }
 
-int
-Spacing_spanner::col_count () const
-{
-  return pscore_l_->line_l_->cols_.size ();
-}
-
-Score_column *
-Spacing_spanner::scol (int i)const
-{
-  return dynamic_cast<Score_column*> (pscore_l_->line_l_->cols_[i]);
-}
-
 /*
   cut 'n paste from spring-spacer.cc
 
@@ -48,31 +38,31 @@ Spacing_spanner::scol (int i)const
   
  */
 Array<Spring>
-Spacing_spanner::do_measure (int col1, int col2) const
+Spacing_spanner::do_measure (Link_array<Score_column> cols) const
 {
-  for (int i =col1; i < col2; i++)
+  for (int i =0 ; i < cols.size (); i++)
     {
-      scol (i)->preprocess ();
-      scol (i)->print ();
+      cols[i]->preprocess ();
+      cols[i]->print ();
     }
 
   Moment shortest;
   shortest.set_infinite (1);
-  for (int i =col1; i < col2; i++)
+  for (int i =0 ; i < cols.size (); i++)  
     {
-      if (scol(i)->musical_b ())
+      if (cols[i]->musical_b ())
        {
-         shortest = shortest <? scol(i)->shortest_starter_mom_;
+         shortest = shortest <? cols[i]->shortest_starter_mom_;
        }
     }
 
   Array<Spring> meas_springs;
 
   Real non_musical_space_strength = paper_l ()->get_var ("breakable_column_space_strength");
-  for (int i= col1; i < col2; i++)
+  for (int i= 0; i < cols.size () - 1; i++)
     {
-      Item * l = scol(i);
-      Item * r = scol(i+1);
+      Item * l = cols[i];
+      Item * r = cols[i+1];
       Item * lb = l->find_broken_piece (RIGHT);
       Item * rb = r->find_broken_piece (LEFT);      
 
@@ -99,7 +89,8 @@ Spacing_spanner::do_measure (int col1, int col2) const
            {
              left_distance = gh_scm2double (gh_cdr (hint)); 
            }
-         else if (!lc->musical_b() && i+1 < col_count())
+          // 2nd condition should be (i+1 < col_count()), ie. not the last column in score.  FIXME
+         else if (!lc->musical_b() && i+1 < cols.size ()) 
            {
              left_distance= default_bar_spacing (lc,rc,shortest);
            }
@@ -295,13 +286,20 @@ Array<Spring>
 Spacing_spanner::get_springs () const
 {
   Array<Spring> springs;
-  int last_break =0;
-  for (int i=1; i < col_count (); i++)
+  
+  SCM last_col = pscore_l_->line_l_->get_elt_property ("columns");
+  Link_array<Score_column> measure;
+  for (SCM s = last_col; gh_pair_p (s); s = gh_cdr (s))
     {
-      if (scol (i)->breakable_b ())
+      Score_element * elt = unsmob_element (gh_car (s));
+      Score_column* sc = dynamic_cast<Score_column*> (elt);
+      measure.push (sc);
+      if (sc->breakable_b ())
         {
-          springs.concat (do_measure (last_break, i));
-          last_break  = i;
+         measure.reverse ();
+          springs.concat (do_measure (measure));
+         measure.clear ();
+         measure.push (sc);
         }
     }
   return springs;
index fe85a4e6b65761619778a9606405c3fe8da735de..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);
 }
 
 
 Interval
-Span_bar::do_width () const
+Span_bar::width_callback (Dimension_cache const * c)
 {
-  Molecule m = lookup_l ()->bar (type_str_, 40 PT, paper_l ());
+  Span_bar*  s= dynamic_cast<Span_bar*> (c->element_l ());  
+  Molecule m = s->lookup_l ()->bar (s->type_str_, 40 PT, s->paper_l ());
   
   return m.extent (X_AXIS);
 }
@@ -43,7 +42,7 @@ Span_bar::do_pre_processing ()
   
   evaluate_empty ();
   
-  set_empty (false, Y_AXIS); // a hack to make mark scripts work.
+  //  set_empty (false, Y_AXIS); // a hack to make mark scripts work.
 }
 
 void
@@ -58,16 +57,17 @@ 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 (true, X_AXIS, Y_AXIS);   
-
+      set_empty (X_AXIS);
+      set_empty (Y_AXIS);   
     }
   if (type_str_.empty_b ()) 
     {
       set_elt_property ("transparent", SCM_BOOL_T);
-      set_empty (true);
+      set_empty (X_AXIS);
+      set_empty (Y_AXIS);   
     }
   else if (type_str_ == "|:") 
     {
@@ -88,21 +88,32 @@ 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))
     {
-      Graphical_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;
 }
 
 Interval
-Span_bar::do_height () const
+Span_bar::height_callback (Dimension_cache const *c) 
 {
-  return get_spanned_interval ();
+  Span_bar * s= dynamic_cast<Span_bar*> (c->element_l ()); 
+  return s->get_spanned_interval ();
 }
 
 Molecule*
@@ -126,5 +137,7 @@ Span_bar::do_brew_molecule_p () const
 Span_bar::Span_bar ()
 {
   type_str_ = "";
+  dim_cache_[X_AXIS]->set_callback (width_callback);
+  dim_cache_[Y_AXIS]->set_callback (height_callback);  
 }
 
index 770aa4c4c5983357a4183f13e7629ffeac7dde30..e4efbe0ec068e1ab2c29d5485ba4cbdccf863e8a 100644 (file)
@@ -32,7 +32,7 @@ Span_bar*
 Piano_bar_engraver::get_span_bar_p () const
 {
   Span_bar *s= new Span_bar;
-  s->set_empty (true, X_AXIS);
+  s->set_empty (X_AXIS);
   s->type_str_ = "brace";
   return s;
 }
@@ -41,7 +41,7 @@ Span_bar*
 Staff_group_bar_engraver::get_span_bar_p () const
 {
   Span_bar *s= new Span_bar;
-  s->set_empty (true, X_AXIS);
+  s->set_empty (X_AXIS);
   s->type_str_ = "bracket";
   return s;
 }
index 5aa48681d4717f8e6860dcb1a924b5fd11e350ff..dd3d24ead3276ff9e2dbcc58755cf8042fdf02b0 100644 (file)
 #include "paper-outputter.hh"
 #include "score-column.hh"
 #include "line-of-score.hh"
-
-void
-Spanner::do_print() const
-{
-#ifndef NPRINT
-  DEBUG_OUT << "Between " << classname (spanned_drul_[LEFT])
-       << " and " << classname (spanned_drul_[RIGHT]) << '\n';
-
-  if (broken_b ())
-    DEBUG_OUT << "Broken in " << to_str (broken_into_l_arr_.size ()) << " pieces";
-#endif
-}
+#include "break-align-item.hh"
 
 void
 Spanner::break_into_pieces ()
 {
-  if (broken_b ())
-    return; 
-        
+  if (line_l () || broken_b ())
+    return;
+  
   Item * left = spanned_drul_[LEFT];
   Item * right = spanned_drul_[RIGHT];
 
@@ -80,13 +69,13 @@ Spanner::break_into_pieces ()
 void
 Spanner::set_my_columns()
 {
-  Direction i = (Direction)1;
+  Direction i = (Direction) LEFT;
   do 
     {
       if (!spanned_drul_[i]->line_l())
-       set_bounds(i,spanned_drul_[i]->find_broken_piece((Direction)-i));
+       set_bounds(i,spanned_drul_[i]->find_broken_piece((Direction) -i));
     } 
-  while (flip(&i) != 1);
+  while (flip(&i) != LEFT);
 }       
 
 void
@@ -106,18 +95,18 @@ Spanner::set_bounds(Direction d, Item*i)
       set_parent (i, X_AXIS);
     }
   
-  if  (spanned_drul_[Direction(-d)] == spanned_drul_[d]
+  if (spanned_drul_[Direction(-d)] == spanned_drul_[d]
        && i)
     warning (_f ("Spanner `%s' has equal left and right spanpoints", classname (this)));
 }
 
+
+
 void
 Spanner::do_break_processing()
 {
-  if (!line_l())
-    break_into_pieces ();
-  else 
-    handle_broken_dependencies();
+  break_into_pieces ();
+  handle_broken_dependencies();
 }
 
 Spanner::Spanner ()
@@ -133,8 +122,8 @@ Spanner::Spanner (Spanner const &s)
 }
 
 
-Interval
-Spanner::do_width() const
+Real
+Spanner::spanner_length() const
 {  
   Real l = spanned_drul_[LEFT]->relative_coordinate (0, X_AXIS);
   Real r = spanned_drul_[RIGHT]->relative_coordinate (0, X_AXIS);
@@ -142,7 +131,7 @@ Spanner::do_width() const
   if (r< l)
     warning (_ ("spanner with negative length"));
        
-  return Interval (0, r-l);
+  return r-l;
 }
 
 Line_of_score *
@@ -159,22 +148,17 @@ Spanner::line_l() const
 Score_element*
 Spanner::find_broken_piece (Line_of_score*l) const
 {
+  Spanner* me = (Spanner*) this;
+  break_into_pieces ();
+  
   int idx = binsearch_link_array (broken_into_l_arr_,  (Spanner*)l, Spanner::compare);
+  
   if (idx < 0)
     return 0;
   else
     return broken_into_l_arr_ [idx];
 }
 
-/*
-  for (int i=0; i < broken_into_l_arr_.size (); i++)
-    {
-      if (broken_into_l_arr_[i]->line_l () == l)
-       return broken_into_l_arr_[i];
-    }
-  return 0;
-*/
-
 
 int
 Spanner::compare (Spanner * const &p1, Spanner * const &p2)
@@ -218,28 +202,6 @@ Spanner::do_space_processing ()
     }
 }
 
-/*
-  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.");
-    }
-}
-
 /*
   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
@@ -249,22 +211,31 @@ 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
-  if(sc != NULL && sc->line_l ()->cols_.find_i (sc) == 0)
+  if(sc != NULL &&
+     sc->break_status_dir () == RIGHT)
     {
       // 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 bea519b2dd5d2427d12c0d4d90400ada382bf8d8..068ff7b2c2d0c6ef0adcf6b83412849ac2749384 100644 (file)
@@ -39,16 +39,15 @@ Side_position_interface::get_direction () const
 
   Direction relative_dir = UP;
   SCM reldir = elt_l_->get_elt_property ("side-relative-direction");   // should use a lambda.
-  if (isdir_b (d))
+  if (isdir_b (reldir))
     {
       relative_dir = to_dir (reldir);
     }
   
   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 ();
     }
   
@@ -65,29 +64,27 @@ Side_position_interface::side_position (Dimension_cache const * c)
 
   Interval dim;
   Axis  axis = c->axis ();
-  Graphical_element *common = me->parent_l (axis);
+  Score_element *common = me->parent_l (axis);
   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);
@@ -135,55 +132,62 @@ Side_position_interface::self_alignment (Dimension_cache const *c)
 
 
 Real
-Side_position_interface::aligned_side (Dimension_cache const *c)
+directed_round (Real f, Direction d )
+{
+  if (d < 0)
+    return floor (f);
+  else
+    return ceil (f);
+}
+
+Real
+Side_position_interface::quantised_position (Dimension_cache const *c)
 {
   Score_element * me = dynamic_cast<Score_element*> (c->element_l ());
   Side_position_interface s(me);
   Direction d = s.get_direction ();
-  Axis ax = c->axis ();
-  Real o = side_position (c);
-
-  Interval iv =  me->extent (ax);
 
-  if (!iv.empty_b ())
+  Staff_symbol_referencer *ref = dynamic_cast<Staff_symbol_referencer*> (me);
+  if (ref)
     {
-      o += - iv[-d];
+      Real p = ref->position_f ();
+      Real rp = directed_round (d, p);
 
-      SCM pad = me->get_elt_property ("padding");
-      if (gh_number_p (pad))
-       o += d *gh_scm2double (pad) ; 
+      int ip = int  (p);
+      if (!(ip % 2))
+       {
+         ip += d;
+         rp += d;
+       }
+
+      return (rp - p) * ref->staff_line_leading_f ();
     }
-  return o;
+  return 0.0;
 }
 
-#if 0
-
-/*
-  need cascading off callbacks for this.
- */
-Side_position_interface::quantised_side (Dimension_cache const *c)
+Real
+Side_position_interface::aligned_side (Dimension_cache const *c)
 {
   Score_element * me = dynamic_cast<Score_element*> (c->element_l ());
   Side_position_interface s(me);
   Direction d = s.get_direction ();
   Axis ax = c->axis ();
   Real o = side_position (c);
-  Staff_symbol_referencer * st = dynamic_cast (me);
 
-  if (st && ax == Y_AXIS)
+  Interval iv =  me->extent (ax);
+
+  if (!iv.empty_b ())
     {
-      st->translate_axis (o, Y_AXIS);
-      st->set_position ();
+      o += - iv[-d];
 
-      st->lines_i ();
-      st->quantise_to_next_line (d);
-      st->translate_axis (o, -Y_AXIS);
+      SCM pad = me->get_elt_property ("padding");
+      if (gh_number_p (pad))
+       o += d *gh_scm2double (pad) ; 
     }
-
   return o;
 }
-#endif
-  
+
+
 
 
 void
@@ -193,11 +197,20 @@ Side_position_interface::set_axis (Axis a)
   if (elt_l_->get_elt_property ("side-support") == SCM_UNDEFINED)
     elt_l_->set_elt_property ("side-support" ,SCM_EOL);
 
-  Axis other = Axis ((a +1)%2);
   elt_l_->dim_cache_[a]->off_callbacks_.push (aligned_side);
 }
 
 
+void
+Side_position_interface::set_quantised (Axis a)
+{
+  Dimension_cache * c = elt_l_->dim_cache_[a];
+  for (int i=0; i <  c->off_callbacks_.size (); i++)
+    if (c->off_callbacks_[i] == aligned_side)
+      c->off_callbacks_[i] = side_position ;
+  c->off_callbacks_.push (quantised_position);
+}
+
 Axis
 Side_position_interface::get_axis () const
 {
index 695d1099997b187860d8478940f1d87cd00ab27d..369df2928f637792af52f1849716c8f7fefd23c1 100644 (file)
@@ -58,11 +58,9 @@ Staff_symbol_engraver::do_removal_processing()
 void
 Staff_symbol_engraver::acknowledge_element (Score_element_info s)
 {
-  if (Staff_symbol_referencer * st = dynamic_cast<Staff_symbol_referencer*> (s.elem_l_))
-    {
-      st->set_staff_symbol (span_p_);      
-    }
-  
+  s.elem_l_->set_elt_property ("staff-symbol", span_p_->self_scm_);
+  s.elem_l_->add_dependency (span_p_); // UGH. UGH. UGH 
+
   SCM ss =s.elem_l_->remove_elt_property ("staff-support");
   if (gh_boolean_p (ss) && gh_scm2bool (ss))
     {
index 7ab14e91ba2c5f23cf9173af6d5cef278aafba7a..2bc87b2321a2c77af1c0753563155fee9aec335f 100644 (file)
@@ -29,18 +29,11 @@ Staff_symbol::do_print() const
 #endif
 }
 
-Interval
-Staff_symbol::do_height() const
-{
-  Interval i =Interval (0, staff_line_leading_f_ * (no_lines_i_-1));
-  i += - i.center ();
-  return i;
-}
 
 Molecule*
 Staff_symbol::do_brew_molecule_p() const
 {
-  Graphical_element * common
+  Score_element * common
     = spanned_drul_[LEFT]->common_refpoint (spanned_drul_[RIGHT], X_AXIS);
 
 #if 0
index 22b29af5397857dab5258a1f9dd9daaf2d13aeb7..f2532f0d43e0cbda93eef0d2356e565a8f7d4ef0 100644 (file)
 
 Staff_symbol_referencer::Staff_symbol_referencer ()
 {
-  staff_symbol_l_ =0;
-  position_f_ =0;
+  set_elt_property ("staff-position", gh_double2scm (0.0));
+  dim_cache_[Y_AXIS]->off_callbacks_.push (callback);
 }
 
-void
-Staff_symbol_referencer::do_substitute_element_pointer (Score_element *o,
-                                                       Score_element*n)
-{
-  if (staff_symbol_l_ == o)
-    {
-      staff_symbol_l_ = dynamic_cast<Staff_symbol*> (n);
-    }
-}
 
 int
 Staff_symbol_referencer::lines_i () const
 {
-  return (staff_symbol_l_) ?  staff_symbol_l_->no_lines_i_ : 5;
-}
-
-void
-Staff_symbol_referencer::set_staff_symbol (Staff_symbol*s)
-{
-  staff_symbol_l_ =s;
-  add_dependency (s);
+  Staff_symbol *st = staff_symbol_l ();
+  return st  ?  st->no_lines_i_ : 5;
 }
 
 Staff_symbol*
 Staff_symbol_referencer::staff_symbol_l () const
 {
-  return staff_symbol_l_;
+  SCM st = get_elt_property ("staff-symbol");
+  return dynamic_cast<Staff_symbol* > (unsmob_element(st));
 }
 
 Real
 Staff_symbol_referencer::staff_line_leading_f () const
 {
-  if (staff_symbol_l_)
-    return  staff_symbol_l_->staff_line_leading_f_;
+  Staff_symbol * st = staff_symbol_l ();
+  if (st)
+    return st->staff_line_leading_f_;
   else if (pscore_l_ && paper_l ())
     paper_l ()->get_var ("interline");
  
   return 0.0;
 }
 
+
 Real
 Staff_symbol_referencer::position_f () const
 {
-  Real p = position_f_;
-  if (staff_symbol_l_ )
+  Real p =0.0;
+  SCM pos = get_elt_property ("staff-position");
+  if (gh_number_p (pos))
+    p = gh_scm2double (pos);
+
+  Staff_symbol * st = staff_symbol_l ();
+  if (st)
     {
-      Graphical_element * c = common_refpoint (staff_symbol_l_, Y_AXIS);
-      Real y = relative_coordinate (c, Y_AXIS) - staff_symbol_l_->relative_coordinate (c, Y_AXIS);
+      Score_element * c = common_refpoint (st, Y_AXIS);
+      Real y = relative_coordinate (c, Y_AXIS)
+       - st->relative_coordinate (c, Y_AXIS);
 
       p += 2.0 * y / staff_line_leading_f ();
     }
@@ -78,23 +72,38 @@ Staff_symbol_referencer::position_f () const
 /*
   should use offset callback!
  */
-void
-Staff_symbol_referencer::do_pre_processing ()
+Real
+Staff_symbol_referencer::callback (Dimension_cache const * c)
 {
-  translate_axis (position_f_ * staff_line_leading_f () /2.0, Y_AXIS);
-  position_f_ =0;
+  Score_element * sc = dynamic_cast<Score_element*> (c->element_l ());
+  Staff_symbol_referencer * ref = dynamic_cast<Staff_symbol_referencer*> (sc);
+  SCM pos = sc->get_elt_property ("staff-position");
+  Real off =0.0;
+  if (gh_number_p (pos))
+    {
+      off = gh_scm2double (pos) * ref->staff_line_leading_f () /2.0;
+    }
+  sc->set_elt_property ("staff-position", gh_double2scm (0.0));
+
+  return off;
 }
 
 
 void
 Staff_symbol_referencer::set_position (Real p)
 {
-  Real halfspace =  staff_line_leading_f ()* 0.5;
+  Real halfspace = staff_line_leading_f ()* 0.5;
   
   translate_axis (- halfspace * position_f (), Y_AXIS);
-  if (staff_symbol_l_)
+  Staff_symbol *st = staff_symbol_l ();
+  if (st)
     translate_axis (halfspace * p, Y_AXIS);
   else
-    position_f_ =   p;
+    {
+      //      SCM pos = get_elt_property ("staff-position");
+      set_elt_property ("staff-position",
+                       gh_double2scm (p));
+                       //                      gh_double2scm (p + gh_scm2double (pos)));
+    }
 }
 
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 6269efb796bdac48142c5d8c8fc916cfae42585a..ee0faf9721a4a60516b2d21e82a5444b596b191f 100644 (file)
@@ -29,13 +29,13 @@ Stem_info::Stem_info ()
 
   GURG UGRGINRG INA UG R
 
-  JUNKME -> This should be in Beam
+  JUNKME -> this should set elt properties of STEM.
 */
 Stem_info::Stem_info (Stem*s, int mult)
 {
   mult_i_ =mult;
   stem_l_ = s;
-  Beam* beam_l = stem_l_->beam_l_;
+  Beam* beam_l = stem_l_->beam_l ();
   
   x_ = stem_l_->hpos_f ();
   set_direction (stem_l_->get_direction ());
index bbc4b0b50ad8b887d9fb4ec7411aa4b7ef24ea08..d55cd55272200002c3036e6de523a77e3c91e5fd 100644 (file)
 #include "lookup.hh"
 #include "stem.hh"
 #include "offset.hh"
+#include "dimension-cache.hh"
 
 Stem_tremolo::Stem_tremolo ()
 {
-  stem_l_ = 0;
+  set_elt_property ("stem", SCM_EOL);
   abbrev_flags_i_ = 1;
 }
 
@@ -27,31 +28,37 @@ Stem_tremolo::do_print () const
   DEBUG_OUT << "abbrev_flags_i_ " << abbrev_flags_i_;
 }
 
-Interval
-Stem_tremolo::do_width () const
+Stem *
+Stem_tremolo::stem_l ()const
 {
-  Real space = stem_l_->staff_line_leading_f ();
-  return Interval (-space, space);
+  SCM s =   get_elt_property ("stem");
+
+  return dynamic_cast<Stem*> (  unsmob_element (s));
 }
 
-void
-Stem_tremolo::do_pre_processing ()
+Interval
+Stem_tremolo::dim_callback (Dimension_cache const *c) 
 {
+  Stem_tremolo * s = dynamic_cast<Stem_tremolo*> (c->element_l ());
+  Real space = s->stem_l ()->staff_line_leading_f ();
+  return Interval (-space, space);
 }
 
+
 Molecule*
 Stem_tremolo::do_brew_molecule_p () const
 {
+  Stem * st = stem_l ();
   int mult =0;
-  if (Beam * b = stem_l_->beam_l_)
+  if (Beam * b = st->beam_l ())
     {
-      Stem_info i = b->get_stem_info (stem_l_);
+      Stem_info i = b->get_stem_info (st);
       mult = i.mult_i_;
     }
   
   Real interbeam_f = paper_l ()->interbeam_f (mult);
   Real w  = gh_scm2double (get_elt_property ("beam-width"));
-  Real space = stem_l_->staff_line_leading_f ();
+  Real space = st->staff_line_leading_f ();
   Real internote_f = space/2;
   
   Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));
@@ -59,10 +66,10 @@ Stem_tremolo::do_brew_molecule_p () const
   int beams_i = 0;
   Real slope_f = internote_f / 4 / internote_f;        // HUH?
 
-  if (stem_l_ && stem_l_->beam_l_) {
-    slope_f = stem_l_->beam_l_->slope_f_;
+  if (st && st->beam_l ()) {
+    slope_f = st->beam_l ()->slope_f_;
     // ugh, rather calc from Stem_tremolo_req
-    beams_i = stem_l_->beams_i_drul_[RIGHT] >? stem_l_->beams_i_drul_[LEFT];
+    beams_i = st->beams_i_drul_[RIGHT] >? st->beams_i_drul_[LEFT];
   } 
   Real sl = slope_f * internote_f;
 
@@ -78,35 +85,35 @@ Stem_tremolo::do_brew_molecule_p () const
     }
   beams->translate_axis (-beams->extent ()[Y_AXIS].center (), Y_AXIS);
 
-  if (stem_l_)
+  if (st)
     { 
-      if (stem_l_->beam_l_)
+      if (st->beam_l ())
         {
-         beams->translate (Offset(stem_l_->hpos_f () - hpos_f (),
-           stem_l_->stem_end_f () * internote_f - 
-           stem_l_->beam_l_->get_direction () * beams_i * interbeam_f));
+         beams->translate (Offset(st->hpos_f () - hpos_f (),
+           st->stem_end_f () * internote_f - 
+           st->beam_l ()->get_direction () * beams_i * interbeam_f));
        }
       else
        {  
          /*
            Beams should intersect one beamthickness below staff end
           */
-         Real dy = - beams->extent ()[Y_AXIS].length () / 2 * stem_l_->get_direction ();
+         Real dy = - beams->extent ()[Y_AXIS].length () / 2 * st->get_direction ();
 
          /*
            uhg.  Should use relative coords and placement
          */
-         Real whole_note_correction = (stem_l_ && stem_l_->invisible_b( ))
-           ? -stem_l_->get_direction () * stem_l_->note_delta_f ()/2
+         Real whole_note_correction = (st && st->invisible_b( ))
+           ? -st->get_direction () * st->note_delta_f ()/2
            : 0.0;
 
          /*
            UGH. Internote fudging.
           */
          dy /= internote_f;
-         dy += stem_l_->stem_end_f ();
+         dy += st->stem_end_f ();
          dy *= internote_f;
-         beams->translate (Offset(stem_l_->hpos_f () - hpos_f ()+
+         beams->translate (Offset(st->hpos_f () - hpos_f ()+
                                   whole_note_correction, dy));
        }
 
@@ -119,18 +126,11 @@ Stem_tremolo::do_brew_molecule_p () const
   return beams;
 }
 
-void
-Stem_tremolo::do_substitute_element_pointer (Score_element*o, Score_element*n)
-{
-  if (stem_l_ == o)
-    stem_l_ = dynamic_cast<Stem*> (n);
-}
-
 
 void
 Stem_tremolo::set_stem (Stem *s)
 {
-  stem_l_ = s;
+  set_elt_property ("stem", s->self_scm_);
   add_dependency (s);
 }
 
index 2975f3321afe187b6c8423c9b6297fcb2ad438f9..1edd92bc53cb3f7c7dea32e05afba42394483379 100644 (file)
@@ -7,7 +7,7 @@
 
   TODO: This is way too hairy
 */
-
+#include "dimension-cache.hh"
 #include "stem.hh"
 #include "debug.hh"
 #include "paper-def.hh"
 #include "misc.hh"
 #include "beam.hh"
 #include "rest.hh"
+#include "group-interface.hh"
 
 Stem::Stem ()
 {
   beams_i_drul_[LEFT] = beams_i_drul_[RIGHT] = -1;
   yextent_drul_[DOWN] = yextent_drul_[UP] = 0;
   flag_i_ = 2;
-  beam_l_ = 0;
 }
 
 Interval_t<int>
@@ -35,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;
     }
@@ -55,8 +58,6 @@ Stem::do_print () const
 {
 #ifndef NPRINT
   DEBUG_OUT << "flag "<< flag_i_;
-  if (beam_l_)
-    DEBUG_OUT << "beamed";
 #endif
 }
 
@@ -99,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
@@ -199,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 ());
     }
 }
 
@@ -238,8 +257,11 @@ Stem::do_pre_processing ()
   if (invisible_b ())
     {
       set_elt_property ("transparent", SCM_BOOL_T);
+      set_empty (Y_AXIS);      
+      set_empty (X_AXIS);      
     }
-  set_empty (invisible_b (), X_AXIS, Y_AXIS);
+
+
   set_spacing_hints ();
 }
 
@@ -290,15 +312,17 @@ Stem::flag () const
 }
 
 Interval
-Stem::do_width () const
+Stem::dim_callback (Dimension_cache const* c) 
 {
+  Stem * s = dynamic_cast<Stem*> (c->element_l ());
+  
   Interval r (0, 0);
-  if (beam_l_ || abs (flag_i_) <= 2)
+  if (s->get_elt_property ("beam") != SCM_UNDEFINED || abs (s->flag_i_) <= 2)
     ;  // TODO!
   else
     {
-      r = flag ().dim_.x ();
-      r += note_delta_f ();
+      r = s->flag ().dim_.x ();
+      r += s->note_delta_f ();
     }
   return r;
 }
@@ -316,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 ())
@@ -328,14 +352,15 @@ Stem::do_brew_molecule_p () const
       mol_p->add_molecule (ss);
     }
 
-  if (!beam_l_ && abs (flag_i_) > 2)
+  if (get_elt_property ("beam") == SCM_UNDEFINED
+      && abs (flag_i_) > 2)
     {
       Molecule fl = flag ();
       fl.translate_axis(stem_y[get_direction ()]*dy, Y_AXIS);
       mol_p->add_molecule (fl);
     }
 
-  if (head_l_arr_.size())
+  if (first_head ())
     {
       mol_p->translate_axis (note_delta_f (), X_AXIS);
     }
@@ -346,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);
@@ -366,18 +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)
+
+Beam*
+Stem::beam_l ()const
 {
-  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));
-  if (Beam* b = dynamic_cast<Beam*> (o))
-    {
-      if (b == beam_l_) 
-       beam_l_ = dynamic_cast<Beam*> (n);
-    }
-  Staff_symbol_referencer::do_substitute_element_pointer (o,n);
+  SCM b=  get_elt_property ("beam");
+  return dynamic_cast<Beam*> (unsmob_element (b));
 }
-
index 90f8d49700ce02fa46f1697485fa4fe084affa52..dee963dedd196381efb0bb04d981e5d88767f01c 100644 (file)
@@ -53,7 +53,7 @@ void
 Super_element::breakable_col_processing ()
 {
   calculate_dependencies (PREBROKEN, PREBROKEN, &Score_element::do_breakable_col_processing);
-  calculate_dependencies (PREBROKEN_SECOND, PREBROKEN_SECOND, &Score_element::handle_prebroken_dependents);
+  //  calculate_dependencies (PREBROKEN_SECOND, PREBROKEN_SECOND, &Score_element::handle_prebroken_dependents);
 }
 
 void
@@ -65,8 +65,8 @@ Super_element::break_processing ()
 void
 Super_element::post_processing ()
 {
-  calculate_dependencies (BROKEN_SECOND, BROKEN_SECOND,
-                         &Score_element::handle_broken_dependents);
+  //  calculate_dependencies (BROKEN_SECOND, BROKEN_SECOND,
+  //             &Score_element::handle_broken_dependents);
   calculate_dependencies (POSTCALCED, POSTCALCING, &Score_element::do_post_processing);
 }
 
index 718845c75577dedb6cdeec3b720f85f76876174a..40646392ed5a4923bacddde0d0207c7fb22052fb 100644 (file)
@@ -104,7 +104,7 @@ Text_engraver::do_process_requests ()
       SCM empty = get_property ("textEmptyDimension", 0);
       if (gh_boolean_p (empty) && gh_scm2bool (empty))
        {
-         text->set_empty (true, X_AXIS);
+         text->set_empty (X_AXIS);
        }
 
       announce_element (Score_element_info (text, r));
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 61ac19f2dc3eb33ba66ac5206c5f2ad08370248a..4e60c76a0119ba2eca671450f09c77f012feedbd 100644 (file)
@@ -96,10 +96,13 @@ grace_forced_stem_shorten3 = \grace_forced_stem_shorten2;
 % * MEDIAN   : mean centre distance weighted per note
 %
 
-#'slope-quantisation = #'normal
 #'beam-dir-algorithm = #'majority      %urg.
 #'Stem_tremolo::beam-width = 1.5 * \quartwidth ; 
 
+% The beams should be prevented to conflict with the stafflines, 
+% especially at small slopes.
+#'slope-quantisation = #'normal
+
 
 
 #'Clef_item::visibility-lambda = #postbreak-only-visibility
index 2c2e0510867cb57e89c360993056be1d6805daf9..8a33b3279c7e33b5cf1310b95c83f9a76992b8e5 100644 (file)
@@ -44,5 +44,5 @@ localinstall:
        $(LN_S) $(TEX_TFMDIR) $(datadir)/cmtfm
 
 local-WWW-clean:
-       $(depth)/buildscripts/out/clean-fonts
+       $(SHELL) $(depth)/buildscripts/clean-fonts.sh
 
index c9e18e1f5dea00f25a5cf8b44125cd5019409ab7..e37947d68b70cce8c0ffc9bd06a74eb7f0c1862b 100644 (file)
@@ -44,7 +44,7 @@ Note: Original key F.
 \version "1.3.4";
 
 vocalVerse = \notes\relative c''{
-       \property Voice.dynamicDirection=1
+       \property Voice.dynamicDirection=\up
        \times 2/3 { [ g8( )as] g } c4. g8 |
        \times 2/3 { [ f8( )g] f } c'4 f,8 r |
        g4.-> f8 \times 2/3 { [ f( )es] d } |
@@ -73,7 +73,7 @@ vocalVerse = \notes\relative c''{
 }
 
 vocalThrough = \notes\relative c{
-       \property Voice.dynamicDirection=1
+       \property Voice.dynamicDirection=\up
        g''8. g16 b8. b16 d8. d16 |
        c4 b r |
        g4. b8 d8. c16 |
@@ -176,7 +176,7 @@ trebleVerseOne = \notes\relative c{
 }
 
 trebleEentje = \notes \relative c'{
-       \context Voice=one \property Voice.verticalDirection = 0
+       \context Voice=one \property Voice.verticalDirection = \center
        <e2 e'> <e4 g>|
        <f2\mf as!(> <as8.->( c> <)f16 )as> |
        <e4. g> <e8-. g-.(> <e-. g-.> <e-. )g-.> |
@@ -190,7 +190,7 @@ trebleEentje = \notes \relative c'{
 }
 
 trebleThrough = \notes \relative c'{
-       \context Voice=one \property Voice.verticalDirection = 0
+       \context Voice=one \property Voice.verticalDirection = \center
        <e2. e'> |
        %61
        R2. |
@@ -348,8 +348,8 @@ lyricStaff = \context Lyrics = lyric<
 vocals = \notes{
        \clef treble;
        % certainly no auto-beaming for vocals
-       \property Voice.noAutoBeaming = "1"
-       \property Staff.automaticMelismata=1
+       \property Voice.noAutoBeaming = ##t
+       \property Staff.automaticMelismata= ##t
 
        \property Voice.dynamicDirection = \up
        \skip 4 * 12; 
@@ -367,7 +367,7 @@ vocalStaff = \context Staff = vocal<
 
 treble = {
        \clef treble;
-       \property Voice.beamAutoBegin=0
+       \property Voice.beamAutoBegin= #(make-moment 0 1)
        \trebleIntro 
        \trebleVerseOne 
        \trebleEentje