]> git.donarmstrong.com Git - lilypond.git/blob - lily/command-request.cc
ea7e0a4a20cdad1578ae20cf289c636707285ec8
[lilypond.git] / lily / command-request.cc
1 /*
2   command-request.cc -- implement non-musical reqs
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "command-request.hh"
10 #include "debug.hh"
11 #include "musical-request.hh"
12
13 bool
14 Barcheck_req::do_equal_b (Request const *r) const
15 {
16   Barcheck_req  const*b = dynamic_cast<Barcheck_req const*> (r);
17   return b;
18 }
19
20 Tempo_req::Tempo_req ()
21 {
22   set_mus_property ("duration", Duration (2,0).smobbed_copy ());
23 }
24
25 void
26 Key_change_req::transpose (Pitch p)
27 {
28   SCM newlist = SCM_EOL;
29   SCM pa = get_mus_property ("pitch-alist");
30   for (SCM s = pa; gh_pair_p (s); s = gh_cdr (s))
31     {
32       SCM key = gh_caar (s);
33       SCM alter = gh_cdar (s);
34       if (gh_pair_p (key))
35         {
36           Pitch orig (gh_scm2int (gh_car (key)),
37                               gh_scm2int (gh_cdr (key)),
38                               gh_scm2int (alter));
39
40           orig.transpose (p);
41
42           SCM key = gh_cons (gh_int2scm (orig.octave_i ()),
43                              gh_int2scm (orig.notename_i_));
44
45           newlist = gh_cons (gh_cons (key, gh_int2scm (orig.alteration_i_)),
46                              newlist);
47         }
48       else if (gh_number_p (key))
49         {
50           Pitch orig (0, gh_scm2int (key), gh_scm2int (alter));
51           orig.transpose (p);
52
53           key =gh_int2scm (orig.notename_i_);
54           alter = gh_int2scm (orig.alteration_i_);
55           newlist = gh_cons (gh_cons (key, alter), newlist);
56         }
57     }
58
59   set_mus_property ("pitch-alist", newlist);
60 }
61
62 Break_req::Break_req ()
63 {
64 }
65
66
67 bool
68 Mark_req::do_equal_b (Request const * r) const
69 {
70   Mark_req const * other = dynamic_cast<Mark_req const*> (r);
71   return other && scm_equal_p (other->get_mus_property ("mark-label"),
72                                get_mus_property ("mark-label")) == SCM_BOOL_T;
73 }
74
75
76 ADD_MUSIC (Articulation_req);
77 ADD_MUSIC (Barcheck_req);
78 ADD_MUSIC (Break_req);
79 ADD_MUSIC (Breathing_sign_req);
80 ADD_MUSIC (Busy_playing_req);
81 ADD_MUSIC (Extender_req);
82 ADD_MUSIC (Glissando_req);
83 ADD_MUSIC (Hyphen_req);
84 ADD_MUSIC (Key_change_req);
85 ADD_MUSIC (Lyric_req);
86 ADD_MUSIC (Mark_req);
87 ADD_MUSIC (Melisma_playing_req);
88 ADD_MUSIC (Melisma_req);
89 ADD_MUSIC (Melodic_req);
90 ADD_MUSIC (Note_req);
91 ADD_MUSIC (Rest_req);
92 ADD_MUSIC (Rhythmic_req);
93 ADD_MUSIC (Script_req);
94 ADD_MUSIC (Skip_req);
95 ADD_MUSIC (Span_req);
96 ADD_MUSIC (Tempo_req);
97 ADD_MUSIC (Text_script_req);
98 ADD_MUSIC (Tie_req);
99 ADD_MUSIC (Tremolo_req);