]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.5.4.jcn5
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 12 Aug 2001 14:25:12 +0000 (16:25 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 12 Aug 2001 14:25:12 +0000 (16:25 +0200)
19 files changed:
VERSION
input/trip.ly
lily/break-algorithm.cc
lily/gourlay-breaking.cc
lily/include/break-algorithm.hh
lily/include/column-x-positions.hh
lily/include/line-of-score.hh
lily/include/new-spacing-spanner.hh
lily/include/simple-spacer.hh
lily/include/spacing-spanner.hh
lily/kpath.cc
lily/line-of-score.cc
lily/new-spacing-spanner.cc
lily/paper-score.cc
lily/separating-line-group-engraver.cc
lily/simple-spacer.cc
lily/spacing-spanner.cc
lily/stanza-number-engraver.cc
scm/grob-description.scm

diff --git a/VERSION b/VERSION
index fead2c56c16b4d8074767d07fab456b23cc284a2..e033a5880779bba1c18774aab9a67b0b3f6873c7 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=5
 PATCH_LEVEL=4
-MY_PATCH_LEVEL=jcn4
+MY_PATCH_LEVEL=jcn5
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index 11a30811d3261fa357980f067fda478d29f045a3..6aa569f52328c06888cb2507148170b69c5a3650 100644 (file)
@@ -69,7 +69,7 @@ praeludiumLeft =  \notes \relative c {
 
       cis] }
       \translator Staff = bass 
-      \shiftOff
+      \shiftOff \stemUp
       [bis gis] cis4 |
       dis2 cis4 r8 cis }
     \context Voice = one { \stemUp bis2 }
index e845133d6364aca3c23f25f488658186df86ea98..887efc3d20346f2fc51c16c295fa0b736f1ed9a2 100644 (file)
@@ -22,7 +22,7 @@
 Array<int>
 Break_algorithm::find_break_indices () const
 {
-  Link_array<Grob> all = pscore_l_->line_l_->column_l_arr ();
+  Link_array<Item> all = pscore_l_->line_l_->column_l_arr ();
   Array<int> retval;
 
   for (int i=0; i < all.size (); i++)
@@ -37,11 +37,11 @@ Break_algorithm::find_break_indices () const
 }
 
 
