]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.5.17
authorfred <fred>
Wed, 27 Mar 2002 02:03:37 +0000 (02:03 +0000)
committerfred <fred>
Wed, 27 Mar 2002 02:03:37 +0000 (02:03 +0000)
lily/include/new-spacing-spanner.hh
lily/new-spacing-spanner.cc
lily/slur.cc
lily/spacing-spanner.cc
scm/engraver-documentation-lib.scm

index ac1ac8069601db3d82dbf9119da53c120da249c2..6238dde3f1e268f2a6eb29f2477b1481dd04d411 100644 (file)
 #ifndef SPACING_SPANNER_HH
 #define SPACING_SPANNER_HH
 
-#include "spanner.hh"
-#include "spring.hh"
-
-class New_spacing_spanner
-{
-public:
-  static void set_interface (Grob*);
-  static void do_measure (Grob*,Link_array<Grob> *) ;
-  static void stretch_to_regularity (Grob*, Array<Spring> *, Link_array<Grob> const &);
-  static void breakable_column_spacing (Item* l, Item *r);
-  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) ;
-};
-
-#endif /* SPACING_SPANNER_HH */
-
index 682dc0847fcee1b78fdd06dd15396b8e1f01a606..5fc0aaf4987eff3836db7b5122f6e252224c12ee 100644 (file)
@@ -7,7 +7,6 @@
   
  */
 
-#include "new-spacing-spanner.hh"
 #include "paper-column.hh"
 #include "dimensions.hh"
 #include "paper-def.hh"
 #include "line-of-score.hh"
 #include "misc.hh"
 #include "separation-item.hh"
+#include "spanner.hh"
+#include "spring.hh"
 
+class New_spacing_spanner
+{
+public:
+  static void set_interface (Grob*);
+  static void do_measure (Grob*,Link_array<Grob> *) ;
+  static void stretch_to_regularity (Grob*, Array<Spring> *, Link_array<Grob> const &);
+  static void breakable_column_spacing (Item* l, Item *r);
+  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 prune_loose_colunms (Link_array<Grob>*);
+};
 
 void
 New_spacing_spanner::set_interface (Grob*me)
@@ -25,6 +40,29 @@ New_spacing_spanner::set_interface (Grob*me)
   me->set_extent_callback (SCM_EOL, Y_AXIS) ; 
 }
 
+/*
+  Remove all columns that are not tightly
+  fitting part of the spacing problem.
+ */
+void
+New_spacing_spanner::prune_loose_colunms (Link_array<Grob> *cols)
+{
+  for (int i = cols->size(); i--;)
+    {
+      SCM between = cols->elem(i)->get_grob_property ("between-cols");
+      if (!gh_pair_p (between))
+       continue;
+
+      Item * l = dynamic_cast<Item*> (unsmob_grob (gh_car (between)));
+      Item * r = dynamic_cast<Item*> (unsmob_grob (gh_cdr (between)));      
+      if (l->column_l () != cols->elem (i-1)
+         || r->column_l () != cols->elem (i +1))
+       {
+         cols->del (i);
+       }
+    }
+}
+
 /*
 
   The algorithm is partly taken from :
@@ -49,12 +87,7 @@ New_spacing_spanner::do_measure (Grob*me, Link_array<Grob> *cols)
   Moment base_shortest_duration = *unsmob_moment (me->get_grob_property ("maximum-duration-for-spacing"));
   shortest_in_measure.set_infinite (1);
 
-  for (int i = cols->size(); i--;)
-    {
-      if (gh_pair_p (cols->elem(i)->get_grob_property ("between-cols")))
-       cols->del (i);
-    }
-  
+  prune_loose_colunms (cols);
 
   for (int i =0 ; i < cols->size (); i++)  
     {
index 4cc9bf3e5a6aadc91eadd3b99ee8617d3532df67..e0f4836d04383cc9f29918df6335fb78f3d8e9e3 100644 (file)
@@ -175,7 +175,17 @@ Slur::set_extremities (Grob *me)
   Direction dir = LEFT;
   do 
     {
-      if (!gh_symbol_p (index_cell (me->get_grob_property ("attachment"), dir)))
+      SCM att = me->get_grob_property ("attachment");
+      /*
+       */
+      if (!gh_pair_p (att))
+       {
+         programming_error ("attachment is not a cons?!");
+         att = gh_cons (SCM_EOL, SCM_EOL);
+         me->set_grob_property ("attachment", att);
+       }
+      
+      if (!gh_symbol_p (index_cell (att, dir)))
        {
          for (SCM s = me->get_grob_property ("extremity-rules");
               s != SCM_EOL; s = ly_cdr (s))
@@ -184,7 +194,7 @@ Slur::set_extremities (Grob *me)
                                 gh_int2scm ((int)dir));
              if (r != SCM_BOOL_F)
                {
-                 index_set_cell (me->get_grob_property ("attachment"), dir,
+                 index_set_cell (att, dir,
                                  ly_cdar (s));
                  break;
                }
index 6a0a62806e6e3f06be69755586e51c7826fe392c..92b7cb748017c229603bfc368b0d5d7b3015ddfd 100644 (file)
@@ -23,73 +23,6 @@ Spacing_spanner::set_interface (Grob*me)
   me->set_extent_callback (SCM_EOL, Y_AXIS) ; 
 }
 
-#if 0  
-struct Note_run
-{
-  Array<int> idxes;
-  int start, end;
-  Moment duration;
-  int count;
-};
-
-int
-column_compare (Grob  *const &t1, Grob *const &t2)
-{
-  return Moment::compare (Paper_column::when_mom (t1),
-                         Paper_column::when_mom (t2));
-}
-
-
-Note_run
-run_length (Moment dt, int i, Array<Moment> const &moms,
-           Link_array<Note_run> runs)
-{
-  int k = 0;
-  Array<int> idxes;
-
-  idxes.push (i);
-  while (1)
-    {
-      Moment next = moms[i] + dt;
-      while (i < moms.size () && moms[i] < next)
-       i++;
-      if (i == moms.size () || moms[i] != next)
-       break;
-
-      idxes.push (i);
-      k++;
-    }
-
-  Moment dur = idxes.size ()
-}
-
-void
-find_runs (Grob*me, Link_array<Grob> cols) 
-{
-  Link_array<Grob> filter_cols;
-  Array<Moment> col_moments;
-  for (int i = 0; i < cols.size (); i++)
-    {
-      Moment w =  Paper_column::when_mom (cols[i]);
-      
-      if (!w.grace_part_ && Paper_column::musical_b (cols[i]))
-       {
-         filter_cols.push (cols[i]);
-         col_moments.push (w);
-       }
-    }
-
-  Moment end_mom = col_moments.top ();
-  for (int i = 0; i < col_moments.size () ; i++)
-    {
-      for (int j = i+1; j < col_moments.size (); j++)
-       {
-         Moment dt = Paper_column::col_momentsfilter_cols 
-       }
-    }
-}
-#endif  
-
 /*
 
   The algorithm is partly taken from :
index e19bce865b795b4f831fdf9d4afdbd32fd761de8..f1e67ab88db82e34b0b235a9e9583266c2dafb40 100644 (file)
@@ -7,7 +7,6 @@
 ;;; Jan Nieuwenhuizen <janneke@gnu.org>
 
 
-(eval-string (ly-gulp-file "translator-description.scm"))
 
 ;; alist of translater descriptions
 (define (document-translator-property sym)