]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.11
authorfred <fred>
Tue, 26 Mar 2002 22:44:12 +0000 (22:44 +0000)
committerfred <fred>
Tue, 26 Mar 2002 22:44:12 +0000 (22:44 +0000)
76 files changed:
CHANGES
Documentation/programmer/regression-test.tely
TODO
lily/align-element.cc
lily/axis-group-element.cc
lily/axis-group-engraver.cc
lily/bar-script-engraver.cc
lily/beam-engraver.cc
lily/beam.cc
lily/bow.cc
lily/breathing-sign-engraver.cc
lily/breathing-sign.cc
lily/chord-tremolo-engraver.cc
lily/clef-engraver.cc
lily/clef-item.cc
lily/collision.cc
lily/dimension-cache.cc
lily/directional-spanner.cc
lily/dot-column.cc
lily/dots.cc
lily/dynamic-engraver.cc
lily/grace-position-engraver.cc
lily/group-interface.cc
lily/include/axis-group-element.hh
lily/include/axis-group-item.hh
lily/include/axis-group-spanner.hh
lily/include/beam.hh
lily/include/breathing-sign.hh
lily/include/clef-item.hh
lily/include/dots.hh
lily/include/group-interface.hh
lily/include/key-item.hh
lily/include/local-key-item.hh
lily/include/multi-measure-rest.hh
lily/include/note-head.hh
lily/include/rest.hh
lily/include/rhythmic-head.hh
lily/include/score-element.hh
lily/include/side-position-interface.hh [new file with mode: 0644]
lily/include/spanner.hh
lily/include/staff-bar.hh
lily/include/staff-symbol.hh
lily/include/stem-info.hh
lily/include/stem.hh
lily/key-engraver.cc
lily/key-item.cc
lily/line-of-score.cc
lily/local-key-engraver.cc
lily/local-key-item.cc
lily/multi-measure-rest-engraver.cc
lily/multi-measure-rest.cc
lily/note-column.cc
lily/note-head-side.cc
lily/note-head.cc
lily/note-heads-engraver.cc
lily/paper-score.cc
lily/pitch-squash-engraver.cc
lily/rest-engraver.cc
lily/rest.cc
lily/rhythmic-head.cc
lily/score-element.cc
lily/script-column-engraver.cc
lily/script-column.cc
lily/script-engraver.cc
lily/script.cc
lily/spanner.cc
lily/staff-bar.cc
lily/staff-margin-engraver.cc
lily/staff-symbol-engraver.cc [new file with mode: 0644]
lily/staff-symbol.cc [new file with mode: 0644]
lily/stem-engraver.cc
lily/stem-tremolo.cc
lily/stem.cc
lily/tie.cc
lily/vertical-align-engraver.cc
ly/params.ly

diff --git a/CHANGES b/CHANGES
index 6742e3945cc6943ca5f3a6296e03460d3c3497fe..db957bac39577d598fcd0ca7d25688b6e5a4b5cf 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,20 @@
+
+pl 10.uu1
+       - various small bfs
+       - bf: alignment reversed
+       - Staff_symbol_referencer -> Staff_symbol_referencer_interface
+       - bf: staccato pos
+       - Knee fixes (thanks, Jan)
+
+pl 10.jcn2
+       - fixes for invisible beamed stems
+       - removed steminfo from properties, don't cache Stem_info
+
+pl 10.jcn1
+       - steminfo to properties
+       - dropped internote dim for stem-beams
+
+**********
 pl 9.hwn1
        - abstracting Staff_symbol_referencer to an interface.
        - quantised_position for staccato dots.
index 249626288342b9cdd997db1572fe3a12b74b5933..de989ac512c0489c87802262fcc253f5f6deb4eb 100644 (file)
@@ -67,7 +67,7 @@ like beam segments crossing stems.  If the stem is in a beam, the
 tremolo must be parallel to the beam.  If the stem is invisible
 (eg. on a whole note), the tremolo must be centered on the note.
 
-@mudelafile{stem-tremolo.ly}
+@c @mu delafile{stem-tremolo.ly}
 
 Chord tremolos look like beams, but are a kind of repeat symbol.
 To avoid confusion, chord tremolo beams do not reach the stems, but 
@@ -75,7 +75,7 @@ leave a gap.  Chord tremolo beams on half notes are not ambiguous,
 as half notes cannot appear in a regular beam, and should reach the 
 stems.
   
-@mudelafile{chord-tremolo.sly}
+@c miudelafile{chord-tremolo.sly}
 
 Beams, stems and noteheads often have communication troubles, since
 the two systems for y dimensions (1 unit = staffspace, 1 unit = 1
diff --git a/TODO b/TODO
index 48be8ed92c40cafe3ba2b4e9b4ea069641fa8cba..5bf1c889c4336c4c748605122360e19c854820d7 100644 (file)
--- a/TODO
+++ b/TODO
@@ -11,6 +11,8 @@ Grep -i for TODO, FIXME and ugh/ugr/urg.
 .* TODO
 . * use hash tabs iso. alist_ for elt property?
 . * agressive type-checking for SCM stuff.
+. * use  "staff-space" and "half-space" iso interline,
+    staff_line_leading () etc.
 
 . * TODO^2:
 .  * make  a TODO.texi, like http://www.gnu.org/software/guile/ideas.html
@@ -24,8 +26,6 @@ Grep -i for TODO, FIXME and ugh/ugr/urg.
        ctor_dict["Score_element"]->create_func ();
 . * acc at tied note after linebreak.
 . * fix font-naming and selecting
-. * fix naming: \interline Context.staffLineLeading, staff_line_leading (),
-staff_position staff_space
 . * chord tonic: placement of accidental  C#, Cb (from scm and C++)
 . * note head on stem err msg in dutch.
 . * why need to run -C mf twice?
index 4134d8e3e2579cfb1185d0b9cce9ee586bff1aa2..5f4080015c39040d4b9a1b3f2f90e4e2c3c47244 100644 (file)
@@ -97,12 +97,13 @@ Align_element::do_side_processing ()
   if (center_f)
     translate_axis ( - center_f, axis ());
 
-  dim_cache_[axis ()]->invalidate ();
+
+  //  dim_cache_[axis ()]->invalidate ();
+
 }
 
 Align_element::Align_element()
 {
-  ordered_b_ = true;
   threshold_interval_ = Interval (0, Interval::infinity ());
   stacking_dir_ = DOWN;
   align_dir_ = CENTER;
index 5992ea461455522ca4fa17bf50d877b6b6155042..081b42a22faee300ad1e5c6ac66dc0771df5fe8d 100644 (file)
@@ -6,9 +6,9 @@
   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "axis-group-element.hh"
 #include "axis-group-element.hh"
 #include "dimension-cache.hh"
+#include "group-interface.hh"
 
 Link_array<Score_element>
 Axis_group_element::get_extra_dependencies() const
@@ -20,17 +20,8 @@ Axis_group_element::get_extra_dependencies() const
 Link_array<Score_element>
 Axis_group_element::elem_l_arr () const
 {  
-  /*
-    ugh. I know
-  */
-  Link_array<Score_element> r;
-  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;
+  return
+    Group_interface__extract_elements (this, (Score_element*)0, "elements");
 }
 
 Link_array<Score_element> 
@@ -96,15 +87,6 @@ Axis_group_element::extent_callback (Dimension_cache const *c)
 }
 
 
-/*
-  UGH.
- */
-void
-Axis_group_element::add_extra_element (Score_element *e)
-{
-  add_element (e);
-}
-
 
 void
 Axis_group_element::add_element (Score_element *e)
@@ -117,16 +99,7 @@ Axis_group_element::add_element (Score_element *e)
       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);
+  Group_interface gi (this);
+  gi.add_element (e);
 }
 
-
-
-
-
-
-
index 85d21f0f8cebad79006f2013b3538536841c22ba..22cfb5fdf3f4aba25acfb76700dbea873a31da39 100644 (file)
@@ -55,7 +55,7 @@ Axis_group_engraver::process_acknowledged ()
               && ! dynamic_cast<Axis_group_element*> (elts_[i]->parent_l (Y_AXIS)))
               
        {
-         staffline_p_->add_extra_element (elts_[i]);
+         staffline_p_->add_element (elts_[i]);
        }
     }
   elts_.clear ();
index 1e82d91657cd52f4ebbfc160645218eb21acb15c..f4fa06452c4f8cfc33c7148f8e94af75cebba814 100644 (file)
@@ -10,7 +10,7 @@
 #include "bar-script-engraver.hh"
 #include "bar.hh"
 #include "clef-item.hh"
-#include "staff-side.hh"
+#include "side-position-interface.hh"
 #include "text-item.hh"
 #include "lily-guile.hh"
 #include "paper-column.hh"
index 1d1a70addff36b0a19ba6a42bec0fed9bd58ec70..1fa729cc51a0e8a6d41c22d9866ed7a2268e4f42 100644 (file)
@@ -183,7 +183,8 @@ Beam_engraver::acknowledge_element (Score_element_info info)
          return;
        }
 
-      stem_l->flag_i_ = rhythmic_req->duration_.durlog_i_;
+      stem_l->set_elt_property ("duration-log",
+                               gh_int2scm (rhythmic_req->duration_.durlog_i_));
       Moment stem_location = now_mom () - beam_start_mom_ + beam_start_location_;
       beam_info_p_->add_stem (stem_location, rhythmic_req->duration_.durlog_i_ - 2);
       beam_p_->add_stem (stem_l);
index 0335ff72565218e592c032d95588e3cf6f1af069..8b25aeb5d5550e8883e8ca12947be5534acc3ec6 100644 (file)
   [TODO]
     * center beam symbol
     * less hairy code
-    * redo grouping 
-
-TODO:
-
-The relationship Stem <-> Beam is way too hairy.  Let's figure who
-needs what, and what information should be available when.
 
     */
 
@@ -36,6 +30,8 @@ needs what, and what information should be available when.
 #include "paper-def.hh"
 #include "lookup.hh"
 #include "group-interface.hh"
+#include "staff-symbol-referencer.hh"
+#include "cross-staff.hh"
 
 Beam::Beam ()
 {
@@ -44,7 +40,7 @@ Beam::Beam ()
   
   slope_f_ = 0;
   left_y_ = 0;
-  multiple_i_ = 0;
+  multiplicity_i_ = 0;
 }
 
 /*
@@ -63,6 +59,54 @@ Beam::stem_count ()const
   return gi.count ();
 }
 
+Stem*
+Beam::stem_top ()const
+{
+  return Group_interface__extract_elements ((Beam*) this, (Stem*) 0, "stems")[stem_count () - 1];
+}
+
+/* burp */
+int
+Beam::visible_stem_count () const
+{
+  int c = 0;
+  for (int i = 0; i < stem_count (); i++)
+    {
+      if (!stem (i)->invisible_b ())
+        c++;
+    }
+  return c;
+}
+
+Stem*
+Beam::first_visible_stem () const
+{
+  for (int i = 0; i < stem_count (); i++)
+    {
+      Stem* s = stem (i);
+      if (!s->invisible_b ())
+        return s;
+    }
+
+  assert (0);
+  // sigh
+  return 0;
+}
+
+Stem*
+Beam::last_visible_stem () const
+{
+  for (int i = stem_count (); i > 0; i--)
+    {
+      Stem* s = stem (i - 1);
+      if (!s->invisible_b ())
+        return s;
+    }
+
+  assert (0);
+  // sigh
+  return 0;
+}
 
 void
 Beam::add_stem (Stem*s)
@@ -81,27 +125,14 @@ Beam::add_stem (Stem*s)
     set_bounds (RIGHT,s);
 }
 
-Stem_info
-Beam::get_stem_info (Stem *s)
-{
-  Stem_info i;
-  for (int i=0; i < sinfo_.size (); i++)
-    {
-      if (sinfo_[i].stem_l_ == s)
-       return sinfo_[i];
-    }
-  assert (false);
-  return i;
-}
-
 Molecule*
 Beam::do_brew_molecule_p () const
 {
   Molecule *mol_p = new Molecule;
-  if (!sinfo_.size ())
+  if (!stem_count ())
     return mol_p;
   
-  Real x0 = stem (0)->hpos_f ();
+  Real x0 = first_visible_stem ()->hpos_f ();
   for (int j=0; j <stem_count (); j++)
     {
       Stem *i = stem (j);
@@ -110,8 +141,7 @@ Beam::do_brew_molecule_p () const
 
       Molecule sb = stem_beams (i, next, prev);
       Real  x = i->hpos_f ()-x0;
-      sb.translate (Offset (x, (x * slope_f_ + left_y_) *
-                           i->staff_line_leading_f ()/2 ));
+      sb.translate (Offset (x, x * slope_f_ + left_y_));
       mol_p->add_molecule (sb);
     }
   mol_p->translate_axis (x0 
@@ -123,11 +153,8 @@ Beam::do_brew_molecule_p () const
 Offset
 Beam::center () const
 {
-  Stem_info si = sinfo_[0];
-  
-  Real w= (si.stem_l_->note_delta_f () + extent (X_AXIS).length ())/2.0;
-  return Offset (w, ( w* slope_f_) *
-                si.stem_l_->staff_line_leading_f ()/2);
+  Real w = (first_visible_stem ()->note_delta_f () + extent (X_AXIS).length ())/2.0;
+  return Offset (w, w * slope_f_);
 }
 
 /*
@@ -139,17 +166,17 @@ Beam::auto_knee (SCM gap, bool interstaff_b)
 {
   bool knee = false;
   int knee_y = 0;
-  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 < stem_count (); i++)
         {
-         bool is_b = (bool)(sinfo_[i].interstaff_f_ - sinfo_[i-1].interstaff_f_);
-         int l_y = (int)(stem (i-1)->chord_start_f () / internote_f)
-           + (int)sinfo_[i-1].interstaff_f_;
-         int r_y = (int)(stem (i)->chord_start_f () / internote_f)
-           + (int)sinfo_[i].interstaff_f_;
+         bool is_b = (bool)(calc_interstaff_dist (stem (i), this) 
+           - calc_interstaff_dist (stem (i-1), this));
+         int l_y = (int)(stem (i-1)->chord_start_f ())
+           + (int)calc_interstaff_dist (stem (i-1), this);
+         int r_y = (int)(stem (i)->chord_start_f ())
+           + (int)calc_interstaff_dist (stem (i), this);
          int gap_i = r_y - l_y;
 
          /*
@@ -168,8 +195,8 @@ Beam::auto_knee (SCM gap, bool interstaff_b)
     {
       for (int i=0; i < stem_count (); i++)
         {
-         int y = (int)(stem (i)->chord_start_f () / internote_f)
-           + (int)sinfo_[i].interstaff_f_;
+         int y = (int)(stem (i)->chord_start_f ())
+           + (int)calc_interstaff_dist (stem (i), this);
          stem (i)->set_direction ( y < knee_y ? UP : DOWN);
          stem (i)->set_elt_property ("dir-forced", SCM_BOOL_T);
        }
@@ -212,20 +239,20 @@ Beam::do_print () const
 void
 Beam::do_post_processing ()
 {
-  if (stem_count () < 2)
+  if (visible_stem_count () < 2)
     {
       warning (_ ("beam with less than two stems"));
       set_elt_property ("transparent", SCM_BOOL_T);
       return;
     }
-  set_steminfo ();
+  set_stem_shorten ();
   if (auto_knees ())
     {
       /*
        if auto-knee did its work, most probably stem directions
        have changed, so we must recalculate all.
        */
-      set_direction ( get_default_dir ());
+      set_direction (get_default_dir ());
       set_direction (get_direction ());
 
       /* auto-knees used to only work for slope = 0
@@ -233,22 +260,14 @@ Beam::do_post_processing ()
          set_elt_property ("damping", gh_int2scm(1000));
       */
 
-      sinfo_.clear ();
-      set_steminfo ();
+      set_stem_shorten ();
     }
   calculate_slope ();
   set_stemlens ();
 }
 
 
