]> git.donarmstrong.com Git - lilypond.git/commitdiff
''
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 2 Apr 2002 12:27:37 +0000 (12:27 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 2 Apr 2002 12:27:37 +0000 (12:27 +0000)
12 files changed:
ChangeLog
Documentation/regression-test.tely
input/regression/dot-flag-collision.ly
lily/beam.cc
lily/chord-tremolo-engraver.cc
lily/dot-column.cc
lily/dots.cc
lily/include/stem.hh
lily/note-spacing.cc
lily/stem-engraver.cc
lily/stem.cc
scm/grob-description.scm

index 9b1a0f09ac96b1ba04ac98bea0d5d59bf062a57f..68b331b8fd425b339a797ee931bfaaf00922b4f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-04-02  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * lily/stem.cc (duration_log): change from flag_i (); better
+       naming.
+       (get_default_stem_end_position): fix dot/flag collision code.
+
 2002-04-02  Han-Wen  <hanwen@cs.uu.nl>
 
        * VERSION: release 1.5.50
index fb74d544cd7f4df50ccf882d9fab572320f18a2d..c730a883669c01ef0574d917ab1079f902f6f6bc 100644 (file)
@@ -23,17 +23,17 @@ documenting bugfixes.
 
 @section Notes and rests
 
-@lilypondfile[printfilename]{rest.ly}
-
-@lilypondfile[printfilename]{rest-ledger.ly}
-
 @lilypondfile[printfilename]{note-head-style.ly}
 
 @lilypondfile[printfilename]{mensural.ly}
 
 @lilypondfile[printfilename]{easy-notation.ly}
 
-@lilypondfile[printfilename]{dots.ly}
+@section Rests
+
+@lilypondfile[printfilename]{rest-ledger.ly}
+
+@lilypondfile[printfilename]{rest.ly}
 
 @lilypondfile[printfilename]{multi-measure-rest.ly}
 
@@ -41,6 +41,14 @@ documenting bugfixes.
 
 @lilypondfile[printfilename]{rest-pitch.ly}
 
+
+@section Dots
+
+@lilypondfile[printfilename]{dots.ly}
+
+@lilypondfile[printfilename]{dot-flag-collision.ly}
+
+
 @section Accidentals
 
 Accidentals are currently in a development stage.
index 267ffde42ac79d9945302bb5334f30ad363bebe5..049d030bf9ed7a784efd440e51e5554a1534c484 100644 (file)
@@ -1,8 +1,16 @@
+\header {
+    texidoc = "Dots move to the right when a collision with the (up)flag happens"
+}
 
-\header { texidoc = "Dots are moved right if flags and dots
-collide. This doesn't happens when the dot fits beneath the flag " }
-
-\score{
-  \notes\relative c'{ f8. g f16. g f32. g}
+\score {
+    \notes\relative c''
+    {
+       \time 8/4
+       \property Staff.autoBeaming = ##f
+       a,16.
+       g''16.
+       a,4. a8 a8. a16. c,16. g16.
+    }
+    \paper { linewidth = -1. }
 }
 
index 82491cd972bc365fa337d06ded36056d7287d31c..0e8bf56f3458302935d8cdfc10562738f5851688 100644 (file)
@@ -905,7 +905,7 @@ Real
 Beam::calc_stem_y (Grob *me, Grob* s, Interval pos)
 {
   int beam_multiplicity = get_multiplicity (me);
-  int stem_multiplicity = (Stem::flag_i (s) - 2) >? 0;
+  int stem_multiplicity = (Stem::duration_log (s) - 2) >? 0;
 
   Real thick = gh_scm2double (me->get_grob_property ("thickness"));
   Real interbeam = get_interbeam (me);
index 99711b84af7f08a713c69cfa0c57595fc33a6a60..8f0b97500c602abb9a92dbd392cd283bbf838386 100644 (file)
@@ -158,7 +158,7 @@ Chord_tremolo_engraver::acknowledge_grob (Grob_info info)
       if (Stem::has_interface (info.grob_l_))
        {
          Grob * s = info.grob_l_;
-         int f = Stem::flag_i (s);
+         int f = Stem::duration_log (s);
          f = (f > 2) ? f - 2 : 1;
          Stem::set_beaming (s, f, LEFT);
          Stem::set_beaming (s, f, RIGHT);
@@ -177,7 +177,7 @@ Chord_tremolo_engraver::acknowledge_grob (Grob_info info)
          SCM d = s->get_grob_property ("direction");
          if (Stem::type_i (s) != 1)
            {
-             int gap_i =Stem::flag_i (s) - ((Stem::type_i (s) >? 2) - 2);
+             int gap_i =Stem::duration_log (s) - ((Stem::type_i (s) >? 2) - 2);
              beam_p_->set_grob_property ("gap", gh_int2scm (gap_i));
            }
          s->set_grob_property ("direction", d);
index 584b3616e64e4286abf7fa56aafff7a7ebb6f1ae..b37a995b1de29c92db248e99302e2948b0f3e28e 100644 (file)
@@ -44,7 +44,7 @@ Dot_column::side_position (SCM element_smob, SCM axis)
   Grob * stem = unsmob_grob (me->get_grob_property ("stem"));
   if (stem
       && !Stem::beam_l (stem)
-      && Stem::flag_i (stem))
+      && Stem::duration_log (stem) > 2)
     {
       /*
        trigger stem end & direction calculation.
index 0e1b6912a7db57e2f3217455df6da61f580d17a1..1af6f64c4e567af574eb726ef387d29ef55b5b2d 100644 (file)
@@ -56,6 +56,10 @@ Dots::brew_molecule (SCM d)
       /*
        we need to add a real blank box, to assure that
        side-positioning doth not cancel the left-most padding.  */
+
+      /*
+       TODO: this should  be handled by side-position padding.
+       */
       mol = Lookup::blank (Box (Interval (0,0),
                                Interval (0,0)));
   
index fcda40ed7b8458ddba3df253e6e90a6d223b23b7..70051bed6b26dc84720096f84088e0dc0d0754c6 100644 (file)
@@ -18,7 +18,7 @@ public:
   DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
 
   static Array<int> note_head_positions (Grob*);
-  static  int flag_i (Grob*) ;
+  static  int duration_log (Grob*) ;
   static int beam_count (Grob*,Direction) ;
   static void set_beaming (Grob*,int,  Direction d);
   static Grob * beam_l (Grob*);
index 9126fc728ad667756e3a40fedb55d1b2a3af2d06..314d2dd5bdce96d40097e07bc73f5e68849fd7e8 100644 (file)
@@ -277,7 +277,7 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn,
            hanging from the note.
           */
          if (d == LEFT
-             && Stem::flag_i (stem) && !Stem::beam_l (stem))
+             && Stem::duration_log (stem) > 2  && !Stem::beam_l (stem))
            {
              correct = false;
              goto exit_func;
index da011fd60ee670f454f47923611de740b22afb12..37f8ac7a8b7992b667224e8ac89c3bfe28692a1d 100644 (file)
@@ -109,9 +109,9 @@ Stem_engraver::acknowledge_grob (Grob_info i)
          announce_grob(stem_p_, i.music_cause ()->self_scm());
        }
 
-      if (Stem::flag_i (stem_p_) != duration_log)
+      if (Stem::duration_log (stem_p_) != duration_log)
        {
-         i.music_cause ()->origin ()->warning (_f ("Adding note head to incompatible stem (type = %d)", 1 <<  Stem::flag_i (stem_p_)));
+         i.music_cause ()->origin ()->warning (_f ("Adding note head to incompatible stem (type = %d)", 1 <<  Stem::duration_log (stem_p_)));
        }
 
       Stem::add_head (stem_p_,h);
index 752a0baef2136588dd7166c7151cdf6233828cc1..726f71a2ab8e8382e553cd870d7843c4eb5ecd8c 100644 (file)
@@ -28,6 +28,7 @@
 #include "staff-symbol-referencer.hh"
 #include "spanner.hh"
 #include "side-position-interface.hh"
+#include "dot-column.hh"
 
 void
 Stem::set_beaming (Grob*me ,int i,  Direction d)
@@ -277,7 +278,7 @@ Stem::get_default_stem_end_position (Grob*me)
        a.push (gh_scm2double (ly_car (q)));
                
       // stem uses half-spaces
-      length_f = a[ ((flag_i (me) - 2) >? 0) <? (a.size () - 1)] * 2;
+      length_f = a[ ((duration_log (me) - 2) >? 0) <? (a.size () - 1)] * 2;
     }
 
 
@@ -290,7 +291,7 @@ Stem::get_default_stem_end_position (Grob*me)
   // stem uses half-spaces
 
   // fixme: use scm_list_n_ref () iso. array[]
-  Real shorten_f = a[ ((flag_i (me) - 2) >? 0) <? (a.size () - 1)] * 2;
+  Real shorten_f = a[ ((duration_log (me) - 2) >? 0) <? (a.size () - 1)] * 2;
 
   /* On boundary: shorten only half */
   if (abs (chord_start_f (me)) == 0.5)
@@ -315,18 +316,18 @@ Stem::get_default_stem_end_position (Grob*me)
   Interval hp = head_positions (me);  
   Real st = hp[dir] + dir * length_f;
 
-
-  
+  bool no_extend_b = to_boolean (me->get_grob_property ("no-stem-extend"));
+  if (!grace_b && !no_extend_b && dir * st < 0) // junkme?
+    st = 0.0;
 
   /*
-    Make a little room if we have a flag and there is a dot.
-
-    TODO:
-
-    maybe  we should consider moving the dot to the right?
+    Make a little room if we have a upflag and there is a dot.
+    previous approach was to lengthen the stem. This is not
+    good typesetting practice. 
+    
   */
-  if (!beam_l (me)
-      && flag_i (me))
+  if (!beam_l (me) && dir == UP
+      && duration_log (me) > 2)
     {
       Grob * closest_to_flag = extremal_heads (me)[dir];
       Grob * dots = closest_to_flag
@@ -335,36 +336,43 @@ Stem::get_default_stem_end_position (Grob*me)
       if (dots)
        {
          Real dp = Staff_symbol_referencer::position_f  (dots);
-         Real flagy =  flag (me).extent (Y_AXIS)[-dir] * 2; // should divide by staffspace
+         Real flagy =  flag (me).extent (Y_AXIS)[-dir] * 2
+           / Staff_symbol_referencer::staff_space (me); 
 
          /*
            Very gory: add myself to the X-support of the parent,
            which should be a dot-column.
           */
          if (dir * (st + flagy -  dp) < 0.5)
-           Side_position_interface::add_support (dots->get_parent (X_AXIS), me);
-
-         /*
-           previous approach was to lengthen the stem. This is not
-           good typesetting practice.  */
+           {
+             Grob *par = dots->get_parent (X_AXIS);
+
+             if (Dot_column::has_interface (par))
+               {
+                 Side_position_interface::add_support (par, me);
+
+                 /*
+                   TODO: apply some better logic here. The flag is
+                   curved inwards, so this will typically be too
+                   much.
+                 */
+               }
+           }
        }
     }
 
 
-  bool no_extend_b = to_boolean (me->get_grob_property ("no-stem-extend"));
-  if (!grace_b && !no_extend_b && dir * st < 0) // junkme?
-    st = 0.0;
-
   return st;
 }
 
 
 
 /*
-  Number of hooks on the flag, ie. the log of the duration.
+  
+  the log of the duration (Number of hooks on the flag minus two)
  */
 int
-Stem::flag_i (Grob*me) 
+Stem::duration_log (Grob*me) 
 {
   SCM s = me->get_grob_property ("duration-log");
   return (gh_number_p (s)) ? gh_scm2int (s) : 2;
@@ -508,6 +516,13 @@ Stem::flag (Grob*me)
             looks slightly misplaced, but that will usually be the
             programmer's fault (e.g. when trying to attach multiple
             note heads to a single stem in mensural notation).  */
+
+         /*
+           perhaps the detection whether this correction is needed should
+           happen in a different place  to avoid the recursion.
+           
+           --hwn.
+         */
          Grob *first = first_head(me);
          int sz = Staff_symbol_referencer::line_count (me)-1;
          int p = (int)rint (Staff_symbol_referencer::position_f (first));
@@ -524,7 +539,7 @@ Stem::flag (Grob*me)
     }
   char c = (get_direction (me) == UP) ? 'u' : 'd';
   String index_str
-    = String ("flags-") + style + to_str (c) + staffline_offs + to_str (flag_i (me));
+    = String ("flags-") + style + to_str (c) + staffline_offs + to_str (duration_log (me));
   Molecule m
     = Font_interface::get_default_font (me)->find_by_name (index_str);
   if (!fstyle.empty_b ())
@@ -540,7 +555,7 @@ Stem::dim_callback (SCM e, SCM ax)
   assert (a == X_AXIS);
   Grob *se = unsmob_grob (e);
   Interval r (0, 0);
-  if (unsmob_grob (se->get_grob_property ("beam")) || abs (flag_i (se)) <= 2)
+  if (unsmob_grob (se->get_grob_property ("beam")) || abs (duration_log (se)) <= 2)
     ;  // TODO!
   else
     {
@@ -593,7 +608,7 @@ Stem::brew_molecule (SCM smob)
       mol.add_molecule (ss);
     }
 
-  if (!beam_l (me) && abs (flag_i (me)) > 2)
+  if (!beam_l (me) && abs (duration_log (me)) > 2)
     {
       Molecule fl = flag (me);
       fl.translate_axis (stem_y[d]*dy, Y_AXIS);
index d48295cd4e178eedf667d3b57dac51f3b9069632..45644a2fd3399f24156415a9297bb47ab32eb6d0 100644 (file)
      . (
        (molecule-callback . ,Dots::brew_molecule)
        (dot-count . 1)
-       (staff-position . 0.0)
        (Y-offset-callbacks  . (,Dots::quantised_position_callback ,Staff_symbol_referencer::callback))
        (meta . ((interfaces . (font-interface staff-symbol-referencer-interface dots-interface))))
        ))