]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.10.jcn1
authorJan Nieuwenhuizen <janneke@gnu.org>
Wed, 8 Dec 1999 22:12:24 +0000 (23:12 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Wed, 8 Dec 1999 22:12:24 +0000 (23:12 +0100)
pl 10.jcn1
- steminfo to properties
- dropped internote dim for stem-beams

20 files changed:
CHANGES
VERSION
lily/beam.cc
lily/chord-tremolo-engraver.cc
lily/file-results.cc
lily/include/beam.hh
lily/include/glob.hh
lily/include/new-beaming.hh
lily/include/new-repeated-music.hh
lily/include/parseconstruct.hh
lily/include/score-element.hh
lily/include/stem-info.hh
lily/include/stem.hh
lily/include/symbols.hh
lily/score-element.cc
lily/stem-info.cc
lily/stem-staff-side.cc
lily/stem-tremolo.cc
lily/stem.cc
ly/params.ly

diff --git a/CHANGES b/CHANGES
index 6742e3945cc6943ca5f3a6296e03460d3c3497fe..9e4c61e8a05540db08a37b090631d1a512b20989 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+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.
diff --git a/VERSION b/VERSION
index 978773045b1b91f64e82ff4b5cb6266373b0682e..48ade71e1d508f3697654a119152bd83b4b02194 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
 PATCH_LEVEL=10
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=jcn1
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index 0335ff72565218e592c032d95588e3cf6f1af069..c8c1dd022948e942dc795c0dae17ff46206d0062 100644 (file)
@@ -44,7 +44,7 @@ Beam::Beam ()
   
   slope_f_ = 0;
   left_y_ = 0;
-  multiple_i_ = 0;
+  multiplicity_i_ = 0;
 }
 
 /*
@@ -63,6 +63,12 @@ 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];
+}
+
 
 void
 Beam::add_stem (Stem*s)
@@ -81,24 +87,11 @@ 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 ();
@@ -110,8 +103,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 +115,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 = (stem (0)->note_delta_f () + extent (X_AXIS).length ())/2.0;
+  return Offset (w, w * slope_f_);
 }
 
 /*
@@ -139,17 +128,16 @@ 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)(stem (i)->get_real ("interstaff-f") - stem (i-1)->get_real ("interstaff-f"));
+         int l_y = (int)(stem (i-1)->chord_start_f ())
+           + (int)stem (i-1)->get_real ("interstaff-f");
+         int r_y = (int)(stem (i)->chord_start_f ())
+           + (int)stem (i)->get_real ("interstaff-f");
          int gap_i = r_y - l_y;
 
          /*
@@ -168,8 +156,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)stem (i)->get_real ("interstaff-f");
          stem (i)->set_direction ( y < knee_y ? UP : DOWN);
          stem (i)->set_elt_property ("dir-forced", SCM_BOOL_T);
        }
@@ -218,14 +206,14 @@ Beam::do_post_processing ()
       set_elt_property ("transparent", SCM_BOOL_T);
       return;
     }
-  set_steminfo ();
+  beamify_stems ();
   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,8 +221,7 @@ Beam::do_post_processing ()
          set_elt_property ("damping", gh_int2scm(1000));
       */
 
-      sinfo_.clear ();
-      set_steminfo ();
+      beamify_stems ();
     }
   calculate_slope ();
   set_stemlens ();
@@ -338,12 +325,14 @@ Beam::set_direction (Direction d)
 void
 Beam::solve_slope ()
 {
-  assert (sinfo_.size () > 1);
+  assert (stem_count () > 1);
 
   Least_squares l;
-  for (int i=0; i < sinfo_.size (); i++)
+  Real x0 = stem (0)->hpos_f ();
+  for (int i=0; i < stem_count (); i++)
     {
-      l.input.push (Offset (sinfo_[i].x_, sinfo_[i].idealy_f_));
+      l.input.push (Offset (stem (i)->hpos_f () - x0, 
+        stem (i)->get_real ("idealy-f")));
     }
   l.minimise (slope_f_, left_y_);
 }
@@ -355,52 +344,55 @@ Beam::solve_slope ()
 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 = stem (0)->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_;
+      Real y = (stem (i)->hpos_f () - x0) * slope_f_ + left_y_;
 
       // correct for knee
-      if (get_direction () != sinfo_[i].get_direction ())
+      if (get_direction () != stem (i)->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);
+         if (!i
+           && stem (i)->staff_symbol_l () != stem_top ()->staff_symbol_l ())
+           y += get_direction () * (multiplicity_i_ - (stem (i)->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_);
+       stem (i)->set_stemend ((y - stem (i)->get_real ("interstaff-f"))
+                              / 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 > stem (i)->get_real ("maxy-f"))
+       dy_f = dy_f <? stem (i)->get_real ("maxy-f") - y;
+      if (y < stem (i)->get_real ("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 >? stem (i)->get_real ("miny-f") - y; 
        }
     }
   return dy_f;
 }
 
 void