-#if 0
-Interval
-Beam::do_width () const
-{
-  return Interval (stem (0)->hpos_f (),
-                  stems_.top ()->hpos_f ());
-}
-#endif 
+
 
 Direction
 Beam::get_default_dir () const
@@ -325,7 +344,7 @@ Beam::set_direction (Direction d)
       Stem *s = stem (i);
       s->set_elt_property ("beam-dir", gh_int2scm (d));
 
-      SCM force = s->remove_elt_property ("dir-forced");
+      SCM force = s->get_elt_property ("dir-forced"); // remove_prop?
       if (force == SCM_UNDEFINED)
        s->set_direction ( d);
     }
@@ -338,12 +357,16 @@ Beam::set_direction (Direction d)
 void
 Beam::solve_slope ()
 {
-  assert (sinfo_.size () > 1);
+  assert (visible_stem_count () > 1);
 
   Least_squares l;
-  for (int i=0; i < sinfo_.size (); i++)
+  Real x0 = first_visible_stem ()->hpos_f ();
+  for (int i=0; i < stem_count (); i++)
     {
-      l.input.push (Offset (sinfo_[i].x_, sinfo_[i].idealy_f_));
+      Stem* s = stem (i);
+      if (s->invisible_b ())
+        continue;
+      l.input.push (Offset (s->hpos_f () - x0, s->calc_stem_info ().idealy_f_));
     }
   l.minimise (slope_f_, left_y_);
 }
@@ -351,56 +374,67 @@ Beam::solve_slope ()
 /*
   ugh. Naming: this doesn't check, but sets as well.
  */
-  
 Real
 Beam::check_stemlengths_f (bool set_b)
 {
-  Real interbeam_f = paper_l ()->interbeam_f (multiple_i_);
+  Real interbeam_f = paper_l ()->interbeam_f (multiplicity_i_);
 
   Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));
   Real staffline_f = paper_l ()-> get_var ("stafflinethickness");
   Real epsilon_f = staffline_f / 8;
   Real dy_f = 0.0;
-  for (int i=0; i < sinfo_.size (); i++)
+  Real x0 = first_visible_stem ()->hpos_f ();
+  Real internote_f = paper_l ()->get_var ("interline");
+  for (int i=0; i < stem_count (); i++)
     {
-      Real y = sinfo_[i].x_ * slope_f_ + left_y_;
+      Stem* s = stem (i);
+      if (s->invisible_b ())
+       continue;
+      Real y = (s->hpos_f () - x0) * slope_f_ + left_y_;
+      Stem_info info = s->calc_stem_info ();
 
       // correct for knee
-      if (get_direction () != sinfo_[i].get_direction ())
+      if (get_direction () != s->get_direction ())
        {
-         Real internote_f = sinfo_[i].stem_l_->staff_line_leading_f ()/2;
          y -= get_direction () * (beam_f / 2
-                      + (sinfo_[i].mult_i_ - 1) * interbeam_f) / internote_f;
-         if (!i && sinfo_[i].stem_l_->staff_symbol_l () !=
-             sinfo_.top ().stem_l_->staff_symbol_l ())
-           y += get_direction () * (multiple_i_ - (sinfo_[i].stem_l_->flag_i_ - 2) >? 0)
-             * interbeam_f / internote_f;
+           + (multiplicity_i_ - 1) * interbeam_f);
+
+
+         Staff_symbol_referencer_interface s1 (s);
+         Staff_symbol_referencer_interface s2 (stem_top ());
+         
+         if (!i
+           && s1.staff_symbol_l () != s2.staff_symbol_l ())
+           y += get_direction () * (multiplicity_i_ - (s->flag_i () - 2) >? 0)
+             * interbeam_f;
        }
 
+      /* caution: stem measures in staff-positions */
       if (set_b)
-       sinfo_[i].stem_l_->set_stemend (y - sinfo_[i].interstaff_f_);
+       s->set_stemend ((y - calc_interstaff_dist (s, this))
+                              / internote_f);
        
       y *= get_direction ();
-      if (y > sinfo_[i].maxy_f_)
-       dy_f = dy_f <? sinfo_[i].maxy_f_ - y;
-      if (y < sinfo_[i].miny_f_)
+      if (y > info.maxy_f_)
+       dy_f = dy_f <? info.maxy_f_ - y;
+      if (y < info.miny_f_)
        { 
          // when all too short, normal stems win..
          if (dy_f < -epsilon_f)
            warning (_ ("weird beam vertical offset"));
-         dy_f = dy_f >? sinfo_[i].miny_f_ - y; 
+         dy_f = dy_f >? info.miny_f_ - y; 
        }
     }
   return dy_f;
 }
 
 void
-Beam::set_steminfo ()
+Beam::set_stem_shorten ()
 {
   if(!stem_count ())
     return;
   
-  assert (multiple_i_);
+  assert (multiplicity_i_);
 
   int total_count_i = 0;
   int forced_count_i = 0;
@@ -416,13 +450,13 @@ Beam::set_steminfo ()
       total_count_i++;
     }
 
+  Real internote_f = paper_l ()->get_var ("interline");
   bool grace_b = get_elt_property ("grace") == SCM_BOOL_T;
   String type_str = grace_b ? "grace_" : "";
   int stem_max = (int)rint(paper_l ()->get_var ("stem_max"));
   Real shorten_f = paper_l ()->get_var (type_str + "forced_stem_shorten"
-                                       + to_str (multiple_i_ <? stem_max));
+    + to_str (multiplicity_i_ <? stem_max)) * internote_f;
     
-  Real leftx = 0;
   for (int i=0; i < stem_count (); i++)
     {
       Stem *s = stem (i);
@@ -436,30 +470,25 @@ Beam::set_steminfo ()
            continue;
        }
 
-      Stem_info info (s, multiple_i_);
-      if (leftx == 0)
-       leftx = info.x_;
-      info.x_ -= leftx;
-      if (info.get_direction () == get_direction ())
+      if (s->get_direction () == get_direction ())
         {
          if (forced_count_i == total_count_i)
-           info.idealy_f_ -= shorten_f;
+           s->set_real ("shorten", shorten_f);
          else if (forced_count_i > total_count_i / 2)
-           info.idealy_f_ -= shorten_f / 2;
+           s->set_real ("shorten", shorten_f/2);
        }
-      sinfo_.push (info);
     }
 }
 
 void
 Beam::calculate_slope ()
 {
-  if (!sinfo_.size ())
+  if (!stem_count ())
     slope_f_ = left_y_ = 0;
-  else if (sinfo_[0].idealy_f_ == sinfo_.top ().idealy_f_)
+  else if (first_visible_stem ()->calc_stem_info ().idealy_f_ == last_visible_stem ()->calc_stem_info ().idealy_f_)
     {
       slope_f_ = 0;
-      left_y_ = sinfo_[0].idealy_f_;
+      left_y_ = first_visible_stem ()->calc_stem_info ().idealy_f_;
       left_y_ *= get_direction ();
     }
   else
@@ -470,16 +499,13 @@ Beam::calculate_slope ()
       /*
        steep slope running against lengthened stem is suspect
       */
-      Real dx_f = stem (stem_count () -1)->hpos_f () - stem (0)->hpos_f ();
+      Real dx_f = stem (stem_count () -1)->hpos_f () - first_visible_stem ()->hpos_f ();
 
-      // urg, these y internote-y-dimensions
-      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;
-      if (((left_y_ - sinfo_[0].idealy_f_ > lengthened)
+      Real lengthened = paper_l ()->get_var ("beam_lengthened");
+      Real steep = paper_l ()->get_var ("beam_steep_slope");
+      if (((left_y_ - first_visible_stem ()->calc_stem_info ().idealy_f_ > lengthened)
           && (slope_f_ > steep))
-         || ((left_y_ + slope_f_ * dx_f - sinfo_.top ().idealy_f_ > lengthened)
+         || ((left_y_ + slope_f_ * dx_f - last_visible_stem ()->calc_stem_info ().idealy_f_ > lengthened)
              && (slope_f_ < -steep)))
        {
          slope_f_ = 0;
@@ -525,15 +551,15 @@ Beam::quantise_dy ()
   if (q == ly_symbol2scm ("none"))
     return;
 
-  Real interline_f = stem (0)->staff_line_leading_f ();
-  Real internote_f = interline_f / 2;
+  Staff_symbol_referencer_interface st (this);
+  Real interline_f = st.staff_line_leading_f ();
+  
   Real staffline_f = paper_l ()->get_var ("stafflinethickness");
   Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));;
 
-  Real dx_f = stem (stem_count () -1 )->hpos_f () - stem (0)->hpos_f ();
+  Real dx_f = stem (stem_count () -1 )->hpos_f () - first_visible_stem ()->hpos_f ();
 
-  // dim(y) = internote; so slope = (y/internote)/x
-  Real dy_f = dx_f * abs (slope_f_ * internote_f);
+  Real dy_f = dx_f * abs (slope_f_);
   
   Real quanty_f = 0.0;
 
@@ -542,14 +568,12 @@ Beam::quantise_dy ()
   allowed_fraction[1] = (beam_f / 2 + staffline_f / 2);
   allowed_fraction[2] = (beam_f + staffline_f);
 
-
   Interval iv = quantise_iv (allowed_fraction, interline_f, dy_f);
   quanty_f = (dy_f - iv[SMALLER] <= iv[BIGGER] - dy_f)
     ? iv[SMALLER]
     : iv[BIGGER];
 
-
-  slope_f_ = (quanty_f / dx_f) / internote_f * sign (slope_f_);
+  slope_f_ = (quanty_f / dx_f) * sign (slope_f_);
 }
 
 /*
@@ -578,8 +602,8 @@ Beam::quantise_left_y (bool extend_b)
        hang       straddle   sit        inter      hang
    */
 
-  Real space = stem (0)->staff_line_leading_f ();
-  Real internote_f = space /2;
+  Staff_symbol_referencer_interface sinf (this);
+  Real space = sinf.staff_line_leading_f ();
   Real staffline_f = paper_l ()->get_var ("stafflinethickness");
   Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));;
 
@@ -603,27 +627,26 @@ Beam::quantise_left_y (bool extend_b)
    */
   // isn't this asymmetric ? --hwn
   
-  // dim(left_y_) = internote
-  Real dy_f = get_direction () * left_y_ * internote_f;
+  Real dy_f = get_direction () * left_y_;
 
-  Real beamdx_f = stem (stem_count () -1)->hpos_f () - stem (0)->hpos_f ();
-  Real beamdy_f = beamdx_f * slope_f_ * internote_f;
+  Real beamdx_f = stem (stem_count () -1)->hpos_f () - first_visible_stem ()->hpos_f ();
+  Real beamdy_f = beamdx_f * slope_f_;
 
   Array<Real> allowed_position;
   if (q == ly_symbol2scm ("normal"))
     {
-      if ((multiple_i_ <= 2) || (abs (beamdy_f) >= staffline_f / 2))
+      if ((multiplicity_i_ <= 2) || (abs (beamdy_f) >= staffline_f / 2))
        allowed_position.push (straddle);
-      if ((multiple_i_ <= 1) || (abs (beamdy_f) >= staffline_f / 2))
+      if ((multiplicity_i_ <= 1) || (abs (beamdy_f) >= staffline_f / 2))
        allowed_position.push (sit);
       allowed_position.push (hang);
     }
   else if (q == ly_symbol2scm ("traditional"))
     {
       // TODO: check and fix TRADITIONAL
-      if ((multiple_i_ <= 2) || (abs (beamdy_f) >= staffline_f / 2))
+      if ((multiplicity_i_ <= 2) || (abs (beamdy_f) >= staffline_f / 2))
        allowed_position.push (straddle);
-      if ((multiple_i_ <= 1) && (beamdy_f <= staffline_f / 2))
+      if ((multiplicity_i_ <= 1) && (beamdy_f <= staffline_f / 2))
        allowed_position.push (sit);
       if (beamdy_f >= -staffline_f / 2)
        allowed_position.push (hang);
@@ -636,8 +659,7 @@ Beam::quantise_left_y (bool extend_b)
   if (extend_b)
     quanty_f = iv[BIGGER];
 
-  // dim(left_y_) = internote
-  left_y_ = get_direction () * quanty_f / internote_f;
+  left_y_ = get_direction () * quanty_f;
 }
 
 void
