]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/command-request.cc
release: 1.3.93
[lilypond.git] / lily / command-request.cc
index af9e706632bb07c177e7742fd152cf554e6f74b8..8ea0ef54dd175a2b63e1f3f7e40702d9137d5f14 100644 (file)
 #include "musical-request.hh"
 
 
-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;
+  set_mus_property ("type", ly_str02scm (s.ch_C()));
 }
 
-
-
 bool
 Barcheck_req::do_equal_b (Request const *r) const
 {
@@ -40,13 +23,6 @@ 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)
 {
@@ -54,14 +30,6 @@ Clef_change_req::Clef_change_req (String s)
 }
 
 
-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
 {
@@ -85,11 +53,6 @@ Tempo_req::Tempo_req ()
   dur_. durlog_i_ = 2;
 }
 
-void
-Tempo_req::do_print () const
-{
-  DEBUG_OUT << dur_.str () << " = " << metronome_i_;
-}
 
 
 bool
@@ -100,25 +63,50 @@ Tempo_req::do_equal_b (Request const *r) const
   return t&& t->dur_.length_mom ()== dur_.length_mom () && metronome_i_ == t->metronome_i_;
 }
 
-void
-Key_change_req::do_print () const
-{
-}
 
-Key_change_req::Key_change_req ()
-{
-  key_ = 0;
-}
 
-Key_change_req::Key_change_req (Key_change_req const&s)
-  : Request (s)
+
+bool
+Key_change_req::do_equal_b (Request const * req) const
 {
-  key_ = s.key_ ?  new Key_def (*s.key_) : 0;
+  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"));
 }
 
-Key_change_req::~Key_change_req ()
+
+void
+Key_change_req::transpose (Musical_pitch p)
 {
-  delete key_;
+  SCM newlist = SCM_EOL;
+  SCM pa = get_mus_property ("pitch-alist");
+  for (SCM s = pa; gh_pair_p (s); s = gh_cdr (s))
+    {
+      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);
+       }
+    }
+
+  set_mus_property ("pitch-alist", newlist);
 }
 
 Break_req::Break_req ()
@@ -126,17 +114,10 @@ Break_req::Break_req ()
 }
 
 
-
 bool
 Mark_req::do_equal_b (Request const * r) const
 {
   Mark_req const * other = dynamic_cast<Mark_req const*> (r);
-  return other && scm_equal_p (other->mark_label_,  mark_label_);
-}
-
-void
-Key_change_req::transpose (Musical_pitch p)
-{
-  key_->transpose (p);
+  return other && scm_equal_p (other->get_mus_property ("mark-label"),
+                              get_mus_property ("mark-label"));
 }
-