]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/grob.cc (programming_error): add Grob::programming_error with
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 19 Jun 2002 18:30:36 +0000 (18:30 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 19 Jun 2002 18:30:36 +0000 (18:30 +0000)
origin location.

* lily/tuplet-bracket.cc (parallel_beam): robustness check, don't
fail if a beam doesn't have stems.

* lily/engraver-group-engraver.cc (do_announces): scary change in
calling convention of create_grobs():  no create_grobs() call
before acknowledge_grobs().

* lily/sequential-music-iterator.cc (skip): add support for grace
notes.

ChangeLog
Documentation/regression-test.tely
input/regression/grace-part-combine.ly [new file with mode: 0644]
lily/engraver-group-engraver.cc
lily/global-translator.cc
lily/grob.cc
lily/include/grob.hh
lily/item.cc
lily/sequential-music-iterator.cc
lily/tuplet-bracket.cc

index 2fa4e6226c8170cd988748df96f9c0678b55e8c0..7bd0c65d24002b503228c73f4a645a9e8e67ea01 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,21 @@
 2002-06-19  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
+       * lily/grob.cc (programming_error): add programming_error with
+       origin location.  
+
+       * lily/tuplet-bracket.cc (parallel_beam): robustness check, don't
+       fail if a beam doesn't have stems.  
+
+       * lily/engraver-group-engraver.cc (do_announces): scary change in
+       calling convention of create_grobs():  no create_grobs() call
+       before acknowledge_grobs().
+
+       * lily/sequential-music-iterator.cc (skip): add support for grace
+       notes. 
+
        * lily/music.cc (Music): fix very subtle and nasty memory
-       corruption bug.
+       corruption bug. Typical symptom: "programming_error: Rhythmic_req
+       has no duration"
 
        * mutopia/claop.py: new file: CLA(O)P II by Peter Wallin.
 
index 28717c25ae8e8b5128e11d71bb107636d3d44e91..694fca3513db82530923fcdfb159ccb5f9bb0d0c 100644 (file)
@@ -141,6 +141,8 @@ Grace note do weird things with timing. Fragile.
 
 @lilypondfile[printfilename]{grace-sync.ly}
 
+@lilypondfile[printfilename]{grace-part-combine.ly}
+
 @lilypondfile[printfilename]{grace-bar-number.ly}
 
 
diff --git a/input/regression/grace-part-combine.ly b/input/regression/grace-part-combine.ly
new file mode 100644 (file)
index 0000000..bec2319
--- /dev/null
@@ -0,0 +1,17 @@
+\header {
+    texidoc = "partcombiner and grace notes can go together"
+}
+
+\score {
+    \context StaffGroup = group <
+       \context Staff = instrument <
+           \context Voice=one \partcombine Voice
+           \context Thread=one \notes \relative c'' {
+               c4 d e f  \grace f16 g1
+           }
+           \context Thread=two \notes \relative c' {
+               c4 d e2  g1
+           }
+       >
+    >
+}
index 7bd0641015f6050e138c5e7fce8c55fb9df7c34c..518d277d592fc2ba588bcb834ed02746f3c26cb5 100644 (file)
@@ -125,7 +125,7 @@ Engraver_group_engraver::do_announces ()
       dynamic_cast<Engraver_group_engraver*> (t)->do_announces ();
     }
 
-  create_grobs_in_simple_children ();
+  //  create_grobs_in_simple_children ();
     
   while (announce_info_arr_.size ())
     {
index a7fb3e0c3c0f5f946e1e8f19a3ddb9bf600c7e17..9ee578925abe5c49f1e2f874fef42d57c26c7369 100644 (file)
@@ -5,6 +5,7 @@
 
   (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
+#include <stdio.h>
 
 #include "debug.hh"
 #include "music.hh"
@@ -97,8 +98,9 @@ Global_translator::run_iterator_on_me (Music_iterator * iter)
        }
 
       w = sneaky_insert_extra_moment (w);
+      
+      //      printf ("proccing %s\n ",       w.str().ch_C());
 
-      //      cout << "Proccing " << w << endl;
 
       
       if (first)
index b61e151e34ddd6927d767260e9e09ab589b4fe8b..08d263bcf6d30f966a10194dff7419c95ac176d7 100644 (file)
@@ -791,7 +791,7 @@ Grob::fixup_refpoint (SCM smob)
 }
 
 void
-Grob::warning (String s)
+Grob::warning (String s)const
 {
   SCM cause = self_scm();
   while (cause != SCM_EOL && !unsmob_music (cause))
@@ -806,7 +806,13 @@ Grob::warning (String s)
     }
   else
     ::warning (s);
-      
+}
+
+void
+Grob::programming_error (String s)const
+{
+  s = "Programming error: "  + s;
+  warning (s);
 }
 
 
