]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.45
authorfred <fred>
Sun, 24 Mar 2002 20:05:44 +0000 (20:05 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:05:44 +0000 (20:05 +0000)
14 files changed:
input/sleur.ly
lily/bow.cc
lily/horizontal-vertical-group-item.cc [new file with mode: 0644]
lily/include/bow.hh
lily/include/collision.hh
lily/include/horizontal-vertical-group-item.hh [new file with mode: 0644]
lily/include/lookup.hh
lily/include/script-column.hh
lily/include/slur.hh
lily/lookup.cc
lily/slur.cc
lily/tex-slur.cc
mutopia/J.S.Bach/preludes-4.ly
tex/lily-ps-defs.tex

index 1226a9b7c05e1dbfeec74874c94d8a8ac6bd09b1..a0c895286c6b684a41139e3393f790d6a47de5f2 100644 (file)
@@ -30,12 +30,29 @@ beum = \melodic{
        [c8 c] c4 c4 c4 |
 }
 
+extend = {
+         c8(( c c )c c c c )c |
+         \[4/5c8( c c' c )c\]1/1 c c c c |
+         \[4/5c8( c c c c'\]1/1 c c c )c |
+         \[4/5c8( c c c c''\]1/1 c c c )c' |
+         \[4/5c8( c c c c'\]1/1 c c c )'c |
+         \[4/5c8( c c' c c\]1/1 c c c )c |
+         \[4/5c8( c c c ''c\]1/1 c c c )c |
+         \[4/5c8( c ''c c c\]1/1 c c c )c |
+}
+
 \score{
        \melodic{ 
                \shortlong
                \dirs
                \complex
                \beum
+               \stemup; 
+               \octave c''; 
+               \extend
+               \stemdown; 
+               \octave c'; 
+               \extend
        }
        \paper{ }
 }
index 1f75bba5dea4cb432b934f0bbd15b4ede98a053b..7f73df520ce37746e61b144cd8179bd5a5df2a1a 100644 (file)
@@ -11,7 +11,9 @@
 #include "molecule.hh"
 #include "lookup.hh"
 
-Bow::Bow()
+IMPLEMENT_IS_TYPE_B1(Bow,Directional_spanner);
+
+Bow::Bow ()
 {
   dy_f_drul_[LEFT] = dy_f_drul_[RIGHT] = 0;
   dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0;
@@ -19,39 +21,41 @@ Bow::Bow()
 
 
 Offset
-Bow::center() const
+Bow::center () const
 {
   Real dy =  dy_f_drul_[RIGHT]-dy_f_drul_[LEFT];
 
-  Real w = width().length ();
+  Real w = width ().length ();
 
   return Offset (w/2,dy );
 }
 
+Real
+Bow::height_f () const
+{
+  return 0;
+}
 
 Molecule*
-Bow::brew_molecule_p() const
+Bow::brew_molecule_p () const
 {
   Molecule*output = new Molecule;
-  Real w = width().length ();
+  Real w = width ().length ();
   
   Real dy_f = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT];
   
-  Real nw_f = paper()->note_width ();
-  Real nh_f = paper()->internote_f ();
+  Real nw_f = paper ()->note_width ();
   
   w+= (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]);
   Real round_w = w;            // slur lookup rounds the slurwidth .
   
-  Atom a = paper()->lookup_l ()->slur (dy_f, round_w, dir_);
+  Atom a = paper ()->lookup_l ()->slur (dy_f, round_w, height_f (), dir_);
 
   Real error = w-round_w;
-  a.translate (Offset ((dx_f_drul_[LEFT] + 0.5*nw_f)
+  a.translate (Offset ( (dx_f_drul_[LEFT] + 0.5*nw_f)
                       + error/2,
                       dy_f_drul_[LEFT]));
   output->add (a);
   return output;
 }
 
-
-IMPLEMENT_IS_TYPE_B1(Bow,Directional_spanner);
diff --git a/lily/horizontal-vertical-group-item.cc b/lily/horizontal-vertical-group-item.cc
new file mode 100644 (file)
index 0000000..2b70f21
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+  horizontal-vertical-group-item.cc -- implement Horizontal_vertical_group_item
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#include "horizontal-vertical-group-item.hh"
+#include "p-col.hh"
+
+void
+Horizontal_vertical_group_item::do_print() const
+{
+  Horizontal_vertical_group_element::do_print();
+}
+
+IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_item,Horizontal_vertical_group_element,Item);
index 558315674336a428f5dec869f11eb6c031c2bcd4..c2908836d5c54a6a9a1ca854e7c84cfc76036156 100644 (file)
@@ -20,7 +20,8 @@ protected:
   Drul_array<Real> dy_f_drul_;
   Drul_array<Real> dx_f_drul_;
 
-  Molecule*brew_molecule_p() const;
+  virtual Real height_f () const;
+  virtual Molecule* brew_molecule_p () const;
 public:
   Bow();
   DECLARE_MY_RUNTIME_TYPEINFO;
index 6ab5db3fad20db9ca5b41ff6b083921b772fa774..08b07065726b25f2647ee68ebd975864bbaa92f2 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef COLLISION_HH
 #define COLLISION_HH
 #include "lily-proto.hh"
-#include "elem-group-item.hh"
+#include "horizontal-vertical-group-item.hh"
 
 /**
   Resolve conflicts between various Note_columns (chords).
diff --git a/lily/include/horizontal-vertical-group-item.hh b/lily/include/horizontal-vertical-group-item.hh
new file mode 100644 (file)
index 0000000..733ff63
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+  horizontal-vertical-group-item.hh -- declare Horizontal_vertical_group_item
+  
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef HORIZONTAL_VERTICAL_GROUP_ITEM_HH
+#define HORIZONTAL_VERTICAL_GROUP_ITEM_HH
+
+#include "axis-group-item.hh"
+#include "elem-group.hh"
+
+
+/**
+  Treat a collection of items as a unity
+ */
+class Horizontal_vertical_group_item  : public Axis_group_item, public Horizontal_vertical_group_element {
+protected:
+  virtual void do_print() const;
+  virtual void remove_all() { Horizontal_vertical_group_element::remove_all (); }
+  virtual void do_unlink () { Horizontal_vertical_group_element::do_unlink (); }
+  SCORE_HORIZONTAL_VERTICAL_CLONE(Horizontal_vertical_group_item);
+public:
+  virtual void add_element (Graphical_element*e) { Horizontal_vertical_group_element::add_element (e); }
+  virtual void remove_element (Graphical_element*e) { Horizontal_vertical_group_element::remove_element (e); }
+
+  DECLARE_MY_RUNTIME_TYPEINFO;
+};
+
+#endif // HORIZONTAL_VERTICAL_GROUP_ITEM_HH
index e5cf3f10e94f2f12b485a723b04d23db3b97bc86..c290cbd64f2e9b32d8b4d2b938bd293273dc50fc 100644 (file)
@@ -50,10 +50,10 @@ struct Lookup {
   Atom bar (String, Real height) const;
     
   Atom dots () const;
-  Atom slur (Real &dy, Real &dx, Direction dir) const;
+  Atom slur (Real &dy, Real &dx, Real ht, Direction dir) const;
   Atom plet (Real &dy, Real &dx, Direction dir) const;
   Atom tex_slur (int dy, Real &dx, Direction dir) const;
-  Atom ps_slur (Real dy, Real dx, Real dir) const;
+  Atom ps_slur (Real dy, Real dx, Real ht, Real dir) const;
   Atom half_slur (int dy, Real &dx, Direction dir, int xpart) const;
   Atom half_slur_middlepart (Real &dx, Direction dir) const;
   Atom big_slur (int dy, Real &dx, Direction dir) const;
index e5b83984b78e7ca10c6916c4e74c7639307288a9..335ed551fec491d71b6833decb69ca760534ae6a 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef SCRIPT_COLUMN_HH
 #define SCRIPT_COLUMN_HH
 
-#include "elem-group-item.hh"
+#include "horizontal-vertical-group-item.hh"
 
 /** a struct for treating a group of noteheads (noteheads, stem
   (chord) and scripts) as a single entity.  */
index 07b9093f9c439e2bb939a4fde1d966a98b429e67..8d2212b294a1884f6dde7d69018217c45f4d3fea 100644 (file)
@@ -25,6 +25,7 @@ protected:
   virtual void do_add_processing ();
   virtual void do_pre_processing ();
   virtual void do_substitute_dependency (Score_elem*, Score_elem*);
+  virtual Real height_f () const;
 
   SCORE_ELEM_CLONE(Slur);
   DECLARE_MY_RUNTIME_TYPEINFO;
index a4dc393ec06729e51e19ef24024f711a060460b6..da4083afe6466b48b184662db60bfe071df2283b 100644 (file)
@@ -164,7 +164,7 @@ Lookup::hairpin (Real &wid, bool decresc, bool continued) const
   Atom ret;  
   if (embedded_b)
     {
-      Real height = 2 PT;
+      Real height = paper_l_->get_var ("barsize") / 6;
       embed = "\\embeddedps{\n" ;
       embed += String (wid) + " " 
        + String (height) + " " 
index cc2471bec7f5f20f74b259658e77071ef19285aa..88b2c6cc3378661071b2dd6b018bdaac21e8e447 100644 (file)
@@ -23,8 +23,6 @@
 #include "debug.hh"
 #include "boxes.hh"
 
-
-
 void
 Slur::add (Note_column*n)
 {
@@ -33,25 +31,25 @@ Slur::add (Note_column*n)
 }
 
 void
-Slur::set_default_dir()
+Slur::set_default_dir ()
 {
   dir_ = DOWN;
-  for (int i=0; i < encompass_arr_.size(); i ++) 
+  for (int i=0; i < encompass_arr_.size (); i ++) 
     {
       if (encompass_arr_[i]->dir_ < 0) 
        {
-         dir_ =UP;
+         dir_ = UP;
          break;
        }
     }
 }
 
 void
-Slur::do_add_processing()
+Slur::do_add_processing ()
 {
-  set_bounds(LEFT, encompass_arr_[0]);    
+  set_bounds (LEFT, encompass_arr_[0]);    
   if (encompass_arr_.size () > 1)
-    set_bounds(RIGHT, encompass_arr_.top());
+    set_bounds (RIGHT, encompass_arr_.top ());
 }
 
 void
@@ -64,28 +62,27 @@ void
 Slur::do_substitute_dependency (Score_elem*o, Score_elem*n)
 {
   int i;
-  while ((i = encompass_arr_.find_i ((Note_column*)o->item())) >=0) 
+  while ((i = encompass_arr_.find_i ((Note_column*)o->item ())) >=0) 
     {
       if (n)
-       encompass_arr_[i] = (Note_column*)n->item();
+       encompass_arr_[i] = (Note_column*)n->item ();
       else
        encompass_arr_.del (i);
     }
 }
 
-
 static int 
 Note_column_compare (Note_column *const&n1 , Note_column* const&n2)
 {
-  return Item::left_right_compare(n1, n2);
+  return Item::left_right_compare (n1, n2);
 }
 
 void
-Slur::do_post_processing()
+Slur::do_post_processing ()
 {
   encompass_arr_.sort (Note_column_compare);
   if (!dir_)
-    set_default_dir();
+    set_default_dir ();
   Real interline_f = paper ()->interline_f ();
   Real inter_f = interline_f / 2;
 
@@ -106,10 +103,10 @@ Slur::do_post_processing()
   
   Drul_array<Note_column*> extrema;
   extrema[LEFT] = encompass_arr_[0];
-  extrema[RIGHT] = encompass_arr_.top();
+  extrema[RIGHT] = encompass_arr_.top ();
 
   Direction d=LEFT;
-  Real nw_f = paper()->note_width ();
+  Real nw_f = paper ()->note_width ();
  
   do 
     {
@@ -120,17 +117,60 @@ Slur::do_post_processing()
        }
       else if (extrema[d]->stem_l_ && !extrema[d]->stem_l_->transparent_b_) 
         {
-         dy_f_drul_[d] = (int)rint (extrema[d]->stem_l_->height()[dir_]);
+         dy_f_drul_[d] = (int)rint (extrema[d]->stem_l_->height ()[dir_]);
          /* normal slur from notehead centre to notehead centre, minus gap */
          dx_f_drul_[d] += -d * gap_f;
        }
       else 
         {
-         dy_f_drul_[d] = (int)rint (extrema[d]->head_positions_interval()[dir_])* inter_f;
+         dy_f_drul_[d] = (int)rint (extrema[d]->head_positions_interval ()[dir_])* inter_f;
        }
       dy_f_drul_[d] += dir_ * interline_f;
     }
   while ((d *= -1) != LEFT);
 }
 
+Real
+Slur::height_f () const
+{
+  /*
+   rather braindead way that of adjusting slur height 
+   for heads/stems that extend beyond default slur
+   works quite good
+   */
+
+  Real interline_f = paper ()->interline_f ();
+  Real nh_f = interline_f / 2;
+  Real h = 0;
+  Real dx = width ().length ();
+  Real dy = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT];
+  Stem* stem = encompass_arr_[0]->stem_l_;
+  Real lx = stem->hpos_f ();
+  Real centre = (width ().min () + width ().max ()) / 2;
+  Real ly = stem->dir_ == dir_ ? stem->stem_end_f () : stem->stem_begin_f () 
+    + dir_ * nh_f / 2;
+  for (int i = 0; i < encompass_arr_.size (); i++) 
+    {
+      Stem* stem = encompass_arr_[i]->stem_l_;
+      Real sx = abs (centre - stem->hpos_f ());
+      Real sy = stem->dir_ == dir_ ? stem->stem_end_f () 
+        : stem->stem_begin_f () + dir_ * nh_f / 2;
+      sy = dir_ * (sy - (ly + ((stem->hpos_f () - lx) / dx) * dy));
+      /*
+        uhm, correct for guess bezier curve (more if further from centre)
+        forget the cos alpha...
+       */
+      if (sy > 0)
+       h = h >? sy * (1 + 2 * sx / dx);
+    }
+  Real ratio = 1.0/3; // duh
+  /* 
+    correct h for slur ratio
+   */
+  Real staffheight = paper ()->get_var ("barsize");
+  if (h)
+    h *= ((h * interline_f) / dx ) / ratio;
+  return h;
+}
+
 IMPLEMENT_IS_TYPE_B1(Slur,Spanner);
index b0c67cf95b695076f114a93d64a7cff0c8871e21..51af06c23001bd9c5e5e7296b776f5e11ee35827 100644 (file)
@@ -133,12 +133,13 @@ Lookup::half_slur (int dy, Real &dx, Direction dir, int xpart) const
 }
 
 Atom
-Lookup::ps_slur (Real dy , Real dx, Real dir) const
+Lookup::ps_slur (Real dy , Real dx, Real ht, Real dir) const
 {
   String ps = "\\embeddedps{\n";
   
   ps += String_convert::double_str (dx) + " " 
     + String_convert::double_str (dy) + " "
+    + String_convert::double_str (ht) + " "
     + String_convert::double_str (dir) +
     " draw_slur}";
 
@@ -279,7 +280,7 @@ Lookup::big_slur (int dy , Real &dx, Direction dir) const
 
 
 Atom
-Lookup::slur  (Real &dy_f , Real &dx, Direction dir) const
+Lookup::slur  (Real &dy_f , Real &dx, Real ht, Direction dir) const
 {
   if  (dx < 0)
     {
@@ -289,7 +290,7 @@ Lookup::slur  (Real &dy_f , Real &dx, Direction dir) const
   Atom s;
   
   if (postscript_global_b)
-    s = ps_slur (dy_f, dx, dir);
+    s = ps_slur (dy_f, dx, ht, dir);
   else
     {
       Real nh =  paper_l_->internote_f ();
index 2d28e33f2a0f5c8956218f859ba0944651db9385..6086842e714a45aec4cdedeb2eb3a82b53824e9e 100644 (file)
@@ -6,46 +6,95 @@ enteredby =    "jcn";
 copyright =     "public domain";
 }
 
-rh = \melodic{
+\include "paper20.ly"
+
+one = \melodic{
        \octave c'';
        \textstyle "italic";
-       % ugh, start in multi, because of slurring an tieing over bars
-       \multi 2 < 
-               { 
-                       r16\p_"legato" 
-                       ['d-1( 'fis-3 'd-1] ['a-2 'b-3 cis-4 'a-3]
-                       [d-3 cis-2 d-1 e-2] [d-1 fis-3 e-2 d-1] |
-                       \textstyle "finger";
-                       \stemup; 
-                       )cis4-2 fis-5 ~ [fis8 fis-4] e4-3 ~ | 
-                       e( )d8-2 s s4 s4 |
-                       r8 d4-> cis8-1 ~ cis 'b4-1 'b8 |
-               }
-               { 
-%                      s1
-                       \stemdown; 
-                       r8 'a4 'a8 'b4.-"2\\_1" cis8 ~ | 
-                       cis16\< ['a( cis 'a] [d-2 e fis d-1]
-                       [g-3 fis g a-4] [a-3 b a \!g] |
-                       )fis4-"2\\_3" [e8-2 a-5] <fis4-4 d-2> <gis-5 e-3> |
-               } 
-       >
-       \stemboth;
+       r16\p_"legato" 
+       \textstyle "finger";
+       ['d-1( 'fis-3 'd-1] ['a-2 'b-3 cis-4 'a-3]
+       [d-3 cis-2 d-1 e-2] [d-1 fis-3 e-2 d-1] |
+       \textstyle "finger";
+       \stemup; 
+       )cis4-2 fis-5 ~ [fis8 fis-4] e4-3 ~ | 
+       e16\< \stemboth ['a16( cis 'a] [d-2 e fis d-1]
+       [g-3 fis g a-4] [a-3 b a \!g] |
+       \stemup
+       )fis4-"2\\_3" [e8-2 a-5] <fis4-4 d-2> <gis-5 e-3> |
+       <a4-5( e> <fis-4 d-2> <[)g!16-5 d> fis-2 g-3 a-4] 
+       \stemboth
+       [g-3 b a g] |
+       \textstyle "italic";
+       [fis_"dim." e fis-3 g] [fis-3 a-5 g fis]
+       \textstyle "finger";
+       e4-"2\\_5" ~ e16 ['e( 'fis 'g ] |
+       \textstyle "italic";
+       ['a-4_"dim." 'g-1 'a 'b] ['a-2 c-4 'b 'a]
+       ['g-1 'fis-2 'g-3 'a] ['g-3 'b 'a 'g] |
+       \stemup
+       )'fis4\p r16 [''b-1\< d-2 ''b~] <'g4-5 'e-3 ''b>
+       r16 ['cis-1 'e-2 \!cis] |  % cis wants ~
+
+}
+
+two = \melodic{
+       \textstyle "finger";
+% ugh: koor
+%      \translator Staff=bass \octave c; \stemup
+       fis4-1( e8-2 a4 a4 gis8-2 | 
+       ) a8
+       \translator Staff=treble \octave c''; \stemdown
+       'a4 'a8 'b4.-"2\\_1" cis8 ~ | 
+       cis8
+       \translator Staff=bass \octave c; \stemup
+       a8 ~ [a d'] ~ d' d'4-> c'8 | 
+       d'8
+       \translator Staff=treble \octave c''; \stemdown
+       d4-> cis8-1 ~ cis 'b4-1 'b8 |
+       r8 'a4 'a8
+       \translator Staff=bass \octave c; \stemup
+       [g'8-1( fis'-2] )e'4-1 ~ | 
+       e'4 d' ~ [d'16 d-1 cis'-2 g-1] cis'4-2 ~ |
+       [c'8 a-3] d'4.-1 d'4-> cis'8-2 |
+       \translator Staff=treble \octave c''; \stemdown
+       'd4 \skip 4*3; |
+}
+
+three = \melodic{
+       \octave c;
+       \stemdown;
+       d4-3 c-4 'b e-3 |
+       a16 ['a-5\mf( c-3 'a-5] [d-2 e-1 fis-2 d-4]
+       [g-1 fis-3 g a] [g b a g] |
+       )fis4 fis e a-4 |
+       d'16 \stemboth [d-5\f( fis-3 d-5] [a-2 b-1 c'-2 a-4]
+       [d'-1 c'-3 d' e'] [d'-4 fis'-2 e'-1 ) d'] |
+       [cis'-3 b-4 cis'-3 d'-2] [c'-4 e'-2 d'-3 c'-4] 
+       \stemdown b4-5 [cis'8-4 b-3(] |
+       [a-4 )fis-5 b-2 a-3] [gis-4 e-5 a-3 g-4] |
+       fis4. d8-5 e4-5 a4-3 |
+       \stemboth
+       r16 [d-4( fis-2 d-4] [)g8-.-1 'g-.-5]
+       r16 [e-4( g-2 e-4] [)a8-. 'a-.-5] |
+}
+
+rh = \melodic{
+       \one
        \bar "|.";
 }
 
+
 lh = \melodic{
-       \octave c;
-       \clef bass;
-       s1 | s1 | s1 | s1
-%      \multi 2 <
-%              { \stemup; }
-%              { \stemdown; }
-%      >
-%      \stemboth; |
+       \clef "bass";
+       \multi 2 < 
+               \two
+               \three
+       >
        \bar "|.";
 }
 
+
 global  = \melodic{
        \meter 4/4;
        \key fis cis;
@@ -55,16 +104,24 @@ global  = \melodic{
        % Allegretto
        % it would be nice to shut-off fingering...
        \melodic \type Grandstaff < 
-               <
+               \type Staff=treble  < 
                        \global 
-                       \rh
+% huh? try these iso directly!
+                       \lh
+%                      \one
+%                      \two
                >
-               <
+               \type Staff=bass  < 
                        \global 
-                       \lh
+                       \rh
+% or try \two having here, iso above!
+%                      \two
+%                      \three
                >
        >
        \paper{
+               \paper_twenty
+               linewidth= 195.\mm;
        }
        \midi{
                \tempo 4 = 110;
index f93da7cfd26a34051d2853e4484248434230b2c1..cab0aaa82c6a3e0a4afd5bf501e9899faf435a8d 100644 (file)
@@ -82,6 +82,7 @@ def
         bind def
         /draw_cresc
         {
+                staffrulethickness setlinewidth
                 /cresc_cont exch def
                 /cresc_ht exch def
                 /cresc_wd exch def
@@ -118,14 +119,14 @@ def
                stroke
         }
         bind def
- staffheight 2 div
- /slurhtlimit exch def
+ staffheight 2 div /slurhtlimit exch def
  /slurratio 0.3333 def
  %
  %  (b*ratio)/(1 + b / htlimit)
  /getslurcontrol 
  { 
-        slurhtlimit 90 div /slur_alpha exch def
+       slurhtlimit add /slurheight exch def
+        slurheight 90 div /slur_alpha exch def
         slurratio 60 div slur_alpha div  /slur_beta  exch def
         slur_beta mul 1 atan slur_alpha mul
  } bind def
@@ -135,12 +136,13 @@ def
         staffrulethickness setlinewidth
         0 0 moveto
         /slur_dir exch def
+        /slur_height exch def
         /slur_dy exch def
         /slur_dx exch def
         slur_dy slur_dx lily_distance /slur_b  exch def
-        slur_b getslurcontrol 
+        slur_b slur_height getslurcontrol 
         slur_dir mul /slur_ht exch def
-        slur_b getslurcontrol /slur_indent exch def       
+        slur_b slur_height getslurcontrol /slur_indent exch def       
 %
         slur_dy slur_dx atan rotate
         slur_indent slur_ht