]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/command-request.cc
release: 1.3.93
[lilypond.git] / lily / command-request.cc
index 35f0cdac4c10295d10d1d83e289f996350405c1d..8ea0ef54dd175a2b63e1f3f7e40702d9137d5f14 100644 (file)
@@ -3,66 +3,17 @@
 
   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
-  DEBUG_OUT << (int)on_b_;
-#endif
-}
-
-bool
-Cadenza_req::do_equal_b (Request const *r) const
-{
-  Cadenza_req const*cad =  dynamic_cast <Cadenza_req const *> (r);
-  return cad && cad->on_b_ == on_b_;
-}
-
-Cadenza_req::Cadenza_req (bool b)
-{
-  on_b_ =b;
-}
-
-
-
-bool
-Bar_req::do_equal_b (Request const *r) const
-{
-  Bar_req  const* b = dynamic_cast <Bar_req const *> (r);
-  return b && type_str_ == b->type_str_;
-}
-
-void
-Bar_req::do_print () const
-{
-#ifndef NPRINT
-  DEBUG_OUT << 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 const* r) const
-{
-  Partial_measure_req  const*p = dynamic_cast <Partial_measure_req  const*> (r);
-
-  return p&& p->length_mom_ == length_mom_;
+  set_mus_property ("type", ly_str02scm (s.ch_C()));
 }
 
 bool
@@ -72,32 +23,12 @@ Barcheck_req::do_equal_b (Request const *r) const
   return b;
 }
 
-void
-Clef_change_req::do_print () const
-{
-#ifndef NPRINT
-  DEBUG_OUT << clef_str_ ;
-#endif
-}
 
 Clef_change_req::Clef_change_req (String s)
 {
   clef_str_ = s;
 }
 
-void
-Partial_measure_req::do_print () const
-{
-  DEBUG_OUT << length_mom_;
-}
-
-void
-Time_signature_change_req::do_print () const
-{
-#ifndef NPRINT
-  DEBUG_OUT << beats_i_ << "/" << one_beat_i_;
-#endif
-}
 
 bool
 Time_signature_change_req::do_equal_b (Request const *r) const
@@ -122,11 +53,6 @@ Tempo_req::Tempo_req ()
   dur_. durlog_i_ = 2;
 }
 
-void
-Tempo_req::do_print () const
-{
-  DEBUG_OUT << dur_.str () << " = " << metronome_i_;
-}
 
 
 bool
@@ -140,40 +66,58 @@ Tempo_req::do_equal_b (Request const *r) const
 
 
 
+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 ()
 {
 }
 
-Mark_req::Mark_req (String s)
-{
-  str_ = s;
-}
 
-void
-Mark_req::do_print () const
-{
-  DEBUG_OUT << 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"));
 }
-
-
-