2 command-request.cc -- implement non-musical reqs
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "command-request.hh"
11 #include "musical-request.hh"
13 Tempo_req::Tempo_req ()
15 set_mus_property ("duration", Duration (2,0).smobbed_copy ());
19 LY_DEFINE(transpose_key_alist,"transpose-key-alist",
20 2, 0,0, (SCM l, SCM pitch),
21 "Make a new key alist of @var{l} transposed by pitch @var{pitch}")
23 SCM newlist = SCM_EOL;
24 Pitch *p = unsmob_pitch (pitch);
26 for (SCM s = l; gh_pair_p (s); s = ly_cdr (s))
28 SCM key = ly_caar (s);
29 SCM alter = ly_cdar (s);
32 Pitch orig (gh_scm2int (ly_car (key)),
33 gh_scm2int (ly_cdr (key)),
38 SCM key = gh_cons (scm_int2num (orig.get_octave ()),
39 scm_int2num (orig.notename_));
41 newlist = gh_cons (gh_cons (key, scm_int2num (orig.alteration_)),
44 else if (gh_number_p (key))
46 Pitch orig (0, gh_scm2int (key), gh_scm2int (alter));
49 key =scm_int2num (orig.notename_);
50 alter = scm_int2num (orig.alteration_);
51 newlist = gh_cons (gh_cons (key, alter), newlist);
54 return scm_reverse_x (newlist, SCM_EOL);
58 Key_change_req::transpose (Pitch p)
60 SCM pa = get_mus_property ("pitch-alist");
62 set_mus_property ("pitch-alist", transpose_key_alist (pa, p.smobbed_copy()));
67 alist_equal_p (SCM a, SCM b)
70 gh_pair_p (s); s = ly_cdr (s))
72 SCM key = ly_caar (s);
73 SCM val = ly_cdar (s);
74 SCM l = scm_assoc (key, b);
77 || !gh_equal_p ( ly_cdr (l), val))
85 Key_change_req::do_equal_b (Request const * m )const
87 Key_change_req const * kc =dynamic_cast<Key_change_req const*> (m);
91 return alist_equal_p (get_mus_property ("pitch-alist"),
92 kc->get_mus_property ("pitch-alist"));
98 Mark_req::do_equal_b (Request const * r) const
100 Mark_req const * other = dynamic_cast<Mark_req const*> (r);
101 return other && scm_equal_p (other->get_mus_property ("label"),
102 get_mus_property ("label")) == SCM_BOOL_T;
105 ADD_MUSIC(Bass_figure_req);
106 ADD_MUSIC (Arpeggio_req);
107 ADD_MUSIC (Articulation_req);
108 ADD_MUSIC (Break_req);
109 ADD_MUSIC (Breathing_sign_req);
110 ADD_MUSIC (Busy_playing_req);
111 ADD_MUSIC (Extender_req);
112 ADD_MUSIC (Glissando_req);
113 ADD_MUSIC (Hyphen_req);
114 ADD_MUSIC (Key_change_req);
115 ADD_MUSIC (Lyric_req);
116 ADD_MUSIC (Mark_req);
117 ADD_MUSIC (Melisma_playing_req);
118 ADD_MUSIC (Melisma_req);
119 ADD_MUSIC (Melodic_req);
120 ADD_MUSIC (Note_req);
121 ADD_MUSIC (Porrectus_req);
122 ADD_MUSIC (Rest_req);
123 ADD_MUSIC (Rhythmic_req);
124 ADD_MUSIC (Script_req);
125 ADD_MUSIC (Skip_req);
126 ADD_MUSIC (Span_req);
127 ADD_MUSIC (Tempo_req);
128 ADD_MUSIC (Text_script_req);
130 ADD_MUSIC (Tremolo_req);