-Beam::set_steminfo ()
+Beam::beamify_stems ()
 {
   if(!stem_count ())
     return;
   
-  assert (multiple_i_);
+  assert (multiplicity_i_);
 
   int total_count_i = 0;
   int forced_count_i = 0;
@@ -416,13 +408,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 +428,26 @@ 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 ())
+      s->beamify ();
+      if (s->get_direction () == get_direction ())
         {
          if (forced_count_i == total_count_i)
-           info.idealy_f_ -= shorten_f;
+           s->set_real ("idealy-f", s->get_real ("idealy-f") - shorten_f);
          else if (forced_count_i > total_count_i / 2)
-           info.idealy_f_ -= shorten_f / 2;
+           s->set_real ("idealy-f", s->get_real ("idealy-f") - 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 (stem (0)->get_real ("idealy-f") == stem_top ()->get_real ("idealy-f"))
     {
       slope_f_ = 0;
-      left_y_ = sinfo_[0].idealy_f_;
+      left_y_ = stem (0)->get_real ("idealy-f");
       left_y_ *= get_direction ();
     }
   else
@@ -472,14 +460,11 @@ Beam::calculate_slope ()
       */
       Real dx_f = stem (stem_count () -1)->hpos_f () - stem (0)->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_ - stem (0)->get_real ("idealy-f") > lengthened)
           && (slope_f_ > steep))
-         || ((left_y_ + slope_f_ * dx_f - sinfo_.top ().idealy_f_ > lengthened)
+         || ((left_y_ + slope_f_ * dx_f - stem_top ()->get_real ("idealy-f") > lengthened)
              && (slope_f_ < -steep)))
        {
          slope_f_ = 0;
@@ -526,14 +511,12 @@ Beam::quantise_dy ()
     return;
 
   Real interline_f = stem (0)->staff_line_leading_f ();
-  Real internote_f = interline_f / 2;
   Real staffline_f = paper_l ()->get_var ("stafflinethickness");
   Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));;
 
   Real dx_f = stem (stem_count () -1 )->hpos_f () - stem (0)->hpos_f ();
 
-  // dim(y) = internote; so slope = (y/internote)/x
-  Real dy_f = dx_f * abs (slope_f_ * internote_f);
+  Real dy_f = dx_f * abs (slope_f_);
   
   Real quanty_f = 0.0;
 
@@ -542,14 +525,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_);
 }
 
 /*
@@ -579,7 +560,6 @@ Beam::quantise_left_y (bool extend_b)
    */
 
   Real space = stem (0)->staff_line_leading_f ();
-  Real internote_f = space /2;
   Real staffline_f = paper_l ()->get_var ("stafflinethickness");
   Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));;
 
@@ -603,27 +583,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 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 +615,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,7 +663,7 @@ 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);
     }
 
