]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/command-request.cc
patch::: 1.3.141.jcn3
[lilypond.git] / lily / command-request.cc
index 68016b6683e80d7b9d9df7628f78390168014aa6..ea7e0a4a20cdad1578ae20cf289c636707285ec8 100644 (file)
@@ -3,36 +3,13 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "command-request.hh"
 #include "debug.hh"
 #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;
-}
-
-
-
 bool
 Barcheck_req::do_equal_b (Request const *r) const
 {
@@ -40,108 +17,83 @@ 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
-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
-{
-  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_;
-}
-
-Time_signature_change_req::Time_signature_change_req ()
-{
-  beats_i_ = 0;
-  one_beat_i_ =0;
-}
-
-
 Tempo_req::Tempo_req ()
 {
-  metronome_i_ = 60;
-  dur_. durlog_i_ = 2;
-}
-
-void
-Tempo_req::do_print () const
-{
-  DEBUG_OUT << dur_.str () << " = " << metronome_i_;
-}
-
-
-bool
-Tempo_req::do_equal_b (Request const *r) const
-{
-  Tempo_req const *t = dynamic_cast <Tempo_req const*> (r);
-
-  return t&& t->dur_.length_mom ()== dur_.length_mom () && metronome_i_ == t->metronome_i_;
+  set_mus_property ("duration", Duration (2,0).smobbed_copy ());
 }
 
-
-
-
 void
-Key_change_req::do_print () const
-{
-#if 0
-  key_->print();
-#endif
-}
-
-Key_change_req::Key_change_req ()
-{
-  key_ = 0;
-}
-Key_change_req::Key_change_req (Key_change_req const&s)
-  : Request (s)
-{
-  key_ = new Key_def (*s.key_);
-}
-Key_change_req::~Key_change_req ()
-{
-  delete key_;
+Key_change_req::transpose (Pitch p)
+{
+  SCM newlist = SCM_EOL;
+  SCM pa = get_mus_property ("pitch-alist");
+  for (SCM s = pa; gh_pair_p (s); s = gh_cdr (s))
+    {
+      SCM key = gh_caar (s);
+      SCM alter = gh_cdar (s);
+      if (gh_pair_p (key))
+       {
+         Pitch orig (gh_scm2int (gh_car (key)),
+                             gh_scm2int (gh_cdr (key)),
+                             gh_scm2int (alter));
+
+         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.alteration_i_)),
+                            newlist);
+       }
+      else if (gh_number_p (key))
+       {
+         Pitch orig (0, gh_scm2int (key), gh_scm2int (alter));
+         orig.transpose (p);
+
+         key =gh_int2scm (orig.notename_i_);
+         alter = gh_int2scm (orig.alteration_i_);
+         newlist = gh_cons (gh_cons (key, alter), newlist);
+       }
+    }
+
+  set_mus_property ("pitch-alist", newlist);
 }
 
-
 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")) == SCM_BOOL_T;
+}
+
+
+ADD_MUSIC (Articulation_req);
+ADD_MUSIC (Barcheck_req);
+ADD_MUSIC (Break_req);
+ADD_MUSIC (Breathing_sign_req);
+ADD_MUSIC (Busy_playing_req);
+ADD_MUSIC (Extender_req);
+ADD_MUSIC (Glissando_req);
+ADD_MUSIC (Hyphen_req);
+ADD_MUSIC (Key_change_req);
+ADD_MUSIC (Lyric_req);
+ADD_MUSIC (Mark_req);
+ADD_MUSIC (Melisma_playing_req);
+ADD_MUSIC (Melisma_req);
+ADD_MUSIC (Melodic_req);
+ADD_MUSIC (Note_req);
+ADD_MUSIC (Rest_req);
+ADD_MUSIC (Rhythmic_req);
+ADD_MUSIC (Script_req);
+ADD_MUSIC (Skip_req);
+ADD_MUSIC (Span_req);
+ADD_MUSIC (Tempo_req);
+ADD_MUSIC (Text_script_req);
+ADD_MUSIC (Tie_req);
+ADD_MUSIC (Tremolo_req);