@@ -685,18 +707,10 @@ Beam::do_add_processing ()
     {
       Direction d = LEFT;
       do {
-       multiple_i_ = multiple_i_ >? stem (i)->beams_i_drul_[d];
+       multiplicity_i_ = multiplicity_i_ >? stem (i)->beams_i_drul_[d];
       } while ((flip (&d)) != LEFT);
     }
 
-  /*
-    Why?
-   */
-  if (stem_count ())
-    {
-      stem (0)->beams_i_drul_[LEFT] =0;
-      stem (stem_count () -1)->beams_i_drul_[RIGHT] =0;
-    }
 }
 
 
@@ -714,14 +728,12 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
       programming_error ("Beams are not left-to-right");
 
   Real staffline_f = paper_l ()->get_var ("stafflinethickness");
-  Real interbeam_f = paper_l ()->interbeam_f (multiple_i_);
-
-  Real internote_f = here->staff_line_leading_f ()/2;
+  Real interbeam_f = paper_l ()->interbeam_f (multiplicity_i_);
   Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));;
 
   Real dy = interbeam_f;
   Real stemdx = staffline_f;
-  Real sl = slope_f_* internote_f;
+  Real sl = slope_f_;
 
   Molecule leftbeams;
   Molecule rightbeams;
index ca967f0ee31008d67678bb3ffc9e38e50f2ae57d..5d44313d0472b6d72aa76e02d46069941aee9478 100644 (file)
@@ -6,8 +6,8 @@
   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
       Jan Nieuwenhuizen <janneke@gnu.org>
 */
-#include "dimension-cache.hh"
 
+#include "dimension-cache.hh"
 #include "bow.hh"
 #include "debug.hh"
 #include "paper-def.hh"
index df9c9a70bdeea98cb56d2ce43500f141de9e50c2..669a606353d7f6237a51ceaf19af567e2670f885 100644 (file)
@@ -13,6 +13,7 @@ TODO:
 
 */
 
+#include "staff-symbol-referencer.hh"
 #include "breathing-sign-engraver.hh"
 #include "breathing-sign.hh"
 #include "musical-request.hh"
@@ -44,6 +45,8 @@ Breathing_sign_engraver::do_process_requests()
 {
   if(breathing_sign_req_l_) {
     breathing_sign_p_ = new Breathing_sign;
+    Staff_symbol_referencer_interface st (breathing_sign_p_);
+    st.set_interface ();
 
     announce_element (Score_element_info (breathing_sign_p_, breathing_sign_req_l_));
   }
index 3578e06210a094b203574576ba709f165f67a1b6..bf1f8dea96e3207c4d7158f0266766a20fe6520a 100644 (file)
@@ -8,6 +8,7 @@
 TODO: --> see breathing-sign-engraver.cc
 
 */
+#include "staff-symbol-referencer.hh"
 
 #include "breathing-sign.hh"
 #include "string.hh"
@@ -30,7 +31,9 @@ Breathing_sign::Breathing_sign ()
 Molecule*
 Breathing_sign::do_brew_molecule_p () const
 {
-  Real dl = staff_line_leading_f();
+  Staff_symbol_referencer_interface si (this);
+  
+  Real dl = si.staff_line_leading_f();
   Interval i1(0, dl / 6), i2(-dl / 2, dl / 2);
   Box b(i1, i2);
 
@@ -42,7 +45,7 @@ Breathing_sign::do_brew_molecule_p () const
 void
 Breathing_sign::do_post_processing()
 {
-  Real dl = staff_line_leading_f();
+  Real dl = Staff_symbol_referencer_interface (this).staff_line_leading_f();
 
   translate_axis(2.0 * dl * get_direction (), Y_AXIS);
 }
index 567c31ec6a6b0db8f506ce69501665a3c268eead..c705ea05a36805686634b97ab671b03e0d04d2a7 100644 (file)
@@ -137,25 +137,25 @@ Chord_tremolo_engraver::acknowledge_element (Score_element_info i)
       if (Stem* s = dynamic_cast<Stem *> (i.elem_l_))
        {
          int type_i = prev_start_req_->type_i_;
-         s->flag_i_ = intlog2 (type_i) - 2;
+         s->set_elt_property ("duration-log",  gh_int2scm (intlog2 (type_i) - 2));
 
-         s->beams_i_drul_[LEFT] = s->flag_i_;
-         s->beams_i_drul_[RIGHT] = s->flag_i_;
+         s->beams_i_drul_[LEFT] = s->flag_i ();
+         s->beams_i_drul_[RIGHT] = s->flag_i ();
          
-         abeam_p_->multiple_i_ = s->flag_i_;
+         abeam_p_->multiplicity_i_ = s->flag_i ();
          /*
            abbrev gaps on all but half note
          */
 #if 0
          if (s->type_i () != 1)
            {
-             int gap_i =s->flag_i_ - ((s->type_i () >? 2) - 2);
+             int gap_i =s->flag_i () - ((s->type_i () >? 2) - 2);
              s->set_elt_property ("beam-gap", gh_int2scm(gap_i));
            }
 #else
          if (s->type_i () != 1)
            {
-             int gap_i =s->flag_i_ - ((s->type_i () >? 2) - 2);
+             int gap_i =s->flag_i () - ((s->type_i () >? 2) - 2);
              abeam_p_->set_elt_property ("beam-gap", gh_int2scm(gap_i));
            }
 #endif
index 2ec5e9c56904abb83a8b052d0795719514f838c0..226e7adaa4785249eee5957cd010dcf14e489892 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 #include <ctype.h>
+#include "staff-symbol-referencer.hh"
 #include "bar.hh"
 #include "clef-engraver.hh"
 #include "clef-item.hh"
@@ -126,7 +127,8 @@ Clef_engraver::acknowledge_element (Score_element_info info)
     {
       if (Note_head * h = dynamic_cast<Note_head*>(it_l))
        {
-         h->set_position (int (h->position_f ()) + c0_position_i_);
+         Staff_symbol_referencer_interface si (h);
+         si.set_position (int (si.position_f ()) + c0_position_i_);
        }
       else if (Local_key_item *i = dynamic_cast<Local_key_item*> (it_l))
        {
@@ -178,11 +180,15 @@ Clef_engraver::create_clef()
       Clef_item *c= new Clef_item;
       c->set_elt_property ("break-aligned", SCM_BOOL_T);
       announce_element (Score_element_info (c, clef_req_l_));
+
+      Staff_symbol_referencer_interface si(c);
+      si.set_interface ();
+      
       clef_p_ = c;
     }
-  
+  Staff_symbol_referencer_interface si(clef_p_);
   clef_p_->symbol_ = clef_type_str_;
-  clef_p_->set_position(clef_position_i_);
+  si.set_position (clef_position_i_);
   if (octave_dir_)
     {
       clef_p_->set_elt_property ("octave-dir", gh_int2scm (octave_dir_));
index 838d06a808009c198c04437315f1b7422227c49a..c98c188f7cc4c09da9d5e33c34462832d8e1d861 100644 (file)
 #include "text-item.hh"
 #include "paper-score.hh"
 #include "dimension-cache.hh"
-#include "staff-side.hh"
+#include "side-position-interface.hh"
 
 void
 Clef_item::do_pre_processing()
 {
-  Staff_symbol_referencer::do_pre_processing();
   SCM style_sym =get_elt_property ("style");
   String style;
   if (style_sym != SCM_UNDEFINED)
@@ -43,7 +42,6 @@ Clef_item::Clef_item()
   set_elt_property ("breakable", SCM_BOOL_T);
 
   symbol_ = "treble";
-  set_position(-2);
 }
 
 void
index f1691792c64754faccc7d43f2a79c7179c0a065d..1ee27e6c3707706bef3bd8e9dd696b6d50ad258d 100644 (file)
@@ -155,7 +155,7 @@ Collision::automatic_shift ()
       
       bool merge  =
        downpos == uppos
-       && nu_l->balltype_i_ == nd_l->balltype_i_
+       && nu_l->balltype_i () == nd_l->balltype_i ()
        && nu_l->dots_i () == nd_l->dots_i ();
 
       /*
index aacf58aadc0cc5ed7b115a1ba268968e814c89e8..ce851df2bd92b9f3f7d484f71c554827f440116c 100644 (file)
@@ -46,8 +46,8 @@ Dimension_cache::init()
 void
 Dimension_cache::invalidate ()
 {
-  off_valid_b_ =false;
-  valid_b_ = false;
+  /*  off_valid_b_ =false;
+      valid_b_ = false;*/
 }
 
 
@@ -99,16 +99,13 @@ Dimension_cache::axis () const
 Real
 Dimension_cache::get_offset () const
 {
-  if (!off_valid_b_)
+  Dimension_cache *me = (Dimension_cache*) this;
+  while (off_callbacks_.size ())
     {
-      Dimension_cache *d = (Dimension_cache*) this;
-
-      d->basic_offset_ =0.0;
-      d->off_valid_b_ = true;
-      for (int i=0; i < off_callbacks_.size (); i++)
-       d->basic_offset_ += (*off_callbacks_[i]) (d);
+      Offset_cache_callback c = me->off_callbacks_[0];
+      me->off_callbacks_.del (0);
+      me->basic_offset_ += (*c) (me);
     }
-
   return basic_offset_ + extra_offset_;
 }
 
index eb6b471fc6abd0ed1d79d0f207f7377e5aae3289..41751d77a2772831540048faa2f7968fb562629b 100644 (file)
@@ -14,12 +14,4 @@ Directional_spanner::do_pre_processing()
     set_direction (get_default_dir());
 }
 
-#if 0
-Offset
-Directional_spanner::center () const
-{
-  Real w= extent (X_AXIS).length ();
-  Offset o (w/2, 0);  
-  return o;
-}
-#endif
+
index 730228eeecad7cdbeae88bcb94eb9cf3808e3c71..d085bf401116a6b8dbbdab1086e4eb6452c93b9a 100644 (file)
@@ -10,6 +10,7 @@
 #include "dot-column.hh"
 #include "rhythmic-head.hh"
 #include "group-interface.hh"
+#include "staff-symbol-referencer.hh"
 
 void
 Dot_column::add_dots (Dots *d)
@@ -35,7 +36,11 @@ Dot_column::add_head (Rhythmic_head *r)
 int
 Dot_column::compare (Dots * const &d1, Dots * const &d2)
 {
-  return int (d1->position_f () - d2->position_f ());
+  Staff_symbol_referencer_interface s1(d1);
+  Staff_symbol_referencer_interface s2(d2);  
+
+  
+  return int (s1.position_f () - s2.position_f ());
 }
 
 
@@ -78,12 +83,15 @@ Dot_column::do_post_processing ()
   int conflicts = 0;
   for (int i=0; i < dots.size (); i++)
     {
+      Real p = Staff_symbol_referencer_interface (dots[i]).position_f ();
       for (int j=0; j < taken_posns.size (); j++)
-       if (taken_posns[j] == (int) dots[i]->position_f ())
-         conflicts++;
-      taken_posns.push ((int)dots[i]->position_f ());
-      s.unite (Slice ((int)dots[i]->position_f (),
-                     (int)dots[i]->position_f ()));      
+       {
+         if (taken_posns[j] == (int) p)
+           conflicts++;
+       }
+      taken_posns.push ((int)p);
+      s.unite (Slice ((int)p,
+                     (int)p));      
     }
 
   if (!conflicts)
@@ -99,6 +107,6 @@ Dot_column::do_post_processing ()
 
   for (int i=0; i  <dots.size (); pos += 2, i++)
     {
-      dots[i]->set_position(pos);
+      staff_symbol_referencer_interface (dots[i]).set_position(pos);
     }
 }
index 6fc996328c41064c9939b7f6b543612ef7368ef0..92d564478ed1f4f93651a13da17a1afa733d3ebc 100644 (file)
@@ -10,6 +10,7 @@
 #include "molecule.hh"
 #include "paper-def.hh"
 #include "lookup.hh"
+#include "staff-symbol-referencer.hh"
 
 Dots::Dots ()
 {
@@ -30,9 +31,10 @@ Dots::do_post_processing ()
       if (!get_direction ())
        set_direction (UP);
 
-      int p = int (position_f ());
+      Staff_symbol_referencer_interface si (this);
+      int p = si.position_f ();
       if (!(p % 2))
-       set_position (p  + get_direction ());
+       si.set_position (p  + get_direction ());
     }
 }
 Molecule* 
index d112945de175acaaaf6d153bb617dbce43db965b..f117c9c49d5c2a401b922f97705dd6ebc69398f0 100644 (file)
@@ -14,7 +14,7 @@
 #include "staff-symbol.hh"
 #include "note-column.hh"
 #include "text-item.hh"
-#include "staff-side.hh"
+#include "side-position-interface.hh"
 #include "engraver.hh"
 #include "stem.hh"
 #include "note-head.hh"
index 172f26968f7fc03228a85f11f673ab68f11196e8..03be73a2d2719c39c18e790e2bd63419c66c73b5 100644 (file)
@@ -87,11 +87,12 @@ Grace_position_engraver::do_pre_move_processing ()
        return;
 
       warning (_("Unattached grace notes.  Attaching to last musical column."));
-      Axis_group_element * ae = dynamic_cast<Axis_group_element*> (elt);
       /*      if (ae)
        ae->remove_element (align_l_);
        else if (elt)*/
-       align_l_->set_parent (0, X_AXIS);
+
+      
+      align_l_->set_parent (0, X_AXIS);
       last_musical_col_l_->add_element (align_l_);
     }
 
index e9b79eeb19a05a195a58cdb8100fbd3a96206610..b8388670effb2a9f8f7d57eb36d63175ccdd64ed 100644 (file)
@@ -22,7 +22,7 @@ Group_interface::Group_interface (Score_element const *e, String s)
   name_ = s;
 } 
 bool
