]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.0.1
authorfred <fred>
Sun, 24 Mar 2002 20:12:57 +0000 (20:12 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:12:57 +0000 (20:12 +0000)
lily/abbrev.cc
lily/stem.cc
stepmake/bin/install-layout.sh [new file with mode: 0644]

index 977c1307c68ccf20ef1ce25451a1b6abbd5ad5c8..323bf8ddd8b4a09f8ec8942db190bf826d9040d0 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
@@ -13,7 +13,7 @@
 #include "paper-def.hh"
 #include "lookup.hh"
 #include "stem.hh"
-#include "dimen.hh"
+#include "dimension.hh"
 
 Abbreviation::Abbreviation ()
 {
@@ -30,63 +30,108 @@ Abbreviation::do_print () const
 Molecule*
 Abbreviation::brew_molecule_p () const
 {
-  Real dy = paper ()->interbeam_f (stem_l_->mult_i_);
-  Real w = 1.5 * paper ()->lookup_l ()->ball (2).dim_.x ().length ();
+  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 interline_f = paper ()->interline_f ();
+  Real beam_f = paper ()->beam_thickness_f ();
 
   int beams_i = 0;
-  Real slope_f = paper ()->internote_f () / 4;
+  Real slope_f = internote_f / 4 / internote_f;
 
   if (stem_l_ && stem_l_->beam_l_) {
-    // huh?
-    slope_f = 2 * stem_l_->beam_l_->slope_f_;
+    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_;
-  }
-  paper ()->lookup_l ()->beam (slope_f, 20 PT, 1 PT);
+  } 
+  Real sl = slope_f * internote_f;
 
-  Atom a (paper ()->lookup_l ()->beam (slope_f, w, .48 * interline_f));
+  Atom 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);
-      b.translate_axis (dy * i, Y_AXIS);
-      beams->add (b);
+      b.translate_axis (interbeam_f * i, Y_AXIS);
+      beams->add_atom (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_)
-    {
-      /* Try to be in the middle of the open part of the stem and
-        between on the staff.
-
-        (urgh)
-      */
-      Direction sd  = stem_l_->dir_;
-      Interval empty_stem (stem_l_->chord_start_f () * sd ,
-                          (stem_l_->stem_end_f ()* sd) - beams_i * dy);
-      empty_stem *= sd;
-      
-      Interval instaff = empty_stem;
-      instaff.intersect (interline_f * Interval (-2,2));
-      if (instaff.empty_b ())
-       instaff = empty_stem;
-
-      instaff.print (); 
-      beams->translate (Offset(stem_l_->hpos_f () - hpos_f (),
-                         instaff.center ()));
+    { 
+      if (stem_l_->beam_l_)
+        {
+         beams->translate (Offset(stem_l_->hpos_f () - hpos_f (),
+           stem_l_->stem_end_f () * internote_f - 
+           stem_l_->beam_l_->dir_ * beams_i * interbeam_f));
+       }
+      else
+#if 1
+       {  
+         /*
+           Beams should intersect one beamthickness below staff end
+          */
+         Real dy = - beams->extent ()[Y_AXIS].length () / 2 * stem_l_->dir_;
+         dy /= internote_f;
+         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_;
+         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
     }
   
   return beams;
 }
 
 void
-Abbreviation::do_substitute_dependent (Score_elem*o, Score_elem*n)
+Abbreviation::do_substitute_dependent (Score_element*o, Score_element*n)
 {
   if (stem_l_ == o)
-    stem_l_ = n ? (Stem*)n->item () : 0;
+    stem_l_ = n ? (Stem*)n->access_Item () : 0;
 }
 
 
index d87ae71b929930d7bd85cd700dc365736cf379a2..454f6d7f7a1e63b8f33f7f3712c1ec5c12023131 100644 (file)
@@ -3,13 +3,13 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 
   TODO: This is way too hairy
 */
 
 #include "stem.hh"
-#include "dimen.hh"
+#include "dimension.hh"
 #include "debug.hh"
 #include "paper-def.hh"
 #include "note-head.hh"
 #include "beam.hh"
 #include "rest.hh"
 
-const int STEMLEN = 7;
-
 IMPLEMENT_IS_TYPE_B1 (Stem,Item);
 
+
+Stem::~Stem ()
+{
+}
 Stem::Stem ()
 {
   /*
@@ -62,7 +64,7 @@ void
 Stem::do_print () const
 {
 #ifndef NPRINT
-  DOUT << "flag "<< flag_i_ ;
+  DOUT << "flag "<< flag_i_;
   if (beam_l_)
     DOUT << "beamed";
 #endif
@@ -97,7 +99,7 @@ Stem::set_stemend (Real se)
 {
   // todo: margins
   if (dir_ && dir_ * head_positions()[dir_] >= se*dir_)
-    warning (_("Weird stem size; check for narrow beams"));
+    warning (_ ("weird stem size; check for narrow beams"));
 
   
   yextent_drul_[dir_]  =  se;
@@ -111,7 +113,7 @@ Stem::type_i () const
 }
 
 void
-Stem::add (Rhythmic_head *n)
+Stem::add_head (Rhythmic_head *n)
 {
   n->add_dependency (this);    // ?
   if (n->is_type_b (Note_head::static_name ()))
@@ -132,7 +134,7 @@ Stem::invisible_b () const
 }
 
 int
-Stem::get_center_distance (Direction d)
+Stem::get_center_distance (Direction d) const
 {
   int staff_center = 0;
   int distance = d*(head_positions()[d] - staff_center);
@@ -140,7 +142,7 @@ Stem::get_center_distance (Direction d)
 }
 
 Direction
-Stem::get_default_dir ()
+Stem::get_default_dir () const
 {
   return (get_center_distance (UP) >
          get_center_distance (DOWN)) 
@@ -149,7 +151,7 @@ Stem::get_default_dir ()
 }
 
 Direction
-Stem::get_dir ()
+Stem::get_dir () const
 {
   return dir_;
 }
@@ -163,18 +165,27 @@ Stem::set_default_dir ()
 void
 Stem::set_default_stemlen ()
 {
-  Real len = STEMLEN;
-  Real dy = paper ()->interbeam_f (mult_i_);
+  /*
+   TODO
+   urg; this should be handled by Stem_info
+   */
+
+  Real length_f = paper ()->get_var ("stem_length");
+  Real shorten_f = paper ()->get_var ("forced_stem_shorten");
 
+  Real internote_f = paper ()->internote_f ();
+  length_f /= internote_f;
+  shorten_f /= internote_f;
+
+  Real len = length_f;
   if (!dir_)
     set_default_dir ();
-
-  /* If the stem points in the "wrong" direction, it should be
-     shortened, according to [Roush & Gourlay].  Their suggestion to knock off
-     a whole staffspace is a bit drastical though.
-     */
+  /* 
+    stems in unnatural (forced) direction should be shortened, 
+    accoding to [Roush & Gourlay]
+   */
   else if (dir_ != get_default_dir ())
-    len  -= 1.0;
+    len -= shorten_f / internote_f;
 
   if (flag_i_ >= 5)
     len += 2.0;
@@ -184,13 +195,12 @@ Stem::set_default_stemlen ()
   set_stemend ((dir_ > 0) ? head_positions()[BIGGER] + len :
               head_positions()[SMALLER] - len);
 
-
   if (dir_ * stem_end_f () < 0)
     {
       set_stemend (0);
     }
 }
-
+//xxx
 void
 Stem::set_default_extents ()
 {
@@ -259,8 +269,7 @@ Stem::do_width () const
     ;  // TODO!
   else
     {
-      Paper_def*p= paper ();
-      r = p->lookup_l ()->flag (flag_i_, dir_).dim_.x ();
+      r = lookup_l ()->flag (flag_i_, dir_).dim_.x ();
       r += note_delta_f ();
     }
   return r;
@@ -275,9 +284,8 @@ Molecule*
 Stem::brew_molecule_p () const
 {
   Molecule *mol_p =new Molecule;
-  Paper_def *p =paper ();
   Drul_array<Real> stem_y = yextent_drul_;
-  Real dy = p->internote_f ();
+  Real dy = paper ()->internote_f ();
   
 
   Real head_wid = 0;
@@ -287,16 +295,16 @@ Stem::brew_molecule_p () const
   
   if (!invisible_b ())
     {
-      Atom ss =p->lookup_l ()->stem (stem_y[DOWN]*dy,
+      Atom ss =lookup_l ()->stem (stem_y[DOWN]*dy,
                                     stem_y[UP]*dy);
-      mol_p->add (Atom (ss));
+      mol_p->add_atom (ss);
     }
 
-  if (!beam_l_ &&abs (flag_i_) > 2)
+  if (!beam_l_ && abs (flag_i_) > 2)
     {
-      Atom fl = p->lookup_l ()->flag (flag_i_, dir_);
+      Atom fl = lookup_l ()->flag (flag_i_, dir_);
       fl.translate_axis(stem_y[dir_]*dy, Y_AXIS);
-      mol_p->add(fl);
+      mol_p->add_atom (fl);
     }
 
   if (head_l_arr_.size())
@@ -316,7 +324,12 @@ Stem::note_delta_f () const
       Real rule_thick(paper ()->rule_thickness ());
       Interval stem_wid(-rule_thick/2, rule_thick/2);
       if (stem_xdir_ == CENTER)
+#define EGCS_ICE
+#ifndef EGCS_ICE
        r = head_wid.center ();
+#else
+       r = (head_wid.min () + head_wid.max ()) / 2;
+#endif
       else
        r = head_wid[stem_xdir_] - stem_wid[stem_xdir_];
     }
@@ -333,11 +346,10 @@ Stem::hpos_f () const
   TODO:  head_l_arr_/rest_l_arr_ in  do_substitute_dependent ()
  */
 void
- Stem::do_substitute_dependency (Score_elem*o,Score_elem*n)
+ Stem::do_substitute_dependency (Score_element*o,Score_element*n)
 {
-  Item * o_l = o->item ();
-  Item * n_l = n? n->item () : 0;
+  Item * o_l = o->access_Item ();
+  Item * n_l = n? n->access_Item () : 0;
   head_l_arr_.substitute ((Note_head*)o_l, (Note_head*)n_l);
   rest_l_arr_.substitute ((Rest*)o_l, (Rest*)n_l);
 }
-
diff --git a/stepmake/bin/install-layout.sh b/stepmake/bin/install-layout.sh
new file mode 100644 (file)
index 0000000..4e54a99
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+# install-layout.sh --- build an installation layout
+#
+prefix=$HOME/usr
+dirs='bin src/patches src/releases lib/texmf/tex lib/texmf/mf/source/public'
+
+for i in $dirs; do
+       if [ ! -e $prefix/$i ]; then
+               echo +mkdir -p $prefix/$i
+               mkdir -p $prefix/$i
+       fi
+done