index c01a5fe7a798edaa953bef0fbfd9e24d995e42b2..792cdf8f9e36375db413d0431e91bc1ef02bc7a6 100644 (file)
@@ -70,7 +70,8 @@ public:
   SCM internal_get_grob_property (SCM) const;
   void internal_set_grob_property (SCM, SCM val);
   
-  void warning (String);
+  void warning (String)const;
+  void programming_error (String)const;
   
   void set_elt_pointer (const char*, SCM val);
   friend class Property_engraver; //  UGHUGHUGH.
index abae1689a6ad828a82430caa84b59435ad395cff..d6214c5b6a8e2e0e89cc887047af582a265ef873 100644 (file)
@@ -41,7 +41,7 @@ Item::breakable_b (Grob*me)
     return false;
 
   if (!dynamic_cast<Item*> (me))
-    programming_error ("only items can be breakable.");
+    me->programming_error ("only items can be breakable.");
   
   Item * i  =dynamic_cast<Item*> (me->get_parent (X_AXIS));
   return (i) ?  Item::breakable_b (i) : to_boolean (me->get_grob_property ("breakable"));
index 61cf029270af6e2f81748408fdf42ecdb36613ce..b3d0e5bc09f30de01ec65b61010cbd822cd9a2ad 100644 (file)
@@ -11,6 +11,8 @@
 #include "sequential-music-iterator.hh"
 #include "music-list.hh"
 
+Grace_fixup *copy_grace_fixups (Grace_fixup* src);
+Grace_fixup *get_grace_fixups (SCM cursor);
 
 /*
   
@@ -59,7 +61,7 @@ Sequential_music_iterator::Sequential_music_iterator ()
 Sequential_music_iterator::Sequential_music_iterator (Sequential_music_iterator const &src)
   : Music_iterator (src)
 {
-  grace_fixups_ = src.grace_fixups_;
+  grace_fixups_ = copy_grace_fixups (src.grace_fixups_);
   cursor_ = src.cursor_;
   here_mom_ = src.here_mom_;
   if (src.iter_p_)
@@ -74,17 +76,6 @@ Sequential_music_iterator::~Sequential_music_iterator ()
 }
 
 
-/*
-
-
-  if (start_music.grace)
-    here.grace -= start_music.grace
-
-  last
-  if (len
-  
- */
-
 Grace_fixup *
 get_grace_fixups (SCM cursor)
 {
@@ -124,6 +115,23 @@ get_grace_fixups (SCM cursor)
   return  head;
 }
 
+Grace_fixup *
+copy_grace_fixups (Grace_fixup* src)
+{
+  
+  Grace_fixup * head = 0;
+  Grace_fixup **dest = &head;
+
+  while (src)
+    {
+      *dest = new Grace_fixup (*src);
+      dest = & (*dest)->next_;
+      src = src ->next_;
+    }
+
+  return head;
+}
+
 void
 Sequential_music_iterator::construct_children ()
 {
@@ -264,16 +272,25 @@ Sequential_music_iterator::get_music (Moment until)const
   descending to child iterator contexts, because they might depend on
   \context specs and \translator changes being executed
 
-  TODO: build support for grace notes here.
+  TODO: check support for grace notes here.
  */
 void
 Sequential_music_iterator::skip (Moment until)
 {
   while (ok ())
     {
-      Moment l =iter_p_->music_length_mom ();
-      if (l >= until - here_mom_)
-       iter_p_->skip (until - here_mom_);
+      if (grace_fixups_ &&
+         grace_fixups_->start_ == here_mom_
+         && (grace_fixups_->start_ + grace_fixups_->length_
+             + Moment (Rational (0), grace_fixups_->grace_start_) == until))
+       {
+         /*
+           do the stuff/note/rest preceding a grace.
+          */
+         iter_p_->skip (iter_p_->music_length_mom ());
+       }
+      else if (iter_p_->music_length_mom () >= until - here_mom_)
+       iter_p_->skip (until - here_mom_ + iter_p_->music_start_mom ());
 
       if (iter_p_->ok ())
        return ; 
index e458287cc75cdf7f9f3c19a48d5cfc356d241e8b..b58cd43d01dbf97d572bd9a460633990d3efe1a7 100644 (file)
@@ -75,6 +75,12 @@ Tuplet_bracket::parallel_beam (Grob *me, Link_array<Grob> const &cols, bool *equ
   Link_array<Grob> beam_stems = Pointer_group_interface__extract_grobs
     (b1, (Grob*)0, "stems");
 
+  if (beam_stems.size() == 0)
+    {
+      programming_error ("Beam under tuplet bracket has no stems!");
+      *equally_long = 0;
+      return 0;
+    }
   
   *equally_long = (beam_stems[0] == s1 && beam_stems.top() == s2);
   return b1;