]> git.donarmstrong.com Git - lilypond.git/blob - lily/repeated-music.cc
patch::: 1.1.6.jcn1: pats
[lilypond.git] / lily / repeated-music.cc
1 /*   
2   repeated-music.cc --  implement Repeated_music
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
7   
8  */
9
10 #include "repeated-music.hh"
11 #include "music-wrapper.hh"
12 #include "music-list.hh"
13
14 Repeated_music::Repeated_music (Music_wrapper *r, int n, Sequential_music* a)
15 {
16   repeats_i_ = n;
17   repeat_p_ = r;
18   alternative_p_ = a;
19 }
20
21 Repeated_music::~Repeated_music ()
22 {
23   delete repeat_p_;
24   delete alternative_p_;
25 }
26
27 Repeated_music::Repeated_music (Repeated_music const& s)
28   : Music (s)
29 {
30 #if 0
31  // urg?
32   repeat_p_ = (Music_wrapper*)(s.repeat_p_) ? s.repeat_p_->clone () : 0;
33   alternative_p_ = (Sequential_music*)(s.alternative_p_) ? s.alternative_p_->clone () : 0;
34 #endif 
35 }
36
37 void
38 Repeated_music::do_print () const
39 {
40   if (repeat_p_)
41     repeat_p_->print ();
42   if (alternative_p_)
43     alternative_p_->print ();
44 }
45
46 void
47 Repeated_music::transpose (Musical_pitch p)
48 {
49   if (repeat_p_)
50     repeat_p_->transpose (p);
51   if (alternative_p_)
52     alternative_p_->transpose (p);
53 }
54
55 Moment
56 Repeated_music::duration () const
57 {
58   Moment m;
59   if (repeat_p_)
60     m += repeat_p_->duration ();
61   if (alternative_p_)
62     m += alternative_p_->duration ();
63   return m;
64 }