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 ()
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);
40 return m && m->beats_i_ == beats_i_
41 && one_beat_i_ == m->one_beat_i_;
46 Time_signature_change_req::Time_signature_change_req ()
51 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 ();
64 // && metronome_i_ == t->metronome_i_;
71 Key_change_req::do_equal_b (Request const * req) const
73 Key_change_req const * k = dynamic_cast<Key_change_req const*> (req);
74 return k && scm_equal_p (get_mus_property ("pitch-alist"), k->get_mus_property ("pitch-alist"));
79 Key_change_req::transpose (Musical_pitch p)
81 SCM newlist = SCM_EOL;
82 SCM pa = get_mus_property ("pitch-alist");
83 for (SCM s = pa; gh_pair_p (s); s = gh_cdr (s))
89 Musical_pitch orig (gh_list (gh_car (k), gh_cdr (k), gh_cdr (s), SCM_UNDEFINED));
93 SCM key = gh_cons (gh_int2scm (orig.octave_i_),
94 gh_int2scm (orig.notename_i_));
96 newlist = gh_cons (gh_cons (key, gh_int2scm (orig.accidental_i_)),
99 else if (gh_number_p (k))
101 Musical_pitch orig (gh_list (gh_int2scm (0), k, gh_cdar (s), SCM_UNDEFINED));
104 SCM key =gh_int2scm (orig.notename_i_);
105 newlist = gh_cons (gh_cons (key, gh_int2scm (orig.accidental_i_)),
110 set_mus_property ("pitch-alist", newlist);
113 Break_req::Break_req ()
119 Mark_req::do_equal_b (Request const * r) const
121 Mark_req const * other = dynamic_cast<Mark_req const*> (r);
122 return other && scm_equal_p (other->get_mus_property ("mark-label"),
123 get_mus_property ("mark-label"));