@@ -714,14 +692,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 567c31ec6a6b0db8f506ce69501665a3c268eead..427e0d76e620f91f959c6b0d56e4404210f0c02d 100644 (file)
@@ -142,7 +142,7 @@ Chord_tremolo_engraver::acknowledge_element (Score_element_info 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
          */
index 8b137891791fe96927ad78e64b0aad7bded08bdc..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1 +0,0 @@
-
index cfcc305e65fb45d43524f9b7d4c82611248d7e0a..67c443eee616eebe9409382fcfda9504309484ec 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "lily-proto.hh"
 #include "directional-spanner.hh"
-#include "stem-info.hh"
 
 
 /** a beam connects multiple stems.
@@ -31,6 +30,7 @@ public:
 
   int stem_count ()const;
   Stem * stem (int )const;
+  Stem* Beam::stem_top ()const;
 
   /**
      the slope of the beam in (staffpositions) per (X-dimension, in PT).
@@ -41,15 +41,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 +59,7 @@ protected:
   Offset center () const;
   Direction get_default_dir () const;
   void set_direction (Direction);
-  void set_steminfo ();
+  void beamify_stems ();
   bool auto_knee (SCM gap, bool interstaff_b);
   bool auto_knees ();
   
index 3bb2fe7601872729e8196e5a75e33180053775c6..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,9 +0,0 @@
-#ifndef GLOB_HH
-#define GLOB_HH
-#include <assert.h>
-#include <math.h>
-#include "real.hh"
-
-#include "lily-proto.hh"
-#include "const.hh"
-#endif
index 65296f81060baccd891380179b283fc7515acef0..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,2 +0,0 @@
-
-#error
index 65296f81060baccd891380179b283fc7515acef0..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,2 +0,0 @@
-
-#error
index 65296f81060baccd891380179b283fc7515acef0..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,2 +0,0 @@
-
-#error
index f5a26a030f5a8c63ccd191c0378394c1a2113d19..c799408ee818a4a8262f4a3699a11338b2135869 100644 (file)
@@ -74,6 +74,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.
    */
index 248f71b82dbe5eac54f5af466bd69fa0140ab917..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,33 +0,0 @@
-/*
-  stem-info.hh -- declare Stem_info
-
-  source file of the GNU LilyPond music typesetter
-
-  (c)  1997--1999 Jan Nieuwenhuizen <janneke@gnu.org>
-*/
-
-
-#ifndef STEM_INFO_HH
-#define STEM_INFO_HH
-
-#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_;
-  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..6f6fd757829d57aa57de0ef0a928939e5c61318f 100644 (file)
@@ -69,6 +69,7 @@ public:
     
   /// ensure that this Stem also encompasses the Notehead #n#
   void add_head (Rhythmic_head*n);
+  void beamify ();
 
   Real hpos_f () const;
   Real chord_start_f () const;
index 8b137891791fe96927ad78e64b0aad7bded08bdc..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1 +0,0 @@
-
index 45fbc03ed65605525260fa310fbd28d9ff24cda3..5e958affaa55c2e37e07620603939f6750690ddf 100644 (file)
@@ -27,7 +27,6 @@
 #include "staff-side.hh"
 #include "item.hh"
 
-
 Score_element::Score_element()
 {
   output_p_ =0;
@@ -109,6 +108,18 @@ Score_element::dependency_size () const
   return dependency_arr_.size ();
 }
 
+Real
+Score_element::get_real (String s) const
+{
+  return gh_scm2double (get_elt_property (s));
+}
+
+void
+Score_element::set_real (String s, Real r)
+{
+  set_elt_property (s, gh_double2scm (r));
+}
+
 // should also have one that takes SCM arg. 
 SCM
 Score_element::get_elt_property (String nm) const
index ee0faf9721a4a60516b2d21e82a5444b596b191f..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,138 +0,0 @@
-/*
-  stem-info.cc -- implement Stem_info
-
-  source file of the GNU LilyPond music typesetter
-
-  (c)  1997--1999 Jan Nieuwenhuizen <janneke@gnu.org>
-
-*/
-
-#include "proto.hh"
-#include "misc.hh"
-#include "cross-staff.hh"
-#include "debug.hh"
-#include "stem.hh"
-#include "paper-def.hh"
-#include "lookup.hh"
-#include "stem-info.hh"
-#include "beam.hh"
-
-
-Stem_info::Stem_info ()
-{
-}
-
-
-/*
-  FIXME: y dims should not be in internote.
-
-
-  GURG UGRGINRG INA UG R
-
-  JUNKME -> this should set elt properties of STEM.
-*/
-Stem_info::Stem_info (Stem*s, int mult)
-{
-  mult_i_ =mult;
-  stem_l_ = s;
-  Beam* beam_l = stem_l_->beam_l ();
-  
-  x_ = stem_l_->hpos_f ();
-  set_direction (stem_l_->get_direction ());
-  SCM bd = stem_l_->remove_elt_property ("beam-dir");
-  
-  if (gh_number_p (bd))
-    {
-      beam_dir_ = gh_scm2int (bd);
-    }
-  else
-    {
-      programming_error ("Beam direction not set."); 
-      beam_dir_ = UP;          //  GURAUGRNAGURAGU! urg !
-    }
-  
-  Paper_def* paper_l = stem_l_->paper_l ();
-  Real internote_f = stem_l_->staff_line_leading_f ()/2;
-  Real interbeam_f = paper_l->interbeam_f (mult_i_);
-  Real beam_f = gh_scm2double (beam_l->get_elt_property ("beam-thickness"));
-         
-
-  // strangely enough, dim(chord_start_f) == pt (and not internote!)
-  idealy_f_ = stem_l_->chord_start_f () / internote_f;
-
-  // calculate using dim(y) == pt
-  idealy_f_ *= internote_f;
-
-  // for simplicity, we calculate as if dir == UP
-  idealy_f_ *= beam_dir_;
-
-  bool grace_b = stem_l_->get_elt_property ("grace") != SCM_UNDEFINED;
-  bool no_extend_b = stem_l_->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 (mult_i_ <? stem_max)) * internote_f;
-  Real stem_f = paper_l->get_var (type_str + "stem_length"
-                                 + to_str (mult_i_ <? stem_max))* internote_f;
-
-  if (!beam_dir_ || (beam_dir_ == get_direction ()))
-    /* normal beamed stem */
-    {
-      if (mult_i_)
-       {
-         idealy_f_ += beam_f;
-         idealy_f_ += (mult_i_ - 1) * interbeam_f;
-       }
-      miny_f_ = idealy_f_;
-      maxy_f_ = INT_MAX;
-
-      idealy_f_ += stem_f;
-      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
-         miny_f_ = miny_f_ >? 0;
-         //lowest beam of (UP) beam must never be lower than second staffline
-         miny_f_ = miny_f_ >? (- 2 * internote_f - beam_f
-                               + (mult_i_ > 0) * beam_f + interbeam_f * (mult_i_ - 1));
-       }
-    }
-  else
-    /* knee */
-    {
-      idealy_f_ -= beam_f;
-      maxy_f_ = idealy_f_;
-      miny_f_ = -INT_MAX;
-
-      idealy_f_ -= stem_f;
-      maxy_f_ -= min_stem_f;
-    }
-
-  // set dim(y) == internote
-  idealy_f_ /= internote_f;
-  miny_f_ /= internote_f;
-  maxy_f_ /= internote_f;
-
-  idealy_f_ = maxy_f_ <? idealy_f_;
-  idealy_f_ = miny_f_ >? idealy_f_;
-
-  interstaff_f_ = calc_interstaff_dist (stem_l_, beam_l) / internote_f;
-  idealy_f_ += interstaff_f_* beam_dir_;
-  miny_f_   += interstaff_f_ * beam_dir_;
-  maxy_f_   += interstaff_f_ * beam_dir_;
-}
-
-
index 8b137891791fe96927ad78e64b0aad7bded08bdc..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1 +0,0 @@
-
index d55cd55272200002c3036e6de523a77e3c91e5fd..fc6df56fa8802d5995489b34f9c8fd112c1cd94f 100644 (file)
@@ -52,28 +52,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 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 +104,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..74b92dd89d2f7c7fd16594571617e25b09e6bb36 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
 */
