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::do_print () const
30 DEBUG_OUT << clef_str_ ;
34 Clef_change_req::Clef_change_req (String s)
41 Time_signature_change_req::do_print () const
44 DEBUG_OUT << beats_i_ << "/" << one_beat_i_;
49 Time_signature_change_req::do_equal_b (Request const *r) const
51 Time_signature_change_req const* m
52 = dynamic_cast <Time_signature_change_req const*> (r);
54 return m && m->beats_i_ == beats_i_
55 && one_beat_i_ == m->one_beat_i_;
58 Time_signature_change_req::Time_signature_change_req ()
65 Tempo_req::Tempo_req ()
72 Tempo_req::do_print () const
74 DEBUG_OUT << dur_.str () << " = " << metronome_i_;
79 Tempo_req::do_equal_b (Request const *r) const
81 Tempo_req const *t = dynamic_cast <Tempo_req const*> (r);
83 return t&& t->dur_.length_mom ()== dur_.length_mom () && metronome_i_ == t->metronome_i_;
90 Key_change_req::do_equal_b (Request const * req) const
92 Key_change_req const * k = dynamic_cast<Key_change_req const*> (req);
93 return k && scm_equal_p (get_mus_property ("pitch-alist"), k->get_mus_property ("pitch-alist"));
98 Key_change_req::transpose (Musical_pitch p)
100 SCM newlist = SCM_EOL;
101 SCM pa = get_mus_property ("pitch-alist");
102 for (SCM s = pa; gh_pair_p (s); s = gh_cdr (s))
108 Musical_pitch orig (gh_list (gh_car (k), gh_cdr (k), gh_cdr (s), SCM_UNDEFINED));
112 SCM key = gh_cons (gh_int2scm (orig.octave_i_),
113 gh_int2scm (orig.notename_i_));
115 newlist = gh_cons (gh_cons (key, gh_int2scm (orig.accidental_i_)),
118 else if (gh_number_p (k))
120 Musical_pitch orig (gh_list (gh_int2scm (0), k, gh_cdar (s), SCM_UNDEFINED));
123 SCM key =gh_int2scm (orig.notename_i_);
124 newlist = gh_cons (gh_cons (key, gh_int2scm (orig.accidental_i_)),
129 set_mus_property ("pitch-alist", newlist);
132 Break_req::Break_req ()
138 Mark_req::do_equal_b (Request const * r) const
140 Mark_req const * other = dynamic_cast<Mark_req const*> (r);
141 return other && scm_equal_p (other->get_mus_property ("mark-label"),
142 get_mus_property ("mark-label"));