]> git.donarmstrong.com Git - lilypond.git/commitdiff
* input/mutopia/J.S.Bach/baerenreiter-sarabande.ly: Warn when not
authorJan Nieuwenhuizen <janneke@gnu.org>
Tue, 23 Jul 2002 21:32:50 +0000 (21:32 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Tue, 23 Jul 2002 21:32:50 +0000 (21:32 +0000)
using 6 systems, like the original.

* lily/spanner.cc (get_broken_into):
* lily/grob.cc (original_scm, line_scm): New function.

* lily/include/grob.hh (ly_scm2grob_array): Moved from
group-interface.hh and renamed.
(ly_grob_array2scm): New function.

ChangeLog
input/mutopia/J.S.Bach/baerenreiter-sarabande.ly
lily/grob.cc
lily/include/grob.hh
lily/include/group-interface.hh
lily/include/spanner.hh
lily/slur.cc
lily/spanner.cc

index 65be160e05b387218c7fc4a90112f4628abb3d1a..04f5f0a3f743c1d672f241c9b4407d577926ab86 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2002-07-23  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * input/mutopia/J.S.Bach/baerenreiter-sarabande.ly: Warn when not
+       using 6 systems, like the original.
+
+       * input/test/count-systems.ly: New file.
+
+       * lily/spanner.cc (get_broken_into):
+       * lily/grob.cc (original_scm, line_scm): New function.
+
+       * lily/include/grob.hh (ly_scm2grob_array): Moved from
+       group-interface.hh and renamed.
+       (ly_grob_array2scm): New function.
+
 2002-07-23  Juergen Reuter  <reuter@ipd.uka.de>
 
        * lily/ambitus-engraver.cc: bugfix: create ambitus grob during
index baf7ce50b5e4dce24c36382e8919e77c185c8ccb..7c1a780c08c77efc3dc14a4b9190a44823b5603e 100644 (file)
@@ -1,6 +1,19 @@
 
 %% #(set! point-and-click line-column-location)
 
+%% We want this to perfectly match the Baerenreiter spacing.
+%% If we're not using 6 systems, there's definately a problem.
+#(define (assert-system-count smob n)
+  (let ((systems (length (Spanner::get_broken_into
+                         (Grob::original_scm
+                          (Grob::line_scm smob))))))
+    (if (not (equal? n systems))
+       ;; Can't use error yet, as we know that we're not using 6...
+       ;;(error
+       (warn
+       (string-append "Got " (number->string systems)
+                            " systems (expecting " (number->string n))))))
+            
 \header {
   title = "Solo Cello Suite II"
   piece ="Sarabande"
@@ -101,7 +114,12 @@ sarabandeA =  \context Voice \notes \relative c {
   [a,8 e']
   \oneVoice
   [d' cis] |
-  d4 d,,2 |
+  %%  d4 d,,2 |
+  d4
+  \property Thread.NoteHead
+  \override #'after-line-breaking-callback
+  = #(lambda (smob) (assert-system-count smob 6))
+  d,,2 |
 }
 
 
index 9394dac32181363a9915fff4424874843b8f4beb..f4cb9937b19db23390ae3edddbc97e1a88030363 100644 (file)
@@ -308,6 +308,28 @@ Grob::line_l () const
   return 0;
 }
 
+MAKE_SCHEME_CALLBACK (Grob, line_scm, 1);
+SCM
+Grob::line_scm (SCM smob)
+{
+  Grob *me = unsmob_grob (smob); 
+  if (Grob *g = me->line_l ())
+    return g->self_scm ();
+      
+  return SCM_EOL;
+}
+
+MAKE_SCHEME_CALLBACK (Grob, original_scm, 1);
+SCM
+Grob::original_scm (SCM smob)
+{
+  Grob *me = unsmob_grob (smob);
+  if (me->original_l_)
+    return me->original_l_->self_scm ();
+      
+  return SCM_EOL;
+}
+
 void
 Grob::add_dependency (Grob*e)
 {
index 71921452e368a6488d522caffe60ac2e4738e63d..bc62ac7e25e8b3daafb35de22a505a9982a10fe9 100644 (file)
@@ -154,6 +154,8 @@ public:
   
   Grob *get_parent (Axis a) const {   return  dim_cache_[a].parent_l_; }
   DECLARE_SCHEME_CALLBACK (fixup_refpoint, (SCM));
+  DECLARE_SCHEME_CALLBACK (original_scm, (SCM smob));
+  DECLARE_SCHEME_CALLBACK (line_scm, (SCM smob));
 };
 
 DECLARE_UNSMOB(Grob,grob);
@@ -167,5 +169,34 @@ void set_break_subsititution (SCM criterion);
 SCM substitute_mutable_property_alist (SCM alist);
 
 
+/** Return Array of Grobs in SCM list L */
+inline Link_array<Grob>
+ly_scm2grob_array (SCM l)
+{
+  Link_array<Grob> arr;
+
+  for (SCM s = l; gh_pair_p (s); s = gh_cdr (s))
+    {
+      SCM e = gh_car (s);
+      arr.push (unsmob_grob (e));
+    }
+
+  arr.reverse ();
+  return arr;
+}
+
+#if 0
+/** Return SCM list of Grob array A */
+inline SCM
+ly_grob_array2scm (Link_array<Grob> a)
+{
+  SCM s = SCM_EOL;
+  for (int i = a.size (); i; i--)
+    s = gh_cons (a[i-1]->self_scm (), s);
+
+  return s;
+}
+#endif
+
 #endif // STAFFELEM_HH
 
index 5ee3a085e59d54f5ede1f9cf3fc9a70556013425..7d88d5674ed5da1a92884544ccdb12743b3e10ae 100644 (file)
@@ -35,24 +35,6 @@ struct Pointer_group_interface : public Group_interface {
 public:
   static void add_grob (Grob*, SCM nm, Grob*e);
 };
-/** 
-  Put all score elements of ELT's property called NAME into an array,
-  and return it.  */
-
-inline Link_array<Grob>
-list_to_grob_array (SCM l)
-{
-  Link_array<Grob> arr;
-
-  for (SCM s = l; gh_pair_p (s); s = gh_cdr (s))
-    {
-      SCM e = gh_car (s);
-      arr.push (unsmob_grob (e));
-    }
-
-  arr.reverse ();
-  return arr;
-}
 
 template<class T>
 Link_array<T>
index 5457c666381f3e71f636ffd8a0cb99d5bd396bd0..cc0bd57753079627b630bc8b90cdd7c9d84e227c 100644 (file)
@@ -33,7 +33,8 @@ class Spanner : public  Grob {
   Drul_array<Item*> spanned_drul_;
 
 public:
-  DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM ));
+  DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
+  DECLARE_SCHEME_CALLBACK (get_broken_into, (SCM));
   
   Link_array<Spanner> broken_into_l_arr_;
 
index 1861eb18c4d8123bc6dd097a3e925e9e50c90b05..424aa55765ee4d26c849620d5ef487931d7e6f9a 100644 (file)
@@ -462,7 +462,7 @@ Slur::get_encompass_offset_arr (Grob *me)
   common[X_AXIS] = common[X_AXIS]->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
   common[X_AXIS] = common[X_AXIS]->common_refpoint (sp->get_bound (LEFT), X_AXIS);
   
-  Link_array<Grob>  encompass_arr = list_to_grob_array (eltlist);
+  Link_array<Grob>  encompass_arr = ly_scm2grob_array (eltlist);
   Array<Offset> offset_arr;
 
   Offset origin (me->relative_coordinate (common[X_AXIS], X_AXIS),
index 0c11f2833ab4be321755bd9115772e84c3600e13..7cae376694708d71bdb77c3db953e4383e52bc89 100644 (file)
 #include "system.hh"
 #include "group-interface.hh"
 
+
+MAKE_SCHEME_CALLBACK (Spanner, get_broken_into, 1);
+SCM
+Spanner::get_broken_into (SCM smob)
+{
+  if (Spanner *me = dynamic_cast<Spanner*> (unsmob_grob (smob)))
+#if 0    
+    return ly_grob_array2scm (me->broken_into_l_arr_);
+#else
+  {
+      SCM s = SCM_EOL;
+      for (int i = me->broken_into_l_arr_.size (); i; i--)
+       s = gh_cons (me->broken_into_l_arr_[i-1]->self_scm (), s);
+      return s;
+  }
+#endif
+  
+  return SCM_EOL;
+}
+
 void
 Spanner::do_break_processing ()
 {