]> git.donarmstrong.com Git - lilypond.git/blob - lily/relative-octave-music.cc
LSR: update.
[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--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #include "music.hh"
10 #include "warn.hh"
11 #include "program-option.hh"
12
13 class Relative_octave_music
14 {
15 public:
16   DECLARE_SCHEME_CALLBACK (relative_callback, (SCM, SCM));
17   DECLARE_SCHEME_CALLBACK (no_relative_callback, (SCM, SCM));
18 };
19
20 MAKE_SCHEME_CALLBACK (Relative_octave_music, no_relative_callback, 2)
21   SCM
22 Relative_octave_music::no_relative_callback (SCM music, SCM pitch)
23 {
24   (void)music;
25   return pitch;
26 }
27
28 MAKE_SCHEME_CALLBACK (Relative_octave_music, relative_callback, 2)
29   SCM
30 Relative_octave_music::relative_callback (SCM music, SCM pitch)
31 {
32   Music *me = unsmob_music (music);
33   if (lily_1_8_relative)
34     {
35       lily_1_8_compatibility_used = true;
36       /*  last-pitch should be junked some time, when
37           we ditch 1.8 compat too.
38
39           When you do, B should start where A left off.
40
41           \relative { A \relative { ...} B }  */
42       SCM last_pitch = me->get_property ("last-pitch");
43       Pitch *ptr = unsmob_pitch (last_pitch);
44       return (ptr) ? last_pitch : pitch;
45     }
46   else
47     return pitch;
48 }
49