-Link_array<Grob>
+Link_array<Item>
 Break_algorithm::find_breaks () const
 {
-  Link_array<Grob> all = pscore_l_->line_l_->column_l_arr ();
-  Link_array<Grob> retval;
+  Link_array<Item> all = pscore_l_->line_l_->column_l_arr ();
+  Link_array<Item> retval;
 
   for (int i=0; i < all.size (); i++)
     if (Item::breakable_b (all[i]))
@@ -56,7 +56,7 @@ Break_algorithm::find_breaks () const
 
 
 Simple_spacer*
-Break_algorithm::generate_spacing_problem (Link_array<Grob> curline, Interval line) const
+Break_algorithm::generate_spacing_problem (Link_array<Item> curline, Interval line) const
 {
   Simple_spacer * sp =  new Simple_spacer;
 
@@ -80,8 +80,6 @@ Break_algorithm::generate_spacing_problem (Link_array<Grob> curline, Interval li
     sp->line_len_f_ = line.length ();
   
   sp->add_columns (curline);
-
-
   return sp;
 }
 
index 04112971d318513083b415e3f3373c949da1f243..4b8b6048fcddd422d0adf3ab8577127bfe792d14 100644 (file)
@@ -54,7 +54,7 @@ Array<Column_x_positions>
 Gourlay_breaking::do_solve () const
 {
   Array<Break_node> optimal_paths;
-  Link_array<Grob> all =
+  Link_array<Item> all =
     pscore_l_->line_l_->column_l_arr ();
   
   Array<int> breaks = find_break_indices ();
@@ -80,7 +80,7 @@ Gourlay_breaking::do_solve () const
 
       for (int start_idx = break_idx; start_idx--;)
        {
-         Link_array<Grob> line = all.slice (breaks[start_idx], breaks[break_idx]+1);
+         Link_array<Item> line = all.slice (breaks[start_idx], breaks[break_idx]+1);
   
          line[0]     = dynamic_cast<Item*> (line[0])    ->find_prebroken_piece (RIGHT);
          line.top () = dynamic_cast<Item*> (line.top ())->find_prebroken_piece (LEFT);
index c91a00bdafa03b83d838b2305506db7d5c464391..ba0048b9b221b26b6659bb75d271946ef585afaa 100644 (file)
@@ -28,7 +28,7 @@ protected:
   Real linewidth_f_;
 
   /// search all pcols which are breakable.
-  Link_array<Grob> find_breaks () const;
+  Link_array<Item> find_breaks () const;
 
   Array<int> find_break_indices () const;
     
@@ -37,10 +37,10 @@ protected:
   void solve_line (Column_x_positions*) const;
 
   /// does curline fit on the paper?    
-  bool feasible (Link_array<Grob>) const;
+  bool feasible (Link_array<Item>) const;
     
 
-  Simple_spacer* generate_spacing_problem (Link_array<Grob>, Interval) const;
+  Simple_spacer* generate_spacing_problem (Link_array<Item>, Interval) const;
 
   virtual Array<Column_x_positions> do_solve () const=0;
 
index e8688d3bcdfed2b776ca091cff411669aef48e3f..7e1a48245ca400f2b8484cd1a9094bb8cd5f5475 100644 (file)
@@ -13,7 +13,7 @@
 
 struct Column_x_positions
 {
-  Link_array<Grob> cols_;
+  Link_array<Item> cols_;
   Array<Real> config_;
   Real force_f_;
   bool satisfies_constraints_b_;
index e2c2fc4b73df22a269333a117cee931f8860983d..5de05af03f9ebc20172041920b4e978b8b2710c2 100644 (file)
@@ -26,7 +26,7 @@ public:
   void output_lines ();
 
   Link_array<Item> broken_col_range (Item const*, Item const*) const;
-  Link_array<Grob> column_l_arr () const;
+  Link_array<Item> column_l_arr () const;
   
   void add_column (Paper_column*);
   void typeset_grob (Grob*);
index 0137a5c8a1926b7e77c9519113a00f3602ef3eb3..e46b406ce7adff1923fcf1da7bff2f7235c800d3 100644 (file)
@@ -17,13 +17,14 @@ class New_spacing_spanner
 {
 public:
   static void set_interface (Grob*);
-  static void do_measure (Grob*,Link_array<Grob> const &) ;
-  static void stretch_to_regularity (Grob*, Array<Spring> *, Link_array<Grob> const &);
+  static void do_measure (Grob*,Link_array<Item> const &) ;
+  static void stretch_to_regularity (Grob*, Array<Spring> *, Link_array<Item> const &);
   DECLARE_SCHEME_CALLBACK (set_springs, (SCM ));
   static Real stem_dir_correction (Grob*,Grob*,Grob*)  ;
   static Real default_bar_spacing (Grob*,Grob*,Grob*,Moment)  ;
   static Real note_spacing (Grob*,Grob*,Grob*,Moment)  ;
   static Real get_duration_space (Grob*,Moment dur, Moment shortest) ;
+  static void breakable_column_spacing (Item*,Item*);
 };
 
 #endif /* SPACING_SPANNER_HH */
index 2f13a107d21d609f78fc463efa299774170b95f2..2f12339490ad6b6060ae6097315513519ea9e9a6 100644 (file)
@@ -63,7 +63,10 @@ struct Spring_description
 struct Simple_spacer
 {
   Array<Spring_description> springs_;
+  Link_array<Item> spaced_cols_;
+  Link_array<Item> all_cols_; 
 
+  
   Real force_f_;
   Real indent_f_;
   Real line_len_f_;
@@ -71,9 +74,10 @@ struct Simple_spacer
 
 
   Simple_spacer ();
-  
+
+  void do_wide_springs (Column_x_positions*) const;
   void solve (Column_x_positions *) const;
-  void add_columns (Link_array<Grob>);
+  void add_columns (Link_array<Item>);
   void my_solve_linelen ();
   void my_solve_natural_len ();
   Real active_springs_stiffness () const;
index b045401a028d3fac6a21de30d72aefe824a8bbb0..fa3a92f1c792390ce53292b93deed467344fc7ca 100644 (file)
@@ -17,9 +17,10 @@ class Spacing_spanner
 {
 public:
   static void set_interface (Grob*);
-  static void do_measure (Grob*,Link_array<Grob> const &) ;
-  static void stretch_to_regularity (Grob*, Array<Spring> *, Link_array<Grob> const &);
+  static void do_measure (Grob*,Link_array<Item> const &) ;
+  static void stretch_to_regularity (Grob*, Array<Spring> *, Link_array<Item> const &);
   DECLARE_SCHEME_CALLBACK (set_springs, (SCM ));
+
   static Real stem_dir_correction (Grob*,Grob*,Grob*)  ;
   static Real default_bar_spacing (Grob*,Grob*,Grob*,Moment)  ;
   static Real note_spacing (Grob*,Grob*,Grob*,Moment)  ;
index f42c5fd1f6fcbadb101c1d692932af28cd19020c..d97cacba31ddb6b70921a21bf24768dbd891c300 100644 (file)
@@ -25,7 +25,6 @@ extern "C" {
 #include "string.hh"
 #include "main.hh"
 #include "kpath.hh"
-#include "lily-version.hh"
 
 
 char *
@@ -96,55 +95,7 @@ ly_init_kpath (char *av0)
    */
   kpse_set_program_name (av0, NULL);
   kpse_maketex_option ("tfm", TRUE);
-
-#if  0
-
-
-  /*
-    
-    Remove the setting for TFMFONTS if we have kpathsea, because
-    kpathsea can find TFM fonts anyway.
-
-    If we don't lily will want to make tfms for cmr fonts, even if
-    there is a :: entry in the TFMFONTS path.
-
-    This will fail if a user has special fonts (outside of feta) that
-    can not be found by kpath.
-
-    If TFMFONTS is unset, TFMs of feta will be generated on the
-    fly. The risk is that this will cause checksum mismatch errors,
-    but MF is reasonably deterministic (so we hope not).
-
-    The advantage is that the PK font will also be generated under
-    /var/texmf/fonts, reducing clutter and compilation time.
-
-   */
-
-#ifndef __CYGWIN__  /* mktextfm/mktexpk does not work on windows */
-  unsetenv ("TFMFONTS");
-#endif
-
-#ifdef DEBIAN
-  String my_tfm = "$VARTEXFONTS/tfm/public/lilypond";
-#else
-  String my_tfm = "$VARTEXFONTS/tfm/lilypond/";
-  my_tfm += version_str () + "/";
-#endif
-
-#ifdef DEBIAN
-  char * mypath = strdup ((my_tfm + ":").ch_C());
-  kpse_format_info[kpse_tfm_format].client_path = mypath;
-#else
-  char * mypath = kpse_expand (my_tfm.ch_C ());
-                          
-  String prog = "mktextfm --destdir ";
-  prog += mypath;
-  
-  kpse_format_info[kpse_tfm_format].program = strdup (prog.ch_C ());
-#endif
 #endif
-#endif
-  
 }
 
 
index 9c70f62adb98d0e8ee5c2200826270b801a93927..bb3384f0232329ddb2eb0cfe12f484f763023dc1 100644 (file)
@@ -132,7 +132,7 @@ Line_of_score::break_into_pieces (Array<Column_x_positions> const &breaking)
       Line_of_score *line_l = dynamic_cast <Line_of_score*> (clone ());
       line_l->rank_i_ = i;
       //      line_l->set_immutable_grob_property ("rank", gh_int2scm (i));
-      Link_array<Grob> c (breaking[i].cols_);
+      Link_array<Item> c (breaking[i].cols_);
       pscore_l_->typeset_line (line_l);
       
       line_l->set_bound (LEFT,c[0]);
@@ -393,11 +393,11 @@ Line_of_score::broken_col_range (Item const*l, Item const*r) const
    Return all columns, but filter out any unused columns , since they might
    disrupt the spacing problem.
  */
-Link_array<Grob>
+Link_array<Item>
 Line_of_score::column_l_arr ()const
 {
-  Link_array<Grob> acs
-    = Pointer_group_interface__extract_elements (this, (Grob*) 0, "columns");
+  Link_array<Item> acs
+    = Pointer_group_interface__extract_elements (this, (Item*) 0, "columns");
   bool bfound = false;
   for (int i= acs.size (); i -- ;)
     {
index 009dd0f0aa0f06d25cba8cedfbaf5d365936b271..324a6cd3776409bf4e5060594d4a50c751c6a56e 100644 (file)
@@ -39,7 +39,7 @@ New_spacing_spanner::set_interface (Grob*me)
   
  */
 void
-New_spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols) 
+New_spacing_spanner::do_measure (Grob*me, Link_array<Item> const & cols) 
 {
   Moment shortest;
   Moment mean_shortest;
@@ -77,30 +77,54 @@ New_spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols)
   Array<Spring> springs;
 
   Item * first_col = 0;
-  Item * last_col = 0;
-  
   for (int i= 0; i < cols.size () - 1; i++)
     {
       Item * l = dynamic_cast<Item*> (cols[i]);
 
-      if (!Paper_column::musical_b (l))
-       continue ;
-
-      if (!first_col)
+      if (!first_col && Paper_column::musical_b (l))
        first_col = l;
+
+      SCM between = cols[i]->get_grob_property ("between-cols"); 
+      if (gh_pair_p (between)
+         && i > 0
+         && i < cols.size ()-1
+         && (gh_cdr (between) != cols[i+1]->self_scm ()
+          || gh_car (between) != cols[i-1]->self_scm ()) 
+         )
+       continue ;
       
-      last_col = l;
       int j = i+1;
-      for (; j < cols.size () -1 ; j++)
-       if (Paper_column::musical_b (cols[j]))
-         break ;
-      
+      for (; j < cols.size () - 1; j++)
+       {
+         if  (Paper_column::musical_b (cols[j]))
+           break;
+
+         SCM between = cols[j]->get_grob_property ("between-cols");
+         if (!gh_pair_p (between))
+           continue;
+
+         if (gh_car (between) == cols[i]->self_scm () )
+           break ;
+       }
+
       Item * r =  dynamic_cast<Item*> (cols[j]);
       Paper_column * lc = dynamic_cast<Paper_column*> (l);
       Paper_column *rc = dynamic_cast<Paper_column*> (r);
-      if (!lc || !rc)
-       continue;
 
+
+      cout << "params for cols " << Paper_column::rank_i (l) << " " << Paper_column::rank_i (r) << endl;
+      cout << " musical: " << Paper_column::musical_b (l) << " " << Paper_column::musical_b (r) << endl;
+      if (!Paper_column::musical_b (l))
+       {
+         breakable_column_spacing (l, r);
+
+         l = l->find_prebroken_piece (RIGHT);
+         if (l)
+           breakable_column_spacing (l,r);
+
+         continue ; 
+       }
+      
       Real note_space = note_spacing (me,lc, rc, shortest <? base_shortest_duration);
       Real hinterfleisch = note_space;
       Real headwid = gh_scm2double (me->get_grob_property ("arithmetic-multiplier"));
@@ -139,11 +163,14 @@ New_spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols)
        }
     }
 
-  Item * l = dynamic_cast<Item*> (cols[0])->find_prebroken_piece (RIGHT);
+}
 
-  /*
-    TODO read different spacing hints from break-alignment.
-   */
+/*
+  Read hints from L (todo: R) and generate springs.
+ */
+void
+New_spacing_spanner::breakable_column_spacing (Item* l, Item *r)
+{
   Spring s;
 
   Real break_dist = 0.0;
@@ -167,11 +194,8 @@ New_spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols)
   s.distance_f_ = break_dist;
   s.strength_f_ = 1/break_stretch;
   s.item_l_drul_[LEFT] = l;
-  s.item_l_drul_[RIGHT] = first_col;
-
-  s.add_to_cols ();
+  s.item_l_drul_[RIGHT] = r;
 
-  s.item_l_drul_[LEFT] = dynamic_cast<Item*>(cols[0]);
   s.add_to_cols ();
 }
 
@@ -213,7 +237,7 @@ New_spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols)
 void
 New_spacing_spanner::stretch_to_regularity (Grob *me,
                                        Array<Spring> * springs,
-                                       Link_array<Grob> const & cols)
+                                       Link_array<Item> const & cols)
 {
   /*
     Find the starting column of the run. REGULAR-DISTANCE-TO points
@@ -225,7 +249,7 @@ New_spacing_spanner::stretch_to_regularity (Grob *me,
   for (int i = 0 ;  i <  cols.size () && !first_regular_spaced_col; i++)
     {
       SCM rdt = cols[i]->get_grob_property ("regular-distance-to");
-      if (cols.find_l (unsmob_grob (rdt)))
+      if (cols.find_l (dynamic_cast<Item*> (unsmob_grob (rdt))))
        first_regular_spaced_col = unsmob_grob (rdt);
     }
   for (int i = springs->size ();  i-- ;)
@@ -446,7 +470,7 @@ SCM
 New_spacing_spanner::set_springs (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-  Link_array<Grob> all (me->pscore_l_->line_l_->column_l_arr ()) ;
+  Link_array<Item> all (me->pscore_l_->line_l_->column_l_arr ()) ;
 
   int j = 0;
 
@@ -455,7 +479,7 @@ New_spacing_spanner::set_springs (SCM smob)
       Grob *sc = all[i];
       if (Item::breakable_b (sc))
         {
-         Link_array<Grob> measure (all.slice (j, i+1));          
+         Link_array<Item> measure (all.slice (j, i+1));          
           do_measure (me, measure);
          j = i;
         }
index 6d659d7064cd0576c3f222eb9bb227c2d3e1d914..0a9f8114b7507744f21399a2a6ac2fc6b254b6bf 100644 (file)
@@ -82,7 +82,7 @@ Paper_score::process ()
   /*
     Be sure to set breakability on first & last column.
    */
-  Link_array<Grob> pc (line_l_->column_l_arr ());
+  Link_array<Item> pc (line_l_->column_l_arr ());
   
   pc[0]->set_grob_property ("breakable", SCM_BOOL_T);
   pc.top ()->set_grob_property ("breakable", SCM_BOOL_T);
index 5ac89108964b20cb48853902c5d23a9da64c5b3a..d767d1bade302f61c32628c8e8b8233c2ee95889 100644 (file)
@@ -6,6 +6,7 @@
   (c) 1998--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
+#include <iostream.h>
 
 #include "separating-group-spanner.hh"
 #include "separation-item.hh"
@@ -25,6 +26,8 @@ protected:
     
    */
   Item * last_step_musical_malt_p_;
+  Item * last_nonnil_musical_malt_p_;
+  Item * last_nonnil_break_malt_p_;
   
   Spanner * sep_span_p_;
   
@@ -40,6 +43,9 @@ public:
 Separating_line_group_engraver::Separating_line_group_engraver ()
 {
   last_step_musical_malt_p_ = 0;
+  last_nonnil_break_malt_p_ = 0;
+  last_nonnil_musical_malt_p_ = 0;
+  
   sep_span_p_ = 0;
   break_malt_p_ = 0;
   musical_malt_p_ =0;
@@ -96,14 +102,50 @@ Separating_line_group_engraver::stop_translation_timestep ()
   if (break_malt_p_)
     {
       Separating_group_spanner::add_spacing_unit (sep_span_p_, break_malt_p_);
-      
+
       typeset_grob (break_malt_p_);
+
+      last_nonnil_break_malt_p_ = break_malt_p_;
       break_malt_p_ =0;
     }
+
   if (musical_malt_p_)
     {
       Separating_group_spanner::add_spacing_unit (sep_span_p_, musical_malt_p_);
 
+
+      /* TODO
+
+        move this mucketry into separation-spanner.
+        
+       */
+      if (last_nonnil_break_malt_p_ && last_nonnil_musical_malt_p_)
+       {
+         cout << now_mom ().str () <<endl;
+         Item *col =     last_nonnil_break_malt_p_->column_l();
+         if (!col)
+           col = dynamic_cast<Item*> (unsmob_grob (get_property ("currentCommandColumn")));
+         
+         SCM between = col->get_grob_property ("between-cols");
+
+         SCM left = last_nonnil_musical_malt_p_->column_l()->self_scm ();
+         SCM right = get_property ("currentMusicalColumn"); // musical_malt_p_->column_l()->self_scm ();
+         if (gh_pair_p (between))
+           {
+             /*
+               ugh. set_..._x ()
+              */
+             if (Paper_column::rank_i (unsmob_grob (gh_car (between))) < Paper_column::rank_i (unsmob_grob (left)))
+               gh_set_car_x (between, left);
+             if (Paper_column::rank_i (unsmob_grob (gh_cdr (between))) > Paper_column::rank_i (unsmob_grob (right)))
+               gh_set_cdr_x (between, right);
+           }
+         else
+           {
+             col->set_grob_property ("between-cols", gh_cons (left, right));
+           }
+       }
+      
       if (last_step_musical_malt_p_)
        {
          Paper_column *col = 
@@ -114,7 +156,11 @@ Separating_line_group_engraver::stop_translation_timestep ()
                                  gh_cons (newtup,
                                           col->get_grob_property ("spacing-sequence")));
        }
+
       
+
+      last_nonnil_break_malt_p_ = 0;
+      last_nonnil_musical_malt_p_ = musical_malt_p_;
       typeset_grob (musical_malt_p_);
     }
   last_step_musical_malt_p_ = musical_malt_p_;
index 0340596ad3b0168e01be82028e209f3a79143165..f058f56f4fd18b9c10df87952d14887ab2e708b5 100644 (file)
@@ -13,6 +13,7 @@
 #include <math.h>
 #include <libc-extension.hh>   // isinf
 
+#include "string-convert.hh"
 #include "simple-spacer.hh"
 #include "paper-column.hh"
 #include "spring.hh"
@@ -165,55 +166,66 @@ Simple_spacer::my_solve_natural_len ()
 }
 
 void
-Simple_spacer::add_columns (Link_array<Grob> cols)
+Simple_spacer::add_columns (Link_array<Item> cols)
 {
+  for (int i =0; i < cols.size (); i++)
+    all_cols_.push ( dynamic_cast<Item*> (cols[i]));
+
+  Grob *next = 0;  
   for (int i=0; i < cols.size () - 1; i++)
     {
       SCM spring_params = SCM_UNDEFINED;
+
+      if (next && cols[i] != next)
+       continue;
+
       for (SCM s = cols[i]->get_grob_property ("ideal-distances");
-          spring_params == SCM_UNDEFINED && gh_pair_p (s);
+          !gh_pair_p (spring_params) && gh_pair_p (s);
           s = gh_cdr (s))
        {
          Grob *other = unsmob_grob (gh_caar (s));
-         if (other != cols[i+1])
+         int j = i+1;
+         for (; j < cols.size (); j++)
+           if (cols[j] == other)
+             break;
+
+         if(j == cols.size ())
            continue;
 
+         next = other;
          spring_params = gh_cdar (s);
        }
 
       Spring_description desc;
-      if (spring_params != SCM_UNDEFINED)
+      desc.ideal_f_ = -1;
+      if (gh_pair_p(spring_params))
        {
          desc.ideal_f_ = gh_scm2double (gh_car (spring_params));
          desc.hooke_f_ = gh_scm2double (gh_cdr (spring_params));
        }
-      else
+
+      if (gh_pair_p (spring_params) && desc.sane_b ())
        {
-         programming_error (_f("No spring between column %d and next one",
-                               Paper_column::rank_i (cols[i])
-                               ));
-         desc.hooke_f_ = 1.0;
-         desc.ideal_f_ = default_space_f_;
+         spaced_cols_.push (dynamic_cast<Item*> (cols[i]));
+         desc.block_force_f_ = - desc.hooke_f_ * desc.ideal_f_; // block at distance 0
+         springs_.push (desc);
        }
-
-      if (!desc.sane_b ())
+      else if (gh_pair_p (spring_params) && !desc.sane_b ())
        {
-         programming_error ("Insane spring found. Setting to unit spring.");
-         desc.hooke_f_ = 1.0;
-         desc.ideal_f_ = 1.0;
+         programming_error (String_convert::form_str  ("insane springs at col %d", Paper_column::rank_i (cols[i])));
+         // Generate rods for these cols. 
        }
-      
-      desc.block_force_f_ = - desc.hooke_f_ * desc.ideal_f_; // block at distance 0
-      springs_.push (desc);
     }
+
+  spaced_cols_.push (all_cols_.top ());
   
-  for (int i=0; i < cols.size () - 1; i++)
+  for (int i=0; i < spaced_cols_.size () - 1; i++)
     {
-      for (SCM s = Spaceable_grob::get_minimum_distances (cols[i]);
+      for (SCM s = Spaceable_grob::get_minimum_distances (spaced_cols_[i]);
           gh_pair_p (s); s = gh_cdr (s))
        {
-         Grob * other = unsmob_grob (gh_caar (s));
-         int oi = cols.find_i (other);
+         Item * other = dynamic_cast<Item*> (unsmob_grob (gh_caar (s)));
+         int oi = spaced_cols_.find_i (other);
          if (oi >= 0)
            {
              add_rod (i, oi, gh_scm2double (gh_cdar (s)));
@@ -242,6 +254,60 @@ Simple_spacer::solve (Column_x_positions *positions) const
     }
 
   positions->satisfies_constraints_b_ = (line_len_f_ < 0) || active_b ();
+  positions->cols_ = spaced_cols_;
+  do_wide_springs (positions);
+}
+
+/*
+  Do the columns whose springs didn't paricipate in the spacing process
+ */
+void
+Simple_spacer::do_wide_springs ( Column_x_positions *positions_)const
+{
+  int i  = 0;
+
+
+  Array<Real> all_posns;
+  for (int j = 0; j < all_cols_.size () && i < spaced_cols_.size (); j++)
+    {
+      if (all_cols_[j] == spaced_cols_[i])
+       {
+         all_posns.push (positions_->config_[i] );
+         i++;
+         continue;
+       }
+
+
+      SCM between = all_cols_[j]->get_grob_property ("between-cols");
+      if (!gh_pair_p (between))
+       {
+         programming_error (String_convert::form_str ("loose column rank %d not beween spaced cols", Paper_column::rank_i (all_cols_[j] )));
+         all_posns.push (positions_->config_[i]);
+         continue;
+       }
+      
+      Item * prev = dynamic_cast<Item*>  (unsmob_grob (gh_car (between)));
+      Item *next = dynamic_cast<Item*> (unsmob_grob (gh_cdr (between)));
+      int ip = i;
+      int in = i;
+      for (; ip--; )
+       if(spaced_cols_[ip] == prev)
+         break;
+
+      for (; in < spaced_cols_.size (); in++)
+       if(spaced_cols_[in] == next)
+         break;
+
+      // TODO: compute iso. 0.5
+      if (ip >= 0 && in < positions_->config_.size ())
+       all_posns.push (0.5 * (positions_->config_[ip] + positions_->config_[in]));
+      else
+       all_posns.push (positions_->config_[i]);
+      
+    }
+
+  positions_->config_ = all_posns;
+  positions_->cols_ = all_cols_;
 }
 
 
index e5a519f1ea9e2e5914df4346e4e486ab431ed7ff..9b281e83b044bf05f8e02114e12b4bb7aec9fc57 100644 (file)
@@ -104,7 +104,7 @@ find_runs (Grob*me, Link_array<Grob> cols)
   
  */
 void
-Spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols) 
+Spacing_spanner::do_measure (Grob*me, Link_array<Item> const & cols) 
 {
   Moment shortest;
   Moment mean_shortest;
@@ -313,7 +313,7 @@ Spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols)
 void
 Spacing_spanner::stretch_to_regularity (Grob *me,
                                        Array<Spring> * springs,
-                                       Link_array<Grob> const & cols)
+                                       Link_array<Item> const & cols)
 {
   /*
     Find the starting column of the run. REGULAR-DISTANCE-TO points
@@ -325,7 +325,7 @@ Spacing_spanner::stretch_to_regularity (Grob *me,
   for (int i = 0 ;  i <  cols.size () && !first_regular_spaced_col; i++)
     {
       SCM rdt = cols[i]->get_grob_property ("regular-distance-to");
-      if (cols.find_l (unsmob_grob (rdt)))
+      if (cols.find_l (dynamic_cast<Item*> (unsmob_grob (rdt))))
        first_regular_spaced_col = unsmob_grob (rdt);
     }
   for (int i = springs->size ();  i-- ;)
@@ -553,16 +553,16 @@ SCM
 Spacing_spanner::set_springs (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-  Link_array<Grob> all (me->pscore_l_->line_l_->column_l_arr ()) ;
+  Link_array<Item> all (me->pscore_l_->line_l_->column_l_arr ()) ;
 
   int j = 0;
 
   for (int i = 1; i < all.size (); i++)
     {
-      Grob *sc = all[i];
+      Item *sc = all[i];
       if (Item::breakable_b (sc))
         {
-         Link_array<Grob> measure (all.slice (j, i+1));          
+         Link_array<Item> measure (all.slice (j, i+1));          
           do_measure (me, measure);
          j = i;
         }
index 5d4b0a5e0109cc1aecdf241d69d867a3f5f43342..5c3d0421e9ab224d4a7593eb2df7b8c46871eb59 100644 (file)
@@ -38,7 +38,7 @@ Stanza_number_engraver::Stanza_number_engraver ()
 }
 
 void
-Stanza_number_engraver::acknowledge_grob (Grob_info i)
+Stanza_number_engraver::acknowledge_grob (Grob_info )
 {
   if (gh_string_p (get_property ("whichBar")))
     {
index a66b6ddadc405275395e6dc327e7d2081edd2d9c..4eb74a3e747ab8dfaed96e337ec2718369ac926e 100644 (file)
@@ -2,7 +2,7 @@
 ;;;;
 ;;;;  source file of the GNU LilyPond music typesetter
 ;;;; 
-;;;; (c) 1998--2001  Han-Wen Nienhuys <hanwen@cs.uu.nl>
+;;;; (c) 1998--20.301  Han-Wen Nienhuys <hanwen@cs.uu.nl>
 ;;;;                 Jan Nieuwenhuizen <janneke@gnu.org>
 
 ; distances are given in stafflinethickness (thicknesses) and
        (Script . (
                ;; don't set direction here: it breaks staccato.
                (molecule-callback . ,Script::brew_molecule)
-               (padding . 0.3
+               (padding . 0.29
                (X-offset-callbacks . (,Side_position_interface::centered_on_parent))
                (before-line-breaking-callback . ,Script::before_line_breaking)
                (meta . ,(grob-description "Script" script-interface side-position-interface font-interface))