-Group_interface::supports_interface_b () 
+Group_interface::has_interface_b () 
 {
   SCM el = elt_l_->get_elt_property (name_);
 
@@ -33,6 +33,9 @@ Group_interface::supports_interface_b ()
 void
 Group_interface::add_element (Score_element*p) 
 {
+  p->used_b_ =  true;
+  elt_l_->used_b_ = true;
+  
   elt_l_->set_elt_property (name_,
                            gh_cons (p->self_scm_, elt_l_->get_elt_property (name_)));
 }
@@ -46,7 +49,7 @@ Group_interface::count ()
 void
 Group_interface::set_interface ()
 {
-  if (!supports_interface_b ())
+  if (!has_interface_b ())
     {
       elt_l_->set_elt_property (name_, SCM_EOL);
     }
index 270bcdb03e2b4c91dd2e8ddf79eef9d304181938..3b1264d5fc6a46e39fdc3290a819f11b432737db 100644 (file)
@@ -21,37 +21,17 @@ class Axis_group_element : public virtual Score_element
 {
   /// modify fields of E for removal.
   void do_remove (Score_element*e);
-  void purge_extra ();
-
-
 
 protected:
   virtual Link_array<Score_element> get_extra_dependencies() const;
   virtual Link_array<Score_element> elem_l_arr() const;
   static Interval extent_callback (Dimension_cache const*);
-  
-
 
-  Interval extra_extent (Axis a) const;
 public:
-  // 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
-     relationship with THIS.
-  */
-  void add_extra_element (Score_element*);
-
-
   Axis_group_element ();
   void set_axes (Axis,Axis);
 
index 8f59c298a2b625196d7fd9fb6a818c2dba9e7f1f..3f75d905e7fb9ba5d65153f351590671545284b2 100644 (file)
@@ -18,9 +18,8 @@
  */
 
 class Axis_group_item : public virtual Axis_group_element,
-                       public virtual Item {
-protected:
-  virtual void do_breakable_col_processing();
+                       public virtual Item
+{
 public:
   VIRTUAL_COPY_CONS(Score_element);
 };
index f81b7354c766fb4eded61dfc67dcc26743fd1585..9d7e0c8382fbb1c192abb244f629d7ba121db0f0 100644 (file)
@@ -19,9 +19,6 @@ class Axis_group_spanner : public virtual Axis_group_element,
                           public virtual Spanner
 
 {
-  void do_break_processing_if_unbroken();
-protected:
-  virtual void do_break_processing();
 public:
   VIRTUAL_COPY_CONS(Score_element);
 };
index cfcc305e65fb45d43524f9b7d4c82611248d7e0a..d3d3c71afd089c50f6567e5a5270393a4226f70c 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "lily-proto.hh"
 #include "directional-spanner.hh"
-#include "stem-info.hh"
 
 
 /** a beam connects multiple stems.
@@ -29,8 +28,12 @@ slope_quantisation: 'none, 'normal or 'traditional
 class Beam : public Directional_spanner  {
 public:
 
-  int stem_count ()const;
-  Stem * stem (int )const;
+  int stem_count () const;
+  Stem* stem (int) const;
+  Stem* stem_top () const;
+  int visible_stem_count () const;
+  Stem* first_visible_stem () const;
+  Stem* last_visible_stem () const;
 
   /**
      the slope of the beam in (staffpositions) per (X-dimension, in PT).
@@ -41,15 +44,14 @@ public:
   /// position of leftmost end of beam  
   Real left_y_;
 
+  /** 
+    highest number of beams present, for opening-up of beam-spacing
+    and calculation of stem lengths
+   */
+  int multiplicity_i_;
 
-  /// maximum number of beams (for opening-up of beam-spacing)
-  int multiple_i_;
-
-  Array<Stem_info> sinfo_;
-  
-  Beam();
+  Beam ();
   void add_stem (Stem*);
-  Stem_info get_stem_info (Stem*);
 
   void set_grouping (Rhythmic_grouping def, Rhythmic_grouping current);
   void set_beaming (Beaming_info_list *);
@@ -60,7 +62,7 @@ protected:
   Offset center () const;
   Direction get_default_dir () const;
   void set_direction (Direction);
-  void set_steminfo ();
+  void set_stem_shorten ();
   bool auto_knee (SCM gap, bool interstaff_b);
   bool auto_knees ();
   
index 0378d62078fd1ec46d2c3e87df2b700f4dd0a68c..ffc2f3d7eb8c3d5b2740c2b8faa9eb62d7e5ed9e 100644 (file)
 #define BREATHING_SIGN_HH
 
 #include "item.hh"
-#include "staff-symbol-referencer.hh"
 #include "parray.hh"
 #include "directional-element.hh"
 
 class Breathing_sign : public Item,
-                      public Staff_symbol_referencer,
                       public Directional_element
 {
 public:
index 11362d72fa832aba713ab38d6bea0a5163b643d9..e35b20c9c0f10df922c2fe78165ec363eae43f0b 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "direction.hh"
 #include "pointer.hh"
-#include "staff-symbol-referencer.hh"
+
 /**
   Set a clef in a staff.
 
@@ -23,7 +23,8 @@
   change: is this a change clef (smaller size)?
   
  */
-class Clef_item : public Item, public Staff_symbol_referencer {
+class Clef_item : public Item
+{
 protected:
   virtual void do_pre_processing();
   virtual Molecule* do_brew_molecule_p() const;
index 05aeec680d2073e2a3145c80574cd15d94d1b59f..8225860aa9ca1af4180e5e57b9377bb699308dd3 100644 (file)
 #define DOTS_HH
 
 #include "item.hh"
-#include "staff-symbol-referencer.hh"
+
 #include "directional-element.hh"
 
 /**
   The dots to go with a notehead/rest.  A separate class, since they
   are a party in collision resolution.
   */
-class Dots : public Item, public Staff_symbol_referencer,
+class Dots :
+  public Item,
   public Directional_element
 {
 protected:
index 289ba913ba4ff236f8f6d2917549e19d1ecb3fea..fc832a5426096ea626327977638eeb79eccf4db2 100644 (file)
@@ -23,7 +23,7 @@ public:
   Group_interface (Score_element const*);
   Group_interface (Score_element const*, String);
   int count ();
-  bool supports_interface_b ();
+  bool has_interface_b ();
   void set_interface ();
   void add_element (Score_element*);
 };
index 82f72cb871c8d5795c4b7c98798b5599265e42c2..ac80432208ce0c00ba959700ac60b81963407510 100644 (file)
@@ -9,10 +9,11 @@
 
 #include "item.hh"
 #include "array.hh"
-#include "staff-symbol-referencer.hh"
+
 
 /// An item which places accidentals at the start of the line
-class Key_item :public  Item, public Staff_symbol_referencer {
+class Key_item :public  Item
+{
   Array<int> pitch_arr_;
   Array<int> acc_arr_;
   Array<int> old_pitch_arr_;
index e10468474a7fdfe281ff45a4ec2c56300d0b0c5f..25a1a2d3dd4cc54a6f35511037df64348acc62fc 100644 (file)
@@ -9,7 +9,7 @@
 #include "item.hh"
 #include "array.hh"
 #include "musical-pitch.hh"
-#include "staff-symbol-referencer.hh"
+
 #include "note-head-side.hh"
 
 struct Local_key_cautionary_tuple
@@ -40,7 +40,8 @@ struct Local_key_cautionary_tuple
   
  */
 
-class Local_key_item : public Note_head_side, public Staff_symbol_referencer {
+class Local_key_item : public Note_head_side
+{
   Array<Local_key_cautionary_tuple> accidental_arr_;
 
   Molecule accidental (int,bool,bool) const;
index 23cea928fdbde82d662ec18b54995f863cdaf8dd..1d5fc2bcce4fe79f1bffed501f53428b8df70128 100644 (file)
@@ -11,9 +11,9 @@
 #define MULTI_MEASURE_REST_HH
 
 #include "spanner.hh"
-#include "staff-symbol-referencer.hh"
 
-class Multi_measure_rest : public Spanner, public Staff_symbol_referencer
+
+class Multi_measure_rest : public Spanner
 {
 public:
   Multi_measure_rest ();
@@ -26,7 +26,6 @@ protected:
 
   virtual void do_add_processing ();
   virtual void do_post_processing ();
-  virtual void do_print () const;
   virtual Array<Rod> get_rods () const;
 };
 
index 308ff1c1eb5a17860a7a8aa0de44a829d1727e96..bbc051d2396ac6f1096a0540f55338e5d3da5fba 100644 (file)
 
   */
 
-class Note_head : public Rhythmic_head {
+class Note_head : public Rhythmic_head
+{
 public:
-
   Note_head ();
   void flip_around_stem (Direction);
   static int compare (Note_head * const &a, Note_head *const &b) ;
 protected:
   Molecule make_molecule () const;
-
   
   static  Interval dim_callback (Dimension_cache const*);
   virtual void do_pre_processing();
index 86147896843ee851a365049624fc350783e02933..591c9eb81b04e28ae2259a5459773c78cc62caa1 100644 (file)
 
 class  Rest : public Rhythmic_head
 {
-public:
-
 protected:
-  virtual void do_add_processing ();
   virtual void do_post_processing ();
   virtual Molecule * do_brew_molecule_p () const;
 };
index 58063bd501bf49288c4ec491ce411899c6dfac78..9013c0eb42ca6c663821d4813793db747cda195e 100644 (file)
 #define RHYTHMIC_HEAD_HH
 
 #include "item.hh"
-#include "staff-symbol-referencer.hh"
 
-class Rhythmic_head : public Item, public Staff_symbol_referencer
+
+class Rhythmic_head : public Item
 {
-  Dots * dots_l_;
-  Stem * stem_l_;
 public:
-
-  int balltype_i_;
+  int balltype_i () const;
 
   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;
 };
 
 #endif // RHYTHMIC_HEAD_HH
index f5a26a030f5a8c63ccd191c0378394c1a2113d19..ba75990681f5d286d07d1d2ca1dce534addfade9 100644 (file)
@@ -43,7 +43,6 @@ class Score_element  {
 
   */
   SCM element_property_alist_;
-  Link_array<Score_element> dependency_arr_;
   /**
      The lookup, determined by the font size. Cache this value.
    */
@@ -74,6 +73,9 @@ public:
   void set_elt_property (String, SCM val);
   SCM remove_elt_property (String nm);
 
+  void Score_element::set_real (String, Real);
+  Real Score_element::get_real (String s) const;
+
   /*
     related classes.
    */
@@ -103,7 +105,7 @@ public:
   static SCM handle_broken_smobs (SCM, SCM criterion);
   void recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)());
 
-
+  virtual void do_break_processing ();
   virtual Score_element *find_broken_piece (Line_of_score*) const;
 protected:
 
@@ -112,9 +114,6 @@ protected:
     be handled by GUILE gc.  */
   virtual ~Score_element ();
   
-  Score_element* dependency (int) const;
-  int dependency_size () const;
-  
   virtual void output_processing ();
   static Interval molecule_extent (Dimension_cache const*);
 
@@ -134,8 +133,6 @@ protected:
   /// do calculations after determining horizontal spacing
   virtual void do_post_processing ();
     
-  virtual void do_break_processing ();
-
   virtual Link_array<Score_element> get_extra_dependencies () const;
 
   static Interval dim_cache_callback (Dimension_cache const*);
diff --git a/lily/include/side-position-interface.hh b/lily/include/side-position-interface.hh
new file mode 100644 (file)
index 0000000..55a15f3
--- /dev/null
@@ -0,0 +1,41 @@
+/*   
+  side-position-interface.hh -- declare Side_position_interface
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#ifndef SIDE_POSITION_INTERFACE_HH
+#define SIDE_POSITION_INTERFACE_HH
+
+#include "spanner.hh"
+#include "item.hh"
+
+#include "directional-element.hh"
+
+struct Side_position_interface
+{
+  Score_element * elt_l_;
+public:
+  Side_position_interface (Score_element const*);
+  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;
+  bool has_interface_b () const;
+  void add_support (Score_element*);
+  
+  Direction get_direction () const;
+  void set_direction (Direction);
+};
+
+
+#endif /* SIDE_POSITION_INTERFACE_HH */
+
index 08c7f361f32e50d7f65fdc0465e6e36d4b69b1f1..6ef182fe1324235b25c307b6c82292d83b24d559 100644 (file)
@@ -63,7 +63,6 @@ protected:
   friend Axis_group_spanner; // UGH
 
   virtual void do_space_processing ();
-  //  void handle_broken_dependents ();
   virtual void do_break_processing ();
   Real spanner_length () const;
   virtual Line_of_score*line_l () const;
index 171ec1ddc062e21f15dfa71b12d2ce4708bbc2f6..244f36a849b0283d7aceefe79f2dabdffa7161ca 100644 (file)
 #define STAFF_BAR_HH
 
 #include "bar.hh"
-#include "staff-symbol-referencer.hh"
+
 
 /**
    A bar that is on a staff.
    Ugh. Entita non multiplicandum  ... 
  */
-class Staff_bar : public Bar, public Staff_symbol_referencer
+class Staff_bar : public Bar
 {
 public:
-  virtual void do_pre_processing ();
   VIRTUAL_COPY_CONS(Score_element);
   virtual Real get_bar_size () const;
 };
index afe679d65b70ab1e8f9a5be34fe3bd1886ab579f..89dc0d63cdb474ecf4f5559fab992422754e7aeb 100644 (file)
@@ -21,6 +21,8 @@ public:
   /// this many lines.
   int no_lines_i_;
   Real staff_line_leading_f_;
+  Real staff_line_leading_f ();
+  
   
   Staff_symbol ();
   int steps_i() const;
index 248f71b82dbe5eac54f5af466bd69fa0140ab917..096671a6d5faacaeba3aa88ab9e8f772c90bf16b 100644 (file)
 
 #include "real.hh"
 
-struct Stem_info {
-  Real x_;
-  Direction dir_;
-  void set_direction (Direction d ) { dir_ =  d; }
-  Direction get_direction () const { return dir_; }
-
-  int beam_dir_;
+struct Stem_info 
+{
   Real idealy_f_;
   Real miny_f_;
   Real maxy_f_;
-  int mult_i_;
-  Real interstaff_f_;
-  Stem* stem_l_;
-
-  Stem_info ();
-  Stem_info (Stem *, int);
 };
 
 #endif // STEM_INFO_HH
index 3f1b58356509d247391b933616c4fd22af0ad9da..a40484123c159980c75c226d50c0862bbe5e9814 100644 (file)
@@ -6,12 +6,13 @@
 
 #ifndef STEM_HH
 #define STEM_HH
+
 #include "item.hh"
 #include "array.hh"
 #include "moment.hh"
 #include "molecule.hh"
-#include "staff-symbol-referencer.hh"
 #include "directional-element.hh"
+#include "stem-info.hh"
 
 /**the rule attached to the ball.
   takes care of:
 
   
   */
-// todo: remove baseclass Staff_symbol_referencer, since stem
-// can be across a staff.
-class Stem : public Item, public Staff_symbol_referencer,
+class Stem : public Item,
             public Directional_element
 {
 
   /**extent of the stem (positions).
     fractional, since Beam has to adapt them.
     */
-  Drul_array<Real> yextent_drul_;
+  Interval yextent_;
 
 public:
-
-    
   /// log of the duration. Eg. 4 -> 16th note -> 2 flags
-  int flag_i_;
+  int flag_i () const;
+
+  Drul_array<int> beams_i_drul_;
+
 
   /** 
     don't print flag when in beam.
@@ -63,19 +63,17 @@ public:
    */
   Beam* beam_l () const;
   Note_head * first_head () const;
-
-  Drul_array<int> beams_i_drul_;
   Stem ();
     
   /// ensure that this Stem also encompasses the Notehead #n#
   void add_head (Rhythmic_head*n);
 
   Real hpos_f () const;
+  Stem_info calc_stem_info () const;
+
   Real chord_start_f () const;
   
   int type_i () const;
-
-  void do_print() const;
   void set_stemend (Real);
   Direction get_default_dir() const;
 
index d477f006209be7b918d5a54da88eff7dc7577f97..6758de42079032733a64e80588faaa409cb24d69 100644 (file)
@@ -14,6 +14,7 @@
 #include "local-key-item.hh"
 #include "bar.hh"
 #include "timing-translator.hh"
+#include "staff-symbol-referencer.hh"
 
 Key_engraver::Key_engraver ()
 {
@@ -33,6 +34,9 @@ Key_engraver::create_key ()
   if (!item_p_) 
     {
       item_p_ = new Key_item;
+      Staff_symbol_referencer_interface st (item_p_);
+      st.set_interface ();
+      
       item_p_->set_elt_property ("break-aligned", SCM_BOOL_T); // ugh
       
       item_p_->multi_octave_b_ = key_.multi_octave_b_;
index 7b7631fe9afeffd6ee9466beefe21e7941a10d1a..c39f0e4e5cfcec987d9f85ceec7844fcb8375bcd 100644 (file)
@@ -15,6 +15,7 @@
 #include "paper-def.hh"
 #include "lookup.hh"
 #include "musical-pitch.hh"
+#include "staff-symbol-referencer.hh"
 
 const int FLAT_TOP_PITCH=2; /* fes,ges,as and bes typeset in lower octave */
 const int SHARP_TOP_PITCH=4; /*  ais and bis typeset in lower octave */
@@ -97,7 +98,9 @@ Molecule*
 Key_item::do_brew_molecule_p() const
 {
   Molecule*output = new Molecule;
-  Real inter = staff_line_leading_f ()/2.0;
+
+  Staff_symbol_referencer_interface si (this);
+  Real inter = si.staff_line_leading_f ()/2.0;
   
   int j;
   if ((break_status_dir () == LEFT || break_status_dir () == CENTER)
index 5fb4931a2a0fbb1bb3dbc21efb8f410211726bf7..28d2477f685058374751cf9004c791913e751baf 100644 (file)
@@ -58,13 +58,6 @@ Line_of_score::break_into_pieces (Array<Column_x_positions> const &breaking)
       
       broken_into_l_arr_.push (line_l);
     }
-
-  for (int i=0; i < broken_into_l_arr_.size (); i++)
-    {
-      broken_into_l_arr_[i]->handle_broken_dependencies ();
-    }
-
-  handle_broken_dependencies ();
 }
 
 void
index beff1c9148d828b4e398b7f04247a422a110aac1..100bac981ddbb9207d55544697f88a6c2ede35b9 100644 (file)
@@ -16,6 +16,7 @@
 #include "timing-translator.hh"
 #include "engraver-group-engraver.hh"
 #include "grace-align-item.hh"
+#include "staff-symbol-referencer.hh"
 
 Local_key_engraver::Local_key_engraver()
 {
@@ -82,6 +83,9 @@ Local_key_engraver::process_acknowledged ()
                  if (!key_item_p_) 
                     {
                         key_item_p_ = new Local_key_item;
+                        Staff_symbol_referencer_interface si(key_item_p_);
+                        si.set_interface ();
+                        
                         announce_element (Score_element_info (key_item_p_, 0));
                     }
 
index a8823c59c930f63d1d88f3b0856f8cb5d4e8ff13..72c7104e4abfdf3e856242bbf8937dafbac11e5e 100644 (file)
@@ -7,6 +7,7 @@
 */
 #include "local-key-item.hh"
 #include "molecule.hh"
+#include "staff-symbol-referencer.hh"
 
 #include "lookup.hh"
 #include "paper-def.hh"
@@ -67,7 +68,8 @@ Molecule*
 Local_key_item::do_brew_molecule_p() const
 {
   Molecule*output = new Molecule;
-  Real note_distance = staff_line_leading_f ()/2;
+  Staff_symbol_referencer_interface si (this);
+  Real note_distance = si.staff_line_leading_f ()/2;
   Molecule *octave_mol_p = 0;
   int lastoct = -100;
   
index 609cf8c72058ec5d5d0026f2a6dc108215ed03b4..d6c065ccf29c8985a2a207999b51028201ca72c1 100644 (file)
@@ -13,6 +13,7 @@
 #include "engraver-group-engraver.hh"
 #include "timing-translator.hh"
 #include "bar.hh"
+#include "staff-symbol-referencer.hh"
 
 
 ADD_THIS_TRANSLATOR (Multi_measure_rest_engraver);
@@ -77,6 +78,10 @@ Multi_measure_rest_engraver::do_process_requests ()
       Timing_translator * time = dynamic_cast<Timing_translator*> (tr);
 
       mmrest_p_ = new Multi_measure_rest;
+      Staff_symbol_referencer_interface si (mmrest_p_);
+      si.set_interface ();
+
+      
       if(dynamic_cast<Repetitions_req *> (multi_measure_req_l_))
        mmrest_p_->set_elt_property ("alt-symbol", 
                                     ly_str02scm ("scripts-repeatsign"));
index d69333940f1c66f4d68ccfe3ff60c25a06d9c75c..5edec8fc3e801a7180711211c68034cdbf3d9c87 100644 (file)
@@ -18,6 +18,7 @@
 #include "misc.hh"
 #include "group-interface.hh"
 #include "stem.hh"
+#include "staff-symbol-referencer.hh"
 
 Multi_measure_rest::Multi_measure_rest ()
 {
@@ -25,13 +26,7 @@ Multi_measure_rest::Multi_measure_rest ()
   set_elt_property ("columns", SCM_EOL);
 }
 
-void
-Multi_measure_rest::do_print () const
-{
-#ifndef NPRINT
-  DEBUG_OUT << "measures_i_ " << measures_i_;
-#endif
-}
+
 
 
 
@@ -94,7 +89,8 @@ Multi_measure_rest::do_brew_molecule_p () const
     }
   
   mol_p->add_molecule (s);
-  Real interline_f = staff_line_leading_f ();
+  Real interline_f
+    = staff_symbol_referencer_interface (this).staff_line_leading_f ();
   if (measures_i_ == 1 && rest_symbol)
     {
       mol_p->translate_axis (interline_f, Y_AXIS);
index 21740f4513ccd9a02707d047e05ad84760a362bc..439cb08186489148f0122f2f96e2a8ae27a1b7b2 100644 (file)
@@ -14,6 +14,7 @@
 #include "debug.hh"
 #include "paper-def.hh"
 #include "group-interface.hh"
+#include "staff-symbol-referencer.hh"
 
 bool
 Note_column::rest_b () const
@@ -61,8 +62,9 @@ Note_column::head_positions_interval() const
   for (; gh_pair_p (h); h = gh_cdr (h))
     {
       Score_element *se = unsmob_element (gh_car (h));
+      Staff_symbol_referencer_interface si (se); 
       
-      int j = int (dynamic_cast<Staff_symbol_referencer*> (se)->position_f ());
+      int j = int (si.position_f ());
       iv.unite (Slice (j,j));
     }
   return iv;
@@ -114,14 +116,15 @@ Note_column::add_head (Rhythmic_head *h)
 void
 Note_column::translate_rests (int dy_i)
 {
-  invalidate_cache (Y_AXIS);
+  //  invalidate_cache (Y_AXIS);
 
   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);
+      Score_element * se = unsmob_element (gh_car (s));
+      Staff_symbol_referencer_interface si (se);
+
+      se->translate_axis (dy_i * si.staff_line_leading_f ()/2.0, Y_AXIS);
     }
 }
 
@@ -159,9 +162,9 @@ Note_column::do_post_processing ()
 
   SCM s = get_elt_property ("rests");
   Score_element * se = unsmob_element (gh_car (s));
-  Staff_symbol_referencer *str = dynamic_cast<Staff_symbol_referencer*> (se);
+  Staff_symbol_referencer_interface si (se);
 
-  Real staff_space = str->staff_line_leading_f ();      
+  Real staff_space = si.staff_line_leading_f ();      
   Real rest_dim = extent (Y_AXIS)[d]*2.0  /staff_space ;
 
   Real minimum_dist
@@ -169,7 +172,7 @@ Note_column::do_post_processing ()
   Real dist =
     minimum_dist +  -d  * (beamy - rest_dim) >? 0;
 
-  int stafflines = str->lines_i ();
+  int stafflines = si.lines_i ();
 
   // move discretely by half spaces.
   int discrete_dist = int (ceil (dist ));
index 1406da12a6aa0fdda9241628702be8e426a7666a..b84b8953347e5e6cd6c0a2f0a76b279b7510647a 100644 (file)
@@ -7,7 +7,7 @@
   
  */
 
-#include "staff-side.hh"
+#include "side-position-interface.hh"
 #include "note-head-side.hh"
 void
 Note_head_side::add_support (Item*head_l)
index 17bc7d6b30ff0555b069aba9db3a41141121afb3..4ddaac08487a9e3cb95d3b741c2bf651c2a1f342 100644 (file)
@@ -14,6 +14,7 @@
 #include "molecule.hh"
 #include "musical-request.hh"
 #include "dimension-cache.hh"
+#include "staff-symbol-referencer.hh"
 
 void
 Note_head::flip_around_stem (Direction d)
@@ -37,8 +38,6 @@ Note_head::Note_head ()
 void
 Note_head::do_pre_processing ()
 {
-  Rhythmic_head::do_pre_processing ();
-
   // 8 ball looks the same as 4 ball:
   String type; 
   SCM style  = get_elt_property ("style");
@@ -48,24 +47,27 @@ Note_head::do_pre_processing ()
     }
   
   
-  if (balltype_i_ > 2 || type == "harmonic" || type == "cross")
-    balltype_i_ = 2;
+  if (balltype_i () > 2 || type == "harmonic" || type == "cross")
+    set_elt_property ("duration-log", gh_int2scm (2));
 
-  if (dots_l ())                       // move into Rhythmic_head?
-    dots_l ()->set_position(int (position_f ()));
+  if (Dots *d = dots_l ())
+    { // move into Rhythmic_head?
 
+      Staff_symbol_referencer_interface si (d);
+      Staff_symbol_referencer_interface me (this);      
+      
+      si.set_position(int (me.position_f ()));
+    }
 }
 
-
-
 int
 Note_head::compare (Note_head *const  &a, Note_head * const &b)
 {
-  return sign(a->position_f () - b->position_f ());
-}
-
+  Staff_symbol_referencer_interface s1(a);
+  Staff_symbol_referencer_interface s2(b);      
 
+  return sign(s1.position_f () - s2.position_f ());
+}
 
 Molecule
 Note_head::make_molecule () const
@@ -78,18 +80,20 @@ Note_head::make_molecule () const
     }
   
   return lookup_l()->afm_find (String ("noteheads-")
-                              + to_str (balltype_i_) + type);
+                              + to_str (balltype_i ()) + type);
 }
 
 Molecule*
 Note_head::do_brew_molecule_p() const 
 {
-  Real inter_f = staff_line_leading_f ()/2;
-  int sz = lines_i ()-1;
-
-  int streepjes_i = abs (position_f ()) < sz 
+  Staff_symbol_referencer_interface si (this);
+  
+  Real inter_f = si.staff_line_leading_f ()/2;
+  int sz = si.lines_i ()-1;
+  Real p = si.position_f ();
+  int streepjes_i = abs (p) < sz 
     ? 0
-    : (abs((int)position_f ()) - sz) /2;
+    : (abs((int)p) - sz) /2;
 
   Molecule*  out =  new Molecule (make_molecule ());
 
@@ -97,7 +101,7 @@ Note_head::do_brew_molecule_p() const
 
   if (streepjes_i) 
     {
-      Direction dir = (Direction)sign (position_f ());
+      Direction dir = (Direction)sign (p);
       Interval hd = out->dim_[X_AXIS];
       Real hw = hd.length ()/4;
       
@@ -105,7 +109,7 @@ Note_head::do_brew_molecule_p() const
        = lookup_l ()->ledger_line  (Interval (hd[LEFT] - hw,
                                               hd[RIGHT] + hw));
       
-      int parity =  abs(int (position_f ())) % 2;
+      int parity =  abs(int (p)) % 2;
       
       for (int i=0; i < streepjes_i; i++)
        {
index c1bfea9317267b6349d6ed925e095b257fe1c8a6..ce6c46dcf5f834542ec0caffd81f41e00e200d9f 100644 (file)
@@ -10,6 +10,7 @@
 #include "musical-request.hh"
 #include "dots.hh"
 #include "dot-column.hh"
+#include "staff-symbol-referencer.hh"
 
 Note_heads_engraver::Note_heads_engraver()
 {
@@ -61,19 +62,29 @@ Note_heads_engraver::do_process_requests()
   for (int i=0; i < note_req_l_arr_.size (); i++)
     {
       Note_head *note_p  = new Note_head;
+      
+      Staff_symbol_referencer_interface si (note_p);
+      si.set_interface ();
+
+      
       Note_req * note_req_l = note_req_l_arr_[i];
       
-      note_p->balltype_i_ = note_req_l->duration_.durlog_i_ <? 2;
+      note_p->set_elt_property ("duration-log",
+                               gh_int2scm (note_req_l->duration_.durlog_i_ <? 2));
 
       if (note_req_l->duration_.dots_i_)
        {
          Dots * d = new Dots;
+
+         Staff_symbol_referencer_interface sd (d);
+         sd.set_interface ();
+         
          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);
        }
-      note_p->set_position(note_req_l->pitch_.steps ());
+      si.set_position(note_req_l->pitch_.steps ());
 
       /*
        TODO: transparent note heads.
index 960dffd675026835608966d97bbbfb2fa1a9776a..adb3b1f0ca9848ddf030a95b6a41ae2517c755c5 100644 (file)
@@ -123,6 +123,17 @@ Paper_score::process ()
   Array<Column_x_positions> breaking = calc_breaking ();
   line_l_->break_into_pieces (breaking);
 
+  for (SCM s = element_smob_list_; gh_pair_p (s); s = gh_cdr (s))
+    {
+      Score_element *sc = unsmob_element (gh_car (s));
+      sc->do_break_processing ();
+    }
+  for (SCM s = element_smob_list_; gh_pair_p (s); s = gh_cdr (s))
+    {
+      Score_element *sc = unsmob_element (gh_car (s));
+      sc->handle_broken_dependencies ();
+    }
+
   outputter_l_ = new Paper_outputter ;
   outputter_l_->output_header ();
 
index 8218ff66c9d29f50edefb81cd93108185aa0a91d..7ed7a8c085855afa7732bbcceac8cf8994ec3d35 100644 (file)
@@ -6,6 +6,7 @@
   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
+#include "staff-symbol-referencer.hh"
 
 #include "pitch-squash-engraver.hh"
 #include "note-head.hh"
@@ -15,7 +16,7 @@ Pitch_squash_engraver::acknowledge_element (Score_element_info i)
 {
   if (Note_head *nh = dynamic_cast<Note_head *> (i.elem_l_))
     {
-      nh->set_position(0);
+      Staff_symbol_referencer_interface (nh).set_position(0);
     }
 }
 
index 93b182591f0e21391cc8a62be7701205b02d9dc7..368f6fdae2f066e6aa023df5417a365b66afee51 100644 (file)
@@ -5,7 +5,7 @@
 
   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
-
+#include "staff-symbol-referencer.hh"
 #include "rest-engraver.hh"
 #include "musical-request.hh"
 #include "dots.hh"
@@ -47,11 +47,19 @@ Rest_engraver::do_process_requests ()
   if (rest_req_l_ && !rest_p_) 
     {
       rest_p_ = new Rest;
-      rest_p_->balltype_i_ = rest_req_l_->duration_.durlog_i_; 
-
+      Staff_symbol_referencer_interface si (rest_p_);
+      si.set_interface ();
+      
+      rest_p_->set_elt_property ("duration-log",
+                                gh_int2scm (rest_req_l_->duration_.durlog_i_)); 
+      
       if (rest_req_l_->duration_.dots_i_)
        {
          dot_p_ = new Dots;
+
+         Staff_symbol_referencer_interface si (dot_p_);
+         si.set_interface ();
+         
          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 10455405f886898c89a4b66b527a410fa0a5c0ab..5caadb099980f7281846d1dd6f84b32355545561 100644 (file)
 #include "dots.hh"
 #include "axis-group-element.hh"
 #include "paper-score.hh"
+#include "staff-symbol-referencer.hh"
 
-void
-Rest::do_add_processing ()
-{
-  if (balltype_i_ == 0)
-    set_position (position_f () + 2);
-
-  Rhythmic_head::do_add_processing ();
-}
 
 void
 Rest::do_post_processing ()
 {
-  Rhythmic_head::do_post_processing ();
-  if (dots_l ()
-      && balltype_i_ > 4) // UGH.
+  if (balltype_i () == 0)
+    {
+      Staff_symbol_referencer_interface si (this);
+      si.set_position (si.position_f () + 2);
+    }
+  
+  Dots * d = dots_l ();
+  if (d && balltype_i () > 4) // UGH.
     {
       /*
        UGH. 
        */
-      if (balltype_i_ == 7)
-       dots_l ()->set_position (4);
-      else
-       dots_l ()->set_position (3);
+      staff_symbol_referencer_interface (d)
+       .set_position ((balltype_i () == 7) ? 4 : 3);
     }
 }
 
@@ -46,18 +42,21 @@ Rest::do_brew_molecule_p () const
 {
   bool ledger_b =false;
 
-  if (balltype_i_ == 0 || balltype_i_ == 1)
-    ledger_b = abs(position_f ()  - (2* balltype_i_ - 1)) > lines_i (); 
-
+  if (balltype_i () == 0 || balltype_i () == 1)
+    {
+      Staff_symbol_referencer_interface si(this);
+      ledger_b = abs(si.position_f ()  - (2* balltype_i () - 1))
+       > si.lines_i (); 
+    }
   
   String style; 
   SCM style_sym =get_elt_property ("style");
-  if (balltype_i_ >= 2 && style_sym != SCM_UNDEFINED)
+  if (balltype_i () >= 2 && style_sym != SCM_UNDEFINED)
     {
       style = ly_scm2string (style_sym);
     }
 
-  String idx =  ("rests-") + to_str (balltype_i_) + (ledger_b ? "o" : "") + style;
+  String idx =  ("rests-") + to_str (balltype_i ()) + (ledger_b ? "o" : "") + style;
 
   return new Molecule(lookup_l ()->afm_find (idx));
 }
index 171c93cb7b9f6071efe13bfb896bf9441acb2388..9e354bde2f0e4108e337be94bc8766019620f418 100644 (file)
@@ -16,6 +16,7 @@
 #include "axis-group-element.hh"
 #include "paper-score.hh"
 #include "stem.hh"
+#include "staff-symbol-referencer.hh"
 
 
 Dots*
@@ -25,6 +26,14 @@ Rhythmic_head::dots_l () const
   return dynamic_cast<Dots*> (unsmob_element (s));
 }
 
+int
+Rhythmic_head::balltype_i () const
+{
+  SCM s = get_elt_property ("duration-log");
+  
+  return gh_number_p (s) ? gh_scm2int (s) : 0;
+}
+
 Stem*
 Rhythmic_head::stem_l () const
 {
@@ -41,9 +50,11 @@ Rhythmic_head::dots_i () const
 void
 Rhythmic_head::do_post_processing ()
 {
-  if (dots_l ())
+  if (Dots *d = dots_l ())
     {
-      dots_l ()->set_position(int (position_f ()));
+      Staff_symbol_referencer_interface si (d);
+      Staff_symbol_referencer_interface me (d);      
+      si.set_position(int (me.position_f ()));
     }
 }
 
@@ -55,18 +66,4 @@ Rhythmic_head::add_dots (Dots *dot_l)
   dot_l->add_dependency (this);  
 }
 
-Rhythmic_head::Rhythmic_head ()
-{
-  balltype_i_ =0;
-}
-
-
-
-void
-Rhythmic_head::do_print () const
-{
-#ifndef NPRINT
-  DEBUG_OUT << "balltype = "<< balltype_i_ << "dots = " << dots_i ();
-#endif
-}
 
index 45fbc03ed65605525260fa310fbd28d9ff24cda3..918550d15862f95578f8542db0a4c95460584804 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <string.h>
 
+#include "group-interface.hh"
 #include "misc.hh"
 #include "paper-score.hh"
 #include "paper-def.hh"
 #include "misc.hh"
 #include "paper-outputter.hh"
 #include "dimension-cache.hh"
-#include "staff-side.hh"
+#include "side-position-interface.hh"
 #include "item.hh"
 
-
 Score_element::Score_element()
 {
   output_p_ =0;
@@ -48,6 +48,9 @@ Score_element::Score_element()
   element_property_alist_ = SCM_EOL;
 
   smobify_self ();
+
+
+  set_elt_property ("dependencies", SCM_EOL);
 }
 
 SCM ly_deep_copy (SCM);
@@ -78,7 +81,7 @@ Score_element::Score_element (Score_element const&s)
     should protect because smobify_self () might trigger GC.
    */
   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_;
   lookup_l_ = s.lookup_l_;
@@ -97,16 +100,17 @@ Score_element::~Score_element()
   delete dim_cache_[Y_AXIS];  
 }
 
-Score_element*
-Score_element::dependency (int i) const
+
+Real
+Score_element::get_real (String s) const
 {
-  return dependency_arr_ [i];
+  return gh_scm2double (get_elt_property (s));
 }
 
-int
-Score_element::dependency_size () const
+void
+Score_element::set_real (String s, Real r)
 {
-  return dependency_arr_.size ();
+  set_elt_property (s, gh_double2scm (r));
 }
 
 // should also have one that takes SCM arg. 
@@ -173,7 +177,6 @@ Score_element::print() const
   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 ";
   do_print();
@@ -185,7 +188,7 @@ Score_element::print() const
 Paper_def*
 Score_element::paper_l ()  const
 {
- return pscore_l_->paper_l_;
+ return pscore_l_ ? pscore_l_->paper_l_ : 0;
 }
 
 Lookup const *
@@ -245,8 +248,11 @@ Score_element::calculate_dependencies (int final, int busy,
   assert (status_i_!= busy);
   status_i_= busy;
 
-  for (int i=0; i < dependency_arr_.size(); i++)
-    dependency_arr_[i]->calculate_dependencies (final, busy, funcptr);
+  Link_array<Score_element> dependency_arr =
+    Group_interface__extract_elements (this, (Score_element*)0, "dependencies");
+  
+  for (int i=0; i < dependency_arr.size(); i++)
+    dependency_arr[i]->calculate_dependencies (final, busy, funcptr);
 
   Link_array<Score_element> extra (get_extra_dependencies());
   for (int i=0; i < extra.size(); i++)
@@ -293,7 +299,6 @@ Score_element::output_processing ()
 void
 Score_element::do_break_processing()
 {
-  handle_broken_dependencies();
 }
 
 void
@@ -345,8 +350,8 @@ Score_element::add_dependency (Score_element*e)
 {
   if (e)
     {
-      dependency_arr_.push (e);
-      e->used_b_ = true;
+      Group_interface gi (this, "dependencies");
+      gi.add_element (e);
     }
   else
     programming_error ("Null dependency added");
@@ -400,12 +405,17 @@ 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);
+      SCM c = gh_cdr(s);
+
+      // gh_list_p () is linear, this is O(1)  
+      bool list = gh_pair_p (c) || c == SCM_EOL;
+      
+      if (gh_car (s) == SCM_UNDEFINED && list)
+       return c;
     }
   return s;
 }
-
+#if 0
 void
 Score_element::recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)())
 {
@@ -420,6 +430,7 @@ Score_element::recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)())
       recurse_into_smobs (gh_cdr (s), meth_ptr);      
     }
 }
+#endif
 
 void
 Score_element::handle_broken_dependencies()
@@ -435,27 +446,8 @@ Score_element::handle_broken_dependencies()
                                                 line ? line->self_scm_ : SCM_UNDEFINED);
 
 
-  recurse_into_smobs (element_property_alist_,
-                     &Score_element::handle_broken_dependencies);
-  
   if (!line)
     return;
-
-
-  Link_array<Score_element> new_deps;
-
-  for (int i=0; i < dependency_size(); i++) 
-    {
-      Score_element * elt = dependency (i);
-      if (elt->line_l() != line)
-       {
-         Score_element * broken = elt->find_broken_piece (line);
-         elt  = broken ;
-       }
-      if (elt)
-       new_deps.push (elt);
-    }
-  dependency_arr_ = new_deps;
 }
 
 
@@ -597,7 +589,7 @@ unsmob_element (SCM s)
 void
 Score_element::invalidate_cache (Axis a)
 {
-  dim_cache_[a]->invalidate ();
+  //  dim_cache_[a]->invalidate ();
 }
 
 Score_element*
index b39e2b0524f45ac47e2daa7d0bcff5e217cb4332..793ef46e977ec1c7248ebf393b423e4b554df4f9 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "engraver.hh"
 #include "script-column.hh"
-#include "staff-side.hh"
+#include "side-position-interface.hh"
 #include "dimension-cache.hh"
 
 /**
@@ -60,7 +60,7 @@ Script_column_engraver::acknowledge_element( Score_element_info inf)
   if (!thing)
     return;
   
-  if (Side_position_interface (thing).is_staff_side_b ())
+  if (Side_position_interface (thing).has_interface_b ())
     {
       if (!thing->breakable_b () && Side_position_interface (thing).get_axis () == Y_AXIS)
        {
index d9da8bc7894ed639114731250fa01f31c06c0100..18a7fac8b068c0ac6576cbf408880b05a2826e94 100644 (file)
@@ -7,7 +7,7 @@
   
  */
 #include "script-column.hh"
-#include "staff-side.hh"
+#include "side-position-interface.hh"
 #include "dimension-cache.hh"
 #include "group-interface.hh"
 
index cde149793f4e4b721691dd8fdd2c677d5a48a462..bb38f2833968f129193f1951791d61280e9f59ff 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "script-engraver.hh"
 #include "script.hh"
-#include "staff-side.hh"
+#include "side-position-interface.hh"
 #include "musical-request.hh"
 #include "stem.hh"
 #include "staff-symbol.hh"
@@ -50,7 +50,8 @@ Script_engraver::do_process_requests()
          continue;
        }
       Script *p =new Script;
-      Side_position_interface stafy (p); 
+      Side_position_interface stafy (p);
+      
       
       list = gh_cdr (list);
       p->set_elt_property ("molecule",
index 430b03acfe385711c9486e82106729dc5564982e..cc5db9d7482c1952807dd8cdf10ae2ff7eb4f5c3 100644 (file)
@@ -10,7 +10,7 @@
 #include "debug.hh"
 #include "script.hh"
 #include "lookup.hh"
-#include "staff-side.hh"
+#include "side-position-interface.hh"
 #include "paper-def.hh"
 #include "dimension-cache.hh"
 
index dd3d24ead3276ff9e2dbcc58755cf8042fdf02b0..5fb0da4792f5485a04d89a52c48fbfedd9bac27d 100644 (file)
@@ -58,8 +58,6 @@ Spanner::break_into_pieces ()
       span_p->set_bounds(RIGHT,bounds[RIGHT]);
       
       pscore_l_->typeset_element (span_p);
-      span_p->handle_broken_dependencies();
-
       broken_into_l_arr_.push (span_p);
     }
 
@@ -106,7 +104,6 @@ void
 Spanner::do_break_processing()
 {
   break_into_pieces ();
-  handle_broken_dependencies();
 }
 
 Spanner::Spanner ()
@@ -149,7 +146,7 @@ Score_element*
 Spanner::find_broken_piece (Line_of_score*l) const
 {
   Spanner* me = (Spanner*) this;
-  break_into_pieces ();
+  me->break_into_pieces ();
   
   int idx = binsearch_link_array (broken_into_l_arr_,  (Spanner*)l, Spanner::compare);
   
@@ -217,24 +214,12 @@ Spanner::get_broken_left_end_align () const
   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.
-
       /*
-       In fact that doesn't make a difference, since the Score_column
+       
+       We used to do a full search for the Break_align_item.
+       But 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))
-       {
-         Score_element *e = SMOB_TO_TYPE (Score_element, gh_car (s));
-         if(dynamic_cast<Break_align_item*> (e))
-           {
-             return e->extent (X_AXIS) [RIGHT];
-           }
-       }
-#endif
       return sc->extent (X_AXIS)[RIGHT];
     }
 
index 55167bbd3266f5edafe562d547ca8083f7818da7..bf62e781e0c8a0ec424e0d341e98652711089505 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include "staff-bar.hh"
+#include "staff-symbol-referencer.hh"
 
 Real
 Staff_bar::get_bar_size () const
@@ -16,12 +17,9 @@ Staff_bar::get_bar_size () const
   if (gh_number_p (size))
     return gh_scm2double (size);
   else
-    return (lines_i () -1) * staff_line_leading_f ();
+    {
+      Staff_symbol_referencer_interface si (this);
+      return (si.lines_i () -1) * si.staff_line_leading_f ();
+    }
 }
 
-void
-Staff_bar::do_pre_processing ()
-{
-  Bar::do_pre_processing ();
-  Staff_symbol_referencer::do_pre_processing ();
-}
index dc67ca5cf46f567d8b352f7a96c219e3826e6df2..bc52eb857d2f0d38f214eb67a8ea88cbd626d6a3 100644 (file)
@@ -10,7 +10,7 @@
 #include "bar.hh"
 #include "timing-translator.hh"
 #include "text-item.hh"
-#include "staff-side.hh"
+#include "side-position-interface.hh"
 
 ADD_THIS_TRANSLATOR (Staff_margin_engraver);
 
diff --git a/lily/staff-symbol-engraver.cc b/lily/staff-symbol-engraver.cc
new file mode 100644 (file)
index 0000000..9b2575a
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+  staff-sym-reg.cc -- implement Staff_symbol_engraver
+
+  source file of the GNU LilyPond music typesetter
+
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+#include "staff-symbol.hh"
+#include "score.hh"
+#include "paper-column.hh"
+#include "paper-def.hh"
+#include "side-position-interface.hh"
+#include "engraver.hh"
+#include "moment.hh"
+
+/**
+  Manage the staff symbol.
+ */
+class Staff_symbol_engraver : public Engraver { 
+  Staff_symbol *span_p_;
+public:
+  VIRTUAL_COPY_CONS(Translator);
+  Staff_symbol_engraver();
+  
+protected:
+  virtual ~Staff_symbol_engraver();
+
+  virtual void acknowledge_element (Score_element_info);
+  virtual void do_removal_processing();
+  virtual void do_creation_processing();
+       
+};
+
+
+Staff_symbol_engraver::~Staff_symbol_engraver()
+{
+  assert (!span_p_);
+}
+
+Staff_symbol_engraver::Staff_symbol_engraver()
+{
+  span_p_ = 0;
+}
+
+void
+Staff_symbol_engraver::do_creation_processing()
+{
+  span_p_ = new Staff_symbol;
+  span_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ());
+  announce_element (Score_element_info (span_p_, 0));
+}
+
+void
+Staff_symbol_engraver::do_removal_processing()
+{
+  SCM l (get_property ("numberOfStaffLines", 0));
+  if (gh_number_p(l))
+    {
+      span_p_->no_lines_i_ = gh_scm2int (l);
+    }
+
+  SCM sz (get_property ("staffLineLeading", 0));
+  if (gh_number_p(sz))
+    {
+      span_p_->staff_line_leading_f_ = gh_scm2double (sz);
+    }
+  else
+    {
+      span_p_->staff_line_leading_f_ = paper_l ()->get_var ("interline");
+    }
+  span_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ());
+  typeset_element (span_p_);
+  span_p_ =0;
+}
+
+void
+Staff_symbol_engraver::acknowledge_element (Score_element_info s)
+{
+  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))
+    {
+      Side_position_interface si (s.elem_l_);
+      if (si.has_interface_b ())
+       si.add_support (span_p_);
+    }
+}
+
+
+ADD_THIS_TRANSLATOR(Staff_symbol_engraver);
+
diff --git a/lily/staff-symbol.cc b/lily/staff-symbol.cc
new file mode 100644 (file)
index 0000000..bd9d63b
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+  staffsym.cc -- implement Staff_symbol
+
+  source file of the GNU LilyPond music typesetter
+
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+#include "staff-symbol.hh"
+#include "lookup.hh"
+#include "dimensions.hh"
+#include "paper-def.hh"
+#include "molecule.hh"
+#include "debug.hh"
+#include "item.hh"
+
+
+Staff_symbol::Staff_symbol ()
+{
+  no_lines_i_ = 5;
+  staff_line_leading_f_ = 5.0 PT;
+}
+
+void
+Staff_symbol::do_print() const
+{
+#ifndef NPRINT
+  Spanner::do_print();
+  DEBUG_OUT << "lines: " << no_lines_i_;
+#endif
+}
+
+
+Molecule*
+Staff_symbol::do_brew_molecule_p() const
+{
+  Score_element * common
+    = spanned_drul_[LEFT]->common_refpoint (spanned_drul_[RIGHT], X_AXIS);
+
+#if 0
+  Interval r =  spanned_drul_[RIGHT]->extent (X_AXIS);
+  Interval l =  spanned_drul_[LEFT]->extent (X_AXIS);
+  
+  Real left_shift =l.empty_b () ? 0.0: l[LEFT];
+  Real right_shift =r.empty_b () ? 0.0: r[RIGHT];  
+#endif
+  Real width =
+    // right_shift     - left_shift
+    + spanned_drul_[RIGHT]->relative_coordinate (common , X_AXIS)
+    - spanned_drul_[LEFT]->relative_coordinate (common, X_AXIS)
+    ;
+
+  Real t = paper_l ()->get_var ("stafflinethickness");
+  Molecule rule  = lookup_l ()->filledbox (Box (Interval (0,width),
+                                               Interval (-t/2, t/2)));
+
+  Real height = (no_lines_i_-1) * staff_line_leading_f_ /2;
+  Molecule * m = new Molecule;
+  for (int i=0; i < no_lines_i_; i++)
+    {
+      Molecule a (rule);
+      a.translate_axis (height - i * staff_line_leading_f_, Y_AXIS);
+      m->add_molecule (a);
+    }
+
+  //  m->translate_axis (left_shift, X_AXIS);
+  return m;
+}
+
+
+int
+Staff_symbol::steps_i() const
+{
+  return no_lines_i_*2;
+}
+Real
+Staff_symbol::staff_line_leading_f ()
+{
+  return staff_line_leading_f_;
+}
index cdb819767c0e81475436694b0bc91aa7233008d1..e6bd43c2bdd8d121ed3f18296e4fd76eeb6335dc 100644 (file)
@@ -6,6 +6,7 @@
   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
