]> git.donarmstrong.com Git - lilypond.git/commitdiff
update outdated comments
authorJoe Neeman <joeneeman@gmail.com>
Fri, 22 Jun 2007 03:35:30 +0000 (13:35 +1000)
committerJoe Neeman <joeneeman@gmail.com>
Tue, 26 Jun 2007 12:40:31 +0000 (15:40 +0300)
lily/include/spring.hh
lily/note-spacing.cc
lily/paper-column.cc
lily/spaceable-grob.cc
lily/spacing-spanner.cc
lily/staff-spacing.cc

index 78bd68cb57b7bcb08b08af05d3c6d6f2782f341c..4022173201f45d00852568d7f5e8cd0c181a5ef8 100644 (file)
@@ -46,7 +46,6 @@ public:
 
   void operator*= (Real);
   bool operator> (Spring const&) const;
-  Grob *other_;
 };
 DECLARE_UNSMOB (Spring, spring);
 
index 1bf208c4bd2be26dca41dfd71948083b78472310..38a87e2d387191ae5824411cd47633e1f2c9d189 100644 (file)
@@ -57,12 +57,13 @@ Note_spacing::get_spacing (Grob *me, Item *right_col,
     }
 
   /*
-    We look at the width of the note head, since smaller heads get less space
+    The main factor that determines the amount of space is the width of the
+    note head (or the rest). For example, a quarter rest gets almost 0.5 ss
+    less horizontal space than a note.
 
-    eg. a quarter rest gets almost 0.5 ss less horizontal space than a note.
-
-    What is sticking out of the note head (eg. a flag), doesn't get
-    the full amount of space.
+    The other parts of a note column (eg. flags, accidentals, etc.) don't get
+    the full amount of space. We give them half the amount of space, but then
+    adjust things so there are no collisions.
   */
   Real min_dist = Spacing_interface::minimum_distance (me, right_col);
   Real min_desired_space = max (left_head_end + (min_dist - left_head_end) / 2,
index d09518a590d8671de27d3502f37e367b83f5b6b5..56b96469975d71cac75b73346ce54ceee3c108b9 100644 (file)
@@ -200,8 +200,9 @@ Paper_column::print (SCM p)
   for (SCM s = me->get_object ("ideal-distances");
        scm_is_pair (s); s = scm_cdr (s))
     {
-      Spring *sp = unsmob_spring (scm_car (s));
-      if (!sp->other_->get_system ())
+      Spring *sp = unsmob_spring (scm_caar (s));
+      if (!unsmob_grob (scm_cdar (s))
+         || !unsmob_grob (scm_cdar (s))->get_system ())
        continue;
       
       j++;
index 638a4fa83bbc258654386729e4c3b87778de7bfc..87d30397e3ae48e4bf40976584eae0c0d1f16862 100644 (file)
@@ -59,8 +59,8 @@ void
 Spaceable_grob::add_spring (Grob *me, Grob *other, Spring sp)
 {
   SCM ideal = me->get_object ("ideal-distances");
-  sp.other_ = other;
-  ideal = scm_cons (sp.smobbed_copy (), ideal);
+
+  ideal = scm_cons (scm_cons (sp.smobbed_copy (), other->self_scm ()), ideal);
   me->set_object ("ideal-distances", ideal);
 }
 
@@ -73,10 +73,10 @@ Spaceable_grob::get_spring (Grob *this_col, Grob *next_col)
        !spring && scm_is_pair (s);
        s = scm_cdr (s))
     {
-      Spring *sp = unsmob_spring (scm_car (s));
-
-      if (sp && sp->other_ == next_col)
-       spring = sp;
+      if (scm_is_pair (scm_car (s))
+         && unsmob_grob (scm_cdar (s)) == next_col
+         && unsmob_spring (scm_caar (s)))
+       spring = unsmob_spring (scm_caar (s));
     }
 
   if (!spring)
index 3e6ca278994f674bc83bd373c9fe743a450df7b8..91b1b2e7f0001fcaa7763fa92d344adb0e4d339a 100644 (file)
@@ -11,8 +11,6 @@
 #include <math.h>
 #include <cstdio>
 
-using namespace std;
-
 #include "spacing-options.hh"
 #include "international.hh"
 #include "main.hh"
index a41f8f7f8ce5f48f9d43a82b392bb4d05484abdd..83e7f6167d8e3759296fe3435dbcb4abe26eb0fc 100644 (file)
@@ -24,6 +24,13 @@ using namespace std;
 #include "pointer-group-interface.hh"
 #include "directional-element-interface.hh"
 
+/* A stem following a bar-line creates an optical illusion similar to the
+   one mentioned in note-spacing.cc. We correct for it here.
+
+   TODO: should we still correct if there are accidentals/arpeggios before
+   the stem?
+*/
+
 Real
 Staff_spacing::optical_correction (Grob *me, Grob *g, Interval bar_height)
 {
@@ -100,12 +107,11 @@ Staff_spacing::next_notes_correction (Grob *me,
   return max_optical;
 }
 
-/* This routine does not impose any minimum distances between columns; it only
-   affects springs. As such, the FIXED variable does not refer to a minimum
-   distance between columns, but instead to a minimum desired distance between
-   columns -- this ends up affecting the stiffness of a spring. In fact, FIXED
-   will be the distance between columns if there is a compression force of 1.0
-   applied to the line. */
+/* We calculate three things here: the ideal distance, the minimum distance
+   (which is the distance at which collisions will occure) and the "fixed"
+   distance, which is the distance at which things start to look really bad.
+   We arrange things so that the fixed distance will be attained when the
+   line is compressed with a force of 1.0 */
 Spring
 Staff_spacing::get_spacing (Grob *me, Grob *right_col)
 {
@@ -193,6 +199,8 @@ Staff_spacing::get_spacing (Grob *me, Grob *right_col)
 
   Real optical_correction = next_notes_correction (me, last_grob);
   Real min_dist = Spacing_interface::minimum_distance (me, right_col);
+
+  /* ensure that the "fixed" distance will leave a gap of at least 0.3 ss. */
   Real min_dist_correction = max (0.0, 0.3 + min_dist - fixed);
   Real correction = max (optical_correction, min_dist_correction);