]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/translator.cc (derived_mark): new function.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 11 Sep 2004 12:35:20 +0000 (12:35 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 11 Sep 2004 12:35:20 +0000 (12:35 +0000)
* lily/slur-scoring.cc (score_encompass): new penalty type:
variance penalty demerits slurs where one head/stem is much
closer to the slur than average.

* lily/tuplet-bracket.cc (print): use robust_relative_extent
iso. extent()
(calc_position_and_height): use robust_relative_extent(). This
fixes a couple of programming_errors

27 files changed:
ChangeLog
input/regression/new-slur.ly
lily/accidental-engraver.cc
lily/ambitus-engraver.cc
lily/break-align-engraver.cc
lily/chord-name-engraver.cc
lily/context-def.cc
lily/include/book-paper-def.hh
lily/include/chord-name.hh
lily/include/music-iterator.hh
lily/include/output-def.hh
lily/include/translator-group.hh
lily/include/translator.hh
lily/ottava-engraver.cc
lily/output-def.cc
lily/quote-iterator.cc
lily/recording-group-engraver.cc
lily/slur-scoring.cc
lily/slur.cc
lily/tempo-performer.cc
lily/tie-engraver.cc
lily/translator-group.cc
lily/translator-scheme.cc
lily/translator.cc
lily/tuplet-bracket.cc
scm/page-layout.scm
scm/slur.scm

index 03330de6f36851d99c4ec175cf7aece59f120022..4e514dc08433f02dbb4457c9e904658a0556bce9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2004-09-11  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * lily/*-engraver.cc: remove all Protected_scm objects to fix GC
+       errors with GUILE 1.7 CVS.
+
+       * lily/translator.cc (derived_mark): new function.
+
+       * lily/slur-scoring.cc (score_encompass): new penalty type:
+       variance penalty demerits slurs where one head/stem is much
+       closer to the slur than average.
+
+       * lily/tuplet-bracket.cc (print): use robust_relative_extent
+       iso. extent()
+       (calc_position_and_height): use robust_relative_extent(). This
+       fixes a couple of programming_errors
+
        * input/regression/part-combine-mmrest-after-solo.ly (Module): new
        file.
 
index 0b3d93cf42d74e62b281a58c12936888bc2e16c8..8b62ec99c4f46ea51a29c83ee752e112082bfd38 100644 (file)
@@ -6,6 +6,7 @@
 \version "2.3.7"
 \paper {
     raggedright = ##t
+%    #(define debug-slur-scoring #t)
 }
 
 %% help lilypond-book
     e4( dis4)
     e4( dis4) 
     g='16( b d fis)
-    \clef bass a=8[ e16(f] g[ a bes d,)] |
+    \clef bass a=8[ e16(f] g[ a bes d,)]  s4 | \break
+    
+    \clef treble
+    \relative c'' {
+       \slurDown f2( d4 f | g c a f | d c f2 | f1) |
+    }
+
 }
 
index d74ac87635e00aa501e3fc56f68994655a703e66..d4bfad593dc79217dcf501f601dbdebf5b6828f8 100644 (file)
@@ -60,8 +60,9 @@ protected:
   virtual void process_acknowledged_grobs ();
   virtual void finalize ();
 
+  virtual void derived_mark () const;
 public:
-  Protected_scm last_keysig_;  // ugh.
+  SCM last_keysig_;    // ugh.
   
   /* Urgh. Since the accidentals depend on lots of variables, we have
     to store all information before we can really create the
@@ -102,6 +103,12 @@ Accidental_engraver::Accidental_engraver ()
   last_keysig_ = SCM_EOL;
 }
 
+void
+Accidental_engraver::derived_mark () const
+{
+  scm_gc_mark (last_keysig_);
+}
+
 void
 Accidental_engraver::update_local_key_signature ()
 {
index f50b651050756c7bc63ce61f6a4076a35854cbb9..59464954134e23b0829d1c4181c07405cf30e8d6 100644 (file)
@@ -28,6 +28,7 @@ TRANSLATOR_DECLARATIONS (Ambitus_engraver);
   virtual void acknowledge_grob (Grob_info);
   virtual void stop_translation_timestep ();
   virtual void finalize ();
+  virtual void derived_mark () const;
 
 private:
   void create_ambitus ();
@@ -38,9 +39,15 @@ private:
   Pitch_interval pitch_interval_;
   bool is_typeset_;
   int start_c0_;
-  Protected_scm start_key_sig_;
+  SCM start_key_sig_;
 };
 
+void
+Ambitus_engraver::derived_mark () const
+{
+  scm_gc_mark (start_key_sig_);
+}
+
 void
 Ambitus_engraver::create_ambitus ()
 {
@@ -72,6 +79,7 @@ Ambitus_engraver::Ambitus_engraver ()
   accidentals_[LEFT] = accidentals_[RIGHT] = 0;
   group_ = 0;
   is_typeset_ = false;
+  start_key_sig_ = SCM_EOL;
 }
 
 void
index da8a22e0af3756b3fb550d9fcec4e5367a4ca06a..a18647b0da26dee02f7a4aa486f5c17ce5b45f9f 100644 (file)
 class Break_align_engraver : public Engraver
 {
   Item *align_;
-  Protected_scm column_alist_;
+SCM column_alist_;
   Item *left_edge_;
 
   void add_to_group (SCM,Item*);
 protected:
-  virtual void finalize ();
   virtual void acknowledge_grob (Grob_info i);
   virtual void stop_translation_timestep ();
+  virtual void derived_mark () const;
   void add_column (SCM);
   
 public:
@@ -40,12 +40,6 @@ Break_align_engraver::add_column (SCM smob)
   
 }
 
-void
-Break_align_engraver::finalize ()
-{
-  column_alist_ = SCM_EOL;
-}
-
 void
 Break_align_engraver::stop_translation_timestep ()
 {
@@ -68,6 +62,12 @@ Break_align_engraver::Break_align_engraver ()
   align_ = 0;
 }
 
+void
+Break_align_engraver::derived_mark () const
+{
+  scm_gc_mark (column_alist_);
+}
+
 void
 Break_align_engraver::acknowledge_grob (Grob_info inf)
 {
index a5603207c501259fd92b3bbf17a3b8b3651fd028..0291aef631c688b8744fa384ab9ec9cd3be59563 100644 (file)
@@ -27,19 +27,27 @@ protected:
   virtual void process_music ();
   virtual bool try_music (Music *);
   virtual void finalize ();
+  virtual void derived_mark () const;
 private:
   void add_note (Music *);
   
   Item* chord_name_;
   Link_array<Music> notes_;
   
-  Protected_scm last_chord_;
+  SCM last_chord_;
 };
 
+
+
 void
 Chord_name_engraver::finalize ()
 {
-  last_chord_ = SCM_EOL; 
+}
+
+void
+Chord_name_engraver::derived_mark() const
+{
+  scm_gc_mark (last_chord_);
 }
 
 Chord_name_engraver::Chord_name_engraver ()
index a438341286e1b7a5b16edf95786a8d80e0fb1c41..e2a0b8c50ab01e15dcd56b04370f3817f8e82453 100644 (file)
@@ -273,8 +273,9 @@ Context_def::instantiate (SCM ops)
 
   SCM trans_names = get_translator_names (ops); 
 
-  Translator *g = get_translator (translator_group_type_);
-  g = g->clone ();
+  Translator_group *g = dynamic_cast<Translator_group*>
+    (get_translator (translator_group_type_));
+  g = dynamic_cast<Translator_group*> (g->clone ());
 
   SCM trans_list = SCM_EOL;
   
index 9ae39edb6e556dac485294386f913c90058dcaef..f807347bb610c5ee2d05b8c5c836e03e9a8af46c 100644 (file)
@@ -12,6 +12,8 @@
 #include "lily-proto.hh"
 #include "output-def.hh"
 
+#error
+
 class Output_def : public Output_def
 {
 public:
index a775a2b79abfca6cc328fcc1e430dbada4eb8103..147722ade0d3acf4c07a3517f6ec347a4c313ead 100644 (file)
@@ -17,7 +17,7 @@ class Chord_name
 {
 public:
   DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM ));
-  static  bool has_interface (Grob*);
+  static bool has_interface (Grob*);
 };
 
 #endif // CHORD_NAME_HH
index 2dad3c9b2b4904103457aa1a4cf28571412437eb..8d10fe5bf724916194244a95bc3a5ca1bf423b4a 100644 (file)
@@ -91,7 +91,7 @@ public:
 
   virtual bool run_always () const; 
   virtual void process (Moment until);
-  virtual void derived_mark ()const;
+  virtual void derived_mark () const;
   virtual void construct_children ();
   
   /**
index 4b2bf9c3e48151274f101075380c497e0cadfc9e..0f60d9b5572946ec612e33057a7eeea690633d63 100644 (file)
@@ -49,7 +49,6 @@ public:
 
   Output_def (Output_def const&);
   Output_def ();
-  virtual void derived_mark ();
   
   /*
     variables.
index cb8f00570f62d3be5cbd7fac02c9db27378a1973..17a61636597708364944e52b9e4d69c993e09bee 100644 (file)
@@ -27,8 +27,13 @@ public:
   virtual SCM get_simple_trans_list ();
   virtual bool try_music (Music* req);       
   virtual void initialize ();
-};
+  Translator_group ();
 
+protected:
+  SCM simple_trans_list_;
+  friend class Context_def;
+  virtual void derived_mark () const;
+};
 
 SCM names_to_translators (SCM namelist, Context*tg);
 void recurse_over_translators (Context * c, Translator_method ptr, Direction);
index 4b40032ba82bbbe9141dcee0274757ef0cc888be..3babb758c95a6e3a20572ba86db2f099aa3c4e07 100644 (file)
@@ -69,7 +69,8 @@ public:
   DECLARE_SMOBS (Translator, dummy);
 protected:                     // should be private.
   Context * daddy_context_ ;
-  SCM simple_trans_list_;
+  virtual void derived_mark () const;
+  
   friend class Context_def;
   friend class Context;
 };
index 99fbe7e3c6ed26b391faf3f392fca27f4328f26a..e7778a8d4c814bd2fdbedd0d3b23c471c3ab3e79 100644 (file)
@@ -21,15 +21,21 @@ protected:
   virtual void acknowledge_grob (Grob_info);
   virtual void process_music ();
   virtual void stop_translation_timestep ();
+  virtual void derived_mark () const;
 private:
   Spanner *span_;
   Spanner *finished_;
   
-  Protected_scm last_ottavation_;
+  SCM last_ottavation_;
   
   void typeset_all ();
 };
 
+void
+Ottava_spanner_engraver::derived_mark () const
+{
+  scm_gc_mark (last_ottavation_ );
+}
 
 Ottava_spanner_engraver::Ottava_spanner_engraver ()
 {
index 4a1e4963631553c4ac52a314d8fb482755566dca..21139546c91f25412fb91a2ac4b0e5882adc838b 100644 (file)
@@ -57,15 +57,9 @@ Output_def::mark_smob (SCM m)
   if (mo->parent_)
     scm_gc_mark (mo->parent_->self_scm ());
 
-  mo->derived_mark ();
   return mo->scope_;
 }
 
-void
-Output_def::derived_mark ()
-{
-}
-
 void
 assign_context_def (Output_def * m, SCM transdef)
 {
index 8b101eb6e878b7288e65c4086cc82dfb6763c577..718b0278f3f4cbe6c24f0c231d544faf58a6ecc6 100644 (file)
@@ -33,7 +33,7 @@ public:
 
   bool accept_music_type (Music*) const;
 protected:
-  virtual void derived_mark ();
+  virtual void derived_mark () const;
   virtual void construct_children ();
   virtual Moment pending_moment () const;
   virtual void process (Moment);
@@ -56,7 +56,7 @@ Quote_iterator::accept_music_type (Music *mus) const
 
 
 void
-Quote_iterator::derived_mark ()
+Quote_iterator::derived_mark () const
 {
   scm_gc_mark (transposed_musics_ );
 }
@@ -187,6 +187,8 @@ Quote_iterator::process (Moment m)
                  SCM copy = ly_deep_mus_copy (mus->self_scm ());
                  mus = unsmob_music (copy);
                  transposed_musics_ = scm_cons (copy, transposed_musics_);
+                 scm_gc_unprotect_object (copy);
+
                  
                  mus->transpose (diff);
                }
index 41e96ee5e988c9f3751309c4ef1f929fc7530e2d..1852b26372bb8c600c696701af52379b7b5de896 100644 (file)
@@ -21,9 +21,17 @@ public:
   virtual void stop_translation_timestep ();
   virtual void finalize ();
   virtual void initialize ();
-  Protected_scm accumulator_;
+  virtual void derived_mark () const;
+  SCM accumulator_;
 };
 
+void
+Recording_group_engraver::derived_mark () const
+{
+  Engraver_group_engraver::derived_mark();
+  scm_gc_mark (accumulator_);
+}
+
 void
 Recording_group_engraver::initialize ()
 {
@@ -33,6 +41,7 @@ Recording_group_engraver::initialize ()
 
 Recording_group_engraver::Recording_group_engraver ()
 {
+  accumulator_ = SCM_EOL;
 }
 
 void
index 0d7852950f2dab8d6e3984b5bb35490fcdd3d029..1d6dccb0bde7b85d229359faa857d33118d97d69 100644 (file)
@@ -44,11 +44,6 @@ struct Slur_score
   }
 };
 
-/*
-  TODO: put in details property.,
-
-  use lowercase.
-*/
 struct Slur_score_parameters
 {
   int region_size_;
@@ -63,8 +58,15 @@ struct Slur_score_parameters
   Real max_slope_factor_;
   Real extra_object_collision_;
   Real accidental_collision_;
+
   Real free_head_distance_;
   Real extra_encompass_free_distance_;
+
+  Real head_slur_distance_max_ratio_;
+  Real head_slur_distance_factor_;
+
+
+  
   Slur_score_parameters (Grob*);
 };
 
@@ -74,8 +76,6 @@ struct Slur_score_parameters
   - curve around flag for y coordinate
   - better scoring.
   - short-cut: try a smaller region first.
-  - collisions with accidentals
-  - collisions with articulations (staccato, portato, sforzato, ...)
   - handle non-visible stems better.
 */
 struct Encompass_info
@@ -89,6 +89,13 @@ struct Encompass_info
     stem_ = 0.0;
     head_ = 0.0;
   }
