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"
15 Barcheck_req::do_equal_b (Request
const *r
) const
17 Barcheck_req
const*b
= dynamic_cast<Barcheck_req
const*> (r
);
24 Tempo_req::Tempo_req ()
26 set_mus_property ("duration", Duration(2,0).smobbed_copy ());
32 Tempo_req::do_equal_b (Request
const *r
) const
34 Tempo_req
const *t
= dynamic_cast <Tempo_req
const*> (r
);
36 return t
; // && t->dur_.length_mom ()== dur_.length_mom ();
37 // && metronome_i_ == t->metronome_i_;
44 Key_change_req::do_equal_b (Request
const * req
) const
46 Key_change_req
const * k
= dynamic_cast<Key_change_req
const*> (req
);
47 return k
&& scm_equal_p (get_mus_property ("pitch-alist"), k
->get_mus_property ("pitch-alist")) == SCM_BOOL_T
;
52 Key_change_req::transpose (Pitch p
)
54 SCM newlist
= SCM_EOL
;
55 SCM pa
= get_mus_property ("pitch-alist");
56 for (SCM s
= pa
; gh_pair_p (s
); s
= gh_cdr (s
))
58 SCM key
= gh_caar (s
);
59 SCM alter
= gh_cdar (s
);
62 Pitch
orig (gh_scm2int (gh_car (key
)),
63 gh_scm2int (gh_cdr (key
)),
68 SCM key
= gh_cons (gh_int2scm (orig
.octave_i () ),
69 gh_int2scm (orig
.notename_i_
));
71 newlist
= gh_cons (gh_cons (key
, gh_int2scm (orig
.alteration_i_
)),
74 else if (gh_number_p (key
))
76 Pitch
orig (0, gh_scm2int (key
), gh_scm2int (alter
));
79 key
=gh_int2scm (orig
.notename_i_
);
80 alter
= gh_int2scm (orig
.alteration_i_
);
81 newlist
= gh_cons (gh_cons (key
, alter
), newlist
);
85 set_mus_property ("pitch-alist", newlist
);
88 Break_req::Break_req ()
94 Mark_req::do_equal_b (Request
const * r
) const
96 Mark_req
const * other
= dynamic_cast<Mark_req
const*> (r
);
97 return other
&& scm_equal_p (other
->get_mus_property ("mark-label"),
98 get_mus_property ("mark-label")) == SCM_BOOL_T
;