+#include "staff-symbol-referencer.hh"
 #include "stem-engraver.hh"
 #include "note-head.hh"
 #include "stem.hh"
@@ -48,7 +49,10 @@ Stem_engraver::acknowledge_element(Score_element_info i)
       if (!stem_p_) 
        {
          stem_p_ = new Stem;
-         stem_p_->flag_i_ = duration_log;
+         Staff_symbol_referencer_interface st(stem_p_);
+         st.set_interface ();
+         
+         stem_p_->set_elt_property ("duration-log", gh_int2scm (duration_log));
 
          if (abbrev_req_l_)
            {
@@ -75,9 +79,9 @@ Stem_engraver::acknowledge_element(Score_element_info i)
          announce_element (Score_element_info (stem_p_, r));
        }
 
-      if (stem_p_->flag_i_ != duration_log)
+      if (stem_p_->flag_i () != duration_log)
        {
-         r->warning (_f ("Adding note head to incompatible stem (type = %d)", 1 <<  stem_p_->flag_i_));
+         r->warning (_f ("Adding note head to incompatible stem (type = %d)", 1 <<  stem_p_->flag_i ()));
        }
 
       stem_p_->add_head (h);
@@ -112,7 +116,7 @@ Stem_engraver::do_pre_move_processing()
 
       // UGH. Should mark non-forced instead.
       SCM dir = stem_p_->get_elt_property ("direction");
-      if (gh_number_p (dir) && gh_int2scm (dir))
+      if (gh_number_p (dir) && to_dir(dir))
        {
          stem_p_->set_elt_property ("dir-forced", SCM_BOOL_T);   
        }
index d55cd55272200002c3036e6de523a77e3c91e5fd..069ef6259cf2d6251b527eddfc545cab309cd94a 100644 (file)
@@ -15,6 +15,8 @@
 #include "stem.hh"
 #include "offset.hh"
 #include "dimension-cache.hh"
+#include "staff-symbol-referencer.hh"
+
 
 Stem_tremolo::Stem_tremolo ()
 {
@@ -40,7 +42,8 @@ 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 ();
+  Real space = Staff_symbol_referencer_interface (s->stem_l ())
+    .staff_line_leading_f ();
   return Interval (-space, space);
 }
 
@@ -52,28 +55,25 @@ Stem_tremolo::do_brew_molecule_p () const
   int mult =0;
   if (Beam * b = st->beam_l ())
     {
-      Stem_info i = b->get_stem_info (st);
-      mult = i.mult_i_;
+      mult = b->multiplicity_i_;
     }
   
   Real interbeam_f = paper_l ()->interbeam_f (mult);
   Real w  = gh_scm2double (get_elt_property ("beam-width"));
-  Real space = st->staff_line_leading_f ();
-  Real internote_f = space/2;
-  
+  Real space = Staff_symbol_referencer_interface (st).staff_line_leading_f ();
+  Real internote_f = space / 2;
   Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));
 
   int beams_i = 0;
