]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.60
authorfred <fred>
Tue, 26 Mar 2002 23:23:05 +0000 (23:23 +0000)
committerfred <fred>
Tue, 26 Mar 2002 23:23:05 +0000 (23:23 +0000)
lily/command-request.cc
lily/include/command-request.hh
lily/include/key-def.hh
lily/include/newkey-def.hh
lily/key-engraver.cc
lily/key-performer.cc
lily/newkey-def.cc

index fea2de22a4a8bdd6e6af1c873290b3d19e22fce1..92143f8a5554482515790b60b4a088bb21ad7870 100644 (file)
@@ -98,25 +98,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 Newkey_def (*s.key_) : 0;
+  Key_change_req const * k = dynamic_cast<Key_change_req const*> (req);
+  return k && scm_equal_p (pitch_alist_, k->pitch_alist_);
 }
 
-Key_change_req::~Key_change_req ()
+
+
+void
+Key_change_req::transpose (Musical_pitch p)
 {
-  delete key_;
+  SCM newlist = SCM_EOL;
+  for (SCM s = pitch_alist_; 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);
+       }
+    }
+
+  pitch_alist_ = newlist;
 }
 
 Break_req::Break_req ()
@@ -131,10 +156,3 @@ 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);
-}
-
index a79e71132510f44142570ca3c2d6991170057003..845598a3ad96cf0fa273356cb743b46647a288c1 100644 (file)
@@ -14,7 +14,6 @@
 #include "array.hh"
 #include "duration.hh"
 #include "musical-pitch.hh"
-#include "newkey-def.hh"
 #include "protected-scm.hh"
 
 class Break_req : public Request {
@@ -99,24 +98,16 @@ class Breathing_sign_req : public Request {
 
 /**
     Handle key changes.
-    Routines for sharps and flats are separated, 
-    so that caller may identify non-conventional keys.
 */
-/*
-  UGH!
- */
 class Key_change_req  : public Request
 {
 public:
-  Key_change_req ();
-  ~Key_change_req();
-  Key_change_req(Key_change_req const &);
-  Newkey_def *key_;
+  Protected_scm pitch_alist_;
 
 protected:
   VIRTUAL_COPY_CONS(Music);
   void transpose (Musical_pitch  d);
-  virtual void do_print () const;
+  bool do_equal_b (Request const * )const; 
 };
 
 class Clef_change_req  : public Request  {
index 65296f81060baccd891380179b283fc7515acef0..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,2 +0,0 @@
-
-#error
index dfa20c6c6b48c4d25db19cd03a483fa091e3e959..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,36 +0,0 @@
-/*   
-  newkey-def.hh -- declare Newkey_def
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
-
-#ifndef NEWKEY_DEF_HH
-#define NEWKEY_DEF_HH
-
-#include "protected-scm.hh"
-#include "musical-pitch.hh"
-
-class Newkey_def
-{
-
-public:
-  Protected_scm  pitch_alist_;
-
-  Newkey_def();
-  
-  /// return number of flats in key
-  int flats_i () const;
-
-  /// return number of sharps in key
-  int sharps_i () const;
-  int accs_i (int) const;
-  
-  void transpose (Musical_pitch d);
-};
-
-#endif /* NEWKEY_DEF_HH */
-
-
index d5091eb70f61d2071dd5fe696121a44e891cb8d5..64f4e4f0a59e3778e7a1de17936ef585d485b515 100644 (file)
@@ -6,7 +6,6 @@
   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   */
 
-
 #include "key-item.hh"
 #include "command-request.hh"
 #include "musical-request.hh"
@@ -139,10 +138,10 @@ Key_engraver::do_pre_move_processing ()
 void
 Key_engraver::read_req (Key_change_req const * r)
 {
-  if (!r->key_)
+  if (r->pitch_alist_ == SCM_UNDEFINED)
     return;
 
-  SCM n = scm_list_copy (r->key_->pitch_alist_);
+  SCM n = scm_list_copy (r->pitch_alist_);
   SCM accs = SCM_EOL;
   for (SCM s = get_property ("keyAccidentalOrder");
        gh_pair_p (s); s = gh_cdr (s))
index 81fa1c5296eced08330422c4dab90e04665a09d7..b55210a4487d60e37f598f9e37f47e2acf81b4a2 100644 (file)
@@ -26,7 +26,7 @@ Key_performer::~Key_performer ()
 void
 Key_performer::do_process_music ()
 {
-  if (key_req_l_ && key_req_l_->key_)
+  if (key_req_l_ && key_req_l_->pitch_alist_ != SCM_UNDEFINED)
     {
       audio_p_ = new Audio_key (); // *key_req_l_->key_);
       Audio_element_info info (audio_p_, key_req_l_);
index 6d8e5836f8bc2aacdbf578a355d7d8be672e170c..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,51 +0,0 @@
-/*   
-  newkey-def.cc --  implement Newkey_def
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
-
-#include "newkey-def.hh"
-#include "misc.hh"
-
-
-Newkey_def::Newkey_def()
-{
-  pitch_alist_ = SCM_EOL;
-}
-
-void
-Newkey_def::transpose (Musical_pitch p) 
-{
-  SCM newlist = SCM_EOL;
-  for (SCM s = pitch_alist_; 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);
-       }
-    }
-
-  pitch_alist_ = newlist;
-}