+  Real get_point (Direction dir)
+  {
+    Interval y;
+    y.add_point (stem_);
+    y.add_point (head_);
+    return y[dir];    
+  }
 };
 
 struct Bound_info
@@ -222,6 +229,10 @@ init_score_param (Grob *me,
     = get_detail (details, ly_symbol2scm ("accidental-collision"));
   score_param->extra_encompass_free_distance_ 
     = get_detail (details, ly_symbol2scm ("extra-encompass-free-distance"));
+  score_param->head_slur_distance_factor_
+    = get_detail (details, ly_symbol2scm ("head-slur-distance-factor"));
+  score_param->head_slur_distance_max_ratio_
+    = get_detail (details, ly_symbol2scm ("head-slur-distance-max-ratio"));
 }
 
 
@@ -425,9 +436,6 @@ get_bound_info (Spanner* me, Grob **common)
 void
 set_end_points (Grob *me)
 {
-
-  
-  
   Link_array<Grob> columns
     = Pointer_group_interface__extract_grobs (me, (Grob *) 0, "note-columns");
 
@@ -486,7 +494,7 @@ set_end_points (Grob *me)
 #if DEBUG_SLUR_QUANTING
   SCM inspect_quants = me->get_property ("inspect-quants");
   if (to_boolean (me->get_paper ()
-                 ->lookup_variable (ly_symbol2scm ("debug-slur-quanting")))
+                 ->lookup_variable (ly_symbol2scm ("debug-slur-scoring")))
       && ly_c_pair_p (inspect_quants))
     {
       Drul_array<Real> ins = ly_scm2interval (inspect_quants);
@@ -654,11 +662,12 @@ generate_curves (Grob *me, Grob **common,
   Real h_inf = staff_space * scm_to_double (me->get_property ("height-limit"));
   for (int i = 0; i < scores->size(); i++)
     {
-      Bezier bez= get_bezier (me, 
+      Bezier bez = get_bezier (me, 
                              common,
                              score_param,
                              extremes,
                              (*scores)[i].attachment_, r_0, h_inf);
+      
       bez = avoid_staff_line (me, common, extremes, bez);
       (*scores)[i].attachment_[LEFT] = bez.control_[0];
       (*scores)[i].attachment_[RIGHT] = bez.control_[3];
@@ -704,13 +713,9 @@ avoid_staff_line (Grob *me, Grob **common,
            * 5 * thick;
        
          Real dy = (newp - p) * staff_space / 2.0;
-#if 0
-         bez.translate (Offset (0, dy));
-#else
+         
          bez.control_[1][Y_AXIS] += dy;
          bez.control_[2][Y_AXIS] += dy;
-       
-#endif
        }
     }
   return bez;
@@ -812,6 +817,14 @@ enumerate_attachments (Grob *me, Grob *common[],
   return scores;
 }
 
+inline Real 
+linear_interpolate (Real x, Real x1, Real x2,  Real y1, Real  y2)
+{
+  return (x2 - x) / (x2 - x1) * y1 +
+    (x - x1) / (x2 - x1) * y2 ;
+}
+
+
 void
 score_encompass (Grob *me, Grob *common[],
                 Slur_score_parameters *score_param,
@@ -833,8 +846,16 @@ score_encompass (Grob *me, Grob *common[],
 
   for (int i = 0; i < scores->size (); i++)
     {
-      Bezier const &bez (scores->elem (i).curve_);
+      Slur_score &configuration = scores->elem_ref (i);
+      Bezier const &bez (configuration.curve_);
       Real demerit = 0.0;
+
+      /*
+       Distances for heads that are between slur and line between
+       attachment points.
+       */
+      Array<Real> convex_head_distances;
+      Array<Real> edge_distances;
       for (int j = 0; j < infos.size(); j++)
        {
          Real x = infos[j].x_;
@@ -843,8 +864,16 @@ score_encompass (Grob *me, Grob *common[],
          bool r_edge = j==infos.size()-1;
          bool edge =  l_edge || r_edge;
 
-         if (!(x < scores->elem (i).attachment_[RIGHT][X_AXIS]
-               && x > scores->elem (i).attachment_[LEFT][X_AXIS]))
+
+         if (edge)
+         {
+           edge_distances.push (fabs (configuration.attachment_[l_edge ? LEFT : RIGHT][Y_AXIS]
+                                      - infos[j].get_point (dir)));
+         } 
+         
+         
+         if (!(x < configuration.attachment_[RIGHT][X_AXIS]
+               && x > configuration.attachment_[LEFT][X_AXIS]))
            continue;
        
          Real y = bez.get_other_coordinate (X_AXIS, x);
@@ -852,7 +881,10 @@ score_encompass (Grob *me, Grob *common[],
            {
              Real head_dy = (y - infos[j].head_);
              if (dir * head_dy < 0)
-               demerit += score_param->head_encompass_penalty_;
+               {
+                 demerit += score_param->head_encompass_penalty_;
+                 convex_head_distances.push (0.0); 
+               }
              else
                {
                  Real hd = (head_dy)
@@ -860,9 +892,24 @@ score_encompass (Grob *me, Grob *common[],
                    : score_param->head_encompass_penalty_;
                  hd = (hd >? 0)<? score_param->head_encompass_penalty_;
 
-                 demerit += hd;        
+                 demerit += hd;
                }
-           }   
+
+             Real line_y = linear_interpolate (x,
+                                               configuration.attachment_[RIGHT][X_AXIS],
+                                               configuration.attachment_[LEFT][X_AXIS],
+                                               configuration.attachment_[RIGHT][Y_AXIS],
+                                               configuration.attachment_[LEFT][Y_AXIS]);
+
+             if (dir * (infos[j].get_point (dir) - line_y) > 0)
+               {
+                 Real d = fabs (infos[j].get_point (dir) - y);
+                 convex_head_distances.push (d);
+               }             
+           }
+
+         
+       
 
          if (dir * (y - infos[j].stem_) < 0)
            {
@@ -888,11 +935,50 @@ score_encompass (Grob *me, Grob *common[],
            }
        }
 
+      Real variance_penalty = 0.0;
+
+      if (convex_head_distances.size())
+       {
+         Real avg_distance = 0.0;
+         Real min_dist = infinity_f;
+         for (int j = 0; j < convex_head_distances.size(); j++)
+           {
+             min_dist = min_dist <? convex_head_distances[j];
+             avg_distance += convex_head_distances[j];
+           }
+
+         /*
+           For slurs over 3 or 4 heads, the average distance is not a
+           good normalizer.
+          */
+         int n =  convex_head_distances.size();
+         if (convex_head_distances.size() <= 2)
+           {
+             for (int j = 0; j < edge_distances.size(); j++)
+               {
+                 avg_distance += edge_distances[j];
+                 n++;
+               }
+           }
+
+         /*
+           TODO: maybe it's better to use (avgdist - mindist)*factor
+           as penalty.
+          */
+         avg_distance /= n;
+         variance_penalty = score_param->head_slur_distance_max_ratio_;
+         if (min_dist > 0.0)
+           variance_penalty = ((avg_distance / (min_dist  +score_param->free_head_distance_)) - 1.0)
+             <? variance_penalty;
+      
+         variance_penalty *= score_param->head_slur_distance_factor_;
+       }
 #if DEBUG_SLUR_QUANTING
       (*scores)[i].score_card_ += to_string ("C%.2f", demerit);
+      (*scores)[i].score_card_ += to_string ("D%.2f", variance_penalty);
 #endif
 
-      (*scores)[i].score_ += demerit;
+      (*scores)[i].score_ += demerit + variance_penalty;
     }
 }
 
@@ -1177,7 +1263,8 @@ get_bezier (Grob *me,
            Slur_score_parameters *score_param,
            Drul_array<Bound_info> extremes,       
            Drul_array<Offset> attachments,
-           Real r_0, Real h_inf)
+           Real r_0, Real h_inf
+           )
 {
   Link_array<Grob> encompasses
     = Pointer_group_interface__extract_grobs (me, (Grob *)0, "note-columns");
index d8bb8401bf2764fc45d0704d494bd5eb81c3b7b4..725922bf613789e24cf0a3d2c2f2b36b7c8e0d39 100644 (file)
@@ -81,7 +81,7 @@ Slur::print (SCM smob)
   SCM quant_score = me->get_property ("quant-score");
 
   if (to_boolean (me->get_paper ()
-                 ->lookup_variable (ly_symbol2scm ("debug-slur-quanting")))
+                 ->lookup_variable (ly_symbol2scm ("debug-slur-scoring")))
       && scm_is_string (quant_score))
     {
       String str;
index 6fad4e0ce43d4ed35654738a82696f82801f24d0..53943e809f5511db1e7491302fa1cd152d11c502 100644 (file)
@@ -23,7 +23,7 @@ protected:
   virtual void create_audio_elements ();
 
 private:
-Music* tempo_req_;
+  Music* tempo_req_;
   Audio_tempo* audio_;
 };
 
index 7d2b83d82c4ef5aab50359e6a1c2269981c29951..1aecbe526cb16b4a18ca5bc8e5cd0a81b93e1c23 100644 (file)
@@ -36,12 +36,13 @@ class Tie_engraver : public Engraver
   Link_array<Grob> now_heads_;
   Link_array<Grob> heads_to_tie_;
   Link_array<Grob> ties_;
-  Protected_scm tie_start_definition_;
+  SCM tie_start_definition_;
   
   Spanner * tie_column_;
   
 protected:
   virtual void stop_translation_timestep ();
+  virtual void derived_mark () const;
   virtual void start_translation_timestep ();
   virtual void acknowledge_grob (Grob_info);
   virtual bool try_music (Music*);
@@ -58,6 +59,13 @@ Tie_engraver::Tie_engraver ()
   event_ = 0;
   last_event_  = 0;
   tie_column_ = 0;
+  tie_start_definition_ = SCM_EOL;
+}
+
+void
+Tie_engraver::derived_mark () const
+{
+  scm_gc_mark (tie_start_definition_);
 }
 
 
index d7036957d73512caa575917e3fcc5b3478810e5f..7a7573694654cb9989d7a75955958be4bec13a7a 100644 (file)
@@ -134,3 +134,14 @@ recurse_over_translators (Context * c, Translator_method ptr, Direction dir)
       (tg->*ptr) ();
     }
 }
+
+Translator_group::Translator_group()
+{
+  simple_trans_list_ = SCM_EOL;
+}
+
+void
+Translator_group::derived_mark () const
+{
+  scm_gc_mark (simple_trans_list_); 
+}
index c32b13b017cf7b22000a405418198f6be5f40ca0..a80b4c1661bedca200252c6051f340522c4ca218 100644 (file)
@@ -39,8 +39,6 @@ Translator::print_smob (SCM s, SCM port, scm_print_state *)
   Translator *me = (Translator*) ly_cdr (s);
   scm_puts ("#<Translator ", port);
   scm_puts (classname (me), port);
-  scm_display (me->simple_trans_list_, port);
-  
   scm_puts (" >", port);
   return 1;
 }
index 17c9ab38c250e6a30476b577b6e69c4e10905beb..a5c612a929bdda8f9f4288db93a0598e62a6670e 100644 (file)
@@ -26,7 +26,6 @@ Translator::init ()
 {
   must_be_last_ = false;
   self_scm_ = SCM_EOL;
-  simple_trans_list_ = SCM_BOOL_F;
   daddy_context_ =0;
   smobify_self ();
 }
@@ -125,7 +124,8 @@ SCM
 Translator::mark_smob (SCM sm)
 {
   Translator * me = (Translator*) SCM_CELL_WORD_1 (sm);
-  return me->simple_trans_list_;
+  me->derived_mark ();
+  return SCM_EOL;
 }
 
 SCM
@@ -166,3 +166,8 @@ Translator::must_be_last () const
   return must_be_last_;
 }
 
+void
+Translator::derived_mark () const
+{
+  
+}
index f96551bc6f7b4942bf1def8706929fe684bab0d2..0260b2a1cecd639eeb831921cfbedcdddde4da5b 100644 (file)
@@ -160,10 +160,10 @@ Tuplet_bracket::print (SCM smob)
   Direction dir = get_grob_direction (me);
 
   Grob * lgr = get_x_bound_grob (columns[0], dir);
-  Grob * rgr = get_x_bound_grob (columns.top (), dir);  
-  Real x0 = lgr->extent (commonx,X_AXIS)[LEFT];
-  Real x1 = rgr->extent (commonx,X_AXIS)[RIGHT];
-
+  Grob * rgr = get_x_bound_grob (columns.top (), dir);
+  
+  Real x0 = robust_relative_extent (lgr, commonx, X_AXIS)[LEFT];
+  Real x1 = robust_relative_extent (rgr, commonx, X_AXIS)[RIGHT];
   Real w = x1 -x0;
   
   SCM number = me->get_property ("text");
@@ -360,9 +360,8 @@ Tuplet_bracket::calc_position_and_height (Grob*me,Real *offset, Real * dy)
   
   Grob * lgr = get_x_bound_grob (columns[0], dir);
   Grob * rgr = get_x_bound_grob (columns.top (), dir);  
-  Real x0 = lgr->extent (commonx,X_AXIS)[LEFT];
-  Real x1 = rgr->extent (commonx,X_AXIS)[RIGHT];
-
+  Real x0 = robust_relative_extent (lgr, commonx, X_AXIS)[LEFT];
+  Real x1 = robust_relative_extent (rgr, commonx, X_AXIS)[RIGHT];
 
   /*
     Slope.
@@ -478,7 +477,7 @@ Tuplet_bracket::after_line_breaking (SCM smob)
 
       /*
        duh. magic.
-<       */
+       */
       offset = lp + dir * (0.5 + scm_to_double (me->get_property ("padding")));
       dy = rp- lp;
     }