-  Real slope_f = internote_f / 4 / internote_f;        // HUH?
+  Real slope_f = 0.25;
 
   if (st && st->beam_l ()) {
     slope_f = st->beam_l ()->slope_f_;
     // ugh, rather calc from Stem_tremolo_req
     beams_i = st->beams_i_drul_[RIGHT] >? st->beams_i_drul_[LEFT];
   } 
-  Real sl = slope_f * internote_f;
 
-  Molecule a (lookup_l ()->beam (sl, w, beam_f));
+  Molecule a (lookup_l ()->beam (slope_f, w, beam_f));
   a.translate (Offset (-w/2, w / 2 * slope_f));
 
   Molecule *beams= new Molecule; 
@@ -107,12 +107,7 @@ Stem_tremolo::do_brew_molecule_p () const
            ? -st->get_direction () * st->note_delta_f ()/2
            : 0.0;
 
-         /*
-           UGH. Internote fudging.
-          */
-         dy /= internote_f;
          dy += st->stem_end_f ();
-         dy *= internote_f;
          beams->translate (Offset(st->hpos_f () - hpos_f ()+
                                   whole_note_correction, dy));
        }
index 1edd92bc53cb3f7c7dea32e05afba42394483379..a6ca3d3df5d3d08c4bbd769b604f666faedb3a72 100644 (file)
@@ -4,6 +4,7 @@
   source file of the GNU LilyPond music typesetter
 
   (c) 1996, 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+    Jan Nieuwenhuizen <janneke@gnu.org>
 
   TODO: This is way too hairy
 */
 #include "beam.hh"
 #include "rest.hh"
 #include "group-interface.hh"
