]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge commit 'origin' into beamlets2
authorJoe Neeman <joeneeman@gmail.com>
Wed, 31 Dec 2008 04:07:52 +0000 (15:07 +1100)
committerJoe Neeman <joeneeman@gmail.com>
Wed, 31 Dec 2008 04:07:52 +0000 (15:07 +1100)
1  2 
lily/beam.cc
lily/stem.cc
scm/define-grob-properties.scm
scm/define-grobs.scm

diff --combined lily/beam.cc
index 250b055a658b55d484ca1d669b5bdb60cd55d343,dcca55322795e4b58816788306f646a83f6d8fb2..46ed26ba6604bab63e8c939708d53d1b87ee5ad0
@@@ -341,12 -341,6 +341,12 @@@ Beam::get_beam_segments (Grob *me_grob
    Position_stem_segments_map stem_segments;
    Real lt = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
  
 +  /* There are two concepts of "rank" that are used in the following code.
 +     The beam_rank is the vertical position of the beam (larger numbers are
 +     closer to the noteheads). Beam_stem_segment.rank_, on the other hand,
 +     is the horizontal position of the segment (this is incremented by two
 +     for each stem; the beam segment on the right side of the stem has
 +     a higher rank (by one) than its neighbour to the left). */
    Slice ranks;
    for (vsize i = 0; i < stems.size (); i++)
      {
        Direction d = LEFT;
        do
        {
 +        // Find the maximum and minimum beam ranks.
 +        // Given that RANKS is never reset to empty, the interval will always be
 +        // smallest for the left beamlet of the first stem, and then it might grow.
 +        // Do we really want this? (It only affects the tremolo gaps) --jneem
          for (SCM s = index_get_cell (beaming, d);
               scm_is_pair (s); s = scm_cdr (s))
            {
  
        Beam_segment current;
  
 +      // Iterate over all of the segments of the current beam rank,
 +      // merging the adjacent Beam_stem_segments into one Beam_segment
 +      // when appropriate.
        int vertical_count =  (*i).first;
        for (vsize j = 0; j < segs.size (); j++)
        {
 -        /*
 -          event_dir == LEFT: left edge of a beamsegment.
 -         */
 +        // Keeping track of the different directions here is a little tricky.
 +        // segs[j].dir_ is the direction of the beam segment relative to the stem
 +        // (ie. segs[j].dir_ == LEFT if the beam segment sticks out to the left of
 +        // its stem) whereas event_dir refers to the edge of the beam segment that
 +        // we are currently looking at (ie. if segs[j].dir_ == event_dir then we
 +        // are looking at that edge of the beam segment that is furthest from its
 +        // stem).
          Direction event_dir = LEFT;
 +        Beam_stem_segment const& seg = segs[j];
          do
            {
 -            bool on_line_bound = (segs[j].dir_ == LEFT) ? segs[j].stem_index_ == 0
 -              : segs[j].stem_index_ == stems.size() - 1;
 +            Beam_stem_segment const& neighbor_seg = segs[j + event_dir];
 +            // TODO: make names clearer? --jneem
 +            // on_line_bound: whether the current segment is on the boundary of the WHOLE beam
 +            // on_beam_bound: whether the current segment is on the boundary of just that part
 +            //   of the beam with the current beam_rank
 +            bool on_line_bound = (seg.dir_ == LEFT) ? seg.stem_index_ == 0
 +              : seg.stem_index_ == stems.size() - 1;
              bool on_beam_bound = (event_dir == LEFT) ? j == 0 :
                j == segs.size () - 1;
              bool inside_stem = (event_dir == LEFT)
 -              ? segs[j].stem_index_ > 0
 -              : segs[j].stem_index_ + 1 < stems.size () ;
 +              ? seg.stem_index_ > 0
 +              : seg.stem_index_ + 1 < stems.size () ;
                      
              bool event = on_beam_bound
 -              || abs (segs[j].rank_ - segs[j+event_dir].rank_) > 1
 -              || (abs (vertical_count) >= segs[j].max_connect_
 -                  || abs (vertical_count) >= segs[j + event_dir].max_connect_);
 +              || abs (seg.rank_ - neighbor_seg.rank_) > 1
 +              || (abs (vertical_count) >= seg.max_connect_
 +                  || abs (vertical_count) >= neighbor_seg.max_connect_);
              
              if (!event)
 +              // Then this edge of the current segment is irrelevent because it will
 +              // be connected with the next segment in the event_dir direction.
                continue;
  
              current.vertical_count_ = vertical_count;
 -            current.horizontal_[event_dir] = segs[j].stem_x_;
 -            if (segs[j].dir_ == event_dir)
 +            current.horizontal_[event_dir] = seg.stem_x_;
 +            if (seg.dir_ == event_dir)
 +              // then we are examining the edge of a beam segment that is furthest
 +              // from its stem.
                {
                  if (on_line_bound
                      && me->get_bound (event_dir)->break_status_dir ())
                    }
                  else
                    {
 -                    Real notehead_width = 
 -                      Stem::duration_log (segs[j].stem_) == 1
 -                      ? 1.98
 -                      : 1.32; // URG.
 -
 +                    Grob *stem = stems[seg.stem_index_];
 +                    Drul_array<Real> beamlet_length =
 +                      robust_scm2interval (stem->get_property ("beamlet-default-length"), Interval (1.0, 1.0));
 +                    Drul_array<Real> max_proportion =
 +                      robust_scm2interval (stem->get_property ("beamlet-max-length-proportion"), Interval (0.5, 0.5));
 +                    Real length = beamlet_length[seg.dir_];
  
                      if (inside_stem)
                        {
 -                        Grob *neighbor_stem = stems[segs[j].stem_index_ + event_dir];
 -                        Real neighbor_stem_x
 -                          = neighbor_stem->relative_coordinate (commonx, X_AXIS);
 +                        Grob *neighbor_stem = stems[seg.stem_index_ + event_dir];
 +                        Real neighbor_stem_x = neighbor_stem->relative_coordinate (commonx, X_AXIS);
  
 -                        notehead_width = min (notehead_width,
 -                                              fabs (neighbor_stem_x - segs[j].stem_x_)/2.5);
 +                        length = min (length,
 +                                      fabs (neighbor_stem_x - seg.stem_x_) * max_proportion[seg.dir_]);
                        }
 -                    current.horizontal_[event_dir] += event_dir * notehead_width;
 +                    current.horizontal_[event_dir] += event_dir * length;
                    }
                }
              else
 +              // we are examining the edge of a beam segment that is closest
 +              // (ie. touching, unless there is a gap) its stem.
                {
 -                current.horizontal_[event_dir] += event_dir * segs[j].width_/2;
 -                if (segs[j].gapped_)
 +                current.horizontal_[event_dir] += event_dir * seg.width_/2;
 +                if (seg.gapped_)
                    {
                      current.horizontal_[event_dir] -= event_dir * gap_length;
  
 -                    if (Stem::is_invisible (segs[j].stem_))
 +                    if (Stem::is_invisible (seg.stem_))
                        {
                          /*
                            Need to do this in case of whole notes. We don't want the
                            heads to collide with the beams.
                           */
 -                        extract_grob_set (segs[j].stem_, "note-heads", heads);
 +                        extract_grob_set (seg.stem_, "note-heads", heads);
  
                          for (vsize k = 0; k < heads.size (); k ++)
                            current.horizontal_[event_dir]
@@@ -922,10 -893,8 +922,8 @@@ Beam::no_visible_stem_positions (Grob *
  */
  MAKE_SCHEME_CALLBACK (Beam, calc_least_squares_positions, 2);
  SCM
- Beam::calc_least_squares_positions (SCM smob, SCM posns)
+ Beam::calc_least_squares_positions (SCM smob, SCM /* posns */)
  {
-   (void) posns;
-   
    Grob *me = unsmob_grob (smob);
  
    int count = normal_stem_count (me);
diff --combined lily/stem.cc
index 0ec01fd1080c0c8a8c91cf014ce9b8db2f0cdf25,3380d0cc17b1b14aec7e5d05b0d878faefc369b5..a5d23c31050f5193ff263c8eaae5cd01e4d8e20f
@@@ -229,11 -229,10 +229,10 @@@ Stem::is_normal_stem (Grob *me
  
  MAKE_SCHEME_CALLBACK (Stem, pure_height, 3)
  SCM
- Stem::pure_height (SCM smob, SCM start, SCM end)
+ Stem::pure_height (SCM smob,
+                  SCM /* start */,
+                  SCM /* end */)
  {
-   (void) start;
-   (void) end;
    Grob *me = unsmob_grob (smob);
    Interval iv;
  
@@@ -1052,8 -1051,6 +1051,8 @@@ ADD_INTERFACE (Stem
               "avoid-note-head "
               "beam "
               "beaming "
 +             "beamlet-default-length "
 +             "beamlet-max-length-proportion "
               "default-direction "
               "details "
               "direction "
index 9c12167d1aea26cb0d6dd5cb995bc9673f57f533,2eda0539ce4cb0f4f8a841946f7f2fb596c8720f..9ed32e95a27753ab9b77dae6b24aa465e0ee7164
@@@ -79,14 -79,6 +79,14 @@@ specifies which beams to make.  @code{0
  @code{1}@tie{}is the next beam toward the note, etc.  This
  information is used to determine how to connect the beaming patterns
  from stem to stem inside a beam.")
 +     (beamlet-default-length ,pair? "A pair of numbers. The first number
 +specifies the default length of a beamlet that sticks out of the left hand
 +side of this stem; the second number specifies the default length of the
 +beamlet to the right. The actual length of a beamlet is determined by
 +taking either the default length or the length specified by
 +@code{beamlet-max-length-proportion}, whichever is smaller.")
 +     (beamlet-max-length-proportion ,pair? "The maximum length of a beamlet,
 +as a proportion of the distance between two adjacent stems.")
       (before-line-breaking ,boolean? "Dummy property, used to trigger
  a callback function.")
       (between-cols ,pair? "Where to attach a loose column to.")
@@@ -141,6 -133,8 +141,8 @@@ stick out of its bounds?"
  
       (c0-position ,integer? "An integer indicating the position of
  middle@tie{}C.")
+      (circled-tip ,boolean? "Put a circle at start/end of hairpins (al/del
+ niente).")
       (clip-edges ,boolean? "Allow outward pointing beamlets at the
  edges of beams?")
       (collapse-height ,ly:dimension? "Minimum height of system start
@@@ -264,6 -258,9 +266,9 @@@ include the following
  Choices include @code{curved}, @code{straight}, and
  @code{none}.  Default @code{curved}.
  @item
+ @code{capo-thickness} -- Thickness of capo indicator, in
+ multiples of fret-space.  Default value 0.5.
+ @item
  @code{dot-color} -- Color of dots.  Options include
  @code{black} and @code{white}.  Default @code{black}.
  @item
@@@ -505,6 -502,8 +510,8 @@@ In case of a potential collision, the g
  tightly as possible.")
       (padding ,ly:dimension? "Add this much extra space between
  objects that are next to each other.")
+      (padding-pairs ,list? "An alist mapping @code{(@var{name} . @var{name})}
+ to distances.")
       (page-break-penalty ,number? "Penalty for page break at this
  column.  This affects the choices of the page breaker; it avoids a
  page break at a column with a positive penalty and prefers a page break
@@@ -559,6 -558,10 +566,10 @@@ value @code{-1} means left aligned, @co
  values may also be specified.")
       (self-alignment-Y ,number? "Like @code{self-alignment-X} but for
  the Y@tie{}axis.")
+      (toward-stem-shift ,number? "Amount by which scripts are shifted
+ toward the stem if their direction coincides with the stem direction.
+ @code{0.0} means keep the default position (centered on the note head),
+ @code{1.0} means centered on the stem.  Interpolated values are possible.")
       (shorten-pair ,number-pair? "The lengths to shorten a
  text-spanner on both sides, for example a pedal bracket.  Positive
  values shorten the text-spanner, while negative values lengthen it.")
@@@ -578,6 -581,11 +589,11 @@@ is placed vertically."
  @code{direction-source} with this to get the direction of this
  object.")
       (size ,number? "Size of object, relative to standard size.")
+      (skyline-horizontal-padding ,number? "For determining the vertical
+ distance between two staves, it is possible to have a configuration which
+ would result in a tight interleaving of grobs from the top staff and the
+ bottom staff.  The larger this parameter is, the farther apart the staves
+ are placed in such a configuration.")
       (slash-negative-kern ,number? "The space to remove between
  slashes in percent repeat glyphs.  Larger values bring the two
  elements closer together.")
@@@ -766,9 -774,6 +782,6 @@@ columns."
       (note-columns ,pair? "A list of @code{NoteColumn} grobs.")
       (note-head ,ly:grob? "A single note head.")
       (note-heads ,ly:grob-array? "A list of note head grobs.")
-      (padding-pairs ,list? "An alist mapping @code{(@var{name} . @var{name})}
- to distances.")
       (pedal-text ,ly:grob? "A pointer to the text of a mixed-style piano
  pedal.")
       (pure-Y-common ,ly:grob? "A cache of the
@@@ -812,9 -817,6 +825,6 @@@ that should only show changes."
  
       (cause ,scheme? "Any kind of causation objects (i.e., music, or perhaps
  translator) that was the cause for this grob.")
-      (circled-tip ,boolean? "Put a circle at start/end of hairpins (al/del
- niente).")
       (delta-position ,number? "The vertical position difference.")
       (details ,list? "Alist of parameters for detailed grob behavior.
  
@@@ -857,11 -859,6 +867,6 @@@ acts as an index for looking up a @code
  Internally used to distribute beam shortening over stems.")
       (skyline-distance ,number? "The distance between this staff and the
  next one, as determined by a skyline algorithm.")
-      (skyline-horizontal-padding ,number? "For determining the vertical
- distance between two staves, it is possible to have a configuration which
- would result in a tight interleaving of grobs from the top staff and the
- bottom staff.  The larger this parameter is, the farther apart the staves
- are placed in such a configuration.")
       (stem-info ,pair? "A cache of stem parameters.")
  
       (use-breve-rest ,boolean? "Use breve rests for measures longer
diff --combined scm/define-grobs.scm
index feca08ef5bf71dc0e0de247c201b07527b2a0aba,c7059d0ff39d268821e57a6e351ccacf6a08e334..e32cd6a7218ce47a3cdb4ee2f37ce7f428a8f365
        (thickness . 1.3)
        (cross-staff . ,ly:stem::calc-cross-staff)
        (flag . ,ly:stem::calc-flag)
 +      (beamlet-default-length . (1.0 . 1.0))
 +      (beamlet-max-length-proportion . (0.5 . 0.5))
        (details
         . (
            ;; 3.5 (or 3 measured from note head) is standard length
-           ;; 32nd, 64th flagged stems should be longer
-           (lengths . (3.5 3.5 3.5 4.5 5.0))
+           ;; 32nd, 64th, 128th flagged stems should be longer
+           (lengths . (3.5 3.5 3.5 4.5 5.0 6.0))
  
            ;; FIXME.  3.5 yields too long beams (according to Ross and
            ;; looking at Baerenreiter examples) for a number of common