2 command-request.cc -- implement non-musical reqs
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "command-request.hh"
11 #include "musical-request.hh"
14 Bar_req::Bar_req (String s)
16 set_mus_property ("type", ly_str02scm (s.ch_C()));
20 Barcheck_req::do_equal_b (Request const *r) const
22 Barcheck_req const*b = dynamic_cast<Barcheck_req const*> (r);
27 Clef_change_req::Clef_change_req (String s)
34 Time_signature_change_req::do_equal_b (Request const *r) const
36 Time_signature_change_req const* m
37 = dynamic_cast <Time_signature_change_req const*> (r);
39 return m && m->beats_i_ == beats_i_
40 && one_beat_i_ == m->one_beat_i_;
43 Time_signature_change_req::Time_signature_change_req ()
50 Tempo_req::Tempo_req ()
59 Tempo_req::do_equal_b (Request const *r) const
61 Tempo_req const *t = dynamic_cast <Tempo_req const*> (r);
63 return t&& t->dur_.length_mom ()== dur_.length_mom () && metronome_i_ == t->metronome_i_;
70 Key_change_req::do_equal_b (Request const * req) const
72 Key_change_req const * k = dynamic_cast<Key_change_req const*> (req);
73 return k && scm_equal_p (get_mus_property ("pitch-alist"), k->get_mus_property ("pitch-alist"));
78 Key_change_req::transpose (Musical_pitch p)
80 SCM newlist = SCM_EOL;
81 SCM pa = get_mus_property ("pitch-alist");
82 for (SCM s = pa; gh_pair_p (s); s = gh_cdr (s))
88 Musical_pitch orig (gh_list (gh_car (k), gh_cdr (k), gh_cdr (s), SCM_UNDEFINED));
92 SCM key = gh_cons (gh_int2scm (orig.octave_i_),
93 gh_int2scm (orig.notename_i_));
95 newlist = gh_cons (gh_cons (key, gh_int2scm (orig.accidental_i_)),
98 else if (gh_number_p (k))
100 Musical_pitch orig (gh_list (gh_int2scm (0), k, gh_cdar (s), SCM_UNDEFINED));
103 SCM key =gh_int2scm (orig.notename_i_);
104 newlist = gh_cons (gh_cons (key, gh_int2scm (orig.accidental_i_)),
109 set_mus_property ("pitch-alist", newlist);
112 Break_req::Break_req ()
118 Mark_req::do_equal_b (Request const * r) const
120 Mark_req const * other = dynamic_cast<Mark_req const*> (r);
121 return other && scm_equal_p (other->get_mus_property ("mark-label"),
122 get_mus_property ("mark-label"));