+#include "cross-staff.hh"
+#include "staff-symbol-referencer.hh"
 
 Stem::Stem ()
 {
   beams_i_drul_[LEFT] = beams_i_drul_[RIGHT] = -1;
-  yextent_drul_[DOWN] = yextent_drul_[UP] = 0;
-  flag_i_ = 2;
 }
 
 Interval_t<int>
@@ -46,43 +47,38 @@ Stem::head_positions () const
   Interval_t<int> r;
   for (int i =0; i < head_l_arr.size (); i++)
     {
-      int p = (int)head_l_arr[i]->position_f ();
+      Staff_symbol_referencer_interface si (head_l_arr[i]);
+      int p = (int)si.position_f ();
       r[BIGGER] = r[BIGGER] >? p;
       r[SMALLER] = r[SMALLER] <? p;
     }
   return r;
 }
 
-void
-Stem::do_print () const
-{
-#ifndef NPRINT
-  DEBUG_OUT << "flag "<< flag_i_;
-#endif
-}
 
 Real
 Stem::stem_length_f () const
 {
-  return yextent_drul_[UP]-yextent_drul_[DOWN] ;
+  return yextent_.length();
 }
 
 Real
 Stem::stem_begin_f () const
 {
-  return yextent_drul_[Direction(-get_direction ())];
+  return yextent_[Direction(-get_direction ())];
 }
 
 Real
 Stem::chord_start_f () const
 {
-  return head_positions()[get_direction ()] * staff_line_leading_f ()/2.0;
+  return head_positions()[get_direction ()]
+    * Staff_symbol_referencer_interface (this).staff_line_leading_f ()/2.0;
 }
 
 Real
 Stem::stem_end_f () const
 {
-  return yextent_drul_[get_direction ()];
+  return yextent_[get_direction ()];
 }
 
 void
