]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/note-spacing.cc
* Documentation/topdocs/{AUTHORS.texi,INSTALL.texi,README.texi}:
[lilypond.git] / lily / note-spacing.cc
index b4d85287d20dbd53b2c6e76cbb9ce40d5f919f5e..82640d4d626c9db8841537815756c68498fe9263 100644 (file)
@@ -43,8 +43,7 @@ Note_spacing::get_spacing (Grob *me, Item *right_col,
 
          if (d == RIGHT && it->break_status_dir () != col_dir)
            {
-             it = it -> find_prebroken_piece (col_dir);
-
+             it = it->find_prebroken_piece (col_dir);
            }
          /*
            some kind of mismatch, eg. a note column, that is behind a
@@ -110,10 +109,10 @@ Note_spacing::get_spacing (Grob *me, Item *right_col,
     FIXED also includes the left part of the right object.
   */
   *fixed
-    = (left_head_wid.is_empty () ? increment :
-       /*
-        Size of the head:
-       */
+    = (left_head_wid.is_empty () ? increment
+       :        /*
+                 Size of the head:
+               */
        (left_head_wid[RIGHT]+
 
        /*
@@ -318,7 +317,7 @@ Note_spacing::stem_dir_correction (Grob *me, Item *rcolumn,
              Real chord_start = hp[sd];
              Real stem_end = Stem::stem_end_position (stem);
 
-             stem_posns[d] = Interval (chord_start <? stem_end, chord_start>? stem_end);
+             stem_posns[d] = Interval (min (chord_start, stem_end), max (chord_start,  stem_end));
              head_posns[d].unite (hp);
            }
        }
@@ -339,7 +338,7 @@ Note_spacing::stem_dir_correction (Grob *me, Item *rcolumn,
       stem_posns[RIGHT] = bar_yextent;
     }
 
-  if (correct_stem_dirs && stem_dirs[LEFT] *stem_dirs[RIGHT] == -1)
+  if (correct_stem_dirs && stem_dirs[LEFT] * stem_dirs[RIGHT] == -1)
     {
       if (beams_drul[LEFT] && beams_drul[LEFT] == beams_drul[RIGHT])
        {
@@ -367,7 +366,7 @@ Note_spacing::stem_dir_correction (Grob *me, Item *rcolumn,
                }
            }
 
-         correction = note_head_width* stem_dirs[LEFT];
+         correction = note_head_width * stem_dirs[LEFT];
          correction *= robust_scm2double (me->get_property ("knee-spacing-correction"), 0);
          *fixed += correction;
        }
@@ -384,7 +383,7 @@ Note_spacing::stem_dir_correction (Grob *me, Item *rcolumn,
              /*
                Ugh. 7 is hardcoded.
              */
-             correction = (correction / 7) <? 1.0;
+             correction = min (correction / 7, 1.0);
              correction *= stem_dirs[LEFT];
              correction
                *= robust_scm2double (me->get_property ("stem-spacing-correction"), 0);
@@ -396,7 +395,7 @@ Note_spacing::stem_dir_correction (Grob *me, Item *rcolumn,
            }
        }
     }
-  else if (correct_stem_dirs && stem_dirs[LEFT] *stem_dirs[RIGHT] == UP)
+  else if (correct_stem_dirs && stem_dirs[LEFT] * stem_dirs[RIGHT] == UP)
     {
       /*
        Correct for the following situation:
@@ -426,10 +425,10 @@ Note_spacing::stem_dir_correction (Grob *me, Item *rcolumn,
        = (head_posns[LEFT][DOWN] > head_posns[RIGHT][UP]) ? RIGHT : LEFT;
 
       Real delta = head_posns[-lowest][DOWN] - head_posns[lowest][UP];
-      Real corr = robust_scm2double (me->get_property ("stem-spacing-correction"), 0);
-      corr = (delta <= 1) ? 0.0 : 0.25;
-
-      correction = -lowest * corr;
+      Real corr = robust_scm2double (me->get_property ("same-direction-correction"), 0);
+      
+      if (delta > 1)
+       correction = -lowest * corr;
     }
 
   *space += correction;
@@ -437,11 +436,9 @@ Note_spacing::stem_dir_correction (Grob *me, Item *rcolumn,
   /* there used to be a correction for bar_xextent () here, but
      it's unclear what that was good for ?
   */
-
 }
 
-
 ADD_INTERFACE (Note_spacing, "note-spacing-interface",
               "This object calculates spacing wishes for individual voices.",
-              "left-items right-items stem-spacing-correction knee-spacing-correction");
+              "left-items right-items stem-spacing-correction same-direction-correction knee-spacing-correction");