index 7422ca26822ae7cd86233440b3334a3795968e56..296444317b289d3554f62d51e5b277104a2b5402 100644 (file)
@@ -300,11 +300,14 @@ is what have collected so far, and has ascending page numbers."
                 (entry (list idx (1+ idx) distance)))
              entry)))
         (rods (map calc-rod (iota (1- no-systems))))
-        (page-very-empty (> space-left (/ page-height 3)))
+        (page-very-empty? (> space-left (/ page-height 3)))
         (result (ly:solve-spring-rod-problem
                  springs rods space
-                 ragged?))
-        (force (car result))
+                 (or page-very-empty? ragged?)))
+        (force (car (if page-very-empty?
+                        (ly:solve-spring-rod-problem
+                         springs rods space ragged?)
+                        result)))
         (positions
          (map (lambda (y)
                       (+ y topskip)) 
@@ -346,7 +349,6 @@ CURRENT-BEST is the best result sofar, or #f."
                       (and (eq? #t (ly:output-def-lookup bookpaper 'raggedlastbottom))
                            last?)))
            (page-height (page-height this-page-num last?))
-          
           (vertical-spacing (space-systems page-height current-lines ragged?))
           (satisfied-constraints (car vertical-spacing))
            (force (if satisfied-constraints satisfied-constraints 10000))
index d7ec5fef84318872996c1171f2bb96522749cafc..943e6dd61e6db697b2e6d58a6601c50cdce211c4 100644 (file)
@@ -22,4 +22,6 @@
     (extra-object-collision . 50)
     (accidental-collision . 3)
     (extra-encompass-free-distance . 0.3)
+    (head-slur-distance-max-ratio . 3)
+    (head-slur-distance-factor . 10)
     ))