]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/abbrev.cc
release: 1.1.47
[lilypond.git] / lily / abbrev.cc
index 841f063ca6f739f095043dde8a6bfe2790914d3c..dd17851d1ee596e46ee3d7ef775ca901e4474a9c 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
@@ -13,6 +13,7 @@
 #include "paper-def.hh"
 #include "lookup.hh"
 #include "stem.hh"
+#include "offset.hh"
 
 Abbreviation::Abbreviation ()
 {
@@ -27,40 +28,44 @@ Abbreviation::do_print () const
 }
 
 Molecule*
-Abbreviation::brew_molecule_p () const
+Abbreviation::do_brew_molecule_p () const
 {
-  Real interbeam_f = paper ()->interbeam_f (stem_l_->mult_i_);
-  Real w = 1.5 * lookup_l ()->ball (2).dim_.x ().length ();
-  Real internote_f = paper ()->internote_f ();
-  Real beam_f = paper ()->beam_thickness_f ();
+  Beam * b = stem_l_->beam_l_;
+  int mult =0;
+  if (b)
+    {
+      Stem_info i = b->get_stem_info (stem_l_);
+      mult = i.mult_i_;
+    }
+  
+  Real interbeam_f = paper_l ()->interbeam_f (mult);
+  Real w = 1.5 * lookup_l ()->notehead (2, "").dim_[X_AXIS].length ();
+  Real space = stem_l_->staff_line_leading_f ();
+  Real internote_f = space/2;
+  
+  Real beam_f = paper_l ()->beam_thickness_f ();
 
   int beams_i = 0;
-  Real slope_f = internote_f / 4 / internote_f;
+  Real slope_f = internote_f / 4 / internote_f;        // HUH?
 
   if (stem_l_ && stem_l_->beam_l_) {
     slope_f = stem_l_->beam_l_->slope_f_;
     // ugh, rather calc from Abbreviation_req
-    beams_i = stem_l_->beams_right_i_ >? stem_l_->beams_left_i_;
+    beams_i = stem_l_->beams_i_drul_[RIGHT] >? stem_l_->beams_i_drul_[LEFT];
   } 
   Real sl = slope_f * internote_f;
 
-  Atom a (lookup_l ()->beam (sl, w, beam_f));
+  Molecule a (lookup_l ()->beam (sl, w, beam_f));
   a.translate (Offset (-w/2, w / 2 * slope_f));
 
   Molecule *beams= new Molecule; 
   for (int i = 0; i < abbrev_flags_i_; i++)
     {
-      Atom b (a);
+      Molecule b (a);
       b.translate_axis (interbeam_f * i, Y_AXIS);
-      beams->add_atom (b);
+      beams->add_molecule (b);
     }
-#define EGCS_ICE
-#ifndef EGCS_ICE
   beams->translate_axis (-beams->extent ()[Y_AXIS].center (), Y_AXIS);
-#else
-  beams->translate_axis (-(beams->extent ()[Y_AXIS].min () + 
-    beams->extent ()[Y_AXIS].max ()) / 2 , Y_AXIS);
-#endif
 
   if (stem_l_)
     { 
@@ -71,7 +76,6 @@ Abbreviation::brew_molecule_p () const
            stem_l_->beam_l_->dir_ * beams_i * interbeam_f));
        }
       else
-#if 1
        {  
          /*
            Beams should intersect one beamthickness below staff end
@@ -81,52 +85,21 @@ Abbreviation::brew_molecule_p () const
          dy += stem_l_->stem_end_f ();
          dy *= internote_f;
 // urg: can't: stem should be stetched first
-//       dy -= paper ()->beam_thickness_f () * stem_l_->dir_;
+//       dy -= paper_l ()->beam_thickness_f () * stem_l_->dir_;
          beams->translate (Offset(stem_l_->hpos_f () - hpos_f (), dy));
        }
-#else
-       {
-         /* 
-            urg: this is wrong, even if coded correctly
-
-            Try to be in the middle of the open part of the stem and
-            between on the staff.
 
-            (urgh)
-         */
-         Direction sd  = stem_l_->dir_;
-         // watch out: chord_start_f is (the only one) not in dim(internote)
-         Interval empty_stem (stem_l_->chord_start_f () / internote_f * sd
-           + interline_f, (stem_l_->stem_end_f ()* sd));
-         empty_stem *= sd;
-         
-         Interval instaff = empty_stem;
-         /*
-           huh? i don't understand, hw
-           what about:
-           .fly= \stemup d'''2:16
-           instaff.intersect (Interval (-4,4));
-           */
-         // hmm, let's try
-         if (stem_l_->get_default_dir () == stem_l_->dir_)
-           instaff.intersect (Interval (-4,4));
-
-         if (instaff.empty_b ())
-           instaff = empty_stem;
-
-         instaff.print (); 
-         instaff *= internote_f;
-         beams->translate (Offset(stem_l_->hpos_f () - hpos_f (),
-                             instaff.center ()));
-       }
-#endif
+      /*
+       there used to be half a page of code that was long commented out.
+       Removed in 1.1.35
+       */
     }
   
   return beams;
 }
 
 void
-Abbreviation::do_substitute_dependent (Score_element*o, Score_element*n)
+Abbreviation::do_substitute_element_pointer (Score_element*o, Score_element*n)
 {
   if (stem_l_ == o)
     stem_l_ = dynamic_cast<Stem*> (n);