]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/repeated-music.cc
* lily/include/lily-guile.hh: many new ly_ functions. Thanks to
[lilypond.git] / lily / repeated-music.cc
index 28b2c0aca6ef56ec39510c83d2dfa25a27cc20db..7aa77605fc1381195314e343f33d20d10d51c0d8 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
 #include "pitch.hh"
 #include "warn.hh"
 #include "music-sequence.hh"
+#include "scm-option.hh"
 
 Music *
 Repeated_music::body ()const
 {
-  return unsmob_music (get_mus_property ("element"));
+  return unsmob_music (get_property ("element"));
 }
 
 SCM
 Repeated_music::alternatives ()const
 {
-  return get_mus_property ("elements");
+  return get_property ("elements");
 }
 
 
@@ -31,35 +32,28 @@ Repeated_music::alternatives ()const
 Pitch
 Repeated_music::to_relative_octave (Pitch p)
 {
-  if (body ())
-    p = body ()->to_relative_octave (p);
+  if (lily_1_8_relative)
+    {
+      if (body ())
+       p = body ()->to_relative_octave (p);
 
-  Pitch last = p ; 
-  if (alternatives ())
-    for (SCM s = alternatives (); gh_pair_p (s);  s = ly_cdr (s))
-      unsmob_music (ly_car (s))->to_relative_octave (p);
-     
+      Pitch last = p ; 
+      if (alternatives ())
+       {
+         lily_1_8_compatibility_used = true; 
 
-  return last;
-}
+         for (SCM s = alternatives (); ly_pair_p (s);  s = ly_cdr (s))
+           unsmob_music (ly_car (s))->to_relative_octave (p);
+       }     
 
-void
-Repeated_music::transpose (Pitch p)
-{
-  if (body ())
-    body ()->transpose (p);
-
-  Music_sequence::transpose_list (get_mus_property ("elements"), p);
+      return last;
+    }
+  else
+    {
+      return Music::to_relative_octave (p);
+    }
 }
 
-void
-Repeated_music::compress (Moment p)
-{
-  if (body ())
-    body ()->compress (p);
-
-  Music_sequence::compress_list (alternatives (), p);
-}
 
 Moment
 Repeated_music::alternatives_get_length (bool fold) const
@@ -74,7 +68,7 @@ Repeated_music::alternatives_get_length (bool fold) const
   int done =0;
 
   SCM p = alternatives ();
-  while (gh_pair_p (p) && done < repeat_count ())
+  while (ly_pair_p (p) && done < repeat_count ())
     {
       m = m + unsmob_music (ly_car (p))->get_length ();
       done ++;
@@ -96,7 +90,7 @@ Repeated_music::alternatives_volta_get_length () const
 
   Moment m;
   SCM p = alternatives ();
-  while (gh_pair_p (p))
+  while (ly_pair_p (p))
     {
       m = m + unsmob_music (ly_car (p))->get_length ();
       p = ly_cdr (p);
@@ -122,7 +116,7 @@ Repeated_music::body_get_length () const
 int
 Repeated_music::repeat_count () const
 {
-  return gh_scm2int (get_mus_property ("repeat-count"));
+  return ly_scm2int (get_property ("repeat-count"));
 }
 
 
@@ -171,13 +165,13 @@ SCM
 Repeated_music::minimum_start (SCM m)
 {
   Music * me = unsmob_music (m);
-  Music * body = unsmob_music (me->get_mus_property ("element"));
+  Music * body = unsmob_music (me->get_property ("element"));
 
   if (body)
-    return body->start_mom ().smobbed_copy();
+    return body->start_mom ().smobbed_copy ();
   else
     {
-      return Music_sequence::minimum_start (me->get_mus_property ("elements")).smobbed_copy();
+      return Music_sequence::minimum_start (me->get_property ("elements")).smobbed_copy ();
     }
 }
 
@@ -185,10 +179,10 @@ SCM
 Repeated_music::first_start (SCM m)
 {
   Music * me = unsmob_music (m);
-  Music * body = unsmob_music (me->get_mus_property ("element"));
+  Music * body = unsmob_music (me->get_property ("element"));
 
   Moment rv =  (body) ? body->start_mom () :
-    Music_sequence::first_start (me->get_mus_property ("elements"));
+    Music_sequence::first_start (me->get_property ("elements"));
 
   return rv.smobbed_copy ();
 }