@@ -93,15 +89,14 @@ Stem::set_stemend (Real se)
     warning (_ ("Weird stem size; check for narrow beams"));
 
   
-  yextent_drul_[get_direction ()]  =  se;
-  yextent_drul_[Direction(-get_direction ())] = head_positions()[-get_direction ()];
+  yextent_[get_direction ()]  =  se;
+  yextent_[Direction(-get_direction ())] = head_positions()[-get_direction ()];
 }
 
 int
 Stem::type_i () const
 {
-  
-  return first_head ()->balltype_i_;
+  return first_head ()->balltype_i ();
 }
 
 Note_head*
@@ -135,7 +130,7 @@ Stem::add_head (Rhythmic_head *n)
 bool
 Stem::invisible_b () const
 {
-  return !(first_head () && first_head()->balltype_i_ >= 1);
+  return !(first_head () && first_head()->balltype_i () >= 1);
 }
 
 int
@@ -158,8 +153,6 @@ Stem::get_default_dir () const
   return Direction (int(paper_l ()->get_var ("stem_default_neutral_direction")));
 }
 
-
-
 void
 Stem::set_default_stemlen ()
 {
@@ -187,10 +180,10 @@ Stem::set_default_stemlen ()
   if (((int)chord_start_f ())
       && (get_direction () != get_default_dir ()))
     length_f -= shorten_f;
-
 if (flag_i_ >= 5)
if (flag_i () >= 5)
     length_f += 2.0;
-  if (flag_i_ >= 6)
+  if (flag_i () >= 6)
     length_f += 1.0;
   
   set_stemend ((get_direction () > 0) ? head_positions()[BIGGER] + length_f:
@@ -201,6 +194,13 @@ Stem::set_default_stemlen ()
     set_stemend (0);
 }
 
+int
+Stem::flag_i () const
+{
+  SCM s = get_elt_property ("duration-log");
+  return  (gh_number_p (s)) ? gh_scm2int (s) : 2;
+}
+
 //xxx
 void
 Stem::set_default_extents ()
@@ -230,10 +230,11 @@ Stem::set_noteheads ()
     head_l_arr.top ()->set_elt_property ("extremal", SCM_BOOL_T);
   
   int parity=1;
-  int lastpos = int (beginhead->position_f ());
+  int lastpos = int (Staff_symbol_referencer_interface (beginhead).position_f ());
   for (int i=1; i < head_l_arr.size (); i ++)
     {
-      int dy =abs (lastpos- (int)head_l_arr[i]->position_f ());
+      Real p = Staff_symbol_referencer_interface (head_l_arr[i]).position_f ();
+      int dy =abs (lastpos- (int)p);
 
       if (dy <= 1)
        {
@@ -243,14 +244,14 @@ Stem::set_noteheads ()
        }
       else
        parity = 1;
-      lastpos = int (head_l_arr[i]->position_f ());
+      lastpos = int (p);
     }
 }
 
 void
 Stem::do_pre_processing ()
 {
-  if (yextent_drul_[DOWN]== yextent_drul_[UP])
+  if (yextent_.empty_b ())
     set_default_extents ();
   set_noteheads ();
 
@@ -305,7 +306,7 @@ Stem::flag () const
 
   char c = (get_direction () == UP) ? 'u' : 'd';
   Molecule m = lookup_l ()->afm_find (String ("flags-") + to_str (c) + 
-                                     to_str (flag_i_));
+                                     to_str (flag_i ()));
   if (!style.empty_b ())
     m.add_molecule(lookup_l ()->afm_find (String ("flags-") + to_str (c) + style));
   return m;
@@ -317,7 +318,7 @@ Stem::dim_callback (Dimension_cache const* c)
   Stem * s = dynamic_cast<Stem*> (c->element_l ());
   
   Interval r (0, 0);
-  if (s->get_elt_property ("beam") != SCM_UNDEFINED || abs (s->flag_i_) <= 2)
+  if (s->get_elt_property ("beam") != SCM_UNDEFINED || abs (s->flag_i ()) <= 2)
     ;  // TODO!
   else
     {
@@ -336,8 +337,9 @@ Molecule*
 Stem::do_brew_molecule_p () const
 {
   Molecule *mol_p =new Molecule;
-  Drul_array<Real> stem_y = yextent_drul_;
-  Real dy = staff_line_leading_f ()/2.0;
+  Interval stem_y = yextent_;
+  Real dy = staff_symbol_referencer_interface (this)
+    .staff_line_leading_f ()/2.0;
 
   Real head_wid = 0;
   if (first_head ())
@@ -353,7 +355,7 @@ Stem::do_brew_molecule_p () const
     }
 
   if (get_elt_property ("beam") == SCM_UNDEFINED
-      && abs (flag_i_) > 2)
+      && abs (flag_i ()) > 2)
     {
       Molecule fl = flag ();
       fl.translate_axis(stem_y[get_direction ()]*dy, Y_AXIS);
@@ -398,3 +400,104 @@ Stem::beam_l ()const
   SCM b=  get_elt_property ("beam");
   return dynamic_cast<Beam*> (unsmob_element (b));
 }
+
+
+Stem_info
+Stem::calc_stem_info () const
+{
+  assert (beam_l ());
+
+  SCM bd = get_elt_property ("beam-dir");
+  Real internote_f
+    = staff_symbol_referencer_interface (this).staff_line_leading_f ()/2;
+  
+  Direction beam_dir;
+  Stem_info info; 
+
+  if (isdir_b (bd))
+    {
+      beam_dir = to_dir (bd);
+    }
+  else
+    {
+      programming_error ("Beam direction not set."); 
+      beam_dir = UP;           //  GURAUGRNAGURAGU! urg !
+    }
+  
+  Real interbeam_f = paper_l ()->interbeam_f (beam_l ()->multiplicity_i_);
+  Real beam_f = gh_scm2double (beam_l ()->get_elt_property ("beam-thickness"));
+         
+  info.idealy_f_ = chord_start_f ();
+
+  // for simplicity, we calculate as if dir == UP
+  info.idealy_f_ *= beam_dir;
+
+  bool grace_b = get_elt_property ("grace") != SCM_UNDEFINED;
+  bool no_extend_b = get_elt_property ("no-stem-extend") != SCM_UNDEFINED;
+
+  int stem_max = (int)rint(paper_l ()->get_var ("stem_max"));
+  String type_str = grace_b ? "grace_" : "";
+  Real min_stem_f = paper_l ()->get_var (type_str + "minimum_stem_length"
+    + to_str (beam_l ()->multiplicity_i_ <? stem_max)) * internote_f;
+  Real stem_f = paper_l ()->get_var (type_str + "stem_length"
+    + to_str (beam_l ()->multiplicity_i_ <? stem_max)) * internote_f;
+
+  if (!beam_dir || (beam_dir == get_direction ()))
+    /* normal beamed stem */
+    {
+      if (beam_l ()->multiplicity_i_)
+       {
+         info.idealy_f_ += beam_f;
+         info.idealy_f_ += (beam_l ()->multiplicity_i_ - 1) * interbeam_f;
+       }
+      info.miny_f_ = info.idealy_f_;
+      info.maxy_f_ = INT_MAX;
+
+      info.idealy_f_ += stem_f;
+      info.miny_f_ += min_stem_f;
+
+      /*
+       lowest beam of (UP) beam must never be lower than second staffline
+
+       Hmm, reference (Wanske?)
+
+       Although this (additional) rule is probably correct,
+       I expect that highest beam (UP) should also never be lower
+       than middle staffline, just as normal stems.
+       
+      */
+      if (!grace_b && !no_extend_b)
+       {
+         //highest beam of (UP) beam must never be lower than middle staffline
+         info.miny_f_ = info.miny_f_ >? 0;
+         //lowest beam of (UP) beam must never be lower than second staffline
+         info.miny_f_ = info.miny_f_ >? (- 2 * internote_f - beam_f
+                               + (beam_l ()->multiplicity_i_ > 0) * beam_f + interbeam_f * (beam_l ()->multiplicity_i_ - 1));
+       }
+    }
+  else
+    /* knee */
+    {
+      info.idealy_f_ -= beam_f;
+      info.maxy_f_ = info.idealy_f_;
+      info.miny_f_ = -INT_MAX;
+
+      info.idealy_f_ -= stem_f;
+      info.maxy_f_ -= min_stem_f;
+    }
+
+  info.idealy_f_ = info.maxy_f_ <? info.idealy_f_;
+  info.idealy_f_ = info.miny_f_ >? info.idealy_f_;
+
+  Real interstaff_f = calc_interstaff_dist (this, beam_l ());
+  info.idealy_f_ += interstaff_f * beam_dir;
+
+  SCM s = get_elt_property ("shorten");
+  if (s != SCM_UNDEFINED)
+    info.idealy_f_ -= gh_double2scm (s);
+  info.miny_f_ += interstaff_f * beam_dir;
+  info.maxy_f_ += interstaff_f * beam_dir;
+
+  return info;
+}
+
index 6959854d0f659f796905f8ca2d0d59eeecb36fef..f7ea46e8015040c79617a4f319e6e990ddad5082 100644 (file)
 #include "note-head.hh"
 #include "paper-column.hh"
 #include "debug.hh"
-#include "group-interface.hh"
-
-
-
+#include "staff-symbol-referencer.hh"
 
 void
 Tie::set_head (Direction d, Note_head * head_l)
@@ -22,7 +19,7 @@ Tie::set_head (Direction d, Note_head * head_l)
   assert (!head (d));
   if (d == LEFT)
     gh_set_car_x (get_elt_property ("heads"), head_l->self_scm_ );
-  else if (d == LEFT)
+  else if (d == RIGHT)
     gh_set_cdr_x (get_elt_property ("heads"), head_l->self_scm_ );
   
   set_bounds (d, head_l);
@@ -51,8 +48,10 @@ Tie::head (Direction d) const
 Direction
 Tie::get_default_dir () const
 {
-  int m = int (head (LEFT)->position_f () 
-              + head (RIGHT)->position_f ()) /2;
+  Real p1 = Staff_symbol_referencer_interface (head (LEFT)).position_f () ;
+  Real p2 = Staff_symbol_referencer_interface (head (RIGHT)).position_f () ;  
+  
+  int m = int (p1  + p2);
 
   /*
     If dir is not determined: inverse of stem: down
@@ -84,7 +83,14 @@ Tie::do_add_processing()
 void
 Tie::do_post_processing()
 {
-  assert (head (LEFT) || head (RIGHT));
+  if (!head (LEFT) && !head (RIGHT))
+    {
+      programming_error ("Tie without heads.");
+      set_elt_property ("transparent", SCM_BOOL_T);
+      set_empty (X_AXIS);
+      set_empty (Y_AXIS);
+      return;
+    }
 
   Real interline_f = paper_l ()->get_var ("interline");
   Real internote_f = interline_f / 2;
@@ -167,8 +173,10 @@ Tie::do_post_processing()
         for smal slurs
    */
 
-  Real ypos = head (LEFT) ? head (LEFT)->position_f ()
-    : head (RIGHT)->position_f ();
+
+  Real ypos = head (LEFT)
+    ? Staff_symbol_referencer_interface (head (LEFT)).position_f ()
+    : Staff_symbol_referencer_interface (head (RIGHT)).position_f () ;  
 
   Real y_f = internote_f * ypos; 
   int ypos_i = int (ypos);
index 48935c674cbe572705430ffdf44b1f781de114b4..7f047f908eec98142898d4abe7575f7f96befe75 100644 (file)
@@ -58,15 +58,8 @@ Vertical_align_engraver::do_removal_processing()
 bool
 Vertical_align_engraver::qualifies_b (Score_element_info i) const
 {
-#if 0
-  Translator * t =   i.origin_trans_l_arr_[0];
-#endif
   int sz = i.origin_trans_l_arr_.size()  ;
 
-#if 0 
-  return (sz == 1 && dynamic_cast<Translator_group*> (t))
-    || (sz == 2 && dynamic_cast<Axis_group_engraver*> (t));
-#endif
 
   Axis_group_element * elt = dynamic_cast<Axis_group_element *> (i.elem_l_);
 
index 4e60c76a0119ba2eca671450f09c77f012feedbd..bbeba9384157dfdab38514ce3f44e95130e01dae 100644 (file)
@@ -29,7 +29,7 @@ stem_max = 3.0;
 
 %{ Specify length of stems for notes in the staff
 that don't have beams. 
- Measured in staff positions.
  Measured in staff positions.
 %}
 stem_length0 = 7.;
 stem_length1 = 5.;
@@ -63,7 +63,7 @@ grace_stem_length3 = \stem_length3 * \grace_factor;
 
 % only used for beams
 minimum_stem_length0 = 0.0 ; % not used
-minimum_stem_length1 = 3. ;
+minimum_stem_length1 = 3.;
 minimum_stem_length2 = 2.5;
 minimum_stem_length3 = 2.0;