source file of the GNU LilyPond music typesetter
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "command-request.hh"
#include "debug.hh"
#include "musical-request.hh"
-void
-Cadenza_req::do_print () const
-{
-#ifndef NPRINT
- DOUT << (int)on_b_;
-#endif
-}
-
-bool
-Cadenza_req::do_equal_b (Request*r) const
-{
- Cadenza_req*cad = dynamic_cast <Cadenza_req *> (r);
- return cad && cad->on_b_ == on_b_;
-}
-
-Cadenza_req::Cadenza_req (bool b)
-{
- on_b_ =b;
-}
-
-
-
-bool
-Bar_req::do_equal_b (Request*r) const
-{
- Bar_req * b = dynamic_cast <Bar_req *> (r);
- return b && type_str_ == b->type_str_;
-}
-
-void
-Bar_req::do_print () const
-{
-#ifndef NPRINT
- DOUT << type_str_;
-#endif
-}
Bar_req::Bar_req (String s)
{
- type_str_ = s;
-}
-
-Partial_measure_req::Partial_measure_req (Moment m)
-{
- length_mom_ =m;
-}
-
-bool
-Partial_measure_req::do_equal_b (Request* r) const
-{
- Partial_measure_req *p = dynamic_cast <Partial_measure_req *> (r);
-
- return p&& p->length_mom_ == length_mom_;
+ set_mus_property ("type", ly_str02scm (s.ch_C()));
}
bool
-Barcheck_req::do_equal_b (Request*r) const
+Barcheck_req::do_equal_b (Request const *r) const
{
- Barcheck_req *b = dynamic_cast<Barcheck_req*> (r);
+ Barcheck_req const*b = dynamic_cast<Barcheck_req const*> (r);
return b;
}
-void
-Clef_change_req::do_print () const
-{
-#ifndef NPRINT
- DOUT << clef_str_ ;
-#endif
-}
Clef_change_req::Clef_change_req (String s)
{
clef_str_ = s;
}
-void
-Partial_measure_req::do_print () const
-{
- DOUT << length_mom_;
-}
-
-void
-Time_signature_change_req::do_print () const
-{
-#ifndef NPRINT
- DOUT << beats_i_ << "/" << one_beat_i_;
-#endif
-}
bool
-Time_signature_change_req::do_equal_b (Request * r) const
+Time_signature_change_req::do_equal_b (Request const *r) const
{
- Time_signature_change_req * m
- = dynamic_cast <Time_signature_change_req *> (r);
+ Time_signature_change_req const* m
+ = dynamic_cast <Time_signature_change_req const*> (r);
return m && m->beats_i_ == beats_i_
&& one_beat_i_ == m->one_beat_i_;
dur_. durlog_i_ = 2;
}
-void
-Tempo_req::do_print () const
-{
- DOUT << dur_.str () << " = " << metronome_i_;
-}
bool
-Tempo_req::do_equal_b (Request *r) const
+Tempo_req::do_equal_b (Request const *r) const
{
- Tempo_req *t = dynamic_cast <Tempo_req *> (r);
+ Tempo_req const *t = dynamic_cast <Tempo_req const*> (r);
return t&& t->dur_.length_mom ()== dur_.length_mom () && metronome_i_ == t->metronome_i_;
}
+bool
+Key_change_req::do_equal_b (Request const * req) const
+{
+ Key_change_req const * k = dynamic_cast<Key_change_req const*> (req);
+ return k && scm_equal_p (get_mus_property ("pitch-alist"), k->get_mus_property ("pitch-alist"));
+}
+
+
void
-Key_change_req::do_print () const
+Key_change_req::transpose (Musical_pitch p)
{
-#ifndef NPRINT
- for (int i=0; i < key_.pitch_arr_.size (); i++)
+ SCM newlist = SCM_EOL;
+ SCM pa = get_mus_property ("pitch-alist");
+ for (SCM s = pa; gh_pair_p (s); s = gh_cdr (s))
{
- key_.pitch_arr_[i].print ();
+ SCM k = gh_caar (s);
+
+ if (gh_pair_p (k))
+ {
+ Musical_pitch orig (gh_list (gh_car (k), gh_cdr (k), gh_cdr (s), SCM_UNDEFINED));
+
+ orig.transpose (p);
+
+ SCM key = gh_cons (gh_int2scm (orig.octave_i_),
+ gh_int2scm (orig.notename_i_));
+
+ newlist = gh_cons (gh_cons (key, gh_int2scm (orig.accidental_i_)),
+ newlist);
+ }
+ else if (gh_number_p (k))
+ {
+ Musical_pitch orig (gh_list (gh_int2scm (0), k, gh_cdar (s), SCM_UNDEFINED));
+ orig.transpose (p);
+
+ SCM key =gh_int2scm (orig.notename_i_);
+ newlist = gh_cons (gh_cons (key, gh_int2scm (orig.accidental_i_)),
+ newlist);
+ }
}
-#endif
-}
-Key_change_req::Key_change_req ()
-{
+ set_mus_property ("pitch-alist", newlist);
}
Break_req::Break_req ()
{
- penalty_i_ = 0;
}
-Mark_req::Mark_req (String s)
-{
- str_ = s;
-}
-void
-Mark_req::do_print () const
-{
- DOUT << str_;
-}
-void
-Key_change_req::transpose (Musical_pitch p)
+bool
+Mark_req::do_equal_b (Request const * r) const
{
- key_.transpose (p);
+ Mark_req const * other = dynamic_cast<Mark_req const*> (r);
+ return other && scm_equal_p (other->get_mus_property ("mark-label"),
+ get_mus_property ("mark-label"));
}
-
-
-