@@ -19,6 +20,7 @@
 #include "beam.hh"
 #include "rest.hh"
 #include "group-interface.hh"
+#include "cross-staff.hh"
 
 Stem::Stem ()
 {
@@ -398,3 +400,109 @@ Stem::beam_l ()const
   SCM b=  get_elt_property ("beam");
   return dynamic_cast<Beam*> (unsmob_element (b));
 }
+
+
+/*
+  stupid name: we're calculating and setting (caching??)
+  some stem length parameters for beamed stem
+*/
+void
+Stem::beamify ()
+{
+  assert (beam_l ());
+
+  SCM bd = remove_elt_property ("beam-dir");
+  Real internote_f = staff_line_leading_f ()/2;
+  
+  Direction beam_dir;
+  Real idealy_f;
+  Real interstaff_f;
+  Real maxy_f;
+  Real miny_f;
+
+  if (gh_number_p (bd))
+    {
+      beam_dir = (Direction)gh_scm2int (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"));
+         
+  idealy_f = chord_start_f ();
+
+  // for simplicity, we calculate as if dir == UP
+  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_)
+       {
+         idealy_f += beam_f;
+         idealy_f += (beam_l ()->multiplicity_i_ - 1) * interbeam_f;
+       }
+      miny_f = idealy_f;
+      maxy_f = INT_MAX;
+
+      idealy_f += stem_f;
+      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
+         miny_f = miny_f >? 0;
+         //lowest beam of (UP) beam must never be lower than second staffline
+         miny_f = miny_f >? (- 2 * internote_f - beam_f
+                               + (beam_l ()->multiplicity_i_ > 0) * beam_f + interbeam_f * (beam_l ()->multiplicity_i_ - 1));
+       }
+    }
+  else
+    /* knee */
+    {
+      idealy_f -= beam_f;
+      maxy_f = idealy_f;
+      miny_f = -INT_MAX;
+
+      idealy_f -= stem_f;
+      maxy_f -= min_stem_f;
+    }
+
+  idealy_f = maxy_f <? idealy_f;
+  idealy_f = miny_f >? idealy_f;
+
+  interstaff_f = calc_interstaff_dist (this, beam_l ());
+  idealy_f += interstaff_f * beam_dir;
+  miny_f += interstaff_f * beam_dir;
+  maxy_f += interstaff_f * beam_dir;
+
+  set_elt_property ("interstaff-f", gh_double2scm (interstaff_f));
+  set_elt_property ("idealy-f", gh_double2scm (idealy_f));
+  set_elt_property ("miny-f", gh_double2scm (miny_f));
+  set_real ("maxy-f", gh_double2scm (maxy_f));
+}
+
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;