]> git.donarmstrong.com Git - lilypond.git/blob - lily/relative-octave-music.cc
* lily/include/repeated-music.hh (class Repeated_music): change
[lilypond.git] / lily / relative-octave-music.cc
1 /*   
2   relative-music.cc --  implement Relative_octave_music
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #include "music.hh"
11 #include "pitch.hh"
12 #include "warn.hh"
13 #include "scm-option.hh"
14
15
16 class Relative_octave_music
17 {
18 public:
19   DECLARE_SCHEME_CALLBACK(relative_callback,(SCM,SCM));
20   DECLARE_SCHEME_CALLBACK(no_relative_callback,(SCM,SCM));
21 };
22
23 MAKE_SCHEME_CALLBACK(Relative_octave_music,no_relative_callback,2)
24 SCM
25 Relative_octave_music::no_relative_callback (SCM music, SCM pitch)
26 {
27   (void)music;
28   return pitch;
29 }
30
31 MAKE_SCHEME_CALLBACK(Relative_octave_music,relative_callback,2)
32 SCM
33 Relative_octave_music::relative_callback (SCM music, SCM pitch)
34 {
35   Music *me = unsmob_music (music);
36   if (lily_1_8_relative)
37     {
38       lily_1_8_compatibility_used = true;
39       /*  last-pitch should be junked some time, when
40           we ditch 1.8 compat too.
41
42          When you do, B should start where A left off.
43
44         \relative { A \relative { ...} B }  */
45       SCM last_pitch = me->get_property ("last-pitch");
46       Pitch *ptr = unsmob_pitch (last_pitch);
47       return (ptr) ?  last_pitch : pitch;
48     }
49   else
50     return pitch;
51 }
52
53